From patchwork Fri Dec 1 09:14:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ughreja, Rakesh A" X-Patchwork-Id: 10086581 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 481E66035E for ; Fri, 1 Dec 2017 09:11:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B2EB2A4BB for ; Fri, 1 Dec 2017 09:11:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 301092A4C3; Fri, 1 Dec 2017 09:11:56 +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 416F32A4BB for ; Fri, 1 Dec 2017 09:11:55 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F213C267C11; Fri, 1 Dec 2017 10:10: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 38CEA267C36; Fri, 1 Dec 2017 10:10:27 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by alsa0.perex.cz (Postfix) with ESMTP id 09D67267C0E for ; Fri, 1 Dec 2017 10:09:57 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Dec 2017 01:09:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,344,1508828400"; d="scan'208";a="154983585" Received: from raughrej-desk.iind.intel.com ([10.223.84.131]) by orsmga004.jf.intel.com with ESMTP; 01 Dec 2017 01:09:54 -0800 From: Rakesh Ughreja To: alsa-devel@alsa-project.org, broonie@kernel.org, tiwai@suse.de, liam.r.girdwood@linux.intel.com Date: Fri, 1 Dec 2017 14:44:00 +0530 Message-Id: <1512119648-2700-3-git-send-email-rakesh.a.ughreja@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512119648-2700-1-git-send-email-rakesh.a.ughreja@intel.com> References: <1512119648-2700-1-git-send-email-rakesh.a.ughreja@intel.com> Cc: vinod.koul@intel.com, patches.audio@intel.com, Rakesh Ughreja , pierre-louis.bossart@linux.intel.com Subject: [alsa-devel] [RFC 02/10] ASoC: Intel: Skylake: Add entry in sst_acpi_mach for HDA codecs 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 When no I2S based codecs are detected in the BIOS, check if there are any HDA codecs present. If yes, load the corresponding machine driver. TODO: support for detecting the presence of HDA codec is not implemented. it will be implemented in the next revision. Signed-off-by: Rakesh Ughreja --- sound/soc/intel/skylake/skl.c | 46 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 27462c0..568a285 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -424,6 +424,26 @@ static int skl_free(struct hdac_bus *bus) return 0; } +static struct snd_soc_acpi_mach *skl_probe_hda_machine( + struct snd_soc_acpi_mach *machines) +{ + + struct snd_soc_acpi_mach *mach; + + /* + * FIXME: + * First check if there are any HDA codecs present on the system + * then search the match table. + * For now this function is not detecting the presence of any + * HDA codecs. + */ + for (mach = machines; mach->id[0]; mach++) { + if (!strcmp(mach->id, "HDA_GEN")) + return mach; + } + return NULL; +} + static int skl_machine_device_register(struct skl *skl, void *driver_data) { struct hdac_bus *bus = skl_to_bus(skl); @@ -433,9 +453,14 @@ static int skl_machine_device_register(struct skl *skl, void *driver_data) mach = snd_soc_acpi_find_machine(mach); if (mach == NULL) { - dev_err(bus->dev, "No matching machine driver found\n"); - return -ENODEV; + dev_dbg(bus->dev, "No matching I2S machine driver found\n"); + mach = skl_probe_hda_machine(driver_data); + if (mach == NULL) { + dev_err(bus->dev, "No matching machine driver found\n"); + return -ENODEV; + } } + skl->fw_name = mach->fw_filename; pdev = platform_device_alloc(mach->drv_name, -1); @@ -911,6 +936,14 @@ static struct snd_soc_acpi_mach sst_skl_devdata[] = { .quirk_data = &skl_codecs, .pdata = &skl_dmic_data }, + { + .id = "HDA_GEN", + .drv_name = "skl_hda_generic", + .fw_filename = "intel/dsp_fw_release.bin", + .machine_quirk = NULL, + .quirk_data = NULL, + .pdata = NULL + }, {} }; @@ -973,7 +1006,14 @@ static struct snd_soc_acpi_mach sst_kbl_devdata[] = { .drv_name = "kbl_rt5663", .fw_filename = "intel/dsp_fw_kbl.bin", }, - + { + .id = "HDA_GEN", + .drv_name = "skl_hda_generic", + .fw_filename = "intel/dsp_fw_kbl.bin", + .machine_quirk = NULL, + .quirk_data = NULL, + .pdata = NULL + }, {} };