.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * rt5659.c -- RT5659/RT5658 ALSA SoC audio codec driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright 2015 Realtek Semiconductor Corp. |
---|
5 | 6 | * 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. |
---|
10 | 7 | */ |
---|
11 | 8 | |
---|
12 | 9 | #include <linux/clk.h> |
---|
.. | .. |
---|
1198 | 1195 | static const struct snd_kcontrol_new rt5659_if3_adc_swap_mux = |
---|
1199 | 1196 | SOC_DAPM_ENUM("IF3 ADC Swap Source", rt5659_if3_adc_enum); |
---|
1200 | 1197 | |
---|
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 | | - |
---|
1238 | 1198 | static int rt5659_hp_vol_put(struct snd_kcontrol *kcontrol, |
---|
1239 | 1199 | struct snd_ctl_elem_value *ucontrol) |
---|
1240 | 1200 | { |
---|
1241 | 1201 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
---|
1242 | 1202 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); |
---|
1243 | 1203 | |
---|
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) { |
---|
1245 | 1205 | snd_soc_component_update_bits(component, RT5659_STO_NG2_CTRL_1, |
---|
1246 | 1206 | RT5659_NG2_EN_MASK, RT5659_NG2_DIS); |
---|
1247 | 1207 | snd_soc_component_update_bits(component, RT5659_STO_NG2_CTRL_1, |
---|
.. | .. |
---|
1308 | 1268 | snd_soc_dapm_force_enable_pin(dapm, |
---|
1309 | 1269 | "Mic Det Power"); |
---|
1310 | 1270 | 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); |
---|
1312 | 1272 | |
---|
1313 | 1273 | snd_soc_component_update_bits(component, RT5659_PWR_ANLG_1, |
---|
1314 | 1274 | RT5659_PWR_VREF2 | RT5659_PWR_MB, |
---|
.. | .. |
---|
1326 | 1286 | |
---|
1327 | 1287 | while (i < 5) { |
---|
1328 | 1288 | 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; |
---|
1330 | 1290 | i++; |
---|
1331 | 1291 | if (val == 0x1 || val == 0x2 || val == 0x3) |
---|
1332 | 1292 | break; |
---|
.. | .. |
---|
1360 | 1320 | { |
---|
1361 | 1321 | int btn_type, val; |
---|
1362 | 1322 | |
---|
1363 | | - val = snd_soc_component_read32(component, RT5659_4BTN_IL_CMD_1); |
---|
| 1323 | + val = snd_soc_component_read(component, RT5659_4BTN_IL_CMD_1); |
---|
1364 | 1324 | btn_type = val & 0xfff0; |
---|
1365 | 1325 | snd_soc_component_write(component, RT5659_4BTN_IL_CMD_1, val); |
---|
1366 | 1326 | |
---|
.. | .. |
---|
1399 | 1359 | if (!rt5659->component) |
---|
1400 | 1360 | return; |
---|
1401 | 1361 | |
---|
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; |
---|
1403 | 1363 | if (!val) { |
---|
1404 | 1364 | /* jack in */ |
---|
1405 | 1365 | if (rt5659->jack_type == 0) { |
---|
.. | .. |
---|
1607 | 1567 | { |
---|
1608 | 1568 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
---|
1609 | 1569 | struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); |
---|
1610 | | - int pd, idx = -EINVAL; |
---|
| 1570 | + int pd, idx; |
---|
1611 | 1571 | |
---|
1612 | 1572 | pd = rl6231_get_pre_div(rt5659->regmap, |
---|
1613 | 1573 | RT5659_ADDA_CLK_1, RT5659_I2S_PD1_SFT); |
---|
.. | .. |
---|
1699 | 1659 | unsigned int val; |
---|
1700 | 1660 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
---|
1701 | 1661 | |
---|
1702 | | - val = snd_soc_component_read32(component, RT5659_GLB_CLK); |
---|
| 1662 | + val = snd_soc_component_read(component, RT5659_GLB_CLK); |
---|
1703 | 1663 | val &= RT5659_SCLK_SRC_MASK; |
---|
1704 | 1664 | if (val == RT5659_SCLK_SRC_PLL1) |
---|
1705 | 1665 | return 1; |
---|
.. | .. |
---|
1742 | 1702 | return 0; |
---|
1743 | 1703 | } |
---|
1744 | 1704 | |
---|
1745 | | - val = (snd_soc_component_read32(component, reg) >> shift) & 0xf; |
---|
| 1705 | + val = (snd_soc_component_read(component, reg) >> shift) & 0xf; |
---|
1746 | 1706 | switch (val) { |
---|
1747 | 1707 | case 1: |
---|
1748 | 1708 | case 2: |
---|