From patchwork Mon Aug 29 06:23:25 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: 9304219 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 D974B60756 for ; Mon, 29 Aug 2016 17:40:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDF6C288E2 for ; Mon, 29 Aug 2016 17:40:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2B08288E5; Mon, 29 Aug 2016 17:40:54 +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 187D8288E2 for ; Mon, 29 Aug 2016 17:40:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2CD17267832; Mon, 29 Aug 2016 19:40:53 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B8152266E69; Mon, 29 Aug 2016 18:43: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 28B40266E5F; Mon, 29 Aug 2016 18:43:23 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 1779E266E64 for ; Mon, 29 Aug 2016 18:23:44 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP; 28 Aug 2016 23:29:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,595,1464678000"; d="scan'208";a="2203718" Received: from subhransu-desktop.iind.intel.com ([10.223.96.24]) by orsmga004.jf.intel.com with ESMTP; 28 Aug 2016 23:29:24 -0700 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Mon, 29 Aug 2016 11:53:25 +0530 Message-Id: <1472451806-10605-12-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472451806-10605-1-git-send-email-subhransu.s.prusty@intel.com> References: <1472451806-10605-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 11/12] 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 | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h index b9593b2..42c2fa6 100644 --- a/include/sound/hdaudio_ext.h +++ b/include/sound/hdaudio_ext.h @@ -217,6 +217,7 @@ struct hdac_ext_device { struct snd_card *card; void *scodec; void *private_data; + 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 31b510c..c5ca488 100644 --- a/sound/hda/ext/hdac_ext_bus.c +++ b/sound/hda/ext/hdac_ext_bus.c @@ -235,6 +235,17 @@ 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); + + edev->id_entry = hdac_get_device_id(dev, drv); + if (edev->id_entry) + return 1; + else + return 0; +} + /** * snd_hda_ext_driver_register - register a driver for ext hda devices * @@ -244,6 +255,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)