Commit 4f9e0c38 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Add a common helper to give the codec modalias string

This 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.
Reviewed-by: default avatarVinod Koul <vinod.koul@intel.com>
Tested-by: default avatarSubhransu S Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent da23ac1e
...@@ -109,6 +109,7 @@ void snd_hdac_device_exit(struct hdac_device *dev); ...@@ -109,6 +109,7 @@ void snd_hdac_device_exit(struct hdac_device *dev);
int snd_hdac_device_register(struct hdac_device *codec); int snd_hdac_device_register(struct hdac_device *codec);
void snd_hdac_device_unregister(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_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_widgets(struct hdac_device *codec);
int snd_hdac_refresh_widget_sysfs(struct hdac_device *codec); int snd_hdac_refresh_widget_sysfs(struct hdac_device *codec);
......
...@@ -185,6 +185,21 @@ int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name) ...@@ -185,6 +185,21 @@ int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name)
} }
EXPORT_SYMBOL_GPL(snd_hdac_device_set_chip_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 * snd_hdac_make_cmd - compose a 32bit command word to be sent to the
* HD-audio controller * HD-audio controller
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment