From patchwork Mon May 8 09:18:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen M X-Patchwork-Id: 9717083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 290E560365 for ; Tue, 9 May 2017 06:04:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A16A28068 for ; Tue, 9 May 2017 06:04:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D8C028307; Tue, 9 May 2017 06:04:45 +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=-1.9 required=2.0 tests=BAYES_00, 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 4B6C628068 for ; Tue, 9 May 2017 06:04:44 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2D408266D18; Tue, 9 May 2017 08:03:26 +0200 (CEST) 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 ED888266C9B; Mon, 8 May 2017 11:19:38 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by alsa0.perex.cz (Postfix) with ESMTP id 2556D266A53 for ; Mon, 8 May 2017 11:19:35 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2017 02:19:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,308,1491289200"; d="scan'208";a="99023727" Received: from unknown (HELO localhost.localdomain) ([10.223.165.72]) by fmsmga006.fm.intel.com with ESMTP; 08 May 2017 02:19:32 -0700 From: Naveen M To: alsa-devel@alsa-project.org Date: Mon, 8 May 2017 14:48:58 +0530 Message-Id: <1494235140-29369-5-git-send-email-naveen.m@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494235140-29369-1-git-send-email-naveen.m@intel.com> References: <1494235140-29369-1-git-send-email-naveen.m@intel.com> X-Mailman-Approved-At: Tue, 09 May 2017 08:03:19 +0200 Cc: vinod.koul@intel.com, liam.r.girdwood@linux.intel.com, Harsha Priya , broonie@kernel.org, naveen.m@intel.com, pierre-louis.bossart@intel.com Subject: [alsa-devel] [PATCH 4/6] ASoC: Improve machine driver selection based on quirk data 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Use quirk function to select the correct machine driver by checking all codecs instead of only one based on quirk data. Signed-off-by: Naveen M Signed-off-by: Harsha Priya --- sound/soc/intel/common/sst-acpi.h | 19 +++++++++++++++++++ sound/soc/intel/common/sst-match-acpi.c | 18 ++++++++++++++++++ sound/soc/intel/skylake/skl.c | 22 +++++++++++++++------- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/sound/soc/intel/common/sst-acpi.h b/sound/soc/intel/common/sst-acpi.h index fbf010e..afe9b87 100644 --- a/sound/soc/intel/common/sst-acpi.h +++ b/sound/soc/intel/common/sst-acpi.h @@ -61,3 +61,22 @@ struct sst_acpi_mach { const void *quirk_data; void *pdata; }; + +#define SST_ACPI_MAX_CODECS 3 + +/** + * struct sst_codecs: Structure to hold secondary codec information apart from + * the matched one, this data will be passed to the quirk function to match + * with the ACPI detected devices + * + * @num_codecs: number of secondary codecs used in the platform + * @codecs: holds the codec IDs + * + */ +struct sst_codecs { + int num_codecs; + u8 codecs[SST_ACPI_MAX_CODECS][ACPI_ID_LEN]; +}; + +/* check all codecs */ +struct sst_acpi_mach *sst_acpi_codec_list(void *arg); diff --git a/sound/soc/intel/common/sst-match-acpi.c b/sound/soc/intel/common/sst-match-acpi.c index 88e4977..56d26f3 100644 --- a/sound/soc/intel/common/sst-match-acpi.c +++ b/sound/soc/intel/common/sst-match-acpi.c @@ -151,5 +151,23 @@ bool sst_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN], } EXPORT_SYMBOL_GPL(sst_acpi_find_package_from_hid); +struct sst_acpi_mach *sst_acpi_codec_list(void *arg) +{ + struct sst_acpi_mach *mach = arg; + struct sst_codecs *codec_list = (struct sst_codecs *) mach->quirk_data; + int i; + + if (mach->quirk_data == NULL) + return mach; + + for (i = 0; i < codec_list->num_codecs; i++) { + if (sst_acpi_check_hid(codec_list->codecs[i]) != true) + return NULL; + } + + return mach; +} +EXPORT_SYMBOL_GPL(sst_acpi_codec_list); + MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Intel Common ACPI Match module"); diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 1df4040..b9faa20 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -862,13 +862,19 @@ static void skl_remove(struct pci_dev *pci) dev_set_drvdata(&pci->dev, NULL); } +static struct sst_codecs skl_codecs = { 1, {"NAU88L25"} }; +static struct sst_codecs kbl_codecs = { 1, {"NAU88L25"} }; +static struct sst_codecs bxt_codecs = { 1, {"MX98357A"} }; + static struct sst_acpi_mach sst_skl_devdata[] = { { "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL, NULL, NULL, NULL }, { "INT343B", "skl_n88l25_s4567", "intel/dsp_fw_release.bin", NULL, - NULL, NULL, &skl_dmic_data }, + sst_acpi_codec_list, &skl_codecs, + &skl_dmic_data }, { "MX98357A", "skl_n88l25_m98357a", "intel/dsp_fw_release.bin", NULL, - NULL, NULL, &skl_dmic_data }, + sst_acpi_codec_list, &skl_codecs, + &skl_dmic_data }, {} }; @@ -876,16 +882,18 @@ static void skl_remove(struct pci_dev *pci) { "INT343A", "bxt_alc298s_i2s", "intel/dsp_fw_bxtn.bin", NULL, NULL, NULL, NULL }, { "DLGS7219", "bxt_da7219_max98357a_i2s", "intel/dsp_fw_bxtn.bin", NULL, - NULL, NULL, NULL }, + sst_acpi_codec_list, &bxt_codecs, NULL }, }; static struct sst_acpi_mach sst_kbl_devdata[] = { { "INT343A", "kbl_alc286s_i2s", "intel/dsp_fw_kbl.bin", NULL, NULL, NULL, NULL }, - { "INT343B", "kbl_n88l25_s4567", "intel/dsp_fw_kbl.bin", NULL, NULL, - NULL, &skl_dmic_data }, - { "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL, NULL, - NULL, &skl_dmic_data }, + { "INT343B", "kbl_n88l25_s4567", "intel/dsp_fw_kbl.bin", NULL, + sst_acpi_codec_list, &kbl_codecs, + &skl_dmic_data }, + { "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL, + sst_acpi_codec_list, &kbl_codecs, + &skl_dmic_data }, {} };