hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/sound/soc/codecs/wm8991.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * wm8991.c -- WM8991 ALSA Soc Audio driver
34 *
45 * Copyright 2007-2010 Wolfson Microelectronics PLC.
56 * Author: Graeme Gregory
67 * Graeme.Gregory@wolfsonmicro.com
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of the GNU General Public License as published by the
10
- * Free Software Foundation; either version 2 of the License, or (at your
11
- * option) any later version.
128 */
139
1410 #include <linux/module.h>
....@@ -143,7 +139,7 @@
143139 return ret;
144140
145141 /* now hit the volume update bits (always bit 8) */
146
- val = snd_soc_component_read32(component, reg);
142
+ val = snd_soc_component_read(component, reg);
147143 return snd_soc_component_write(component, reg, val | 0x0100);
148144 }
149145
....@@ -368,7 +364,7 @@
368364
369365 switch (reg_shift) {
370366 case WM8991_SPEAKER_MIXER | (WM8991_LDSPK_BIT << 8):
371
- reg = snd_soc_component_read32(component, WM8991_OUTPUT_MIXER1);
367
+ reg = snd_soc_component_read(component, WM8991_OUTPUT_MIXER1);
372368 if (reg & WM8991_LDLO) {
373369 printk(KERN_WARNING
374370 "Cannot set as Output Mixer 1 LDLO Set\n");
....@@ -377,7 +373,7 @@
377373 break;
378374
379375 case WM8991_SPEAKER_MIXER | (WM8991_RDSPK_BIT << 8):
380
- reg = snd_soc_component_read32(component, WM8991_OUTPUT_MIXER2);
376
+ reg = snd_soc_component_read(component, WM8991_OUTPUT_MIXER2);
381377 if (reg & WM8991_RDRO) {
382378 printk(KERN_WARNING
383379 "Cannot set as Output Mixer 2 RDRO Set\n");
....@@ -386,7 +382,7 @@
386382 break;
387383
388384 case WM8991_OUTPUT_MIXER1 | (WM8991_LDLO_BIT << 8):
389
- reg = snd_soc_component_read32(component, WM8991_SPEAKER_MIXER);
385
+ reg = snd_soc_component_read(component, WM8991_SPEAKER_MIXER);
390386 if (reg & WM8991_LDSPK) {
391387 printk(KERN_WARNING
392388 "Cannot set as Speaker Mixer LDSPK Set\n");
....@@ -395,7 +391,7 @@
395391 break;
396392
397393 case WM8991_OUTPUT_MIXER2 | (WM8991_RDRO_BIT << 8):
398
- reg = snd_soc_component_read32(component, WM8991_SPEAKER_MIXER);
394
+ reg = snd_soc_component_read(component, WM8991_SPEAKER_MIXER);
399395 if (reg & WM8991_RDSPK) {
400396 printk(KERN_WARNING
401397 "Cannot set as Speaker Mixer RDSPK Set\n");
....@@ -479,14 +475,6 @@
479475
480476 static const struct snd_kcontrol_new wm8991_dapm_ainrmux_controls =
481477 SOC_DAPM_ENUM("Route", wm8991_ainrmux_enum);
482
-
483
-/* RXVOICE */
484
-static const struct snd_kcontrol_new wm8991_dapm_rxvoice_controls[] = {
485
- SOC_DAPM_SINGLE_TLV("LIN4RXN", WM8991_INPUT_MIXER5, WM8991_LR4BVOL_SHIFT,
486
- WM8991_LR4BVOL_MASK, 0, in_mix_tlv),
487
- SOC_DAPM_SINGLE_TLV("RIN4RXP", WM8991_INPUT_MIXER6, WM8991_RL4BVOL_SHIFT,
488
- WM8991_RL4BVOL_MASK, 0, in_mix_tlv),
489
-};
490478
491479 /* LOMIX */
492480 static const struct snd_kcontrol_new wm8991_dapm_lomix_controls[] = {
....@@ -934,12 +922,12 @@
934922 pll_factors(&pll_div, freq_out * 4, freq_in);
935923
936924 /* Turn on PLL */
937
- reg = snd_soc_component_read32(component, WM8991_POWER_MANAGEMENT_2);
925
+ reg = snd_soc_component_read(component, WM8991_POWER_MANAGEMENT_2);
938926 reg |= WM8991_PLL_ENA;
939927 snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_2, reg);
940928
941929 /* sysclk comes from PLL */
942
- reg = snd_soc_component_read32(component, WM8991_CLOCKING_2);
930
+ reg = snd_soc_component_read(component, WM8991_CLOCKING_2);
943931 snd_soc_component_write(component, WM8991_CLOCKING_2, reg | WM8991_SYSCLK_SRC);
944932
945933 /* set up N , fractional mode and pre-divisor if necessary */
....@@ -949,7 +937,7 @@
949937 snd_soc_component_write(component, WM8991_PLL3, (u8)(pll_div.k & 0xFF));
950938 } else {
951939 /* Turn on PLL */
952
- reg = snd_soc_component_read32(component, WM8991_POWER_MANAGEMENT_2);
940
+ reg = snd_soc_component_read(component, WM8991_POWER_MANAGEMENT_2);
953941 reg &= ~WM8991_PLL_ENA;
954942 snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_2, reg);
955943 }
....@@ -965,8 +953,8 @@
965953 struct snd_soc_component *component = codec_dai->component;
966954 u16 audio1, audio3;
967955
968
- audio1 = snd_soc_component_read32(component, WM8991_AUDIO_INTERFACE_1);
969
- audio3 = snd_soc_component_read32(component, WM8991_AUDIO_INTERFACE_3);
956
+ audio1 = snd_soc_component_read(component, WM8991_AUDIO_INTERFACE_1);
957
+ audio3 = snd_soc_component_read(component, WM8991_AUDIO_INTERFACE_3);
970958
971959 /* set master/slave audio interface */
972960 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
....@@ -1020,22 +1008,22 @@
10201008
10211009 switch (div_id) {
10221010 case WM8991_MCLK_DIV:
1023
- reg = snd_soc_component_read32(component, WM8991_CLOCKING_2) &
1011
+ reg = snd_soc_component_read(component, WM8991_CLOCKING_2) &
10241012 ~WM8991_MCLK_DIV_MASK;
10251013 snd_soc_component_write(component, WM8991_CLOCKING_2, reg | div);
10261014 break;
10271015 case WM8991_DACCLK_DIV:
1028
- reg = snd_soc_component_read32(component, WM8991_CLOCKING_2) &
1016
+ reg = snd_soc_component_read(component, WM8991_CLOCKING_2) &
10291017 ~WM8991_DAC_CLKDIV_MASK;
10301018 snd_soc_component_write(component, WM8991_CLOCKING_2, reg | div);
10311019 break;
10321020 case WM8991_ADCCLK_DIV:
1033
- reg = snd_soc_component_read32(component, WM8991_CLOCKING_2) &
1021
+ reg = snd_soc_component_read(component, WM8991_CLOCKING_2) &
10341022 ~WM8991_ADC_CLKDIV_MASK;
10351023 snd_soc_component_write(component, WM8991_CLOCKING_2, reg | div);
10361024 break;
10371025 case WM8991_BCLK_DIV:
1038
- reg = snd_soc_component_read32(component, WM8991_CLOCKING_1) &
1026
+ reg = snd_soc_component_read(component, WM8991_CLOCKING_1) &
10391027 ~WM8991_BCLK_DIV_MASK;
10401028 snd_soc_component_write(component, WM8991_CLOCKING_1, reg | div);
10411029 break;
....@@ -1054,7 +1042,7 @@
10541042 struct snd_soc_dai *dai)
10551043 {
10561044 struct snd_soc_component *component = dai->component;
1057
- u16 audio1 = snd_soc_component_read32(component, WM8991_AUDIO_INTERFACE_1);
1045
+ u16 audio1 = snd_soc_component_read(component, WM8991_AUDIO_INTERFACE_1);
10581046
10591047 audio1 &= ~WM8991_AIF_WL_MASK;
10601048 /* bit size */
....@@ -1076,12 +1064,12 @@
10761064 return 0;
10771065 }
10781066
1079
-static int wm8991_mute(struct snd_soc_dai *dai, int mute)
1067
+static int wm8991_mute(struct snd_soc_dai *dai, int mute, int direction)
10801068 {
10811069 struct snd_soc_component *component = dai->component;
10821070 u16 val;
10831071
1084
- val = snd_soc_component_read32(component, WM8991_DAC_CTRL) & ~WM8991_DAC_MUTE;
1072
+ val = snd_soc_component_read(component, WM8991_DAC_CTRL) & ~WM8991_DAC_MUTE;
10851073 if (mute)
10861074 snd_soc_component_write(component, WM8991_DAC_CTRL, val | WM8991_DAC_MUTE);
10871075 else
....@@ -1101,7 +1089,7 @@
11011089
11021090 case SND_SOC_BIAS_PREPARE:
11031091 /* VMID=2*50k */
1104
- val = snd_soc_component_read32(component, WM8991_POWER_MANAGEMENT_1) &
1092
+ val = snd_soc_component_read(component, WM8991_POWER_MANAGEMENT_1) &
11051093 ~WM8991_VMID_MODE_MASK;
11061094 snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, val | 0x2);
11071095 break;
....@@ -1158,7 +1146,7 @@
11581146 }
11591147
11601148 /* VMID=2*250k */
1161
- val = snd_soc_component_read32(component, WM8991_POWER_MANAGEMENT_1) &
1149
+ val = snd_soc_component_read(component, WM8991_POWER_MANAGEMENT_1) &
11621150 ~WM8991_VMID_MODE_MASK;
11631151 snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, val | 0x4);
11641152 break;
....@@ -1174,7 +1162,7 @@
11741162 WM8991_BUFIOEN);
11751163
11761164 /* mute DAC */
1177
- val = snd_soc_component_read32(component, WM8991_DAC_CTRL);
1165
+ val = snd_soc_component_read(component, WM8991_DAC_CTRL);
11781166 snd_soc_component_write(component, WM8991_DAC_CTRL, val | WM8991_DAC_MUTE);
11791167
11801168 /* Enable any disabled outputs */
....@@ -1208,10 +1196,11 @@
12081196
12091197 static const struct snd_soc_dai_ops wm8991_ops = {
12101198 .hw_params = wm8991_hw_params,
1211
- .digital_mute = wm8991_mute,
1199
+ .mute_stream = wm8991_mute,
12121200 .set_fmt = wm8991_set_dai_fmt,
12131201 .set_clkdiv = wm8991_set_dai_clkdiv,
1214
- .set_pll = wm8991_set_dai_pll
1202
+ .set_pll = wm8991_set_dai_pll,
1203
+ .no_capture_mute = 1,
12151204 };
12161205
12171206 /*