Commit efffb014 authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ALSA: hda: Introduce snd_hdac_stream_wait_drsm()

Allow for waiting for DRSM bit for specified stream to be cleared from
HDAudio library level. Drivers may utilize this optional step during the
stream resume procedure.
Suggested-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20221027124702.1761002-4-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2b9a50ea
......@@ -597,6 +597,7 @@ int snd_hdac_stream_get_spbmaxfifo(struct hdac_bus *bus,
struct hdac_stream *azx_dev);
void snd_hdac_stream_drsm_enable(struct hdac_bus *bus,
bool enable, int index);
int snd_hdac_stream_wait_drsm(struct hdac_stream *azx_dev);
int snd_hdac_stream_set_dpibr(struct hdac_bus *bus,
struct hdac_stream *azx_dev, u32 value);
int snd_hdac_stream_set_lpib(struct hdac_stream *azx_dev, u32 value);
......
......@@ -821,6 +821,28 @@ void snd_hdac_stream_drsm_enable(struct hdac_bus *bus,
}
EXPORT_SYMBOL_GPL(snd_hdac_stream_drsm_enable);
/*
* snd_hdac_stream_wait_drsm - wait for HW to clear RSM for a stream
* @azx_dev: HD-audio core stream to await RSM for
*
* Returns 0 on success and -ETIMEDOUT upon a timeout.
*/
int snd_hdac_stream_wait_drsm(struct hdac_stream *azx_dev)
{
struct hdac_bus *bus = azx_dev->bus;
u32 mask, reg;
int ret;
mask = 1 << azx_dev->index;
ret = read_poll_timeout(snd_hdac_reg_readl, reg, !(reg & mask), 250, 2000, false, bus,
bus->drsmcap + AZX_REG_DRSM_CTL);
if (ret)
dev_dbg(bus->dev, "polling RSM 0x%08x failed: %d\n", mask, ret);
return ret;
}
EXPORT_SYMBOL_GPL(snd_hdac_stream_wait_drsm);
/**
* snd_hdac_stream_set_dpibr - sets the dpibr value of a stream
* @bus: HD-audio core bus
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment