[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54C7925E.3020303@ti.com>
Date: Tue, 27 Jan 2015 15:27:58 +0200
From: Peter Ujfalusi <peter.ujfalusi@...com>
To: Pali Rohár <pali.rohar@...il.com>,
Jarkko Nikula <jarkko.nikula@...mer.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>
CC: <linux-omap@...r.kernel.org>, <alsa-devel@...a-project.org>,
<linux-kernel@...r.kernel.org>, Pavel Machek <pavel@....cz>,
Sebastian Reichel <sre@...ian.org>,
Ivaylo Dimitrov <ivo.g.dimitrov.75@...il.com>,
Aaro Koskinen <aaro.koskinen@....fi>
Subject: Re: [PATCH] ASoC: rx51: do not fail if could not get jack detection
gpio
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?
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.
> Signed-off-by: Pali Rohár <pali.rohar@...il.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");
>
--
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists