From patchwork Sat Dec 22 14:47:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 10741311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7771161F for ; Sat, 22 Dec 2018 14:52:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F4E22896D for ; Sat, 22 Dec 2018 14:52:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A3C22897C; Sat, 22 Dec 2018 14:52:10 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 AEB432896D for ; Sat, 22 Dec 2018 14:52:08 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DF499267AD2; Sat, 22 Dec 2018 15:52:06 +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 C4DAF267AD5; Sat, 22 Dec 2018 15:52:04 +0100 (CET) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.216]) by alsa0.perex.cz (Postfix) with ESMTP id B8355267AD1 for ; Sat, 22 Dec 2018 15:52:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1545490322; s=strato-dkim-0002; d=gerhold.net; h=Message-Id:Date:Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=hBLn9YEgEYeUDxhpmK6QoTdrpSr7bDicsc/N7VfMHqA=; b=bA/jFxWsX9PvHC6NNkVou/z+xxYzTDKgQRXbl9wkfCLeY051iKk0CDkQ8JYDWndSAF lakuVuirBshhoB/3qS+3Z+lrhT2dD6nuTBKqnQ4Q/VjK9fhB3Ko5qF3B6DwI05iXqp2n hsSsOr0ozyVx77PPufNJHQqLyb7MhrTY4m2HU/MQvOwRQ9aZEuTWwfHxPnooJPksl09h lFEgiHjO7+7tPt4U8SvVmgVU8ZlkEShTd9/nyxr5AbmB3mPXjOAI4T7HyCK/oS8bW5kI hgUZfcOr1XUiQsjg0ebeLzaD99iO57Zt+IabUQOkz7WTv9rav1Pz9Bh+8zNBpgW2NhrD KHVQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7IOGU5qzCB2at3sJ5Uw" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 44.8 AUTH) with ESMTPSA id e031cauBMEq1JZn (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 22 Dec 2018 15:52:01 +0100 (CET) From: Stephan Gerhold To: Pierre-Louis Bossart , Mark Brown Date: Sat, 22 Dec 2018 15:47:10 +0100 Message-Id: <20181222144708.121732-1-stephan@gerhold.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: Liam Girdwood , Hans de Goede , alsa-devel@alsa-project.org, Jie Yang , Stephan Gerhold Subject: [alsa-devel] [PATCH 1/2] ASoC: Intel: sst: Fallback to BYT-CR if IRQ 5 is missing 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Some devices detected as BYT-T by the PMIC-type based detection have only a single IRQ listed in the 80860F28 ACPI device. This causes -ENXIO later when attempting to get the IRQ at index 5. It turns out these devices behave more like BYT-CR devices, and using the IRQ at index 0 makes sound work correctly. This patch adds a fallback for these devices to is_byt_cr(): If there is no IRQ resource at index 5, treating the device as BYT-T is guaranteed to fail later, so we can safely treat these devices as BYT-CR without breaking any working device. Link: http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/143176.html Signed-off-by: Stephan Gerhold --- Moved the "Detected Baytrail-CR platform" message to is_byt_cr() so we can log a different message if the fallback is used. Tested this on my device as-is, and simulated a "normal" BYT-T and BYT-CR device (copied their IRQs to a custom DSDT). sound/soc/intel/atom/sst/sst_acpi.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c index 3a95ebbfc45d..755a396121ff 100644 --- a/sound/soc/intel/atom/sst/sst_acpi.c +++ b/sound/soc/intel/atom/sst/sst_acpi.c @@ -255,10 +255,22 @@ static int is_byt(void) return status; } -static int is_byt_cr(struct device *dev, bool *bytcr) +static int is_byt_cr(struct platform_device *pdev, bool *bytcr) { + struct device *dev = &pdev->dev; int status = 0; + if (platform_get_resource(pdev, IORESOURCE_IRQ, 5) == NULL) { + /* + * Some devices detected as BYT-T have only a single IRQ listed, + * causing platform_get_irq with index 5 to return -ENXIO. + * The correct IRQ in this case is at index 0, as used on BYT-CR. + */ + dev_info(dev, "Falling back to Baytrail-CR platform\n"); + *bytcr = true; + return status; + } + if (IS_ENABLED(CONFIG_IOSF_MBI)) { u32 bios_status; @@ -278,10 +290,12 @@ static int is_byt_cr(struct device *dev, bool *bytcr) /* bits 26:27 mirror PMIC options */ bios_status = (bios_status >> 26) & 3; - if ((bios_status == 1) || (bios_status == 3)) + if ((bios_status == 1) || (bios_status == 3)) { + dev_info(dev, "Detected Baytrail-CR platform\n"); *bytcr = true; - else + } else { dev_info(dev, "BYT-CR not detected\n"); + } } } else { dev_info(dev, "IOSF_MBI not enabled, no BYT-CR detection\n"); @@ -333,10 +347,8 @@ static int sst_acpi_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = is_byt_cr(dev, &bytcr); + ret = is_byt_cr(pdev, &bytcr); if (!(ret < 0 || !bytcr)) { - dev_info(dev, "Detected Baytrail-CR platform\n"); - /* override resource info */ byt_rvp_platform_data.res_info = &bytcr_res_info; } From patchwork Sat Dec 22 14:47:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 10741313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3ED313B5 for ; Sat, 22 Dec 2018 14:52:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9241B2896D for ; Sat, 22 Dec 2018 14:52:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8377C2897C; Sat, 22 Dec 2018 14:52:29 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 CF85F28978 for ; Sat, 22 Dec 2018 14:52:28 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B9F44267AD5; Sat, 22 Dec 2018 15:52:27 +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 ACD31267AD8; Sat, 22 Dec 2018 15:52:24 +0100 (CET) Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.52]) by alsa0.perex.cz (Postfix) with ESMTP id 4A3FE267AD1 for ; Sat, 22 Dec 2018 15:52:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1545490342; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=nuFMN+nn9kIKRYr1vB6nFAnefDUonKnirQjPH+NlxVk=; b=XTmn36oaS0+wDgjinLybp55CzmXUQwFG1yMgDOnNrCgqNKvsczc9Grc5cehNLYXihb 3XkR7VpHA25/BhmNL/h2MZ/dVaVTa2ZpWG6UWMR+sga1iWxqBn9g4b+RcIy6H3arb/uy fT3VQJfsKTXakFkN/6ieWde8B3myPTMOiP3CYOI+EZeUg7wUPFLAL0cptPWY2rzsTwpm J686v6IeCr5KEQOnWN7c503c2igklANy3MNV0h19xkK4vbWVQsQg5iSwyfIsAPPBhBal CEd7sEC6ZTPcmzjNSruWc6sV1CdM777sAIiVGt4UsBKXsR7xaYr7IzBU4mpL9l4bxTPc ZCeg== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7IOGU5qzCB2at3sJ5Uw" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 44.8 AUTH) with ESMTPSA id e031cauBMEqMJZo (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 22 Dec 2018 15:52:22 +0100 (CET) From: Stephan Gerhold To: Pierre-Louis Bossart , Mark Brown Date: Sat, 22 Dec 2018 15:47:12 +0100 Message-Id: <20181222144708.121732-2-stephan@gerhold.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181222144708.121732-1-stephan@gerhold.net> References: <20181222144708.121732-1-stephan@gerhold.net> MIME-Version: 1.0 Cc: Liam Girdwood , Hans de Goede , alsa-devel@alsa-project.org, Jie Yang , Stephan Gerhold Subject: [alsa-devel] [PATCH 2/2] ASoC: Intel: bytcr_rt5640: Add quirks for ASUS MeMO Pad 7 (ME176C) 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Add quirks to select the correct input map, jack-detect options and channel map to make sound work on the ASUS MeMO Pad 7 (ME176C). Note: Although sound works out of the box, jack detection currently requires overriding the ACPI DSDT table. This is necessary because the rt5640 ACPI device (10EC5640) has the wrong GPIO listed as interrupt (one of the Bluetooth GPIOs). The correct GPIO is GPO2 0x0004 (listed as the first GPIO in the Intel(R) Audio Machine Driver - AMCR0F28 device). Signed-off-by: Stephan Gerhold --- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c index a22366ce33c4..ca8b4d5ff70f 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -428,6 +428,18 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { BYT_RT5640_SSP0_AIF1 | BYT_RT5640_MCLK_EN), }, + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ME176C"), + }, + .driver_data = (void *)(BYT_RT5640_IN1_MAP | + BYT_RT5640_JD_SRC_JD2_IN4N | + BYT_RT5640_OVCD_TH_2000UA | + BYT_RT5640_OVCD_SF_0P75 | + BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, { .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),