.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * rt5665.c -- RT5665/RT5658 ALSA SoC audio codec driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright 2016 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/module.h> |
---|
.. | .. |
---|
1003 | 1000 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
---|
1004 | 1001 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); |
---|
1005 | 1002 | |
---|
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) { |
---|
1007 | 1004 | snd_soc_component_update_bits(component, RT5665_STO_NG2_CTRL_1, |
---|
1008 | 1005 | RT5665_NG2_EN_MASK, RT5665_NG2_DIS); |
---|
1009 | 1006 | snd_soc_component_update_bits(component, RT5665_STO_NG2_CTRL_1, |
---|
.. | .. |
---|
1019 | 1016 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
---|
1020 | 1017 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); |
---|
1021 | 1018 | |
---|
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) { |
---|
1023 | 1020 | snd_soc_component_update_bits(component, RT5665_MONO_NG2_CTRL_1, |
---|
1024 | 1021 | RT5665_NG2_EN_MASK, RT5665_NG2_DIS); |
---|
1025 | 1022 | snd_soc_component_update_bits(component, RT5665_MONO_NG2_CTRL_1, |
---|
.. | .. |
---|
1129 | 1126 | { |
---|
1130 | 1127 | int btn_type, val; |
---|
1131 | 1128 | |
---|
1132 | | - val = snd_soc_component_read32(component, RT5665_4BTN_IL_CMD_1); |
---|
| 1129 | + val = snd_soc_component_read(component, RT5665_4BTN_IL_CMD_1); |
---|
1133 | 1130 | btn_type = val & 0xfff0; |
---|
1134 | 1131 | snd_soc_component_write(component, RT5665_4BTN_IL_CMD_1, val); |
---|
1135 | 1132 | |
---|
.. | .. |
---|
1201 | 1198 | |
---|
1202 | 1199 | usleep_range(10000, 15000); |
---|
1203 | 1200 | |
---|
1204 | | - rt5665->sar_adc_value = snd_soc_component_read32(rt5665->component, |
---|
| 1201 | + rt5665->sar_adc_value = snd_soc_component_read(rt5665->component, |
---|
1205 | 1202 | RT5665_SAR_IL_CMD_4) & 0x7ff; |
---|
1206 | 1203 | |
---|
1207 | 1204 | sar_hs_type = rt5665->pdata.sar_hs_type ? |
---|
.. | .. |
---|
1248 | 1245 | struct rt5665_priv *rt5665 = container_of(work, struct rt5665_priv, |
---|
1249 | 1246 | jd_check_work.work); |
---|
1250 | 1247 | |
---|
1251 | | - if (snd_soc_component_read32(rt5665->component, RT5665_AJD1_CTRL) & 0x0010) { |
---|
| 1248 | + if (snd_soc_component_read(rt5665->component, RT5665_AJD1_CTRL) & 0x0010) { |
---|
1252 | 1249 | /* jack out */ |
---|
1253 | 1250 | rt5665->jack_type = rt5665_headset_detect(rt5665->component, 0); |
---|
1254 | 1251 | |
---|
.. | .. |
---|
1313 | 1310 | |
---|
1314 | 1311 | mutex_lock(&rt5665->calibrate_mutex); |
---|
1315 | 1312 | |
---|
1316 | | - val = snd_soc_component_read32(rt5665->component, RT5665_AJD1_CTRL) & 0x0010; |
---|
| 1313 | + val = snd_soc_component_read(rt5665->component, RT5665_AJD1_CTRL) & 0x0010; |
---|
1317 | 1314 | if (!val) { |
---|
1318 | 1315 | /* jack in */ |
---|
1319 | 1316 | if (rt5665->jack_type == 0) { |
---|
.. | .. |
---|
1481 | 1478 | { |
---|
1482 | 1479 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
---|
1483 | 1480 | struct rt5665_priv *rt5665 = snd_soc_component_get_drvdata(component); |
---|
1484 | | - int pd, idx = -EINVAL; |
---|
| 1481 | + int pd, idx; |
---|
1485 | 1482 | |
---|
1486 | 1483 | pd = rl6231_get_pre_div(rt5665->regmap, |
---|
1487 | 1484 | RT5665_ADDA_CLK_1, RT5665_I2S_PD1_SFT); |
---|
.. | .. |
---|
1525 | 1522 | unsigned int val; |
---|
1526 | 1523 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
---|
1527 | 1524 | |
---|
1528 | | - val = snd_soc_component_read32(component, RT5665_GLB_CLK); |
---|
| 1525 | + val = snd_soc_component_read(component, RT5665_GLB_CLK); |
---|
1529 | 1526 | val &= RT5665_SCLK_SRC_MASK; |
---|
1530 | 1527 | if (val == RT5665_SCLK_SRC_PLL1) |
---|
1531 | 1528 | return 1; |
---|
.. | .. |
---|
1576 | 1573 | return 0; |
---|
1577 | 1574 | } |
---|
1578 | 1575 | |
---|
1579 | | - val = (snd_soc_component_read32(component, reg) >> shift) & 0xf; |
---|
| 1576 | + val = (snd_soc_component_read(component, reg) >> shift) & 0xf; |
---|
1580 | 1577 | switch (val) { |
---|
1581 | 1578 | case RT5665_CLK_SEL_I2S1_ASRC: |
---|
1582 | 1579 | case RT5665_CLK_SEL_I2S2_ASRC: |
---|
.. | .. |
---|
2569 | 2566 | return 0; |
---|
2570 | 2567 | } |
---|
2571 | 2568 | |
---|
2572 | | -static int rt5655_set_verf(struct snd_soc_dapm_widget *w, |
---|
| 2569 | +static int rt5665_set_verf(struct snd_soc_dapm_widget *w, |
---|
2573 | 2570 | struct snd_kcontrol *kcontrol, int event) |
---|
2574 | 2571 | { |
---|
2575 | 2572 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
---|
.. | .. |
---|
2689 | 2686 | SND_SOC_DAPM_SUPPLY("Mic Det Power", RT5665_PWR_VOL, |
---|
2690 | 2687 | RT5665_PWR_MIC_DET_BIT, 0, NULL, 0), |
---|
2691 | 2688 | 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), |
---|
2693 | 2690 | 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), |
---|
2695 | 2692 | 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), |
---|
2697 | 2694 | |
---|
2698 | 2695 | /* ASRC */ |
---|
2699 | 2696 | SND_SOC_DAPM_SUPPLY_S("I2S1 ASRC", 1, RT5665_ASRC_1, |
---|
.. | .. |
---|
4633 | 4630 | .cache_type = REGCACHE_RBTREE, |
---|
4634 | 4631 | .reg_defaults = rt5665_reg, |
---|
4635 | 4632 | .num_reg_defaults = ARRAY_SIZE(rt5665_reg), |
---|
4636 | | - .use_single_rw = true, |
---|
| 4633 | + .use_single_read = true, |
---|
| 4634 | + .use_single_write = true, |
---|
4637 | 4635 | }; |
---|
4638 | 4636 | |
---|
4639 | 4637 | static const struct i2c_device_id rt5665_i2c_id[] = { |
---|