From 90e678d2e1a50b913f23a897851caa3d190690b1 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 04:34:42 +0000 Subject: ASoC: bt-sco: 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 Signed-off-by: Mark Brown --- sound/soc/codecs/bt-sco.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'sound/soc/codecs') diff --git a/sound/soc/codecs/bt-sco.c b/sound/soc/codecs/bt-sco.c index 806191addb44..842204203eb3 100644 --- a/sound/soc/codecs/bt-sco.c +++ b/sound/soc/codecs/bt-sco.c @@ -62,25 +62,26 @@ static struct snd_soc_dai_driver bt_sco_dai[] = { } }; -static const struct snd_soc_codec_driver soc_codec_dev_bt_sco = { - .component_driver = { - .dapm_widgets = bt_sco_widgets, - .num_dapm_widgets = ARRAY_SIZE(bt_sco_widgets), - .dapm_routes = bt_sco_routes, - .num_dapm_routes = ARRAY_SIZE(bt_sco_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_bt_sco = { + .dapm_widgets = bt_sco_widgets, + .num_dapm_widgets = ARRAY_SIZE(bt_sco_widgets), + .dapm_routes = bt_sco_routes, + .num_dapm_routes = ARRAY_SIZE(bt_sco_routes), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int bt_sco_probe(struct platform_device *pdev) { - return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_bt_sco, + return devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_bt_sco, bt_sco_dai, ARRAY_SIZE(bt_sco_dai)); } static int bt_sco_remove(struct platform_device *pdev) { - snd_soc_unregister_codec(&pdev->dev); - return 0; } -- cgit v1.2.3 From 0fe1daa6663ae9437c7168b81fe23c9ed50f55df Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 13 Feb 2018 02:03:12 +0000 Subject: ASoC: arizona: replace codec to component Now we can replace Codec to Component. Let's do it. Because there are many drivers which are using arizona, we need to update these all related drivers in same time. Otherwise compile error/warning happen Note: cs47l24 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 wm5102 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 wm5110 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 wm8997 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 wm8998 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto Tested-by: Charles Keepax Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/arizona.c | 208 ++++++++++++++++++++--------------------- sound/soc/codecs/arizona.h | 24 ++--- sound/soc/codecs/cs47l24.c | 86 ++++++++--------- sound/soc/codecs/wm5102.c | 106 ++++++++++----------- sound/soc/codecs/wm5110.c | 140 +++++++++++++-------------- sound/soc/codecs/wm8997.c | 62 ++++++------ sound/soc/codecs/wm8998.c | 88 ++++++++--------- sound/soc/codecs/wm_adsp.c | 58 ++++++------ sound/soc/codecs/wm_adsp.h | 6 +- sound/soc/samsung/tm2_wm5110.c | 54 +++++------ 10 files changed, 400 insertions(+), 432 deletions(-) (limited to 'sound/soc/codecs') diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index b3375e19598a..ffcfe8ea1848 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c @@ -84,13 +84,13 @@ static int arizona_spk_ev(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 arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); int val; switch (event) { case SND_SOC_DAPM_POST_PMU: - val = snd_soc_read(codec, ARIZONA_INTERRUPT_RAW_STATUS_3); + val = snd_soc_component_read32(component, ARIZONA_INTERRUPT_RAW_STATUS_3); if (val & ARIZONA_SPK_OVERHEAT_STS) { dev_crit(arizona->dev, "Speaker not enabled due to temperature\n"); @@ -169,10 +169,10 @@ static const struct snd_soc_dapm_widget arizona_spkr = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD); -int arizona_init_spk(struct snd_soc_codec *codec) +int arizona_init_spk(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int ret; @@ -238,10 +238,10 @@ static const struct snd_soc_dapm_route arizona_mono_routes[] = { { "OUT6R", NULL, "OUT6L" }, }; -int arizona_init_mono(struct snd_soc_codec *codec) +int arizona_init_mono(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int i; @@ -255,11 +255,9 @@ int arizona_init_mono(struct snd_soc_codec *codec) } EXPORT_SYMBOL_GPL(arizona_init_mono); -int arizona_init_gpio(struct snd_soc_codec *codec) +int arizona_init_gpio(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int i; @@ -882,9 +880,9 @@ const struct snd_kcontrol_new arizona_voice_trigger_switch[] = { }; EXPORT_SYMBOL_GPL(arizona_voice_trigger_switch); -static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena) +static void arizona_in_set_vu(struct snd_soc_component *component, int ena) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); unsigned int val; int i; @@ -894,15 +892,15 @@ static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena) val = 0; for (i = 0; i < priv->num_inputs; i++) - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, ARIZONA_ADC_DIGITAL_VOLUME_1L + (i * 4), ARIZONA_IN_VU, val); } -bool arizona_input_analog(struct snd_soc_codec *codec, int shift) +bool arizona_input_analog(struct snd_soc_component *component, int shift) { unsigned int reg = ARIZONA_IN1L_CONTROL + ((shift / 2) * 8); - unsigned int val = snd_soc_read(codec, reg); + unsigned int val = snd_soc_component_read32(component, reg); return !(val & ARIZONA_IN1_MODE_MASK); } @@ -911,8 +909,8 @@ EXPORT_SYMBOL_GPL(arizona_input_analog); int arizona_in_ev(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 arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); unsigned int reg; if (w->shift % 2) @@ -925,25 +923,25 @@ int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, priv->in_pending++; break; case SND_SOC_DAPM_POST_PMU: - snd_soc_update_bits(codec, reg, ARIZONA_IN1L_MUTE, 0); + snd_soc_component_update_bits(component, reg, ARIZONA_IN1L_MUTE, 0); /* If this is the last input pending then allow VU */ priv->in_pending--; if (priv->in_pending == 0) { msleep(1); - arizona_in_set_vu(codec, 1); + arizona_in_set_vu(component, 1); } break; case SND_SOC_DAPM_PRE_PMD: - snd_soc_update_bits(codec, reg, + snd_soc_component_update_bits(component, reg, ARIZONA_IN1L_MUTE | ARIZONA_IN_VU, ARIZONA_IN1L_MUTE | ARIZONA_IN_VU); break; case SND_SOC_DAPM_POST_PMD: /* Disable volume updates if no inputs are enabled */ - reg = snd_soc_read(codec, ARIZONA_INPUT_ENABLES); + reg = snd_soc_component_read32(component, ARIZONA_INPUT_ENABLES); if (reg == 0) - arizona_in_set_vu(codec, 0); + arizona_in_set_vu(component, 0); break; default: break; @@ -957,8 +955,8 @@ int arizona_out_ev(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 arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; switch (event) { @@ -1001,7 +999,7 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w, case ARIZONA_OUT4R_ENA_SHIFT: priv->out_up_pending--; if (!priv->out_up_pending && priv->out_up_delay) { - dev_dbg(codec->dev, "Power up delay: %d\n", + dev_dbg(component->dev, "Power up delay: %d\n", priv->out_up_delay); msleep(priv->out_up_delay); priv->out_up_delay = 0; @@ -1054,7 +1052,7 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w, case ARIZONA_OUT4R_ENA_SHIFT: priv->out_down_pending--; if (!priv->out_down_pending && priv->out_down_delay) { - dev_dbg(codec->dev, "Power down delay: %d\n", + dev_dbg(component->dev, "Power down delay: %d\n", priv->out_down_delay); msleep(priv->out_down_delay); priv->out_down_delay = 0; @@ -1076,8 +1074,8 @@ int arizona_hp_ev(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 arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; unsigned int mask = 1 << w->shift; unsigned int val; @@ -1111,15 +1109,15 @@ int arizona_hp_ev(struct snd_soc_dapm_widget *w, } EXPORT_SYMBOL_GPL(arizona_hp_ev); -static int arizona_dvfs_enable(struct snd_soc_codec *codec) +static int arizona_dvfs_enable(struct snd_soc_component *component) { - const struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + const struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int ret; ret = regulator_set_voltage(arizona->dcvdd, 1800000, 1800000); if (ret) { - dev_err(codec->dev, "Failed to boost DCVDD: %d\n", ret); + dev_err(component->dev, "Failed to boost DCVDD: %d\n", ret); return ret; } @@ -1128,7 +1126,7 @@ static int arizona_dvfs_enable(struct snd_soc_codec *codec) ARIZONA_SUBSYS_MAX_FREQ, ARIZONA_SUBSYS_MAX_FREQ); if (ret) { - dev_err(codec->dev, "Failed to enable subsys max: %d\n", ret); + dev_err(component->dev, "Failed to enable subsys max: %d\n", ret); regulator_set_voltage(arizona->dcvdd, 1200000, 1800000); return ret; } @@ -1136,9 +1134,9 @@ static int arizona_dvfs_enable(struct snd_soc_codec *codec) return 0; } -static int arizona_dvfs_disable(struct snd_soc_codec *codec) +static int arizona_dvfs_disable(struct snd_soc_component *component) { - const struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + const struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int ret; @@ -1146,28 +1144,28 @@ static int arizona_dvfs_disable(struct snd_soc_codec *codec) ARIZONA_DYNAMIC_FREQUENCY_SCALING_1, ARIZONA_SUBSYS_MAX_FREQ, 0); if (ret) { - dev_err(codec->dev, "Failed to disable subsys max: %d\n", ret); + dev_err(component->dev, "Failed to disable subsys max: %d\n", ret); return ret; } ret = regulator_set_voltage(arizona->dcvdd, 1200000, 1800000); if (ret) { - dev_err(codec->dev, "Failed to unboost DCVDD: %d\n", ret); + dev_err(component->dev, "Failed to unboost DCVDD: %d\n", ret); return ret; } return 0; } -int arizona_dvfs_up(struct snd_soc_codec *codec, unsigned int flags) +int arizona_dvfs_up(struct snd_soc_component *component, unsigned int flags) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); int ret = 0; mutex_lock(&priv->dvfs_lock); if (!priv->dvfs_cached && !priv->dvfs_reqs) { - ret = arizona_dvfs_enable(codec); + ret = arizona_dvfs_enable(component); if (ret) goto err; } @@ -1179,9 +1177,9 @@ err: } EXPORT_SYMBOL_GPL(arizona_dvfs_up); -int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags) +int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); unsigned int old_reqs; int ret = 0; @@ -1191,7 +1189,7 @@ int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags) priv->dvfs_reqs &= ~flags; if (!priv->dvfs_cached && old_reqs && !priv->dvfs_reqs) - ret = arizona_dvfs_disable(codec); + ret = arizona_dvfs_disable(component); mutex_unlock(&priv->dvfs_lock); return ret; @@ -1201,8 +1199,8 @@ EXPORT_SYMBOL_GPL(arizona_dvfs_down); int arizona_dvfs_sysclk_ev(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 arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); int ret = 0; mutex_lock(&priv->dvfs_lock); @@ -1210,7 +1208,7 @@ int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: if (priv->dvfs_reqs) - ret = arizona_dvfs_enable(codec); + ret = arizona_dvfs_enable(component); priv->dvfs_cached = false; break; @@ -1222,7 +1220,7 @@ int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w, priv->dvfs_cached = true; if (priv->dvfs_reqs) - ret = arizona_dvfs_disable(codec); + ret = arizona_dvfs_disable(component); break; default: break; @@ -1243,7 +1241,7 @@ int arizona_anc_ev(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 snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); unsigned int val; switch (event) { @@ -1257,7 +1255,7 @@ int arizona_anc_ev(struct snd_soc_dapm_widget *w, return 0; } - snd_soc_write(codec, ARIZONA_CLOCK_CONTROL, val); + snd_soc_component_write(component, ARIZONA_CLOCK_CONTROL, val); return 0; } @@ -1277,10 +1275,10 @@ static unsigned int arizona_opclk_ref_44k1_rates[] = { 45158400, }; -static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk, +static int arizona_set_opclk(struct snd_soc_component *component, unsigned int clk, unsigned int freq) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); unsigned int reg; unsigned int *rates; int ref, div, refclk; @@ -1308,9 +1306,9 @@ static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk, div = 1; while (rates[ref] / div >= freq && div < 32) { if (rates[ref] / div == freq) { - dev_dbg(codec->dev, "Configured %dHz OPCLK\n", + dev_dbg(component->dev, "Configured %dHz OPCLK\n", freq); - snd_soc_update_bits(codec, reg, + snd_soc_component_update_bits(component, reg, ARIZONA_OPCLK_DIV_MASK | ARIZONA_OPCLK_SEL_MASK, (div << @@ -1322,22 +1320,22 @@ static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk, } } - dev_err(codec->dev, "Unable to generate %dHz OPCLK\n", freq); + dev_err(component->dev, "Unable to generate %dHz OPCLK\n", freq); return -EINVAL; } int arizona_clk_ev(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 arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); unsigned int val; int clk_idx; int ret; ret = regmap_read(arizona->regmap, w->reg, &val); if (ret) { - dev_err(codec->dev, "Failed to check clock source: %d\n", ret); + dev_err(component->dev, "Failed to check clock source: %d\n", ret); return ret; } @@ -1366,10 +1364,10 @@ int arizona_clk_ev(struct snd_soc_dapm_widget *w, } EXPORT_SYMBOL_GPL(arizona_clk_ev); -int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, +int arizona_set_sysclk(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; char *name; unsigned int reg; @@ -1391,7 +1389,7 @@ int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, break; case ARIZONA_CLK_OPCLK: case ARIZONA_CLK_ASYNC_OPCLK: - return arizona_set_opclk(codec, clk_id, freq); + return arizona_set_opclk(component, clk_id, freq); default: return -EINVAL; } @@ -1445,8 +1443,8 @@ EXPORT_SYMBOL_GPL(arizona_set_sysclk); static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int lrclk, bclk, mode, base; @@ -1620,8 +1618,8 @@ static const struct snd_pcm_hw_constraint_list arizona_constraint = { static int arizona_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; unsigned int base_rate; @@ -1651,10 +1649,10 @@ static int arizona_startup(struct snd_pcm_substream *substream, &dai_priv->constraint); } -static void arizona_wm5102_set_dac_comp(struct snd_soc_codec *codec, +static void arizona_wm5102_set_dac_comp(struct snd_soc_component *component, unsigned int rate) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; struct reg_sequence dac_comp[] = { { 0x80, 0x3 }, @@ -1680,8 +1678,8 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; int base = dai->driver->base; int i, sr_val, ret; @@ -1704,9 +1702,9 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream, case WM5102: case WM8997: if (arizona_sr_vals[sr_val] >= 88200) - ret = arizona_dvfs_up(codec, ARIZONA_DVFS_SR1_RQ); + ret = arizona_dvfs_up(component, ARIZONA_DVFS_SR1_RQ); else - ret = arizona_dvfs_down(codec, ARIZONA_DVFS_SR1_RQ); + ret = arizona_dvfs_down(component, ARIZONA_DVFS_SR1_RQ); if (ret) { arizona_aif_err(dai, "Failed to change DVFS %d\n", ret); @@ -1721,24 +1719,24 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream, case ARIZONA_CLK_SYSCLK: switch (priv->arizona->type) { case WM5102: - arizona_wm5102_set_dac_comp(codec, + arizona_wm5102_set_dac_comp(component, params_rate(params)); break; default: break; } - snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1, + snd_soc_component_update_bits(component, ARIZONA_SAMPLE_RATE_1, ARIZONA_SAMPLE_RATE_1_MASK, sr_val); if (base) - snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, + snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL, ARIZONA_AIF1_RATE_MASK, 0); break; case ARIZONA_CLK_ASYNCCLK: - snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, + snd_soc_component_update_bits(component, ARIZONA_ASYNC_SAMPLE_RATE_1, ARIZONA_ASYNC_SAMPLE_RATE_1_MASK, sr_val); if (base) - snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, + snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL, ARIZONA_AIF1_RATE_MASK, 8 << ARIZONA_AIF1_RATE_SHIFT); break; @@ -1750,20 +1748,20 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream, return 0; } -static bool arizona_aif_cfg_changed(struct snd_soc_codec *codec, +static bool arizona_aif_cfg_changed(struct snd_soc_component *component, int base, int bclk, int lrclk, int frame) { int val; - val = snd_soc_read(codec, base + ARIZONA_AIF_BCLK_CTRL); + val = snd_soc_component_read32(component, base + ARIZONA_AIF_BCLK_CTRL); if (bclk != (val & ARIZONA_AIF1_BCLK_FREQ_MASK)) return true; - val = snd_soc_read(codec, base + ARIZONA_AIF_TX_BCLK_RATE); + val = snd_soc_component_read32(component, base + ARIZONA_AIF_TX_BCLK_RATE); if (lrclk != (val & ARIZONA_AIF1TX_BCPF_MASK)) return true; - val = snd_soc_read(codec, base + ARIZONA_AIF_FRAME_CTRL_1); + val = snd_soc_component_read32(component, base + ARIZONA_AIF_FRAME_CTRL_1); if (frame != (val & (ARIZONA_AIF1TX_WL_MASK | ARIZONA_AIF1TX_SLOT_LEN_MASK))) return true; @@ -1775,8 +1773,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int base = dai->driver->base; const int *rates; @@ -1813,7 +1811,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, } /* Force multiple of 2 channels for I2S mode */ - val = snd_soc_read(codec, base + ARIZONA_AIF_FORMAT); + val = snd_soc_component_read32(component, base + ARIZONA_AIF_FORMAT); val &= ARIZONA_AIF1_FMT_MASK; if ((channels & 1) && (val == ARIZONA_FMT_I2S_MODE)) { arizona_aif_dbg(dai, "Forcing stereo mode\n"); @@ -1841,13 +1839,13 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, frame = wl << ARIZONA_AIF1TX_WL_SHIFT | tdm_width; - reconfig = arizona_aif_cfg_changed(codec, base, bclk, lrclk, frame); + reconfig = arizona_aif_cfg_changed(component, base, bclk, lrclk, frame); if (reconfig) { /* Save AIF TX/RX state */ - aif_tx_state = snd_soc_read(codec, + aif_tx_state = snd_soc_component_read32(component, base + ARIZONA_AIF_TX_ENABLES); - aif_rx_state = snd_soc_read(codec, + aif_rx_state = snd_soc_component_read32(component, base + ARIZONA_AIF_RX_ENABLES); /* Disable AIF TX/RX before reconfiguring it */ regmap_update_bits_async(arizona->regmap, @@ -1908,9 +1906,9 @@ static const char *arizona_dai_clk_str(int clk_id) static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = dai->codec; - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; struct snd_soc_dapm_route routes[2]; @@ -1926,12 +1924,12 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, return 0; if (dai->active) { - dev_err(codec->dev, "Can't change clock on active DAI %d\n", + dev_err(component->dev, "Can't change clock on active DAI %d\n", dai->id); return -EBUSY; } - dev_dbg(codec->dev, "Setting AIF%d to %s\n", dai->id + 1, + dev_dbg(component->dev, "Setting AIF%d to %s\n", dai->id + 1, arizona_dai_clk_str(clk_id)); memset(&routes, 0, sizeof(routes)); @@ -1953,7 +1951,7 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; int base = dai->driver->base; unsigned int reg; @@ -1962,7 +1960,7 @@ static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate) else reg = 0; - return snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, + return snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL, ARIZONA_AIF1_TRI, reg); } @@ -1970,8 +1968,8 @@ static void arizona_set_channels_to_mask(struct snd_soc_dai *dai, unsigned int base, int channels, unsigned int mask) { - struct snd_soc_codec *codec = dai->codec; - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int slot, i; @@ -1992,8 +1990,8 @@ static void arizona_set_channels_to_mask(struct snd_soc_dai *dai, static int arizona_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) { - struct snd_soc_codec *codec = dai->codec; - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; int base = dai->driver->base; int rx_max_chan = dai->driver->playback.channels_max; @@ -2645,7 +2643,7 @@ EXPORT_SYMBOL_GPL(arizona_init_fll); /** * arizona_set_output_mode - Set the mode of the specified output * - * @codec: Device to configure + * @component: Device to configure * @output: Output number * @diff: True to set the output to differential mode * @@ -2658,7 +2656,7 @@ EXPORT_SYMBOL_GPL(arizona_init_fll); * Most systems have a single static configuration and should use * platform data instead. */ -int arizona_set_output_mode(struct snd_soc_codec *codec, int output, bool diff) +int arizona_set_output_mode(struct snd_soc_component *component, int output, bool diff) { unsigned int reg, val; @@ -2672,7 +2670,7 @@ int arizona_set_output_mode(struct snd_soc_codec *codec, int output, bool diff) else val = 0; - return snd_soc_update_bits(codec, reg, ARIZONA_OUT1_MONO, val); + return snd_soc_component_update_bits(component, reg, ARIZONA_OUT1_MONO, val); } EXPORT_SYMBOL_GPL(arizona_set_output_mode); @@ -2721,8 +2719,8 @@ static bool arizona_eq_filter_unstable(bool mode, __be16 _a, __be16 _b) int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); struct soc_bytes *params = (void *)kcontrol->private_value; unsigned int val; __be16 *data; @@ -2765,8 +2763,8 @@ EXPORT_SYMBOL_GPL(arizona_eq_coeff_put); int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); __be16 *data = (__be16 *)ucontrol->value.bytes.data; s16 val = be16_to_cpu(*data); diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h index dfdf6d8c9687..e3ccee5627c6 100644 --- a/sound/soc/codecs/arizona.h +++ b/sound/soc/codecs/arizona.h @@ -273,7 +273,7 @@ int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol, int arizona_clk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); -int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, int source, +int arizona_set_sysclk(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir); extern const struct snd_soc_dai_ops arizona_dai_ops; @@ -297,8 +297,8 @@ struct arizona_fll { char clock_ok_name[ARIZONA_FLL_NAME_LEN]; }; -int arizona_dvfs_up(struct snd_soc_codec *codec, unsigned int flags); -int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags); +int arizona_dvfs_up(struct snd_soc_component *component, unsigned int flags); +int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags); int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); void arizona_init_dvfs(struct arizona_priv *priv); @@ -310,9 +310,9 @@ int arizona_set_fll_refclk(struct arizona_fll *fll, int source, int arizona_set_fll(struct arizona_fll *fll, int source, unsigned int Fref, unsigned int Fout); -int arizona_init_spk(struct snd_soc_codec *codec); -int arizona_init_gpio(struct snd_soc_codec *codec); -int arizona_init_mono(struct snd_soc_codec *codec); +int arizona_init_spk(struct snd_soc_component *component); +int arizona_init_gpio(struct snd_soc_component *component); +int arizona_init_mono(struct snd_soc_component *component); int arizona_init_common(struct arizona *arizona); int arizona_init_vol_limit(struct arizona *arizona); @@ -322,20 +322,20 @@ int arizona_free_spk_irqs(struct arizona *arizona); int arizona_init_dai(struct arizona_priv *priv, int dai); -int arizona_set_output_mode(struct snd_soc_codec *codec, int output, +int arizona_set_output_mode(struct snd_soc_component *component, int output, bool diff); -bool arizona_input_analog(struct snd_soc_codec *codec, int shift); +bool arizona_input_analog(struct snd_soc_component *component, int shift); const char *arizona_sample_rate_val_to_name(unsigned int rate_val); -static inline int arizona_register_notifier(struct snd_soc_codec *codec, +static inline int arizona_register_notifier(struct snd_soc_component *component, struct notifier_block *nb, int (*notify) (struct notifier_block *nb, unsigned long action, void *data)) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; nb->notifier_call = notify; @@ -343,10 +343,10 @@ static inline int arizona_register_notifier(struct snd_soc_codec *codec, return blocking_notifier_chain_register(&arizona->notifier, nb); } -static inline int arizona_unregister_notifier(struct snd_soc_codec *codec, +static inline int arizona_unregister_notifier(struct snd_soc_component *component, struct notifier_block *nb) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; return blocking_notifier_chain_unregister(&arizona->notifier, nb); diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c index 3f34de5f800e..c93d3f7e8e36 100644 --- a/sound/soc/codecs/cs47l24.c +++ b/sound/soc/codecs/cs47l24.c @@ -62,14 +62,14 @@ static const struct wm_adsp_region *cs47l24_dsp_regions[] = { static int cs47l24_adsp_power_ev(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 arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); unsigned int v; int ret; ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); if (ret != 0) { - dev_err(codec->dev, "Failed to read SYSCLK state: %d\n", ret); + dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret); return ret; } @@ -931,10 +931,10 @@ static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = { { "DSP3 Voice Trigger", "Switch", "DSP3" }, }; -static int cs47l24_set_fll(struct snd_soc_codec *codec, int fll_id, int source, +static int cs47l24_set_fll(struct snd_soc_component *component, int fll_id, int source, unsigned int Fref, unsigned int Fout) { - struct cs47l24_priv *cs47l24 = snd_soc_codec_get_drvdata(codec); + struct cs47l24_priv *cs47l24 = snd_soc_component_get_drvdata(component); switch (fll_id) { case CS47L24_FLL1: @@ -1118,33 +1118,32 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data) return IRQ_HANDLED; } -static int cs47l24_codec_probe(struct snd_soc_codec *codec) +static int cs47l24_component_probe(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); - struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->core.arizona; int ret; arizona->dapm = dapm; - snd_soc_codec_init_regmap(codec, arizona->regmap); + snd_soc_component_init_regmap(component, arizona->regmap); - ret = arizona_init_spk(codec); + ret = arizona_init_spk(component); if (ret < 0) return ret; - arizona_init_gpio(codec); - arizona_init_mono(codec); + arizona_init_gpio(component); + arizona_init_mono(component); - ret = wm_adsp2_codec_probe(&priv->core.adsp[1], codec); + ret = wm_adsp2_component_probe(&priv->core.adsp[1], component); if (ret) goto err_adsp2_codec_probe; - ret = wm_adsp2_codec_probe(&priv->core.adsp[2], codec); + ret = wm_adsp2_component_probe(&priv->core.adsp[2], component); if (ret) goto err_adsp2_codec_probe; - ret = snd_soc_add_codec_controls(codec, + ret = snd_soc_add_component_controls(component, &arizona_adsp2_rate_controls[1], 2); if (ret) goto err_adsp2_codec_probe; @@ -1154,22 +1153,20 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec) return 0; err_adsp2_codec_probe: - wm_adsp2_codec_remove(&priv->core.adsp[1], codec); - wm_adsp2_codec_remove(&priv->core.adsp[2], codec); + wm_adsp2_component_remove(&priv->core.adsp[1], component); + wm_adsp2_component_remove(&priv->core.adsp[2], component); return ret; } -static int cs47l24_codec_remove(struct snd_soc_codec *codec) +static void cs47l24_component_remove(struct snd_soc_component *component) { - struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec); + struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component); - wm_adsp2_codec_remove(&priv->core.adsp[1], codec); - wm_adsp2_codec_remove(&priv->core.adsp[2], codec); + wm_adsp2_component_remove(&priv->core.adsp[1], component); + wm_adsp2_component_remove(&priv->core.adsp[2], component); priv->core.arizona->dapm = NULL; - - return 0; } #define CS47L24_DIG_VU 0x0200 @@ -1190,25 +1187,22 @@ static struct snd_compr_ops cs47l24_compr_ops = { .copy = wm_adsp_compr_copy, }; -static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = { - .probe = cs47l24_codec_probe, - .remove = cs47l24_codec_remove, - - .idle_bias_off = true, - - .set_sysclk = arizona_set_sysclk, - .set_pll = cs47l24_set_fll, - - .component_driver = { - .name = DRV_NAME, - .compr_ops = &cs47l24_compr_ops, - .controls = cs47l24_snd_controls, - .num_controls = ARRAY_SIZE(cs47l24_snd_controls), - .dapm_widgets = cs47l24_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs47l24_dapm_widgets), - .dapm_routes = cs47l24_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(cs47l24_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_cs47l24 = { + .probe = cs47l24_component_probe, + .remove = cs47l24_component_remove, + .set_sysclk = arizona_set_sysclk, + .set_pll = cs47l24_set_fll, + .name = DRV_NAME, + .compr_ops = &cs47l24_compr_ops, + .controls = cs47l24_snd_controls, + .num_controls = ARRAY_SIZE(cs47l24_snd_controls), + .dapm_widgets = cs47l24_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs47l24_dapm_widgets), + .dapm_routes = cs47l24_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(cs47l24_dapm_routes), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int cs47l24_probe(struct platform_device *pdev) @@ -1299,10 +1293,11 @@ static int cs47l24_probe(struct platform_device *pdev) if (ret < 0) goto err_dsp_irq; - ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24, + ret = devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_cs47l24, cs47l24_dai, ARRAY_SIZE(cs47l24_dai)); if (ret < 0) { - dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); + dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; } @@ -1321,7 +1316,6 @@ static int cs47l24_remove(struct platform_device *pdev) struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev); struct arizona *arizona = cs47l24->core.arizona; - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); wm_adsp2_remove(&cs47l24->core.adsp[1]); diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index a568050090ad..24f19cfc98f5 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -583,8 +583,8 @@ static const struct reg_default wm5102_sysclk_revb_patch[] = { static int wm5102_sysclk_ev(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 arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); struct regmap *regmap = arizona->regmap; const struct reg_default *patch = NULL; int i, patch_size; @@ -622,8 +622,8 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, static int wm5102_adsp_power_ev(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 arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); unsigned int v = 0; int ret; @@ -631,7 +631,7 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_PRE_PMU: ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); if (ret != 0) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret); return -EIO; } @@ -639,9 +639,9 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w, v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT; if (v >= 3) { - ret = arizona_dvfs_up(codec, ARIZONA_DVFS_ADSP1_RQ); + ret = arizona_dvfs_up(component, ARIZONA_DVFS_ADSP1_RQ); if (ret) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to raise DVFS: %d\n", ret); return ret; } @@ -649,9 +649,9 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMD: - ret = arizona_dvfs_down(codec, ARIZONA_DVFS_ADSP1_RQ); + ret = arizona_dvfs_down(component, ARIZONA_DVFS_ADSP1_RQ); if (ret) - dev_warn(codec->dev, + dev_warn(component->dev, "Failed to lower DVFS: %d\n", ret); break; @@ -665,8 +665,8 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w, static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); mutex_lock(&arizona->dac_comp_lock); put_unaligned_be16(arizona->dac_comp_coeff, @@ -679,8 +679,8 @@ static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol, static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); mutex_lock(&arizona->dac_comp_lock); memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data, @@ -694,8 +694,8 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol, static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); mutex_lock(&arizona->dac_comp_lock); ucontrol->value.integer.value[0] = arizona->dac_comp_enabled; @@ -707,8 +707,8 @@ static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol, static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); mutex_lock(&arizona->dac_comp_lock); arizona->dac_comp_enabled = ucontrol->value.integer.value[0]; @@ -1736,10 +1736,10 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { { "DRC1 Signal Activity", NULL, "DRC1R" }, }; -static int wm5102_set_fll(struct snd_soc_codec *codec, int fll_id, int source, +static int wm5102_set_fll(struct snd_soc_component *component, int fll_id, int source, unsigned int Fref, unsigned int Fout) { - struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec); + struct wm5102_priv *wm5102 = snd_soc_component_get_drvdata(component); switch (fll_id) { case WM5102_FLL1: @@ -1933,30 +1933,29 @@ static irqreturn_t wm5102_adsp2_irq(int irq, void *data) return IRQ_HANDLED; } -static int wm5102_codec_probe(struct snd_soc_codec *codec) +static int wm5102_component_probe(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); - struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct wm5102_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->core.arizona; int ret; - snd_soc_codec_init_regmap(codec, arizona->regmap); + snd_soc_component_init_regmap(component, arizona->regmap); - ret = wm_adsp2_codec_probe(&priv->core.adsp[0], codec); + ret = wm_adsp2_component_probe(&priv->core.adsp[0], component); if (ret) return ret; - ret = snd_soc_add_codec_controls(codec, + ret = snd_soc_add_component_controls(component, arizona_adsp2_rate_controls, 1); if (ret) goto err_adsp2_codec_probe; - ret = arizona_init_spk(codec); + ret = arizona_init_spk(component); if (ret < 0) return ret; - arizona_init_gpio(codec); + arizona_init_gpio(component); snd_soc_component_disable_pin(component, "HAPTICS"); @@ -1965,20 +1964,18 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec) return 0; err_adsp2_codec_probe: - wm_adsp2_codec_remove(&priv->core.adsp[0], codec); + wm_adsp2_component_remove(&priv->core.adsp[0], component); return ret; } -static int wm5102_codec_remove(struct snd_soc_codec *codec) +static void wm5102_component_remove(struct snd_soc_component *component) { - struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); + struct wm5102_priv *priv = snd_soc_component_get_drvdata(component); - wm_adsp2_codec_remove(&priv->core.adsp[0], codec); + wm_adsp2_component_remove(&priv->core.adsp[0], component); priv->core.arizona->dapm = NULL; - - return 0; } #define WM5102_DIG_VU 0x0200 @@ -2005,25 +2002,22 @@ static struct snd_compr_ops wm5102_compr_ops = { .copy = wm_adsp_compr_copy, }; -static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { - .probe = wm5102_codec_probe, - .remove = wm5102_codec_remove, - - .idle_bias_off = true, - - .set_sysclk = arizona_set_sysclk, - .set_pll = wm5102_set_fll, - - .component_driver = { - .name = DRV_NAME, - .compr_ops = &wm5102_compr_ops, - .controls = wm5102_snd_controls, - .num_controls = ARRAY_SIZE(wm5102_snd_controls), - .dapm_widgets = wm5102_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm5102_dapm_widgets), - .dapm_routes = wm5102_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm5102_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm5102 = { + .probe = wm5102_component_probe, + .remove = wm5102_component_remove, + .set_sysclk = arizona_set_sysclk, + .set_pll = wm5102_set_fll, + .name = DRV_NAME, + .compr_ops = &wm5102_compr_ops, + .controls = wm5102_snd_controls, + .num_controls = ARRAY_SIZE(wm5102_snd_controls), + .dapm_widgets = wm5102_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm5102_dapm_widgets), + .dapm_routes = wm5102_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm5102_dapm_routes), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int wm5102_probe(struct platform_device *pdev) @@ -2110,10 +2104,11 @@ static int wm5102_probe(struct platform_device *pdev) if (ret < 0) goto err_dsp_irq; - ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102, + ret = devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_wm5102, wm5102_dai, ARRAY_SIZE(wm5102_dai)); if (ret < 0) { - dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); + dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; } @@ -2132,7 +2127,6 @@ static int wm5102_remove(struct platform_device *pdev) struct wm5102_priv *wm5102 = platform_get_drvdata(pdev); struct arizona *arizona = wm5102->core.arizona; - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); wm_adsp2_remove(&wm5102->core.adsp[0]); diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index d5ece6c6fcb6..b33cbd0161d3 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -161,8 +161,8 @@ static const struct reg_default wm5110_sysclk_reve_patch[] = { static int wm5110_sysclk_ev(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 arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); struct regmap *regmap = arizona->regmap; const struct reg_default *patch = NULL; int i, patch_size; @@ -198,14 +198,14 @@ static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, static int wm5110_adsp_power_ev(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 arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); unsigned int v; int ret; ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); if (ret != 0) { - dev_err(codec->dev, "Failed to read SYSCLK state: %d\n", ret); + dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret); return ret; } @@ -288,10 +288,10 @@ static const struct reg_sequence wm5110_dre_right_enable[] = { static int wm5110_hp_pre_enable(struct snd_soc_dapm_widget *w) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; - unsigned int val = snd_soc_read(codec, ARIZONA_DRE_ENABLE); + unsigned int val = snd_soc_component_read32(component, ARIZONA_DRE_ENABLE); const struct reg_sequence *wseq; int nregs; @@ -325,25 +325,25 @@ static int wm5110_hp_pre_enable(struct snd_soc_dapm_widget *w) static int wm5110_hp_pre_disable(struct snd_soc_dapm_widget *w) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); - unsigned int val = snd_soc_read(codec, ARIZONA_DRE_ENABLE); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); + unsigned int val = snd_soc_component_read32(component, ARIZONA_DRE_ENABLE); switch (w->shift) { case ARIZONA_OUT1L_ENA_SHIFT: if (!(val & ARIZONA_DRE1L_ENA_MASK)) { - snd_soc_update_bits(codec, ARIZONA_SPARE_TRIGGERS, + snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS, ARIZONA_WS_TRG1, ARIZONA_WS_TRG1); - snd_soc_update_bits(codec, ARIZONA_SPARE_TRIGGERS, + snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS, ARIZONA_WS_TRG1, 0); priv->out_down_delay += 27; } break; case ARIZONA_OUT1R_ENA_SHIFT: if (!(val & ARIZONA_DRE1R_ENA_MASK)) { - snd_soc_update_bits(codec, ARIZONA_SPARE_TRIGGERS, + snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS, ARIZONA_WS_TRG2, ARIZONA_WS_TRG2); - snd_soc_update_bits(codec, ARIZONA_SPARE_TRIGGERS, + snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS, ARIZONA_WS_TRG2, 0); priv->out_down_delay += 27; } @@ -358,8 +358,8 @@ static int wm5110_hp_pre_disable(struct snd_soc_dapm_widget *w) static int wm5110_hp_ev(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 arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); switch (priv->arizona->rev) { case 0 ... 3: @@ -397,9 +397,9 @@ static int wm5110_clear_pga_volume(struct arizona *arizona, int output) static int wm5110_put_dre(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; unsigned int ena, dre; @@ -458,8 +458,8 @@ err: static int wm5110_in_pga_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); int ret; /* @@ -478,8 +478,8 @@ static int wm5110_in_pga_get(struct snd_kcontrol *kcontrol, static int wm5110_in_pga_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); int ret; /* @@ -498,9 +498,9 @@ static int wm5110_in_pga_put(struct snd_kcontrol *kcontrol, static int wm5110_in_analog_ev(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 arizona_priv *priv = snd_soc_codec_get_drvdata(codec); - struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); + struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; unsigned int reg, mask; struct reg_sequence analog_seq[] = { @@ -519,9 +519,9 @@ static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w, wm5110->in_post_pending++; return 0; case SND_SOC_DAPM_PRE_PMU: - wm5110->in_pga_cache[w->shift] = snd_soc_read(codec, reg); + wm5110->in_pga_cache[w->shift] = snd_soc_component_read32(component, reg); - snd_soc_update_bits(codec, reg, mask, + snd_soc_component_update_bits(component, reg, mask, 0x40 << ARIZONA_IN1L_PGA_VOL_SHIFT); wm5110->in_pre_pending--; @@ -538,7 +538,7 @@ static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMU: - snd_soc_update_bits(codec, reg, mask, + snd_soc_component_update_bits(component, reg, mask, wm5110->in_pga_cache[w->shift]); wm5110->in_post_pending--; @@ -557,13 +557,13 @@ static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w, static int wm5110_in_ev(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 arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; switch (arizona->rev) { case 0 ... 4: - if (arizona_input_analog(codec, w->shift)) + if (arizona_input_analog(component, w->shift)) wm5110_in_analog_ev(w, kcontrol, event); break; @@ -2034,10 +2034,10 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { { "DSP3 Voice Trigger", "Switch", "DSP3" }, }; -static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source, +static int wm5110_set_fll(struct snd_soc_component *component, int fll_id, int source, unsigned int Fref, unsigned int Fout) { - struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec); + struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component); switch (fll_id) { case WM5110_FLL1: @@ -2278,31 +2278,30 @@ static irqreturn_t wm5110_adsp2_irq(int irq, void *data) return IRQ_HANDLED; } -static int wm5110_codec_probe(struct snd_soc_codec *codec) +static int wm5110_component_probe(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); - struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct wm5110_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->core.arizona; int i, ret; arizona->dapm = dapm; - snd_soc_codec_init_regmap(codec, arizona->regmap); + snd_soc_component_init_regmap(component, arizona->regmap); - ret = arizona_init_spk(codec); + ret = arizona_init_spk(component); if (ret < 0) return ret; - arizona_init_gpio(codec); - arizona_init_mono(codec); + arizona_init_gpio(component); + arizona_init_mono(component); for (i = 0; i < WM5110_NUM_ADSP; ++i) { - ret = wm_adsp2_codec_probe(&priv->core.adsp[i], codec); + ret = wm_adsp2_component_probe(&priv->core.adsp[i], component); if (ret) goto err_adsp2_codec_probe; } - ret = snd_soc_add_codec_controls(codec, + ret = snd_soc_add_component_controls(component, arizona_adsp2_rate_controls, WM5110_NUM_ADSP); if (ret) @@ -2314,22 +2313,20 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec) err_adsp2_codec_probe: for (--i; i >= 0; --i) - wm_adsp2_codec_remove(&priv->core.adsp[i], codec); + wm_adsp2_component_remove(&priv->core.adsp[i], component); return ret; } -static int wm5110_codec_remove(struct snd_soc_codec *codec) +static void wm5110_component_remove(struct snd_soc_component *component) { - struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); + struct wm5110_priv *priv = snd_soc_component_get_drvdata(component); int i; for (i = 0; i < WM5110_NUM_ADSP; ++i) - wm_adsp2_codec_remove(&priv->core.adsp[i], codec); + wm_adsp2_component_remove(&priv->core.adsp[i], component); priv->core.arizona->dapm = NULL; - - return 0; } #define WM5110_DIG_VU 0x0200 @@ -2359,25 +2356,22 @@ static struct snd_compr_ops wm5110_compr_ops = { .copy = wm_adsp_compr_copy, }; -static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = { - .probe = wm5110_codec_probe, - .remove = wm5110_codec_remove, - - .idle_bias_off = true, - - .set_sysclk = arizona_set_sysclk, - .set_pll = wm5110_set_fll, - - .component_driver = { - .name = DRV_NAME, - .compr_ops = &wm5110_compr_ops, - .controls = wm5110_snd_controls, - .num_controls = ARRAY_SIZE(wm5110_snd_controls), - .dapm_widgets = wm5110_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets), - .dapm_routes = wm5110_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm5110 = { + .probe = wm5110_component_probe, + .remove = wm5110_component_remove, + .set_sysclk = arizona_set_sysclk, + .set_pll = wm5110_set_fll, + .name = DRV_NAME, + .compr_ops = &wm5110_compr_ops, + .controls = wm5110_snd_controls, + .num_controls = ARRAY_SIZE(wm5110_snd_controls), + .dapm_widgets = wm5110_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets), + .dapm_routes = wm5110_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int wm5110_probe(struct platform_device *pdev) @@ -2465,10 +2459,11 @@ static int wm5110_probe(struct platform_device *pdev) if (ret < 0) goto err_dsp_irq; - ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110, + ret = devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_wm5110, wm5110_dai, ARRAY_SIZE(wm5110_dai)); if (ret < 0) { - dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); + dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; } @@ -2488,7 +2483,6 @@ static int wm5110_remove(struct platform_device *pdev) struct arizona *arizona = wm5110->core.arizona; int i; - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); for (i = 0; i < WM5110_NUM_ADSP; i++) diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index cac9b3e7e15d..45ee1e6bf715 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -84,8 +84,8 @@ static const struct reg_default wm8997_sysclk_reva_patch[] = { static int wm8997_sysclk_ev(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 arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct arizona *arizona = dev_get_drvdata(component->dev->parent); struct regmap *regmap = arizona->regmap; const struct reg_default *patch = NULL; int i, patch_size; @@ -927,10 +927,10 @@ static const struct snd_soc_dapm_route wm8997_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, }; -static int wm8997_set_fll(struct snd_soc_codec *codec, int fll_id, int source, +static int wm8997_set_fll(struct snd_soc_component *component, int fll_id, int source, unsigned int Fref, unsigned int Fout) { - struct wm8997_priv *wm8997 = snd_soc_codec_get_drvdata(codec); + struct wm8997_priv *wm8997 = snd_soc_component_get_drvdata(component); switch (fll_id) { case WM8997_FLL1: @@ -1057,17 +1057,16 @@ static struct snd_soc_dai_driver wm8997_dai[] = { }, }; -static int wm8997_codec_probe(struct snd_soc_codec *codec) +static int wm8997_component_probe(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); - struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct wm8997_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->core.arizona; int ret; - snd_soc_codec_init_regmap(codec, arizona->regmap); + snd_soc_component_init_regmap(component, arizona->regmap); - ret = arizona_init_spk(codec); + ret = arizona_init_spk(component); if (ret < 0) return ret; @@ -1078,13 +1077,11 @@ static int wm8997_codec_probe(struct snd_soc_codec *codec) return 0; } -static int wm8997_codec_remove(struct snd_soc_codec *codec) +static void wm8997_component_remove(struct snd_soc_component *component) { - struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec); + struct wm8997_priv *priv = snd_soc_component_get_drvdata(component); priv->core.arizona->dapm = NULL; - - return 0; } #define WM8997_DIG_VU 0x0200 @@ -1098,23 +1095,20 @@ static unsigned int wm8997_digital_vu[] = { ARIZONA_DAC_DIGITAL_VOLUME_5R, }; -static const struct snd_soc_codec_driver soc_codec_dev_wm8997 = { - .probe = wm8997_codec_probe, - .remove = wm8997_codec_remove, - - .idle_bias_off = true, - - .set_sysclk = arizona_set_sysclk, - .set_pll = wm8997_set_fll, - - .component_driver = { - .controls = wm8997_snd_controls, - .num_controls = ARRAY_SIZE(wm8997_snd_controls), - .dapm_widgets = wm8997_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8997_dapm_widgets), - .dapm_routes = wm8997_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8997_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8997 = { + .probe = wm8997_component_probe, + .remove = wm8997_component_remove, + .set_sysclk = arizona_set_sysclk, + .set_pll = wm8997_set_fll, + .controls = wm8997_snd_controls, + .num_controls = ARRAY_SIZE(wm8997_snd_controls), + .dapm_widgets = wm8997_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8997_dapm_widgets), + .dapm_routes = wm8997_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8997_dapm_routes), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int wm8997_probe(struct platform_device *pdev) @@ -1178,10 +1172,11 @@ static int wm8997_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8997, + ret = devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_wm8997, wm8997_dai, ARRAY_SIZE(wm8997_dai)); if (ret < 0) { - dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); + dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; } @@ -1196,7 +1191,6 @@ static int wm8997_remove(struct platform_device *pdev) struct wm8997_priv *wm8997 = platform_get_drvdata(pdev); struct arizona *arizona = wm8997->core.arizona; - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); arizona_free_spk_irqs(arizona); diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c index 1288e1f67dcf..6f3fdd7b095e 100644 --- a/sound/soc/codecs/wm8998.c +++ b/sound/soc/codecs/wm8998.c @@ -41,12 +41,12 @@ static int wm8998_asrc_ev(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 snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); unsigned int val; switch (event) { case SND_SOC_DAPM_PRE_PMU: - val = snd_soc_read(codec, ARIZONA_ASRC_RATE1); + val = snd_soc_component_read32(component, ARIZONA_ASRC_RATE1); val &= ARIZONA_ASRC_RATE1_MASK; val >>= ARIZONA_ASRC_RATE1_SHIFT; @@ -54,23 +54,23 @@ static int wm8998_asrc_ev(struct snd_soc_dapm_widget *w, case 0: case 1: case 2: - val = snd_soc_read(codec, + val = snd_soc_component_read32(component, ARIZONA_SAMPLE_RATE_1 + val); if (val >= 0x11) { - dev_warn(codec->dev, + dev_warn(component->dev, "Unsupported ASRC rate1 (%s)\n", arizona_sample_rate_val_to_name(val)); return -EINVAL; } break; default: - dev_err(codec->dev, + dev_err(component->dev, "Illegal ASRC rate1 selector (0x%x)\n", val); return -EINVAL; } - val = snd_soc_read(codec, ARIZONA_ASRC_RATE2); + val = snd_soc_component_read32(component, ARIZONA_ASRC_RATE2); val &= ARIZONA_ASRC_RATE2_MASK; val >>= ARIZONA_ASRC_RATE2_SHIFT; @@ -78,17 +78,17 @@ static int wm8998_asrc_ev(struct snd_soc_dapm_widget *w, case 8: case 9: val -= 0x8; - val = snd_soc_read(codec, + val = snd_soc_component_read32(component, ARIZONA_ASYNC_SAMPLE_RATE_1 + val); if (val >= 0x11) { - dev_warn(codec->dev, + dev_warn(component->dev, "Unsupported ASRC rate2 (%s)\n", arizona_sample_rate_val_to_name(val)); return -EINVAL; } break; default: - dev_err(codec->dev, + dev_err(component->dev, "Illegal ASRC rate2 selector (0x%x)\n", val); return -EINVAL; @@ -104,9 +104,9 @@ static int wm8998_asrc_ev(struct snd_soc_dapm_widget *w, static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct wm8998_priv *wm8998 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct wm8998_priv *wm8998 = snd_soc_component_get_drvdata(component); struct arizona *arizona = wm8998->core.arizona; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; unsigned int mode_reg, mode_index; @@ -137,9 +137,9 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, if (inmode & ARIZONA_INMODE_SE) src_val |= 1 << ARIZONA_IN1L_SRC_SE_SHIFT; - snd_soc_update_bits(codec, mode_reg, ARIZONA_IN1_MODE_MASK, mode_val); + snd_soc_component_update_bits(component, mode_reg, ARIZONA_IN1_MODE_MASK, mode_val); - snd_soc_update_bits(codec, e->reg, + snd_soc_component_update_bits(component, e->reg, ARIZONA_IN1L_SRC_MASK | ARIZONA_IN1L_SRC_SE_MASK, src_val); @@ -1249,10 +1249,10 @@ static struct snd_soc_dai_driver wm8998_dai[] = { }, }; -static int wm8998_set_fll(struct snd_soc_codec *codec, int fll_id, int source, +static int wm8998_set_fll(struct snd_soc_component *component, int fll_id, int source, unsigned int Fref, unsigned int Fout) { - struct wm8998_priv *wm8998 = snd_soc_codec_get_drvdata(codec); + struct wm8998_priv *wm8998 = snd_soc_component_get_drvdata(component); switch (fll_id) { case WM8998_FLL1: @@ -1270,35 +1270,32 @@ static int wm8998_set_fll(struct snd_soc_codec *codec, int fll_id, int source, } } -static int wm8998_codec_probe(struct snd_soc_codec *codec) +static int wm8998_component_probe(struct snd_soc_component *component) { - struct wm8998_priv *priv = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); + struct wm8998_priv *priv = snd_soc_component_get_drvdata(component); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); struct arizona *arizona = priv->core.arizona; int ret; arizona->dapm = dapm; - snd_soc_codec_init_regmap(codec, arizona->regmap); + snd_soc_component_init_regmap(component, arizona->regmap); - ret = arizona_init_spk(codec); + ret = arizona_init_spk(component); if (ret < 0) return ret; - arizona_init_gpio(codec); + arizona_init_gpio(component); snd_soc_component_disable_pin(component, "HAPTICS"); return 0; } -static int wm8998_codec_remove(struct snd_soc_codec *codec) +static void wm8998_component_remove(struct snd_soc_component *component) { - struct wm8998_priv *priv = snd_soc_codec_get_drvdata(codec); + struct wm8998_priv *priv = snd_soc_component_get_drvdata(component); priv->core.arizona->dapm = NULL; - - return 0; } #define WM8998_DIG_VU 0x0200 @@ -1315,23 +1312,20 @@ static unsigned int wm8998_digital_vu[] = { ARIZONA_DAC_DIGITAL_VOLUME_5R, }; -static const struct snd_soc_codec_driver soc_codec_dev_wm8998 = { - .probe = wm8998_codec_probe, - .remove = wm8998_codec_remove, - - .idle_bias_off = true, - - .set_sysclk = arizona_set_sysclk, - .set_pll = wm8998_set_fll, - - .component_driver = { - .controls = wm8998_snd_controls, - .num_controls = ARRAY_SIZE(wm8998_snd_controls), - .dapm_widgets = wm8998_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8998_dapm_widgets), - .dapm_routes = wm8998_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8998_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8998 = { + .probe = wm8998_component_probe, + .remove = wm8998_component_remove, + .set_sysclk = arizona_set_sysclk, + .set_pll = wm8998_set_fll, + .controls = wm8998_snd_controls, + .num_controls = ARRAY_SIZE(wm8998_snd_controls), + .dapm_widgets = wm8998_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8998_dapm_widgets), + .dapm_routes = wm8998_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8998_dapm_routes), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int wm8998_probe(struct platform_device *pdev) @@ -1384,10 +1378,11 @@ static int wm8998_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8998, + ret = devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_wm8998, wm8998_dai, ARRAY_SIZE(wm8998_dai)); if (ret < 0) { - dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); + dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; } @@ -1404,7 +1399,6 @@ static int wm8998_remove(struct platform_device *pdev) struct wm8998_priv *wm8998 = platform_get_drvdata(pdev); struct arizona *arizona = wm8998->core.arizona; - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); arizona_free_spk_irqs(arizona); diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 66e32f5d2917..4847e947410b 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -605,13 +605,13 @@ static const struct { }; static void wm_adsp2_init_debugfs(struct wm_adsp *dsp, - struct snd_soc_codec *codec) + struct snd_soc_component *component) { struct dentry *root = NULL; char *root_name; int i; - if (!codec->component.debugfs_root) { + if (!component->debugfs_root) { adsp_err(dsp, "No codec debugfs root\n"); goto err; } @@ -621,7 +621,7 @@ static void wm_adsp2_init_debugfs(struct wm_adsp *dsp, goto err; snprintf(root_name, PAGE_SIZE, "dsp%d", dsp->num); - root = debugfs_create_dir(root_name, codec->component.debugfs_root); + root = debugfs_create_dir(root_name, component->debugfs_root); kfree(root_name); if (!root) @@ -662,7 +662,7 @@ static void wm_adsp2_cleanup_debugfs(struct wm_adsp *dsp) } #else static inline void wm_adsp2_init_debugfs(struct wm_adsp *dsp, - struct snd_soc_codec *codec) + struct snd_soc_component *component) { } @@ -688,9 +688,9 @@ static inline void wm_adsp_debugfs_clear(struct wm_adsp *dsp) static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol, 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 soc_enum *e = (struct soc_enum *)kcontrol->private_value; - struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); + struct wm_adsp *dsp = snd_soc_component_get_drvdata(component); ucontrol->value.enumerated.item[0] = dsp[e->shift_l].fw; @@ -700,9 +700,9 @@ static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol, static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, 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 soc_enum *e = (struct soc_enum *)kcontrol->private_value; - struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); + struct wm_adsp *dsp = snd_soc_component_get_drvdata(component); int ret = 0; if (ucontrol->value.enumerated.item[0] == dsp[e->shift_l].fw) @@ -1213,7 +1213,7 @@ static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl) break; } - ret = snd_soc_add_codec_controls(dsp->codec, kcontrol, 1); + ret = snd_soc_add_component_controls(dsp->component, kcontrol, 1); if (ret < 0) goto err_kcontrol; @@ -2396,14 +2396,14 @@ int wm_adsp1_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 wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct wm_adsp *dsps = snd_soc_component_get_drvdata(component); struct wm_adsp *dsp = &dsps[w->shift]; struct wm_coeff_ctl *ctl; int ret; unsigned int val; - dsp->codec = codec; + dsp->component = component; mutex_lock(&dsp->pwr_lock); @@ -2633,8 +2633,8 @@ static void wm_adsp2_set_dspclk(struct wm_adsp *dsp, unsigned int freq) int wm_adsp2_preloader_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wm_adsp *dsp = snd_soc_component_get_drvdata(component); ucontrol->value.integer.value[0] = dsp->preloaded; @@ -2645,9 +2645,9 @@ EXPORT_SYMBOL_GPL(wm_adsp2_preloader_get); int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wm_adsp *dsp = snd_soc_component_get_drvdata(component); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; char preload[32]; @@ -2683,8 +2683,8 @@ int wm_adsp2_early_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event, unsigned int freq) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct wm_adsp *dsps = snd_soc_component_get_drvdata(component); struct wm_adsp *dsp = &dsps[w->shift]; struct wm_coeff_ctl *ctl; @@ -2726,8 +2726,8 @@ EXPORT_SYMBOL_GPL(wm_adsp2_early_event); int wm_adsp2_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 wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct wm_adsp *dsps = snd_soc_component_get_drvdata(component); struct wm_adsp *dsp = &dsps[w->shift]; int ret; @@ -2841,31 +2841,31 @@ err: } EXPORT_SYMBOL_GPL(wm_adsp2_event); -int wm_adsp2_codec_probe(struct wm_adsp *dsp, struct snd_soc_codec *codec) +int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); char preload[32]; snprintf(preload, ARRAY_SIZE(preload), "DSP%d Preload", dsp->num); snd_soc_dapm_disable_pin(dapm, preload); - wm_adsp2_init_debugfs(dsp, codec); + wm_adsp2_init_debugfs(dsp, component); - dsp->codec = codec; + dsp->component = component; - return snd_soc_add_codec_controls(codec, + return snd_soc_add_component_controls(component, &wm_adsp_fw_controls[dsp->num - 1], 1); } -EXPORT_SYMBOL_GPL(wm_adsp2_codec_probe); +EXPORT_SYMBOL_GPL(wm_adsp2_component_probe); -int wm_adsp2_codec_remove(struct wm_adsp *dsp, struct snd_soc_codec *codec) +int wm_adsp2_component_remove(struct wm_adsp *dsp, struct snd_soc_component *component) { wm_adsp2_cleanup_debugfs(dsp); return 0; } -EXPORT_SYMBOL_GPL(wm_adsp2_codec_remove); +EXPORT_SYMBOL_GPL(wm_adsp2_component_remove); int wm_adsp2_init(struct wm_adsp *dsp) { diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h index 41cc11c19b83..82d651ff9d73 100644 --- a/sound/soc/codecs/wm_adsp.h +++ b/sound/soc/codecs/wm_adsp.h @@ -62,7 +62,7 @@ struct wm_adsp { int type; struct device *dev; struct regmap *regmap; - struct snd_soc_codec *codec; + struct snd_soc_component *component; int base; int sysclk_reg; @@ -126,8 +126,8 @@ extern const struct snd_kcontrol_new wm_adsp_fw_controls[]; int wm_adsp1_init(struct wm_adsp *dsp); int wm_adsp2_init(struct wm_adsp *dsp); void wm_adsp2_remove(struct wm_adsp *dsp); -int wm_adsp2_codec_probe(struct wm_adsp *dsp, struct snd_soc_codec *codec); -int wm_adsp2_codec_remove(struct wm_adsp *dsp, struct snd_soc_codec *codec); +int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *component); +int wm_adsp2_component_remove(struct wm_adsp *dsp, struct snd_soc_component *component); int wm_adsp1_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); int wm_adsp2_early_event(struct snd_soc_dapm_widget *w, diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c index a55d18703fe7..6faaec889d1b 100644 --- a/sound/soc/samsung/tm2_wm5110.c +++ b/sound/soc/samsung/tm2_wm5110.c @@ -31,7 +31,7 @@ #define TM2_DAI_AIF2 1 struct tm2_machine_priv { - struct snd_soc_codec *codec; + struct snd_soc_component *component; unsigned int sysclk_rate; struct gpio_desc *gpio_mic_bias; }; @@ -39,33 +39,33 @@ struct tm2_machine_priv { static int tm2_start_sysclk(struct snd_soc_card *card) { struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(card); - struct snd_soc_codec *codec = priv->codec; + struct snd_soc_component *component = priv->component; int ret; - ret = snd_soc_codec_set_pll(codec, WM5110_FLL1_REFCLK, + ret = snd_soc_component_set_pll(component, WM5110_FLL1_REFCLK, ARIZONA_FLL_SRC_MCLK1, MCLK_RATE, priv->sysclk_rate); if (ret < 0) { - dev_err(codec->dev, "Failed to set FLL1 source: %d\n", ret); + dev_err(component->dev, "Failed to set FLL1 source: %d\n", ret); return ret; } - ret = snd_soc_codec_set_pll(codec, WM5110_FLL1, + ret = snd_soc_component_set_pll(component, WM5110_FLL1, ARIZONA_FLL_SRC_MCLK1, MCLK_RATE, priv->sysclk_rate); if (ret < 0) { - dev_err(codec->dev, "Failed to start FLL1: %d\n", ret); + dev_err(component->dev, "Failed to start FLL1: %d\n", ret); return ret; } - ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK, + ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK, ARIZONA_CLK_SRC_FLL1, priv->sysclk_rate, SND_SOC_CLOCK_IN); if (ret < 0) { - dev_err(codec->dev, "Failed to set SYSCLK source: %d\n", ret); + dev_err(component->dev, "Failed to set SYSCLK source: %d\n", ret); return ret; } @@ -75,19 +75,19 @@ static int tm2_start_sysclk(struct snd_soc_card *card) static int tm2_stop_sysclk(struct snd_soc_card *card) { struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(card); - struct snd_soc_codec *codec = priv->codec; + struct snd_soc_component *component = priv->component; int ret; - ret = snd_soc_codec_set_pll(codec, WM5110_FLL1, 0, 0, 0); + ret = snd_soc_component_set_pll(component, WM5110_FLL1, 0, 0, 0); if (ret < 0) { - dev_err(codec->dev, "Failed to stop FLL1: %d\n", ret); + dev_err(component->dev, "Failed to stop FLL1: %d\n", ret); return ret; } - ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK, + ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK, ARIZONA_CLK_SRC_FLL1, 0, 0); if (ret < 0) { - dev_err(codec->dev, "Failed to stop SYSCLK: %d\n", ret); + dev_err(component->dev, "Failed to stop SYSCLK: %d\n", ret); return ret; } @@ -98,7 +98,7 @@ static int tm2_aif1_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_component *component = rtd->codec_dai->component; struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card); switch (params_rate(params)) { @@ -123,7 +123,7 @@ static int tm2_aif1_hw_params(struct snd_pcm_substream *substream, priv->sysclk_rate = 135475200U; break; default: - dev_err(codec->dev, "Not supported sample rate: %d\n", + dev_err(component->dev, "Not supported sample rate: %d\n", params_rate(params)); return -EINVAL; } @@ -139,7 +139,7 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_component *component = rtd->codec_dai->component; unsigned int asyncclk_rate; int ret; @@ -155,35 +155,35 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream, asyncclk_rate = 45158400U; break; default: - dev_err(codec->dev, "Not supported sample rate: %d\n", + dev_err(component->dev, "Not supported sample rate: %d\n", params_rate(params)); return -EINVAL; } - ret = snd_soc_codec_set_pll(codec, WM5110_FLL2_REFCLK, + ret = snd_soc_component_set_pll(component, WM5110_FLL2_REFCLK, ARIZONA_FLL_SRC_MCLK1, MCLK_RATE, asyncclk_rate); if (ret < 0) { - dev_err(codec->dev, "Failed to set FLL2 source: %d\n", ret); + dev_err(component->dev, "Failed to set FLL2 source: %d\n", ret); return ret; } - ret = snd_soc_codec_set_pll(codec, WM5110_FLL2, + ret = snd_soc_component_set_pll(component, WM5110_FLL2, ARIZONA_FLL_SRC_MCLK1, MCLK_RATE, asyncclk_rate); if (ret < 0) { - dev_err(codec->dev, "Failed to start FLL2: %d\n", ret); + dev_err(component->dev, "Failed to start FLL2: %d\n", ret); return ret; } - ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_ASYNCCLK, + ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_ASYNCCLK, ARIZONA_CLK_SRC_FLL2, asyncclk_rate, SND_SOC_CLOCK_IN); if (ret < 0) { - dev_err(codec->dev, "Failed to set ASYNCCLK source: %d\n", ret); + dev_err(component->dev, "Failed to set ASYNCCLK source: %d\n", ret); return ret; } @@ -193,14 +193,14 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream, static int tm2_aif2_hw_free(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_component *component = rtd->codec_dai->component; int ret; /* disable FLL2 */ - ret = snd_soc_codec_set_pll(codec, WM5110_FLL2, ARIZONA_FLL_SRC_MCLK1, + ret = snd_soc_component_set_pll(component, WM5110_FLL2, ARIZONA_FLL_SRC_MCLK1, 0, 0); if (ret < 0) - dev_err(codec->dev, "Failed to stop FLL2: %d\n", ret); + dev_err(component->dev, "Failed to stop FLL2: %d\n", ret); return ret; } @@ -269,7 +269,7 @@ static int tm2_late_probe(struct snd_soc_card *card) rtd = snd_soc_get_pcm_runtime(card, card->dai_link[TM2_DAI_AIF1].name); aif1_dai = rtd->codec_dai; - priv->codec = rtd->codec; + priv->component = rtd->codec_dai->component; ret = snd_soc_dai_set_sysclk(aif1_dai, ARIZONA_CLK_SYSCLK, 0, 0); if (ret < 0) { -- cgit v1.2.3 From 7dd0f7ca5f23a9c8b4a5b69587b41b413b2ecc2d Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Tue, 20 Feb 2018 16:08:11 +0000 Subject: ASoC: arizona: Fixup some minor formatting issues Repair any formatting/style issues that can be fixed without major code refactoring. Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/arizona.c | 59 ++++++++++++++++++++++++------------------- sound/soc/codecs/cs47l24.c | 22 ++++++++-------- sound/soc/codecs/wm5102.c | 20 +++++++-------- sound/soc/codecs/wm5110.c | 62 +++++++++++++++++++++++++--------------------- sound/soc/codecs/wm8997.c | 14 +++++------ sound/soc/codecs/wm8998.c | 33 +++++++++++++----------- 6 files changed, 113 insertions(+), 97 deletions(-) (limited to 'sound/soc/codecs') diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index ffcfe8ea1848..5727ea079ad7 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c @@ -90,7 +90,8 @@ static int arizona_spk_ev(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: - val = snd_soc_component_read32(component, ARIZONA_INTERRUPT_RAW_STATUS_3); + val = snd_soc_component_read32(component, + ARIZONA_INTERRUPT_RAW_STATUS_3); if (val & ARIZONA_SPK_OVERHEAT_STS) { dev_crit(arizona->dev, "Speaker not enabled due to temperature\n"); @@ -641,7 +642,6 @@ const unsigned int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE] = { }; EXPORT_SYMBOL_GPL(arizona_rate_val); - const struct soc_enum arizona_isrc_fsh[] = { SOC_VALUE_ENUM_SINGLE(ARIZONA_ISRC_1_CTRL_1, ARIZONA_ISRC1_FSH_SHIFT, 0xf, @@ -923,7 +923,8 @@ int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, priv->in_pending++; break; case SND_SOC_DAPM_POST_PMU: - snd_soc_component_update_bits(component, reg, ARIZONA_IN1L_MUTE, 0); + snd_soc_component_update_bits(component, reg, + ARIZONA_IN1L_MUTE, 0); /* If this is the last input pending then allow VU */ priv->in_pending--; @@ -1070,9 +1071,8 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w, } EXPORT_SYMBOL_GPL(arizona_out_ev); -int arizona_hp_ev(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, - int event) +int arizona_hp_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, + int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct arizona_priv *priv = snd_soc_component_get_drvdata(component); @@ -1275,8 +1275,8 @@ static unsigned int arizona_opclk_ref_44k1_rates[] = { 45158400, }; -static int arizona_set_opclk(struct snd_soc_component *component, unsigned int clk, - unsigned int freq) +static int arizona_set_opclk(struct snd_soc_component *component, + unsigned int clk, unsigned int freq) { struct arizona_priv *priv = snd_soc_component_get_drvdata(component); unsigned int reg; @@ -1302,7 +1302,7 @@ static int arizona_set_opclk(struct snd_soc_component *component, unsigned int c rates = arizona_opclk_ref_48k_rates; for (ref = 0; ref < ARRAY_SIZE(arizona_opclk_ref_48k_rates) && - rates[ref] <= refclk; ref++) { + rates[ref] <= refclk; ref++) { div = 1; while (rates[ref] / div >= freq && div < 32) { if (rates[ref] / div == freq) { @@ -1727,18 +1727,23 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream, } snd_soc_component_update_bits(component, ARIZONA_SAMPLE_RATE_1, - ARIZONA_SAMPLE_RATE_1_MASK, sr_val); + ARIZONA_SAMPLE_RATE_1_MASK, + sr_val); if (base) - snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL, - ARIZONA_AIF1_RATE_MASK, 0); + snd_soc_component_update_bits(component, + base + ARIZONA_AIF_RATE_CTRL, + ARIZONA_AIF1_RATE_MASK, 0); break; case ARIZONA_CLK_ASYNCCLK: - snd_soc_component_update_bits(component, ARIZONA_ASYNC_SAMPLE_RATE_1, - ARIZONA_ASYNC_SAMPLE_RATE_1_MASK, sr_val); + snd_soc_component_update_bits(component, + ARIZONA_ASYNC_SAMPLE_RATE_1, + ARIZONA_ASYNC_SAMPLE_RATE_1_MASK, + sr_val); if (base) - snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL, - ARIZONA_AIF1_RATE_MASK, - 8 << ARIZONA_AIF1_RATE_SHIFT); + snd_soc_component_update_bits(component, + base + ARIZONA_AIF_RATE_CTRL, + ARIZONA_AIF1_RATE_MASK, + 8 << ARIZONA_AIF1_RATE_SHIFT); break; default: arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk); @@ -1849,9 +1854,10 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, base + ARIZONA_AIF_RX_ENABLES); /* Disable AIF TX/RX before reconfiguring it */ regmap_update_bits_async(arizona->regmap, - base + ARIZONA_AIF_TX_ENABLES, 0xff, 0x0); + base + ARIZONA_AIF_TX_ENABLES, + 0xff, 0x0); regmap_update_bits(arizona->regmap, - base + ARIZONA_AIF_RX_ENABLES, 0xff, 0x0); + base + ARIZONA_AIF_RX_ENABLES, 0xff, 0x0); } ret = arizona_hw_params_rate(substream, params, dai); @@ -1960,8 +1966,9 @@ static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate) else reg = 0; - return snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL, - ARIZONA_AIF1_TRI, reg); + return snd_soc_component_update_bits(component, + base + ARIZONA_AIF_RATE_CTRL, + ARIZONA_AIF1_TRI, reg); } static void arizona_set_channels_to_mask(struct snd_soc_dai *dai, @@ -2319,7 +2326,6 @@ static int arizona_calc_fll(struct arizona_fll *fll, arizona_fll_dbg(fll, "GAIN=0x%x(%d)\n", cfg->gain, 1 << cfg->gain); return 0; - } static void arizona_apply_fll(struct arizona *arizona, unsigned int base, @@ -2565,9 +2571,8 @@ int arizona_set_fll_refclk(struct arizona_fll *fll, int source, fll->ref_src = source; fll->ref_freq = Fref; - if (fll->fout && Fref > 0) { + if (fll->fout && Fref > 0) ret = arizona_enable_fll(fll); - } return ret; } @@ -2656,7 +2661,8 @@ EXPORT_SYMBOL_GPL(arizona_init_fll); * Most systems have a single static configuration and should use * platform data instead. */ -int arizona_set_output_mode(struct snd_soc_component *component, int output, bool diff) +int arizona_set_output_mode(struct snd_soc_component *component, int output, + bool diff) { unsigned int reg, val; @@ -2670,7 +2676,8 @@ int arizona_set_output_mode(struct snd_soc_component *component, int output, boo else val = 0; - return snd_soc_component_update_bits(component, reg, ARIZONA_OUT1_MONO, val); + return snd_soc_component_update_bits(component, reg, + ARIZONA_OUT1_MONO, val); } EXPORT_SYMBOL_GPL(arizona_set_output_mode); diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c index c93d3f7e8e36..196e9c343aeb 100644 --- a/sound/soc/codecs/cs47l24.c +++ b/sound/soc/codecs/cs47l24.c @@ -196,14 +196,13 @@ SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL, SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L, - ARIZONA_OUT4L_MUTE_SHIFT, 1, 1), + ARIZONA_OUT4L_MUTE_SHIFT, 1, 1), SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L, ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT, 0xbf, 0, digital_tlv), SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L, - ARIZONA_OUT4L_VOL_SHIFT, - 0xbf, 0, digital_tlv), + ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv), SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp), SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), @@ -494,8 +493,7 @@ SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3, ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0), SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, - ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, - &cs47l24_aec_loopback_mux), + ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &cs47l24_aec_loopback_mux), SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0, ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0), @@ -931,8 +929,8 @@ static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = { { "DSP3 Voice Trigger", "Switch", "DSP3" }, }; -static int cs47l24_set_fll(struct snd_soc_component *component, int fll_id, int source, - unsigned int Fref, unsigned int Fout) +static int cs47l24_set_fll(struct snd_soc_component *component, int fll_id, + int source, unsigned int Fref, unsigned int Fout) { struct cs47l24_priv *cs47l24 = snd_soc_component_get_drvdata(component); @@ -1144,7 +1142,8 @@ static int cs47l24_component_probe(struct snd_soc_component *component) goto err_adsp2_codec_probe; ret = snd_soc_add_component_controls(component, - &arizona_adsp2_rate_controls[1], 2); + &arizona_adsp2_rate_controls[1], + 2); if (ret) goto err_adsp2_codec_probe; @@ -1214,7 +1213,7 @@ static int cs47l24_probe(struct platform_device *pdev) BUILD_BUG_ON(ARRAY_SIZE(cs47l24_dai) > ARIZONA_MAX_DAI); cs47l24 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l24_priv), - GFP_KERNEL); + GFP_KERNEL); if (!cs47l24) return -ENOMEM; @@ -1294,8 +1293,9 @@ static int cs47l24_probe(struct platform_device *pdev) goto err_dsp_irq; ret = devm_snd_soc_register_component(&pdev->dev, - &soc_component_dev_cs47l24, - cs47l24_dai, ARRAY_SIZE(cs47l24_dai)); + &soc_component_dev_cs47l24, + cs47l24_dai, + ARRAY_SIZE(cs47l24_dai)); if (ret < 0) { dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 24f19cfc98f5..1ac83388d1b8 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -620,7 +620,7 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, } static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, int event) + struct snd_kcontrol *kcontrol, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct arizona *arizona = dev_get_drvdata(component->dev->parent); @@ -717,7 +717,7 @@ static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol, return 0; } -static const char *wm5102_osr_text[] = { +static const char * const wm5102_osr_text[] = { "Low power", "Normal", "High performance", }; @@ -1062,7 +1062,7 @@ ARIZONA_MIXER_ENUMS(DSP1R, ARIZONA_DSP1RMIX_INPUT_1_SOURCE); ARIZONA_DSP_AUX_ENUMS(DSP1, ARIZONA_DSP1AUX1MIX_INPUT_1_SOURCE); -static const char *wm5102_aec_loopback_texts[] = { +static const char * const wm5102_aec_loopback_texts[] = { "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "EPOUT", "SPKOUTL", "SPKOUTR", "SPKDAT1L", "SPKDAT1R", }; @@ -1317,8 +1317,7 @@ SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 0, ARIZONA_DSP_WIDGETS(DSP1, "DSP1"), SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, - ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, - &wm5102_aec_loopback_mux), + ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &wm5102_aec_loopback_mux), SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, @@ -1736,8 +1735,8 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { { "DRC1 Signal Activity", NULL, "DRC1R" }, }; -static int wm5102_set_fll(struct snd_soc_component *component, int fll_id, int source, - unsigned int Fref, unsigned int Fout) +static int wm5102_set_fll(struct snd_soc_component *component, int fll_id, + int source, unsigned int Fref, unsigned int Fout) { struct wm5102_priv *wm5102 = snd_soc_component_get_drvdata(component); @@ -1947,7 +1946,7 @@ static int wm5102_component_probe(struct snd_soc_component *component) return ret; ret = snd_soc_add_component_controls(component, - arizona_adsp2_rate_controls, 1); + arizona_adsp2_rate_controls, 1); if (ret) goto err_adsp2_codec_probe; @@ -2105,8 +2104,9 @@ static int wm5102_probe(struct platform_device *pdev) goto err_dsp_irq; ret = devm_snd_soc_register_component(&pdev->dev, - &soc_component_dev_wm5102, - wm5102_dai, ARRAY_SIZE(wm5102_dai)); + &soc_component_dev_wm5102, + wm5102_dai, + ARRAY_SIZE(wm5102_dai)); if (ret < 0) { dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index b33cbd0161d3..fb9835dcd836 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -332,19 +332,25 @@ static int wm5110_hp_pre_disable(struct snd_soc_dapm_widget *w) switch (w->shift) { case ARIZONA_OUT1L_ENA_SHIFT: if (!(val & ARIZONA_DRE1L_ENA_MASK)) { - snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS, - ARIZONA_WS_TRG1, ARIZONA_WS_TRG1); - snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS, - ARIZONA_WS_TRG1, 0); + snd_soc_component_update_bits(component, + ARIZONA_SPARE_TRIGGERS, + ARIZONA_WS_TRG1, + ARIZONA_WS_TRG1); + snd_soc_component_update_bits(component, + ARIZONA_SPARE_TRIGGERS, + ARIZONA_WS_TRG1, 0); priv->out_down_delay += 27; } break; case ARIZONA_OUT1R_ENA_SHIFT: if (!(val & ARIZONA_DRE1R_ENA_MASK)) { - snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS, - ARIZONA_WS_TRG2, ARIZONA_WS_TRG2); - snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS, - ARIZONA_WS_TRG2, 0); + snd_soc_component_update_bits(component, + ARIZONA_SPARE_TRIGGERS, + ARIZONA_WS_TRG2, + ARIZONA_WS_TRG2); + snd_soc_component_update_bits(component, + ARIZONA_SPARE_TRIGGERS, + ARIZONA_WS_TRG2, 0); priv->out_down_delay += 27; } break; @@ -539,7 +545,7 @@ static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMU: snd_soc_component_update_bits(component, reg, mask, - wm5110->in_pga_cache[w->shift]); + wm5110->in_pga_cache[w->shift]); wm5110->in_post_pending--; if (wm5110->in_post_pending == 0) @@ -863,14 +869,14 @@ SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT, ARIZONA_SPK2R_MUTE_SHIFT, 1, 1), SOC_DOUBLE_EXT("HPOUT1 DRE Switch", ARIZONA_DRE_ENABLE, - ARIZONA_DRE1L_ENA_SHIFT, ARIZONA_DRE1R_ENA_SHIFT, 1, 0, - snd_soc_get_volsw, wm5110_put_dre), + ARIZONA_DRE1L_ENA_SHIFT, ARIZONA_DRE1R_ENA_SHIFT, 1, 0, + snd_soc_get_volsw, wm5110_put_dre), SOC_DOUBLE_EXT("HPOUT2 DRE Switch", ARIZONA_DRE_ENABLE, - ARIZONA_DRE2L_ENA_SHIFT, ARIZONA_DRE2R_ENA_SHIFT, 1, 0, - snd_soc_get_volsw, wm5110_put_dre), + ARIZONA_DRE2L_ENA_SHIFT, ARIZONA_DRE2R_ENA_SHIFT, 1, 0, + snd_soc_get_volsw, wm5110_put_dre), SOC_DOUBLE_EXT("HPOUT3 DRE Switch", ARIZONA_DRE_ENABLE, - ARIZONA_DRE3L_ENA_SHIFT, ARIZONA_DRE3R_ENA_SHIFT, 1, 0, - snd_soc_get_volsw, wm5110_put_dre), + ARIZONA_DRE3L_ENA_SHIFT, ARIZONA_DRE3R_ENA_SHIFT, 1, 0, + snd_soc_get_volsw, wm5110_put_dre), SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp), SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), @@ -1036,7 +1042,7 @@ ARIZONA_MUX_ENUMS(ISRC3DEC2, ARIZONA_ISRC3DEC2MIX_INPUT_1_SOURCE); ARIZONA_MUX_ENUMS(ISRC3DEC3, ARIZONA_ISRC3DEC3MIX_INPUT_1_SOURCE); ARIZONA_MUX_ENUMS(ISRC3DEC4, ARIZONA_ISRC3DEC4MIX_INPUT_1_SOURCE); -static const char *wm5110_aec_loopback_texts[] = { +static const char * const wm5110_aec_loopback_texts[] = { "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R", "SPKOUTL", "SPKOUTR", "SPKDAT1L", "SPKDAT1R", "SPKDAT2L", "SPKDAT2R", }; @@ -1274,18 +1280,17 @@ SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3, ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0), SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, - ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, - &wm5110_aec_loopback_mux), + ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &wm5110_aec_loopback_mux), SND_SOC_DAPM_SUPPLY("RXANC NG External Clock", SND_SOC_NOPM, - ARIZONA_EXT_NG_SEL_SET_SHIFT, 0, arizona_anc_ev, - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), + ARIZONA_EXT_NG_SEL_SET_SHIFT, 0, arizona_anc_ev, + SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), SND_SOC_DAPM_PGA("RXANCL NG External", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_PGA("RXANCR NG External", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("RXANC NG Clock", SND_SOC_NOPM, - ARIZONA_CLK_NG_ENA_SET_SHIFT, 0, arizona_anc_ev, - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), + ARIZONA_CLK_NG_ENA_SET_SHIFT, 0, arizona_anc_ev, + SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), SND_SOC_DAPM_PGA("RXANCL NG Internal", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_PGA("RXANCR NG Internal", SND_SOC_NOPM, 0, 0, NULL, 0), @@ -2034,8 +2039,8 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { { "DSP3 Voice Trigger", "Switch", "DSP3" }, }; -static int wm5110_set_fll(struct snd_soc_component *component, int fll_id, int source, - unsigned int Fref, unsigned int Fout) +static int wm5110_set_fll(struct snd_soc_component *component, int fll_id, + int source, unsigned int Fref, unsigned int Fout) { struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component); @@ -2302,8 +2307,8 @@ static int wm5110_component_probe(struct snd_soc_component *component) } ret = snd_soc_add_component_controls(component, - arizona_adsp2_rate_controls, - WM5110_NUM_ADSP); + arizona_adsp2_rate_controls, + WM5110_NUM_ADSP); if (ret) goto err_adsp2_codec_probe; @@ -2460,8 +2465,9 @@ static int wm5110_probe(struct platform_device *pdev) goto err_dsp_irq; ret = devm_snd_soc_register_component(&pdev->dev, - &soc_component_dev_wm5110, - wm5110_dai, ARRAY_SIZE(wm5110_dai)); + &soc_component_dev_wm5110, + wm5110_dai, + ARRAY_SIZE(wm5110_dai)); if (ret < 0) { dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 45ee1e6bf715..df5b36b8fc5a 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -118,7 +118,7 @@ static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w, return arizona_dvfs_sysclk_ev(w, kcontrol, event); } -static const char *wm8997_osr_text[] = { +static const char * const wm8997_osr_text[] = { "Low power", "Normal", "High performance", }; @@ -609,8 +609,7 @@ SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 0, ARIZONA_SLIMRX8_ENA_SHIFT, 0), SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, - ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, - &wm8997_aec_loopback_mux), + ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &wm8997_aec_loopback_mux), SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, @@ -927,8 +926,8 @@ static const struct snd_soc_dapm_route wm8997_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, }; -static int wm8997_set_fll(struct snd_soc_component *component, int fll_id, int source, - unsigned int Fref, unsigned int Fout) +static int wm8997_set_fll(struct snd_soc_component *component, int fll_id, + int source, unsigned int Fref, unsigned int Fout) { struct wm8997_priv *wm8997 = snd_soc_component_get_drvdata(component); @@ -1173,8 +1172,9 @@ static int wm8997_probe(struct platform_device *pdev) return ret; ret = devm_snd_soc_register_component(&pdev->dev, - &soc_component_dev_wm8997, - wm8997_dai, ARRAY_SIZE(wm8997_dai)); + &soc_component_dev_wm8997, + wm8997_dai, + ARRAY_SIZE(wm8997_dai)); if (ret < 0) { dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c index 6f3fdd7b095e..61294c787f27 100644 --- a/sound/soc/codecs/wm8998.c +++ b/sound/soc/codecs/wm8998.c @@ -137,11 +137,13 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, if (inmode & ARIZONA_INMODE_SE) src_val |= 1 << ARIZONA_IN1L_SRC_SE_SHIFT; - snd_soc_component_update_bits(component, mode_reg, ARIZONA_IN1_MODE_MASK, mode_val); + snd_soc_component_update_bits(component, mode_reg, + ARIZONA_IN1_MODE_MASK, mode_val); snd_soc_component_update_bits(component, e->reg, - ARIZONA_IN1L_SRC_MASK | ARIZONA_IN1L_SRC_SE_MASK, - src_val); + ARIZONA_IN1L_SRC_MASK | + ARIZONA_IN1L_SRC_SE_MASK, + src_val); return snd_soc_dapm_mux_update_power(dapm, kcontrol, ucontrol->value.enumerated.item[0], @@ -322,7 +324,7 @@ SOC_DOUBLE_R("HPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, SOC_DOUBLE_R("LINEOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L, ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1), SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L, - ARIZONA_OUT3L_MUTE_SHIFT, 1, 1), + ARIZONA_OUT3L_MUTE_SHIFT, 1, 1), SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L, ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1), SOC_DOUBLE_R("SPKDAT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L, @@ -335,7 +337,7 @@ SOC_DOUBLE_R_TLV("LINEOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L, ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT, 0xbf, 0, digital_tlv), SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L, - ARIZONA_OUT3L_VOL_SHIFT, 0xbf, 0, digital_tlv), + ARIZONA_OUT3L_VOL_SHIFT, 0xbf, 0, digital_tlv), SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L, ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv), @@ -615,12 +617,12 @@ SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3, ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0), SND_SOC_DAPM_MUX("AEC1 Loopback", ARIZONA_DAC_AEC_CONTROL_1, - ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, - &wm8998_aec_loopback_mux[0]), + ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, + &wm8998_aec_loopback_mux[0]), SND_SOC_DAPM_MUX("AEC2 Loopback", ARIZONA_DAC_AEC_CONTROL_2, - ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, - &wm8998_aec_loopback_mux[1]), + ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, + &wm8998_aec_loopback_mux[1]), SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0, ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0), @@ -739,9 +741,9 @@ SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), SND_SOC_DAPM_PGA("SPD1TX1", ARIZONA_SPD1_TX_CONTROL, - ARIZONA_SPD1_VAL1_SHIFT, 0, NULL, 0), + ARIZONA_SPD1_VAL1_SHIFT, 0, NULL, 0), SND_SOC_DAPM_PGA("SPD1TX2", ARIZONA_SPD1_TX_CONTROL, - ARIZONA_SPD1_VAL2_SHIFT, 0, NULL, 0), + ARIZONA_SPD1_VAL2_SHIFT, 0, NULL, 0), SND_SOC_DAPM_OUT_DRV("SPD1", ARIZONA_SPD1_TX_CONTROL, ARIZONA_SPD1_ENA_SHIFT, 0, NULL, 0), @@ -1249,8 +1251,8 @@ static struct snd_soc_dai_driver wm8998_dai[] = { }, }; -static int wm8998_set_fll(struct snd_soc_component *component, int fll_id, int source, - unsigned int Fref, unsigned int Fout) +static int wm8998_set_fll(struct snd_soc_component *component, int fll_id, + int source, unsigned int Fref, unsigned int Fout) { struct wm8998_priv *wm8998 = snd_soc_component_get_drvdata(component); @@ -1379,8 +1381,9 @@ static int wm8998_probe(struct platform_device *pdev) return ret; ret = devm_snd_soc_register_component(&pdev->dev, - &soc_component_dev_wm8998, - wm8998_dai, ARRAY_SIZE(wm8998_dai)); + &soc_component_dev_wm8998, + wm8998_dai, + ARRAY_SIZE(wm8998_dai)); if (ret < 0) { dev_err(&pdev->dev, "Failed to register component: %d\n", ret); goto err_spk_irqs; -- cgit v1.2.3 From f6d4b052175d84c6f2b73e884f3ab8c83c5f4d45 Mon Sep 17 00:00:00 2001 From: Katsuhiro Suzuki Date: Fri, 23 Feb 2018 10:17:17 +0900 Subject: ASoC: support ROHM BD28623 codec This patch adds support of the ROHM BD28623MUV Class D speaker amplifier for Flat-panel TVs. This IC delivers an output power of 20W + 20W. Signed-off-by: Katsuhiro Suzuki Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 8 ++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/bd28623.c | 242 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 252 insertions(+) create mode 100644 sound/soc/codecs/bd28623.c (limited to 'sound/soc/codecs') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 2b331f7266ab..4545f8fde220 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -45,6 +45,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_ALC5623 if I2C select SND_SOC_ALC5632 if I2C select SND_SOC_BT_SCO + select SND_SOC_BD28623 select SND_SOC_CQ0093VC select SND_SOC_CS35L32 if I2C select SND_SOC_CS35L33 if I2C @@ -405,6 +406,13 @@ config SND_SOC_ALC5623 config SND_SOC_ALC5632 tristate +config SND_SOC_BD28623 + tristate "ROHM BD28623 CODEC" + help + Enable support for ROHM BD28623MUV Class D speaker amplifier. + This codec does not have any control buses such as I2C, it + detect format of I2S automatically. + config SND_SOC_BT_SCO tristate "Dummy BT SCO codec driver" diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index da1571336f1e..6df2fb32fc7e 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -35,6 +35,7 @@ snd-soc-ak4642-objs := ak4642.o snd-soc-ak4671-objs := ak4671.o snd-soc-ak5386-objs := ak5386.o snd-soc-arizona-objs := arizona.o +snd-soc-bd28623-objs := bd28623.o snd-soc-bt-sco-objs := bt-sco.o snd-soc-cq93vc-objs := cq93vc.o snd-soc-cs35l32-objs := cs35l32.o @@ -280,6 +281,7 @@ obj-$(CONFIG_SND_SOC_AK5386) += snd-soc-ak5386.o obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o obj-$(CONFIG_SND_SOC_ALC5632) += snd-soc-alc5632.o obj-$(CONFIG_SND_SOC_ARIZONA) += snd-soc-arizona.o +obj-$(CONFIG_SND_SOC_BD28623) += snd-soc-bd28623.o obj-$(CONFIG_SND_SOC_BT_SCO) += snd-soc-bt-sco.o obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o obj-$(CONFIG_SND_SOC_CS35L32) += snd-soc-cs35l32.o diff --git a/sound/soc/codecs/bd28623.c b/sound/soc/codecs/bd28623.c new file mode 100644 index 000000000000..31904ef5c88b --- /dev/null +++ b/sound/soc/codecs/bd28623.c @@ -0,0 +1,242 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// ROHM BD28623MUV class D speaker amplifier codec driver. +// +// Copyright (c) 2018 Socionext Inc. + +#include +#include +#include +#include +#include +#include +#include + +#define BD28623_NUM_SUPPLIES 3 + +static const char *const bd28623_supply_names[BD28623_NUM_SUPPLIES] = { + "VCCA", + "VCCP1", + "VCCP2", +}; + +struct bd28623_priv { + struct device *dev; + struct regulator_bulk_data supplies[BD28623_NUM_SUPPLIES]; + struct gpio_desc *reset_gpio; + struct gpio_desc *mute_gpio; + + int switch_spk; +}; + +static const struct snd_soc_dapm_widget bd28623_widgets[] = { + SND_SOC_DAPM_DAC("DAC", "Playback", SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_OUTPUT("OUT1P"), + SND_SOC_DAPM_OUTPUT("OUT1N"), + SND_SOC_DAPM_OUTPUT("OUT2P"), + SND_SOC_DAPM_OUTPUT("OUT2N"), +}; + +static const struct snd_soc_dapm_route bd28623_routes[] = { + { "OUT1P", NULL, "DAC" }, + { "OUT1N", NULL, "DAC" }, + { "OUT2P", NULL, "DAC" }, + { "OUT2N", NULL, "DAC" }, +}; + +static int bd28623_power_on(struct bd28623_priv *bd) +{ + int ret; + + ret = regulator_bulk_enable(ARRAY_SIZE(bd->supplies), bd->supplies); + if (ret) { + dev_err(bd->dev, "Failed to enable supplies: %d\n", ret); + return ret; + } + + gpiod_set_value_cansleep(bd->reset_gpio, 0); + usleep_range(300000, 400000); + + return 0; +} + +static void bd28623_power_off(struct bd28623_priv *bd) +{ + gpiod_set_value_cansleep(bd->reset_gpio, 1); + + regulator_bulk_disable(ARRAY_SIZE(bd->supplies), bd->supplies); +} + +static int bd28623_get_switch_spk(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = + snd_soc_kcontrol_component(kcontrol); + struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); + + ucontrol->value.integer.value[0] = bd->switch_spk; + + return 0; +} + +static int bd28623_set_switch_spk(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = + snd_soc_kcontrol_component(kcontrol); + struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); + + if (bd->switch_spk == ucontrol->value.integer.value[0]) + return 0; + + bd->switch_spk = ucontrol->value.integer.value[0]; + + gpiod_set_value_cansleep(bd->mute_gpio, bd->switch_spk ? 0 : 1); + + return 0; +} + +static const struct snd_kcontrol_new bd28623_controls[] = { + SOC_SINGLE_BOOL_EXT("Speaker Switch", 0, + bd28623_get_switch_spk, bd28623_set_switch_spk), +}; + +static int bd28623_codec_probe(struct snd_soc_component *component) +{ + struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); + int ret; + + bd->switch_spk = 1; + + ret = bd28623_power_on(bd); + if (ret) + return ret; + + gpiod_set_value_cansleep(bd->mute_gpio, bd->switch_spk ? 0 : 1); + + return 0; +} + +static void bd28623_codec_remove(struct snd_soc_component *component) +{ + struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); + + bd28623_power_off(bd); +} + +static int bd28623_codec_suspend(struct snd_soc_component *component) +{ + struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); + + bd28623_power_off(bd); + + return 0; +} + +static int bd28623_codec_resume(struct snd_soc_component *component) +{ + struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); + int ret; + + ret = bd28623_power_on(bd); + if (ret) + return ret; + + gpiod_set_value_cansleep(bd->mute_gpio, bd->switch_spk ? 0 : 1); + + return 0; +} + +static const struct snd_soc_component_driver soc_codec_bd = { + .probe = bd28623_codec_probe, + .remove = bd28623_codec_remove, + .suspend = bd28623_codec_suspend, + .resume = bd28623_codec_resume, + .dapm_widgets = bd28623_widgets, + .num_dapm_widgets = ARRAY_SIZE(bd28623_widgets), + .dapm_routes = bd28623_routes, + .num_dapm_routes = ARRAY_SIZE(bd28623_routes), + .controls = bd28623_controls, + .num_controls = ARRAY_SIZE(bd28623_controls), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, +}; + +static struct snd_soc_dai_driver soc_dai_bd = { + .name = "bd28623-speaker", + .playback = { + .stream_name = "Playback", + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_32000, + .channels_min = 2, + .channels_max = 2, + }, +}; + +static int bd28623_probe(struct platform_device *pdev) +{ + struct bd28623_priv *bd; + struct device *dev = &pdev->dev; + int i, ret; + + bd = devm_kzalloc(&pdev->dev, sizeof(struct bd28623_priv), GFP_KERNEL); + if (!bd) + return -ENOMEM; + + for (i = 0; i < ARRAY_SIZE(bd->supplies); i++) + bd->supplies[i].supply = bd28623_supply_names[i]; + + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(bd->supplies), + bd->supplies); + if (ret) { + dev_err(dev, "Failed to get supplies: %d\n", ret); + return ret; + } + + bd->reset_gpio = devm_gpiod_get_optional(dev, "reset", + GPIOD_OUT_HIGH); + if (IS_ERR(bd->reset_gpio)) { + dev_err(dev, "Failed to request reset_gpio: %ld\n", + PTR_ERR(bd->reset_gpio)); + return PTR_ERR(bd->reset_gpio); + } + + bd->mute_gpio = devm_gpiod_get_optional(dev, "mute", + GPIOD_OUT_HIGH); + if (IS_ERR(bd->mute_gpio)) { + dev_err(dev, "Failed to request mute_gpio: %ld\n", + PTR_ERR(bd->mute_gpio)); + return PTR_ERR(bd->mute_gpio); + } + + platform_set_drvdata(pdev, bd); + bd->dev = dev; + + return devm_snd_soc_register_component(dev, &soc_codec_bd, + &soc_dai_bd, 1); +} + +static const struct of_device_id bd28623_of_match[] = { + { .compatible = "rohm,bd28623", }, + {} +}; +MODULE_DEVICE_TABLE(of, bd28623_of_match); + +static struct platform_driver bd28623_codec_driver = { + .driver = { + .name = "bd28623", + .of_match_table = of_match_ptr(bd28623_of_match), + }, + .probe = bd28623_probe, +}; +module_platform_driver(bd28623_codec_driver); + +MODULE_AUTHOR("Katsuhiro Suzuki "); +MODULE_DESCRIPTION("ROHM BD28623 speaker amplifier driver"); +MODULE_LICENSE("GPL v2"); -- cgit v1.2.3