Lines Matching refs:codec
3 * sysfs interface for HD-audio codec
34 struct hda_codec *codec = dev_get_drvdata(dev);
35 snd_hda_update_power_acct(codec);
36 return sprintf(buf, "%u\n", jiffies_to_msecs(codec->power_on_acct));
43 struct hda_codec *codec = dev_get_drvdata(dev);
44 snd_hda_update_power_acct(codec);
45 return sprintf(buf, "%u\n", jiffies_to_msecs(codec->power_off_acct));
57 struct hda_codec *codec = dev_get_drvdata(dev); \
58 return sprintf(buf, "0x%x\n", codec->field); \
66 struct hda_codec *codec = dev_get_drvdata(dev); \
68 codec->field ? codec->field : ""); \
80 static ssize_t pin_configs_show(struct hda_codec *codec,
86 mutex_lock(&codec->user_mutex);
91 mutex_unlock(&codec->user_mutex);
99 struct hda_codec *codec = dev_get_drvdata(dev);
100 return pin_configs_show(codec, &codec->init_pins, buf);
107 struct hda_codec *codec = dev_get_drvdata(dev);
108 return pin_configs_show(codec, &codec->driver_pins, buf);
117 static int clear_codec(struct hda_codec *codec)
121 err = snd_hda_codec_reset(codec);
123 codec_err(codec, "The codec is being used, can't free.\n");
126 snd_hda_sysfs_clear(codec);
130 static int reconfig_codec(struct hda_codec *codec)
134 snd_hda_power_up(codec);
135 codec_info(codec, "hda-codec: reconfiguring\n");
136 err = snd_hda_codec_reset(codec);
138 codec_err(codec,
139 "The codec is being used, can't reconfigure.\n");
142 err = device_reprobe(hda_codec_dev(codec));
145 err = snd_card_register(codec->card);
147 snd_hda_power_down(codec);
171 struct hda_codec *codec = dev_get_drvdata(dev); \
176 codec->field = val; \
185 struct hda_codec *codec = dev_get_drvdata(dev); \
189 kfree(codec->field); \
190 codec->field = s; \
206 struct hda_codec *codec = dev_get_drvdata(dev); \
209 err = type##_codec(codec); \
220 struct hda_codec *codec = dev_get_drvdata(dev);
223 mutex_lock(&codec->user_mutex);
224 snd_array_for_each(&codec->init_verbs, i, v) {
229 mutex_unlock(&codec->user_mutex);
233 static int parse_init_verbs(struct hda_codec *codec, const char *buf)
242 mutex_lock(&codec->user_mutex);
243 v = snd_array_new(&codec->init_verbs);
245 mutex_unlock(&codec->user_mutex);
251 mutex_unlock(&codec->user_mutex);
259 struct hda_codec *codec = dev_get_drvdata(dev);
260 int err = parse_init_verbs(codec, buf);
270 struct hda_codec *codec = dev_get_drvdata(dev);
273 mutex_lock(&codec->user_mutex);
274 snd_array_for_each(&codec->hints, i, hint) {
278 mutex_unlock(&codec->user_mutex);
282 static struct hda_hint *get_hint(struct hda_codec *codec, const char *key)
287 snd_array_for_each(&codec->hints, i, hint) {
309 static int parse_hints(struct hda_codec *codec, const char *buf)
333 mutex_lock(&codec->user_mutex);
334 hint = get_hint(codec, key);
343 if (codec->hints.used >= MAX_HINTS)
346 hint = snd_array_new(&codec->hints);
354 mutex_unlock(&codec->user_mutex);
364 struct hda_codec *codec = dev_get_drvdata(dev);
365 int err = parse_hints(codec, buf);
375 struct hda_codec *codec = dev_get_drvdata(dev);
376 return pin_configs_show(codec, &codec->user_pins, buf);
381 static int parse_user_pin_configs(struct hda_codec *codec, const char *buf)
389 mutex_lock(&codec->user_mutex);
390 err = snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg);
391 mutex_unlock(&codec->user_mutex);
399 struct hda_codec *codec = dev_get_drvdata(dev);
400 int err = parse_user_pin_configs(codec, buf);
415 * @codec: the HDA codec
421 const char *snd_hda_get_hint(struct hda_codec *codec, const char *key)
423 struct hda_hint *hint = get_hint(codec, key);
430 * @codec: the HDA codec
437 int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key)
442 mutex_lock(&codec->user_mutex);
443 p = snd_hda_get_hint(codec, key);
458 mutex_unlock(&codec->user_mutex);
465 * @codec: the HDA codec
473 int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp)
479 mutex_lock(&codec->user_mutex);
480 p = snd_hda_get_hint(codec, key);
489 mutex_unlock(&codec->user_mutex);
537 /* parse the contents after the line "[codec]"
538 * accept only the line with three numbers, and assign the current codec
544 struct hda_codec *codec;
548 list_for_each_codec(codec, bus) {
549 if ((vendorid <= 0 || codec->core.vendor_id == vendorid) &&
550 (subid <= 0 || codec->core.subsystem_id == subid) &&
551 codec->core.addr == caddr) {
552 *codecp = codec;
561 * just pass to the sysfs helper (only when any codec was specified)
616 .tag = "[codec]",
718 struct hda_codec *codec;
722 codec = NULL;
729 (codec || line_mode <= LINE_MODE_CODEC))
730 patch_items[line_mode].parser(buf, bus, &codec);
774 void snd_hda_sysfs_init(struct hda_codec *codec)
776 mutex_init(&codec->user_mutex);
778 snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32);
779 snd_array_init(&codec->hints, sizeof(struct hda_hint), 32);
780 snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16);
784 void snd_hda_sysfs_clear(struct hda_codec *codec)
791 snd_array_free(&codec->init_verbs);
793 snd_array_for_each(&codec->hints, i, hint) {
796 snd_array_free(&codec->hints);
797 snd_array_free(&codec->user_pins);