From patchwork Fri Sep 2 11:04:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Subhransu S. Prusty" X-Patchwork-Id: 9311353 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 3E55160756 for ; Fri, 2 Sep 2016 16:06:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 303D1297E3 for ; Fri, 2 Sep 2016 16:06:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 246B6297E5; Fri, 2 Sep 2016 16:06:26 +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 DBDAD297E3 for ; Fri, 2 Sep 2016 16:06:23 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0EAF6267951; Fri, 2 Sep 2016 18:06:18 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5B58C26768F; Fri, 2 Sep 2016 16:15:23 +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 CA15826768F; Fri, 2 Sep 2016 16:15:21 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by alsa0.perex.cz (Postfix) with ESMTP id 169DB26809A for ; Fri, 2 Sep 2016 13:10:59 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 02 Sep 2016 04:10:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,270,1470726000"; d="scan'208";a="756489713" Received: from subhransu-desktop.iind.intel.com ([10.223.96.24]) by FMSMGA003.fm.intel.com with ESMTP; 02 Sep 2016 04:10:57 -0700 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Fri, 2 Sep 2016 16:34:59 +0530 Message-Id: <1472814300-5629-11-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472814300-5629-1-git-send-email-subhransu.s.prusty@intel.com> References: <1472814300-5629-1-git-send-email-subhransu.s.prusty@intel.com> Cc: tiwai@suse.de, lgirdwood@gmail.com, patches.audio@intel.com, broonie@kernel.org, Vinod Koul , "Subhransu S. Prusty" Subject: [alsa-devel] [PATCH v2 10/11] ALSA: hdac: Implement a match function 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 Ext driver match function will be used to apply any hdac device specific quirks. Signed-off-by: Subhransu S. Prusty Signed-off-by: Vinod Koul --- include/sound/hdaudio_ext.h | 1 + sound/hda/ext/hdac_ext_bus.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h index 2113765..c182114 100644 --- a/include/sound/hdaudio_ext.h +++ b/include/sound/hdaudio_ext.h @@ -248,6 +248,7 @@ struct hdac_ext_device { void *private_data; struct list_head widget_list; + const struct hda_device_id *id_entry; }; struct hdac_ext_dma_params { diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c index 85ccc18..f156884 100644 --- a/sound/hda/ext/hdac_ext_bus.c +++ b/sound/hda/ext/hdac_ext_bus.c @@ -246,6 +246,18 @@ static void hdac_ext_drv_shutdown(struct device *dev) return (get_edrv(dev))->shutdown(get_edev(dev)); } +static int hdac_ext_drv_match(struct hdac_device *dev, struct hdac_driver *drv) +{ + struct hdac_ext_device *edev = get_edev(&dev->dev); + const struct hda_device_id *id_entry = hdac_get_device_id(dev, drv); + + if (id_entry) { + edev->id_entry = id_entry; + return 1; + } else + return 0; +} + /** * snd_hda_ext_driver_register - register a driver for ext hda devices * @@ -255,6 +267,7 @@ int snd_hda_ext_driver_register(struct hdac_ext_driver *drv) { drv->hdac.type = HDA_DEV_ASOC; drv->hdac.driver.bus = &snd_hda_bus_type; + drv->hdac.match = hdac_ext_drv_match; /* we use default match */ if (drv->probe)