From patchwork Thu Jan 7 10:53:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12003563 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 843B4C433E0 for ; Thu, 7 Jan 2021 10:55:49 +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 8B0BC23333 for ; Thu, 7 Jan 2021 10:55:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B0BC23333 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 037F31686; Thu, 7 Jan 2021 11:54:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 037F31686 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610016947; bh=8+iwY3VC2agUxbO5q7ctp7r8IIuVv5+RFLHQUqnuDDM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cgca+f57eW/SmPn6EG6VNRF/3nmKRRao8OcjZbI/qUq+ZwSH6WBtFt6Jy4PLwVNUQ rTg+JCQP7nBDhPDv4vxxALivg4lAXCAp2uFXgRKVc9RVeAWpZgLNHGj4w4V67eXJeQ 6gHbdQFFlTrBuBfJNDtmNJtJQ5i8FqCaXhMh2lKQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9317FF80096; Thu, 7 Jan 2021 11:54:19 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C9230F804BD; Thu, 7 Jan 2021 11:54:09 +0100 (CET) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (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 2F42BF801F5 for ; Thu, 7 Jan 2021 11:54:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2F42BF801F5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="XgAYbgAD" Received: by mail-pj1-x1035.google.com with SMTP id j13so3469106pjz.3 for ; Thu, 07 Jan 2021 02:54:00 -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=12r/7rOzox/JK2DCf9N0SI8WA+cddx4BrIGJoo+tj8g=; b=XgAYbgADc1HGmz3Rs4DbWeqU4nQhtXSZRRLZVCYuIVRpipDojplFv45ggi6d9xCxQp 3FnCYgwhuF3vB181VeZyIT6TiK9mS3nyQMPP//z7s/+JR5QjlpgDsFQhBK7gIXL72kFQ xt0iyY0j/OEyluwkq7hxLjRxqfQUnwtwyyILTiCDXpqNIHqcJafLcSAZDbxGayTlEfXA sHnm0Fh5jt8nxPL6xEdmVC+jT+iHytDkz1hl6YL0B29SKs9u6pPWBR7Dn58D2EtQBnKY rF9MSKBqRozxkwDaT/HK6T/ANwSvXfw905Zv++p9n8snqfadnLbEiphV+ZS2JkB4N/AX Lt9w== 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=12r/7rOzox/JK2DCf9N0SI8WA+cddx4BrIGJoo+tj8g=; b=ESTB1TTW4soFLrzv8ECGEV1a2aBabmMeiNvQxeJZdTprSewOeKbM1LgdWnT09mDBcJ +QJszPW5KoU4yVeoAps8DT/pbC/tTIg28mRGf/YzfpFPyffV94xKTorvq8CTIk/TIUYJ +ceWPMFCW2oY1cVgs18ILaNBINknvISpjcaExr8QjaEhGu88d2z86C4Y5DUrk02UYV7x RGSOo+5+KA8NJCFYs1dm9bL3Cz7Ko1/z0c0oLYOKp6nGOp/exXQC5bxXZ3UeVJH1h3je +TMV03G2CC6EsWVN4B+/4EM8VPiM5SZTlGtVj30TaYr7TMBgLOm37iXcww7ZmK9fvbiZ Ji9w== X-Gm-Message-State: AOAM530YadN65/TeRUVohaKeCnCX+zjhq/iWitIrBvHaXwvuES2/2b5r Mf7P2FLXD9pvlzRA64uILbKC5g== X-Google-Smtp-Source: ABdhPJwSJlWjDnGj6RPJ/lxCdUcf40Qfbpy7gvlLcv+Fnk3pluwpeOJg8qnPEvY/6h4tPkRsn/F9Iw== X-Received: by 2002:a17:90b:e0d:: with SMTP id ge13mr8557626pjb.111.1610016838576; Thu, 07 Jan 2021 02:53:58 -0800 (PST) Received: from localhost.localdomain (123-204-46-122.static.seed.net.tw. [123.204.46.122]) by smtp.googlemail.com with ESMTPSA id p187sm5426042pfp.60.2021.01.07.02.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 02:53:58 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH v2 1/4] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO Date: Thu, 7 Jan 2021 18:53:26 +0800 Message-Id: <20210107105329.146988-2-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107105329.146988-1-chiu@endlessos.org> References: <20210107105329.146988-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 --- v1 -> v2: - none 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 10:53:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12003565 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 6FFA3C433E0 for ; Thu, 7 Jan 2021 10:55:53 +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 CC0CC23333 for ; Thu, 7 Jan 2021 10:55:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC0CC23333 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 53FE2168C; Thu, 7 Jan 2021 11:55:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 53FE2168C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610016951; bh=Zc5zLnW0zCbyh7U5LYFUoQYTj4XRMVhlWJFZ6GCb6PQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=h98X+9GBNcjeZs2xnaVuE4mPpTmGzz7GlQurD791i5RfDjjC5IlLlEloAU50EHFvh N/5SErRANlP8gz5dVGJOlt98wpNHd82DNJKAzy2lt7Uw3H+if7VYnjH488aYqoljkt 605EvFdflVNxGVQD4BjVIrkN0uIo4aeyFI9KmLQc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 994CBF8049C; Thu, 7 Jan 2021 11:54:21 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C9B01F8049C; Thu, 7 Jan 2021 11:54:11 +0100 (CET) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (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 DA43FF80271 for ; Thu, 7 Jan 2021 11:54:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DA43FF80271 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="HwxIRamI" Received: by mail-pj1-x102f.google.com with SMTP id z12so1228250pjn.1 for ; Thu, 07 Jan 2021 02:54:02 -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=SXRukigj1iHMoS+zrcnuLFVozC6TWaz57QCscXGkcCw=; b=HwxIRamI6tKzP/RTL3p6ielXV0TT8QwY+6wdetq7ByGFKnicsZfEQQMkN9TSjZTtBz ADN8/bXZFlglNZIYZ8BrZ2w7jzfkG1wrphN0a8reVaB6CcL4qEoip8nHtvidtcLCtHpF /WInHPbvoAe8oANfyH75yBts3IkIaxhQorzOQt11J4hOw3D03aqn5UWzViy/AExcu90t rnkSPUSdF0L86JaIs22jDznUkFlR+Us8l3yjsjv/XwEBOBCT7rnNTDXj0WmF5UkvB0LS 5m7QoJuBOv4pfaGZWe3xOZl6M8IJFtv/RJDdMGFUUuLMarRwOHg2HkP/HTs5kVkLA0/p u85w== 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=SXRukigj1iHMoS+zrcnuLFVozC6TWaz57QCscXGkcCw=; b=m+sDdXJwQFEq9gQMUDdXLSbqQSinPeZedHqKhSEUxJUr3KZUwZ1Hr1a2uhIJSVmwwY EMojbot+JUYFOPoOQYqNQG0gCJqNwZkVoj7MV7kzttoJgL3hYegNj67gZRyHO+59p6sk F09+pZ7NQEYDhPhDxzogSKSRzC0lmtoVVoFimOeREhRDVYrfGTlz/67ccsMrrDx9T2nN 5AZePWCYhguDQcaVdSq+jZe23vWRerYCMhXiUBklXPRcX1e/9VYEv86XXRORAoKwDLMp 4UxrWiU9yBIc8nVvejfu96yvAaclddErfZw4zJCOVFBqaHXJROgR4+NyhgGTxr0ImvYh YGBw== X-Gm-Message-State: AOAM533jvRMciatcAXwj61SpRPMSAGSggYVwJyT2wQEGMNmoI67Mb5Sr j/pKGUmDs0IEN1M4U2KoMwTDUA== X-Google-Smtp-Source: ABdhPJwuTBYeXammjoxaNx9IYUL56AthITKesmqaEc+ZGvadw7MKmud5l7/Fa7Um7AmHXxHZMlw7Uw== X-Received: by 2002:a17:90a:4817:: with SMTP id a23mr8633976pjh.16.1610016840812; Thu, 07 Jan 2021 02:54:00 -0800 (PST) Received: from localhost.localdomain (123-204-46-122.static.seed.net.tw. [123.204.46.122]) by smtp.googlemail.com with ESMTPSA id p187sm5426042pfp.60.2021.01.07.02.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 02:54:00 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH v2 2/4] ASoC: rt5645: Add ACPI-defined GPIO for ECS EF20 series Date: Thu, 7 Jan 2021 18:53:27 +0800 Message-Id: <20210107105329.146988-3-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107105329.146988-1-chiu@endlessos.org> References: <20210107105329.146988-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 --- v1 -> v2: - Invoke callback() of the DMI quirk if it exists. sound/soc/codecs/rt5645.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 78f0ab0a008e..94faa0a9561f 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) @@ -3831,6 +3858,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, if (dmi_data) { dev_info(&i2c->dev, "Detected %s platform\n", dmi_data->ident); pdata = dmi_data->driver_data; + if (dmi_data->callback) + dmi_data->callback(dmi_data); } if (pdata) From patchwork Thu Jan 7 10:53:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12003567 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 4E714C433E0 for ; Thu, 7 Jan 2021 10:56:34 +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 7CDE52333C for ; Thu, 7 Jan 2021 10:56:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CDE52333C 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 0316F1678; Thu, 7 Jan 2021 11:55:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0316F1678 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610016992; bh=bbf8nnSJesZ2zKuuRUgJIeOoTODjD7TfSKzJLMWGoaM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dAoTlqQAQCqsRZFpOZ1yPQtY0M6A7Ne7TCX2J7wFm7yBseKccWkUfsTk05ihLtI6M AA059JcWcZu7S78Z8FVuwRjZjzUoM83AIVlghhY1TXPL4xOWk+DjmBZKRLgmZ09lE7 aPL2XcA/jq6r+7PKT6fpiHhmUuTJYaMqrGKyFuB8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 73723F804CC; Thu, 7 Jan 2021 11:54:22 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 49061F802C4; Thu, 7 Jan 2021 11:54:15 +0100 (CET) Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (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 3D3B1F80096 for ; Thu, 7 Jan 2021 11:54:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3D3B1F80096 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="qkU4ooKT" Received: by mail-pg1-x534.google.com with SMTP id n25so4602547pgb.0 for ; Thu, 07 Jan 2021 02:54:04 -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=GLS4gP2Eh8NLeiNLmHSAPr2HGbTg/Br5dE7CxZfSO3A=; b=qkU4ooKThum8yYHmTG/VT/ykGywcrQBi5WdFfz4IY5ZhOPlCGWnI330uyaZ1h9rzTe 3/d77vF0KiVsTQzlwIFTv9boBxcSkVmWMku3E86d/lZC5qwt3tUXfmocCVqVlYqcklCN Zn0HUaNLc9kKQghj0hlLPdK+f1h977z4ygSgw11k+g7ump/hucJW4sutwtijjeKTPUqE AW8Z5+zL6Stghw11fC22KXtC+ZtOBbzoo6itCAfvZNOVmyZkMoaFOl9rsTVtszkSJT8C cg7qdY0SNW8yB0ud65j0FdFFdz9Py07Z2ep7IwROxQYCrCoCXmDN6/bXaK0Tx2A8Q08X rojg== 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=GLS4gP2Eh8NLeiNLmHSAPr2HGbTg/Br5dE7CxZfSO3A=; b=L0IP8KA334nR/tbwoM1IHNwBBI8QTfh+QCCswZfmsD/S7BKqCT6rbAlzQERaqBfDlg L9eQeyrTlDzOaH/T092Ms/X3SiKOUoZxUfzhfIFfRzU/uZphqlGbpaZSbNaKcxuBgRoV 11t8thkHVcICYPy5XbksArI5BHgsQcTnr350lsAxpghFUiaZsMK4q9nQcjR0WE4xyec4 xdsZZQJ6UP0FgbW3cQCPF8Zp9Z1nDRmUuusEQKbVQ263y8BPHAFiUrWktcdrSW1Qq6Lw btLKvJCqvE53GNRvyQIcYxNWfU6HFkgsQTwzHBZu+p8AjO7hbfsfFALNhfOioBwNoJhN baTQ== X-Gm-Message-State: AOAM530zCGyKTJ2hYEv/bU2PN2i7CmcNScbQbLL09x1O9QOiayx3IxzZ +mOacy8rSnbDEIiok9FihK2ihQ== X-Google-Smtp-Source: ABdhPJx6WDiTbySCDVkfYV5+Su1psU9JnwXmV5YgsXYqYUNjupzlxH9hbNfkDRY8i3+v2wS/BeWUUw== X-Received: by 2002:a65:68da:: with SMTP id k26mr1266349pgt.397.1610016842972; Thu, 07 Jan 2021 02:54:02 -0800 (PST) Received: from localhost.localdomain (123-204-46-122.static.seed.net.tw. [123.204.46.122]) by smtp.googlemail.com with ESMTPSA id p187sm5426042pfp.60.2021.01.07.02.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 02:54:02 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH v2 3/4] ASoC: rt5645: add inv_hp_det flag Date: Thu, 7 Jan 2021 18:53:28 +0800 Message-Id: <20210107105329.146988-4-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107105329.146988-1-chiu@endlessos.org> References: <20210107105329.146988-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 --- v1 -> v2: - none 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 94faa0a9561f..ca1bdb67ecc5 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); @@ -3873,6 +3876,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 10:53:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12003569 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 A7473C433DB for ; Thu, 7 Jan 2021 10:57:06 +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 CA4AA20738 for ; Thu, 7 Jan 2021 10:57:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA4AA20738 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 446461687; Thu, 7 Jan 2021 11:56:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 446461687 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610017024; bh=Vqu/K+4UVBpwm6/Dpy9TCq9iTdjqMP9scHdcdjEtTdU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JdacJo3cOuwe3IOl1CIfwtVYQ/jIgQgN5wWIHBiO7Vz9JkiHO+M6pTNw684iuQ5m1 GkJ9msHwNfFDa2SAcjAvRaL5y46cTR8PaiAYQo9cDURW+EeU25uewcZZAK8yVlB+HR yjGVGU94clzE6fnHwa7TDW2VPRWi8+BT+ym5BLqY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A6F0FF800FD; Thu, 7 Jan 2021 11:54:25 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9F252F804E4; Thu, 7 Jan 2021 11:54:23 +0100 (CET) Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (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 574FBF800FD for ; Thu, 7 Jan 2021 11:54:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 574FBF800FD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="NlAhefOS" Received: by mail-pg1-x534.google.com with SMTP id q7so2677036pgm.5 for ; Thu, 07 Jan 2021 02:54:06 -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=S75Szc7++nY1TyducuLbqYdGcj1o18w6RuvL7vJegts=; b=NlAhefOS9cbbZeUSDvp5H44CBKSZnjtM+1I63yOXlOg8kwKE8bajQgPtyxL3+q9zUI rrQSq+fN9FNfdegsMaG84D6B7IcihOBKpS/b8sBxS4uZ106wIc7ilBIc3Fxp8z68Vh/1 PtHaGY0YX61gr4Ar5p0SzO9tmt23QwvOaRiSRch1yt9wyEIYpmLT+OqP0vekaarerHEi jYOIVm4ZX3VMzP6bMbB5stQk9il/hEuOdijx2k4Njqvwqm40hetIwDqM2rQ5EWuzeVv7 by1/51uk1WAxIEjytNKmSI+czFD2q5DjfstxG9TKns3bxq6Ua4IwulS9LG6//uys30pr Zxyg== 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=S75Szc7++nY1TyducuLbqYdGcj1o18w6RuvL7vJegts=; b=QvEoPohUzYJoue7xcTJQElGSxeIaOJWFGO3DLkzobqmkeyoNjoVvb33wl0k49sDRTU aggtMnOvSRsnGH0999eTh4EoPCkeTb585jhCUhiqrJMmZHgpMiCvtuXJTZR9TukPr0DA Mrmr776qhUF0TYLi3YJTaOCW1oRQ4RkJTWkeEM9up3QzUJuC9J2o0BuHcoXIY0fvt1t8 IvJpEJ2+nKScOAQder1kG9YzU/1EZAQs5hephUT67amWAJC8+am34+9B8Jis5b8y63x0 2Jvb6+OaQ2jWaIXuX4hubmNFqqY3clrj0j0sh97QdzBFvqkWcZbYUmkbzBb6SPUj+vmc ej+A== X-Gm-Message-State: AOAM5312ScLZ/XWF69F/WvPw0viaOW4mq3o/wCXRUqLPk5r5NE2+vPEP 2p01H8O0QVnz/22ovoorXwKR5g== X-Google-Smtp-Source: ABdhPJxvMoxAdiXUF/sT3MRBy8A6NSDnI4JDYJys+nX1MROceZswyy5lG8DDldOqE4mKpdZ/xJO7Sw== X-Received: by 2002:a63:c702:: with SMTP id n2mr1279619pgg.382.1610016845156; Thu, 07 Jan 2021 02:54:05 -0800 (PST) Received: from localhost.localdomain (123-204-46-122.static.seed.net.tw. [123.204.46.122]) by smtp.googlemail.com with ESMTPSA id p187sm5426042pfp.60.2021.01.07.02.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 02:54:04 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH v2 4/4] ASoC: rt5645: Enable internal microphone and JD on ECS EF20 Date: Thu, 7 Jan 2021 18:53:29 +0800 Message-Id: <20210107105329.146988-5-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107105329.146988-1-chiu@endlessos.org> References: <20210107105329.146988-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 --- v1 -> v2: - none 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 ca1bdb67ecc5..6628b7e5a583 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, }, };