Lines Matching defs: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 sysfs_emit(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 sysfs_emit(buf, "%u\n", jiffies_to_msecs(codec->power_off_acct));
57 struct hda_codec *codec = dev_get_drvdata(dev); \
58 return sysfs_emit(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) {
228 mutex_unlock(&codec->user_mutex);
232 static int parse_init_verbs(struct hda_codec *codec, const char *buf)
241 mutex_lock(&codec->user_mutex);
242 v = snd_array_new(&codec->init_verbs);
244 mutex_unlock(&codec->user_mutex);
250 mutex_unlock(&codec->user_mutex);
258 struct hda_codec *codec = dev_get_drvdata(dev);
259 int err = parse_init_verbs(codec, buf);
269 struct hda_codec *codec = dev_get_drvdata(dev);
272 mutex_lock(&codec->user_mutex);
273 snd_array_for_each(&codec->hints, i, hint) {
277 mutex_unlock(&codec->user_mutex);
281 static struct hda_hint *get_hint(struct hda_codec *codec, const char *key)
286 snd_array_for_each(&codec->hints, i, hint) {
308 static int parse_hints(struct hda_codec *codec, const char *buf)
332 mutex_lock(&codec->user_mutex);
333 hint = get_hint(codec, key);
342 if (codec->hints.used >= MAX_HINTS)
345 hint = snd_array_new(&codec->hints);
353 mutex_unlock(&codec->user_mutex);
363 struct hda_codec *codec = dev_get_drvdata(dev);
364 int err = parse_hints(codec, buf);
374 struct hda_codec *codec = dev_get_drvdata(dev);
375 return pin_configs_show(codec, &codec->user_pins, buf);
378 static int parse_user_pin_configs(struct hda_codec *codec, const char *buf)
386 mutex_lock(&codec->user_mutex);
387 err = snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg);
388 mutex_unlock(&codec->user_mutex);
396 struct hda_codec *codec = dev_get_drvdata(dev);
397 int err = parse_user_pin_configs(codec, buf);
412 * @codec: the HDA codec
418 const char *snd_hda_get_hint(struct hda_codec *codec, const char *key)
420 struct hda_hint *hint = get_hint(codec, key);
427 * @codec: the HDA codec
434 int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key)
439 mutex_lock(&codec->user_mutex);
440 p = snd_hda_get_hint(codec, key);
455 mutex_unlock(&codec->user_mutex);
462 * @codec: the HDA codec
470 int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp)
476 mutex_lock(&codec->user_mutex);
477 p = snd_hda_get_hint(codec, key);
486 mutex_unlock(&codec->user_mutex);
534 /* parse the contents after the line "[codec]"
535 * accept only the line with three numbers, and assign the current codec
541 struct hda_codec *codec;
545 list_for_each_codec(codec, bus) {
546 if ((vendorid <= 0 || codec->core.vendor_id == vendorid) &&
547 (subid <= 0 || codec->core.subsystem_id == subid) &&
548 codec->core.addr == caddr) {
549 *codecp = codec;
558 * just pass to the sysfs helper (only when any codec was specified)
613 .tag = "[codec]",
715 struct hda_codec *codec;
719 codec = NULL;
726 (codec || line_mode <= LINE_MODE_CODEC))
727 patch_items[line_mode].parser(buf, bus, &codec);
771 void snd_hda_sysfs_init(struct hda_codec *codec)
773 mutex_init(&codec->user_mutex);
775 snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32);
776 snd_array_init(&codec->hints, sizeof(struct hda_hint), 32);
777 snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16);
781 void snd_hda_sysfs_clear(struct hda_codec *codec)
788 snd_array_free(&codec->init_verbs);
790 snd_array_for_each(&codec->hints, i, hint) {
793 snd_array_free(&codec->hints);
794 snd_array_free(&codec->user_pins);