/* * Multilink helpers - these helpers are useful for dealing with HDA * new multilink capability
*/
/** * snd_hdac_ext_bus_get_ml_capabilities - get multilink capability * @bus: the pointer to HDAC bus object * * This will parse all links and read the mlink capabilities and add them * in hlink_list of extended hdac bus * Note: this will be freed on bus exit by driver
*/ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus)
{ int idx;
u32 link_count; struct hdac_ext_link *hlink;
u32 leptr;
/** * snd_hdac_ext_bus_get_hlink_by_name - get hlink based on codec name * @bus: the pointer to HDAC bus object * @codec_name: codec name
*/ struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name(struct hdac_bus *bus, constchar *codec_name)
{ int bus_idx, addr;
if (sscanf(codec_name, "ehdaudio%dD%d", &bus_idx, &addr) != 2) return NULL; if (bus->idx != bus_idx) return NULL; if (addr < 0 || addr > 31) return NULL;
/** * snd_hdac_ext_bus_link_power_up_all -power up all hda link * @bus: the pointer to HDAC bus object
*/ int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus)
{ struct hdac_ext_link *hlink = NULL; int ret;
list_for_each_entry(hlink, &bus->hlink_list, list) {
ret = snd_hdac_ext_bus_link_power_up(hlink); if (ret < 0) return ret;
}
/** * snd_hdac_ext_bus_link_power_down_all -power down all hda link * @bus: the pointer to HDAC bus object
*/ int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus)
{ struct hdac_ext_link *hlink = NULL; int ret;
list_for_each_entry(hlink, &bus->hlink_list, list) {
ret = snd_hdac_ext_bus_link_power_down(hlink); if (ret < 0) return ret;
}
/** * snd_hdac_ext_bus_link_set_stream_id - maps stream id to link output * @link: HD-audio ext link to set up * @stream: stream id
*/ void snd_hdac_ext_bus_link_set_stream_id(struct hdac_ext_link *link, int stream)
{
snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 1 << stream);
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_set_stream_id);
/** * snd_hdac_ext_bus_link_clear_stream_id - maps stream id to link output * @link: HD-audio ext link to set up * @stream: stream id
*/ void snd_hdac_ext_bus_link_clear_stream_id(struct hdac_ext_link *link, int stream)
{
snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 0);
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_clear_stream_id);
int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *hlink)
{ unsignedlong codec_mask; int ret = 0;
mutex_lock(&bus->lock);
/* * if we move from 0 to 1, count will be 1 so power up this link * as well, also check the dma status and trigger that
*/ if (++hlink->ref_count == 1) { if (!bus->cmd_dma_state) {
snd_hdac_bus_init_cmd_io(bus);
bus->cmd_dma_state = true;
}
ret = snd_hdac_ext_bus_link_power_up(hlink);
/* * clear the register to invalidate all the output streams
*/
snd_hdac_updatew(hlink->ml_addr, AZX_REG_ML_LOSIDV,
AZX_ML_LOSIDV_STREAM_MASK, 0); /* * wait for 521usec for codec to report status * HDA spec section 4.3 - Codec Discovery
*/
udelay(521);
codec_mask = snd_hdac_chip_readw(bus, STATESTS);
dev_dbg(bus->dev, "codec_mask = 0x%lx\n", codec_mask);
snd_hdac_chip_writew(bus, STATESTS, codec_mask); if (!bus->codec_mask)
bus->codec_mask = codec_mask;
}
int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *hlink)
{ int ret = 0; struct hdac_ext_link *hlink_tmp; bool link_up = false;
mutex_lock(&bus->lock);
/* * if we move from 1 to 0, count will be 0 * so power down this link as well
*/ if (--hlink->ref_count == 0) {
ret = snd_hdac_ext_bus_link_power_down(hlink);
/* * now check if all links are off, if so turn off * cmd dma as well
*/
list_for_each_entry(hlink_tmp, &bus->hlink_list, list) { if (hlink_tmp->ref_count) {
link_up = true; break;
}
}
if (!link_up) {
snd_hdac_bus_stop_cmd_io(bus);
bus->cmd_dma_state = false;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.