Lines Matching full:codec
3 * sysfs interface for HD-audio codec
33 struct hda_codec *codec = dev_get_drvdata(dev);
34 snd_hda_update_power_acct(codec);
35 return sysfs_emit(buf, "%u\n", jiffies_to_msecs(codec->power_on_acct));
42 struct hda_codec *codec = dev_get_drvdata(dev);
43 snd_hda_update_power_acct(codec);
44 return sysfs_emit(buf, "%u\n", jiffies_to_msecs(codec->power_off_acct));
55 struct hda_codec *codec = dev_get_drvdata(dev); \
56 return sysfs_emit(buf, "0x%x\n", codec->field); \
64 struct hda_codec *codec = dev_get_drvdata(dev); \
66 codec->field ? codec->field : ""); \
78 static ssize_t pin_configs_show(struct hda_codec *codec,
85 guard(mutex)(&codec->user_mutex);
97 struct hda_codec *codec = dev_get_drvdata(dev);
98 return pin_configs_show(codec, &codec->init_pins, buf);
105 struct hda_codec *codec = dev_get_drvdata(dev);
106 return pin_configs_show(codec, &codec->driver_pins, buf);
115 static int clear_codec(struct hda_codec *codec)
119 err = snd_hda_codec_reset(codec);
121 codec_err(codec, "The codec is being used, can't free.\n");
124 snd_hda_sysfs_clear(codec);
128 static int reconfig_codec(struct hda_codec *codec)
132 CLASS(snd_hda_power, pm)(codec);
133 codec_info(codec, "hda-codec: reconfiguring\n");
134 err = snd_hda_codec_reset(codec);
136 codec_err(codec,
137 "The codec is being used, can't reconfigure.\n");
140 err = device_reprobe(hda_codec_dev(codec));
143 return snd_card_register(codec->card);
166 struct hda_codec *codec = dev_get_drvdata(dev); \
171 codec->field = val; \
180 struct hda_codec *codec = dev_get_drvdata(dev); \
184 kfree(codec->field); \
185 codec->field = s; \
201 struct hda_codec *codec = dev_get_drvdata(dev); \
204 err = type##_codec(codec); \
215 struct hda_codec *codec = dev_get_drvdata(dev);
219 guard(mutex)(&codec->user_mutex);
220 snd_array_for_each(&codec->init_verbs, i, v) {
227 static int parse_init_verbs(struct hda_codec *codec, const char *buf)
236 guard(mutex)(&codec->user_mutex);
237 v = snd_array_new(&codec->init_verbs);
250 struct hda_codec *codec = dev_get_drvdata(dev);
251 int err = parse_init_verbs(codec, buf);
261 struct hda_codec *codec = dev_get_drvdata(dev);
265 guard(mutex)(&codec->user_mutex);
266 snd_array_for_each(&codec->hints, i, hint) {
273 static struct hda_hint *get_hint(struct hda_codec *codec, const char *key)
278 snd_array_for_each(&codec->hints, i, hint) {
300 static int parse_hints(struct hda_codec *codec, const char *buf)
322 guard(mutex)(&codec->user_mutex);
323 hint = get_hint(codec, key);
330 if (codec->hints.used >= MAX_HINTS)
332 hint = snd_array_new(&codec->hints);
345 struct hda_codec *codec = dev_get_drvdata(dev);
346 int err = parse_hints(codec, buf);
356 struct hda_codec *codec = dev_get_drvdata(dev);
357 return pin_configs_show(codec, &codec->user_pins, buf);
360 static int parse_user_pin_configs(struct hda_codec *codec, const char *buf)
368 guard(mutex)(&codec->user_mutex);
369 return snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg);
376 struct hda_codec *codec = dev_get_drvdata(dev);
377 int err = parse_user_pin_configs(codec, buf);
392 * @codec: the HDA codec
398 const char *snd_hda_get_hint(struct hda_codec *codec, const char *key)
400 struct hda_hint *hint = get_hint(codec, key);
407 * @codec: the HDA codec
414 int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key)
418 guard(mutex)(&codec->user_mutex);
419 p = snd_hda_get_hint(codec, key);
435 * @codec: the HDA codec
443 int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp)
448 guard(mutex)(&codec->user_mutex);
449 p = snd_hda_get_hint(codec, key);
504 /* parse the contents after the line "[codec]"
505 * accept only the line with three numbers, and assign the current codec
511 struct hda_codec *codec;
515 list_for_each_codec(codec, bus) {
516 if ((vendorid <= 0 || codec->core.vendor_id == vendorid) &&
517 (subid <= 0 || codec->core.subsystem_id == subid) &&
518 codec->core.addr == caddr) {
519 *codecp = codec;
528 * just pass to the sysfs helper (only when any codec was specified)
583 .tag = "[codec]",
685 struct hda_codec *codec;
689 codec = NULL;
696 (codec || line_mode <= LINE_MODE_CODEC))
697 patch_items[line_mode].parser(buf, bus, &codec);
739 void snd_hda_sysfs_init(struct hda_codec *codec)
741 mutex_init(&codec->user_mutex);
743 snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32);
744 snd_array_init(&codec->hints, sizeof(struct hda_hint), 32);
745 snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16);
749 void snd_hda_sysfs_clear(struct hda_codec *codec)
756 snd_array_free(&codec->init_verbs);
758 snd_array_for_each(&codec->hints, i, hint) {
761 snd_array_free(&codec->hints);
762 snd_array_free(&codec->user_pins);