hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/codecs/rt5659.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * rt5659.c -- RT5659/RT5658 ALSA SoC audio codec driver
34 *
45 * Copyright 2015 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/clk.h>
....@@ -1198,50 +1195,13 @@
11981195 static const struct snd_kcontrol_new rt5659_if3_adc_swap_mux =
11991196 SOC_DAPM_ENUM("IF3 ADC Swap Source", rt5659_if3_adc_enum);
12001197
1201
-static const char * const rt5659_asrc_clk_src[] = {
1202
- "clk_sysy_div_out", "clk_i2s1_track", "clk_i2s2_track",
1203
- "clk_i2s3_track", "clk_sys2", "clk_sys3"
1204
-};
1205
-
1206
-static unsigned int rt5659_asrc_clk_map_values[] = {
1207
- 0, 1, 2, 3, 5, 6,
1208
-};
1209
-
1210
-static SOC_VALUE_ENUM_SINGLE_DECL(
1211
- rt5659_da_sto_asrc_enum, RT5659_ASRC_2, RT5659_DA_STO_T_SFT, 0x7,
1212
- rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
1213
-
1214
-static SOC_VALUE_ENUM_SINGLE_DECL(
1215
- rt5659_da_monol_asrc_enum, RT5659_ASRC_2, RT5659_DA_MONO_L_T_SFT, 0x7,
1216
- rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
1217
-
1218
-static SOC_VALUE_ENUM_SINGLE_DECL(
1219
- rt5659_da_monor_asrc_enum, RT5659_ASRC_2, RT5659_DA_MONO_R_T_SFT, 0x7,
1220
- rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
1221
-
1222
-static SOC_VALUE_ENUM_SINGLE_DECL(
1223
- rt5659_ad_sto1_asrc_enum, RT5659_ASRC_2, RT5659_AD_STO1_T_SFT, 0x7,
1224
- rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
1225
-
1226
-static SOC_VALUE_ENUM_SINGLE_DECL(
1227
- rt5659_ad_sto2_asrc_enum, RT5659_ASRC_3, RT5659_AD_STO2_T_SFT, 0x7,
1228
- rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
1229
-
1230
-static SOC_VALUE_ENUM_SINGLE_DECL(
1231
- rt5659_ad_monol_asrc_enum, RT5659_ASRC_3, RT5659_AD_MONO_L_T_SFT, 0x7,
1232
- rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
1233
-
1234
-static SOC_VALUE_ENUM_SINGLE_DECL(
1235
- rt5659_ad_monor_asrc_enum, RT5659_ASRC_3, RT5659_AD_MONO_R_T_SFT, 0x7,
1236
- rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
1237
-
12381198 static int rt5659_hp_vol_put(struct snd_kcontrol *kcontrol,
12391199 struct snd_ctl_elem_value *ucontrol)
12401200 {
12411201 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
12421202 int ret = snd_soc_put_volsw(kcontrol, ucontrol);
12431203
1244
- if (snd_soc_component_read32(component, RT5659_STO_NG2_CTRL_1) & RT5659_NG2_EN) {
1204
+ if (snd_soc_component_read(component, RT5659_STO_NG2_CTRL_1) & RT5659_NG2_EN) {
12451205 snd_soc_component_update_bits(component, RT5659_STO_NG2_CTRL_1,
12461206 RT5659_NG2_EN_MASK, RT5659_NG2_DIS);
12471207 snd_soc_component_update_bits(component, RT5659_STO_NG2_CTRL_1,
....@@ -1308,7 +1268,7 @@
13081268 snd_soc_dapm_force_enable_pin(dapm,
13091269 "Mic Det Power");
13101270 snd_soc_dapm_sync(dapm);
1311
- reg_63 = snd_soc_component_read32(component, RT5659_PWR_ANLG_1);
1271
+ reg_63 = snd_soc_component_read(component, RT5659_PWR_ANLG_1);
13121272
13131273 snd_soc_component_update_bits(component, RT5659_PWR_ANLG_1,
13141274 RT5659_PWR_VREF2 | RT5659_PWR_MB,
....@@ -1326,7 +1286,7 @@
13261286
13271287 while (i < 5) {
13281288 msleep(sleep_time[i]);
1329
- val = snd_soc_component_read32(component, RT5659_EJD_CTRL_2) & 0x0003;
1289
+ val = snd_soc_component_read(component, RT5659_EJD_CTRL_2) & 0x0003;
13301290 i++;
13311291 if (val == 0x1 || val == 0x2 || val == 0x3)
13321292 break;
....@@ -1360,7 +1320,7 @@
13601320 {
13611321 int btn_type, val;
13621322
1363
- val = snd_soc_component_read32(component, RT5659_4BTN_IL_CMD_1);
1323
+ val = snd_soc_component_read(component, RT5659_4BTN_IL_CMD_1);
13641324 btn_type = val & 0xfff0;
13651325 snd_soc_component_write(component, RT5659_4BTN_IL_CMD_1, val);
13661326
....@@ -1399,7 +1359,7 @@
13991359 if (!rt5659->component)
14001360 return;
14011361
1402
- val = snd_soc_component_read32(rt5659->component, RT5659_INT_ST_1) & 0x0080;
1362
+ val = snd_soc_component_read(rt5659->component, RT5659_INT_ST_1) & 0x0080;
14031363 if (!val) {
14041364 /* jack in */
14051365 if (rt5659->jack_type == 0) {
....@@ -1607,7 +1567,7 @@
16071567 {
16081568 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
16091569 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component);
1610
- int pd, idx = -EINVAL;
1570
+ int pd, idx;
16111571
16121572 pd = rl6231_get_pre_div(rt5659->regmap,
16131573 RT5659_ADDA_CLK_1, RT5659_I2S_PD1_SFT);
....@@ -1699,7 +1659,7 @@
16991659 unsigned int val;
17001660 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
17011661
1702
- val = snd_soc_component_read32(component, RT5659_GLB_CLK);
1662
+ val = snd_soc_component_read(component, RT5659_GLB_CLK);
17031663 val &= RT5659_SCLK_SRC_MASK;
17041664 if (val == RT5659_SCLK_SRC_PLL1)
17051665 return 1;
....@@ -1742,7 +1702,7 @@
17421702 return 0;
17431703 }
17441704
1745
- val = (snd_soc_component_read32(component, reg) >> shift) & 0xf;
1705
+ val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
17461706 switch (val) {
17471707 case 1:
17481708 case 2: