Add support for Wolfson Micro WM8998 codec
cover Add support for Wolfson Micro WM8998 codec
This set of patches is based on broonie/regulator.git/for-next and broonie/sound.git/for-next branches.
Richard Fitzgerald (3):
regulator: arizona: add support for WM8998 and WM1814
ASoC: arizona: add defines for single-input gain control
ASoC: wm8998: Initial WM8998 codec driver
drivers/regulator/arizona-ldo1.c | 2 + sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/arizona.c | 33 + sound/soc/codecs/arizona.h | 12 +- sound/soc/codecs/wm8998.c | 1429 ++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/wm8998.h | 23 + 7 files changed, 1506 insertions(+), 1 deletion(-) create mode 100644 sound/soc/codecs/wm8998.c create mode 100644 sound/soc/codecs/wm8998.h
Signature · 1 line
1.9.1
PATCH 1/3 regulator: arizona: add support for WM8998 and WM1814
--- drivers/regulator/arizona-ldo1.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/arizona-ldo1.c +2 -0
@@ -245,6 +245,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev)switch (arizona->type) {case WM5102 :case WM8997 : +case WM8998 : +case WM1814 : desc = &arizona_ldo1_hc; ldo1->init_data = arizona_ldo1_dvfs;break ;
Signature · 1 line
1.9.1
PATCH 2/3 ASoC: arizona: add defines for single-input gain control
In reply to Richard FitzgeraldAdds convenience defines for declaring a gain control that has an input mux. These blocks are functionally equivalent to the existing mixer blocks but can only have a single input active at once.
--- sound/soc/codecs/arizona.h | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/codecs/arizona.h +5 -0
@@ -99,6 +99,11 @@ extern const unsigned int arizona_mixer_tlv[];extern const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS ];extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS ]; +#define ARIZONA_GAINMUX_CONTROLS (name, base) \ + SOC_SINGLE_RANGE_TLV(name " Input Volume", base + 1, \ + ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \ + arizona_mixer_tlv) +#define ARIZONA_MIXER_CONTROLS (name, base) \ SOC_SINGLE_RANGE_TLV(name " Input 1 Volume", base + 1, \ ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
Signature · 1 line
1.9.1
PATCH 3/3 ASoC: wm8998: Initial WM8998 codec driver
In reply to Richard Fitzgerald--- sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/arizona.c | 33 + sound/soc/codecs/arizona.h | 7 +- sound/soc/codecs/wm8998.c | 1429 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/wm8998.h | 23 + 6 files changed, 1499 insertions(+), 1 deletion(-) create mode 100644 sound/soc/codecs/wm8998.c create mode 100644 sound/soc/codecs/wm8998.h
sound/soc/codecs/Kconfig +6 -0
@@ -171,6 +171,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_WM8995 if SND_SOC_I2C_AND_SPI select SND_SOC_WM8996 if I2C select SND_SOC_WM8997 if MFD_WM8997 + select SND_SOC_WM8998 if MFD_WM8998 select SND_SOC_WM9081 if I2C select SND_SOC_WM9090 if I2C select SND_SOC_WM9705 if SND_SOC_AC97_BUS
@@ -195,9 +196,11 @@ config SND_SOC_ARIZONA default y if SND_SOC_WM5102=y default y if SND_SOC_WM5110=y default y if SND_SOC_WM8997=y + default y if SND_SOC_WM8998=y default m if SND_SOC_WM5102=m default m if SND_SOC_WM5110=m default m if SND_SOC_WM8997=m + default m if SND_SOC_WM8998=m config SND_SOC_WM_HUBS tristate
@@ -866,6 +869,9 @@ config SND_SOC_WM8996 config SND_SOC_WM8997 tristate +config SND_SOC_WM8998 + tristate + config SND_SOC_WM9081 tristate
sound/soc/codecs/Makefile +2 -0
@@ -176,6 +176,7 @@ snd-soc-wm8993-objs := wm8993.o snd-soc-wm8994-objs := wm8994.o wm8958-dsp2.o snd-soc-wm8995-objs := wm8995.o snd-soc-wm8997-objs := wm8997.o +snd-soc-wm8998-objs := wm8998.o snd-soc-wm9081-objs := wm9081.o snd-soc-wm9090-objs := wm9090.o snd-soc-wm9705-objs := wm9705.o
@@ -364,6 +365,7 @@ obj-$(CONFIG_SND_SOC_WM8993) += snd-soc-wm8993.o obj-$(CONFIG_SND_SOC_WM8994) += snd-soc-wm8994.o obj-$(CONFIG_SND_SOC_WM8995) += snd-soc-wm8995.o obj-$(CONFIG_SND_SOC_WM8997) += snd-soc-wm8997.o +obj-$(CONFIG_SND_SOC_WM8998) += snd-soc-wm8998.o obj-$(CONFIG_SND_SOC_WM9081) += snd-soc-wm9081.o obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o
sound/soc/codecs/arizona.c +33 -0
@@ -316,6 +316,7 @@ const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS] = {"Tone Generator 2" ,"Haptics" ,"AEC" , +"AEC2" ,"Mic Mute Mixer" ,"Noise Generator" , "IN1L",
@@ -423,6 +424,7 @@ int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS] = {0x05 ,0x06 ,/* Haptics */ 0x08 ,/* AEC */ +0x09 ,/* AEC2 */ 0x0c ,/* Noise mixer */ 0x0d ,/* Comfort noise */ 0x10, /* IN1L */
@@ -527,6 +529,32 @@ EXPORT_SYMBOL_GPL(arizona_mixer_values); const DECLARE_TLV_DB_SCALE(arizona_mixer_tlv, -3200, 100, 0);EXPORT_SYMBOL_GPL (arizona_mixer_tlv); +const char *const arizona_sample_rate_text[ARIZONA_SAMPLE_RATE_ENUM_SIZE ] = { +"12kHz" ,"24kHz" ,"48kHz" ,"96kHz" ,"192kHz" , +"11.025kHz" ,"22.05kHz" ,"44.1kHz" ,"88.2kHz" ,"176.4kHz" , +"4kHz" ,"8kHz" ,"16kHz" ,"32kHz" , +}; +EXPORT_SYMBOL_GPL (arizona_sample_rate_text); + +const unsigned int arizona_sample_rate_val[ARIZONA_SAMPLE_RATE_ENUM_SIZE ] = { +0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x09 ,0x0A ,0x0B ,0x0C ,0x0D , +0x10 ,0x11 ,0x12 ,0x13 , +}; +EXPORT_SYMBOL_GPL (arizona_sample_rate_val); + +const char *arizona_sample_rate_val_to_name (unsigned int rate_val) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (arizona_sample_rate_val); ++i) { +if (arizona_sample_rate_val[i] == rate_val) +return arizona_sample_rate_text[i]; + } + +return "Illegal" ; +} +EXPORT_SYMBOL_GPL (arizona_sample_rate_val_to_name); +const char *arizona_rate_text[ARIZONA_RATE_ENUM_SIZE ] = {"SYNCCLK rate" ,"8kHz" ,"16kHz" ,"ASYNCCLK rate" , };
@@ -1884,6 +1912,11 @@ static int arizona_calc_fratio(struct arizona_fll *fll,if (fll->arizona->rev <3 || sync)return init_ratio;break ; +case WM8998 : +case WM1814 : +if (sync) +return init_ratio; +break ;default :return init_ratio; }
sound/soc/codecs/arizona.h +6 -1
@@ -93,7 +93,7 @@ struct arizona_priv {bool dvfs_cached; }; -#define ARIZONA_NUM_MIXER_INPUTS 103 +#define ARIZONA_NUM_MIXER_INPUTS 104extern const unsigned int arizona_mixer_tlv[];extern const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS ];
@@ -214,8 +214,12 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS]; .num_regs = 1 }) }#define ARIZONA_RATE_ENUM_SIZE 4 +#define ARIZONA_SAMPLE_RATE_ENUM_SIZE 14 +extern const char *arizona_rate_text[ARIZONA_RATE_ENUM_SIZE ];extern const int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE ]; +extern const char *const arizona_sample_rate_text[ARIZONA_SAMPLE_RATE_ENUM_SIZE ]; +extern const unsigned int arizona_sample_rate_val[ARIZONA_SAMPLE_RATE_ENUM_SIZE ];extern const struct soc_enum arizona_isrc_fsl[];extern const struct soc_enum arizona_isrc_fsh[];
@@ -301,4 +305,5 @@ int arizona_set_output_mode(struct snd_soc_codec *codec, int output,extern bool arizona_input_analog (struct snd_soc_codec *codec,int shift); +extern const char *arizona_sample_rate_val_to_name (unsigned int rate_val);#endif
sound/soc/codecs/wm8998.c new file +1429 -0
1,429 lines not on this page · raw message
sound/soc/codecs/wm8998.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* wm8998.h -- ALSA SoC Audio driver for WM8998 codecs +* +* Copyright 2015 Cirrus Logic, Inc. +* +* Author: Richard Fitzgerald <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef _WM8998_H +#define _WM8998_H + +#include "arizona.h" + +#define WM8998_FLL1 1 +#define WM8998_FLL2 2 +#define WM8998_FLL1_REFCLK 3 +#define WM8998_FLL2_REFCLK 4 + +#endif
Signature · 1 line
1.9.1
kbuild test robot
build botRe: [PATCH 3/3] ASoC: wm8998: Initial WM8998 codec driver
config: i386-allmodconfig (attached as .config) reproduce: git checkout ab5dc265e390dfc32011868e02eef600f40efc41
Hi Richard,
[auto build test results on next-20150925 -- if it's inappropriate base, please ignore]
config: i386-allmodconfig (attached as .config) reproduce:
git checkout ab5dc265e390dfc32011868e02eef600f40efc41
# save the attached .config to linux build tree make ARCH=i386
All error/warnings (new ones prefixed by >>):
sound/soc/codecs/wm8998.c: In function 'wm8998_in1mux_put':
>> sound/soc/codecs/wm8998.c:155:45: error: 'struct snd_soc_codec' has no member named 'dapm'
return snd_soc_dapm_mux_update_power(&codec->dapm, kcontrol,
^
sound/soc/codecs/wm8998.c: In function 'wm8998_in2mux_put':
sound/soc/codecs/wm8998.c:190:45: error: 'struct snd_soc_codec' has no member named 'dapm'
return snd_soc_dapm_mux_update_power(&codec->dapm, kcontrol,
^
sound/soc/codecs/wm8998.c: In function 'wm8998_codec_probe':
sound/soc/codecs/wm8998.c:1308:35: error: 'struct snd_soc_codec' has no member named 'dapm'
priv->core.arizona->dapm = &codec->dapm;
^
sound/soc/codecs/wm8998.c:1313:33: error: 'struct snd_soc_codec' has no member named 'dapm'
snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
^
sound/soc/codecs/wm8998.c:1315:35: error: 'struct snd_soc_codec' has no member named 'dapm'
priv->core.arizona->dapm = &codec->dapm;
^
sound/soc/codecs/wm8998.c: In function 'wm8998_in2mux_put':
>> sound/soc/codecs/wm8998.c:193:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
sound/soc/codecs/wm8998.c: In function 'wm8998_in1mux_put':
sound/soc/codecs/wm8998.c:158:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^vim +155 sound/soc/codecs/wm8998.c
149 ARIZONA_IN1L_SRC_MASK |
150 ARIZONA_IN1L_SRC_SE_MASK,
151 src_val);
152 break;
153 }
154
> 155 return snd_soc_dapm_mux_update_power(&codec->dapm, kcontrol,
156 ucontrol->value.enumerated.item[0],
157 e, NULL);
158 }
159
160 static int wm8998_in2mux_put(struct snd_kcontrol *kcontrol,
161 struct snd_ctl_elem_value *ucontrol)
162 {
163 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
164 struct wm8998_priv *wm8998 = snd_soc_codec_get_drvdata(codec);
165 struct arizona *arizona = wm8998->core.arizona;
166 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
167 unsigned int mux, inmode, src_val, mode_val;
168
169 mux = ucontrol->value.enumerated.item[0];
170 if (mux > 1)
171 return -EINVAL;
172
173 inmode = arizona->pdata.inmode[1 + (2 * mux)];
174 if (inmode & ARIZONA_INMODE_DMIC)
175 mode_val = 1 << ARIZONA_IN2_MODE_SHIFT;
176 else
177 mode_val = 0;
178
179 src_val = mux << ARIZONA_IN2L_SRC_SHIFT;
180 if (inmode & ARIZONA_INMODE_SE)
181 src_val |= 1 << ARIZONA_IN2L_SRC_SE_SHIFT;
182
183 snd_soc_update_bits(codec, ARIZONA_IN2L_CONTROL,
184 ARIZONA_IN2_MODE_MASK, mode_val);
185
186 snd_soc_update_bits(codec, ARIZONA_ADC_DIGITAL_VOLUME_2L,
187 ARIZONA_IN2L_SRC_MASK | ARIZONA_IN2L_SRC_SE_MASK,
188 src_val);
189
190 return snd_soc_dapm_mux_update_power(&codec->dapm, kcontrol,
191 ucontrol->value.enumerated.item[0],
192 e, NULL);
> 193 } 194
195 static const char * const wm8998_inmux_texts[] = {
196 "A",
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation