diff mbox series

[SRU,Bionic/OEM-B,2/6] UBUNTU: SAUCE: ASoC: Intel: Kbl: (no-up) Add ACPI GPIO mapping for lineout-mute

Message ID 20181212092600.4505-3-hui.wang@canonical.com
State New
Headers show
Series Add support for ALC3277 codec on new Dell edge gateways | expand

Commit Message

Hui Wang Dec. 12, 2018, 9:25 a.m. UTC
From: Shrirang Bagul <shrirang.bagul@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1807334

Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/soc/intel/boards/kbl_rt5660.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/kbl_rt5660.c b/sound/soc/intel/boards/kbl_rt5660.c
index 6f92dd9e522d..b0c6383d77ba 100644
--- a/sound/soc/intel/boards/kbl_rt5660.c
+++ b/sound/soc/intel/boards/kbl_rt5660.c
@@ -106,26 +106,31 @@  static const struct snd_soc_dapm_route kabylake_5660_map[] = {
 	{ "iDisp1 Tx", NULL, "iDisp1_out"},
 };
 
+static const struct acpi_gpio_params lineout_mute_gpio = { 0, 0, true };
+
+static const struct acpi_gpio_mapping acpi_rt5660_gpios[] = {
+	{ "lineout-mute-gpios", &lineout_mute_gpio , 1 },
+	{ NULL },
+};
+
 static int kabylake_rt5660_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
 	int ret;
 	struct kbl_rt5660_private *ctx = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_codec *codec = rtd->codec;
 
+	ret = devm_acpi_dev_add_driver_gpios(codec->dev, acpi_rt5660_gpios);
+	if (ret)
+		dev_warn(codec->dev, "Failed to add driver gpios\n");
+
 	/* Request rt5660 GPIO for lineout mute control */
-	ctx->gpio_lo_mute = devm_gpiod_get_index(codec->dev,
-			"lineout-mute", 0, 0);
+	ctx->gpio_lo_mute = devm_gpiod_get(codec->dev, "lineout-mute",
+			GPIOD_OUT_HIGH);
 	if (IS_ERR(ctx->gpio_lo_mute)) {
 		dev_err(rtd->card->dev, "Can't find GPIO_MUTE# gpio\n");
 		return PTR_ERR(ctx->gpio_lo_mute);
 	}
 
-	ret = gpiod_direction_output(ctx->gpio_lo_mute, 1);
-	if (ret) {
-		dev_err(rtd->dev, "failed to set lineout-mute gpio %d\n", ret);
-		return ret;
-	}
-
 	return ret;
 }