From patchwork Fri Feb 9 14:23:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlo Caione X-Patchwork-Id: 10209317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD01F60236 for ; Fri, 9 Feb 2018 14:23:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA01F29871 for ; Fri, 9 Feb 2018 14:23:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAA9A29882; Fri, 9 Feb 2018 14:23:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62E8F29871 for ; Fri, 9 Feb 2018 14:23:29 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 258CA2677F8; Fri, 9 Feb 2018 15:23:28 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E0CCF2677F9; Fri, 9 Feb 2018 15:23:26 +0100 (CET) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by alsa0.perex.cz (Postfix) with ESMTP id 6317E266E55 for ; Fri, 9 Feb 2018 15:23:24 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id h9so8416300wre.12 for ; Fri, 09 Feb 2018 06:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=tET1fvQ7gyh+xxe981G2QhUZhOaVWYYiYQSe0tbbOBU=; b=TSRFvI5VEUeLsMjfwN8abnraIG7ytjZPXbPU6BlbS39xs2Zw+Oa9IPiWYiKH3mTlOk eSiHAsB5UlMYc+EbI4q46PGCcKS5V/PbHkP1bb5KFPcEFc6oCGtcbCt/H9IQoU9FWJWL d6QHrP2xBQsYQNS9I5Bp1C8LUZfPH9x5+Bga9mfL0woOnYiqv3sN4vsWcbvMh4yyzx67 s38B+goVjs+zW93iK7Jx+zSQJHEtRY2XETHcTE5V2OLw7oBlzAyV43DbrsqtbqtxvGYV S5Edu+z+oxjIceNmAj8MCHZxdXbKOkjrWLiKcXga58Slt/q57Z9iqtIEJYvWsC1AbBvO T//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=tET1fvQ7gyh+xxe981G2QhUZhOaVWYYiYQSe0tbbOBU=; b=oJVn7X6EyHvarA2Z6yYs0Q47eB3KiCkeJy5jsnaGsDJZEmb6yYAOb31nQWbovPR5Sz /X+PNEFsm3qkx7Tsq7zCOCN9CEII5cZag5q2JtzNMCAyEBElMaFs668uVxxnBJMc/XtQ UAHh7F1cID4r4WtID80GIg3QkuNrFEMkvPH+1bmjs066aZLLc6fZE02VWj0yRQyI01sK v2IS+menAaa5DkPpgD/zGf24kW0K8oy1TtSytMKQwg6qvXpbxT1eZmw59EVfWWohtGzp 6YYDPL2UpmHrjYy3eQOcPZHM5W8u+NXeQ+56CyZ4/+N8EXMbMXMLFvw1ZIVca5+zihCL N/OQ== X-Gm-Message-State: APf1xPB9bau6vLLdhA5Rm68CLo/3Ib2ViScrY5FPxSETQSA7X2cGlcni NO06WU1R+ucmSzXx8x36yJtK1Uaz X-Google-Smtp-Source: AH8x227d+N72ZXIqthEFpbTnFo6sSdhvM/bArcubLceYV7e0CcZoKMkSEsGwYnAontUIfDugOlkX5A== X-Received: by 10.223.133.7 with SMTP id 7mr2804626wrh.96.1518186203850; Fri, 09 Feb 2018 06:23:23 -0800 (PST) Received: from satan.home ([2a00:23c4:f78b:2a00:9520:864c:b8f0:f03d]) by smtp.gmail.com with ESMTPSA id f19sm2301794wmf.23.2018.02.09.06.23.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 06:23:22 -0800 (PST) From: Carlo Caione To: linux@endlessm.com, bardliao@realtek.com, oder_chiou@realtek.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com Date: Fri, 9 Feb 2018 14:23:18 +0000 Message-Id: <20180209142318.14451-1-carlo@caione.org> X-Mailer: git-send-email 2.14.1 Cc: Carlo Caione Subject: [alsa-devel] [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Carlo Caione On at least one notebook (ECS EF20EA) the 'hp-detect' GPIO is defined in the DSDT table by the ACPI GpioIo resources in _CRS. Add this mapping to the rt5645 driver to enable the jack detection also on non-DT platforms. Method (_CRS, 0, NotSerialized) { Name (SBUF, ResourceTemplate () { I2cSerialBusV2 (0x001A, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C2", 0x00, ResourceConsumer, , Exclusive, ) GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 0x0000, "\\_SB.GPO3", 0x00, ResourceConsumer, , ) { // Pin list 0x004F } GpioIo (Shared, PullDefault, 0x0000, 0x0000, IoRestrictionInputOnly, "\\_SB.GPO3", 0x00, ResourceConsumer, , ) { // Pin list 0x004F } }) Return (SBUF) /* \_SB_.PCI0.I2C2.RTK2._CRS.SBUF */ } Reviewed-by: Andy Shevchenko Signed-off-by: Carlo Caione --- Changelog: v2: - s/ACPI_HANDLE/has_acpi_companion/ --- sound/soc/codecs/rt5645.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 8f140c8b93ac..8e3d1e4ddb63 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3764,6 +3764,13 @@ static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev) return 0; } +static const struct acpi_gpio_params hp_detect_gpios = { 1, 0, false }; + +static const struct acpi_gpio_mapping cht_rt5645_gpios[] = { + { "hp-detect-gpios", &hp_detect_gpios, 1 }, + {}, +}; + static int rt5645_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -3779,6 +3786,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, if (rt5645 == NULL) return -ENOMEM; + if (has_acpi_companion(&i2c->dev)) + if (devm_acpi_dev_add_driver_gpios(&i2c->dev, cht_rt5645_gpios)) + dev_dbg(&i2c->dev, "Failed to add driver gpios\n"); + rt5645->i2c = i2c; i2c_set_clientdata(i2c, rt5645);