From patchwork Mon Jan 11 05:41:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12009813 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 9EAFFC433E6 for ; Mon, 11 Jan 2021 05:45:19 +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 BADF32255F for ; Mon, 11 Jan 2021 05:45:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BADF32255F 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 BB5D816C2; Mon, 11 Jan 2021 06:44:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BB5D816C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610343916; bh=Sumx0Ps5kXpKF6T6bCZ0dLxRobtzXZQ5jXM3zLNi/MY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jl4Z25vMEduq9V9TJdMmyEw6/25ccTHa85EmmVpvaZ0yg64fu+0tSOAJBgDol3+Ii 1WARivul/yHPEk3HPTIu77YAt2T44e93lbvlp6bxDneabSZj1hM5nx+TV2jCR21PLA bw58nffCQxGf/rKqxAYsnXSeTXEkusVUImDnH74g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5E69EF8013D; Mon, 11 Jan 2021 06:43:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64CB3F8025F; Mon, 11 Jan 2021 06:43:29 +0100 (CET) Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) (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 77948F800BE for ; Mon, 11 Jan 2021 06:43:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 77948F800BE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="vNYf09dS" Received: by mail-pl1-x634.google.com with SMTP id x18so8921150pln.6 for ; Sun, 10 Jan 2021 21:43:20 -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=cZ/EQIt6H/y8SQLMWPm2hmgqxZ9ZXY3uZLH1G1eLd6I=; b=vNYf09dSEmnLqjpb9fwlPPtOVuiCpYHZhpUrFh4vGT2j14zeEUKsCQrBXONT+LscW2 O/3PHI6D27Q3O2R/beN3nYGGWj7WdBsRWKxfc7nCrxTKG51JB3FIjL/j7DwfAdEnubow L90DGccWjme4lkmESgGM0EYinKWHQsH8R4JS0BDU6jQV1RAxP+1J9uzepmR7sYAffN0P VBSJTbpaip0InnrLeTM6WhESqC76gvq5bNozmQZpoPyteXOH0CxUMZjsMEjWU2HJfvHY f7LmdaG9uzDGnZO6hl3LPzyH2FvX0WQmIDcEmnefGMHkhuAp0YRi5Vr6QanrjGZI1LZm GSQg== 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=cZ/EQIt6H/y8SQLMWPm2hmgqxZ9ZXY3uZLH1G1eLd6I=; b=DMhFBw7OKCSBfEsHPpcXalauhzUQmUaI0tThRwj0ZhHIjVQPRfVc9wlZPqlGp/066R AcFvN+hGkS6F5uIyhtwoiePrXOwY738x9I4kJvbgaQ01neAl/+aVqcq+yQbxcxgQfdZm kH7ksyeLUJzVjRzFZeLGujHsNtqK4wSQLYHFswO8f7O7FLfdyDMgDV1+9N0sjHeV5mDR 9bd6H2+53/Gm0sUa2WVEug/1yHLgZhArG5U3suaZB/6x7j2+52miCZfHv5jjwwPyrcGX t9FlwOWZzWZ+74KnyajkF20cObFOw2bZqP+e7rGeHtM1V7dL0IX+a8nutCJX22mv6LKx JnEw== X-Gm-Message-State: AOAM530ZABoaUEdLcZ7reACjA2UViFD/721iPLRQ6qIE6ceihFi6bDwo GuNCGpIrhlRrvlEsa7bQfQ9RLA== X-Google-Smtp-Source: ABdhPJygrqxArlu5P5B8h2ks1EBMZPzSzd2paE64adL5FqbBS1d+WCnpwz4d40w1WmhkvzazRazv3A== X-Received: by 2002:a17:902:ba97:b029:db:f662:a547 with SMTP id k23-20020a170902ba97b02900dbf662a547mr17654842pls.68.1610343797639; Sun, 10 Jan 2021 21:43:17 -0800 (PST) Received: from localhost.localdomain (61-231-198-38.dynamic-ip.hinet.net. [61.231.198.38]) by smtp.googlemail.com with ESMTPSA id x15sm16726267pfn.118.2021.01.10.21.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 21:43:17 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH v3 1/4] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO Date: Mon, 11 Jan 2021 13:41:38 +0800 Message-Id: <20210111054141.4668-2-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210111054141.4668-1-chiu@endlessos.org> References: <20210111054141.4668-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 --- v2 -> v3: - restore the terminator {} of the dmi_platform_data[] v1 -> v2: - none sound/soc/codecs/rt5645.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 420003d062c7..af8f95644f11 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 @@ -3848,6 +3850,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 Mon Jan 11 05:41:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12009811 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 11461C433E0 for ; Mon, 11 Jan 2021 05:45:19 +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 7D4772251F for ; Mon, 11 Jan 2021 05:45:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D4772251F 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 C30DC16C8; Mon, 11 Jan 2021 06:44:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C30DC16C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610343916; bh=ZGeg1DKO9DrevWyKHE1un4rJxcXH+LYmxbXeo+38bGs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UIF2YDGnJaHQM5WPPA7JS0taPvlVGqpBj5PdpQvyAMrrVJFmS1RXdUtuzWi/uMBLc YfyfNUghT9SqzJnSI9LuEgTTouIzYFzrB8kcRmr0w/QQai4RaKxxvLhGap5fJyY+mk HB90HHBJPW8MUI6ETzvS6bqEQufnF/7ySnD6WXo8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 82E43F80290; Mon, 11 Jan 2021 06:43:31 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3695DF8026B; Mon, 11 Jan 2021 06:43:28 +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 D624EF8016C for ; Mon, 11 Jan 2021 06:43:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D624EF8016C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="L3RdQOOF" Received: by mail-pj1-x102d.google.com with SMTP id n3so7728015pjm.1 for ; Sun, 10 Jan 2021 21:43:21 -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=yOQr05X+xX/KVtl6ApOJMHz2x0Vp5f60Ndun7HKg7HU=; b=L3RdQOOFDqLy+Q2epvPbmWxfDdRAZEIDt/5MrRzq9uZlTDyDlHAd/IW6PqM9BDa9m0 xu/HGX3lw5FxV89PaNXMd/ZQ+nehmfgl79++uj65aKFA5fBxgYK12sSCmEiG/iOgKC7M J4Ku96aXby/ig0iLiiS9cy+EJag+V+MU0fQNF8bGa8rTz7qMbN26oIFPr5wXAwsPHFS8 l4dKkTzUop0Sju7/iw26KVWg+xd938tz+rsVRdmYXO3sC83CU4jaGMLod4FULsQXp1ek EejB3oLBcAvY3q2mS18mLymZytyieNro4puOVVsYdKAIzkopXApEBd7RXONI3sJ+DsxK PIBw== 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=yOQr05X+xX/KVtl6ApOJMHz2x0Vp5f60Ndun7HKg7HU=; b=eYSKjsCsF4A1v4+GFrDZUqnoXH3NRZCWiMSYdDOt0l317u0MHfQZNOgXq/eysXtIkO RYuliZ4stw2eBrUj0oKwKNc1Py7ZwPjqVS+Kyh+g2FNoMWn6oBe/gBreo27txtGA1Id9 2hGpHpL2vCSV0Q5Uv7TP6xxWiHzUChHx0Ci3kTUk2O9uAN/fTTQjrcOZn8CFsIn5pV8G a/6b5Lc8rGWW/iYTbivPgMRWTmzE1sQTkaCWfbvzkk85y0EkTvw/Yr9DGkCUuqjg/V7z uM7vSjssQr/yE6bUwCRTsAgfpkn6QXEKPl/HExgfU1xLLD256QOM4ci7ZTNbWQWoMVqu LC3g== X-Gm-Message-State: AOAM532/MZEBk7LvxH8rP9apF2LCeG8cYJWir+LkfyiriDJVkQMXzNlX 7gKuuMwuhq4ZImTnFtf3GCP7Pg== X-Google-Smtp-Source: ABdhPJw2ONFbNDwJMu27VEV4P16I/0rFc3iebLBY5JaKpGsgPjcU3McVOX/JWuuKs9nxla1GZwIrrA== X-Received: by 2002:a17:90a:6d62:: with SMTP id z89mr16567631pjj.71.1610343799816; Sun, 10 Jan 2021 21:43:19 -0800 (PST) Received: from localhost.localdomain (61-231-198-38.dynamic-ip.hinet.net. [61.231.198.38]) by smtp.googlemail.com with ESMTPSA id x15sm16726267pfn.118.2021.01.10.21.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 21:43:19 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH v3 2/4] ASoC: rt5645: Add ACPI-defined GPIO for ECS EF20 series Date: Mon, 11 Jan 2021 13:41:39 +0800 Message-Id: <20210111054141.4668-3-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210111054141.4668-1-chiu@endlessos.org> References: <20210111054141.4668-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 --- v2 -> v3: - restore the terminator {} of the dmi_platform_data[] v1 -> v2: - Invoke callback() of the DMI quirk if it exists. 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 af8f95644f11..770801de42a6 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"), + }, + }, { } }; From patchwork Mon Jan 11 05:41:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12009815 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 5CA93C433E0 for ; Mon, 11 Jan 2021 05:46:02 +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 40CAB2251F for ; Mon, 11 Jan 2021 05:46:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40CAB2251F 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 5986E16DE; Mon, 11 Jan 2021 06:45:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5986E16DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610343959; bh=oK6p84HgXciQhiheBe3wdjlHfjFMNxr84zV5ScyYXp8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=toOxcyxIvLFGz1ABxOBYGr8J4sEkkhWTKPItx8XfznHX2sBtED8UsqAId4YMaLSrJ 8JxhXfPN6GQJHUq5ILNPl84fjVbsQzMEY5qZ2+ub9qext9pWQ91nqXtdys+PDcqlZ9 yRXWLu5wH22gf5PlSkEBLEluKs2Fzlp/GoCn/ukw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 11664F804CB; Mon, 11 Jan 2021 06:43:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 527F1F804C3; Mon, 11 Jan 2021 06:43:33 +0100 (CET) Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (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 36603F8013D for ; Mon, 11 Jan 2021 06:43:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 36603F8013D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="bMYkSxqT" Received: by mail-pl1-x62d.google.com with SMTP id s15so8905711plr.9 for ; Sun, 10 Jan 2021 21:43:24 -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=XMbpkW+eDXvGxzeNZGTUiKWxTza0cLDoP13Yb/fIyl0=; b=bMYkSxqTeyYPFRk6Pfhz8CMPrfkdIVqEnaZkjx1A4NiD1G+SHQEprLWePzbTtRwymi fMaIewmflTMKlejsp93dOcWFtmUsjPgOrwVK8V6Yjozj97JaJ+fqxKzMOSXquPQdI6Ug kTDL5H0AcoGMeJdiiutVJZfR7YcSyhbWh9UkSvEagAITkBE9zU9jeMG9kS0krud9XtoJ CKRFE3EtENUvtI5URUlxcL7hWZnGhzLMuKU58qs09hdOipghLraS/CvfZNkbPxDTf41h KEAie9QCB1noHHWvOsJn5rOz687whaEmKaClr0jgvcS3g5YlSDcNcCWvle7E3hPKOiHz EFmg== 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=XMbpkW+eDXvGxzeNZGTUiKWxTza0cLDoP13Yb/fIyl0=; b=KhvmBPMrBj3JSMz789bk0j6IriVzJ3rkklNqDdMDgaL1wW12WRAQNGSzBNKqnag2vn FngjcXxQUT8vSyiYh1ibCHvPHBQDvX56sOhZPi+yIUxeD4CA5PqM/Fvx+QwAYlvCAJOG dFAiunHMgdb0dU/CTROwSfTXUsPeFsYBdWqheyBR351EyNxDi9/5VO+vEAHGP+aDJ4v8 6TMpKBh8thTJl8sBesQMl/0upccS5AHFs/r0TTw7S/RgaIJ8XvjWrrI+xhdqrH4QfQD4 0EfThvEFQ0hOzjXkt48z23E+Bi8adt6IM2dIs/SyMuxI5I1hhtebhgOguQCQ8KtMTwSK qdIA== X-Gm-Message-State: AOAM530TU/4Teo2IdXhG/X8Xltn+ZlbtA1nClBxa8KBTEKyA4XSYjTgI SqfJyX5+hFmcCXb0Lq0/M4vRFA== X-Google-Smtp-Source: ABdhPJyOXPSUd+ytQ62J99cOfI/+EggmHpRzgNFnwcWowc5UfgcsUgcIp/rGvomiHlSSMlGmKtb/Zw== X-Received: by 2002:a17:90b:ec2:: with SMTP id gz2mr16289398pjb.143.1610343801948; Sun, 10 Jan 2021 21:43:21 -0800 (PST) Received: from localhost.localdomain (61-231-198-38.dynamic-ip.hinet.net. [61.231.198.38]) by smtp.googlemail.com with ESMTPSA id x15sm16726267pfn.118.2021.01.10.21.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 21:43:21 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH v3 3/4] ASoC: rt5645: add inv_hp_det flag Date: Mon, 11 Jan 2021 13:41:40 +0800 Message-Id: <20210111054141.4668-4-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210111054141.4668-1-chiu@endlessos.org> References: <20210111054141.4668-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 --- v2 -> v3: - none 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 770801de42a6..4fd91ee3cfaa 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); @@ -3872,6 +3875,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 Mon Jan 11 05:41:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 12009817 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 42422C433DB for ; Mon, 11 Jan 2021 05:46:09 +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 BAEBE22527 for ; Mon, 11 Jan 2021 05:46:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAEBE22527 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 4B80616EC; Mon, 11 Jan 2021 06:45:17 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4B80616EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610343967; bh=PF83uvsUvaHoUoSviiDlDzVlp+utIwKVfiZ4BaFSfAQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uxyXnZWStA4/xqLcKLlniLu6ferHnzhp3hObXlHqsweJlImz+/8if37ThNVxG6mLG 16lvjCBI2i92BZlkrrPlcXPsJYGU5vyxDMgowXwtoqp+Rm7QZzcFsyIedotLAqOkzT WWHvl1kdVu8owSftSBz3yLufK26WqS9uFSMzmU7U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C9A9EF804D6; Mon, 11 Jan 2021 06:43:55 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D04C8F80475; Mon, 11 Jan 2021 06:43:35 +0100 (CET) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (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 3344AF8016C for ; Mon, 11 Jan 2021 06:43:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3344AF8016C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="Ez90y4CA" Received: by mail-pl1-x62f.google.com with SMTP id s15so8905749plr.9 for ; Sun, 10 Jan 2021 21:43:26 -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=dxcaQzCef245GEe8BHqti9uSrUtRw/ahVKeK4xjDRr4=; b=Ez90y4CATdLWsRXoTHvdWFgKb9imu7x6pZ+0tq54Es0wZGv/TwxRFVAQ5QPX9cHi+6 8oDY9Z4gmLSjBFoIkQOQzgyFCkKT690yLHSGO3rzG9zvwNpYnSRHbX035eeF6EYo4Zry lhhRV04k4I5RzkWmBJa21Np/2xC+3SvKizJOOhSMtIM4zRyltuTc81NapAYx4fGrfEu6 sqjuHtlvWgVhnlMVTsWwEWiXqeUkNfzsRahPHriuvjmJslB57Nh9OpfkPIRj5YhfecBW JhQ1h6W/wBQU0sCiEjmVVB7MQcjFEgjMXS1tn32mXvL+hX2jsEeql8CnGNJgUNtWAsY4 BkZA== 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=dxcaQzCef245GEe8BHqti9uSrUtRw/ahVKeK4xjDRr4=; b=gZI5h+RSZ0ah6pWcBkwsx+Aj42q5qorAf0V0jeSgLSz3WTSmVY88qoHDZwp3xOQJ/5 xYZUmpyrSsqS/Xbss0Geb0Qpl3umvmMk8BU7XYAkWlWLrWPyB8s+iS4mK2htUBuI2PQO ItKMlTUxgiI7Z7+WbxEcCfpltLMYKYlkMFp+NTWnd7iebItUWC8O4eD99pJVMEeIOcPT r39B8PBFsoRYbobWKW2qObZRp8pP8smpMrlT3gsnrCe0up6/o5q+p4yVbUf/uG97Oykx WeW6cP9TYc4+c714B9CwNfsqQBj/ScD4pcgDy3OxIvZqGN1e2I6gF2B2JmomGsnbiwDo 8OFA== X-Gm-Message-State: AOAM531LFsZ9vJppKyq+jm3b5UeWHiZvN740AVdugZUrE0ucOVhSbCtr vjbUPYhwlBlNIKETyMn34esWvA== X-Google-Smtp-Source: ABdhPJziyb7hLc7BZt6/cajylkz98uap7IhWPym7e8MO4EeDMQPQ1K9MyNAlYU5WgWaEdLxjh9RQzg== X-Received: by 2002:a17:90a:a012:: with SMTP id q18mr15775938pjp.223.1610343804055; Sun, 10 Jan 2021 21:43:24 -0800 (PST) Received: from localhost.localdomain (61-231-198-38.dynamic-ip.hinet.net. [61.231.198.38]) by smtp.googlemail.com with ESMTPSA id x15sm16726267pfn.118.2021.01.10.21.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 21:43:23 -0800 (PST) From: Chris Chiu To: oder_chiou@realtek.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Subject: [PATCH v3 4/4] ASoC: rt5645: Enable internal microphone and JD on ECS EF20 Date: Mon, 11 Jan 2021 13:41:41 +0800 Message-Id: <20210111054141.4668-5-chiu@endlessos.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210111054141.4668-1-chiu@endlessos.org> References: <20210111054141.4668-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 --- v2 -> v3: - restore the terminator {} of the dmi_platform_data[] 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 4fd91ee3cfaa..3c082c4ac3fc 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, }, { } };