HD-audio modalias support patchset
cover HD-audio modalias support patchset
Hi,
this is a patchset to add the support of automatic modalias creation for HD-audio codec drivers like other standard drivers. Currently, the HDA codec driver has put module alias manually due to ugly historical reasons. This patch finally moves to the saner way.
Also it adds the udev modalias support so that it can be autoloaded in udev.
The patchset was initiated by Intel people for SKL ASoC drivers. Now I brushed up and made it working for legacy drivers.
The current patchset is found in topic/hda-modalias branch of sound git tree, too.
thanks,
Takashi
===
Subhransu S. Prusty (2):
ALSA: hda - Add hduadio support to DEVTABLE
ALSA: hda - Add hdaudio bus modalias support
Takashi Iwai (3):
ALSA: hda - Add api_version to hda_device_id struct
ALSA: hda - Add a common helper to give the codec modalias string
ALSA: hda - convert to hda_device_id
Thierry Reding (1):
ALSA: hda - Advertise MODALIAS in uevent
include/linux/mod_devicetable.h | 8 ++ include/sound/hdaudio.h | 12 +-- scripts/mod/devicetable-offsets.c | 5 + scripts/mod/file2alias.c | 17 +++ sound/hda/hda_bus_type.c | 13 +++ sound/hda/hdac_device.c | 15 +++ sound/hda/hdac_sysfs.c | 8 ++ sound/pci/hda/hda_bind.c | 32 +++--- sound/pci/hda/hda_codec.h | 19 ++-- sound/pci/hda/hda_generic.c | 7 +- sound/pci/hda/patch_analog.c | 37 ++++--- sound/pci/hda/patch_ca0110.c | 15 ++- sound/pci/hda/patch_ca0132.c | 9 +- sound/pci/hda/patch_cirrus.c | 21 ++-- sound/pci/hda/patch_cmedia.c | 15 ++- sound/pci/hda/patch_conexant.c | 118 ++++++--------------- sound/pci/hda/patch_hdmi.c | 201 +++++++++++++---------------------- sound/pci/hda/patch_realtek.c | 122 ++++++++++------------ sound/pci/hda/patch_si3054.c | 39 +++---- sound/pci/hda/patch_sigmatel.c | 214 +++++++++++++++++++------------------- sound/pci/hda/patch_via.c | 153 ++++++++++----------------- 21 files changed, 475 insertions(+), 605 deletions(-)
Signature · 1 line
2.6.1
PATCH 1/6 ALSA: hda - Add api_version to hda_device_id struct
For distinguishing the difference between HDA legacy and ext codec driver entries, we need to expose the value corresponding to type field. This patch adds a new field, api_version, to hda_device_id struct, so that this information is embedded in modalias string.
Although the information is basically redundant (struct hdac_device already has type field), the helper that extracts from MODULE_DEVICE_TABLE() won't take it account except for the exported table entries themselves. So we need to put the same information in the table, too.
--- include/sound/hdaudio.h | 1 + 1 file changed, 1 insertion(+)
include/sound/hdaudio.h +1 -0
@@ -33,6 +33,7 @@ extern struct bus_type snd_hda_bus_type;struct hda_device_id {__u32 vendor_id;__u32 rev_id; +__u8 api_version;const char *name;unsigned long driver_data; };
Signature · 1 line
2.6.1
PATCH 2/6 ALSA: hda - Add hduadio support to DEVTABLE
In reply to Takashi IwaiFrom: "Subhransu S. Prusty" <[email protected]>
For generating modalias entries automatically, move the definition of struct hda_device_id to linux/mod_devicetable.h and add the handling of this record in file2alias helper. The new modalias is represented with combination of vendor id, device id, and api version as "hdaudio:vNrNaN".
This patch itself doesn't convert the existing modaliases. Since they were added manually, this patch won't give any regression by itself at this point.
[Modified the modalias format to adapt the api_version field, and drop
invalid ANY_ID definition by tiwai]
--- include/linux/mod_devicetable.h | 8 ++++++++ include/sound/hdaudio.h | 12 +----------- scripts/mod/devicetable-offsets.c | 5 +++++ scripts/mod/file2alias.c | 17 +++++++++++++++++ sound/hda/hda_bus_type.c | 1 + 5 files changed, 32 insertions(+), 11 deletions(-)
include/linux/mod_devicetable.h +8 -0
@@ -219,6 +219,14 @@ struct serio_device_id {__u8 proto; }; +struct hda_device_id { +__u32 vendor_id; +__u32 rev_id; +__u8 api_version; +const char *name; +unsigned long driver_data; +}; +/* * Struct used for matching a device */
include/sound/hdaudio.h +1 -11
@@ -21,6 +21,7 @@ struct hdac_stream;struct hdac_device ;struct hdac_driver ;struct hdac_widget_tree ; +struct hda_device_id ;/* * exported bus type
@@ -28,17 +29,6 @@ struct hdac_widget_tree;extern struct bus_type snd_hda_bus_type;/* -* HDA device table -*/ -struct hda_device_id { -__u32 vendor_id; -__u32 rev_id; -__u8 api_version; -const char *name; -unsigned long driver_data; -}; - -/* * generic arrays */ struct snd_array {
scripts/mod/devicetable-offsets.c +5 -0
@@ -196,5 +196,10 @@ int main(void)DEVID_FIELD (ulpi_device_id, vendor);DEVID_FIELD (ulpi_device_id, product); +DEVID (hda_device_id); +DEVID_FIELD (hda_device_id, vendor_id); +DEVID_FIELD (hda_device_id, rev_id); +DEVID_FIELD (hda_device_id, api_version); +return 0 ; }
scripts/mod/file2alias.c +17 -0
@@ -1250,6 +1250,23 @@ static int do_ulpi_entry(const char *filename, void *symval, }ADD_TO_DEVTABLE ("ulpi" , ulpi_device_id, do_ulpi_entry); +/* Looks like: hdaudio:vNrNaN */ +static int do_hda_entry (const char *filename,void *symval,char *alias) +{ +DEF_FIELD (symval, hda_device_id, vendor_id); +DEF_FIELD (symval, hda_device_id, rev_id); +DEF_FIELD (symval, hda_device_id, api_version); + +strcpy (alias,"hdaudio:" ); +ADD (alias,"v" , vendor_id !=0 , vendor_id); +ADD (alias,"r" , rev_id !=0 , rev_id); +ADD (alias,"a" , api_version !=0 , api_version); + +add_wildcard (alias); +return 1 ; +} +ADD_TO_DEVTABLE ("hdaudio" , hda_device_id, do_hda_entry); +/* Does namelen bytes of name exactly match the symbol? */ static bool sym_is (const char *name,unsigned namelen,const char *symbol) {
sound/hda/hda_bus_type.c +1 -0
@@ -4,6 +4,7 @@#include <linux/init.h> #include <linux/device.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/export.h> #include <sound/hdaudio.h>
Signature · 1 line
2.6.1
PATCH 3/6 ALSA: hda - Add a common helper to give the codec modalias string
In reply to Takashi IwaiThis patch provide a new common helper function, snd_hdac_codec_modalias(), to give the codec modalias name string. This function will be used by multiple places in the later patches.
--- include/sound/hdaudio.h | 1 + sound/hda/hdac_device.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+)
include/sound/hdaudio.h +1 -0
@@ -109,6 +109,7 @@ void snd_hdac_device_exit(struct hdac_device *dev);int snd_hdac_device_register (struct hdac_device *codec);void snd_hdac_device_unregister (struct hdac_device *codec);int snd_hdac_device_set_chip_name (struct hdac_device *codec,const char *name); +int snd_hdac_codec_modalias (struct hdac_device *hdac,char *buf,size_t size);int snd_hdac_refresh_widgets (struct hdac_device *codec);int snd_hdac_refresh_widget_sysfs (struct hdac_device *codec);
sound/hda/hdac_device.c +15 -0
@@ -186,6 +186,21 @@ int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name)EXPORT_SYMBOL_GPL (snd_hdac_device_set_chip_name);/** +* snd_hdac_codec_modalias - give the module alias name +* @codec: HDAC device +* @buf: string buffer to store +* @size: string buffer size +* +* Returns the size of string, like snprintf(), or a negative error code. +*/ +int snd_hdac_codec_modalias (struct hdac_device *codec,char *buf,size_t size) +{ +return snprintf (buf, size,"hdaudio:v%08Xr%08Xa%02X\n" , + codec->vendor_id, codec->revision_id, codec->type); +} +EXPORT_SYMBOL_GPL (snd_hdac_codec_modalias); + +/** * snd_hdac_make_cmd - compose a 32bit command word to be sent to the * HD-audio controller * @codec: the codec object
Signature · 1 line
2.6.1
PATCH 4/6 ALSA: hda - Add hdaudio bus modalias support
In reply to Takashi IwaiFrom: "Subhransu S. Prusty" <[email protected]>
This patch just adds modalias sysfs entry to each hdaudio bus entry.
[rewritten to call the common helper function by tiwai]
--- sound/hda/hdac_sysfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/hda/hdac_sysfs.c +8 -0
@@ -45,6 +45,13 @@ CODEC_ATTR(mfg);CODEC_ATTR_STR (vendor_name);CODEC_ATTR_STR (chip_name); +static ssize_t modalias_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +return snd_hdac_codec_modalias (dev_to_hdac_dev (dev), buf,256 ); +} +static DEVICE_ATTR_RO (modalias); +static struct attribute *hdac_dev_attrs[] = { &dev_attr_type.attr, &dev_attr_vendor_id.attr,
@@ -54,6 +61,7 @@ static struct attribute *hdac_dev_attrs[] = { &dev_attr_mfg.attr, &dev_attr_vendor_name.attr, &dev_attr_chip_name.attr, + &dev_attr_modalias.attr, NULL };
Signature · 1 line
2.6.1
PATCH 5/6 ALSA: hda - convert to hda_device_id
In reply to Takashi IwaiFinally 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(-)
--- sound/pci/hda/hda_bind.c | 32 +++--- sound/pci/hda/hda_codec.h | 19 ++-- sound/pci/hda/hda_generic.c | 7 +- sound/pci/hda/patch_analog.c | 37 ++++--- sound/pci/hda/patch_ca0110.c | 15 ++- sound/pci/hda/patch_ca0132.c | 9 +- sound/pci/hda/patch_cirrus.c | 21 ++-- sound/pci/hda/patch_cmedia.c | 15 ++- sound/pci/hda/patch_conexant.c | 118 ++++++----------------- sound/pci/hda/patch_hdmi.c | 201 ++++++++++++++------------------------ sound/pci/hda/patch_realtek.c | 122 +++++++++++------------ sound/pci/hda/patch_si3054.c | 39 +++----- sound/pci/hda/patch_sigmatel.c | 214 ++++++++++++++++++++--------------------- sound/pci/hda/patch_via.c | 153 +++++++++++------------------ 14 files changed, 407 insertions(+), 595 deletions(-)
sound/pci/hda/hda_bind.c +18 -14
@@ -15,21 +15,22 @@#include "hda_local.h" /* -* find a matching codec preset +* find a matching codec id */ static int hda_codec_match (struct hdac_device *dev,struct hdac_driver *drv) { struct hda_codec *codec = container_of(dev, struct hda_codec, core);struct hda_codec_driver *driver = container_of(drv, struct hda_codec_driver, core); -const struct hda_codec_preset *preset; +const struct hda_device_id *list;/* check probe_id instead of vendor_id if set */ u32 id = codec->probe_id ? codec->probe_id : codec->core.vendor_id; +u32 rev_id = codec->core.revision_id; -for (preset = driver->preset; preset->id; preset++) { -if (preset->id == id && - (!preset->rev || preset->rev == codec->core.revision_id)) { - codec->preset = preset; +for (list = driver->id; list->vendor_id; list++) { +if (list->vendor_id == id && + (!list->rev_id || list->rev_id == rev_id)) { + codec->preset = list;return 1 ; } }
@@ -77,6 +78,7 @@ static int hda_codec_driver_probe(struct device *dev) {struct hda_codec *codec =dev_to_hda_codec (dev);struct module *owner = dev->driver->owner; +hda_codec_patch_t patch;int err;if (WARN_ON (!codec->preset))
@@ -94,9 +96,12 @@ static int hda_codec_driver_probe(struct device *dev) goto error; } - err = codec->preset->patch (codec); -if (err <0 ) - goto error_module; + patch = (hda_codec_patch_t )codec->preset->driver_data; +if (patch) { + err =patch (codec); +if (err <0 ) + goto error_module; + } err =snd_hda_codec_build_pcms (codec);if (err <0 )
@@ -173,11 +178,10 @@ static inline bool codec_probed(struct hda_codec *codec)static void codec_bind_module (struct hda_codec *codec) {#ifdef MODULE -request_module ("snd-hda-codec-id:%08x" , codec->core.vendor_id); -if (codec_probed (codec)) -return ; -request_module ("snd-hda-codec-id:%04x*" , - (codec->core.vendor_id >>16 ) &0xffff ); +char modalias[32 ]; + +snd_hdac_codec_modalias (&codec->core, modalias,sizeof (modalias)); +request_module (modalias);if (codec_probed (codec))return ;#endif
sound/pci/hda/hda_codec.h +11 -8
@@ -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 */
sound/pci/hda/hda_generic.c +4 -3
@@ -5877,13 +5877,14 @@ error:return err; } -static const struct hda_codec_preset snd_hda_preset_generic[] = { - { .id =HDA_CODEC_ID_GENERIC , .patch = snd_hda_parse_generic_codec }, +static const struct hda_device_id snd_hda_id_generic[] = { +HDA_CODEC_ENTRY (HDA_CODEC_ID_GENERIC ,"Generic" , snd_hda_parse_generic_codec), {}/* terminator */ }; +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_generic);static struct hda_codec_driver generic_driver = { - .preset = snd_hda_preset_generic, + .id = snd_hda_id_generic, };module_hda_codec_driver (generic_driver);
sound/pci/hda/patch_analog.c +18 -19
@@ -1165,32 +1165,31 @@ static int patch_ad1882(struct hda_codec *codec)/* * patch entries */ -static const struct hda_codec_preset snd_hda_preset_analog[] = { - { .id =0x11d4184a , .name ="AD1884A" , .patch = patch_ad1884 }, - { .id =0x11d41882 , .name ="AD1882" , .patch = patch_ad1882 }, - { .id =0x11d41883 , .name ="AD1883" , .patch = patch_ad1884 }, - { .id =0x11d41884 , .name ="AD1884" , .patch = patch_ad1884 }, - { .id =0x11d4194a , .name ="AD1984A" , .patch = patch_ad1884 }, - { .id =0x11d4194b , .name ="AD1984B" , .patch = patch_ad1884 }, - { .id =0x11d41981 , .name ="AD1981" , .patch = patch_ad1981 }, - { .id =0x11d41983 , .name ="AD1983" , .patch = patch_ad1983 }, - { .id =0x11d41984 , .name ="AD1984" , .patch = patch_ad1884 }, - { .id =0x11d41986 , .name ="AD1986A" , .patch = patch_ad1986a }, - { .id =0x11d41988 , .name ="AD1988" , .patch = patch_ad1988 }, - { .id =0x11d4198b , .name ="AD1988B" , .patch = patch_ad1988 }, - { .id =0x11d4882a , .name ="AD1882A" , .patch = patch_ad1882 }, - { .id =0x11d4989a , .name ="AD1989A" , .patch = patch_ad1988 }, - { .id =0x11d4989b , .name ="AD1989B" , .patch = patch_ad1988 }, +static const struct hda_device_id snd_hda_id_analog[] = { +HDA_CODEC_ENTRY (0x11d4184a ,"AD1884A" , patch_ad1884), +HDA_CODEC_ENTRY (0x11d41882 ,"AD1882" , patch_ad1882), +HDA_CODEC_ENTRY (0x11d41883 ,"AD1883" , patch_ad1884), +HDA_CODEC_ENTRY (0x11d41884 ,"AD1884" , patch_ad1884), +HDA_CODEC_ENTRY (0x11d4194a ,"AD1984A" , patch_ad1884), +HDA_CODEC_ENTRY (0x11d4194b ,"AD1984B" , patch_ad1884), +HDA_CODEC_ENTRY (0x11d41981 ,"AD1981" , patch_ad1981), +HDA_CODEC_ENTRY (0x11d41983 ,"AD1983" , patch_ad1983), +HDA_CODEC_ENTRY (0x11d41984 ,"AD1984" , patch_ad1884), +HDA_CODEC_ENTRY (0x11d41986 ,"AD1986A" , patch_ad1986a), +HDA_CODEC_ENTRY (0x11d41988 ,"AD1988" , patch_ad1988), +HDA_CODEC_ENTRY (0x11d4198b ,"AD1988B" , patch_ad1988), +HDA_CODEC_ENTRY (0x11d4882a ,"AD1882A" , patch_ad1882), +HDA_CODEC_ENTRY (0x11d4989a ,"AD1989A" , patch_ad1988), +HDA_CODEC_ENTRY (0x11d4989b ,"AD1989B" , patch_ad1988), {}/* terminator */ }; - -MODULE_ALIAS ("snd-hda-codec-id:11d4*" ); +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_analog);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Analog Devices HD-audio codec" );static struct hda_codec_driver analog_driver = { - .preset = snd_hda_preset_analog, + .id = snd_hda_id_analog, };module_hda_codec_driver (analog_driver);
sound/pci/hda/patch_ca0110.c +6 -9
@@ -83,22 +83,19 @@ static int patch_ca0110(struct hda_codec *codec)/* * patch entries */ -static const struct hda_codec_preset snd_hda_preset_ca0110[] = { - { .id =0x1102000a , .name ="CA0110-IBG" , .patch = patch_ca0110 }, - { .id =0x1102000b , .name ="CA0110-IBG" , .patch = patch_ca0110 }, - { .id =0x1102000d , .name ="SB0880 X-Fi" , .patch = patch_ca0110 }, +static const struct hda_device_id snd_hda_id_ca0110[] = { +HDA_CODEC_ENTRY (0x1102000a ,"CA0110-IBG" , patch_ca0110), +HDA_CODEC_ENTRY (0x1102000b ,"CA0110-IBG" , patch_ca0110), +HDA_CODEC_ENTRY (0x1102000d ,"SB0880 X-Fi" , patch_ca0110), {}/* terminator */ }; - -MODULE_ALIAS ("snd-hda-codec-id:1102000a" ); -MODULE_ALIAS ("snd-hda-codec-id:1102000b" ); -MODULE_ALIAS ("snd-hda-codec-id:1102000d" ); +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_ca0110);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Creative CA0110-IBG HD-audio codec" );static struct hda_codec_driver ca0110_driver = { - .preset = snd_hda_preset_ca0110, + .id = snd_hda_id_ca0110, };module_hda_codec_driver (ca0110_driver);
sound/pci/hda/patch_ca0132.c +4 -5
@@ -4778,18 +4778,17 @@ static int patch_ca0132(struct hda_codec *codec)/* * patch entries */ -static struct hda_codec_preset snd_hda_preset_ca0132[] = { - { .id =0x11020011 , .name ="CA0132" , .patch = patch_ca0132 }, +static struct hda_device_id snd_hda_id_ca0132[] = { +HDA_CODEC_ENTRY (0x11020011 ,"CA0132" , patch_ca0132), {}/* terminator */ }; - -MODULE_ALIAS ("snd-hda-codec-id:11020011" ); +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_ca0132);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Creative Sound Core3D codec" );static struct hda_codec_driver ca0132_driver = { - .preset = snd_hda_preset_ca0132, + .id = snd_hda_id_ca0132, };module_hda_codec_driver (ca0132_driver);
sound/pci/hda/patch_cirrus.c +8 -13
@@ -1201,26 +1201,21 @@ static int patch_cs4213(struct hda_codec *codec)/* * patch entries */ -static const struct hda_codec_preset snd_hda_preset_cirrus[] = { - { .id =0x10134206 , .name ="CS4206" , .patch = patch_cs420x }, - { .id =0x10134207 , .name ="CS4207" , .patch = patch_cs420x }, - { .id =0x10134208 , .name ="CS4208" , .patch = patch_cs4208 }, - { .id =0x10134210 , .name ="CS4210" , .patch = patch_cs4210 }, - { .id =0x10134213 , .name ="CS4213" , .patch = patch_cs4213 }, +static const struct hda_device_id snd_hda_id_cirrus[] = { +HDA_CODEC_ENTRY (0x10134206 ,"CS4206" , patch_cs420x), +HDA_CODEC_ENTRY (0x10134207 ,"CS4207" , patch_cs420x), +HDA_CODEC_ENTRY (0x10134208 ,"CS4208" , patch_cs4208), +HDA_CODEC_ENTRY (0x10134210 ,"CS4210" , patch_cs4210), +HDA_CODEC_ENTRY (0x10134213 ,"CS4213" , patch_cs4213), {}/* terminator */ }; - -MODULE_ALIAS ("snd-hda-codec-id:10134206" ); -MODULE_ALIAS ("snd-hda-codec-id:10134207" ); -MODULE_ALIAS ("snd-hda-codec-id:10134208" ); -MODULE_ALIAS ("snd-hda-codec-id:10134210" ); -MODULE_ALIAS ("snd-hda-codec-id:10134213" ); +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_cirrus);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Cirrus Logic HD-audio codec" );static struct hda_codec_driver cirrus_driver = { - .preset = snd_hda_preset_cirrus, + .id = snd_hda_id_cirrus, };module_hda_codec_driver (cirrus_driver);
sound/pci/hda/patch_cmedia.c +6 -9
@@ -123,22 +123,19 @@ static int patch_cmi8888(struct hda_codec *codec)/* * patch entries */ -static const struct hda_codec_preset snd_hda_preset_cmedia[] = { - { .id =0x13f68888 , .name ="CMI8888" , .patch = patch_cmi8888 }, - { .id =0x13f69880 , .name ="CMI9880" , .patch = patch_cmi9880 }, - { .id =0x434d4980 , .name ="CMI9880" , .patch = patch_cmi9880 }, +static const struct hda_device_id snd_hda_id_cmedia[] = { +HDA_CODEC_ENTRY (0x13f68888 ,"CMI8888" , patch_cmi8888), +HDA_CODEC_ENTRY (0x13f69880 ,"CMI9880" , patch_cmi9880), +HDA_CODEC_ENTRY (0x434d4980 ,"CMI9880" , patch_cmi9880), {}/* terminator */ }; - -MODULE_ALIAS ("snd-hda-codec-id:13f68888" ); -MODULE_ALIAS ("snd-hda-codec-id:13f69880" ); -MODULE_ALIAS ("snd-hda-codec-id:434d4980" ); +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_cmedia);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("C-Media HD-audio codec" );static struct hda_codec_driver cmedia_driver = { - .preset = snd_hda_preset_cmedia, + .id = snd_hda_id_cmedia, };module_hda_codec_driver (cmedia_driver);
sound/pci/hda/patch_conexant.c +31 -87
131 lines not on this page · raw message
sound/pci/hda/patch_hdmi.c +70 -131
229 lines not on this page · raw message
sound/pci/hda/patch_realtek.c +57 -65
135 lines not on this page · raw message
sound/pci/hda/patch_si3054.c +14 -25
@@ -289,41 +289,30 @@ static int patch_si3054(struct hda_codec *codec)/* * patch entries */ -static const struct hda_codec_preset snd_hda_preset_si3054[] = { - { .id =0x163c3055 , .name ="Si3054" , .patch = patch_si3054 }, - { .id =0x163c3155 , .name ="Si3054" , .patch = patch_si3054 }, - { .id =0x11c13026 , .name ="Si3054" , .patch = patch_si3054 }, - { .id =0x11c13055 , .name ="Si3054" , .patch = patch_si3054 }, - { .id =0x11c13155 , .name ="Si3054" , .patch = patch_si3054 }, - { .id =0x10573055 , .name ="Si3054" , .patch = patch_si3054 }, - { .id =0x10573057 , .name ="Si3054" , .patch = patch_si3054 }, - { .id =0x10573155 , .name ="Si3054" , .patch = patch_si3054 }, +static const struct hda_device_id snd_hda_id_si3054[] = { +HDA_CODEC_ENTRY (0x163c3055 ,"Si3054" , patch_si3054), +HDA_CODEC_ENTRY (0x163c3155 ,"Si3054" , patch_si3054), +HDA_CODEC_ENTRY (0x11c13026 ,"Si3054" , patch_si3054), +HDA_CODEC_ENTRY (0x11c13055 ,"Si3054" , patch_si3054), +HDA_CODEC_ENTRY (0x11c13155 ,"Si3054" , patch_si3054), +HDA_CODEC_ENTRY (0x10573055 ,"Si3054" , patch_si3054), +HDA_CODEC_ENTRY (0x10573057 ,"Si3054" , patch_si3054), +HDA_CODEC_ENTRY (0x10573155 ,"Si3054" , patch_si3054),/* VIA HDA on Clevo m540 */ - { .id =0x11063288 , .name ="Si3054" , .patch = patch_si3054 }, +HDA_CODEC_ENTRY (0x11063288 ,"Si3054" , patch_si3054),/* Asus A8J Modem (SM56) */ - { .id =0x15433155 , .name ="Si3054" , .patch = patch_si3054 }, +HDA_CODEC_ENTRY (0x15433155 ,"Si3054" , patch_si3054),/* LG LW20 modem */ - { .id =0x18540018 , .name ="Si3054" , .patch = patch_si3054 }, +HDA_CODEC_ENTRY (0x18540018 ,"Si3054" , patch_si3054), {} }; - -MODULE_ALIAS ("snd-hda-codec-id:163c3055" ); -MODULE_ALIAS ("snd-hda-codec-id:163c3155" ); -MODULE_ALIAS ("snd-hda-codec-id:11c13026" ); -MODULE_ALIAS ("snd-hda-codec-id:11c13055" ); -MODULE_ALIAS ("snd-hda-codec-id:11c13155" ); -MODULE_ALIAS ("snd-hda-codec-id:10573055" ); -MODULE_ALIAS ("snd-hda-codec-id:10573057" ); -MODULE_ALIAS ("snd-hda-codec-id:10573155" ); -MODULE_ALIAS ("snd-hda-codec-id:11063288" ); -MODULE_ALIAS ("snd-hda-codec-id:15433155" ); -MODULE_ALIAS ("snd-hda-codec-id:18540018" ); +MODULE_DEVICE_TABLE (hdaudio, snd_hda_id_si3054);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Si3054 HD-audio modem codec" );static struct hda_codec_driver si3054_driver = { - .preset = snd_hda_preset_si3054, + .id = snd_hda_id_si3054, };module_hda_codec_driver (si3054_driver);
sound/pci/hda/patch_sigmatel.c +106 -108
227 lines not on this page · raw message
sound/pci/hda/patch_via.c +54 -99
163 lines not on this page · raw message
Signature · 1 line
2.6.1
PATCH 6/6 ALSA: hda - Advertise MODALIAS in uevent
In reply to Takashi IwaiFrom: Thierry Reding <[email protected]>
By setting the MODALIAS variable in uevents, userspace helpers will be enabled to load modules via the module alias associated with a device.
This information is required to automatically load HDA codec drivers instead of having to explicitly request the various modules in the HDA core code.
[Note that currently the legacy HDA controller driver tries to bind
codec modules manually. It's for supporting the fallback generic drivers. This new udev modalias support was added rather for ASoC HDA ext drivers, since this addition itself won't hurt the legacy HDA -- tiwai]
[Use the common helper function to generate the modalias -- tiwai]
--- sound/hda/hda_bus_type.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/hda/hda_bus_type.c +12 -0
@@ -64,9 +64,21 @@ static int hda_bus_match(struct device *dev, struct device_driver *drv)return 1 ; } +static int hda_uevent (struct device *dev,struct kobj_uevent_env *env) +{ +char modalias[32 ]; + +snd_hdac_codec_modalias (dev_to_hdac_dev (dev), modalias, +sizeof (modalias)); +if (add_uevent_var (env,"MODALIAS=%s" , modalias)) +return -ENOMEM ; +return 0 ; +} +struct bus_type snd_hda_bus_type = { .name ="hdaudio" , .match = hda_bus_match, + .uevent = hda_uevent, };EXPORT_SYMBOL_GPL (snd_hda_bus_type);
Signature · 1 line
2.6.1
Quoted 7 lines · Takashi Iwai
Hi,
this is a patchset to add the support of automatic modalias creation for HD-audio codec drivers like other standard drivers. Currently, the HDA codec driver has put module alias manually due to ugly historical reasons. This patch finally moves to the saner way.
Quoted 8 lines
Also it adds the udev modalias support so that it can be autoloaded in udev.
The patchset was initiated by Intel people for SKL ASoC drivers. Now I brushed up and made it working for legacy drivers.
The current patchset is found in topic/hda-modalias branch of sound git tree, too.
Thanks for posting this,
This series looks great to me. Me and Subhransu will test it out in next day or so and will get back with results on ASoC side :)
Signature · 1 line
~Vinod
Quoted 14 lines · Vinod Koul
Quoted 13 lines · Takashi Iwai
Hi,
this is a patchset to add the support of automatic modalias creation for HD-audio codec drivers like other standard drivers. Currently, the HDA codec driver has put module alias manually due to ugly historical reasons. This patch finally moves to the saner way.
Also it adds the udev modalias support so that it can be autoloaded in udev.
The patchset was initiated by Intel people for SKL ASoC drivers. Now I brushed up and made it working for legacy drivers.
Quoted 7 lines
Quoted 2 lines
The current patchset is found in topic/hda-modalias branch of sound git tree, too.
Thanks for posting this,
This series looks great to me. Me and Subhransu will test it out in next day or so and will get back with results on ASoC side :)
Hi Takashi,
For the whole series
Also please apply below patch which adds HDA_CODEC_EXT_ENTRY. We have tested HDMI patches with this
-----------------><8----------------><8----------------
Quoted 1 line
From
79f4fb6600810103737939c186f928c74ed058feMon Sep 17 00:00:00 2001
From: "Subhransu S. Prusty" <[email protected]>
Date: Mon, 19 Oct 2015 16:58:46 +0530
Subject: [PATCH] ALSA: hdac: Add macro for hda ext devices entry
With the new modalias infrastructure support added for hda, create a macro for ext devices similar to legacy to add the device entry.
--- include/sound/hdaudio_ext.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/sound/hdaudio_ext.h +7 -0
@@ -40,6 +40,13 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus);#define hbus_to_ebus (_bus) \ container_of(_bus, struct hdac_ext_bus, bus) +#define HDA_CODEC_REV_EXT_ENTRY (_vid, _rev, _name, drv_data) \ + { .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \ + .api_version = HDA_DEV_ASOC, \ + .driver_data = (unsigned long)(drv_data) } +#define HDA_CODEC_EXT_ENTRY (_vid, _revid, _name, _drv_data) \ + HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data) +int snd_hdac_ext_bus_parse_capabilities (struct hdac_ext_bus *sbus);void snd_hdac_ext_bus_ppcap_enable (struct hdac_ext_bus *chip,bool enable);void snd_hdac_ext_bus_ppcap_int_enable (struct hdac_ext_bus *chip,bool enable);
Signature · 1 line
~Vinod
Quoted 26 lines · Vinod Koul
Quoted 14 lines · Vinod Koul
Quoted 13 lines · Takashi Iwai
Hi,
this is a patchset to add the support of automatic modalias creation for HD-audio codec drivers like other standard drivers. Currently, the HDA codec driver has put module alias manually due to ugly historical reasons. This patch finally moves to the saner way.
Also it adds the udev modalias support so that it can be autoloaded in udev.
The patchset was initiated by Intel people for SKL ASoC drivers. Now I brushed up and made it working for legacy drivers.
Quoted 7 lines
Quoted 2 lines
The current patchset is found in topic/hda-modalias branch of sound git tree, too.
Thanks for posting this,
This series looks great to me. Me and Subhransu will test it out in next day or so and will get back with results on ASoC side :)
Hi Takashi,
Quoted 7 lines
For the whole series
Reviewed-by Vinod Koul <[email protected]>Tested-by Subhransu S Prusty <[email protected]>Also please apply below patch which adds
HDA_CODEC_EXT_ENTRY. We have tested HDMI patches with this
OK, tags updated and merged the new patch, pushed out now.
BTW:
Quoted 1 line
-----------------><8----------------><8----------------
This won't work with git am --scissors.
Better to use either ">8" or "8<"
thanks,
Takashi