From patchwork Thu Feb 4 20:48:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 12068749 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=-21.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 CE9C6C433E6 for ; Thu, 4 Feb 2021 20:50:47 +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 B433F64F87 for ; Thu, 4 Feb 2021 20:50:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B433F64F87 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 167EB1680; Thu, 4 Feb 2021 21:49:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 167EB1680 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1612471845; bh=neYa6J9NY/EwoXcDAt7kNUCbNEws08vXq61eZ4+Jp68=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dkyrlqjBkHjqMFOVYcaXs7VK34hmo6NqXpf+A0mf1mgZ04R6dHckXepw1hKVY+sWU euHe2h/r5pf/mwrnB7RyAx1jqgngeQHdhpoJpZTzCPRXEdpbm0H0JtFnwjgbi+dZ2/ EIxSHQTUQj1TCBfmTUbcEblNh4Qa3gQb/05PbnsQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6D287F80264; Thu, 4 Feb 2021 21:49:03 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DB7DCF8023E; Thu, 4 Feb 2021 21:49:01 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6E321F80152 for ; Thu, 4 Feb 2021 21:48:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6E321F80152 IronPort-SDR: BKp5myQu30aSLV2WRROgsCCjG+JnQAHv9fz9w7wG/USlikwMZgATZdjjAbXMCVQMW3PquMZCIN thSqmdGoTZSQ== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="168443574" X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="168443574" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 12:48:55 -0800 IronPort-SDR: Mlz4acP/sp70etRccqwsQLR+OXYf78umqL18yE4tI/B7oG9pON8iurer2z4gMi8QyANlDFsh0p VYcxQapNE1Pw== X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="415504496" Received: from zyi-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.188.47]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 12:48:52 -0800 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org, srinivas.kandagatla@linaro.org Subject: [PATCH 1/2] soundwire: slave: introduce DMI quirks for HP Spectre x360 Convertible Date: Thu, 4 Feb 2021 14:48:36 -0600 Message-Id: <20210204204837.27876-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204204837.27876-1-pierre-louis.bossart@linux.intel.com> References: <20210204204837.27876-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Kai Vehmanen , Guennadi Liakhovetski , tiwai@suse.de, gregkh@linuxfoundation.org, Pierre-Louis Bossart , vkoul@kernel.org, broonie@kernel.org, Bard liao , Rander Wang , Bard Liao 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" HP Spectre x360 Convertible devices expose invalid _ADR fields in the DSDT, which prevents codec drivers from probing. A possible solution is to override the DSDT, but that's just too painful for users. This patch suggests a simple DMI-based quirk to remap the existing invalid ADR information into valid ones. BugLink: https://github.com/thesofproject/linux/issues/2700 Co-developed-by: Bard Liao Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart Reviewed-by: Kai Vehmanen Reviewed-by: Bard Liao Reviewed-by: Guennadi Liakhovetski Signed-off-by: Vinod Koul --- drivers/soundwire/slave.c | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index 180f38bd003b..abdc1ae94e9c 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -2,6 +2,7 @@ // Copyright(c) 2015-17 Intel Corporation. #include +#include #include #include #include @@ -91,10 +92,44 @@ int sdw_slave_add(struct sdw_bus *bus, #if IS_ENABLED(CONFIG_ACPI) +struct adr_remap { + u64 adr; + u64 remapped_adr; +}; + +/* + * HP Spectre 360 Convertible devices do not expose the correct _ADR + * in the DSDT. + * Remap the bad _ADR values to the ones reported by hardware + */ +static const struct adr_remap hp_spectre_360[] = { + { + 0x000010025D070100, + 0x000020025D071100 + }, + { + 0x000110025d070100, + 0x000120025D130800 + }, + {} +}; + +static const struct dmi_system_id adr_remap_quirk_table[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Convertible"), + }, + .driver_data = (void *)hp_spectre_360, + }, + {} +}; + static bool find_slave(struct sdw_bus *bus, struct acpi_device *adev, struct sdw_slave_id *id) { + const struct dmi_system_id *dmi_id; unsigned long long addr; unsigned int link_id; acpi_status status; @@ -108,6 +143,21 @@ static bool find_slave(struct sdw_bus *bus, return false; } + /* check if any address remap quirk applies */ + dmi_id = dmi_first_match(adr_remap_quirk_table); + if (dmi_id) { + struct adr_remap *map = dmi_id->driver_data; + + for (map = dmi_id->driver_data; map->adr; map++) { + if (map->adr == addr) { + dev_dbg(bus->dev, "remapped _ADR 0x%llx as 0x%llx\n", + addr, map->remapped_adr); + addr = map->remapped_adr; + break; + } + } + } + /* Extract link id from ADR, Bit 51 to 48 (included) */ link_id = SDW_DISCO_LINK_ID(addr); From patchwork Thu Feb 4 20:48:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 12068751 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.7 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=ham 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 99D04C433E0 for ; Thu, 4 Feb 2021 20:50:56 +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 C85A564F87 for ; Thu, 4 Feb 2021 20:50:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C85A564F87 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 79D301671; Thu, 4 Feb 2021 21:50:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 79D301671 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1612471853; bh=o7X8NX2FTMz+6G4kKvSg5ojVZlE228oLzc3yg+ypjY8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=C/v221dpoXWedn3IuITw50aKoqCfDU9t+oyE0MHOxaouScB5fY9m3UGJQsq5TFjK+ Gdg+5xOx2C6iXUN0JyFi4ElxF8mpYiz+fGHBlKkX6yn4oSuYWML8mTaH92rrYuhdU4 8RKQDFBJy2mnkDSxNbhq/1OlotRDcr3D7bnNlra4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7EE67F80277; Thu, 4 Feb 2021 21:49:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EAEF9F8025D; Thu, 4 Feb 2021 21:49:02 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D1A7AF80171 for ; Thu, 4 Feb 2021 21:48:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D1A7AF80171 IronPort-SDR: cEqkijP2/bMbjas3frJAdGC1WyXUW3vuou9JgmRusFp99e05wGzTttBRc2kpc9wkqusULKClaM O910wXx7ptjA== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="168443578" X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="168443578" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 12:48:56 -0800 IronPort-SDR: bFsOU9ei1WGaxcMSH/4DJHi/V9enSeFO48vus9tjkKTnpx0SgCCKBozfZHtuKT7d1tpj4rxA+X 11utcWmLBWkg== X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="415504501" Received: from zyi-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.188.47]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 12:48:54 -0800 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org, srinivas.kandagatla@linaro.org Subject: [PATCH 2/2] soundwire: slave: add DMI quirk for Dell SKU 0A3E Date: Thu, 4 Feb 2021 14:48:37 -0600 Message-Id: <20210204204837.27876-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204204837.27876-1-pierre-louis.bossart@linux.intel.com> References: <20210204204837.27876-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Kai Vehmanen , Guennadi Liakhovetski , tiwai@suse.de, gregkh@linuxfoundation.org, Pierre-Louis Bossart , vkoul@kernel.org, broonie@kernel.org, Bard liao , Rander Wang , Bard Liao 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" We've been handling ACPI issues on early versions of the product with a local ACPI initrd override but now that we have the possibility of a kernel quirk let's get rid of the initrd override. This helps make sure that the kernel will support all versions of the BIOS, with or without updates. Co-developed-by: Bard Liao Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart Reviewed-by: Kai Vehmanen Reviewed-by: Bard Liao Reviewed-by: Guennadi Liakhovetski --- drivers/soundwire/slave.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index abdc1ae94e9c..e3c4cf252cb7 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -114,6 +114,28 @@ static const struct adr_remap hp_spectre_360[] = { {} }; +/* + * The initial version of the Dell SKU 0A3E did not expose the devices on the correct links. + */ +static const struct adr_remap dell_sku_0A3E[] = { + /* rt715 on link0 */ + { + 0x00020025d071100, + 0x00021025d071500 + }, + /* rt711 on link1 */ + { + 0x000120025d130800, + 0x000120025d071100, + }, + /* rt1308 on link2 */ + { + 0x000220025d071500, + 0x000220025d130800 + }, + {} +}; + static const struct dmi_system_id adr_remap_quirk_table[] = { { .matches = { @@ -122,6 +144,13 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { }, .driver_data = (void *)hp_spectre_360, }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A3E") + }, + .driver_data = (void *)dell_sku_0A3E, + }, {} };