Skip to contentSkip to conversation

ASoC: dapm: Convert pin switches to use snd_soc_card

PATCH In review Mark Brown 3 participants 5 messages Feb 15, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: dapm: Convert pin switches to use snd_soc_card

Since the addition of the non-CODEC control adds card controls like the DAPM pin switch have been broken as they are expecting the private data for the control to be the CODEC but it's now the card. Fix that for the pin switches, an audit of other drivers is required.

---
 sound/soc/soc-dapm.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
sound/soc/soc-dapm.c +10 -10
index 6fc488e..9b796e3 100644
@@ -2644,15 +2644,15 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_info_pin_switch);
 int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_value *ucontrol)
 {
-	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 	const char *pin = (const char *)kcontrol->private_value;
 
-	mutex_lock(&codec->mutex);
+	mutex_lock(&card->mutex);
 
 	ucontrol->value.integer.value[0] =
-		snd_soc_dapm_get_pin_status(&codec->dapm, pin);
+		snd_soc_dapm_get_pin_status(&card->dapm, pin);
 
-	mutex_unlock(&codec->mutex);
+	mutex_unlock(&card->mutex);
 
 	return 0;
 }
@@ -2667,19 +2667,19 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_pin_switch);
 int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_value *ucontrol)
 {
-	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 	const char *pin = (const char *)kcontrol->private_value;
 
-	mutex_lock(&codec->mutex);
+	mutex_lock(&card->mutex);
 
 	if (ucontrol->value.integer.value[0])
-		snd_soc_dapm_enable_pin(&codec->dapm, pin);
+		snd_soc_dapm_enable_pin(&card->dapm, pin);
 	else
-		snd_soc_dapm_disable_pin(&codec->dapm, pin);
+		snd_soc_dapm_disable_pin(&card->dapm, pin);
 
-	snd_soc_dapm_sync(&codec->dapm);
+	snd_soc_dapm_sync(&card->dapm);
 
-	mutex_unlock(&codec->mutex);
+	mutex_unlock(&card->mutex);
 
 	return 0;
 }
Signature · 1 line
1.7.9.rc1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Mark Brown

Since the addition of the non-CODEC control adds card controls like the DAPM pin switch have been broken as they are expecting the private data for the control to be the CODEC but it's now the card. Fix that for the pin switches, an audit of other drivers is required.

I covered all the machine drivers who directly used the old API with the original patch but I'll also do some further audit for indirect users like the pin switch.

Liam

author
#2 lore raw
Quoted 3 lines · Liam Girdwood

I covered all the machine drivers who directly used the old API with the original patch but I'll also do some further audit for indirect users like the pin switch.

Hrm, what about those that use the table based init? I just did a spot check on spitz and it's still expecting to get a snd_soc_codec back.

But now I need breakfast...

#3 lore raw
Quoted 10 lines · Mark Brown
Quoted 3 lines · Liam Girdwood

I covered all the machine drivers who directly used the old API with the original patch but I'll also do some further audit for indirect users like the pin switch.

Hrm, what about those that use the table based init? I just did a spot check on spitz and it's still expecting to get a snd_soc_codec back.

But now I need breakfast...

A lucky check ;-) It looks like spitz was the only one missing the update as the other table inits are all fine. Patch forthcoming...

Liam

Tested-by on v1 1/1
#4 lore raw
In reply to Mark Brown

Mark Brown wrote at Tuesday, February 14, 2012 6:12 PM:

Quoted 6 lines

Since the addition of the non-CODEC control adds card controls like the DAPM pin switch have been broken as they are expecting the private data for the control to be the CODEC but it's now the card. Fix that for the pin switches, an audit of other drivers is required.

(on a board using tegra_wm8903 machine driver)

Signature · 1 line
nvpublic