From patchwork Thu Jan 7 09:06:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12003285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81FE1C433DB for ; Thu, 7 Jan 2021 09:08:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9BB623120 for ; Thu, 7 Jan 2021 09:08:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9BB623120 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=endlessos.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D067B1681; Thu, 7 Jan 2021 10:07:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D067B1681 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610010515; bh=Xb+8ZGYOsL8phfYOktmhdoM5ZtF6qa53rCXeQJjCmXg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZZrq282Le1Qe+yDaNugeFA4jOCo/zoQwcfLtYbPqlwLd3EiL2qG/651r0eTbVfRD7 ZKH4CmFRfEEQ8qoitOiwpkTX5v8N0kXFnBV6t1Yno0ni99bneM5SDpH7Gdkd4GVrLy +HBtl9b6bivfeKg+k4Rt9SdAgFT7ba5lw1WkHAWk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 38985F80276; Thu, 7 Jan 2021 10:06:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3D5B6F802C4; Thu, 7 Jan 2021 10:06:56 +0100 (CET) Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 40F78F801F5 for ; Thu, 7 Jan 2021 10:06:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 40F78F801F5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="thzLh1N9" Received: by mail-pj1-x1034.google.com with SMTP id z12so1098100pjn.1 for ; Thu, 07 Jan 2021 01:06:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/v7jmcVWhLsLyT6srKRYF+HsEWNOg2R2HWvMNn5cQRg=; b=thzLh1N9XQZBb6ehatjpl3RV1IrUsTvfalJ8qkKkCfvmuLZmIamyMWPsW55blLBoTm gAF10Du7MYQzHb49+SECwk3LYEzTegp1MV2IHUMzQ42MNqiALmnduXx2hkzgueb4l+86 hC4RRfjEGmHg8erprT66SX7aH6QzvirlZwO8nkFgaM/BK+FleonRX6MUN21Y+Bstnlq4 nmIF5YQUwrTAkqDpnnpNYGa4ZllHsNtV8P5pnIlWx07N6mPnDxnmb43vnazJGze8K4LN /Z5rMY8hog+An2FfKZmeMnC+AGfe5giwSnr/QflijlcuPkijB2ALnG8a8hgXJP450l4E 5g7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/v7jmcVWhLsLyT6srKRYF+HsEWNOg2R2HWvMNn5cQRg=; b=JGjJwu8cBIwN7nHU4k/odSPVNXklcR7aw8oPc0uPNUsmB3tIAPRCM388VtGDtKCa+6 UfOiwbvV6B7qA2GbQp4I6CtKp1ZEChBZbq/Qa6tM7SohZv1ttsKSCKqXqsQtyjUjsyNk ALBeYvZb0/vEsIIc0LUK7rOOA2Uc6qUztdIXsMejdTzEjpnk0urS0gIvZF5bepD7A8iK /NLeaCGwIuelWIvD2eYkvfdD7G9b0Aa+xo1AKvoFg09braqzUqe3fKShoNO+VD+mTpvA Oe4P+42D78sCssuxUjN96RSKpAIf1n/sGlGzhHo6xy5eCZkNoQhyVod2eLgfViPwsBT/ Y6Aw== X-Gm-Message-State: AOAM530EJZprOPcPU6qjnbT8crES1XqwHQAde5aVzHoMY61R1aX+ndWj MZw+o6CjqqzzuzRxqV0eo1spww== X-Google-Smtp-Source: ABdhPJySebxs1m5St5fhhjLE4vYi0pG/2f2WyTXIaNm/Vx7xOnk8LVyFMk5gka4dCbStVDkx5On6Hw== X-Received: by 2002:a17:90a:f40e:: with SMTP id ch14mr8326062pjb.172.1610010401941; Thu, 07 Jan 2021 01:06:41 -0800 (PST) Received: from endless.endlessm-sf.com (ec2-34-209-191-27.us-west-2.compute.amazonaws.com. [34.209.191.27]) by smtp.googlemail.com with ESMTPSA id b2sm5006394pfo.164.2021.01.07.01.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 01:06:41 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH 1/4] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO Date: Thu, 7 Jan 2021 17:06:22 +0800 Message-Id: <20210107090625.107078-2-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107090625.107078-1-chiu@endlessos.org> References: <20210107090625.107078-1-chiu@endlessos.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Chris Chiu , linux-kernel@vger.kernel.org, linux@endlessos.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On at least one laptop (ECS EF20EA) the 'hp-detect' GPIO is defined in the DSDT table by the ACPI GpioIo resources in _CRS. The GPIO related information should be mapped to the rt5645 driver to enable the jack detection also on non-DT platforms. Signed-off-by: Chris Chiu --- sound/soc/codecs/rt5645.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 420003d062c7..78f0ab0a008e 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -42,6 +42,8 @@ static unsigned int quirk = -1; module_param(quirk, uint, 0444); MODULE_PARM_DESC(quirk, "RT5645 pdata quirk override"); +static const struct acpi_gpio_mapping *cht_rt5645_gpios; + #define RT5645_DEVICE_ID 0x6308 #define RT5650_DEVICE_ID 0x6419 @@ -3780,7 +3782,6 @@ static const struct dmi_system_id dmi_platform_data[] = { }, .driver_data = (void *)&intel_braswell_platform_data, }, - { } }; static bool rt5645_check_dp(struct device *dev) @@ -3848,6 +3849,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, rt5645->pdata.dmic2_data_pin = QUIRK_DMIC2_DATA_PIN(quirk); } + if (cht_rt5645_gpios && 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->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect", GPIOD_IN); From patchwork Thu Jan 7 09:06:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12003287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4321EC433DB for ; Thu, 7 Jan 2021 09:08:42 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A5CE23120 for ; Thu, 7 Jan 2021 09:08:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A5CE23120 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=endlessos.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CAE9F167C; Thu, 7 Jan 2021 10:07:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CAE9F167C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610010519; bh=PMlTmQ3nXoOH1bJjVar6F8K6/GhjQ9sYb4lkPX4mFVI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uVoXxQ5usPiGecwxIJ2JzFK+Y58WHxGvCeP0epodnkOVPlDwGs1pfGgBaJV8XfMwz uys/y2PxY/QrMAGGn5wWgfVkqhuSgJ8Tn70pqLd0KeFxy1/j47XQWkMrCtUOMnxbJ7 LxluEgKR1D9yWn0o0YSecKAED63/7BGTy16WBeDA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3C93CF804CA; Thu, 7 Jan 2021 10:07:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 72F0EF804C3; Thu, 7 Jan 2021 10:07:00 +0100 (CET) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 021BFF80271 for ; Thu, 7 Jan 2021 10:06:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 021BFF80271 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="fDGKemIp" Received: by mail-pj1-x102d.google.com with SMTP id j13so3332236pjz.3 for ; Thu, 07 Jan 2021 01:06:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ViO6PydNgMGhzgsctVMRzuTtGGnQjswu8DFXv1qC3B8=; b=fDGKemIpa0IVex6SVvtLMLeLpbX8hwf1aTMh3SKYdzc6vf0I0zWjc36xoPzzbiEGKJ a17xHx8PgAgh+BZuBF4h/rwOeKWmeD9VBJ9CgkyAQqRfA5vVD11ddiMzVXu1BG3QfGrZ FL6etZ/dJKCXgqiBJNZOZcLa4Ha5c115UdvKOfbxJaD+Ta1i/0ZGeaJ6PR+Al2hQ78Q5 UccaW2ZY7ujhy5a3lrhvWl8pfRZInjbCrXuZAB+2nNsqsG5HezlnXuaESVqW8Nqv8NGt FOStHIjeWu+onuqBmwi3grlhCu/LG35jjKZCndyA22vdym5Yuy439ulEBRmw0wnKneX8 f7xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ViO6PydNgMGhzgsctVMRzuTtGGnQjswu8DFXv1qC3B8=; b=fryle2muTW9MHV6u0gV7wymrao5MfaVnPTm2SHse6bCAatLLRnL7Erkvl7gei/cJbo GgN466GbUoAc2dXSqDlnC7xhMUcvz3LRjE93A24fInTH2n+aQfN/y/1lM26fqCgub9W2 JfzGFPnjAgPXHB5oVB9uiLKmQXT7bAkMkh7/MS63eQe/AMRsU00zQF2XoIwKLl53Z6fv 7Z3/0szPzdiJoVhQOGNMBEv5d5Ydv7TdTlp0broDofF5ldAsS3/uvLmXGZ9WWQBIWprE wnscu2FXdlQ/Yd0IENgTjQ13Y7uUQDbLkdRfB00VAUbRQA3RfLG8RZzU5furo//pdLIy uZUQ== X-Gm-Message-State: AOAM5304Ta262+m5w8p5hcw4JMT+IM2nUBLpwRxA8ewPuPWWkrW6mOBE +0DCZr3V2/cXl5xLhgTcA2z+Iw== X-Google-Smtp-Source: ABdhPJyQ1BWvEYxS4zI9slZsnUqXT+CnmasvCM1QErDNZiba0rcM9PTPxUq5ZQnbX6d1WRr2XQmfRg== X-Received: by 2002:a17:90a:1a10:: with SMTP id 16mr8177738pjk.42.1610010404772; Thu, 07 Jan 2021 01:06:44 -0800 (PST) Received: from endless.endlessm-sf.com (ec2-34-209-191-27.us-west-2.compute.amazonaws.com. [34.209.191.27]) by smtp.googlemail.com with ESMTPSA id b2sm5006394pfo.164.2021.01.07.01.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 01:06:44 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH 2/4] ASoC: rt5645: Add ACPI-defined GPIO for ECS EF20 series Date: Thu, 7 Jan 2021 17:06:23 +0800 Message-Id: <20210107090625.107078-3-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107090625.107078-1-chiu@endlessos.org> References: <20210107090625.107078-1-chiu@endlessos.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Chris Chiu , linux-kernel@vger.kernel.org, linux@endlessos.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add the hp-detect gpio for ECS EF20 series laptops based on the _CRS defined in DSDT table. 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 */ } Signed-off-by: Chris Chiu --- sound/soc/codecs/rt5645.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 78f0ab0a008e..24a6acb3c12f 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3653,6 +3653,19 @@ static const struct rt5645_platform_data kahlee_platform_data = { .jd_mode = 3, }; +static const struct acpi_gpio_params ef20_hp_detect = { 1, 0, false }; + +static const struct acpi_gpio_mapping cht_rt5645_ef20_gpios[] = { + { "hp-detect-gpios", &ef20_hp_detect, 1 }, + { }, +}; + +static int cht_rt5645_ef20_quirk_cb(const struct dmi_system_id *id) +{ + cht_rt5645_gpios = cht_rt5645_ef20_gpios; + return 1; +} + static const struct dmi_system_id dmi_platform_data[] = { { .ident = "Chrome Buddy", @@ -3782,6 +3795,20 @@ static const struct dmi_system_id dmi_platform_data[] = { }, .driver_data = (void *)&intel_braswell_platform_data, }, + { + .ident = "EF20", + .callback = cht_rt5645_ef20_quirk_cb, + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "EF20"), + }, + }, + { + .ident = "EF20EA", + .callback = cht_rt5645_ef20_quirk_cb, + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"), + }, + }, }; static bool rt5645_check_dp(struct device *dev) From patchwork Thu Jan 7 09:06:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12003291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B53A0C433DB for ; Thu, 7 Jan 2021 09:09:32 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1DF8622CF8 for ; Thu, 7 Jan 2021 09:09:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DF8622CF8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=endlessos.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8F3A216A6; Thu, 7 Jan 2021 10:08:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8F3A216A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610010570; bh=uyOSuIEcHd3QXQsK2S7IfLp6TlUUY8lkCnDYeSWxePM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FoUA1EinF2Ttju2BKFusXPXsjc01Fd60tCYh4Tl6PobO6pjRCqXHCDGXEc9mXERKm BrZB2fhpCWGBHpZD5k1+9cBUqwE/v2BMFQLib8RoiNbxHDH3+QHzN4C/IfNeMB+01F MCdt9fcE7muVtjYmCzbHLdQ2aYBMrDJ6G65svveE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 20511F804D8; Thu, 7 Jan 2021 10:07:05 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3B60DF804C3; Thu, 7 Jan 2021 10:07:02 +0100 (CET) Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C5826F801F5 for ; Thu, 7 Jan 2021 10:06:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C5826F801F5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="tdQiJclZ" Received: by mail-pg1-x535.google.com with SMTP id v19so4384902pgj.12 for ; Thu, 07 Jan 2021 01:06:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oGDP77wj0SBSqj0K7AcIhTlzIQ1EOZW+OCgfJtSnnj0=; b=tdQiJclZl5WYttq+YANmngxav4yaUb4TOFtHKzx6l8boS5QkElEvoN9cGpRuCVh8+U be5bFqEt0u5npj6bmQdFi0utLrfuV1J2Mv+BREsB3riHS82GOO5vzzw6q/eV/WAmw09r BhJzYLGj8r7avNP/9l3zfyBM0NyTbxFwRFbAaxDff61uHYSeWCBBaR+I/Kt/DgZG0HBX Ki+lTwmBS7qDMTZWDwcS4ihuI205E6JOA8fmb1BECz7XpjtJqLLVlwYKMiQbzDiBmidZ uhROoAkw59GghHKroEDzu2D0c9pIc67nehO3WYKZZ8NEWjG2CKMZVC3tuELtpUwJqxX7 oQJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oGDP77wj0SBSqj0K7AcIhTlzIQ1EOZW+OCgfJtSnnj0=; b=Bn6zPGv1/Faru/jF9L3I6Zfu+6JySvIvRBoBEldYCpAuckArkWoc6zu4VCt0phL0lF Q4fh4xobtAJ/SI5pS+5UHayhBFZpjdoCgf9HSqUoVMXf5dgBaHrlyb0UC79Y2nzDoFHt l2Fa2Q40vFwkm5+iX7EAiX0o9scxdFaKPARQ32MezbftWcZmhWdk2hg1a3oO65w6zBq2 7isQsFqMWdappzqSdeP1LHFiOmRQOlypehuSsptNtoD9aucqFe98qIDdAES92crpQMck akujE094s+aGWBQRZCJSSm6geXnQb8qNF0bBVsraJF4pOkIwuKXGbBneRqWKqn/9ZLSr 0zDw== X-Gm-Message-State: AOAM5302ezwZBuWOaqtBJm/A8z3788qMd0Jn/pC0j0mG+i1YynjWY2Hk YOrfkTYWGhwU8zUuvNFm5mGDPg== X-Google-Smtp-Source: ABdhPJw/8oBCbWbG0rUFRC4/JHq/k8qLYU3KPf/U/tgCSiPOwlDExBMcmfq4NheFwmH1P+SovtDBDg== X-Received: by 2002:aa7:8506:0:b029:19e:95:f75f with SMTP id v6-20020aa785060000b029019e0095f75fmr7711545pfn.7.1610010407586; Thu, 07 Jan 2021 01:06:47 -0800 (PST) Received: from endless.endlessm-sf.com (ec2-34-209-191-27.us-west-2.compute.amazonaws.com. [34.209.191.27]) by smtp.googlemail.com with ESMTPSA id b2sm5006394pfo.164.2021.01.07.01.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 01:06:47 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH 3/4] ASoC: rt5645: add inv_hp_det flag Date: Thu, 7 Jan 2021 17:06:24 +0800 Message-Id: <20210107090625.107078-4-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107090625.107078-1-chiu@endlessos.org> References: <20210107090625.107078-1-chiu@endlessos.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Chris Chiu , linux-kernel@vger.kernel.org, linux@endlessos.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The ECS EF20EA laptop use gpio for jack detection instead of rt5645 rt5645 JD. However, the GPIO polarity is inverse for hp-detect based on the _DSD property of the RTK2 device. Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () {"hp-detect-gpio", Package() {^RTK2, 0, 0, 1 }}, } }) This flag will invert the hp-detect gpio polarity. Signed-off-by: Chris Chiu --- include/sound/rt5645.h | 2 ++ sound/soc/codecs/rt5645.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h index 39a77c7cea36..710c95be5509 100644 --- a/include/sound/rt5645.h +++ b/include/sound/rt5645.h @@ -22,6 +22,8 @@ struct rt5645_platform_data { bool level_trigger_irq; /* Invert JD1_1 status polarity */ bool inv_jd1_1; + /* Invert HP detect status polarity */ + bool inv_hp_pol; /* Value to asign to snd_soc_card.long_name */ const char *long_name; diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 24a6acb3c12f..530145cf8c5b 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -34,6 +34,7 @@ #define QUIRK_INV_JD1_1(q) ((q) & 1) #define QUIRK_LEVEL_IRQ(q) (((q) >> 1) & 1) #define QUIRK_IN2_DIFF(q) (((q) >> 2) & 1) +#define QUIRK_INV_HP_POL(q) (((q) >> 3) & 1) #define QUIRK_JD_MODE(q) (((q) >> 4) & 7) #define QUIRK_DMIC1_DATA_PIN(q) (((q) >> 8) & 3) #define QUIRK_DMIC2_DATA_PIN(q) (((q) >> 12) & 3) @@ -3263,6 +3264,8 @@ static void rt5645_jack_detect_work(struct work_struct *work) case 0: /* Not using rt5645 JD */ if (rt5645->gpiod_hp_det) { gpio_state = gpiod_get_value(rt5645->gpiod_hp_det); + if (rt5645->pdata.inv_hp_pol) + gpio_state ^= 1; dev_dbg(rt5645->component->dev, "gpio_state = %d\n", gpio_state); report = rt5645_jack_detect(rt5645->component, gpio_state); @@ -3871,6 +3874,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk); rt5645->pdata.level_trigger_irq = QUIRK_LEVEL_IRQ(quirk); rt5645->pdata.inv_jd1_1 = QUIRK_INV_JD1_1(quirk); + rt5645->pdata.inv_hp_pol = QUIRK_INV_HP_POL(quirk); rt5645->pdata.jd_mode = QUIRK_JD_MODE(quirk); rt5645->pdata.dmic1_data_pin = QUIRK_DMIC1_DATA_PIN(quirk); rt5645->pdata.dmic2_data_pin = QUIRK_DMIC2_DATA_PIN(quirk); From patchwork Thu Jan 7 09:06:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12003289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39D97C433DB for ; Thu, 7 Jan 2021 09:09:23 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 77C9523332 for ; Thu, 7 Jan 2021 09:09:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77C9523332 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=endlessos.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E324D1697; Thu, 7 Jan 2021 10:08:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E324D1697 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610010561; bh=hmLfxvcPYr7tnBpam5qHUE2JmIOjcLSdPkFqYUXFH60=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ebjOeuKvSen7nDUFTVkrkdhDZbplHdFtbYJWI5gK1CRwMKymnQ7/a/Y4NmyS8ohpg lHDOgokqZ2ql1VOZZlaSrUTqejYDTpah6Ig3ZjeRynHqF5Phsu3JAe9+wEbEjVY1PI x/VG42Elv1kuQH9CqpfzKMK/4viJXxjalNk7RQ88= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DDF20F804CB; Thu, 7 Jan 2021 10:07:03 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A3311F804C3; Thu, 7 Jan 2021 10:07:01 +0100 (CET) Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 283AAF804BD for ; Thu, 7 Jan 2021 10:06:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 283AAF804BD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="JJbofJ5i" Received: by mail-pf1-x436.google.com with SMTP id w6so3488059pfu.1 for ; Thu, 07 Jan 2021 01:06:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b1YfOOLyujNTY31P6K35Sp25DPEHUg4Lk9EfBksnDDw=; b=JJbofJ5iaDY1Ke5i+MdO64iHHnfm2sdSOVZV8Kvl65CB1vsDp/jy28hqENRiPeH14D RuvuYmlOIz9y+kreEVjFcj1+HDm/ybOTny5lTciL0t/pmEKi/fx6HJntB4LmcIDqWpKE qklfGNr0eWpe5KP0N1NeWE9JS1NaLywFxEL+geofN83NiSdNlCPmhsHjFqn/nyQLD7ZU BEmcypKu38EBBHEE4GMgSwu3zDNW+rFgI9EqIaOsQw2+Iyh0IWGmZZPlA6rqXA7AbL6I Rnx/oK6cmTKtW4bb4yxudSvrX+JU5rSPyGbNIryUT71fPqXzdsNQlNvUr47X3gQSe8rD +XsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b1YfOOLyujNTY31P6K35Sp25DPEHUg4Lk9EfBksnDDw=; b=FSDMe72U9dAwLrRW4VNE9XsIxz3CgELDBK9pXSWfjLdW5EDJqRKExZrW+mzH6exVXE qqGeD6uAhEIuoXQl+yUIrAdR/h0cszfz7HZtaLr/8Vuag52gqgK1NFoAT81Nc15ogrMw vWnUpPcjbbLT+RMv2KAvv1J78QMz6AtfBgAJryznritU1pd/+UlbJCK6IX7bsTYkTG3d 67w2rrX9EQJZzMCivdZWeKl60j/yw+sGCMHQqcwwEja2PJeEcNFLelMuI3SOzT34vrw5 YNR/dILoOAWRoxAZ3Wwy+HvuszJ5Ikv8FpWFE0ADUhMKZif+rBEK8TCWoQ36cqhICsWR VIlg== X-Gm-Message-State: AOAM533qfCWAKFLfa0irepiFejg/Qtum50d5bGGZWYFncBFHNa84dD5a htZx5TeADzrmuaJGRLQ2kIbX9g== X-Google-Smtp-Source: ABdhPJwzjJy9uBXJ+42hsdSQ5rfbYd7OPl02I3+RutmkSExPxKFat6sdQO5dBWnNSFzYSFYJkPZKFg== X-Received: by 2002:aa7:8749:0:b029:1a5:63e6:56fe with SMTP id g9-20020aa787490000b02901a563e656femr1357149pfo.32.1610010410515; Thu, 07 Jan 2021 01:06:50 -0800 (PST) Received: from endless.endlessm-sf.com (ec2-34-209-191-27.us-west-2.compute.amazonaws.com. [34.209.191.27]) by smtp.googlemail.com with ESMTPSA id b2sm5006394pfo.164.2021.01.07.01.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 01:06:50 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH 4/4] ASoC: rt5645: Enable internal microphone and JD on ECS EF20 Date: Thu, 7 Jan 2021 17:06:25 +0800 Message-Id: <20210107090625.107078-5-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107090625.107078-1-chiu@endlessos.org> References: <20210107090625.107078-1-chiu@endlessos.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Chris Chiu , linux-kernel@vger.kernel.org, linux@endlessos.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On ECS EF20 series laptops, the internal mic is on DMIC2/IN2P. And they need the inv_hp_det to make jack detection to work as exoected. Signed-off-by: Chris Chiu --- sound/soc/codecs/rt5645.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 530145cf8c5b..154d9db9ceb3 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3656,6 +3656,12 @@ static const struct rt5645_platform_data kahlee_platform_data = { .jd_mode = 3, }; +static const struct rt5645_platform_data ecs_ef20_platform_data = { + .dmic1_data_pin = RT5645_DMIC1_DISABLE, + .dmic2_data_pin = RT5645_DMIC_DATA_IN2P, + .inv_hp_pol = 1, +}; + static const struct acpi_gpio_params ef20_hp_detect = { 1, 0, false }; static const struct acpi_gpio_mapping cht_rt5645_ef20_gpios[] = { @@ -3804,6 +3810,7 @@ static const struct dmi_system_id dmi_platform_data[] = { .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "EF20"), }, + .driver_data = (void *)&ecs_ef20_platform_data, }, { .ident = "EF20EA", @@ -3811,6 +3818,7 @@ static const struct dmi_system_id dmi_platform_data[] = { .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"), }, + .driver_data = (void *)&ecs_ef20_platform_data, }, };