Lines Matching full:codec
3 * sysfs interface for HD-audio codec
33 struct hda_codec *codec = dev_get_drvdata(dev); in power_on_acct_show() local
34 snd_hda_update_power_acct(codec); in power_on_acct_show()
35 return sysfs_emit(buf, "%u\n", jiffies_to_msecs(codec->power_on_acct)); in power_on_acct_show()
42 struct hda_codec *codec = dev_get_drvdata(dev); in power_off_acct_show() local
43 snd_hda_update_power_acct(codec); in power_off_acct_show()
44 return sysfs_emit(buf, "%u\n", jiffies_to_msecs(codec->power_off_acct)); in power_off_acct_show()
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, in pin_configs_show() argument
84 mutex_lock(&codec->user_mutex); in pin_configs_show()
89 mutex_unlock(&codec->user_mutex); in pin_configs_show()
97 struct hda_codec *codec = dev_get_drvdata(dev); in init_pin_configs_show() local
98 return pin_configs_show(codec, &codec->init_pins, buf); in init_pin_configs_show()
105 struct hda_codec *codec = dev_get_drvdata(dev); in driver_pin_configs_show() local
106 return pin_configs_show(codec, &codec->driver_pins, buf); in driver_pin_configs_show()
115 static int clear_codec(struct hda_codec *codec) in clear_codec() argument
119 err = snd_hda_codec_reset(codec); in clear_codec()
121 codec_err(codec, "The codec is being used, can't free.\n"); in clear_codec()
124 snd_hda_sysfs_clear(codec); in clear_codec()
128 static int reconfig_codec(struct hda_codec *codec) in reconfig_codec() argument
132 snd_hda_power_up(codec); in reconfig_codec()
133 codec_info(codec, "hda-codec: reconfiguring\n"); in reconfig_codec()
134 err = snd_hda_codec_reset(codec); in reconfig_codec()
136 codec_err(codec, in reconfig_codec()
137 "The codec is being used, can't reconfigure.\n"); in reconfig_codec()
140 err = device_reprobe(hda_codec_dev(codec)); in reconfig_codec()
143 err = snd_card_register(codec->card); in reconfig_codec()
145 snd_hda_power_down(codec); in reconfig_codec()
169 struct hda_codec *codec = dev_get_drvdata(dev); \
174 codec->field = val; \
183 struct hda_codec *codec = dev_get_drvdata(dev); \
187 kfree(codec->field); \
188 codec->field = s; \
204 struct hda_codec *codec = dev_get_drvdata(dev); \
207 err = type##_codec(codec); \
218 struct hda_codec *codec = dev_get_drvdata(dev); in init_verbs_show() local
221 mutex_lock(&codec->user_mutex); in init_verbs_show()
222 snd_array_for_each(&codec->init_verbs, i, v) { in init_verbs_show()
226 mutex_unlock(&codec->user_mutex); in init_verbs_show()
230 static int parse_init_verbs(struct hda_codec *codec, const char *buf) in parse_init_verbs() argument
239 mutex_lock(&codec->user_mutex); in parse_init_verbs()
240 v = snd_array_new(&codec->init_verbs); in parse_init_verbs()
242 mutex_unlock(&codec->user_mutex); in parse_init_verbs()
248 mutex_unlock(&codec->user_mutex); in parse_init_verbs()
256 struct hda_codec *codec = dev_get_drvdata(dev); in init_verbs_store() local
257 int err = parse_init_verbs(codec, buf); in init_verbs_store()
267 struct hda_codec *codec = dev_get_drvdata(dev); in hints_show() local
270 mutex_lock(&codec->user_mutex); in hints_show()
271 snd_array_for_each(&codec->hints, i, hint) { in hints_show()
275 mutex_unlock(&codec->user_mutex); in hints_show()
279 static struct hda_hint *get_hint(struct hda_codec *codec, const char *key) in get_hint() argument
284 snd_array_for_each(&codec->hints, i, hint) { in get_hint()
306 static int parse_hints(struct hda_codec *codec, const char *buf) in parse_hints() argument
330 mutex_lock(&codec->user_mutex); in parse_hints()
331 hint = get_hint(codec, key); in parse_hints()
340 if (codec->hints.used >= MAX_HINTS) in parse_hints()
343 hint = snd_array_new(&codec->hints); in parse_hints()
351 mutex_unlock(&codec->user_mutex); in parse_hints()
361 struct hda_codec *codec = dev_get_drvdata(dev); in hints_store() local
362 int err = parse_hints(codec, buf); in hints_store()
372 struct hda_codec *codec = dev_get_drvdata(dev); in user_pin_configs_show() local
373 return pin_configs_show(codec, &codec->user_pins, buf); in user_pin_configs_show()
376 static int parse_user_pin_configs(struct hda_codec *codec, const char *buf) in parse_user_pin_configs() argument
384 mutex_lock(&codec->user_mutex); in parse_user_pin_configs()
385 err = snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg); in parse_user_pin_configs()
386 mutex_unlock(&codec->user_mutex); in parse_user_pin_configs()
394 struct hda_codec *codec = dev_get_drvdata(dev); in user_pin_configs_store() local
395 int err = parse_user_pin_configs(codec, buf); in user_pin_configs_store()
410 * @codec: the HDA codec
416 const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) in snd_hda_get_hint() argument
418 struct hda_hint *hint = get_hint(codec, key); in snd_hda_get_hint()
425 * @codec: the HDA codec
432 int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) in snd_hda_get_bool_hint() argument
437 mutex_lock(&codec->user_mutex); in snd_hda_get_bool_hint()
438 p = snd_hda_get_hint(codec, key); in snd_hda_get_bool_hint()
453 mutex_unlock(&codec->user_mutex); in snd_hda_get_bool_hint()
460 * @codec: the HDA codec
468 int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp) in snd_hda_get_int_hint() argument
474 mutex_lock(&codec->user_mutex); in snd_hda_get_int_hint()
475 p = snd_hda_get_hint(codec, key); in snd_hda_get_int_hint()
484 mutex_unlock(&codec->user_mutex); in snd_hda_get_int_hint()
532 /* parse the contents after the line "[codec]"
533 * accept only the line with three numbers, and assign the current codec
539 struct hda_codec *codec; in parse_codec_mode() local
543 list_for_each_codec(codec, bus) { in parse_codec_mode()
544 if ((vendorid <= 0 || codec->core.vendor_id == vendorid) && in parse_codec_mode()
545 (subid <= 0 || codec->core.subsystem_id == subid) && in parse_codec_mode()
546 codec->core.addr == caddr) { in parse_codec_mode()
547 *codecp = codec; in parse_codec_mode()
556 * just pass to the sysfs helper (only when any codec was specified)
611 .tag = "[codec]",
713 struct hda_codec *codec; in snd_hda_load_patch() local
717 codec = NULL; in snd_hda_load_patch()
724 (codec || line_mode <= LINE_MODE_CODEC)) in snd_hda_load_patch()
725 patch_items[line_mode].parser(buf, bus, &codec); in snd_hda_load_patch()
767 void snd_hda_sysfs_init(struct hda_codec *codec) in snd_hda_sysfs_init() argument
769 mutex_init(&codec->user_mutex); in snd_hda_sysfs_init()
771 snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32); in snd_hda_sysfs_init()
772 snd_array_init(&codec->hints, sizeof(struct hda_hint), 32); in snd_hda_sysfs_init()
773 snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16); in snd_hda_sysfs_init()
777 void snd_hda_sysfs_clear(struct hda_codec *codec) in snd_hda_sysfs_clear() argument
784 snd_array_free(&codec->init_verbs); in snd_hda_sysfs_clear()
786 snd_array_for_each(&codec->hints, i, hint) { in snd_hda_sysfs_clear()
789 snd_array_free(&codec->hints); in snd_hda_sysfs_clear()
790 snd_array_free(&codec->user_pins); in snd_hda_sysfs_clear()