All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: alsa-devel@alsa-project.org,
	Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	Takashi Iwai <tiwai@suse.de>,
	linux-kernel@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Pavel Machek <pavel@ucw.cz>,
	Sebastian Reichel <sre@debian.org>,
	linux-omap@vger.kernel.org,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [PATCH] ASoC: rx51: do not fail if could not get jack detection gpio
Date: Tue, 27 Jan 2015 15:11:08 +0100	[thread overview]
Message-ID: <201501271511.08933@pali> (raw)
In-Reply-To: <54C79597.40105@ti.com>


[-- Attachment #1.1: Type: Text/Plain, Size: 5916 bytes --]

On Tuesday 27 January 2015 14:41:43 Peter Ujfalusi wrote:
> On 01/27/2015 03:32 PM, Pavel Machek wrote:
> > On Tue 2015-01-27 15:27:58, Peter Ujfalusi wrote:
> >> Hi,
> >> 
> >> On 01/26/2015 10:51 PM, Pali Rohár wrote:
> >>> qemu does not emulate it
> >> 
> >> Not sure about this... How does qemu emulate tlv320aic3106,
> >> tpa6130a2a, McBSP, sDMA for audio to work? What about the
> >> other three GPIOs in this machine driver?
> >> 

No idea, but with my patch rx51-audio loads without any problem.

> >> The "nokia,n900-audio" compatible mandates that the
> >> jack-detection GPIO must be provided
> >> (Documentation/devicetree/bindings/sound/nokia,rx51.txt)
> >> since it means that the driver is running on the Nokia
> >> n900 HW.
> > 
> > Fix the documentation, then :-).
> 
> You mean document a workaround for qemu, right? AFAIK the
> documentation is fine ;)
> 
> > [Actually, GPIO is provided, it just can't be requested,
> > AFAICT.]
> 
> So what about the other GPIOs in the machine driver? Why is
> this jack-detection GPIO is special for qemu?
> 

Qemu does not detect it and cause rx51-audio driver to fail.

> > It is quite important to keep qemu working, really.
> > Debugging early boot on hardware is very hard, for example.
> 
> I understand, but looking at the history of the driver, if it
> fails now with the jack-detection GPIO, it should have been
> failing in the past as well. What triggered this sudden qemu
> does not like jack-detection GPIO? Before the
> devm_gpiod_get() conversion the driver should have failed in
> snd_soc_jack_add_gpios() phase.
> 

With 3.12 kernel rx51-audio driver loads without any problem. So 
there is some regression. Here is dmesg log from 3.12 kernel:

[    1.123779] rx51-audio rx51-audio:  tlv320aic3x-hifi <-> omap-
mcbsp.2 mapping ok
[    1.130737] tlv320aic3x-codec 2-0019: ASoC: mux b Right Line1L 
Mux has no paths
[    1.131347] tlv320aic3x-codec 2-0019: ASoC: mux b Left Line1R 
Mux has no paths
[    1.133697] tlv320aic3x-codec 2-0018: ASoC: mux Right Line1L 
Mux has no paths
[    1.134307] tlv320aic3x-codec 2-0018: ASoC: mux Left Line1R 
Mux has no paths
[    1.137451] input: RX-51 AV Jack as /devices/platform/rx51-
audio/sound/card0/input2

I will try to investigate where is problem...

