hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/codecs/tlv320aic23.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ALSA SoC TLV320AIC23 codec driver
34 *
....@@ -5,10 +6,6 @@
56 * Copyright: (C) 2008 Mistral Solutions Pvt Ltd.,
67 *
78 * Based on sound/soc/codecs/wm8731.c by Richard Purdie
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
129 *
1310 * Notes:
1411 * The AIC23 is a driver for a low power stereo audio
....@@ -70,8 +67,6 @@
7067 static const struct snd_kcontrol_new tlv320aic23_rec_src_mux_controls =
7168 SOC_DAPM_ENUM("Input Select", rec_src_enum);
7269
73
-static SOC_ENUM_SINGLE_DECL(tlv320aic23_rec_src,
74
- TLV320AIC23_ANLG, 2, rec_src_text);
7570 static SOC_ENUM_SINGLE_DECL(tlv320aic23_deemph,
7671 TLV320AIC23_DIGT, 1, deemph_text);
7772
....@@ -96,7 +91,7 @@
9691 */
9792 val = (val >= 4) ? 4 : (3 - val);
9893
99
- reg = snd_soc_component_read32(component, TLV320AIC23_ANLG) & (~0x1C0);
94
+ reg = snd_soc_component_read(component, TLV320AIC23_ANLG) & (~0x1C0);
10095 snd_soc_component_write(component, TLV320AIC23_ANLG, reg | (val << 6));
10196
10297 return 0;
....@@ -108,7 +103,7 @@
108103 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
109104 u16 val;
110105
111
- val = snd_soc_component_read32(component, TLV320AIC23_ANLG) & (0x1C0);
106
+ val = snd_soc_component_read(component, TLV320AIC23_ANLG) & (0x1C0);
112107 val = val >> 6;
113108 val = (val >= 4) ? 4 : (3 - val);
114109 ucontrol->value.integer.value[0] = val;
....@@ -299,7 +294,7 @@
299294 static void get_current_sample_rates(struct snd_soc_component *component, int mclk,
300295 u32 *sample_rate_adc, u32 *sample_rate_dac)
301296 {
302
- int src = snd_soc_component_read32(component, TLV320AIC23_SRATE);
297
+ int src = snd_soc_component_read(component, TLV320AIC23_SRATE);
303298 int sr = (src >> 2) & 0x0f;
304299 int val = (mclk / bosr_usb_divisor_table[src & 3]);
305300 int adc = (val * sr_adc_mult_table[sr]) / SR_MULT;
....@@ -361,7 +356,7 @@
361356 if (ret < 0)
362357 return ret;
363358
364
- iface_reg = snd_soc_component_read32(component, TLV320AIC23_DIGT_FMT) & ~(0x03 << 2);
359
+ iface_reg = snd_soc_component_read(component, TLV320AIC23_DIGT_FMT) & ~(0x03 << 2);
365360
366361 switch (params_width(params)) {
367362 case 16:
....@@ -399,7 +394,7 @@
399394 struct aic23 *aic23 = snd_soc_component_get_drvdata(component);
400395
401396 /* deactivate */
402
- if (!snd_soc_component_is_active(component)) {
397
+ if (!snd_soc_component_active(component)) {
403398 udelay(50);
404399 snd_soc_component_write(component, TLV320AIC23_ACTIVE, 0x0);
405400 }
....@@ -409,12 +404,12 @@
409404 aic23->requested_adc = 0;
410405 }
411406
412
-static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute)
407
+static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute, int direction)
413408 {
414409 struct snd_soc_component *component = dai->component;
415410 u16 reg;
416411
417
- reg = snd_soc_component_read32(component, TLV320AIC23_DIGT);
412
+ reg = snd_soc_component_read(component, TLV320AIC23_DIGT);
418413 if (mute)
419414 reg |= TLV320AIC23_DACM_MUTE;
420415
....@@ -432,7 +427,7 @@
432427 struct snd_soc_component *component = codec_dai->component;
433428 u16 iface_reg;
434429
435
- iface_reg = snd_soc_component_read32(component, TLV320AIC23_DIGT_FMT) & (~0x03);
430
+ iface_reg = snd_soc_component_read(component, TLV320AIC23_DIGT_FMT) & (~0x03);
436431
437432 /* set master/slave audio interface */
438433 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
....@@ -454,7 +449,7 @@
454449 break;
455450 case SND_SOC_DAIFMT_DSP_A:
456451 iface_reg |= TLV320AIC23_LRP_ON;
457
- /* fall through */
452
+ fallthrough;
458453 case SND_SOC_DAIFMT_DSP_B:
459454 iface_reg |= TLV320AIC23_FOR_DSP;
460455 break;
....@@ -484,7 +479,7 @@
484479 static int tlv320aic23_set_bias_level(struct snd_soc_component *component,
485480 enum snd_soc_bias_level level)
486481 {
487
- u16 reg = snd_soc_component_read32(component, TLV320AIC23_PWR) & 0x17f;
482
+ u16 reg = snd_soc_component_read(component, TLV320AIC23_PWR) & 0x17f;
488483
489484 switch (level) {
490485 case SND_SOC_BIAS_ON:
....@@ -517,9 +512,10 @@
517512 .prepare = tlv320aic23_pcm_prepare,
518513 .hw_params = tlv320aic23_hw_params,
519514 .shutdown = tlv320aic23_shutdown,
520
- .digital_mute = tlv320aic23_mute,
515
+ .mute_stream = tlv320aic23_mute,
521516 .set_fmt = tlv320aic23_set_dai_fmt,
522517 .set_sysclk = tlv320aic23_set_dai_sysclk,
518
+ .no_capture_mute = 1,
523519 };
524520
525521 static struct snd_soc_dai_driver tlv320aic23_dai = {