hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/codecs/rt5665.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * rt5665.c -- RT5665/RT5658 ALSA SoC audio codec driver
34 *
45 * Copyright 2016 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>
....@@ -1003,7 +1000,7 @@
10031000 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
10041001 int ret = snd_soc_put_volsw(kcontrol, ucontrol);
10051002
1006
- if (snd_soc_component_read32(component, RT5665_STO_NG2_CTRL_1) & RT5665_NG2_EN) {
1003
+ if (snd_soc_component_read(component, RT5665_STO_NG2_CTRL_1) & RT5665_NG2_EN) {
10071004 snd_soc_component_update_bits(component, RT5665_STO_NG2_CTRL_1,
10081005 RT5665_NG2_EN_MASK, RT5665_NG2_DIS);
10091006 snd_soc_component_update_bits(component, RT5665_STO_NG2_CTRL_1,
....@@ -1019,7 +1016,7 @@
10191016 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
10201017 int ret = snd_soc_put_volsw(kcontrol, ucontrol);
10211018
1022
- if (snd_soc_component_read32(component, RT5665_MONO_NG2_CTRL_1) & RT5665_NG2_EN) {
1019
+ if (snd_soc_component_read(component, RT5665_MONO_NG2_CTRL_1) & RT5665_NG2_EN) {
10231020 snd_soc_component_update_bits(component, RT5665_MONO_NG2_CTRL_1,
10241021 RT5665_NG2_EN_MASK, RT5665_NG2_DIS);
10251022 snd_soc_component_update_bits(component, RT5665_MONO_NG2_CTRL_1,
....@@ -1129,7 +1126,7 @@
11291126 {
11301127 int btn_type, val;
11311128
1132
- val = snd_soc_component_read32(component, RT5665_4BTN_IL_CMD_1);
1129
+ val = snd_soc_component_read(component, RT5665_4BTN_IL_CMD_1);
11331130 btn_type = val & 0xfff0;
11341131 snd_soc_component_write(component, RT5665_4BTN_IL_CMD_1, val);
11351132
....@@ -1201,7 +1198,7 @@
12011198
12021199 usleep_range(10000, 15000);
12031200
1204
- rt5665->sar_adc_value = snd_soc_component_read32(rt5665->component,
1201
+ rt5665->sar_adc_value = snd_soc_component_read(rt5665->component,
12051202 RT5665_SAR_IL_CMD_4) & 0x7ff;
12061203
12071204 sar_hs_type = rt5665->pdata.sar_hs_type ?
....@@ -1248,7 +1245,7 @@
12481245 struct rt5665_priv *rt5665 = container_of(work, struct rt5665_priv,
12491246 jd_check_work.work);
12501247
1251
- if (snd_soc_component_read32(rt5665->component, RT5665_AJD1_CTRL) & 0x0010) {
1248
+ if (snd_soc_component_read(rt5665->component, RT5665_AJD1_CTRL) & 0x0010) {
12521249 /* jack out */
12531250 rt5665->jack_type = rt5665_headset_detect(rt5665->component, 0);
12541251
....@@ -1313,7 +1310,7 @@
13131310
13141311 mutex_lock(&rt5665->calibrate_mutex);
13151312
1316
- val = snd_soc_component_read32(rt5665->component, RT5665_AJD1_CTRL) & 0x0010;
1313
+ val = snd_soc_component_read(rt5665->component, RT5665_AJD1_CTRL) & 0x0010;
13171314 if (!val) {
13181315 /* jack in */
13191316 if (rt5665->jack_type == 0) {
....@@ -1481,7 +1478,7 @@
14811478 {
14821479 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
14831480 struct rt5665_priv *rt5665 = snd_soc_component_get_drvdata(component);
1484
- int pd, idx = -EINVAL;
1481
+ int pd, idx;
14851482
14861483 pd = rl6231_get_pre_div(rt5665->regmap,
14871484 RT5665_ADDA_CLK_1, RT5665_I2S_PD1_SFT);
....@@ -1525,7 +1522,7 @@
15251522 unsigned int val;
15261523 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
15271524
1528
- val = snd_soc_component_read32(component, RT5665_GLB_CLK);
1525
+ val = snd_soc_component_read(component, RT5665_GLB_CLK);
15291526 val &= RT5665_SCLK_SRC_MASK;
15301527 if (val == RT5665_SCLK_SRC_PLL1)
15311528 return 1;
....@@ -1576,7 +1573,7 @@
15761573 return 0;
15771574 }
15781575
1579
- val = (snd_soc_component_read32(component, reg) >> shift) & 0xf;
1576
+ val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
15801577 switch (val) {
15811578 case RT5665_CLK_SEL_I2S1_ASRC:
15821579 case RT5665_CLK_SEL_I2S2_ASRC:
....@@ -2569,7 +2566,7 @@
25692566 return 0;
25702567 }
25712568
2572
-static int rt5655_set_verf(struct snd_soc_dapm_widget *w,
2569
+static int rt5665_set_verf(struct snd_soc_dapm_widget *w,
25732570 struct snd_kcontrol *kcontrol, int event)
25742571 {
25752572 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
....@@ -2689,11 +2686,11 @@
26892686 SND_SOC_DAPM_SUPPLY("Mic Det Power", RT5665_PWR_VOL,
26902687 RT5665_PWR_MIC_DET_BIT, 0, NULL, 0),
26912688 SND_SOC_DAPM_SUPPLY("Vref1", RT5665_PWR_ANLG_1, RT5665_PWR_VREF1_BIT, 0,
2692
- rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
2689
+ rt5665_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
26932690 SND_SOC_DAPM_SUPPLY("Vref2", RT5665_PWR_ANLG_1, RT5665_PWR_VREF2_BIT, 0,
2694
- rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
2691
+ rt5665_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
26952692 SND_SOC_DAPM_SUPPLY("Vref3", RT5665_PWR_ANLG_1, RT5665_PWR_VREF3_BIT, 0,
2696
- rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
2693
+ rt5665_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
26972694
26982695 /* ASRC */
26992696 SND_SOC_DAPM_SUPPLY_S("I2S1 ASRC", 1, RT5665_ASRC_1,
....@@ -4633,7 +4630,8 @@
46334630 .cache_type = REGCACHE_RBTREE,
46344631 .reg_defaults = rt5665_reg,
46354632 .num_reg_defaults = ARRAY_SIZE(rt5665_reg),
4636
- .use_single_rw = true,
4633
+ .use_single_read = true,
4634
+ .use_single_write = true,
46374635 };
46384636
46394637 static const struct i2c_device_id rt5665_i2c_id[] = {