> > And yes, some day we may need different dts for n900-qemu
> > (vs. n900-hw), but lets not do it just yet.
> > 
> > 							Pavel
> >>> 
> >>> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> >>> ---
> >>> 
> >>>  sound/soc/omap/rx51.c |   45
> >>>  +++++++++++++++++++++++++-------------------- 1 file
> >>>  changed, 25 insertions(+), 20 deletions(-)
> >>> 
> >>> diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
> >>> index 04896d6..a689021 100644
> >>> --- a/sound/soc/omap/rx51.c
> >>> +++ b/sound/soc/omap/rx51.c
> >>> @@ -310,25 +310,27 @@ static int rx51_aic34_init(struct
> >>> snd_soc_pcm_runtime *rtd)
> >>> 
> >>>  		return err;
> >>>  	
> >>>  	}
> >>> 
> >>> -	/* AV jack detection */
> >>> -	err = snd_soc_jack_new(codec, "AV Jack",
> >>> -			       SND_JACK_HEADSET | SND_JACK_VIDEOOUT,
> >>> -			       &rx51_av_jack);
> >>> -	if (err) {
> >>> -		dev_err(card->dev, "Failed to add AV Jack\n");
> >>> -		return err;
> >>> -	}
> >>> +	if (!IS_ERR(pdata->jack_detection_gpio)) {
> >>> +		/* AV jack detection */
> >>> +		err = snd_soc_jack_new(codec, "AV Jack",
> >>> +				       SND_JACK_HEADSET | 
SND_JACK_VIDEOOUT,
> >>> +				       &rx51_av_jack);
> >>> +		if (err) {
> >>> +			dev_err(card->dev, "Failed to add AV Jack\n");
> >>> +			return err;
> >>> +		}
> >>> 
> >>> -	/* prepare gpio for snd_soc_jack_add_gpios */
> >>> -	rx51_av_jack_gpios[0].gpio =
> >>> desc_to_gpio(pdata->jack_detection_gpio);
> >>> -	devm_gpiod_put(card->dev, pdata->jack_detection_gpio);
> >>> +		/* prepare gpio for snd_soc_jack_add_gpios */
> >>> +		rx51_av_jack_gpios[0].gpio =
> >>> desc_to_gpio(pdata->jack_detection_gpio);
> >>> +		devm_gpiod_put(card->dev, pdata-
>jack_detection_gpio);
> >>> 
> >>> -	err = snd_soc_jack_add_gpios(&rx51_av_jack,
> >>> -				     ARRAY_SIZE(rx51_av_jack_gpios),
> >>> -				     rx51_av_jack_gpios);
> >>> -	if (err) {
> >>> -		dev_err(card->dev, "Failed to add GPIOs\n");
> >>> -		return err;
> >>> +		err = snd_soc_jack_add_gpios(&rx51_av_jack,
> >>> +					     ARRAY_SIZE(rx51_av_jack_gpios),
> >>> +					     rx51_av_jack_gpios);
> >>> +		if (err) {
> >>> +			dev_err(card->dev, "Failed to add GPIOs\n");
> >>> +			return err;
> >>> +		}
> >>> 
> >>>  	}
> >>>  	
> >>>  	return err;
> >>> 
> >>> @@ -336,8 +338,11 @@ static int rx51_aic34_init(struct
> >>> snd_soc_pcm_runtime *rtd)
> >>> 
> >>>  static int rx51_card_remove(struct snd_soc_card *card)
> >>>  {
> >>> 
> >>> -	snd_soc_jack_free_gpios(&rx51_av_jack,
> >>> ARRAY_SIZE(rx51_av_jack_gpios), -				
rx51_av_jack_gpios);
> >>> +	struct rx51_audio_pdata *pdata =
> >>> snd_soc_card_get_drvdata(card); +
> >>> +	if (!IS_ERR(pdata->jack_detection_gpio))
> >>> +		snd_soc_jack_free_gpios(&rx51_av_jack,
> >>> ARRAY_SIZE(rx51_av_jack_gpios),
> >>> +					rx51_av_jack_gpios);
> >>> 
> >>>  	return 0;
> >>>  
> >>>  }
> >>> 
> >>> @@ -470,8 +475,8 @@ static int rx51_soc_probe(struct
> >>> platform_device *pdev)
> >>> 
> >>>  	pdata->jack_detection_gpio = devm_gpiod_get(card->dev,
> >>>  	
> >>>  						    "jack-detection");
> >>>  	
> >>>  	if (IS_ERR(pdata->jack_detection_gpio)) {
> >>> 
> >>> +		/* Do not fail, qemu does not emulate jack 
detection
> >>> gpio */
> >>> 
> >>>  		dev_err(card->dev, "could not get jack detection
> >>>  		gpio\n");
> >>> 
> >>> -		return PTR_ERR(pdata->jack_detection_gpio);
> >>> 
> >>>  	}
> >>>  	
> >>>  	pdata->eci_sw_gpio = devm_gpiod_get(card->dev,
> >>>  	"eci-switch");

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



WARNING: multiple messages have this Message-ID (diff)
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Pavel Machek <pavel@ucw.cz>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.de>,
	linux-omap@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, Sebastian Reichel <sre@debian.org>,
	Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>
Subject: Re: [PATCH] ASoC: rx51: do not fail if could not get jack detection gpio
Date: Tue, 27 Jan 2015 15:11:08 +0100	[thread overview]
Message-ID: <201501271511.08933@pali> (raw)
In-Reply-To: <54C79597.40105@ti.com>

[-- Attachment #1: Type: Text/Plain, Size: 5916 bytes --]

On Tuesday 27 January 2015 14:41:43 Peter Ujfalusi wrote:
> On 01/27/2015 03:32 PM, Pavel Machek wrote:
> > On Tue 2015-01-27 15:27:58, Peter Ujfalusi wrote:
> >> Hi,
> >> 
> >> On 01/26/2015 10:51 PM, Pali Rohár wrote:
> >>> qemu does not emulate it
> >> 
> >> Not sure about this... How does qemu emulate tlv320aic3106,
> >> tpa6130a2a, McBSP, sDMA for audio to work? What about the
> >> other three GPIOs in this machine driver?
> >> 

No idea, but with my patch rx51-audio loads without any problem.

> >> The "nokia,n900-audio" compatible mandates that the
> >> jack-detection GPIO must be provided
> >> (Documentation/devicetree/bindings/sound/nokia,rx51.txt)
> >> since it means that the driver is running on the Nokia
> >> n900 HW.
> > 
> > Fix the documentation, then :-).
> 
> You mean document a workaround for qemu, right? AFAIK the
> documentation is fine ;)
> 
> > [Actually, GPIO is provided, it just can't be requested,
> > AFAICT.]
> 
> So what about the other GPIOs in the machine driver? Why is
> this jack-detection GPIO is special for qemu?
> 

Qemu does not detect it and cause rx51-audio driver to fail.

> > It is quite important to keep qemu working, really.
> > Debugging early boot on hardware is very hard, for example.
> 
> I understand, but looking at the history of the driver, if it
> fails now with the jack-detection GPIO, it should have been
> failing in the past as well. What triggered this sudden qemu
> does not like jack-detection GPIO? Before the
> devm_gpiod_get() conversion the driver should have failed in
> snd_soc_jack_add_gpios() phase.
> 

With 3.12 kernel rx51-audio driver loads without any problem. So 
there is some regression. Here is dmesg log from 3.12 kernel:

[    1.123779] rx51-audio rx51-audio:  tlv320aic3x-hifi <-> omap-
mcbsp.2 mapping ok
[    1.130737] tlv320aic3x-codec 2-0019: ASoC: mux b Right Line1L 
Mux has no paths
[    1.131347] tlv320aic3x-codec 2-0019: ASoC: mux b Left Line1R 
Mux has no paths
[    1.133697] tlv320aic3x-codec 2-0018: ASoC: mux Right Line1L 
Mux has no paths
[    1.134307] tlv320aic3x-codec 2-0018: ASoC: mux Left Line1R 
Mux has no paths
[    1.137451] input: RX-51 AV Jack as /devices/platform/rx51-
audio/sound/card0/input2

I will try to investigate where is problem...

> > And yes, some day we may need different dts for n900-qemu
> > (vs. n900-hw), but lets not do it just yet.
> > 
> > 							Pavel
> >>> 
> >>> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> >>> ---
> >>> 
> >>>  sound/soc/omap/rx51.c |   45
> >>>  +++++++++++++++++++++++++-------------------- 1 file
> >>>  changed, 25 insertions(+), 20 deletions(-)
> >>> 
> >>> diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
> >>> index 04896d6..a689021 100644
> >>> --- a/sound/soc/omap/rx51.c
> >>> +++ b/sound/soc/omap/rx51.c
> >>> @@ -310,25 +310,27 @@ static int rx51_aic34_init(struct
> >>> snd_soc_pcm_runtime *rtd)
> >>> 
> >>>  		return err;
> >>>  	
> >>>  	}
> >>> 
> >>> -	/* AV jack detection */
> >>> -	err = snd_soc_jack_new(codec, "AV Jack",
> >>> -			       SND_JACK_HEADSET | SND_JACK_VIDEOOUT,
> >>> -			       &rx51_av_jack);
> >>> -	if (err) {
> >>> -		dev_err(card->dev, "Failed to add AV Jack\n");
> >>> -		return err;
> >>> -	}
> >>> +	if (!IS_ERR(pdata->jack_detection_gpio)) {
> >>> +		/* AV jack detection */
> >>> +		err = snd_soc_jack_new(codec, "AV Jack",
> >>> +				       SND_JACK_HEADSET | 
SND_JACK_VIDEOOUT,
> >>> +				       &rx51_av_jack);
> >>> +		if (err) {
> >>> +			dev_err(card->dev, "Failed to add AV Jack\n");
> >>> +			return err;
> >>> +		}
> >>> 
> >>> -	/* prepare gpio for snd_soc_jack_add_gpios */
> >>> -	rx51_av_jack_gpios[0].gpio =
> >>> desc_to_gpio(pdata->jack_detection_gpio);
> >>> -	devm_gpiod_put(card->dev, pdata->jack_detection_gpio);
> >>> +		/* prepare gpio for snd_soc_jack_add_gpios */
> >>> +		rx51_av_jack_gpios[0].gpio =
> >>> desc_to_gpio(pdata->jack_detection_gpio);
> >>> +		devm_gpiod_put(card->dev, pdata-
>jack_detection_gpio);
> >>> 
> >>> -	err = snd_soc_jack_add_gpios(&rx51_av_jack,
> >>> -				     ARRAY_SIZE(rx51_av_jack_gpios),
> >>> -				     rx51_av_jack_gpios);
> >>> -	if (err) {
> >>> -		dev_err(card->dev, "Failed to add GPIOs\n");
> >>> -		return err;
> >>> +		err = snd_soc_jack_add_gpios(&rx51_av_jack,
> >>> +					     ARRAY_SIZE(rx51_av_jack_gpios),
> >>> +					     rx51_av_jack_gpios);
> >>> +		if (err) {
> >>> +			dev_err(card->dev, "Failed to add GPIOs\n");
> >>> +			return err;
> >>> +		}
> >>> 
> >>>  	}
> >>>  	
> >>>  	return err;
> >>> 
> >>> @@ -336,8 +338,11 @@ static int rx51_aic34_init(struct
> >>> snd_soc_pcm_runtime *rtd)
> >>> 
> >>>  static int rx51_card_remove(struct snd_soc_card *card)
> >>>  {
> >>> 
> >>> -	snd_soc_jack_free_gpios(&rx51_av_jack,
> >>> ARRAY_SIZE(rx51_av_jack_gpios), -				
rx51_av_jack_gpios);
> >>> +	struct rx51_audio_pdata *pdata =
> >>> snd_soc_card_get_drvdata(card); +
> >>> +	if (!IS_ERR(pdata->jack_detection_gpio))
> >>> +		snd_soc_jack_free_gpios(&rx51_av_jack,
> >>> ARRAY_SIZE(rx51_av_jack_gpios),
> >>> +					rx51_av_jack_gpios);
> >>> 
> >>>  	return 0;
> >>>  
> >>>  }
> >>> 
> >>> @@ -470,8 +475,8 @@ static int rx51_soc_probe(struct
> >>> platform_device *pdev)
> >>> 
> >>>  	pdata->jack_detection_gpio = devm_gpiod_get(card->dev,
> >>>  	
> >>>  						    "jack-detection");
> >>>  	
> >>>  	if (IS_ERR(pdata->jack_detection_gpio)) {
> >>> 
> >>> +		/* Do not fail, qemu does not emulate jack 
detection
> >>> gpio */
> >>> 
> >>>  		dev_err(card->dev, "could not get jack detection
> >>>  		gpio\n");
> >>> 
> >>> -		return PTR_ERR(pdata->jack_detection_gpio);
> >>> 
> >>>  	}
> >>>  	
> >>>  	pdata->eci_sw_gpio = devm_gpiod_get(card->dev,
> >>>  	"eci-switch");

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2015-01-27 14:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 20:51 [PATCH] ASoC: rx51: do not fail if could not get jack detection gpio Pali Rohár
2015-01-26 20:51 ` Pali Rohár
2015-01-27 13:27 ` Peter Ujfalusi
2015-01-27 13:27   ` Peter Ujfalusi
2015-01-27 13:32   ` Pavel Machek
2015-01-27 13:32     ` Pavel Machek
2015-01-27 13:41     ` Peter Ujfalusi
2015-01-27 14:11       ` Pali Rohár [this message]
2015-01-27 14:11         ` Pali Rohár
2015-01-28 14:09         ` Pali Rohár
2015-01-28 14:09           ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201501271511.08933@pali \
    --to=pali.rohar@gmail.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=jarkko.nikula@bitmer.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=peter.ujfalusi@ti.com \
    --cc=sre@debian.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.