forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/codecs/rt5640.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * rt5640.c -- RT5640/RT5639 ALSA SoC audio codec driver
34 *
45 * Copyright 2011 Realtek Semiconductor Corp.
56 * Author: Johnny Hsu <johnnyhsu@realtek.com>
67 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/module.h>
....@@ -977,11 +974,11 @@
977974 switch (event) {
978975 case SND_SOC_DAPM_POST_PMU:
979976 rt5640_pmu_depop(component);
980
- rt5640->hp_mute = 0;
977
+ rt5640->hp_mute = false;
981978 break;
982979
983980 case SND_SOC_DAPM_PRE_PMD:
984
- rt5640->hp_mute = 1;
981
+ rt5640->hp_mute = true;
985982 msleep(70);
986983 break;
987984
....@@ -1656,7 +1653,7 @@
16561653 if (component == NULL)
16571654 return -EINVAL;
16581655
1659
- val = snd_soc_component_read32(component, RT5640_I2S1_SDP);
1656
+ val = snd_soc_component_read(component, RT5640_I2S1_SDP);
16601657 val = (val & RT5640_I2S_IF_MASK) >> RT5640_I2S_IF_SFT;
16611658 switch (dai_id) {
16621659 case RT5640_AIF1:
....@@ -1667,7 +1664,7 @@
16671664 break;
16681665 case RT5640_IF_113:
16691666 ret |= RT5640_U_IF1;
1670
- /* fall through */
1667
+ fallthrough;
16711668 case RT5640_IF_312:
16721669 case RT5640_IF_213:
16731670 ret |= RT5640_U_IF2;
....@@ -1683,7 +1680,7 @@
16831680 break;
16841681 case RT5640_IF_223:
16851682 ret |= RT5640_U_IF1;
1686
- /* fall through */
1683
+ fallthrough;
16871684 case RT5640_IF_123:
16881685 case RT5640_IF_321:
16891686 ret |= RT5640_U_IF2;
....@@ -1842,9 +1839,6 @@
18421839 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
18431840 unsigned int reg_val = 0;
18441841 unsigned int pll_bit = 0;
1845
-
1846
- if (freq == rt5640->sysclk && clk_id == rt5640->sysclk_src)
1847
- return 0;
18481842
18491843 switch (clk_id) {
18501844 case RT5640_SCLK_S_MCLK:
....@@ -2086,7 +2080,7 @@
20862080 snd_soc_component_update_bits(component, RT5640_ASRC_2,
20872081 asrc2_mask, asrc2_value);
20882082
2089
- if (snd_soc_component_read32(component, RT5640_ASRC_2)) {
2083
+ if (snd_soc_component_read(component, RT5640_ASRC_2)) {
20902084 rt5640->asrc_en = true;
20912085 snd_soc_component_update_bits(component, RT5640_JD_CTRL, 0x3, 0x3);
20922086 } else {
....@@ -2151,7 +2145,7 @@
21512145 {
21522146 int val;
21532147
2154
- val = snd_soc_component_read32(component, RT5640_IRQ_CTRL2);
2148
+ val = snd_soc_component_read(component, RT5640_IRQ_CTRL2);
21552149 dev_dbg(component->dev, "irq ctrl2 %#04x\n", val);
21562150
21572151 return (val & RT5640_MB1_OC_STATUS);
....@@ -2162,7 +2156,7 @@
21622156 struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
21632157 int val;
21642158
2165
- val = snd_soc_component_read32(component, RT5640_INT_IRQ_ST);
2159
+ val = snd_soc_component_read(component, RT5640_INT_IRQ_ST);
21662160 dev_dbg(component->dev, "irq status %#04x\n", val);
21672161
21682162 if (rt5640->jd_inverted)
....@@ -2489,7 +2483,7 @@
24892483 snd_soc_component_update_bits(component, RT5640_MICBIAS, 0x0030, 0x0030);
24902484 snd_soc_component_update_bits(component, RT5640_DSP_PATH2, 0xfc00, 0x0c00);
24912485
2492
- switch (snd_soc_component_read32(component, RT5640_RESET) & RT5640_ID_MASK) {
2486
+ switch (snd_soc_component_read(component, RT5640_RESET) & RT5640_ID_MASK) {
24932487 case RT5640_ID_5640:
24942488 case RT5640_ID_5642:
24952489 snd_soc_add_component_controls(component,
....@@ -2713,7 +2707,8 @@
27132707 static const struct regmap_config rt5640_regmap = {
27142708 .reg_bits = 8,
27152709 .val_bits = 16,
2716
- .use_single_rw = true,
2710
+ .use_single_read = true,
2711
+ .use_single_write = true,
27172712
27182713 .max_register = RT5640_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5640_ranges) *
27192714 RT5640_PR_SPACING),
....@@ -2830,7 +2825,7 @@
28302825 regmap_update_bits(rt5640->regmap, RT5640_DUMMY1,
28312826 RT5640_MCLK_DET, RT5640_MCLK_DET);
28322827
2833
- rt5640->hp_mute = 1;
2828
+ rt5640->hp_mute = true;
28342829 rt5640->irq = i2c->irq;
28352830 INIT_DELAYED_WORK(&rt5640->bp_work, rt5640_button_press_work);
28362831 INIT_WORK(&rt5640->jack_work, rt5640_jack_work);