/** * snd_hdac_set_codec_wakeup - Enable / disable HDMI/DP codec wakeup * @bus: HDA core bus * @enable: enable or disable the wakeup * * This function is supposed to be used only by a HD-audio controller * driver that needs the interaction with graphics driver. * * This function should be called during the chip reset, also called at * resume for updating STATESTS register read. * * Returns zero for success or a negative error code.
*/ int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
{ struct drm_audio_component *acomp = bus->audio_component;
/** * snd_hdac_display_power - Power up / down the power refcount * @bus: HDA core bus * @idx: HDA codec address, pass HDA_CODEC_IDX_CONTROLLER for controller * @enable: power up or down * * This function is used by either HD-audio controller or codec driver that * needs the interaction with graphics driver. * * This function updates the power status, and calls the get_power() and * put_power() ops accordingly, toggling the codec wakeup, too.
*/ void snd_hdac_display_power(struct hdac_bus *bus, unsignedint idx, bool enable)
{ struct drm_audio_component *acomp = bus->audio_component;
dev_dbg(bus->dev, "display power %s\n", str_enable_disable(enable));
mutex_lock(&bus->lock); if (enable)
set_bit(idx, &bus->display_power_status); else
clear_bit(idx, &bus->display_power_status);
if (!acomp || !acomp->ops) goto unlock;
if (bus->display_power_status) { if (!bus->display_power_active) { unsignedlong cookie = -1;
if (acomp->ops->get_power)
cookie = acomp->ops->get_power(acomp->dev);
/** * snd_hdac_sync_audio_rate - Set N/CTS based on the sample rate * @codec: HDA codec * @nid: the pin widget NID * @dev_id: device identifier * @rate: the sample rate to set * * This function is supposed to be used only by a HD-audio controller * driver that needs the interaction with graphics driver. * * This function sets N/CTS value based on the given sample rate. * Returns zero for success, or a negative error code.
*/ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int dev_id, int rate)
{ struct hdac_bus *bus = codec->bus; struct drm_audio_component *acomp = bus->audio_component; int port, pipe;
if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) return -ENODEV;
port = nid; if (acomp->audio_ops && acomp->audio_ops->pin2port) {
port = acomp->audio_ops->pin2port(codec, nid); if (port < 0) return -EINVAL;
}
pipe = dev_id; return acomp->ops->sync_audio_rate(acomp->dev, port, pipe, rate);
}
EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);
/** * snd_hdac_acomp_get_eld - Get the audio state and ELD via component * @codec: HDA codec * @nid: the pin widget NID * @dev_id: device identifier * @audio_enabled: the pointer to store the current audio state * @buffer: the buffer pointer to store ELD bytes * @max_bytes: the max bytes to be stored on @buffer * * This function is supposed to be used only by a HD-audio controller * driver that needs the interaction with graphics driver. * * This function queries the current state of the audio on the given * digital port and fetches the ELD bytes onto the given buffer. * It returns the number of bytes for the total ELD data, zero for * invalid ELD, or a negative error code. * * The return size is the total bytes required for the whole ELD bytes, * thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched.
*/ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, bool *audio_enabled, char *buffer, int max_bytes)
{ struct hdac_bus *bus = codec->bus; struct drm_audio_component *acomp = bus->audio_component; int port, pipe;
if (!acomp || !acomp->ops || !acomp->ops->get_eld) return -ENODEV;
port = nid; if (acomp->audio_ops && acomp->audio_ops->pin2port) {
port = acomp->audio_ops->pin2port(codec, nid); if (port < 0) return -EINVAL;
}
pipe = dev_id; return acomp->ops->get_eld(acomp->dev, port, pipe, audio_enabled,
buffer, max_bytes);
}
EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld);
/** * snd_hdac_acomp_register_notifier - Register audio component ops * @bus: HDA core bus * @aops: audio component ops * * This function is supposed to be used only by a HD-audio controller * driver that needs the interaction with graphics driver. * * This function sets the given ops to be called by the graphics driver. * * Returns zero for success or a negative error code.
*/ int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, conststruct drm_audio_component_audio_ops *aops)
{ if (!bus->audio_component) return -ENODEV;
/** * snd_hdac_acomp_init - Initialize audio component * @bus: HDA core bus * @aops: audio component ops * @match_master: match function for finding components * @extra_size: Extra bytes to allocate * * This function is supposed to be used only by a HD-audio controller * driver that needs the interaction with graphics driver. * * This function initializes and sets up the audio component to communicate * with graphics driver. * * Unlike snd_hdac_i915_init(), this function doesn't synchronize with the * binding with the DRM component. Each caller needs to sync via master_bind * audio_ops. * * Returns zero for success or a negative error code.
*/ int snd_hdac_acomp_init(struct hdac_bus *bus, conststruct drm_audio_component_audio_ops *aops, int (*match_master)(struct device *, int, void *),
size_t extra_size)
{ struct component_match *match = NULL; struct device *dev = bus->dev; struct drm_audio_component *acomp; int ret;
/** * snd_hdac_acomp_exit - Finalize audio component * @bus: HDA core bus * * This function is supposed to be used only by a HD-audio controller * driver that needs the interaction with graphics driver. * * This function releases the audio component that has been used. * * Returns zero for success or a negative error code.
*/ int snd_hdac_acomp_exit(struct hdac_bus *bus)
{ struct device *dev = bus->dev; struct drm_audio_component *acomp = bus->audio_component;
if (!acomp) return 0;
if (WARN_ON(bus->display_power_active) && acomp->ops)
acomp->ops->put_power(acomp->dev, bus->display_power_active);
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.