diff options
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/wm8350.c | 183 | ||||
-rw-r--r-- | sound/soc/codecs/wm8350.h | 4 | ||||
-rw-r--r-- | sound/soc/fsl/wm1133-ev1.c | 6 |
3 files changed, 93 insertions, 100 deletions
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index fc79c6725d06..e92ebe52d485 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -256,8 +256,8 @@ static void wm8350_pga_work(struct work_struct *work) static int pga_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); struct wm8350_output *out; 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, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wm8350_data *wm8350_priv = snd_soc_component_get_drvdata(component); struct wm8350_output *out = NULL; struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; @@ -334,16 +334,16 @@ static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol, return ret; /* now hit the volume update bits (always bit 8) */ - val = snd_soc_read(codec, reg); - snd_soc_write(codec, reg, val | WM8350_OUT1_VU); + val = snd_soc_component_read32(component, reg); + snd_soc_component_write(component, reg, val | WM8350_OUT1_VU); return 1; } static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wm8350_data *wm8350_priv = snd_soc_component_get_drvdata(component); struct wm8350_output *out1 = &wm8350_priv->out1; struct wm8350_output *out2 = &wm8350_priv->out2; 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, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = codec_dai->codec; - struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = wm8350_data->wm8350; 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: wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_1, 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; - 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; } @@ -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) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; u16 val; switch (div_id) { 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; - snd_soc_write(codec, WM8350_ADC_DIVIDER, val | div); + snd_soc_component_write(component, WM8350_ADC_DIVIDER, val | div); break; 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; - snd_soc_write(codec, WM8350_DAC_CLOCK_CONTROL, val | div); + snd_soc_component_write(component, WM8350_DAC_CLOCK_CONTROL, val | div); break; 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; - snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); + snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); break; 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; - snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); + snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); break; 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; - snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); + snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); break; 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; - snd_soc_write(codec, WM8350_DAC_LR_RATE, val | div); + snd_soc_component_write(component, WM8350_DAC_LR_RATE, val | div); break; 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; - snd_soc_write(codec, WM8350_ADC_LR_RATE, val | div); + snd_soc_component_write(component, WM8350_ADC_LR_RATE, val | div); break; default: 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) { - struct snd_soc_codec *codec = codec_dai->codec; - u16 iface = snd_soc_read(codec, WM8350_AI_FORMATING) & + struct snd_soc_component *component = codec_dai->component; + u16 iface = snd_soc_component_read32(component, WM8350_AI_FORMATING) & ~(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; - 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; - 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; /* 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; } - snd_soc_write(codec, WM8350_AI_FORMATING, iface); - snd_soc_write(codec, WM8350_AI_DAC_CONTROL, master); - snd_soc_write(codec, WM8350_DAC_LR_RATE, dac_lrc); - snd_soc_write(codec, WM8350_ADC_LR_RATE, adc_lrc); + snd_soc_component_write(component, WM8350_AI_FORMATING, iface); + snd_soc_component_write(component, WM8350_AI_DAC_CONTROL, master); + snd_soc_component_write(component, WM8350_DAC_LR_RATE, dac_lrc); + snd_soc_component_write(component, WM8350_ADC_LR_RATE, adc_lrc); 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_soc_dai *codec_dai) { - struct snd_soc_codec *codec = codec_dai->codec; - struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); 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; /* bit size */ @@ -928,7 +928,7 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream, 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 * 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) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; unsigned int val; if (mute) @@ -955,7 +955,7 @@ static int wm8350_mute(struct snd_soc_dai *dai, int mute) else 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; } @@ -1024,8 +1024,8 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out) { - struct snd_soc_codec *codec = codec_dai->codec; - struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct wm8350_data *priv = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = priv->wm8350; struct _fll_div fll_div; int ret = 0; @@ -1050,17 +1050,17 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai, fll_div.ratio); /* 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); - snd_soc_write(codec, WM8350_FLL_CONTROL_1, + snd_soc_component_write(component, WM8350_FLL_CONTROL_1, 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. n & WM8350_FLL_N_MASK)); - snd_soc_write(codec, WM8350_FLL_CONTROL_3, fll_div.k); - fll_4 = snd_soc_read(codec, WM8350_FLL_CONTROL_4) & + snd_soc_component_write(component, WM8350_FLL_CONTROL_3, fll_div.k); + fll_4 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_4) & ~(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_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; } -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) { - 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_audio_platform_data *platform = wm8350->codec.platform_data; @@ -1101,7 +1101,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec, break; 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), priv->supplies); 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. * - * @codec: WM8350 codec + * @component: WM8350 component * @which: left or right jack detect signal * @jack: jack to report detection events on * @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 * 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 wm8350_data *priv = snd_soc_codec_get_drvdata(codec); + struct wm8350_data *priv = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = priv->wm8350; int ena; @@ -1389,7 +1389,7 @@ static irqreturn_t wm8350_mic_handler(int irq, void *data) /** * wm8350_mic_jack_detect - Enable microphone jack detection. * - * @codec: WM8350 codec + * @component: WM8350 component * @jack: jack to report detection events on * @detect_report: value to report when presence 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 * 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, 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; priv->mic.jack = jack; @@ -1455,26 +1455,26 @@ static struct snd_soc_dai_driver wm8350_dai = { .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_output *out1; struct wm8350_output *out2; int ret, i; 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; } - priv = devm_kzalloc(codec->dev, sizeof(struct wm8350_data), + priv = devm_kzalloc(component->dev, sizeof(struct wm8350_data), GFP_KERNEL); if (priv == NULL) return -ENOMEM; - snd_soc_codec_init_regmap(codec, wm8350->regmap); - snd_soc_codec_set_drvdata(codec, priv); + snd_soc_component_init_regmap(component, wm8350->regmap); + snd_soc_component_set_drvdata(component, priv); 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); /* Enable robust clocking mode in ADC */ - snd_soc_write(codec, WM8350_SECURITY, 0xa7); - snd_soc_write(codec, 0xde, 0x13); - snd_soc_write(codec, WM8350_SECURITY, 0); + snd_soc_component_write(component, WM8350_SECURITY, 0xa7); + snd_soc_component_write(component, 0xde, 0x13); + snd_soc_component_write(component, WM8350_SECURITY, 0); /* read OUT1 & OUT2 volumes */ out1 = &priv->out1; @@ -1552,10 +1552,10 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) 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 *wm8350 = dev_get_platdata(codec->dev); + struct wm8350_data *priv = snd_soc_component_get_drvdata(component); + struct wm8350 *wm8350 = dev_get_platdata(component->dev); wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, 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); wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); - - return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8350 = { - .probe = wm8350_codec_probe, - .remove = wm8350_codec_remove, - .set_bias_level = wm8350_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8350_snd_controls, - .num_controls = ARRAY_SIZE(wm8350_snd_controls), - .dapm_widgets = wm8350_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets), - .dapm_routes = wm8350_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8350 = { + .probe = wm8350_component_probe, + .remove = wm8350_component_remove, + .set_bias_level = wm8350_set_bias_level, + .controls = wm8350_snd_controls, + .num_controls = ARRAY_SIZE(wm8350_snd_controls), + .dapm_widgets = wm8350_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets), + .dapm_routes = wm8350_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; 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); } -static int wm8350_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - return 0; -} - static struct platform_driver wm8350_codec_driver = { .driver = { .name = "wm8350-codec", }, .probe = wm8350_probe, - .remove = wm8350_remove, }; module_platform_driver(wm8350_codec_driver); diff --git a/sound/soc/codecs/wm8350.h b/sound/soc/codecs/wm8350.h index 74108eb82938..1191326c4a61 100644 --- a/sound/soc/codecs/wm8350.h +++ b/sound/soc/codecs/wm8350.h @@ -20,9 +20,9 @@ enum wm8350_jack { 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); -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, int detect_report, int short_report); diff --git a/sound/soc/fsl/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c index cdaf16367b47..2f80b21b2921 100644 --- a/sound/soc/fsl/wm1133-ev1.c +++ b/sound/soc/fsl/wm1133-ev1.c @@ -201,18 +201,18 @@ static struct snd_soc_jack_pin mic_jack_pins[] = { 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 */ snd_soc_card_jack_new(rtd->card, "Headphone", SND_JACK_HEADPHONE, &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 */ snd_soc_card_jack_new(rtd->card, "Microphone", SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack, 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_soc_dapm_force_enable_pin(&rtd->card->dapm, "Mic Bias"); |