ALSA: hdac: add snd_hdac_refresh_widget_sysfs()
authorVinod Koul <vinod.koul@intel.com>
Fri, 21 Aug 2015 10:17:43 +0000 (15:47 +0530)
committerTakashi Iwai <tiwai@suse.de>
Fri, 21 Aug 2015 10:34:50 +0000 (12:34 +0200)
Some codecs like Intel HDMI by default do not show up all the pins, they
have to be manually enabled, so we need to refresh the codec widgets and
then recreate the sysfs tree. So add new API snd_hdac_refresh_widget_sysfs()
to do this. It should be be used by codec driver after sending magic verbs
to codec

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/hdaudio.h
sound/hda/hdac_device.c

index 288c7fa509d8485abcd81eb1a19b1c3ea12a685f..23a44c39c51c30b14dc346a8938b09e3482baf88 100644 (file)
@@ -119,6 +119,7 @@ int snd_hdac_device_register(struct hdac_device *codec);
 void snd_hdac_device_unregister(struct hdac_device *codec);
 
 int snd_hdac_refresh_widgets(struct hdac_device *codec);
+int snd_hdac_refresh_widget_sysfs(struct hdac_device *codec);
 
 unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid,
                               unsigned int verb, unsigned int parm);
index df7039ebe1faaeaaf5cbb86e5baa4d45e0329c3e..aa6d6cec238046e86d5bd9656bd1352f42110337 100644 (file)
@@ -372,6 +372,34 @@ int snd_hdac_refresh_widgets(struct hdac_device *codec)
 }
 EXPORT_SYMBOL_GPL(snd_hdac_refresh_widgets);
 
+/**
+ * snd_hdac_refresh_widget_sysfs - Reset the codec widgets and reinit the
+ * codec sysfs
+ * @codec: the codec object
+ *
+ * first we need to remove sysfs, then refresh widgets and lastly
+ * recreate it
+ */
+int snd_hdac_refresh_widget_sysfs(struct hdac_device *codec)
+{
+       int ret;
+
+       hda_widget_sysfs_exit(codec);
+       ret = snd_hdac_refresh_widgets(codec);
+       if (ret) {
+               dev_err(&codec->dev, "failed to refresh widget: %d\n", ret);
+               return ret;
+       }
+       ret = hda_widget_sysfs_init(codec);
+       if (ret) {
+               dev_err(&codec->dev, "failed to init sysfs: %d\n", ret);
+               return ret;
+       }
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(snd_hdac_refresh_widget_sysfs);
+
 /* return CONNLIST_LEN parameter of the given widget */
 static unsigned int get_num_conns(struct hdac_device *codec, hda_nid_t nid)
 {
This page took 0.035613 seconds and 5 git commands to generate.