Skip to content

Commit

Permalink
ASoC: arizona: Use component pin control functions
Browse files Browse the repository at this point in the history
We need to modify the state of some of our own pins and are currently
not taking account that the pin name may have a name_prefix applied
to it.

Replace the snd_soc_dapm_x_pin functions with the equivalent
snd_soc_component_x_pin functions so that any name_prefix will be
handled automatically.

Signed-off-by: Richard Fitzgerald <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Richard Fitzgerald authored and broonie committed Nov 30, 2016
1 parent 19a113a commit 35f4403
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
12 changes: 8 additions & 4 deletions sound/soc/codecs/arizona.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,28 +257,32 @@ EXPORT_SYMBOL_GPL(arizona_init_mono);
int arizona_init_gpio(struct snd_soc_codec *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 arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
struct arizona *arizona = priv->arizona;
int i;

switch (arizona->type) {
case WM5110:
case WM8280:
snd_soc_dapm_disable_pin(dapm, "DRC2 Signal Activity");
snd_soc_component_disable_pin(component,
"DRC2 Signal Activity");
break;
default:
break;
}

snd_soc_dapm_disable_pin(dapm, "DRC1 Signal Activity");
snd_soc_component_disable_pin(component, "DRC1 Signal Activity");

for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) {
switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) {
case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT:
snd_soc_dapm_enable_pin(dapm, "DRC1 Signal Activity");
snd_soc_component_enable_pin(component,
"DRC1 Signal Activity");
break;
case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT:
snd_soc_dapm_enable_pin(dapm, "DRC2 Signal Activity");
snd_soc_component_enable_pin(component,
"DRC2 Signal Activity");
break;
default:
break;
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/codecs/cs47l24.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,7 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data)
static int cs47l24_codec_probe(struct snd_soc_codec *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 cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec);
int ret;

Expand All @@ -1138,7 +1139,7 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec)
if (ret)
goto err_adsp2_codec_probe;

snd_soc_dapm_disable_pin(dapm, "HAPTICS");
snd_soc_component_disable_pin(component, "HAPTICS");

return 0;

Expand Down
3 changes: 2 additions & 1 deletion sound/soc/codecs/wm5102.c
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,7 @@ static irqreturn_t wm5102_adsp2_irq(int irq, void *data)
static int wm5102_codec_probe(struct snd_soc_codec *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 wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
int ret;

Expand All @@ -1947,7 +1948,7 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
arizona_init_gpio(codec);
arizona_init_notifiers(codec);

snd_soc_dapm_disable_pin(dapm, "HAPTICS");
snd_soc_component_disable_pin(component, "HAPTICS");

priv->core.arizona->dapm = dapm;

Expand Down
3 changes: 2 additions & 1 deletion sound/soc/codecs/wm5110.c
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,7 @@ static irqreturn_t wm5110_adsp2_irq(int irq, void *data)
static int wm5110_codec_probe(struct snd_soc_codec *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 wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
int i, ret;

Expand All @@ -2295,7 +2296,7 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
if (ret)
goto err_adsp2_codec_probe;

snd_soc_dapm_disable_pin(dapm, "HAPTICS");
snd_soc_component_disable_pin(component, "HAPTICS");

return 0;

Expand Down
3 changes: 2 additions & 1 deletion sound/soc/codecs/wm8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,12 +1060,13 @@ static struct snd_soc_dai_driver wm8997_dai[] = {
static int wm8997_codec_probe(struct snd_soc_codec *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 wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);

arizona_init_spk(codec);
arizona_init_notifiers(codec);

snd_soc_dapm_disable_pin(dapm, "HAPTICS");
snd_soc_component_disable_pin(component, "HAPTICS");

priv->core.arizona->dapm = dapm;

Expand Down
3 changes: 2 additions & 1 deletion sound/soc/codecs/wm8998.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,14 +1320,15 @@ static int wm8998_codec_probe(struct snd_soc_codec *codec)
{
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);

priv->core.arizona->dapm = dapm;

arizona_init_spk(codec);
arizona_init_gpio(codec);
arizona_init_notifiers(codec);

snd_soc_dapm_disable_pin(dapm, "HAPTICS");
snd_soc_component_disable_pin(component, "HAPTICS");

return 0;
}
Expand Down

0 comments on commit 35f4403

Please sign in to comment.