aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-08-22 01:44:52 -0400
committerMark Brown <broonie@kernel.org>2017-08-22 08:48:34 -0400
commit804e73adf5cf4b3aea3b6ce058f4dc0191143821 (patch)
treeef7cb29925849f16e51393da300b5d99f6ce4d5e
parent5771a8c08880cdca3bfb4a3fc6d309d6bba20877 (diff)
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. Fixes: f10e4bf6632b ("gpio: acpi: Even more tighten up ACPI GPIO lookups") Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=115531 Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/rt5670.c2
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5672.c10
2 files changed, 11 insertions, 1 deletions
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,
567 567
568 rt5670->jack = jack; 568 rt5670->jack = jack;
569 rt5670->hp_gpio.gpiod_dev = codec->dev; 569 rt5670->hp_gpio.gpiod_dev = codec->dev;
570 rt5670->hp_gpio.name = "headphone detect"; 570 rt5670->hp_gpio.name = "headset";
571 rt5670->hp_gpio.report = SND_JACK_HEADSET | 571 rt5670->hp_gpio.report = SND_JACK_HEADSET |
572 SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2; 572 SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2;
573 rt5670->hp_gpio.debounce_time = 150; 573 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,
184 return 0; 184 return 0;
185} 185}
186 186
187static const struct acpi_gpio_params headset_gpios = { 0, 0, false };
188
189static const struct acpi_gpio_mapping cht_rt5672_gpios[] = {
190 { "headset-gpios", &headset_gpios, 1 },
191 {},
192};
193
187static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) 194static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
188{ 195{
189 int ret; 196 int ret;
@@ -191,6 +198,9 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
191 struct snd_soc_codec *codec = codec_dai->codec; 198 struct snd_soc_codec *codec = codec_dai->codec;
192 struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); 199 struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
193 200
201 if (devm_acpi_dev_add_driver_gpios(codec->dev, cht_rt5672_gpios))
202 dev_warn(runtime->dev, "Unable to add GPIO mapping table\n");
203
194 /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */ 204 /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
195 ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24); 205 ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24);
196 if (ret < 0) { 206 if (ret < 0) {