.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 88pm860x-codec.c -- 88PM860x ALSA SoC Audio Driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright 2010 Marvell International Ltd. |
---|
5 | 6 | * Author: Haojian Zhuang <haojian.zhuang@marvell.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/kernel.h> |
---|
.. | .. |
---|
277 | 274 | unsigned int reg2 = mc->rreg; |
---|
278 | 275 | int val[2], val2[2], i; |
---|
279 | 276 | |
---|
280 | | - val[0] = snd_soc_component_read32(component, reg) & 0x3f; |
---|
281 | | - val[1] = (snd_soc_component_read32(component, PM860X_SIDETONE_SHIFT) >> 4) & 0xf; |
---|
282 | | - val2[0] = snd_soc_component_read32(component, reg2) & 0x3f; |
---|
283 | | - val2[1] = (snd_soc_component_read32(component, PM860X_SIDETONE_SHIFT)) & 0xf; |
---|
| 277 | + val[0] = snd_soc_component_read(component, reg) & 0x3f; |
---|
| 278 | + val[1] = (snd_soc_component_read(component, PM860X_SIDETONE_SHIFT) >> 4) & 0xf; |
---|
| 279 | + val2[0] = snd_soc_component_read(component, reg2) & 0x3f; |
---|
| 280 | + val2[1] = (snd_soc_component_read(component, PM860X_SIDETONE_SHIFT)) & 0xf; |
---|
284 | 281 | |
---|
285 | 282 | for (i = 0; i < ARRAY_SIZE(st_table); i++) { |
---|
286 | 283 | if ((st_table[i].m == val[0]) && (st_table[i].n == val[1])) |
---|
.. | .. |
---|
336 | 333 | int max = mc->max, val, val2; |
---|
337 | 334 | unsigned int mask = (1 << fls(max)) - 1; |
---|
338 | 335 | |
---|
339 | | - val = snd_soc_component_read32(component, reg) >> shift; |
---|
340 | | - val2 = snd_soc_component_read32(component, reg2) >> shift; |
---|
| 336 | + val = snd_soc_component_read(component, reg) >> shift; |
---|
| 337 | + val2 = snd_soc_component_read(component, reg2) >> shift; |
---|
341 | 338 | ucontrol->value.integer.value[0] = (max - val) & mask; |
---|
342 | 339 | ucontrol->value.integer.value[1] = (max - val2) & mask; |
---|
343 | 340 | |
---|
.. | .. |
---|
429 | 426 | snd_soc_component_update_bits(component, PM860X_EAR_CTRL_2, |
---|
430 | 427 | RSYNC_CHANGE, RSYNC_CHANGE); |
---|
431 | 428 | /* update dac */ |
---|
432 | | - data = snd_soc_component_read32(component, PM860X_DAC_EN_2); |
---|
| 429 | + data = snd_soc_component_read(component, PM860X_DAC_EN_2); |
---|
433 | 430 | data &= ~dac; |
---|
434 | 431 | if (!(data & (DAC_LEFT | DAC_RIGHT))) |
---|
435 | 432 | data &= ~MODULATOR; |
---|
.. | .. |
---|
532 | 529 | * DAPM Controls |
---|
533 | 530 | */ |
---|
534 | 531 | |
---|
535 | | -/* PCM Switch / PCM Interface */ |
---|
536 | | -static const struct snd_kcontrol_new pcm_switch_controls = |
---|
537 | | - SOC_DAPM_SINGLE("Switch", PM860X_ADC_EN_2, 0, 1, 0); |
---|
538 | | - |
---|
539 | 532 | /* AUX1 Switch */ |
---|
540 | 533 | static const struct snd_kcontrol_new aux1_switch_controls = |
---|
541 | 534 | SOC_DAPM_SINGLE("Switch", PM860X_ANA_TO_ANA, 4, 1, 0); |
---|
.. | .. |
---|
551 | 544 | /* Right Ex. PA Switch */ |
---|
552 | 545 | static const struct snd_kcontrol_new repa_switch_controls = |
---|
553 | 546 | SOC_DAPM_SINGLE("Switch", PM860X_DAC_EN_2, 1, 1, 0); |
---|
554 | | - |
---|
555 | | -/* PCM Mux / Mux7 */ |
---|
556 | | -static const char *aif1_text[] = { |
---|
557 | | - "PCM L", "PCM R", |
---|
558 | | -}; |
---|
559 | | - |
---|
560 | | -static SOC_ENUM_SINGLE_DECL(aif1_enum, |
---|
561 | | - PM860X_PCM_IFACE_3, 6, aif1_text); |
---|
562 | | - |
---|
563 | | -static const struct snd_kcontrol_new aif1_mux = |
---|
564 | | - SOC_DAPM_ENUM("PCM Mux", aif1_enum); |
---|
565 | 547 | |
---|
566 | 548 | /* I2S Mux / Mux9 */ |
---|
567 | 549 | static const char *i2s_din_text[] = { |
---|
.. | .. |
---|
920 | 902 | * Use MUTE_LEFT & MUTE_RIGHT to implement digital mute. |
---|
921 | 903 | * These bits can also be used to mute. |
---|
922 | 904 | */ |
---|
923 | | -static int pm860x_digital_mute(struct snd_soc_dai *codec_dai, int mute) |
---|
| 905 | +static int pm860x_mute_stream(struct snd_soc_dai *codec_dai, int mute, int direction) |
---|
924 | 906 | { |
---|
925 | 907 | struct snd_soc_component *component = codec_dai->component; |
---|
926 | 908 | int data = 0, mask = MUTE_LEFT | MUTE_RIGHT; |
---|
.. | .. |
---|
1154 | 1136 | } |
---|
1155 | 1137 | |
---|
1156 | 1138 | static const struct snd_soc_dai_ops pm860x_pcm_dai_ops = { |
---|
1157 | | - .digital_mute = pm860x_digital_mute, |
---|
| 1139 | + .mute_stream = pm860x_mute_stream, |
---|
1158 | 1140 | .hw_params = pm860x_pcm_hw_params, |
---|
1159 | 1141 | .set_fmt = pm860x_pcm_set_dai_fmt, |
---|
1160 | 1142 | .set_sysclk = pm860x_set_dai_sysclk, |
---|
| 1143 | + .no_capture_mute = 1, |
---|
1161 | 1144 | }; |
---|
1162 | 1145 | |
---|
1163 | 1146 | static const struct snd_soc_dai_ops pm860x_i2s_dai_ops = { |
---|
1164 | | - .digital_mute = pm860x_digital_mute, |
---|
| 1147 | + .mute_stream = pm860x_mute_stream, |
---|
1165 | 1148 | .hw_params = pm860x_i2s_hw_params, |
---|
1166 | 1149 | .set_fmt = pm860x_i2s_set_dai_fmt, |
---|
1167 | 1150 | .set_sysclk = pm860x_set_dai_sysclk, |
---|
| 1151 | + .no_capture_mute = 1, |
---|
1168 | 1152 | }; |
---|
1169 | 1153 | |
---|
1170 | 1154 | #define PM860X_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | \ |
---|