A few more ALSA and HD-audio core updates
cover A few more ALSA and HD-audio core updates
Hi,
this is a series of patches to cleanup / enhance the ALSA core and HD-audio driver codes. A part of them are the patches I already submitted as RFC shortly ago (patch 4 & patch 5), another part are for better sysfs managment (part 1 & 2). The rest half are about HD-audio, for creating the device struct for each codec, followed by a cleanup patch to replace printk with dev_err() & co.
Takashi
PATCH 1/10 ALSA: Create sysfs attribute files via groups
Instead of calling each time device_create_file(), create the groups of sysfs attribute files at once in a normal way. Add a new helper function, snd_get_device(), to return the associated device object, so that we can handle the sysfs addition locally.
Since the sysfs file addition is done differently now, snd_add_device_sysfs_file() helper function is removed.
--- include/sound/core.h | 3 +- include/sound/hwdep.h | 1 + sound/core/hwdep.c | 14 ++++++ sound/core/pcm.c | 30 +++++++++++-- sound/core/sound.c | 23 +++++----- sound/pci/hda/hda_codec.c | 16 ------- sound/pci/hda/hda_hwdep.c | 110 ++++++++++++++++++++++++---------------------- sound/pci/hda/hda_local.h | 18 -------- 8 files changed, 112 insertions(+), 103 deletions(-)
include/sound/core.h +1 -2
@@ -248,8 +248,7 @@ static inline int snd_register_device(int type, struct snd_card *card, int dev,int snd_unregister_device (int type,struct snd_card *card,int dev);void *snd_lookup_minor_data (unsigned int minor,int type); -int snd_add_device_sysfs_file (int type,struct snd_card *card,int dev, -struct device_attribute *attr); +struct device *snd_get_device (int type,struct snd_card *card,int dev);#ifdef CONFIG_SND_OSSEMUL int snd_register_oss_device(int type, struct snd_card *card, int dev,
include/sound/hwdep.h +1 -0
@@ -68,6 +68,7 @@ struct snd_hwdep {wait_queue_head_t open_wait;void *private_data;void (*private_free) (struct snd_hwdep *hwdep); +const struct attribute_group **groups;struct mutex open_mutex;int used;/* reference counter */
sound/core/hwdep.c +14 -0
@@ -436,6 +436,20 @@ static int snd_hwdep_dev_register(struct snd_device *device)mutex_unlock (®ister_mutex);return err; } + +if (hwdep->groups) { +struct device *d =snd_get_device (SNDRV_DEVICE_TYPE_HWDEP , + hwdep->card, hwdep->device); +if (d) { + err =sysfs_create_groups (&d->kobj, hwdep->groups); +if (err <0 ) +dev_warn (card->dev, +"hwdep %d:%d: cannot create sysfs groups\n" , + card->number, hwdep->device); +put_device (d); + } + } +#ifdef CONFIG_SND_OSSEMUL hwdep->ossreg =0 ;if (hwdep->oss_type >=0 ) {
sound/core/pcm.c +26 -4
@@ -1018,8 +1018,20 @@ static ssize_t show_pcm_class(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%s\n" , str); } -static struct device_attribute pcm_attrs = -__ATTR (pcm_class,S_IRUGO , show_pcm_class,NULL ); +static DEVICE_ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); +static struct attribute *pcm_dev_attrs[] = { + &dev_attr_pcm_class.attr, +NULL +}; + +static struct attribute_group pcm_dev_attr_group = { + .attrs = pcm_dev_attrs, +}; + +static const struct attribute_group *pcm_dev_attr_groups[] = { + &pcm_dev_attr_group, +NULL +};static int snd_pcm_dev_register (struct snd_device *device) {
@@ -1069,8 +1081,18 @@ static int snd_pcm_dev_register(struct snd_device *device)mutex_unlock (®ister_mutex);return err; } -snd_add_device_sysfs_file (devtype, pcm->card, pcm->device, - &pcm_attrs); + + dev =snd_get_device (devtype, pcm->card, pcm->device); +if (dev) { + err =sysfs_create_groups (&dev->kobj, + pcm_dev_attr_groups); +if (err <0 ) +dev_warn (dev, +"pcm %d:%d: cannot create sysfs groups\n" , + pcm->card->number, pcm->device); +put_device (dev); + } +for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)snd_pcm_timer_init (substream); }
sound/core/sound.c +13 -10
@@ -355,22 +355,25 @@ int snd_unregister_device(int type, struct snd_card *card, int dev)EXPORT_SYMBOL (snd_unregister_device); -int snd_add_device_sysfs_file (int type,struct snd_card *card,int dev, -struct device_attribute *attr) +/* get the assigned device to the given type and device number; +* the caller needs to release it via put_device() after using it +*/ +struct device *snd_get_device (int type,struct snd_card *card,int dev) { -int minor, ret = -EINVAL ; -struct device *d; +int minor; +struct device *d =NULL ;mutex_lock (&sound_mutex); minor =find_snd_minor (type, card, dev); -if (minor >=0 && (d = snd_minors[minor]->dev) !=NULL ) - ret =device_create_file (d, attr); +if (minor >=0 ) { + d = snd_minors[minor]->dev; +if (d) +get_device (d); + }mutex_unlock (&sound_mutex); -return ret; - +return d; } - -EXPORT_SYMBOL (snd_add_device_sysfs_file); +EXPORT_SYMBOL (snd_get_device);#ifdef CONFIG_PROC_FS /*
sound/pci/hda/hda_codec.c +0 -16
@@ -852,21 +852,6 @@ static int snd_hda_bus_dev_free(struct snd_device *device)return snd_hda_bus_free (bus); } -#ifdef CONFIG_SND_HDA_HWDEP -static int snd_hda_bus_dev_register (struct snd_device *device) -{ -struct hda_bus *bus = device->device_data; -struct hda_codec *codec; -list_for_each_entry (codec, &bus->codec_list, list) { -snd_hda_hwdep_add_sysfs (codec); -snd_hda_hwdep_add_power_sysfs (codec); - } -return 0 ; -} -#else -#define snd_hda_bus_dev_register NULL -#endif -/** * snd_hda_bus_new - create a HDA bus * @card: the card entry
@@ -882,7 +867,6 @@ int snd_hda_bus_new(struct snd_card *card,struct hda_bus *bus;int err;static struct snd_device_ops dev_ops = { - .dev_register = snd_hda_bus_dev_register, .dev_free = snd_hda_bus_dev_free, };
sound/pci/hda/hda_hwdep.c +57 -53
137 lines not on this page · raw message
sound/pci/hda/hda_local.h +0 -18
@@ -597,24 +597,6 @@ int snd_hda_create_hwdep(struct hda_codec *codec);static inline int snd_hda_create_hwdep (struct hda_codec *codec) {return 0 ; }#endif -#if defined(CONFIG_PM ) && defined(CONFIG_SND_HDA_HWDEP ) -int snd_hda_hwdep_add_power_sysfs (struct hda_codec *codec); -#else -static inline int snd_hda_hwdep_add_power_sysfs (struct hda_codec *codec) -{ -return 0 ; -} -#endif - -#ifdef CONFIG_SND_HDA_RECONFIG -int snd_hda_hwdep_add_sysfs (struct hda_codec *codec); -#else -static inline int snd_hda_hwdep_add_sysfs (struct hda_codec *codec) -{ -return 0 ; -} -#endif -#ifdef CONFIG_SND_HDA_RECONFIG const char *snd_hda_get_hint (struct hda_codec *codec,const char *key);int snd_hda_get_bool_hint (struct hda_codec *codec,const char *key);
Signature · 1 line
1.9.0
PATCH 2/10 ALSA: hwdep: Take private_data as drvdata for sysfs
In reply to Takashi IwaiFor referring to a different object from sysfs ops, take hwdep private_data as stored via dev_set_drvdata() at creating the device object. In that way, the same sysfs ops can be used by different device types.
--- sound/core/hwdep.c | 2 ++ sound/pci/hda/hda_hwdep.c | 45 +++++++++++++++------------------------------ 2 files changed, 17 insertions(+), 30 deletions(-)
sound/core/hwdep.c +2 -0
@@ -441,6 +441,8 @@ static int snd_hwdep_dev_register(struct snd_device *device)struct device *d =snd_get_device (SNDRV_DEVICE_TYPE_HWDEP , hwdep->card, hwdep->device);if (d) { +if (hwdep->private_data) +dev_set_drvdata (d, hwdep->private_data); err =sysfs_create_groups (&d->kobj, hwdep->groups);if (err <0 ) dev_warn(card->dev,
sound/pci/hda/hda_hwdep.c +15 -30
135 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH 3/10 ALSA: hwdep: Allow to assign the given parent
In reply to Takashi IwaiJust like PCM, allow hwdep to be assigned to a different parent device than the card. It'll be used for the HD-audio codec device in the later patches.
--- include/sound/hwdep.h | 1 + sound/core/hwdep.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-)
include/sound/hwdep.h +1 -0
@@ -68,6 +68,7 @@ struct snd_hwdep {wait_queue_head_t open_wait;void *private_data;void (*private_free) (struct snd_hwdep *hwdep); +struct device *dev;const struct attribute_group **groups;struct mutex open_mutex;
sound/core/hwdep.c +12 -7
@@ -416,6 +416,7 @@ static int snd_hwdep_dev_register(struct snd_device *device) {struct snd_hwdep *hwdep = device->device_data;struct snd_card *card = hwdep->card; +struct device *dev;int err;char name[32 ];
@@ -426,10 +427,14 @@ static int snd_hwdep_dev_register(struct snd_device *device) }list_add_tail (&hwdep->list, &snd_hwdep_devices);sprintf (name,"hwC%iD%i" , hwdep->card->number, hwdep->device); -if ((err =snd_register_device (SNDRV_DEVICE_TYPE_HWDEP , - hwdep->card, hwdep->device, - &snd_hwdep_f_ops, hwdep, name)) <0 ) { -dev_err (card->dev, + dev = hwdep->dev; +if (!dev) + dev =snd_card_get_device_link (hwdep->card); + err =snd_register_device_for_dev (SNDRV_DEVICE_TYPE_HWDEP , + hwdep->card, hwdep->device, + &snd_hwdep_f_ops, hwdep, name, dev); +if (err <0 ) { +dev_err (dev,"unable to register hardware dependent device %i:%i\n" , card->number, hwdep->device);list_del (&hwdep->list);
@@ -445,7 +450,7 @@ static int snd_hwdep_dev_register(struct snd_device *device)dev_set_drvdata (d, hwdep->private_data); err =sysfs_create_groups (&d->kobj, hwdep->groups);if (err <0 ) -dev_warn (card->dev, +dev_warn (dev,"hwdep %d:%d: cannot create sysfs groups\n" , card->number, hwdep->device);put_device (d);
@@ -456,13 +461,13 @@ static int snd_hwdep_dev_register(struct snd_device *device) hwdep->ossreg =0 ;if (hwdep->oss_type >=0 ) {if ((hwdep->oss_type ==SNDRV_OSS_DEVICE_TYPE_DMFM ) && (hwdep->device !=0 )) { -dev_warn (card->dev, +dev_warn (dev,"only hwdep device 0 can be registered as OSS direct FM device!\n" ); }else {if (snd_register_oss_device (hwdep->oss_type, card, hwdep->device, &snd_hwdep_f_ops, hwdep) <0 ) { -dev_err (card->dev, +dev_err (dev,"unable to register OSS compatibility device %i:%i\n" , card->number, hwdep->device); }else
Signature · 1 line
1.9.0
PATCH 4/10 ALSA: Use priority list for managing device list
In reply to Takashi IwaiBasically, the device type specifies the priority of the device to be registered / freed, too. However, the priority value isn't well utilized but only it's checked as a group. This results in inconsistent register and free order (where each of them should be in reversed direction).
This patch simplifies the device list management code by simply inserting a list entry at creation time in an incremental order for the priority value. Since we can just follow the link for register, disconnect and free calls, we don't have to specify the group; so the whole enum definitions are also simplified as well.
The visible change to outside is that the priorities of some object types are revisited. For example, now the SNDRV_DEV_LOWLEVEL object is registered before others (control, PCM, etc) and, in return, released after others. Similarly, SNDRV_DEV_CODEC is in a lower priority than SNDRV_DEV_BUS for ensuring the dependency.
Also, the unused SNDRV_DEV_TOPLEVEL, SNDRV_DEV_LOWLEVEL_PRE and SNDRV_DEV_LOWLEVEL_NORMAL are removed as a cleanup.
--- include/sound/core.h | 28 ++++++++-------------- sound/core/device.c | 66 +++++++++++++++++++++++++++++----------------------- sound/core/init.c | 14 +++-------- 3 files changed, 50 insertions(+), 58 deletions(-)
include/sound/core.h +10 -18
@@ -46,24 +46,22 @@ struct completion;/* device allocation stuff */ -#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 - +/* type of the object used in snd_device_*() +* this also defines the calling order +*/ enum snd_device_type { -SNDRV_DEV_TOPLEVEL =0 , -SNDRV_DEV_CONTROL =1 , -SNDRV_DEV_LOWLEVEL_PRE =2 , -SNDRV_DEV_LOWLEVEL_NORMAL =0x1000 , +SNDRV_DEV_LOWLEVEL , +SNDRV_DEV_CONTROL , +SNDRV_DEV_INFO , +SNDRV_DEV_BUS , +SNDRV_DEV_CODEC ,SNDRV_DEV_PCM , +SNDRV_DEV_COMPRESS ,SNDRV_DEV_RAWMIDI ,SNDRV_DEV_TIMER ,SNDRV_DEV_SEQUENCER ,SNDRV_DEV_HWDEP , -SNDRV_DEV_INFO , -SNDRV_DEV_BUS , -SNDRV_DEV_CODEC ,SNDRV_DEV_JACK , -SNDRV_DEV_COMPRESS , -SNDRV_DEV_LOWLEVEL =0x2000 , };enum snd_device_state {
@@ -72,12 +70,6 @@ enum snd_device_state { SNDRV_DEV_DISCONNECTED, }; -enum snd_device_cmd { -SNDRV_DEV_CMD_PRE , -SNDRV_DEV_CMD_NORMAL , -SNDRV_DEV_CMD_POST , -}; -struct snd_device ;struct snd_device_ops {
@@ -320,7 +312,7 @@ int snd_device_register_all(struct snd_card *card);int snd_device_disconnect (struct snd_card *card,void *device_data);int snd_device_disconnect_all (struct snd_card *card);int snd_device_free (struct snd_card *card,void *device_data); -int snd_device_free_all (struct snd_card *card,enum snd_device_cmd cmd); +int snd_device_free_all (struct snd_card *card);/* isadma.c */
sound/core/device.c +37 -29
132 lines not on this page · raw message
sound/core/init.c +3 -11
@@ -266,7 +266,7 @@ int snd_card_new(struct device *parent, int idx, const char *xid,return 0 ; __error_ctl: -snd_device_free_all (card,SNDRV_DEV_CMD_PRE ); +snd_device_free_all (card); __error:put_device (&card->card_dev);return err;
@@ -454,16 +454,8 @@ static int snd_card_do_free(struct snd_card *card)if (snd_mixer_oss_notify_callback)snd_mixer_oss_notify_callback (card,SND_MIXER_OSS_NOTIFY_FREE );#endif -if (snd_device_free_all (card,SNDRV_DEV_CMD_PRE ) <0 ) { -dev_err (card->dev,"unable to free all devices (pre)\n" ); -/* Fatal, but this situation should never occur */ - } -if (snd_device_free_all (card,SNDRV_DEV_CMD_NORMAL ) <0 ) { -dev_err (card->dev,"unable to free all devices (normal)\n" ); -/* Fatal, but this situation should never occur */ - } -if (snd_device_free_all (card,SNDRV_DEV_CMD_POST ) <0 ) { -dev_err (card->dev,"unable to free all devices (post)\n" ); +if (snd_device_free_all (card) <0 ) { +dev_err (card->dev,"unable to free all devices\n" );/* Fatal, but this situation should never occur */ }if (card->private_free)
Signature · 1 line
1.9.0
PATCH 5/10 ALSA: Clean up snd_device_*() codes
In reply to Takashi IwaiA few code cleanups and optimizations. In addition, drop snd_device_disconnect() that isn't used at all, and drop the return values from snd_device_free*().
Another slight difference by this change is that now the device state will become always SNDRV_DEV_REGISTERED no matter whether dev_register ops is present or not. It's for better consistency. There should be no impact for the current tree, as the state isn't checked.
--- include/sound/core.h | 5 +- sound/core/device.c | 128 ++++++++++++++++++++------------------------------- sound/core/init.c | 5 +- 3 files changed, 52 insertions(+), 86 deletions(-)
include/sound/core.h +2 -3
@@ -309,10 +309,9 @@ int snd_device_new(struct snd_card *card, enum snd_device_type type, void *device_data, struct snd_device_ops *ops);int snd_device_register (struct snd_card *card,void *device_data);int snd_device_register_all (struct snd_card *card); -int snd_device_disconnect (struct snd_card *card,void *device_data);int snd_device_disconnect_all (struct snd_card *card); -int snd_device_free (struct snd_card *card,void *device_data); -int snd_device_free_all (struct snd_card *card); +void snd_device_free (struct snd_card *card,void *device_data); +void snd_device_free_all (struct snd_card *card);/* isadma.c */
sound/core/device.c +49 -79
182 lines not on this page · raw message
sound/core/init.c +1 -4
@@ -454,10 +454,7 @@ static int snd_card_do_free(struct snd_card *card)if (snd_mixer_oss_notify_callback)snd_mixer_oss_notify_callback (card,SND_MIXER_OSS_NOTIFY_FREE );#endif -if (snd_device_free_all (card) <0 ) { -dev_err (card->dev,"unable to free all devices\n" ); -/* Fatal, but this situation should never occur */ - } +snd_device_free_all (card);if (card->private_free) card->private_free (card);snd_info_free_entry (card->proc_id);
Signature · 1 line
1.9.0
PATCH 6/10 ALSA: hda - Manage each codec instance individually
In reply to Takashi IwaiNow each snd_hda_codec instance is managed via the device chain, the registration and release are done by its callback instead of calling from bus.
--- sound/pci/hda/hda_codec.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-)
sound/pci/hda/hda_codec.c +25 -11
@@ -821,35 +821,35 @@ static int init_unsol_queue(struct hda_bus *bus)/* * destructor */ -static void snd_hda_codec_free (struct hda_codec *codec); - -static int snd_hda_bus_free (struct hda_bus *bus) +static void snd_hda_bus_free (struct hda_bus *bus) { -struct hda_codec *codec, *n; -if (!bus) -return 0 ; +return ; + +WARN_ON (!list_empty (&bus->codec_list));if (bus->workq)flush_workqueue (bus->workq);if (bus->unsol)kfree (bus->unsol); -list_for_each_entry_safe (codec, n, &bus->codec_list, list) { -snd_hda_codec_free (codec); - }if (bus->ops.private_free) bus->ops.private_free (bus);if (bus->workq)destroy_workqueue (bus->workq);kfree (bus); -return 0 ; }static int snd_hda_bus_dev_free (struct snd_device *device) { +snd_hda_bus_free (device->device_data); +return 0 ; +} + +static int snd_hda_bus_dev_disconnect (struct snd_device *device) +{struct hda_bus *bus = device->device_data; bus->shutdown =1 ; -return snd_hda_bus_free (bus); +return 0 ; }/**
@@ -867,6 +867,7 @@ int snd_hda_bus_new(struct snd_card *card,struct hda_bus *bus;int err;static struct snd_device_ops dev_ops = { + .dev_disconnect = snd_hda_bus_dev_disconnect, .dev_free = snd_hda_bus_dev_free, };
@@ -1376,6 +1377,12 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec,static unsigned int hda_set_power_state (struct hda_codec *codec,unsigned int power_state); +static int snd_hda_codec_dev_free (struct snd_device *device) +{ +snd_hda_codec_free (device->device_data); +return 0 ; +} +/** * snd_hda_codec_new - create a HDA codec * @bus: the bus to assign
@@ -1392,6 +1399,9 @@ int snd_hda_codec_new(struct hda_bus *bus,char component[31 ];hda_nid_t fg;int err; +static struct snd_device_ops dev_ops = { + .dev_free = snd_hda_codec_dev_free, + };if (snd_BUG_ON (!bus))return -EINVAL ;
@@ -1512,6 +1522,10 @@ int snd_hda_codec_new(struct hda_bus *bus, codec->subsystem_id, codec->revision_id);snd_component_add (codec->bus->card, component); + err =snd_device_new (bus->card,SNDRV_DEV_CODEC , codec, &dev_ops); +if (err <0 ) + goto error; +if (codecp) *codecp = codec;return 0 ;
Signature · 1 line
1.9.0
PATCH 7/10 ALSA: hda - Create own device struct for each codec
In reply to Takashi IwaiAs the HD-audio is treated individually in each codec driver, it's more convenient to assign an own struct device to each codec object. Then we'll be able to use dev_err() more easily for each codec, for example.
For achieving it, this patch just creates an object "hdaudioCxDy". It belongs to sound class instead of creating a new bus, just for simplicity, at this stage. No pm ops is implemented in the device struct level but currently it's merely a container. The PCM and hwdep devices are now children of this codec device.
--- sound/pci/hda/hda_codec.c | 36 +++++++++++++++++++++++++++++++++--- sound/pci/hda/hda_codec.h | 1 + sound/pci/hda/hda_hwdep.c | 3 +++ sound/pci/hda/hda_intel.c | 2 ++ 4 files changed, 39 insertions(+), 3 deletions(-)
sound/pci/hda/hda_codec.c +33 -3
@@ -1368,7 +1368,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)kfree (codec->modelname);kfree (codec->wcaps); codec->bus->num_codecs--; -kfree (codec); +put_device (&codec->dev); } static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec,
@@ -1377,12 +1377,33 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec,static unsigned int hda_set_power_state (struct hda_codec *codec,unsigned int power_state); +static int snd_hda_codec_dev_register (struct snd_device *device) +{ +struct hda_codec *codec = device->device_data; + +return device_add (&codec->dev); +} + +static int snd_hda_codec_dev_disconnect (struct snd_device *device) +{ +struct hda_codec *codec = device->device_data; + +device_del (&codec->dev); +return 0 ; +} +static int snd_hda_codec_dev_free (struct snd_device *device) {snd_hda_codec_free (device->device_data);return 0 ; } +/* just free the container */ +static void snd_hda_codec_dev_release (struct device *dev) +{ +kfree (container_of(dev ,struct hda_codec ,dev )); +} +/** * snd_hda_codec_new - create a HDA codec * @bus: the bus to assign
@@ -1400,6 +1421,8 @@ int snd_hda_codec_new(struct hda_bus *bus,hda_nid_t fg;int err;static struct snd_device_ops dev_ops = { + .dev_register = snd_hda_codec_dev_register, + .dev_disconnect = snd_hda_codec_dev_disconnect, .dev_free = snd_hda_codec_dev_free, };
@@ -1420,6 +1443,13 @@ int snd_hda_codec_new(struct hda_bus *bus,return -ENOMEM ; } +device_initialize (&codec->dev); + codec->dev.parent = &bus->card->card_dev; + codec->dev.class = sound_class; + codec->dev.release = snd_hda_codec_dev_release; +dev_set_name (&codec->dev,"hdaudioC%dD%d" , bus->card->number, + codec_addr); + codec->bus = bus; codec->addr = codec_addr;mutex_init (&codec->spdif_mutex);
@@ -1453,8 +1483,8 @@ int snd_hda_codec_new(struct hda_bus *bus,if (codec->bus->modelname) { codec->modelname =kstrdup (codec->bus->modelname,GFP_KERNEL );if (!codec->modelname) { -snd_hda_codec_free (codec); -return -ENODEV ; + err = -ENODEV ; + goto error; } }
sound/pci/hda/hda_codec.h +1 -0
@@ -271,6 +271,7 @@ struct hda_pcm {/* codec information */ struct hda_codec { +struct device dev;struct hda_bus *bus;unsigned int addr;/* codec addr*/ struct list_head list;/* list point */
sound/pci/hda/hda_hwdep.c +3 -0
@@ -155,6 +155,9 @@ int snd_hda_create_hwdep(struct hda_codec *codec)snd_array_init (&codec->hints,sizeof (struct hda_hint ),32 );snd_array_init (&codec->user_pins,sizeof (struct hda_pincfg ),16 ); +/* link to codec */ + hwdep->dev = &codec->dev; +return 0 ; }
sound/pci/hda/hda_intel.c +2 -0
@@ -2663,6 +2663,8 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG ,snd_dma_pci_data (chip->pci), size,MAX_PREALLOC_SIZE ); +/* link to codec */ + pcm->dev = &codec->dev;return 0 ; }
Signature · 1 line
1.9.0
PATCH 8/10 ALSA: hda - Add sysfs to codec object, too
In reply to Takashi IwaiWe have currently sysfs attributes for each hwdep, but basically these should belong to the codec itself, per se. Let's add them to the codec object while keeping them for hwdep as is for compatibility.
While we are at it, split the sysfs-related stuff into a separate source file, hda_sysfs.c, and keep only the stuff necessary for hwdep in hda_hwdep.c.
--- sound/pci/hda/Kconfig | 4 - sound/pci/hda/Makefile | 2 +- sound/pci/hda/hda_codec.c | 11 +- sound/pci/hda/hda_codec.h | 7 +- sound/pci/hda/hda_hwdep.c | 754 --------------------------------------------- sound/pci/hda/hda_local.h | 5 + sound/pci/hda/hda_sysfs.c | 769 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 788 insertions(+), 764 deletions(-) create mode 100644 sound/pci/hda/hda_sysfs.c
sound/pci/hda/Kconfig +0 -4
@@ -41,7 +41,6 @@ config SND_HDA_HWDEP config SND_HDA_RECONFIG bool "Allow dynamic codec reconfiguration" - depends on SND_HDA_HWDEP help Say Y here to enable the HD-audio codec re-configuration feature. This adds the sysfs interfaces to allow user to clear the whole
@@ -76,7 +75,6 @@ config SND_HDA_INPUT_JACK config SND_HDA_PATCH_LOADER bool "Support initialization patch loading for HD-audio" select FW_LOADER - select SND_HDA_HWDEP select SND_HDA_RECONFIG help Say Y here to allow the HD-audio driver to load a pseudo
@@ -84,8 +82,6 @@ config SND_HDA_PATCH_LOADER start up. The "patch" file can be specified via patch module option, such as patch=hda-init. - This option turns on hwdep and reconfig features automatically. - config SND_HDA_CODEC_REALTEK tristate "Build Realtek HD-audio codec support" select SND_HDA_GENERIC
sound/pci/hda/Makefile +1 -1
@@ -2,7 +2,7 @@ snd-hda-intel-objs := hda_intel.o # for haswell power well snd-hda-intel-$(CONFIG_SND_HDA_I915) += hda_i915.o -snd-hda-codec-y := hda_codec.o hda_jack.o hda_auto_parser.o +snd-hda-codec-y := hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
sound/pci/hda/hda_codec.c +8 -3
@@ -1170,7 +1170,7 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) {struct hda_pincfg *pin; -#ifdef CONFIG_SND_HDA_HWDEP +#ifdef CONFIG_SND_HDA_RECONFIG {unsigned int cfg =0 ;mutex_lock (&codec->user_mutex);
@@ -1285,7 +1285,7 @@ static void free_hda_cache(struct hda_cache_rec *cache);static void free_init_pincfgs (struct hda_codec *codec) {snd_array_free (&codec->driver_pins); -#ifdef CONFIG_SND_HDA_HWDEP +#ifdef CONFIG_SND_HDA_RECONFIG snd_array_free (&codec->user_pins);#endif snd_array_free (&codec->init_pins);
@@ -1359,6 +1359,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)if (codec->patch_ops.free) codec->patch_ops.free (codec);hda_call_pm_notify (codec, false);/* cancel leftover refcounts */ +snd_hda_sysfs_clear (codec);unload_parser (codec);module_put (codec->owner);free_hda_cache (&codec->amp_cache);
@@ -1447,8 +1448,10 @@ int snd_hda_codec_new(struct hda_bus *bus, codec->dev.parent = &bus->card->card_dev; codec->dev.class = sound_class; codec->dev.release = snd_hda_codec_dev_release; + codec->dev.groups = snd_hda_dev_attr_groups;dev_set_name (&codec->dev,"hdaudioC%dD%d" , bus->card->number, codec_addr); +dev_set_drvdata (&codec->dev, codec);/* for sysfs */ codec->bus = bus; codec->addr = codec_addr;
@@ -1480,6 +1483,8 @@ int snd_hda_codec_new(struct hda_bus *bus,hda_keep_power_on (codec);#endif +snd_hda_sysfs_init (codec); +if (codec->bus->modelname) { codec->modelname =kstrdup (codec->bus->modelname,GFP_KERNEL );if (!codec->modelname) {
@@ -4038,7 +4043,7 @@ static void sync_power_up_states(struct hda_codec *codec) } } -#ifdef CONFIG_SND_HDA_HWDEP +#ifdef CONFIG_SND_HDA_RECONFIG /* execute additional init verbs */ static void hda_exec_init_verbs (struct hda_codec *codec) {
sound/pci/hda/hda_codec.h +5 -2
@@ -333,14 +333,17 @@ struct hda_codec {struct snd_array driver_pins;/* pin configs set by codec parser */ struct snd_array cvt_setups;/* audio convert setups */ -#ifdef CONFIG_SND_HDA_HWDEP +#ifdef CONFIG_SND_HDA_RECONFIG struct mutex user_mutex; -struct snd_hwdep *hwdep;/* assigned hwdep device */ struct snd_array init_verbs;/* additional init verbs */ struct snd_array hints;/* additional hints */ struct snd_array user_pins;/* default pin configs to override */ #endif +#ifdef CONFIG_SND_HDA_HWDEP +struct snd_hwdep *hwdep;/* assigned hwdep device */ +#endif +/* misc flags */ unsigned int spdif_status_reset :1; /* needs to toggle SPDIF for each* status change
sound/pci/hda/hda_hwdep.c +0 -754
786 lines not on this page · raw message
sound/pci/hda/hda_local.h +5 -0
@@ -597,6 +597,11 @@ int snd_hda_create_hwdep(struct hda_codec *codec);static inline int snd_hda_create_hwdep (struct hda_codec *codec) {return 0 ; }#endif +void snd_hda_sysfs_init (struct hda_codec *codec); +void snd_hda_sysfs_clear (struct hda_codec *codec); + +extern const struct attribute_group *snd_hda_dev_attr_groups[]; +#ifdef CONFIG_SND_HDA_RECONFIG const char *snd_hda_get_hint (struct hda_codec *codec,const char *key);int snd_hda_get_bool_hint (struct hda_codec *codec,const char *key);
sound/pci/hda/hda_sysfs.c new file +769 -0
769 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH 9/10 ALSA: hda - Enable sysfs attributes without CONFIG_SND_HDA_RECONFIG
In reply to Takashi IwaiSome sysfs attributes like init_pin_configs or vendor_name are really basic and should be available no matter whether the codec driver is re-configurable or not. Put them out of #ifdef CONFIG_SND_HDA_RECONFIG and allow the read-only accesses.
--- sound/pci/hda/hda_codec.h | 2 +- sound/pci/hda/hda_sysfs.c | 165 ++++++++++++++++++++++++---------------------- 2 files changed, 89 insertions(+), 78 deletions(-)
sound/pci/hda/hda_codec.h +1 -1
@@ -333,8 +333,8 @@ struct hda_codec {struct snd_array driver_pins;/* pin configs set by codec parser */ struct snd_array cvt_setups;/* audio convert setups */ -#ifdef CONFIG_SND_HDA_RECONFIG struct mutex user_mutex; +#ifdef CONFIG_SND_HDA_RECONFIG struct snd_array init_verbs;/* additional init verbs */ struct snd_array hints;/* additional hints */ struct snd_array user_pins;/* default pin configs to override */
sound/pci/hda/hda_sysfs.c +88 -77
226 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH 10/10 ALSA: hda - Replace with standard printk
In reply to Takashi IwaiUse dev_err() and co for messages from HD-audio controller and codec drivers. The codec drivers are mostly bound with codec objects, so some helper macros, codec_err(), codec_info(), etc, are provided. They merely wrap the corresponding dev_xxx().
There are a few places still calling snd_printk() and its variants as they are called without the codec or device context.
--- sound/pci/hda/hda_auto_parser.c | 35 +++--- sound/pci/hda/hda_beep.c | 2 +- sound/pci/hda/hda_codec.c | 137 ++++++++++++----------- sound/pci/hda/hda_eld.c | 17 ++- sound/pci/hda/hda_generic.c | 42 +++---- sound/pci/hda/hda_i915.c | 6 +- sound/pci/hda/hda_intel.c | 240 +++++++++++++++++++--------------------- sound/pci/hda/hda_local.h | 7 ++ sound/pci/hda/hda_sysfs.c | 6 +- sound/pci/hda/patch_ca0132.c | 208 +++++++++++++++++----------------- sound/pci/hda/patch_cmedia.c | 2 +- sound/pci/hda/patch_conexant.c | 32 +++--- sound/pci/hda/patch_hdmi.c | 76 ++++++------- sound/pci/hda/patch_realtek.c | 50 ++++----- sound/pci/hda/patch_si3054.c | 5 +- sound/pci/hda/patch_sigmatel.c | 12 +- sound/pci/hda/thinkpad_helper.c | 6 +- 17 files changed, 434 insertions(+), 449 deletions(-)
sound/pci/hda/hda_auto_parser.c +15 -20
@@ -313,9 +313,9 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, }if (hsmic) -snd_printdd ("Told to look for a headset mic, but didn't find any.\n" ); +codec_dbg (codec,"Told to look for a headset mic, but didn't find any.\n" );if (hpmic) -snd_printdd ("Told to look for a headphone mic, but didn't find any.\n" ); +codec_dbg (codec,"Told to look for a headphone mic, but didn't find any.\n" ); }/* FIX-UP:
@@ -384,33 +384,33 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,/* * debug prints of the parsed results */ -snd_printd ("autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n" , +codec_info (codec,"autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n" , cfg->line_outs, cfg->line_out_pins[0 ], cfg->line_out_pins[1 ], cfg->line_out_pins[2 ], cfg->line_out_pins[3 ], cfg->line_out_pins[4 ], cfg->line_out_type ==AUTO_PIN_HP_OUT ?"hp" : (cfg->line_out_type ==AUTO_PIN_SPEAKER_OUT ?"speaker" :"line" )); -snd_printd (" speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n" , +codec_info (codec," speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n" , cfg->speaker_outs, cfg->speaker_pins[0 ], cfg->speaker_pins[1 ], cfg->speaker_pins[2 ], cfg->speaker_pins[3 ], cfg->speaker_pins[4 ]); -snd_printd (" hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n" , +codec_info (codec," hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n" , cfg->hp_outs, cfg->hp_pins[0 ], cfg->hp_pins[1 ], cfg->hp_pins[2 ], cfg->hp_pins[3 ], cfg->hp_pins[4 ]); -snd_printd (" mono: mono_out=0x%x\n" , cfg->mono_out_pin); +codec_info (codec," mono: mono_out=0x%x\n" , cfg->mono_out_pin);if (cfg->dig_outs) -snd_printd (" dig-out=0x%x/0x%x\n" , +codec_info (codec," dig-out=0x%x/0x%x\n" , cfg->dig_out_pins[0 ], cfg->dig_out_pins[1 ]); -snd_printd (" inputs:\n" ); +codec_info (codec," inputs:\n" );for (i =0 ; i < cfg->num_inputs; i++) { -snd_printd (" %s=0x%x\n" , +codec_info (codec," %s=0x%x\n" ,hda_get_autocfg_input_label (codec, cfg, i), cfg->inputs[i].pin); }if (cfg->dig_in_pin) -snd_printd (" dig-in=0x%x\n" , cfg->dig_in_pin); +codec_info (codec," dig-in=0x%x\n" , cfg->dig_in_pin);return 0 ; }
@@ -774,38 +774,33 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)case HDA_FIXUP_PINS :if (action !=HDA_FIXUP_ACT_PRE_PROBE || !fix->v.pins)break ; - snd_printdd(KERN_INFO SFX -"%s: Apply pincfg for %s\n" , +codec_dbg (codec,"%s: Apply pincfg for %s\n" , codec->chip_name, modelname);snd_hda_apply_pincfgs (codec, fix->v.pins);break ;case HDA_FIXUP_VERBS :if (action !=HDA_FIXUP_ACT_PROBE || !fix->v.verbs)break ; - snd_printdd(KERN_INFO SFX -"%s: Apply fix-verbs for %s\n" , +codec_dbg (codec,"%s: Apply fix-verbs for %s\n" , codec->chip_name, modelname);snd_hda_add_verbs (codec, fix->v.verbs);break ;case HDA_FIXUP_FUNC :if (!fix->v.func)break ; - snd_printdd(KERN_INFO SFX -"%s: Apply fix-func for %s\n" , +codec_dbg (codec,"%s: Apply fix-func for %s\n" , codec->chip_name, modelname); fix->v.func (codec, fix, action);break ;case HDA_FIXUP_PINCTLS :if (action !=HDA_FIXUP_ACT_PROBE || !fix->v.pins)break ; - snd_printdd(KERN_INFO SFX -"%s: Apply pinctl for %s\n" , +codec_dbg (codec,"%s: Apply pinctl for %s\n" , codec->chip_name, modelname);set_pin_targets (codec, fix->v.pins);break ;default : - snd_printk(KERN_ERR SFX -"%s: Invalid fixup type %d\n" , +codec_err (codec,"%s: Invalid fixup type %d\n" , codec->chip_name, fix->type);break ; }
sound/pci/hda/hda_beep.c +1 -1
@@ -172,7 +172,7 @@ static int snd_hda_do_attach(struct hda_beep *beep) err =input_register_device (input_dev);if (err <0 ) {input_free_device (input_dev); -printk (KERN_INFO "hda_beep: unable to register input device\n" ); +codec_err (codec,"hda_beep: unable to register input device\n" );return err; } beep->dev = input_dev;
sound/pci/hda/hda_codec.c +68 -69
352 lines not on this page · raw message
sound/pci/hda/hda_eld.c +8 -9
@@ -153,7 +153,7 @@ static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid, val =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_HDMI_ELDD , byte_index);#ifdef BE_PARANOID -printk (KERN_INFO "HDMI: ELD data byte %d: 0x%x\n" , byte_index, val); +codec_info (codec,"HDMI: ELD data byte %d: 0x%x\n" , byte_index, val);#endif return val; }
@@ -332,11 +332,11 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid, size =snd_hdmi_get_eld_size (codec, nid);if (size ==0 ) {/* wfg: workaround for ASUS P5E-VM HDMI board */ -snd_printd (KERN_INFO "HDMI: ELD buf size is 0, force 128\n" ); +codec_info (codec,"HDMI: ELD buf size is 0, force 128\n" ); size =128 ; }if (size <ELD_FIXED_BYTES || size >ELD_MAX_SIZE ) { -snd_printd (KERN_INFO "HDMI: invalid ELD buf size %d\n" , size); +codec_info (codec,"HDMI: invalid ELD buf size %d\n" , size);return -ERANGE ; }
@@ -348,8 +348,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,* Just abort. The caller will repoll after a while. */ if (!(val &AC_ELDD_ELD_VALID )) { -snd_printd (KERN_INFO -"HDMI: invalid ELD data byte %d\n" , i); +codec_info (codec,"HDMI: invalid ELD data byte %d\n" , i); ret = -EINVAL ; goto error; }
@@ -361,7 +360,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,* correctly writes ELD content before setting ELD_valid bit. */ if (!val && !i) { -snd_printdd (KERN_INFO "HDMI: 0 ELD data\n" ); +codec_dbg (codec,"HDMI: 0 ELD data\n" ); ret = -EINVAL ; goto error; }
@@ -681,7 +680,7 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid, spkalloc =snd_hda_codec_read (codec, nid,0 ,ATI_VERB_GET_SPEAKER_ALLOCATION ,0 );if (spkalloc <=0 ) { -snd_printd (KERN_INFO "HDMI ATI/AMD: no speaker allocation for ELD\n" ); +codec_info (codec,"HDMI ATI/AMD: no speaker allocation for ELD\n" );return -EINVAL ; }
@@ -722,7 +721,7 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid, sink_desc_len =snd_hda_codec_read (codec, nid,0 ,ATI_VERB_GET_SINK_INFO_DATA ,0 );if (sink_desc_len >ELD_MAX_MNL ) { -snd_printd (KERN_INFO "HDMI ATI/AMD: Truncating HDMI sink description with length %d\n" , +codec_info (codec,"HDMI ATI/AMD: Truncating HDMI sink description with length %d\n" , sink_desc_len); sink_desc_len =ELD_MAX_MNL ; }
@@ -764,7 +763,7 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid, }if (pos ==ELD_FIXED_BYTES + sink_desc_len) { -snd_printd (KERN_INFO "HDMI ATI/AMD: no audio descriptors for ELD\n" ); +codec_info (codec,"HDMI ATI/AMD: no audio descriptors for ELD\n" );return -EINVAL ; }
sound/pci/hda/hda_generic.c +21 -21
162 lines not on this page · raw message
sound/pci/hda/hda_i915.c +3 -3
@@ -30,7 +30,7 @@ void hda_display_power(bool enable)if (!get_power || !put_power)return ; -snd_printdd ("HDA display power %s \n" , +pr_debug ("HDA display power %s \n" , enable ?"Enable" :"Disable" );if (enable)get_power ();
@@ -44,7 +44,7 @@ int hda_i915_init(void) get_power =symbol_request (i915_request_power_well);if (!get_power) { -snd_printk (KERN_WARNING "hda-i915: get_power symbol get fail\n" ); +pr_warn ("hda-i915: get_power symbol get fail\n" );return -ENODEV ; }
@@ -55,7 +55,7 @@ int hda_i915_init(void)return -ENODEV ; } -snd_printd ("HDA driver get symbol successfully from i915 module\n" ); +pr_debug ("HDA driver get symbol successfully from i915 module\n" );return err; }
sound/pci/hda/hda_intel.c +111 -129
592 lines not on this page · raw message
sound/pci/hda/hda_local.h +7 -0
@@ -758,4 +758,11 @@ void snd_hdmi_write_eld_info(struct hdmi_eld *eld,#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80void snd_print_channel_allocation (int spk_alloc,char *buf,int buflen); +/* +*/ +#define codec_err(codec, fmt, args...) dev_err(&(codec)->dev, fmt, ##args) +#define codec_warn(codec, fmt, args...) dev_warn(&(codec)->dev, fmt, ##args) +#define codec_info(codec, fmt, args...) dev_info(&(codec)->dev, fmt, ##args) +#define codec_dbg(codec, fmt, args...) dev_dbg(&(codec)->dev, fmt, ##args) +#endif /* __SOUND_HDA_LOCAL_H */
sound/pci/hda/hda_sysfs.c +3 -3
@@ -119,7 +119,7 @@ static int clear_codec(struct hda_codec *codec) err =snd_hda_codec_reset (codec);if (err <0 ) { -snd_printk (KERN_ERR "The codec is being used, can't free.\n" ); +codec_err (codec,"The codec is being used, can't free.\n" );return err; }snd_hda_sysfs_clear (codec);
@@ -131,10 +131,10 @@ static int reconfig_codec(struct hda_codec *codec)int err;snd_hda_power_up (codec); -snd_printk (KERN_INFO "hda-codec: reconfiguring\n" ); +codec_info (codec,"hda-codec: reconfiguring\n" ); err =snd_hda_codec_reset (codec);if (err <0 ) { -snd_printk (KERN_ERR +codec_err (codec,"The codec is being used, can't reconfigure.\n" ); goto error; }
sound/pci/hda/patch_ca0132.c +103 -105
706 lines not on this page · raw message
sound/pci/hda/patch_cmedia.c +1 -1
@@ -623,7 +623,7 @@ static int patch_cmi9880(struct hda_codec *codec) cmi9880_models, cmi9880_cfg_tbl);if (spec->board_config <0 ) { -snd_printdd (KERN_INFO "hda_codec: %s: BIOS auto-probing.\n" , +codec_dbg (codec,"%s: BIOS auto-probing.\n" , codec->chip_name); spec->board_config =CMI_AUTO ;/* try everything */ }
sound/pci/hda/patch_conexant.c +16 -16
@@ -1900,7 +1900,8 @@ static void cxt5066_update_speaker(struct hda_codec *codec)struct conexant_spec *spec = codec->spec;unsigned int pinctl; -snd_printdd ("CXT5066: update speaker, hp_present=%d, cur_eapd=%d\n" , +codec_dbg (codec, +"CXT5066: update speaker, hp_present=%d, cur_eapd=%d\n" , spec->hp_present, spec->cur_eapd);/* Port A (HP) */
@@ -1969,10 +1970,10 @@ static void cxt5066_vostro_automic(struct hda_codec *codec) present =snd_hda_jack_detect (codec,0x1a );if (present) { -snd_printdd ("CXT5066: external microphone detected\n" ); +codec_dbg (codec,"CXT5066: external microphone detected\n" );snd_hda_sequence_write (codec, ext_mic_present); }else { -snd_printdd ("CXT5066: external microphone absent\n" ); +codec_dbg (codec,"CXT5066: external microphone absent\n" );snd_hda_sequence_write (codec, ext_mic_absent); } }
@@ -1997,10 +1998,10 @@ static void cxt5066_ideapad_automic(struct hda_codec *codec) present =snd_hda_jack_detect (codec,0x1b );if (present) { -snd_printdd ("CXT5066: external microphone detected\n" ); +codec_dbg (codec,"CXT5066: external microphone detected\n" );snd_hda_sequence_write (codec, ext_mic_present); }else { -snd_printdd ("CXT5066: external microphone absent\n" ); +codec_dbg (codec,"CXT5066: external microphone absent\n" );snd_hda_sequence_write (codec, ext_mic_absent); } }
@@ -2012,7 +2013,7 @@ static void cxt5066_asus_automic(struct hda_codec *codec)unsigned int present; present =snd_hda_jack_detect (codec,0x1b ); -snd_printdd ("CXT5066: external microphone present=%d\n" , present); +codec_dbg (codec,"CXT5066: external microphone present=%d\n" , present);snd_hda_codec_write (codec,0x17 ,0 ,AC_VERB_SET_CONNECT_SEL , present ?1 :0 ); }
@@ -2024,7 +2025,7 @@ static void cxt5066_hp_laptop_automic(struct hda_codec *codec)unsigned int present; present =snd_hda_jack_detect (codec,0x1b ); -snd_printdd ("CXT5066: external microphone present=%d\n" , present); +codec_dbg (codec,"CXT5066: external microphone present=%d\n" , present);snd_hda_codec_write (codec,0x17 ,0 ,AC_VERB_SET_CONNECT_SEL , present ?1 :3 ); }
@@ -2063,13 +2064,13 @@ static void cxt5066_thinkpad_automic(struct hda_codec *codec) ext_present =snd_hda_jack_detect (codec,0x1b ); dock_present =snd_hda_jack_detect (codec,0x1a );if (ext_present) { -snd_printdd ("CXT5066: external microphone detected\n" ); +codec_dbg (codec,"CXT5066: external microphone detected\n" );snd_hda_sequence_write (codec, ext_mic_present); }else if (dock_present) { -snd_printdd ("CXT5066: dock microphone detected\n" ); +codec_dbg (codec,"CXT5066: dock microphone detected\n" );snd_hda_sequence_write (codec, dock_mic_present); }else { -snd_printdd ("CXT5066: external microphone absent\n" ); +codec_dbg (codec,"CXT5066: external microphone absent\n" );snd_hda_sequence_write (codec, ext_mic_absent); } }
@@ -2088,7 +2089,7 @@ static void cxt5066_hp_automute(struct hda_codec *codec) spec->hp_present = portA ?HP_PRESENT_PORT_A :0 ; spec->hp_present |= portD ?HP_PRESENT_PORT_D :0 ; -snd_printdd ("CXT5066: hp automute portA=%x portD=%x present=%d\n" , +codec_dbg (codec,"CXT5066: hp automute portA=%x portD=%x present=%d\n" , portA, portD, spec->hp_present);cxt5066_update_speaker (codec); }
@@ -2113,7 +2114,7 @@ static void cxt5066_automic(struct hda_codec *codec)/* unsolicited event for jack sensing */ static void cxt5066_unsol_event (struct hda_codec *codec,unsigned int res) { -snd_printdd ("CXT5066: unsol event %x (%x)\n" , res, res >>26 ); +codec_dbg (codec,"CXT5066: unsol event %x (%x)\n" , res, res >>26 );switch (res >>26 ) {case CONEXANT_HP_EVENT :cxt5066_hp_automute (codec);
@@ -2509,7 +2510,7 @@ static const struct hda_verb cxt5066_init_verbs_hp_laptop[] = {/* initialize jack-sensing, too */ static int cxt5066_init (struct hda_codec *codec) { -snd_printdd ("CXT5066: init\n" ); +codec_dbg (codec,"CXT5066: init\n" );conexant_init (codec);if (codec->patch_ops.unsol_event) {cxt5066_hp_automute (codec);
@@ -3401,8 +3402,7 @@ static int patch_conexant_auto(struct hda_codec *codec)struct conexant_spec *spec;int err; -printk (KERN_INFO "hda_codec: %s: BIOS auto-probing.\n" , - codec->chip_name); +codec_info (codec,"%s: BIOS auto-probing.\n" , codec->chip_name); spec =kzalloc (sizeof (*spec),GFP_KERNEL );if (!spec)
@@ -3474,7 +3474,7 @@ static int patch_conexant_auto(struct hda_codec *codec)* Better to make reset, then. */ if (!codec->bus->sync_write) { -snd_printd ("hda_codec: " +codec_info (codec,"Enable sync_write for stable communication\n" ); codec->bus->sync_write =1 ; codec->bus->allow_bus_reset =1 ;
sound/pci/hda/patch_hdmi.c +39 -37
256 lines not on this page · raw message
sound/pci/hda/patch_realtek.c +25 -25
130 lines not on this page · raw message
sound/pci/hda/patch_si3054.c +3 -2
@@ -236,7 +236,7 @@ static int si3054_init(struct hda_codec *codec) }while ((val &SI3054_MEI_READY ) !=SI3054_MEI_READY && wait_count--);if ((val&SI3054_MEI_READY ) !=SI3054_MEI_READY ) { -snd_printk (KERN_ERR "si3054: cannot initialize. EXT MID = %04x\n" , val); +codec_err (codec,"si3054: cannot initialize. EXT MID = %04x\n" , val);/* let's pray that this is no fatal error */ /* return -EACCES; */ }
@@ -247,7 +247,8 @@ static int si3054_init(struct hda_codec *codec)SET_REG (codec,SI3054_LINE_CFG1 ,0x200 );if ((GET_REG (codec,SI3054_LINE_STATUS ) & (1 <<6 )) ==0 ) { -snd_printd ("Link Frame Detect(FDT) is not ready (line status: %04x)\n" , +codec_dbg (codec, +"Link Frame Detect(FDT) is not ready (line status: %04x)\n" ,GET_REG (codec,SI3054_LINE_STATUS )); }
sound/pci/hda/patch_sigmatel.c +6 -6
@@ -296,7 +296,7 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, {unsigned int gpiostate, gpiomask, gpiodir; -snd_printdd ("%s msk %x dir %x gpio %x\n" , __func__, mask, dir_mask, data); +codec_dbg (codec,"%s msk %x dir %x gpio %x\n" , __func__, mask, dir_mask, data); gpiostate =snd_hda_codec_read (codec, codec->afg,0 ,AC_VERB_GET_GPIO_DATA ,0 );
@@ -359,7 +359,7 @@ static int stac_vrefout_set(struct hda_codec *codec, {int error, pinctl; -snd_printdd ("%s, nid %x ctl %x\n" , __func__, nid, new_vref); +codec_dbg (codec,"%s, nid %x ctl %x\n" , __func__, nid, new_vref); pinctl =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_PIN_WIDGET_CONTROL ,0 );
@@ -2086,7 +2086,7 @@ static void stac92hd83xxx_fixup_hp(struct hda_codec *codec, }if (find_mute_led_cfg (codec, spec->default_polarity)) -snd_printd ("mute LED gpio %d polarity %d\n" , +codec_dbg (codec,"mute LED gpio %d polarity %d\n" , spec->gpio_led, spec->gpio_led_polarity); }
@@ -3077,7 +3077,7 @@ static void stac92hd71bxx_fixup_hp(struct hda_codec *codec, }if (find_mute_led_cfg (codec,1 )) -snd_printd ("mute LED gpio %d polarity %d\n" , +codec_dbg (codec,"mute LED gpio %d polarity %d\n" , spec->gpio_led, spec->gpio_led_polarity);
@@ -4422,8 +4422,8 @@ static int patch_stac92hd73xx(struct hda_codec *codec) num_dacs =snd_hda_get_num_conns (codec,0x0a ) -1 ;if (num_dacs <3 || num_dacs >5 ) { -printk (KERN_WARNING "hda_codec: Could not determine " -"number of channels defaulting to DAC count\n" ); +codec_warn (codec, +"Could not determine number of channels defaulting to DAC count\n" ); num_dacs =5 ; }
sound/pci/hda/thinkpad_helper.c +4 -2
@@ -63,7 +63,8 @@ static void hda_fixup_thinkpad_acpi(struct hda_codec *codec,if (!led_set_func) led_set_func =symbol_request (tpacpi_led_set);if (!led_set_func) { -snd_printk (KERN_WARNING "Failed to find thinkpad-acpi symbol tpacpi_led_set\n" ); +codec_warn (codec, +"Failed to find thinkpad-acpi symbol tpacpi_led_set\n" );return ; }
@@ -75,7 +76,8 @@ static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, }if (led_set_func (TPACPI_LED_MICMUTE , false) >=0 ) {if (spec->num_adc_nids >1 ) -snd_printdd ("Skipping micmute LED control due to several ADCs" ); +codec_dbg (codec, +"Skipping micmute LED control due to several ADCs" );else { spec->cap_sync_hook = update_tpacpi_micmute_led; removefunc = false;
Signature · 1 line
1.9.0