Lines Matching refs: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 sprintf(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 sprintf(buf, "%u\n", jiffies_to_msecs(codec->power_off_acct)); in power_off_acct_show()
56 struct hda_codec *codec = dev_get_drvdata(dev); \
57 return sprintf(buf, "0x%x\n", codec->field); \
65 struct hda_codec *codec = dev_get_drvdata(dev); \
67 codec->field ? codec->field : ""); \
79 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()
90 mutex_unlock(&codec->user_mutex); in pin_configs_show()
98 struct hda_codec *codec = dev_get_drvdata(dev); in init_pin_configs_show() local
99 return pin_configs_show(codec, &codec->init_pins, buf); in init_pin_configs_show()
106 struct hda_codec *codec = dev_get_drvdata(dev); in driver_pin_configs_show() local
107 return pin_configs_show(codec, &codec->driver_pins, buf); in driver_pin_configs_show()
116 static int clear_codec(struct hda_codec *codec) in clear_codec() argument
120 err = snd_hda_codec_reset(codec); in clear_codec()
122 codec_err(codec, "The codec is being used, can't free.\n"); in clear_codec()
125 snd_hda_sysfs_clear(codec); in clear_codec()
129 static int reconfig_codec(struct hda_codec *codec) in reconfig_codec() argument
133 snd_hda_power_up(codec); in reconfig_codec()
134 codec_info(codec, "hda-codec: reconfiguring\n"); in reconfig_codec()
135 err = snd_hda_codec_reset(codec); in reconfig_codec()
137 codec_err(codec, in reconfig_codec()
141 err = snd_hda_codec_configure(codec); in reconfig_codec()
144 err = snd_card_register(codec->card); in reconfig_codec()
146 snd_hda_power_down(codec); in reconfig_codec()
170 struct hda_codec *codec = dev_get_drvdata(dev); \
175 codec->field = val; \
184 struct hda_codec *codec = dev_get_drvdata(dev); \
188 kfree(codec->field); \
189 codec->field = s; \
205 struct hda_codec *codec = dev_get_drvdata(dev); \
208 err = type##_codec(codec); \
219 struct hda_codec *codec = dev_get_drvdata(dev); in init_verbs_show() local
221 mutex_lock(&codec->user_mutex); in init_verbs_show()
222 for (i = 0; i < codec->init_verbs.used; i++) { in init_verbs_show()
223 struct hda_verb *v = snd_array_elem(&codec->init_verbs, i); in init_verbs_show()
228 mutex_unlock(&codec->user_mutex); in init_verbs_show()
232 static int parse_init_verbs(struct hda_codec *codec, const char *buf) in parse_init_verbs() argument
241 mutex_lock(&codec->user_mutex); in parse_init_verbs()
242 v = snd_array_new(&codec->init_verbs); in parse_init_verbs()
244 mutex_unlock(&codec->user_mutex); in parse_init_verbs()
250 mutex_unlock(&codec->user_mutex); in parse_init_verbs()
258 struct hda_codec *codec = dev_get_drvdata(dev); in init_verbs_store() local
259 int err = parse_init_verbs(codec, buf); in init_verbs_store()
269 struct hda_codec *codec = dev_get_drvdata(dev); in hints_show() local
271 mutex_lock(&codec->user_mutex); in hints_show()
272 for (i = 0; i < codec->hints.used; i++) { in hints_show()
273 struct hda_hint *hint = snd_array_elem(&codec->hints, i); in hints_show()
277 mutex_unlock(&codec->user_mutex); in hints_show()
281 static struct hda_hint *get_hint(struct hda_codec *codec, const char *key) in get_hint() argument
285 for (i = 0; i < codec->hints.used; i++) { in get_hint()
286 struct hda_hint *hint = snd_array_elem(&codec->hints, i); in get_hint()
308 static int parse_hints(struct hda_codec *codec, const char *buf) in parse_hints() argument
332 mutex_lock(&codec->user_mutex); in parse_hints()
333 hint = get_hint(codec, key); in parse_hints()
342 if (codec->hints.used >= MAX_HINTS) in parse_hints()
345 hint = snd_array_new(&codec->hints); in parse_hints()
353 mutex_unlock(&codec->user_mutex); in parse_hints()
363 struct hda_codec *codec = dev_get_drvdata(dev); in hints_store() local
364 int err = parse_hints(codec, buf); in hints_store()
374 struct hda_codec *codec = dev_get_drvdata(dev); in user_pin_configs_show() local
375 return pin_configs_show(codec, &codec->user_pins, buf); in user_pin_configs_show()
380 static int parse_user_pin_configs(struct hda_codec *codec, const char *buf) in parse_user_pin_configs() argument
388 mutex_lock(&codec->user_mutex); in parse_user_pin_configs()
389 err = snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg); in parse_user_pin_configs()
390 mutex_unlock(&codec->user_mutex); in parse_user_pin_configs()
398 struct hda_codec *codec = dev_get_drvdata(dev); in user_pin_configs_store() local
399 int err = parse_user_pin_configs(codec, buf); in user_pin_configs_store()
420 const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) in snd_hda_get_hint() argument
422 struct hda_hint *hint = get_hint(codec, key); in snd_hda_get_hint()
436 int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) in snd_hda_get_bool_hint() argument
441 mutex_lock(&codec->user_mutex); in snd_hda_get_bool_hint()
442 p = snd_hda_get_hint(codec, key); in snd_hda_get_bool_hint()
457 mutex_unlock(&codec->user_mutex); in snd_hda_get_bool_hint()
472 int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp) in snd_hda_get_int_hint() argument
478 mutex_lock(&codec->user_mutex); in snd_hda_get_int_hint()
479 p = snd_hda_get_hint(codec, key); in snd_hda_get_int_hint()
488 mutex_unlock(&codec->user_mutex); in snd_hda_get_int_hint()
543 struct hda_codec *codec; in parse_codec_mode() local
547 list_for_each_codec(codec, bus) { in parse_codec_mode()
548 if ((vendorid <= 0 || codec->core.vendor_id == vendorid) && in parse_codec_mode()
549 (subid <= 0 || codec->core.subsystem_id == subid) && in parse_codec_mode()
550 codec->core.addr == caddr) { in parse_codec_mode()
551 *codecp = codec; in parse_codec_mode()
717 struct hda_codec *codec; in snd_hda_load_patch() local
721 codec = NULL; in snd_hda_load_patch()
728 (codec || line_mode <= LINE_MODE_CODEC)) in snd_hda_load_patch()
729 patch_items[line_mode].parser(buf, bus, &codec); in snd_hda_load_patch()
773 void snd_hda_sysfs_init(struct hda_codec *codec) in snd_hda_sysfs_init() argument
775 mutex_init(&codec->user_mutex); in snd_hda_sysfs_init()
777 snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32); in snd_hda_sysfs_init()
778 snd_array_init(&codec->hints, sizeof(struct hda_hint), 32); in snd_hda_sysfs_init()
779 snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16); in snd_hda_sysfs_init()
783 void snd_hda_sysfs_clear(struct hda_codec *codec) in snd_hda_sysfs_clear() argument
789 snd_array_free(&codec->init_verbs); in snd_hda_sysfs_clear()
791 for (i = 0; i < codec->hints.used; i++) { in snd_hda_sysfs_clear()
792 struct hda_hint *hint = snd_array_elem(&codec->hints, i); in snd_hda_sysfs_clear()
795 snd_array_free(&codec->hints); in snd_hda_sysfs_clear()
796 snd_array_free(&codec->user_pins); in snd_hda_sysfs_clear()