diff mbox

ASoC: simple-card: Initialize headphone and mic GPIO numbers

Message ID 1412687366-6400-1-git-send-email-geert+renesas@glider.be (mailing list archive)
State Accepted
Commit 2dbab9784db1c0de517922d81394d9ff4a33c544
Headers show

Commit Message

Geert Uytterhoeven Oct. 7, 2014, 1:09 p.m. UTC
The uninitialized default of 0 for gpio_hp_det and gpio_mic_det doesn't
play well with asm-generic's gpio_is_valid():

	static inline bool gpio_is_valid(int number)
	{
		return number >= 0 && number < ARCH_NR_GPIOS;
	}

Hence on r8a7740/armadillo-legacy:

	sh-mobile-hdmi sh-mobile-hdmi: SH Mobile HDMI Audio Codec
	sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Headphones
	sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Mic Jack

After that the kernel log is spammed ca. 7 times per second with:

	sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Headphones

Initialize the GPIO numbers with a negative number (-ENOENT) to fix this.

Fixes: 3fe240326cc395c6 ("ASoC: simple-card: Add mic and hp detect gpios.")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is against sound-asoc/for-next

 sound/soc/generic/simple-card.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Mark Brown Oct. 7, 2014, 5:24 p.m. UTC | #1
On Tue, Oct 07, 2014 at 03:09:26PM +0200, Geert Uytterhoeven wrote:
> The uninitialized default of 0 for gpio_hp_det and gpio_mic_det doesn't
> play well with asm-generic's gpio_is_valid():

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index fcb431fe20b4ae7b..d1b7293c133eaa45 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -501,6 +501,9 @@  static int asoc_simple_card_probe(struct platform_device *pdev)
 	priv->snd_card.dai_link = dai_link;
 	priv->snd_card.num_links = num_links;
 
+	priv->gpio_hp_det = -ENOENT;
+	priv->gpio_mic_det = -ENOENT;
+
 	/* Get room for the other properties */
 	priv->dai_props = devm_kzalloc(dev,
 			sizeof(*priv->dai_props) * num_links,