From patchwork Wed Dec 12 09:25:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1011706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43FBJX5b7Bz9sN8; Wed, 12 Dec 2018 20:26:20 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gX0mV-0000KA-J8; Wed, 12 Dec 2018 09:26:15 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gX0mT-0000Hv-EO for kernel-team@lists.ubuntu.com; Wed, 12 Dec 2018 09:26:13 +0000 Received: from [125.35.49.90] (helo=hwang4-Lenovo-V480c.bluefin) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gX0mS-0002iI-Gn for kernel-team@lists.ubuntu.com; Wed, 12 Dec 2018 09:26:13 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][Bionic/OEM-B][PATCH 3/6] UBUNTU: SAUCE: ASoC: rt5660: (no-up) Move platform code to board file Date: Wed, 12 Dec 2018 17:25:56 +0800 Message-Id: <20181212092600.4505-4-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181212092600.4505-1-hui.wang@canonical.com> References: <20181212092600.4505-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Shrirang Bagul BugLink: https://bugs.launchpad.net/bugs/1807334 ACPI GPIO table is defined on platform basis. Remove their definitions from the Codec driver and include them in the machine driver instead (where it belongs). Signed-off-by: Shrirang Bagul Signed-off-by: Hui Wang --- sound/soc/codecs/rt5660.c | 25 ------------------------- sound/soc/intel/boards/bytcr_rt5660.c | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/sound/soc/codecs/rt5660.c b/sound/soc/codecs/rt5660.c index 39dc2289d651..30d32a7678a2 100644 --- a/sound/soc/codecs/rt5660.c +++ b/sound/soc/codecs/rt5660.c @@ -9,7 +9,6 @@ * published by the Free Software Foundation. */ -#include #include #include #include @@ -1251,26 +1250,6 @@ static const struct acpi_device_id rt5660_acpi_match[] = { }; MODULE_DEVICE_TABLE(acpi, rt5660_acpi_match); -static const struct acpi_gpio_params audio_wake_intr_gpio = { 0, 0, false }; -static const struct acpi_gpio_params lineout_mute_gpio = { 1, 0, true }; - -static const struct acpi_gpio_mapping byt_rt5660_gpios[] = { - { "audio-wake-intr-gpios", &audio_wake_intr_gpio, 1 }, - { "lineout-mute-gpios", &lineout_mute_gpio , 1 }, - { NULL }, -}; - -static void rt5660_read_acpi_properties(struct rt5660_priv *rt5660, - struct device *dev) -{ - int ret; - - ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), - byt_rt5660_gpios); - if (ret) - dev_warn(dev, "Failed to add driver gpios\n"); -} - static int rt5660_parse_dt(struct rt5660_priv *rt5660, struct device *dev) { rt5660->pdata.in1_diff = device_property_read_bool(dev, @@ -1310,10 +1289,6 @@ static int rt5660_i2c_probe(struct i2c_client *i2c, rt5660->pdata = *pdata; else if (i2c->dev.of_node) rt5660_parse_dt(rt5660, &i2c->dev); - else if (ACPI_HANDLE(&i2c->dev)) - rt5660_read_acpi_properties(rt5660, &i2c->dev); - else - return -EINVAL; rt5660->regmap = devm_regmap_init_i2c(i2c, &rt5660_regmap); if (IS_ERR(rt5660->regmap)) { diff --git a/sound/soc/intel/boards/bytcr_rt5660.c b/sound/soc/intel/boards/bytcr_rt5660.c index f0e3e4125f07..30c711c86260 100644 --- a/sound/soc/intel/boards/bytcr_rt5660.c +++ b/sound/soc/intel/boards/bytcr_rt5660.c @@ -193,6 +193,15 @@ static int byt_rt5660_aif1_hw_params(struct snd_pcm_substream *substream, return 0; } +static const struct acpi_gpio_params audio_wake_intr_gpio = { 0, 0, false }; +static const struct acpi_gpio_params lineout_mute_gpio = { 1, 0, true }; + +static const struct acpi_gpio_mapping byt_rt5660_gpios[] = { + { "audio-wake-intr-gpios", &audio_wake_intr_gpio, 1 }, + { "lineout-mute-gpios", &lineout_mute_gpio , 1 }, + { NULL }, +}; + static int byt_rt5660_init(struct snd_soc_pcm_runtime *runtime) { struct snd_soc_card *card = runtime->card; @@ -200,18 +209,18 @@ static int byt_rt5660_init(struct snd_soc_pcm_runtime *runtime) struct snd_soc_codec *codec = runtime->codec; int ret; + ret = devm_acpi_dev_add_driver_gpios(codec->dev, byt_rt5660_gpios); + if (ret) + dev_warn(codec->dev, "Failed to add driver gpios\n"); + /* Request rt5660 GPIO for lineout mute control */ priv->gpio_lo_mute = devm_gpiod_get_index(codec->dev, - "lineout-mute", 0, 0); + "lineout-mute", 0, GPIOD_OUT_HIGH); if (IS_ERR(priv->gpio_lo_mute)) { dev_err(card->dev, "Can't find GPIO_MUTE# gpio\n"); return PTR_ERR(priv->gpio_lo_mute); } - ret = gpiod_direction_output(priv->gpio_lo_mute, 1); - if (ret) - return ret; - if (byt_rt5660_quirk & BYT_RT5660_MCLK_EN) { /* * The firmware might enable the clock at