Lines Matching refs:codec
23 struct hdac_device *codec = dev_to_hdac_dev(dev); \
24 return sprintf(buf, "0x%x\n", codec->type); \
33 struct hdac_device *codec = dev_to_hdac_dev(dev); \
35 codec->type ? codec->type : ""); \
88 ssize_t (*show)(struct hdac_device *codec, hda_nid_t nid,
90 ssize_t (*store)(struct hdac_device *codec, hda_nid_t nid,
113 struct hdac_device *codec; in widget_attr_show() local
118 nid = get_codec_nid(kobj, &codec); in widget_attr_show()
121 return wid_attr->show(codec, nid, wid_attr, buf); in widget_attr_show()
129 struct hdac_device *codec; in widget_attr_store() local
134 nid = get_codec_nid(kobj, &codec); in widget_attr_store()
137 return wid_attr->store(codec, nid, wid_attr, buf, count); in widget_attr_store()
160 static ssize_t caps_show(struct hdac_device *codec, hda_nid_t nid, in caps_show() argument
163 return sprintf(buf, "0x%08x\n", get_wcaps(codec, nid)); in caps_show()
166 static ssize_t pin_caps_show(struct hdac_device *codec, hda_nid_t nid, in pin_caps_show() argument
169 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in pin_caps_show()
172 snd_hdac_read_parm(codec, nid, AC_PAR_PIN_CAP)); in pin_caps_show()
175 static ssize_t pin_cfg_show(struct hdac_device *codec, hda_nid_t nid, in pin_cfg_show() argument
180 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in pin_cfg_show()
182 if (snd_hdac_read(codec, nid, AC_VERB_GET_CONFIG_DEFAULT, 0, &val)) in pin_cfg_show()
187 static bool has_pcm_cap(struct hdac_device *codec, hda_nid_t nid) in has_pcm_cap() argument
189 if (nid == codec->afg || nid == codec->mfg) in has_pcm_cap()
191 switch (get_wcaps_type(get_wcaps(codec, nid))) { in has_pcm_cap()
200 static ssize_t pcm_caps_show(struct hdac_device *codec, hda_nid_t nid, in pcm_caps_show() argument
203 if (!has_pcm_cap(codec, nid)) in pcm_caps_show()
206 snd_hdac_read_parm(codec, nid, AC_PAR_PCM)); in pcm_caps_show()
209 static ssize_t pcm_formats_show(struct hdac_device *codec, hda_nid_t nid, in pcm_formats_show() argument
212 if (!has_pcm_cap(codec, nid)) in pcm_formats_show()
215 snd_hdac_read_parm(codec, nid, AC_PAR_STREAM)); in pcm_formats_show()
218 static ssize_t amp_in_caps_show(struct hdac_device *codec, hda_nid_t nid, in amp_in_caps_show() argument
221 if (nid != codec->afg && !(get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) in amp_in_caps_show()
224 snd_hdac_read_parm(codec, nid, AC_PAR_AMP_IN_CAP)); in amp_in_caps_show()
227 static ssize_t amp_out_caps_show(struct hdac_device *codec, hda_nid_t nid, in amp_out_caps_show() argument
230 if (nid != codec->afg && !(get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) in amp_out_caps_show()
233 snd_hdac_read_parm(codec, nid, AC_PAR_AMP_OUT_CAP)); in amp_out_caps_show()
236 static ssize_t power_caps_show(struct hdac_device *codec, hda_nid_t nid, in power_caps_show() argument
239 if (nid != codec->afg && !(get_wcaps(codec, nid) & AC_WCAP_POWER)) in power_caps_show()
242 snd_hdac_read_parm(codec, nid, AC_PAR_POWER_STATE)); in power_caps_show()
245 static ssize_t gpio_caps_show(struct hdac_device *codec, hda_nid_t nid, in gpio_caps_show() argument
249 snd_hdac_read_parm(codec, nid, AC_PAR_GPIO_CAP)); in gpio_caps_show()
252 static ssize_t connections_show(struct hdac_device *codec, hda_nid_t nid, in connections_show() argument
259 nconns = snd_hdac_get_connections(codec, nid, list, ARRAY_SIZE(list)); in connections_show()
319 static void widget_tree_free(struct hdac_device *codec) in widget_tree_free() argument
321 struct hdac_widget_tree *tree = codec->widgets; in widget_tree_free()
334 codec->widgets = NULL; in widget_tree_free()
360 static int widget_tree_create(struct hdac_device *codec) in widget_tree_create() argument
366 tree = codec->widgets = kzalloc(sizeof(*tree), GFP_KERNEL); in widget_tree_create()
370 tree->root = kobject_create_and_add("widgets", &codec->dev.kobj); in widget_tree_create()
374 tree->nodes = kcalloc(codec->num_nodes + 1, sizeof(*tree->nodes), in widget_tree_create()
379 for (i = 0, nid = codec->start_nid; i < codec->num_nodes; i++, nid++) { in widget_tree_create()
386 if (codec->afg) { in widget_tree_create()
387 err = add_widget_node(tree->root, codec->afg, in widget_tree_create()
397 int hda_widget_sysfs_init(struct hdac_device *codec) in hda_widget_sysfs_init() argument
401 if (codec->widgets) in hda_widget_sysfs_init()
404 err = widget_tree_create(codec); in hda_widget_sysfs_init()
406 widget_tree_free(codec); in hda_widget_sysfs_init()
413 void hda_widget_sysfs_exit(struct hdac_device *codec) in hda_widget_sysfs_exit() argument
415 widget_tree_free(codec); in hda_widget_sysfs_exit()