ASoC: wm8350: replace codec to component
Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
7928b2cbe5
commit
2621a9a4a2
|
@ -256,8 +256,8 @@ static void wm8350_pga_work(struct work_struct *work)
|
||||||
static int pga_event(struct snd_soc_dapm_widget *w,
|
static int pga_event(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||||
struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350_output *out;
|
struct wm8350_output *out;
|
||||||
|
|
||||||
switch (w->shift) {
|
switch (w->shift) {
|
||||||
|
@ -299,8 +299,8 @@ static int pga_event(struct snd_soc_dapm_widget *w,
|
||||||
static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol,
|
static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *wm8350_priv = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350_output *out = NULL;
|
struct wm8350_output *out = NULL;
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
|
@ -334,16 +334,16 @@ static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* now hit the volume update bits (always bit 8) */
|
/* now hit the volume update bits (always bit 8) */
|
||||||
val = snd_soc_read(codec, reg);
|
val = snd_soc_component_read32(component, reg);
|
||||||
snd_soc_write(codec, reg, val | WM8350_OUT1_VU);
|
snd_soc_component_write(component, reg, val | WM8350_OUT1_VU);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol,
|
static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *wm8350_priv = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350_output *out1 = &wm8350_priv->out1;
|
struct wm8350_output *out1 = &wm8350_priv->out1;
|
||||||
struct wm8350_output *out2 = &wm8350_priv->out2;
|
struct wm8350_output *out2 = &wm8350_priv->out2;
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
|
@ -753,8 +753,8 @@ static const struct snd_soc_dapm_route wm8350_dapm_routes[] = {
|
||||||
static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||||
int clk_id, unsigned int freq, int dir)
|
int clk_id, unsigned int freq, int dir)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = codec_dai->codec;
|
struct snd_soc_component *component = codec_dai->component;
|
||||||
struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350 *wm8350 = wm8350_data->wm8350;
|
struct wm8350 *wm8350 = wm8350_data->wm8350;
|
||||||
u16 fll_4;
|
u16 fll_4;
|
||||||
|
|
||||||
|
@ -769,9 +769,9 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||||
case WM8350_MCLK_SEL_PLL_32K:
|
case WM8350_MCLK_SEL_PLL_32K:
|
||||||
wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_1,
|
wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_1,
|
||||||
WM8350_MCLK_SEL);
|
WM8350_MCLK_SEL);
|
||||||
fll_4 = snd_soc_read(codec, WM8350_FLL_CONTROL_4) &
|
fll_4 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_4) &
|
||||||
~WM8350_FLL_CLK_SRC_MASK;
|
~WM8350_FLL_CLK_SRC_MASK;
|
||||||
snd_soc_write(codec, WM8350_FLL_CONTROL_4, fll_4 | clk_id);
|
snd_soc_component_write(component, WM8350_FLL_CONTROL_4, fll_4 | clk_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,44 +788,44 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||||
|
|
||||||
static int wm8350_set_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div)
|
static int wm8350_set_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = codec_dai->codec;
|
struct snd_soc_component *component = codec_dai->component;
|
||||||
u16 val;
|
u16 val;
|
||||||
|
|
||||||
switch (div_id) {
|
switch (div_id) {
|
||||||
case WM8350_ADC_CLKDIV:
|
case WM8350_ADC_CLKDIV:
|
||||||
val = snd_soc_read(codec, WM8350_ADC_DIVIDER) &
|
val = snd_soc_component_read32(component, WM8350_ADC_DIVIDER) &
|
||||||
~WM8350_ADC_CLKDIV_MASK;
|
~WM8350_ADC_CLKDIV_MASK;
|
||||||
snd_soc_write(codec, WM8350_ADC_DIVIDER, val | div);
|
snd_soc_component_write(component, WM8350_ADC_DIVIDER, val | div);
|
||||||
break;
|
break;
|
||||||
case WM8350_DAC_CLKDIV:
|
case WM8350_DAC_CLKDIV:
|
||||||
val = snd_soc_read(codec, WM8350_DAC_CLOCK_CONTROL) &
|
val = snd_soc_component_read32(component, WM8350_DAC_CLOCK_CONTROL) &
|
||||||
~WM8350_DAC_CLKDIV_MASK;
|
~WM8350_DAC_CLKDIV_MASK;
|
||||||
snd_soc_write(codec, WM8350_DAC_CLOCK_CONTROL, val | div);
|
snd_soc_component_write(component, WM8350_DAC_CLOCK_CONTROL, val | div);
|
||||||
break;
|
break;
|
||||||
case WM8350_BCLK_CLKDIV:
|
case WM8350_BCLK_CLKDIV:
|
||||||
val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) &
|
val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) &
|
||||||
~WM8350_BCLK_DIV_MASK;
|
~WM8350_BCLK_DIV_MASK;
|
||||||
snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div);
|
snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div);
|
||||||
break;
|
break;
|
||||||
case WM8350_OPCLK_CLKDIV:
|
case WM8350_OPCLK_CLKDIV:
|
||||||
val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) &
|
val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) &
|
||||||
~WM8350_OPCLK_DIV_MASK;
|
~WM8350_OPCLK_DIV_MASK;
|
||||||
snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div);
|
snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div);
|
||||||
break;
|
break;
|
||||||
case WM8350_SYS_CLKDIV:
|
case WM8350_SYS_CLKDIV:
|
||||||
val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) &
|
val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) &
|
||||||
~WM8350_MCLK_DIV_MASK;
|
~WM8350_MCLK_DIV_MASK;
|
||||||
snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div);
|
snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div);
|
||||||
break;
|
break;
|
||||||
case WM8350_DACLR_CLKDIV:
|
case WM8350_DACLR_CLKDIV:
|
||||||
val = snd_soc_read(codec, WM8350_DAC_LR_RATE) &
|
val = snd_soc_component_read32(component, WM8350_DAC_LR_RATE) &
|
||||||
~WM8350_DACLRC_RATE_MASK;
|
~WM8350_DACLRC_RATE_MASK;
|
||||||
snd_soc_write(codec, WM8350_DAC_LR_RATE, val | div);
|
snd_soc_component_write(component, WM8350_DAC_LR_RATE, val | div);
|
||||||
break;
|
break;
|
||||||
case WM8350_ADCLR_CLKDIV:
|
case WM8350_ADCLR_CLKDIV:
|
||||||
val = snd_soc_read(codec, WM8350_ADC_LR_RATE) &
|
val = snd_soc_component_read32(component, WM8350_ADC_LR_RATE) &
|
||||||
~WM8350_ADCLRC_RATE_MASK;
|
~WM8350_ADCLRC_RATE_MASK;
|
||||||
snd_soc_write(codec, WM8350_ADC_LR_RATE, val | div);
|
snd_soc_component_write(component, WM8350_ADC_LR_RATE, val | div);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -836,14 +836,14 @@ static int wm8350_set_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div)
|
||||||
|
|
||||||
static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = codec_dai->codec;
|
struct snd_soc_component *component = codec_dai->component;
|
||||||
u16 iface = snd_soc_read(codec, WM8350_AI_FORMATING) &
|
u16 iface = snd_soc_component_read32(component, WM8350_AI_FORMATING) &
|
||||||
~(WM8350_AIF_BCLK_INV | WM8350_AIF_LRCLK_INV | WM8350_AIF_FMT_MASK);
|
~(WM8350_AIF_BCLK_INV | WM8350_AIF_LRCLK_INV | WM8350_AIF_FMT_MASK);
|
||||||
u16 master = snd_soc_read(codec, WM8350_AI_DAC_CONTROL) &
|
u16 master = snd_soc_component_read32(component, WM8350_AI_DAC_CONTROL) &
|
||||||
~WM8350_BCLK_MSTR;
|
~WM8350_BCLK_MSTR;
|
||||||
u16 dac_lrc = snd_soc_read(codec, WM8350_DAC_LR_RATE) &
|
u16 dac_lrc = snd_soc_component_read32(component, WM8350_DAC_LR_RATE) &
|
||||||
~WM8350_DACLRC_ENA;
|
~WM8350_DACLRC_ENA;
|
||||||
u16 adc_lrc = snd_soc_read(codec, WM8350_ADC_LR_RATE) &
|
u16 adc_lrc = snd_soc_component_read32(component, WM8350_ADC_LR_RATE) &
|
||||||
~WM8350_ADCLRC_ENA;
|
~WM8350_ADCLRC_ENA;
|
||||||
|
|
||||||
/* set master/slave audio interface */
|
/* set master/slave audio interface */
|
||||||
|
@ -896,10 +896,10 @@ static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_soc_write(codec, WM8350_AI_FORMATING, iface);
|
snd_soc_component_write(component, WM8350_AI_FORMATING, iface);
|
||||||
snd_soc_write(codec, WM8350_AI_DAC_CONTROL, master);
|
snd_soc_component_write(component, WM8350_AI_DAC_CONTROL, master);
|
||||||
snd_soc_write(codec, WM8350_DAC_LR_RATE, dac_lrc);
|
snd_soc_component_write(component, WM8350_DAC_LR_RATE, dac_lrc);
|
||||||
snd_soc_write(codec, WM8350_ADC_LR_RATE, adc_lrc);
|
snd_soc_component_write(component, WM8350_ADC_LR_RATE, adc_lrc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -907,10 +907,10 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
struct snd_pcm_hw_params *params,
|
struct snd_pcm_hw_params *params,
|
||||||
struct snd_soc_dai *codec_dai)
|
struct snd_soc_dai *codec_dai)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = codec_dai->codec;
|
struct snd_soc_component *component = codec_dai->component;
|
||||||
struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350 *wm8350 = wm8350_data->wm8350;
|
struct wm8350 *wm8350 = wm8350_data->wm8350;
|
||||||
u16 iface = snd_soc_read(codec, WM8350_AI_FORMATING) &
|
u16 iface = snd_soc_component_read32(component, WM8350_AI_FORMATING) &
|
||||||
~WM8350_AIF_WL_MASK;
|
~WM8350_AIF_WL_MASK;
|
||||||
|
|
||||||
/* bit size */
|
/* bit size */
|
||||||
|
@ -928,7 +928,7 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_soc_write(codec, WM8350_AI_FORMATING, iface);
|
snd_soc_component_write(component, WM8350_AI_FORMATING, iface);
|
||||||
|
|
||||||
/* The sloping stopband filter is recommended for use with
|
/* The sloping stopband filter is recommended for use with
|
||||||
* lower sample rates to improve performance.
|
* lower sample rates to improve performance.
|
||||||
|
@ -947,7 +947,7 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
|
|
||||||
static int wm8350_mute(struct snd_soc_dai *dai, int mute)
|
static int wm8350_mute(struct snd_soc_dai *dai, int mute)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = dai->codec;
|
struct snd_soc_component *component = dai->component;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
if (mute)
|
if (mute)
|
||||||
|
@ -955,7 +955,7 @@ static int wm8350_mute(struct snd_soc_dai *dai, int mute)
|
||||||
else
|
else
|
||||||
val = 0;
|
val = 0;
|
||||||
|
|
||||||
snd_soc_update_bits(codec, WM8350_DAC_MUTE, WM8350_DAC_MUTE_ENA, val);
|
snd_soc_component_update_bits(component, WM8350_DAC_MUTE, WM8350_DAC_MUTE_ENA, val);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1024,8 +1024,8 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
|
||||||
int pll_id, int source, unsigned int freq_in,
|
int pll_id, int source, unsigned int freq_in,
|
||||||
unsigned int freq_out)
|
unsigned int freq_out)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = codec_dai->codec;
|
struct snd_soc_component *component = codec_dai->component;
|
||||||
struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *priv = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350 *wm8350 = priv->wm8350;
|
struct wm8350 *wm8350 = priv->wm8350;
|
||||||
struct _fll_div fll_div;
|
struct _fll_div fll_div;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -1050,17 +1050,17 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
|
||||||
fll_div.ratio);
|
fll_div.ratio);
|
||||||
|
|
||||||
/* set up N.K & dividers */
|
/* set up N.K & dividers */
|
||||||
fll_1 = snd_soc_read(codec, WM8350_FLL_CONTROL_1) &
|
fll_1 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_1) &
|
||||||
~(WM8350_FLL_OUTDIV_MASK | WM8350_FLL_RSP_RATE_MASK | 0xc000);
|
~(WM8350_FLL_OUTDIV_MASK | WM8350_FLL_RSP_RATE_MASK | 0xc000);
|
||||||
snd_soc_write(codec, WM8350_FLL_CONTROL_1,
|
snd_soc_component_write(component, WM8350_FLL_CONTROL_1,
|
||||||
fll_1 | (fll_div.div << 8) | 0x50);
|
fll_1 | (fll_div.div << 8) | 0x50);
|
||||||
snd_soc_write(codec, WM8350_FLL_CONTROL_2,
|
snd_soc_component_write(component, WM8350_FLL_CONTROL_2,
|
||||||
(fll_div.ratio << 11) | (fll_div.
|
(fll_div.ratio << 11) | (fll_div.
|
||||||
n & WM8350_FLL_N_MASK));
|
n & WM8350_FLL_N_MASK));
|
||||||
snd_soc_write(codec, WM8350_FLL_CONTROL_3, fll_div.k);
|
snd_soc_component_write(component, WM8350_FLL_CONTROL_3, fll_div.k);
|
||||||
fll_4 = snd_soc_read(codec, WM8350_FLL_CONTROL_4) &
|
fll_4 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_4) &
|
||||||
~(WM8350_FLL_FRAC | WM8350_FLL_SLOW_LOCK_REF);
|
~(WM8350_FLL_FRAC | WM8350_FLL_SLOW_LOCK_REF);
|
||||||
snd_soc_write(codec, WM8350_FLL_CONTROL_4,
|
snd_soc_component_write(component, WM8350_FLL_CONTROL_4,
|
||||||
fll_4 | (fll_div.k ? WM8350_FLL_FRAC : 0) |
|
fll_4 | (fll_div.k ? WM8350_FLL_FRAC : 0) |
|
||||||
(fll_div.ratio == 8 ? WM8350_FLL_SLOW_LOCK_REF : 0));
|
(fll_div.ratio == 8 ? WM8350_FLL_SLOW_LOCK_REF : 0));
|
||||||
|
|
||||||
|
@ -1074,10 +1074,10 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm8350_set_bias_level(struct snd_soc_codec *codec,
|
static int wm8350_set_bias_level(struct snd_soc_component *component,
|
||||||
enum snd_soc_bias_level level)
|
enum snd_soc_bias_level level)
|
||||||
{
|
{
|
||||||
struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *priv = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350 *wm8350 = priv->wm8350;
|
struct wm8350 *wm8350 = priv->wm8350;
|
||||||
struct wm8350_audio_platform_data *platform =
|
struct wm8350_audio_platform_data *platform =
|
||||||
wm8350->codec.platform_data;
|
wm8350->codec.platform_data;
|
||||||
|
@ -1101,7 +1101,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SND_SOC_BIAS_STANDBY:
|
case SND_SOC_BIAS_STANDBY:
|
||||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||||
ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies),
|
ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies),
|
||||||
priv->supplies);
|
priv->supplies);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
|
@ -1310,7 +1310,7 @@ static irqreturn_t wm8350_hpr_jack_handler(int irq, void *data)
|
||||||
/**
|
/**
|
||||||
* wm8350_hp_jack_detect - Enable headphone jack detection.
|
* wm8350_hp_jack_detect - Enable headphone jack detection.
|
||||||
*
|
*
|
||||||
* @codec: WM8350 codec
|
* @component: WM8350 component
|
||||||
* @which: left or right jack detect signal
|
* @which: left or right jack detect signal
|
||||||
* @jack: jack to report detection events on
|
* @jack: jack to report detection events on
|
||||||
* @report: value to report
|
* @report: value to report
|
||||||
|
@ -1318,10 +1318,10 @@ static irqreturn_t wm8350_hpr_jack_handler(int irq, void *data)
|
||||||
* Enables the headphone jack detection of the WM8350. If no report
|
* Enables the headphone jack detection of the WM8350. If no report
|
||||||
* is specified then detection is disabled.
|
* is specified then detection is disabled.
|
||||||
*/
|
*/
|
||||||
int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
|
int wm8350_hp_jack_detect(struct snd_soc_component *component, enum wm8350_jack which,
|
||||||
struct snd_soc_jack *jack, int report)
|
struct snd_soc_jack *jack, int report)
|
||||||
{
|
{
|
||||||
struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *priv = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350 *wm8350 = priv->wm8350;
|
struct wm8350 *wm8350 = priv->wm8350;
|
||||||
int ena;
|
int ena;
|
||||||
|
|
||||||
|
@ -1389,7 +1389,7 @@ static irqreturn_t wm8350_mic_handler(int irq, void *data)
|
||||||
/**
|
/**
|
||||||
* wm8350_mic_jack_detect - Enable microphone jack detection.
|
* wm8350_mic_jack_detect - Enable microphone jack detection.
|
||||||
*
|
*
|
||||||
* @codec: WM8350 codec
|
* @component: WM8350 component
|
||||||
* @jack: jack to report detection events on
|
* @jack: jack to report detection events on
|
||||||
* @detect_report: value to report when presence detected
|
* @detect_report: value to report when presence detected
|
||||||
* @short_report: value to report when microphone short detected
|
* @short_report: value to report when microphone short detected
|
||||||
|
@ -1397,11 +1397,11 @@ static irqreturn_t wm8350_mic_handler(int irq, void *data)
|
||||||
* Enables the microphone jack detection of the WM8350. If both reports
|
* Enables the microphone jack detection of the WM8350. If both reports
|
||||||
* are specified as zero then detection is disabled.
|
* are specified as zero then detection is disabled.
|
||||||
*/
|
*/
|
||||||
int wm8350_mic_jack_detect(struct snd_soc_codec *codec,
|
int wm8350_mic_jack_detect(struct snd_soc_component *component,
|
||||||
struct snd_soc_jack *jack,
|
struct snd_soc_jack *jack,
|
||||||
int detect_report, int short_report)
|
int detect_report, int short_report)
|
||||||
{
|
{
|
||||||
struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *priv = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350 *wm8350 = priv->wm8350;
|
struct wm8350 *wm8350 = priv->wm8350;
|
||||||
|
|
||||||
priv->mic.jack = jack;
|
priv->mic.jack = jack;
|
||||||
|
@ -1455,26 +1455,26 @@ static struct snd_soc_dai_driver wm8350_dai = {
|
||||||
.ops = &wm8350_dai_ops,
|
.ops = &wm8350_dai_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int wm8350_codec_probe(struct snd_soc_codec *codec)
|
static int wm8350_component_probe(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
struct wm8350 *wm8350 = dev_get_platdata(codec->dev);
|
struct wm8350 *wm8350 = dev_get_platdata(component->dev);
|
||||||
struct wm8350_data *priv;
|
struct wm8350_data *priv;
|
||||||
struct wm8350_output *out1;
|
struct wm8350_output *out1;
|
||||||
struct wm8350_output *out2;
|
struct wm8350_output *out2;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
if (wm8350->codec.platform_data == NULL) {
|
if (wm8350->codec.platform_data == NULL) {
|
||||||
dev_err(codec->dev, "No audio platform data supplied\n");
|
dev_err(component->dev, "No audio platform data supplied\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv = devm_kzalloc(codec->dev, sizeof(struct wm8350_data),
|
priv = devm_kzalloc(component->dev, sizeof(struct wm8350_data),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
snd_soc_codec_init_regmap(codec, wm8350->regmap);
|
snd_soc_component_init_regmap(component, wm8350->regmap);
|
||||||
snd_soc_codec_set_drvdata(codec, priv);
|
snd_soc_component_set_drvdata(component, priv);
|
||||||
|
|
||||||
priv->wm8350 = wm8350;
|
priv->wm8350 = wm8350;
|
||||||
|
|
||||||
|
@ -1497,9 +1497,9 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
|
||||||
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
|
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
|
||||||
|
|
||||||
/* Enable robust clocking mode in ADC */
|
/* Enable robust clocking mode in ADC */
|
||||||
snd_soc_write(codec, WM8350_SECURITY, 0xa7);
|
snd_soc_component_write(component, WM8350_SECURITY, 0xa7);
|
||||||
snd_soc_write(codec, 0xde, 0x13);
|
snd_soc_component_write(component, 0xde, 0x13);
|
||||||
snd_soc_write(codec, WM8350_SECURITY, 0);
|
snd_soc_component_write(component, WM8350_SECURITY, 0);
|
||||||
|
|
||||||
/* read OUT1 & OUT2 volumes */
|
/* read OUT1 & OUT2 volumes */
|
||||||
out1 = &priv->out1;
|
out1 = &priv->out1;
|
||||||
|
@ -1552,10 +1552,10 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm8350_codec_remove(struct snd_soc_codec *codec)
|
static void wm8350_component_remove(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
|
struct wm8350_data *priv = snd_soc_component_get_drvdata(component);
|
||||||
struct wm8350 *wm8350 = dev_get_platdata(codec->dev);
|
struct wm8350 *wm8350 = dev_get_platdata(component->dev);
|
||||||
|
|
||||||
wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
|
wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
|
||||||
WM8350_JDL_ENA | WM8350_JDR_ENA);
|
WM8350_JDL_ENA | WM8350_JDR_ENA);
|
||||||
|
@ -1578,44 +1578,37 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
|
||||||
flush_delayed_work(&priv->pga_work);
|
flush_delayed_work(&priv->pga_work);
|
||||||
|
|
||||||
wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
|
wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_soc_codec_driver soc_codec_dev_wm8350 = {
|
static const struct snd_soc_component_driver soc_component_dev_wm8350 = {
|
||||||
.probe = wm8350_codec_probe,
|
.probe = wm8350_component_probe,
|
||||||
.remove = wm8350_codec_remove,
|
.remove = wm8350_component_remove,
|
||||||
.set_bias_level = wm8350_set_bias_level,
|
.set_bias_level = wm8350_set_bias_level,
|
||||||
.suspend_bias_off = true,
|
.controls = wm8350_snd_controls,
|
||||||
|
.num_controls = ARRAY_SIZE(wm8350_snd_controls),
|
||||||
.component_driver = {
|
.dapm_widgets = wm8350_dapm_widgets,
|
||||||
.controls = wm8350_snd_controls,
|
.num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets),
|
||||||
.num_controls = ARRAY_SIZE(wm8350_snd_controls),
|
.dapm_routes = wm8350_dapm_routes,
|
||||||
.dapm_widgets = wm8350_dapm_widgets,
|
.num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes),
|
||||||
.num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets),
|
.suspend_bias_off = 1,
|
||||||
.dapm_routes = wm8350_dapm_routes,
|
.idle_bias_on = 1,
|
||||||
.num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes),
|
.use_pmdown_time = 1,
|
||||||
},
|
.endianness = 1,
|
||||||
|
.non_legacy_dai_naming = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int wm8350_probe(struct platform_device *pdev)
|
static int wm8350_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8350,
|
return devm_snd_soc_register_component(&pdev->dev,
|
||||||
|
&soc_component_dev_wm8350,
|
||||||
&wm8350_dai, 1);
|
&wm8350_dai, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm8350_remove(struct platform_device *pdev)
|
|
||||||
{
|
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct platform_driver wm8350_codec_driver = {
|
static struct platform_driver wm8350_codec_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "wm8350-codec",
|
.name = "wm8350-codec",
|
||||||
},
|
},
|
||||||
.probe = wm8350_probe,
|
.probe = wm8350_probe,
|
||||||
.remove = wm8350_remove,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(wm8350_codec_driver);
|
module_platform_driver(wm8350_codec_driver);
|
||||||
|
|
|
@ -20,9 +20,9 @@ enum wm8350_jack {
|
||||||
WM8350_JDR = 2,
|
WM8350_JDR = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
|
int wm8350_hp_jack_detect(struct snd_soc_component *component, enum wm8350_jack which,
|
||||||
struct snd_soc_jack *jack, int report);
|
struct snd_soc_jack *jack, int report);
|
||||||
int wm8350_mic_jack_detect(struct snd_soc_codec *codec,
|
int wm8350_mic_jack_detect(struct snd_soc_component *component,
|
||||||
struct snd_soc_jack *jack,
|
struct snd_soc_jack *jack,
|
||||||
int detect_report, int short_report);
|
int detect_report, int short_report);
|
||||||
|
|
||||||
|
|
|
@ -201,18 +201,18 @@ static struct snd_soc_jack_pin mic_jack_pins[] = {
|
||||||
|
|
||||||
static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd)
|
static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = rtd->codec;
|
struct snd_soc_component *component = rtd->codec_dai->component;
|
||||||
|
|
||||||
/* Headphone jack detection */
|
/* Headphone jack detection */
|
||||||
snd_soc_card_jack_new(rtd->card, "Headphone", SND_JACK_HEADPHONE,
|
snd_soc_card_jack_new(rtd->card, "Headphone", SND_JACK_HEADPHONE,
|
||||||
&hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins));
|
&hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins));
|
||||||
wm8350_hp_jack_detect(codec, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE);
|
wm8350_hp_jack_detect(component, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE);
|
||||||
|
|
||||||
/* Microphone jack detection */
|
/* Microphone jack detection */
|
||||||
snd_soc_card_jack_new(rtd->card, "Microphone",
|
snd_soc_card_jack_new(rtd->card, "Microphone",
|
||||||
SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack,
|
SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack,
|
||||||
mic_jack_pins, ARRAY_SIZE(mic_jack_pins));
|
mic_jack_pins, ARRAY_SIZE(mic_jack_pins));
|
||||||
wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE,
|
wm8350_mic_jack_detect(component, &mic_jack, SND_JACK_MICROPHONE,
|
||||||
SND_JACK_BTN_0);
|
SND_JACK_BTN_0);
|
||||||
|
|
||||||
snd_soc_dapm_force_enable_pin(&rtd->card->dapm, "Mic Bias");
|
snd_soc_dapm_force_enable_pin(&rtd->card->dapm, "Mic Bias");
|
||||||
|
|
Loading…
Reference in New Issue