GPIO issue with RT5670
Subsystems (4)
the commit f10e4bf6632b5be11cea875b66ba959833a69258
gpio: acpi: Even more tighten up ACPI GPIO lookups
now generates the following issue
[ 9.694204] rt5670 i2c-10EC5672:00: ASoC: Cannot get gpio at index 0: -2 [ 9.694293] rt5670 i2c-10EC5672:00: Adding jack GPIO failed
This is the 3rd occurrence of an audio issue with this commit [1][2], what is the recommended fix here since this codec is not only used in ACPI-based devices and do we need to check for more issues in audio drivers?
Thanks
-Pierre
Quoted 6 lines · Pierre-Louis Bossart
the commit
f10e4bf6632b5be11cea875b66ba959833a69258
gpio: acpi: Even more tighten up ACPI GPIO lookupsnow generates the following issue
Quoted 7 lines
[ 9.694204] rt5670 i2c-10EC5672:00: ASoC: Cannot get gpio at index 0: -2 [ 9.694293] rt5670 i2c-10EC5672:00: Adding jack GPIO failedThis is the 3rd occurrence of an audio issue with this commit [1][2], what is the recommended fix here since this codec is not only used in ACPI-based devices and do we need to check for more issues in audio drivers?
Likely you need to give the proper mapping in the machine driver, and correct the hp_gpio.name to the corresponding one.
It's cht_bsw_rt5672? If so, the required change would be something like below.
Takashi
---
sound/soc/codecs/rt5670.c +1 -1
@@ -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 ;
sound/soc/intel/boards/cht_bsw_rt5672.c +10 -0
@@ -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 ) {
Pierre-Louis Bossart
Tested-byQuoted 14 lines · Takashi Iwai
Quoted 5 lines · Pierre-Louis Bossart
the commit
f10e4bf6632b5be11cea875b66ba959833a69258
gpio: acpi: Even more tighten up ACPI GPIO lookupsnow generates the following issue
Quoted 7 lines
[ 9.694204] rt5670 i2c-10EC5672:00: ASoC: Cannot get gpio at index 0: -2 [ 9.694293] rt5670 i2c-10EC5672:00: Adding jack GPIO failedThis is the 3rd occurrence of an audio issue with this commit [1][2], what is the recommended fix here since this codec is not only used in ACPI-based devices and do we need to check for more issues in audio drivers?
Quoted 5 lines
Likely you need to give the proper mapping in the machine driver, and correct the hp_gpio.name to the corresponding one.
It's
cht_bsw_rt5672? If so, the required change would be something like below.
yep, this works, thanks Takashi. With an additional DMI fix i'll submit later I get sound on the Dell 5585.
Quoted 50 lines
Takashi
---
sound/soc/codecs/rt5670.c +1
-1@@ -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 ;sound/soc/intel/boards/cht_bsw_rt5672.c +10
-0@@ -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 ) {_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerApplied "ASoC: rt5670: Fix GPIO headset detection regression" to the asoc tree
In reply to Takashi IwaiThe patch
ASoC: rt5670: Fix GPIO headset detection regression
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
804e73adf5cf4b3aea3b6ce058f4dc0191143821Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Tue, 22 Aug 2017 07:44:52 +0200
Subject: [PATCH] ASoC: rt5670: Fix GPIO headset detection regression
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.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=115531
--- sound/soc/codecs/rt5670.c | 2 +- sound/soc/intel/boards/cht_bsw_rt5672.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5670.c +1 -1
@@ -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 ;
sound/soc/intel/boards/cht_bsw_rt5672.c +10 -0
@@ -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 ) {
Signature · 1 line
2.13.2