Lines Matching +full:ati +full:- +full:target
2 * HD-audio codec core device
26 * snd_hdac_device_init - initialize the HD-audio codec base device
46 dev = &codec->dev; in snd_hdac_device_init()
48 dev->parent = bus->dev; in snd_hdac_device_init()
49 dev->bus = &snd_hda_bus_type; in snd_hdac_device_init()
50 dev->release = default_release; in snd_hdac_device_init()
51 dev->groups = hdac_dev_attr_groups; in snd_hdac_device_init()
55 codec->bus = bus; in snd_hdac_device_init()
56 codec->addr = addr; in snd_hdac_device_init()
57 codec->type = HDA_DEV_CORE; in snd_hdac_device_init()
58 pm_runtime_set_active(&codec->dev); in snd_hdac_device_init()
59 pm_runtime_get_noresume(&codec->dev); in snd_hdac_device_init()
60 atomic_set(&codec->in_pm, 0); in snd_hdac_device_init()
67 codec->vendor_id = snd_hdac_read_parm(codec, AC_NODE_ROOT, in snd_hdac_device_init()
69 if (codec->vendor_id == -1) { in snd_hdac_device_init()
73 codec->vendor_id = snd_hdac_read_parm(codec, AC_NODE_ROOT, in snd_hdac_device_init()
77 codec->subsystem_id = snd_hdac_read_parm(codec, AC_NODE_ROOT, in snd_hdac_device_init()
79 codec->revision_id = snd_hdac_read_parm(codec, AC_NODE_ROOT, in snd_hdac_device_init()
83 if (!codec->afg && !codec->mfg) { in snd_hdac_device_init()
85 err = -ENODEV; in snd_hdac_device_init()
89 fg = codec->afg ? codec->afg : codec->mfg; in snd_hdac_device_init()
95 codec->power_caps = snd_hdac_read_parm(codec, fg, AC_PAR_POWER_STATE); in snd_hdac_device_init()
97 if (codec->subsystem_id == -1 || codec->subsystem_id == 0) in snd_hdac_device_init()
99 &codec->subsystem_id); in snd_hdac_device_init()
105 codec->chip_name = kasprintf(GFP_KERNEL, "ID %x", in snd_hdac_device_init()
106 codec->vendor_id & 0xffff); in snd_hdac_device_init()
107 if (!codec->chip_name) { in snd_hdac_device_init()
108 err = -ENOMEM; in snd_hdac_device_init()
115 put_device(&codec->dev); in snd_hdac_device_init()
121 * snd_hdac_device_exit - clean up the HD-audio codec base device
126 pm_runtime_put_noidle(&codec->dev); in snd_hdac_device_exit()
128 pm_runtime_set_suspended(&codec->dev); in snd_hdac_device_exit()
129 snd_hdac_bus_remove_device(codec->bus, codec); in snd_hdac_device_exit()
130 kfree(codec->vendor_name); in snd_hdac_device_exit()
131 kfree(codec->chip_name); in snd_hdac_device_exit()
136 * snd_hdac_device_register - register the hd-audio codec base device
143 err = device_add(&codec->dev); in snd_hdac_device_register()
148 device_del(&codec->dev); in snd_hdac_device_register()
157 * snd_hdac_device_unregister - unregister the hd-audio codec base device
162 if (device_is_registered(&codec->dev)) { in snd_hdac_device_unregister()
164 device_del(&codec->dev); in snd_hdac_device_unregister()
165 snd_hdac_bus_remove_device(codec->bus, codec); in snd_hdac_device_unregister()
171 * snd_hdac_device_set_chip_name - set/update the codec name
185 return -ENOMEM; in snd_hdac_device_set_chip_name()
186 kfree(codec->chip_name); in snd_hdac_device_set_chip_name()
187 codec->chip_name = newname; in snd_hdac_device_set_chip_name()
193 * snd_hdac_codec_modalias - give the module alias name
203 codec->vendor_id, codec->revision_id, codec->type); in snd_hdac_codec_modalias()
208 * snd_hdac_make_cmd - compose a 32bit command word to be sent to the
209 * HD-audio controller
215 * Return an encoded command verb or -1 for error.
222 addr = codec->addr; in snd_hdac_make_cmd()
225 dev_err(&codec->dev, "out of range cmd %x:%x:%x:%x\n", in snd_hdac_make_cmd()
227 return -1; in snd_hdac_make_cmd()
239 * snd_hdac_exec_verb - execute an encoded verb
253 if (codec->exec_verb) in snd_hdac_exec_verb()
254 return codec->exec_verb(codec, cmd, flags, res); in snd_hdac_exec_verb()
255 return snd_hdac_bus_exec_verb(codec->bus, codec->addr, cmd, res); in snd_hdac_exec_verb()
261 * snd_hdac_read - execute a verb
280 * _snd_hdac_read_parm - read a parmeter
295 * snd_hdac_read_parm_uncached - read a codec parameter without caching
300 * Returns -1 for error. If you need to distinguish the error more
310 return -1; in snd_hdac_read_parm_uncached()
316 * snd_hdac_override_parm - override read-only parameters
328 if (!codec->regmap) in snd_hdac_override_parm()
329 return -EINVAL; in snd_hdac_override_parm()
331 codec->caps_overwriting = true; in snd_hdac_override_parm()
333 codec->caps_overwriting = false; in snd_hdac_override_parm()
339 * snd_hdac_get_sub_nodes - get start NID and number of subtree nodes
353 if (parm == -1) { in snd_hdac_get_sub_nodes()
376 codec->afg = nid; in setup_fg_nodes()
377 codec->afg_function_id = function_id & 0xff; in setup_fg_nodes()
378 codec->afg_unsol = (function_id >> 8) & 1; in setup_fg_nodes()
381 codec->mfg = nid; in setup_fg_nodes()
382 codec->mfg_function_id = function_id & 0xff; in setup_fg_nodes()
383 codec->mfg_unsol = (function_id >> 8) & 1; in setup_fg_nodes()
392 * snd_hdac_refresh_widgets - Reset the widget start/end nodes
394 * @sysfs: re-initialize sysfs tree, too
401 nums = snd_hdac_get_sub_nodes(codec, codec->afg, &start_nid); in snd_hdac_refresh_widgets()
403 dev_err(&codec->dev, "cannot read sub nodes for FG 0x%02x\n", in snd_hdac_refresh_widgets()
404 codec->afg); in snd_hdac_refresh_widgets()
405 return -EINVAL; in snd_hdac_refresh_widgets()
414 codec->num_nodes = nums; in snd_hdac_refresh_widgets()
415 codec->start_nid = start_nid; in snd_hdac_refresh_widgets()
416 codec->end_nid = start_nid + nums; in snd_hdac_refresh_widgets()
432 if (parm == -1) in get_num_conns()
438 * snd_hdac_get_connections - get a widget connection list
446 * given array size, it returns -ENOSPC.
473 mask = (1 << (shift-1)) - 1; in snd_hdac_get_connections()
501 return -EIO; in snd_hdac_get_connections()
503 range_val = !!(parm & (1 << (shift-1))); /* ranges */ in snd_hdac_get_connections()
506 dev_dbg(&codec->dev, in snd_hdac_get_connections()
515 dev_warn(&codec->dev, in snd_hdac_get_connections()
523 return -ENOSPC; in snd_hdac_get_connections()
531 return -ENOSPC; in snd_hdac_get_connections()
544 * snd_hdac_power_up - power up the codec
555 return pm_runtime_get_sync(&codec->dev); in snd_hdac_power_up()
560 * snd_hdac_power_down - power down the codec
567 struct device *dev = &codec->dev; in snd_hdac_power_down()
575 * snd_hdac_power_up_pm - power up the codec
579 * which may be called by PM suspend/resume again. OTOH, if a power-up
587 if (!atomic_inc_not_zero(&codec->in_pm)) in snd_hdac_power_up_pm()
594 * already powered up. Returns -1 if not powered up, 1 if incremented
599 if (!atomic_inc_not_zero(&codec->in_pm)) { in snd_hdac_keep_power_up()
600 int ret = pm_runtime_get_if_in_use(&codec->dev); in snd_hdac_keep_power_up()
602 return -1; in snd_hdac_keep_power_up()
610 * snd_hdac_power_down_pm - power down the codec
620 if (atomic_dec_if_positive(&codec->in_pm) < 0) in snd_hdac_power_down_pm()
628 * snd_hdac_link_power - Enable/disable the link power for a codec
634 if (!codec->link_power_control) in snd_hdac_link_power()
637 if (codec->bus->ops->link_power) in snd_hdac_link_power()
638 return codec->bus->ops->link_power(codec->bus, enable); in snd_hdac_link_power()
640 return -EINVAL; in snd_hdac_link_power()
651 { 0x1002, "ATI" },
662 { 0x13f6, "C-Media" },
668 { 0x434d, "C-Media" },
678 u16 vendor_id = codec->vendor_id >> 16; in get_codec_vendor_name()
680 for (c = hda_vendor_ids; c->id; c++) { in get_codec_vendor_name()
681 if (c->id == vendor_id) { in get_codec_vendor_name()
682 codec->vendor_name = kstrdup(c->name, GFP_KERNEL); in get_codec_vendor_name()
683 return codec->vendor_name ? 0 : -ENOMEM; in get_codec_vendor_name()
687 codec->vendor_name = kasprintf(GFP_KERNEL, "Generic %04x", vendor_id); in get_codec_vendor_name()
688 return codec->vendor_name ? 0 : -ENOMEM; in get_codec_vendor_name()
702 (AC_FMT_BASE_##base##K | (((mult) - 1) << AC_FMT_MULT_SHIFT) | \
703 (((div) - 1) << AC_FMT_DIV_SHIFT))
730 * snd_hdac_calc_stream_format - calculate the format bitset
735 * @spdif_ctls: HD-audio SPDIF status bits (0 if irrelevant)
760 val |= channels - 1; in snd_hdac_calc_stream_format()
794 if (nid != codec->afg && in query_pcm_param()
797 if (!val || val == -1) in query_pcm_param()
798 val = snd_hdac_read_parm(codec, codec->afg, AC_PAR_PCM); in query_pcm_param()
799 if (!val || val == -1) in query_pcm_param()
808 if (!streams || streams == -1) in query_stream_param()
809 streams = snd_hdac_read_parm(codec, codec->afg, AC_PAR_STREAM); in query_stream_param()
810 if (!streams || streams == -1) in query_stream_param()
816 * snd_hdac_query_supported_pcm - query the supported PCM rates and formats
843 dev_err(&codec->dev, in snd_hdac_query_supported_pcm()
847 return -EIO; in snd_hdac_query_supported_pcm()
858 return -EIO; in snd_hdac_query_supported_pcm()
906 dev_err(&codec->dev, in snd_hdac_query_supported_pcm()
911 return -EIO; in snd_hdac_query_supported_pcm()
924 * snd_hdac_is_supported_format - Check the validity of the format
927 * @format: the HD-audio format value to check
997 return -1; in codec_read()
1011 * snd_hdac_codec_read - send a command and get the response
1020 * Returns the obtained response value, or -1 for an error.
1030 * snd_hdac_codec_write - send a single command without waiting for response
1049 * snd_hdac_check_power_state - check whether the actual power state matches
1050 * with the target state
1054 * @target_state: target state to check for
1071 * snd_hdac_sync_power_state - wait until actual power state matches
1072 * with the target state
1076 * @target_state: target state to check for
1098 /* wait until the codec reachs to the target state */ in snd_hdac_sync_power_state()