All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>, Mark Brown <broonie@kernel.org>
Cc: Oder Chiou <oder_chiou@realtek.com>,
	Bard Liao <bardliao@realtek.com>,
	alsa-devel@alsa-project.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: Re: [PATCH] ASoC: rt5670: Fix GPIO headset detection regression
Date: Tue, 22 Aug 2017 11:33:22 +0300	[thread overview]
Message-ID: <1503390802.25945.36.camel@linux.intel.com> (raw)
In-Reply-To: <20170822054452.25380-1-tiwai@suse.de>

On Tue, 2017-08-22 at 07:44 +0200, Takashi Iwai wrote:
> RT5670 codec driver and its machine driver for Intel CHT assume the
> implicit GPIO mapping on the index 0 while BIOS on most devices don't
> provide it.  The recent commit f10e4bf6632b ("gpio: acpi: Even more
> tighten up ACPI GPIO lookups") restricts such cases and it resulted in
> a regression where the headset jack setup fails like:
> 
>   rt5670 i2c-10EC5672:00: ASoC: Cannot get gpio at index 0: -2
>   rt5670 i2c-10EC5672:00: Adding jack GPIO failed
> 
> For fixing this, we need to provide the GPIO mapping explicitly in the
> machine driver.  Also this patch corrects the string to be passed to
> gpiolib to match with the pre-given mapping, too.
> 

> Fixes: f10e4bf6632b ("gpio: acpi: Even more tighten up ACPI GPIO
> lookups")

I don't think it fixes that exact commit. with this mapping the driver
will work pretty much well for previous versions of kernel (that do not
have mentioned commit).

So, for my opinion it should have referred to the initial commit of that
board file which brings GPIO request in the first place.

After addressing that,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=115531
> Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.co
> m>
> Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  sound/soc/codecs/rt5670.c               |  2 +-
>  sound/soc/intel/boards/cht_bsw_rt5672.c | 10 ++++++++++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
> index 0ec7985ed306..054b613cb0d0 100644
> --- a/sound/soc/codecs/rt5670.c
> +++ b/sound/soc/codecs/rt5670.c
> @@ -567,7 +567,7 @@ int rt5670_set_jack_detect(struct snd_soc_codec
> *codec,
>  
>  	rt5670->jack = jack;
>  	rt5670->hp_gpio.gpiod_dev = codec->dev;
> -	rt5670->hp_gpio.name = "headphone detect";
> +	rt5670->hp_gpio.name = "headset";
>  	rt5670->hp_gpio.report = SND_JACK_HEADSET |
>  		SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2;
>  	rt5670->hp_gpio.debounce_time = 150;
> diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c
> b/sound/soc/intel/boards/cht_bsw_rt5672.c
> index bc2a52de06a3..f597d5582223 100644
> --- a/sound/soc/intel/boards/cht_bsw_rt5672.c
> +++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
> @@ -184,6 +184,13 @@ static int cht_aif1_hw_params(struct
> snd_pcm_substream *substream,
>  	return 0;
>  }
>  
> +static const struct acpi_gpio_params headset_gpios = { 0, 0, false };
> +
> +static const struct acpi_gpio_mapping cht_rt5672_gpios[] = {
> +	{ "headset-gpios", &headset_gpios, 1 },
> +	{},
> +};
> +
>  static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
>  {
>  	int ret;
> @@ -191,6 +198,9 @@ static int cht_codec_init(struct
> snd_soc_pcm_runtime *runtime)
>  	struct snd_soc_codec *codec = codec_dai->codec;
>  	struct cht_mc_private *ctx =
> snd_soc_card_get_drvdata(runtime->card);
>  
> +	if (devm_acpi_dev_add_driver_gpios(codec->dev,
> cht_rt5672_gpios))
> +		dev_warn(runtime->dev, "Unable to add GPIO mapping
> table\n");
> +
>  	/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots
> */
>  	ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24);
>  	if (ret < 0) {

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2017-08-22  8:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22  5:44 [PATCH] ASoC: rt5670: Fix GPIO headset detection regression Takashi Iwai
2017-08-22  8:33 ` Andy Shevchenko [this message]
2017-08-22  8:48   ` Takashi Iwai
2017-08-22  9:22     ` Andy Shevchenko

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=1503390802.25945.36.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bardliao@realtek.com \
    --cc=broonie@kernel.org \
    --cc=oder_chiou@realtek.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --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.