| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * wm8900.c -- WM8900 ALSA Soc Audio driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2007, 2008 Wolfson Microelectronics PLC. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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. |
|---|
| 11 | 8 | * |
|---|
| 12 | 9 | * TODO: |
|---|
| 13 | 10 | * - Tristating. |
|---|
| .. | .. |
|---|
| 225 | 222 | struct snd_kcontrol *kcontrol, int event) |
|---|
| 226 | 223 | { |
|---|
| 227 | 224 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
|---|
| 228 | | - u16 hpctl1 = snd_soc_component_read32(component, WM8900_REG_HPCTL1); |
|---|
| 225 | + u16 hpctl1 = snd_soc_component_read(component, WM8900_REG_HPCTL1); |
|---|
| 229 | 226 | |
|---|
| 230 | 227 | switch (event) { |
|---|
| 231 | 228 | case SND_SOC_DAPM_PRE_PMU: |
|---|
| .. | .. |
|---|
| 446 | 443 | |
|---|
| 447 | 444 | }; |
|---|
| 448 | 445 | |
|---|
| 449 | | -static const struct snd_kcontrol_new wm8900_dapm_loutput2_control = |
|---|
| 450 | | -SOC_DAPM_SINGLE("LINEOUT2L Switch", WM8900_REG_POWER3, 6, 1, 0); |
|---|
| 451 | | - |
|---|
| 452 | | -static const struct snd_kcontrol_new wm8900_dapm_routput2_control = |
|---|
| 453 | | -SOC_DAPM_SINGLE("LINEOUT2R Switch", WM8900_REG_POWER3, 5, 1, 0); |
|---|
| 454 | | - |
|---|
| 455 | 446 | static const struct snd_kcontrol_new wm8900_loutmix_controls[] = { |
|---|
| 456 | 447 | SOC_DAPM_SINGLE("LINPUT3 Bypass Switch", WM8900_REG_LOUTMIXCTL1, 7, 1, 0), |
|---|
| 457 | 448 | SOC_DAPM_SINGLE("AUX Bypass Switch", WM8900_REG_AUXOUT_CTL, 7, 1, 0), |
|---|
| .. | .. |
|---|
| 638 | 629 | struct snd_soc_component *component = dai->component; |
|---|
| 639 | 630 | u16 reg; |
|---|
| 640 | 631 | |
|---|
| 641 | | - reg = snd_soc_component_read32(component, WM8900_REG_AUDIO1) & ~0x60; |
|---|
| 632 | + reg = snd_soc_component_read(component, WM8900_REG_AUDIO1) & ~0x60; |
|---|
| 642 | 633 | |
|---|
| 643 | 634 | switch (params_width(params)) { |
|---|
| 644 | 635 | case 16: |
|---|
| .. | .. |
|---|
| 659 | 650 | snd_soc_component_write(component, WM8900_REG_AUDIO1, reg); |
|---|
| 660 | 651 | |
|---|
| 661 | 652 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
|---|
| 662 | | - reg = snd_soc_component_read32(component, WM8900_REG_DACCTRL); |
|---|
| 653 | + reg = snd_soc_component_read(component, WM8900_REG_DACCTRL); |
|---|
| 663 | 654 | |
|---|
| 664 | 655 | if (params_rate(params) <= 24000) |
|---|
| 665 | 656 | reg |= WM8900_REG_DACCTRL_DAC_SB_FILT; |
|---|
| .. | .. |
|---|
| 869 | 860 | struct snd_soc_component *component = codec_dai->component; |
|---|
| 870 | 861 | unsigned int clocking1, aif1, aif3, aif4; |
|---|
| 871 | 862 | |
|---|
| 872 | | - clocking1 = snd_soc_component_read32(component, WM8900_REG_CLOCKING1); |
|---|
| 873 | | - aif1 = snd_soc_component_read32(component, WM8900_REG_AUDIO1); |
|---|
| 874 | | - aif3 = snd_soc_component_read32(component, WM8900_REG_AUDIO3); |
|---|
| 875 | | - aif4 = snd_soc_component_read32(component, WM8900_REG_AUDIO4); |
|---|
| 863 | + clocking1 = snd_soc_component_read(component, WM8900_REG_CLOCKING1); |
|---|
| 864 | + aif1 = snd_soc_component_read(component, WM8900_REG_AUDIO1); |
|---|
| 865 | + aif3 = snd_soc_component_read(component, WM8900_REG_AUDIO3); |
|---|
| 866 | + aif4 = snd_soc_component_read(component, WM8900_REG_AUDIO4); |
|---|
| 876 | 867 | |
|---|
| 877 | 868 | /* set master/slave audio interface */ |
|---|
| 878 | 869 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
|---|
| .. | .. |
|---|
| 976 | 967 | return 0; |
|---|
| 977 | 968 | } |
|---|
| 978 | 969 | |
|---|
| 979 | | -static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute) |
|---|
| 970 | +static int wm8900_mute(struct snd_soc_dai *codec_dai, int mute, int direction) |
|---|
| 980 | 971 | { |
|---|
| 981 | 972 | struct snd_soc_component *component = codec_dai->component; |
|---|
| 982 | 973 | u16 reg; |
|---|
| 983 | 974 | |
|---|
| 984 | | - reg = snd_soc_component_read32(component, WM8900_REG_DACCTRL); |
|---|
| 975 | + reg = snd_soc_component_read(component, WM8900_REG_DACCTRL); |
|---|
| 985 | 976 | |
|---|
| 986 | 977 | if (mute) |
|---|
| 987 | 978 | reg |= WM8900_REG_DACCTRL_MUTE; |
|---|
| .. | .. |
|---|
| 1006 | 997 | .set_clkdiv = wm8900_set_dai_clkdiv, |
|---|
| 1007 | 998 | .set_pll = wm8900_set_dai_pll, |
|---|
| 1008 | 999 | .set_fmt = wm8900_set_dai_fmt, |
|---|
| 1009 | | - .digital_mute = wm8900_digital_mute, |
|---|
| 1000 | + .mute_stream = wm8900_mute, |
|---|
| 1001 | + .no_capture_mute = 1, |
|---|
| 1010 | 1002 | }; |
|---|
| 1011 | 1003 | |
|---|
| 1012 | 1004 | static struct snd_soc_dai_driver wm8900_dai = { |
|---|
| .. | .. |
|---|
| 1077 | 1069 | WM8900_REG_POWER1_BIAS_ENA | 0x1); |
|---|
| 1078 | 1070 | } |
|---|
| 1079 | 1071 | |
|---|
| 1080 | | - reg = snd_soc_component_read32(component, WM8900_REG_POWER1); |
|---|
| 1072 | + reg = snd_soc_component_read(component, WM8900_REG_POWER1); |
|---|
| 1081 | 1073 | snd_soc_component_write(component, WM8900_REG_POWER1, |
|---|
| 1082 | 1074 | (reg & WM8900_REG_POWER1_FLL_ENA) | |
|---|
| 1083 | 1075 | WM8900_REG_POWER1_BIAS_ENA | 0x1); |
|---|
| .. | .. |
|---|
| 1088 | 1080 | |
|---|
| 1089 | 1081 | case SND_SOC_BIAS_OFF: |
|---|
| 1090 | 1082 | /* Startup bias enable */ |
|---|
| 1091 | | - reg = snd_soc_component_read32(component, WM8900_REG_POWER1); |
|---|
| 1083 | + reg = snd_soc_component_read(component, WM8900_REG_POWER1); |
|---|
| 1092 | 1084 | snd_soc_component_write(component, WM8900_REG_POWER1, |
|---|
| 1093 | 1085 | reg & WM8900_REG_POWER1_STARTUP_BIAS_ENA); |
|---|
| 1094 | 1086 | snd_soc_component_write(component, WM8900_REG_ADDCTL, |
|---|
| .. | .. |
|---|
| 1179 | 1171 | { |
|---|
| 1180 | 1172 | int reg; |
|---|
| 1181 | 1173 | |
|---|
| 1182 | | - reg = snd_soc_component_read32(component, WM8900_REG_ID); |
|---|
| 1174 | + reg = snd_soc_component_read(component, WM8900_REG_ID); |
|---|
| 1183 | 1175 | if (reg != 0x8900) { |
|---|
| 1184 | 1176 | dev_err(component->dev, "Device is not a WM8900 - ID %x\n", reg); |
|---|
| 1185 | 1177 | return -ENODEV; |
|---|