Skip to contentSkip to conversation

ASoC: core: Fix check before defaulting to regmap

PATCH In review Mark Brown 3 participants 3 messages Aug 1, 2012 – Aug 2, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: core: Fix check before defaulting to regmap

Check if the chip has provided a write operation (which is mandatory for I/O) rather than looking for control data as some of the MFDs use a global for this. Also skip the attempt if there's no regmap available by device in case things get confused by the attempt to default.

---
 sound/soc/soc-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
index b1fd043..5359623 100644
@@ -1096,7 +1096,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
 	}
 
 	/* If the driver didn't set I/O up try regmap */
-	if (!codec->control_data)
+	if (!codec->write && dev_get_regmap(codec->dev, NULL))
 		snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
 
 	if (driver->controls)
Signature · 1 line
1.7.10.4
Tested-by on v1 1/1
#1 lore raw

Hi Mark,

Quoted 15 lines · Mark Brown

Check if the chip has provided a write operation (which is mandatory for I/O) rather than looking for control data as some of the MFDs use a global for this. Also skip the attempt if there's no regmap available by device in case things get confused by the attempt to default.

---
 sound/soc/soc-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +0 -0
index b1fd043..5359623 100644

sound/soc/soc-core.c static int soc_probe_codec(struct snd_soc_card *card, · line 1102

Quoted 8 lines
sound/soc/soc-core.c +1 -1
@@ -1096,7 +1096,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
 	}
 
 	/* If the driver didn't set I/O up try regmap */
-	if (!codec->control_data)
+	if (!codec->write && dev_get_regmap(codec->dev, NULL))
 		snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
 
 	if (driver->controls)

I have a slightly different implementation of this, but this looks better.

Boards using the following machine drivers are affected by this issue:
zoom2, overo, omap3pandora, omap3beagle, sdp3430, omap-abe-twl6040, omap3evm, igep0020.

All boards using these machine drivers will have kernel crash at the first time we try to write a register in the codec.

Could you send this patch (if the patch OK with you) to be included in 3.6-rc1 to avoid boards booting to kernel crash (if they restore the mixers at boot time).

Thank you.

#2 lore raw

At Thu, 02 Aug 2012 10:44:41 +0300,

Quoted 37 lines · Peter Ujfalusi

Hi Mark,

Quoted 15 lines · Mark Brown

Check if the chip has provided a write operation (which is mandatory for I/O) rather than looking for control data as some of the MFDs use a global for this. Also skip the attempt if there's no regmap available by device in case things get confused by the attempt to default.

---
 sound/soc/soc-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +0 -0
index b1fd043..5359623 100644

sound/soc/soc-core.c static int soc_probe_codec(struct snd_soc_card *card, · line 1102

Quoted 8 lines
sound/soc/soc-core.c +1 -1
@@ -1096,7 +1096,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
 	}
 
 	/* If the driver didn't set I/O up try regmap */
-	if (!codec->control_data)
+	if (!codec->write && dev_get_regmap(codec->dev, NULL))
 		snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
 
 	if (driver->controls)

I have a slightly different implementation of this, but this looks better.

Boards using the following machine drivers are affected by this issue:
zoom2, overo, omap3pandora, omap3beagle, sdp3430, omap-abe-twl6040, omap3evm, igep0020.

All boards using these machine drivers will have kernel crash at the first time we try to write a register in the codec.

Quoted 7 lines

Could you send this patch (if the patch OK with you) to be included in 3.6-rc1 to avoid boards booting to kernel crash (if they restore the mixers at boot time).

Thank you.

Mark, if this fix (and other for-3.6 patches) are to be included in 3.6-rc1, give a pull request in today or tomorrow, so that I can merge and pass to Linus in time.

thanks,

Takashi