[alsa-devel] [PATCH 11/12] ALSA: hdac: Implement a match function

Subhransu S. Prusty subhransu.s.prusty at intel.com
Mon Aug 29 08:23:25 CEST 2016


Ext driver match function will be used to apply any hdac device
specific quirks.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty at intel.com>
Signed-off-by: Vinod Koul <vinod.koul at intel.com>
---
 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)
-- 
1.9.1



More information about the Alsa-devel mailing list