summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-25 10:38:13 +0100
committerTakashi Iwai <tiwai@suse.de>2014-02-25 12:12:54 +0100
commit648a8d276ed10062addd4a4e18aaf9ff84f14543 (patch)
tree5f0dcf8587dfb6123b51fe379e8aaf8812368ef2 /sound/pci/hda/hda_codec.c
parentALSA: hda - Create own device struct for each codec (diff)
downloadlinux-648a8d276ed10062addd4a4e18aaf9ff84f14543.tar.xz
linux-648a8d276ed10062addd4a4e18aaf9ff84f14543.zip
ALSA: hda - Add sysfs to codec object, too
We 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. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 98baf5674a63..2cba4dc6349a 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -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)
{