summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_codec.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-10-01 17:20:04 +0300
committerTakashi Iwai <tiwai@suse.de>2015-10-20 11:15:20 +0300
commitb9a94a9c787d053e8d3bb7e7dff9648e723a4533 (patch)
tree5aa9dc1c591e16d5eb6a1e99d03f2d57bac5d90f /sound/pci/hda/hda_codec.h
parent78abb2afaf3d7635e9b1770c50e50b59820c4e5d (diff)
downloadlinux-b9a94a9c787d053e8d3bb7e7dff9648e723a4533.tar.xz
ALSA: hda - convert to hda_device_id
Finally we have a proper infrastructure to generate the modaliases automatically, let's move to hda_device_id from the legacy hda_codec_preset that contains basically the same information. The patch function hook is stored in driver_data field, which is long, and we need an explicit cast. Other than that, the conversion is mostly straightforward. Each entry is even simplified using a macro, and the lengthy (and error-prone) manual modaliases got removed. As a result, we achieved a quite good diet: 14 files changed, 407 insertions(+), 595 deletions(-) Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.h')
-rw-r--r--sound/pci/hda/hda_codec.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 891864ac60f5..055a80522282 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -22,6 +22,7 @@
#define __SOUND_HDA_CODEC_H
#include <linux/kref.h>
+#include <linux/mod_devicetable.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/pcm.h>
@@ -80,19 +81,21 @@ struct hda_bus {
* Known codecs have the patch to build and set up the controls/PCMs
* better than the generic parser.
*/
-struct hda_codec_preset {
- unsigned int id;
- unsigned int rev;
- const char *name;
- int (*patch)(struct hda_codec *codec);
-};
+typedef int (*hda_codec_patch_t)(struct hda_codec *);
#define HDA_CODEC_ID_GENERIC_HDMI 0x00000101
#define HDA_CODEC_ID_GENERIC 0x00000201
+#define HDA_CODEC_REV_ENTRY(_vid, _rev, _name, _patch) \
+ { .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \
+ .api_version = HDA_DEV_LEGACY, \
+ .driver_data = (unsigned long)(_patch) }
+#define HDA_CODEC_ENTRY(_vid, _name, _patch) \
+ HDA_CODEC_REV_ENTRY(_vid, 0, _name, _patch)
+
struct hda_codec_driver {
struct hdac_driver core;
- const struct hda_codec_preset *preset;
+ const struct hda_device_id *id;
};
int __hda_codec_driver_register(struct hda_codec_driver *drv, const char *name,
@@ -183,7 +186,7 @@ struct hda_codec {
u32 probe_id; /* overridden id for probing */
/* detected preset */
- const struct hda_codec_preset *preset;
+ const struct hda_device_id *preset;
const char *modelname; /* model name for preset */
/* set by patch */