Lines Matching refs:codec

24 	struct hdac_device *codec = dev_to_hdac_dev(dev);	\
25 return sysfs_emit(buf, "0x%x\n", codec->type); \
34 struct hdac_device *codec = dev_to_hdac_dev(dev); \
36 codec->type ? codec->type : ""); \
89 ssize_t (*show)(struct hdac_device *codec, hda_nid_t nid,
91 ssize_t (*store)(struct hdac_device *codec, hda_nid_t nid,
114 struct hdac_device *codec;
119 nid = get_codec_nid(kobj, &codec);
122 return wid_attr->show(codec, nid, wid_attr, buf);
130 struct hdac_device *codec;
135 nid = get_codec_nid(kobj, &codec);
138 return wid_attr->store(codec, nid, wid_attr, buf, count);
161 static ssize_t caps_show(struct hdac_device *codec, hda_nid_t nid,
164 return sysfs_emit(buf, "0x%08x\n", get_wcaps(codec, nid));
167 static ssize_t pin_caps_show(struct hdac_device *codec, hda_nid_t nid,
170 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
173 snd_hdac_read_parm(codec, nid, AC_PAR_PIN_CAP));
176 static ssize_t pin_cfg_show(struct hdac_device *codec, hda_nid_t nid,
181 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
183 if (snd_hdac_read(codec, nid, AC_VERB_GET_CONFIG_DEFAULT, 0, &val))
188 static bool has_pcm_cap(struct hdac_device *codec, hda_nid_t nid)
190 if (nid == codec->afg || nid == codec->mfg)
192 switch (get_wcaps_type(get_wcaps(codec, nid))) {
201 static ssize_t pcm_caps_show(struct hdac_device *codec, hda_nid_t nid,
204 if (!has_pcm_cap(codec, nid))
207 snd_hdac_read_parm(codec, nid, AC_PAR_PCM));
210 static ssize_t pcm_formats_show(struct hdac_device *codec, hda_nid_t nid,
213 if (!has_pcm_cap(codec, nid))
216 snd_hdac_read_parm(codec, nid, AC_PAR_STREAM));
219 static ssize_t amp_in_caps_show(struct hdac_device *codec, hda_nid_t nid,
222 if (nid != codec->afg && !(get_wcaps(codec, nid) & AC_WCAP_IN_AMP))
225 snd_hdac_read_parm(codec, nid, AC_PAR_AMP_IN_CAP));
228 static ssize_t amp_out_caps_show(struct hdac_device *codec, hda_nid_t nid,
231 if (nid != codec->afg && !(get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
234 snd_hdac_read_parm(codec, nid, AC_PAR_AMP_OUT_CAP));
237 static ssize_t power_caps_show(struct hdac_device *codec, hda_nid_t nid,
240 if (nid != codec->afg && !(get_wcaps(codec, nid) & AC_WCAP_POWER))
243 snd_hdac_read_parm(codec, nid, AC_PAR_POWER_STATE));
246 static ssize_t gpio_caps_show(struct hdac_device *codec, hda_nid_t nid,
250 snd_hdac_read_parm(codec, nid, AC_PAR_GPIO_CAP));
253 static ssize_t connections_show(struct hdac_device *codec, hda_nid_t nid,
260 nconns = snd_hdac_get_connections(codec, nid, list, ARRAY_SIZE(list));
320 static void widget_tree_free(struct hdac_device *codec)
322 struct hdac_widget_tree *tree = codec->widgets;
335 codec->widgets = NULL;
363 static int widget_tree_create(struct hdac_device *codec)
369 tree = codec->widgets = kzalloc(sizeof(*tree), GFP_KERNEL);
373 tree->root = kobject_create_and_add("widgets", &codec->dev.kobj);
377 tree->nodes = kcalloc(codec->num_nodes + 1, sizeof(*tree->nodes),
382 for (i = 0, nid = codec->start_nid; i < codec->num_nodes; i++, nid++) {
389 if (codec->afg) {
390 err = add_widget_node(tree->root, codec->afg,
400 /* call with codec->widget_lock held */
401 int hda_widget_sysfs_init(struct hdac_device *codec)
405 if (codec->widgets)
408 err = widget_tree_create(codec);
410 widget_tree_free(codec);
417 /* call with codec->widget_lock held */
418 void hda_widget_sysfs_exit(struct hdac_device *codec)
420 widget_tree_free(codec);
423 /* call with codec->widget_lock held */
424 int hda_widget_sysfs_reinit(struct hdac_device *codec,
432 if (!codec->widgets)
435 tree = kmemdup(codec->widgets, sizeof(*tree), GFP_KERNEL);
446 for (i = 0, nid = codec->start_nid; i < codec->num_nodes; i++, nid++) {
448 free_widget_node(codec->widgets->nodes[i],
454 if (nid < codec->start_nid || nid >= codec->end_nid)
459 codec->widgets->nodes[nid - codec->start_nid];
463 kfree(codec->widgets->nodes);
464 kfree(codec->widgets);
465 codec->widgets = tree;