From patchwork Wed May 24 17:41:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9746665 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 291416034C for ; Wed, 24 May 2017 17:52:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C10D2892E for ; Wed, 24 May 2017 17:52:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10FD8289AD; Wed, 24 May 2017 17:52:35 +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 41B242892E for ; Wed, 24 May 2017 17:52:34 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C7926267227; Wed, 24 May 2017 19:41:37 +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 5A223266C44; Wed, 24 May 2017 19:41:33 +0200 (CEST) Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id A855E266C0A for ; Wed, 24 May 2017 19:41:30 +0200 (CEST) Received: from [2001:470:1f1d:6b5::3] (helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dDaHk-0004uZ-Bp; Wed, 24 May 2017 17:41:26 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1dDaHh-0002hx-KJ; Wed, 24 May 2017 18:41:21 +0100 From: Mark Brown To: Naveen M In-Reply-To: <1494505944-31378-5-git-send-email-naveen.m@intel.com> Message-Id: Date: Wed, 24 May 2017 18:41:21 +0100 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: alsa-devel@alsa-project.org, Harsha Priya , liam.r.girdwood@linux.intel.com, vinod.koul@intel.com, broonie@kernel.org, tiwai@suse.de, naveen.m@intel.com, pierre-louis.bossart@intel.com Subject: [alsa-devel] Applied "ASoC: Improve machine driver selection based on quirk data" to the asoc tree 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 The patch ASoC: Improve machine driver selection based on quirk data has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 54746dabf770eb268d302f2f770d6dacea24f08a Mon Sep 17 00:00:00 2001 From: Naveen M Date: Mon, 15 May 2017 13:42:15 +0530 Subject: [PATCH] ASoC: Improve machine driver selection based on quirk data 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 Acked-by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/intel/common/sst-acpi.h | 20 ++++++++++++++++++++ sound/soc/intel/common/sst-match-acpi.c | 18 ++++++++++++++++++ sound/soc/intel/skylake/skl.c | 14 ++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/sound/soc/intel/common/sst-acpi.h b/sound/soc/intel/common/sst-acpi.h index 3649d3b08c9e..afe9b87b8bd5 100644 --- a/sound/soc/intel/common/sst-acpi.h +++ b/sound/soc/intel/common/sst-acpi.h @@ -58,5 +58,25 @@ struct sst_acpi_mach { /* board name */ const char *board; struct sst_acpi_mach * (*machine_quirk)(void *arg); + 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 88e4977578b5..56d26f36a3cb 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 a4d1121595b6..ceb7734d74ed 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -876,6 +876,10 @@ 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[] = { { .id = "INT343A", @@ -886,12 +890,16 @@ static struct sst_acpi_mach sst_skl_devdata[] = { .id = "INT343B", .drv_name = "skl_n88l25_s4567", .fw_filename = "intel/dsp_fw_release.bin", + .machine_quirk = sst_acpi_codec_list, + .quirk_data = &skl_codecs, .pdata = &skl_dmic_data }, { .id = "MX98357A", .drv_name = "skl_n88l25_m98357a", .fw_filename = "intel/dsp_fw_release.bin", + .machine_quirk = sst_acpi_codec_list, + .quirk_data = &skl_codecs, .pdata = &skl_dmic_data }, {} @@ -907,6 +915,8 @@ static struct sst_acpi_mach sst_bxtp_devdata[] = { .id = "DLGS7219", .drv_name = "bxt_da7219_max98357a_i2s", .fw_filename = "intel/dsp_fw_bxtn.bin", + .machine_quirk = sst_acpi_codec_list, + .quirk_data = &bxt_codecs, }, }; @@ -920,12 +930,16 @@ static struct sst_acpi_mach sst_kbl_devdata[] = { .id = "INT343B", .drv_name = "kbl_n88l25_s4567", .fw_filename = "intel/dsp_fw_kbl.bin", + .machine_quirk = sst_acpi_codec_list, + .quirk_data = &kbl_codecs, .pdata = &skl_dmic_data }, { .id = "MX98357A", .drv_name = "kbl_n88l25_m98357a", .fw_filename = "intel/dsp_fw_kbl.bin", + .machine_quirk = sst_acpi_codec_list, + .quirk_data = &kbl_codecs, .pdata = &skl_dmic_data }, {}