hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/sound/soc/codecs/wm8993.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * wm8993.c -- WM8993 ALSA SoC audio driver
34 *
45 * Copyright 2009-12 Wolfson Microelectronics plc
56 *
67 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>
....@@ -486,7 +483,7 @@
486483 wm8993->fll_fref = 0;
487484 wm8993->fll_fout = 0;
488485
489
- reg1 = snd_soc_component_read32(component, WM8993_FLL_CONTROL_1);
486
+ reg1 = snd_soc_component_read(component, WM8993_FLL_CONTROL_1);
490487 reg1 &= ~WM8993_FLL_ENA;
491488 snd_soc_component_write(component, WM8993_FLL_CONTROL_1, reg1);
492489
....@@ -497,7 +494,7 @@
497494 if (ret != 0)
498495 return ret;
499496
500
- reg5 = snd_soc_component_read32(component, WM8993_FLL_CONTROL_5);
497
+ reg5 = snd_soc_component_read(component, WM8993_FLL_CONTROL_5);
501498 reg5 &= ~WM8993_FLL_CLK_SRC_MASK;
502499
503500 switch (fll_id) {
....@@ -519,7 +516,7 @@
519516
520517 /* Any FLL configuration change requires that the FLL be
521518 * disabled first. */
522
- reg1 = snd_soc_component_read32(component, WM8993_FLL_CONTROL_1);
519
+ reg1 = snd_soc_component_read(component, WM8993_FLL_CONTROL_1);
523520 reg1 &= ~WM8993_FLL_ENA;
524521 snd_soc_component_write(component, WM8993_FLL_CONTROL_1, reg1);
525522
....@@ -535,7 +532,7 @@
535532 (fll_div.fll_fratio << WM8993_FLL_FRATIO_SHIFT));
536533 snd_soc_component_write(component, WM8993_FLL_CONTROL_3, fll_div.k);
537534
538
- reg4 = snd_soc_component_read32(component, WM8993_FLL_CONTROL_4);
535
+ reg4 = snd_soc_component_read(component, WM8993_FLL_CONTROL_4);
539536 reg4 &= ~WM8993_FLL_N_MASK;
540537 reg4 |= fll_div.n << WM8993_FLL_N_SHIFT;
541538 snd_soc_component_write(component, WM8993_FLL_CONTROL_4, reg4);
....@@ -586,7 +583,7 @@
586583 case WM8993_SYSCLK_MCLK:
587584 dev_dbg(component->dev, "Using %dHz MCLK\n", wm8993->mclk_rate);
588585
589
- reg = snd_soc_component_read32(component, WM8993_CLOCKING_2);
586
+ reg = snd_soc_component_read(component, WM8993_CLOCKING_2);
590587 reg &= ~(WM8993_MCLK_DIV | WM8993_SYSCLK_SRC);
591588 if (wm8993->mclk_rate > 13500000) {
592589 reg |= WM8993_MCLK_DIV;
....@@ -602,7 +599,7 @@
602599 dev_dbg(component->dev, "Using %dHz FLL clock\n",
603600 wm8993->fll_fout);
604601
605
- reg = snd_soc_component_read32(component, WM8993_CLOCKING_2);
602
+ reg = snd_soc_component_read(component, WM8993_CLOCKING_2);
606603 reg |= WM8993_SYSCLK_SRC;
607604 if (wm8993->fll_fout > 13500000) {
608605 reg |= WM8993_MCLK_DIV;
....@@ -1076,7 +1073,7 @@
10761073 switch (clk_id) {
10771074 case WM8993_SYSCLK_MCLK:
10781075 wm8993->mclk_rate = freq;
1079
- /* fall through */
1076
+ fallthrough;
10801077 case WM8993_SYSCLK_FLL:
10811078 wm8993->sysclk_source = clk_id;
10821079 break;
....@@ -1093,8 +1090,8 @@
10931090 {
10941091 struct snd_soc_component *component = dai->component;
10951092 struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component);
1096
- unsigned int aif1 = snd_soc_component_read32(component, WM8993_AUDIO_INTERFACE_1);
1097
- unsigned int aif4 = snd_soc_component_read32(component, WM8993_AUDIO_INTERFACE_4);
1093
+ unsigned int aif1 = snd_soc_component_read(component, WM8993_AUDIO_INTERFACE_1);
1094
+ unsigned int aif4 = snd_soc_component_read(component, WM8993_AUDIO_INTERFACE_4);
10981095
10991096 aif1 &= ~(WM8993_BCLK_DIR | WM8993_AIF_BCLK_INV |
11001097 WM8993_AIF_LRCLK_INV | WM8993_AIF_FMT_MASK);
....@@ -1124,7 +1121,7 @@
11241121 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
11251122 case SND_SOC_DAIFMT_DSP_B:
11261123 aif1 |= WM8993_AIF_LRCLK_INV;
1127
- /* fall through */
1124
+ fallthrough;
11281125 case SND_SOC_DAIFMT_DSP_A:
11291126 aif1 |= 0x18;
11301127 break;
....@@ -1193,16 +1190,16 @@
11931190 int ret, i, best, best_val, cur_val;
11941191 unsigned int clocking1, clocking3, aif1, aif4;
11951192
1196
- clocking1 = snd_soc_component_read32(component, WM8993_CLOCKING_1);
1193
+ clocking1 = snd_soc_component_read(component, WM8993_CLOCKING_1);
11971194 clocking1 &= ~WM8993_BCLK_DIV_MASK;
11981195
1199
- clocking3 = snd_soc_component_read32(component, WM8993_CLOCKING_3);
1196
+ clocking3 = snd_soc_component_read(component, WM8993_CLOCKING_3);
12001197 clocking3 &= ~(WM8993_CLK_SYS_RATE_MASK | WM8993_SAMPLE_RATE_MASK);
12011198
1202
- aif1 = snd_soc_component_read32(component, WM8993_AUDIO_INTERFACE_1);
1199
+ aif1 = snd_soc_component_read(component, WM8993_AUDIO_INTERFACE_1);
12031200 aif1 &= ~WM8993_AIF_WL_MASK;
12041201
1205
- aif4 = snd_soc_component_read32(component, WM8993_AUDIO_INTERFACE_4);
1202
+ aif4 = snd_soc_component_read(component, WM8993_AUDIO_INTERFACE_4);
12061203 aif4 &= ~WM8993_LRCLK_RATE_MASK;
12071204
12081205 /* What BCLK do we need? */
....@@ -1302,7 +1299,7 @@
13021299
13031300 /* ReTune Mobile? */
13041301 if (wm8993->pdata.num_retune_configs) {
1305
- u16 eq1 = snd_soc_component_read32(component, WM8993_EQ1);
1302
+ u16 eq1 = snd_soc_component_read(component, WM8993_EQ1);
13061303 struct wm8993_retune_mobile_setting *s;
13071304
13081305 best = 0;
....@@ -1333,12 +1330,12 @@
13331330 return 0;
13341331 }
13351332
1336
-static int wm8993_digital_mute(struct snd_soc_dai *codec_dai, int mute)
1333
+static int wm8993_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
13371334 {
13381335 struct snd_soc_component *component = codec_dai->component;
13391336 unsigned int reg;
13401337
1341
- reg = snd_soc_component_read32(component, WM8993_DAC_CTRL);
1338
+ reg = snd_soc_component_read(component, WM8993_DAC_CTRL);
13421339
13431340 if (mute)
13441341 reg |= WM8993_DAC_MUTE;
....@@ -1447,9 +1444,10 @@
14471444 .set_sysclk = wm8993_set_sysclk,
14481445 .set_fmt = wm8993_set_dai_fmt,
14491446 .hw_params = wm8993_hw_params,
1450
- .digital_mute = wm8993_digital_mute,
1447
+ .mute_stream = wm8993_mute,
14511448 .set_pll = wm8993_set_fll,
14521449 .set_tdm_slot = wm8993_set_tdm_slot,
1450
+ .no_capture_mute = 1,
14531451 };
14541452
14551453 #define WM8993_RATES SNDRV_PCM_RATE_8000_48000