hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/codecs/rt274.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * rt274.c -- RT274 ALSA SoC audio codec driver
34 *
45 * Copyright 2017 Realtek Semiconductor Corp.
56 * Author: Bard Liao <bardliao@realtek.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118
129 #include <linux/module.h>
....@@ -353,6 +350,7 @@
353350 static int rt274_jack_detect(struct rt274_priv *rt274, bool *hp, bool *mic)
354351 {
355352 unsigned int buf;
353
+ int ret;
356354
357355 *hp = false;
358356 *mic = false;
....@@ -360,9 +358,15 @@
360358 if (!rt274->component)
361359 return -EINVAL;
362360
363
- regmap_read(rt274->regmap, RT274_GET_HP_SENSE, &buf);
361
+ ret = regmap_read(rt274->regmap, RT274_GET_HP_SENSE, &buf);
362
+ if (ret)
363
+ return ret;
364
+
364365 *hp = buf & 0x80000000;
365
- regmap_read(rt274->regmap, RT274_GET_MIC_SENSE, &buf);
366
+ ret = regmap_read(rt274->regmap, RT274_GET_MIC_SENSE, &buf);
367
+ if (ret)
368
+ return ret;
369
+
366370 *mic = buf & 0x80000000;
367371
368372 pr_debug("*hp = %d *mic = %d\n", *hp, *mic);
....@@ -381,10 +385,10 @@
381385 if (rt274_jack_detect(rt274, &hp, &mic) < 0)
382386 return;
383387
384
- if (hp == true)
388
+ if (hp)
385389 status |= SND_JACK_HEADPHONE;
386390
387
- if (mic == true)
391
+ if (mic)
388392 status |= SND_JACK_MICROPHONE;
389393
390394 snd_soc_jack_report(rt274->jack, status,
....@@ -756,6 +760,7 @@
756760 break;
757761 default:
758762 dev_warn(component->dev, "invalid pll source, use BCLK\n");
763
+ fallthrough;
759764 case RT274_PLL2_S_BCLK:
760765 snd_soc_component_update_bits(component, RT274_PLL2_CTRL,
761766 RT274_PLL2_SRC_MASK, RT274_PLL2_SRC_BCLK);
....@@ -783,6 +788,7 @@
783788 break;
784789 default:
785790 dev_warn(component->dev, "invalid freq_in, assume 4.8M\n");
791
+ fallthrough;
786792 case 100:
787793 snd_soc_component_write(component, 0x7a, 0xaab6);
788794 snd_soc_component_write(component, 0x7b, 0x0301);
....@@ -954,10 +960,10 @@
954960 ret = rt274_jack_detect(rt274, &hp, &mic);
955961
956962 if (ret == 0) {
957
- if (hp == true)
963
+ if (hp)
958964 status |= SND_JACK_HEADPHONE;
959965
960
- if (mic == true)
966
+ if (mic)
961967 status |= SND_JACK_MICROPHONE;
962968
963969 snd_soc_jack_report(rt274->jack, status,
....@@ -1099,12 +1105,14 @@
10991105 };
11001106 MODULE_DEVICE_TABLE(i2c, rt274_i2c_id);
11011107
1108
+#ifdef CONFIG_ACPI
11021109 static const struct acpi_device_id rt274_acpi_match[] = {
11031110 { "10EC0274", 0 },
11041111 { "INT34C2", 0 },
11051112 {},
11061113 };
11071114 MODULE_DEVICE_TABLE(acpi, rt274_acpi_match);
1115
+#endif
11081116
11091117 static int rt274_i2c_probe(struct i2c_client *i2c,
11101118 const struct i2c_device_id *id)