Commit 7fa403f2 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Takashi Iwai

ALSA/ASoC: hda: ext: add 'bus' prefix for multi-link stream setting

All the helpers dealing with multi-link configurations are located in
the hdac_ext_controller.c, except the two set/clear routines that
modify the LOSIDV registers.

For consistency, move the two helpers and add the 'bus' prefix. One
could argue that the 'ml' prefix might be more relevant but that would
be a larger code change.

No functionality change, just move and rename.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-8-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 00b6cd95
...@@ -121,9 +121,9 @@ int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *hlink); ...@@ -121,9 +121,9 @@ int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *hlink);
int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *hlink); int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *hlink);
int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus); int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus);
int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus); int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus);
void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *hlink, void snd_hdac_ext_bus_link_set_stream_id(struct hdac_ext_link *hlink,
int stream); int stream);
void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *hlink, void snd_hdac_ext_bus_link_clear_stream_id(struct hdac_ext_link *hlink,
int stream); int stream);
int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *hlink); int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *hlink);
......
...@@ -253,6 +253,30 @@ int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus) ...@@ -253,6 +253,30 @@ int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus)
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all); EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all);
/**
* 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, int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
struct hdac_ext_link *hlink) struct hdac_ext_link *hlink)
{ {
......
...@@ -223,30 +223,6 @@ int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt) ...@@ -223,30 +223,6 @@ int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt)
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_setup); EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_setup);
/**
* snd_hdac_ext_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_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_link_set_stream_id);
/**
* snd_hdac_ext_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_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_link_clear_stream_id);
static struct hdac_ext_stream * static struct hdac_ext_stream *
hdac_ext_link_stream_assign(struct hdac_bus *bus, hdac_ext_link_stream_assign(struct hdac_bus *bus,
struct snd_pcm_substream *substream) struct snd_pcm_substream *substream)
......
...@@ -297,7 +297,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn ...@@ -297,7 +297,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn
return -EINVAL; return -EINVAL;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
snd_hdac_ext_link_clear_stream_id(link, hdac_stream(link_stream)->stream_tag); snd_hdac_ext_bus_link_clear_stream_id(link, hdac_stream(link_stream)->stream_tag);
return 0; return 0;
} }
...@@ -330,7 +330,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn ...@@ -330,7 +330,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
return -EINVAL; return -EINVAL;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
snd_hdac_ext_link_set_stream_id(link, hdac_stream(link_stream)->stream_tag); snd_hdac_ext_bus_link_set_stream_id(link, hdac_stream(link_stream)->stream_tag);
ret = avs_dai_prepare(to_avs_dev(dai->dev), substream, dai); ret = avs_dai_prepare(to_avs_dev(dai->dev), substream, dai);
if (ret) if (ret)
......
...@@ -198,7 +198,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params) ...@@ -198,7 +198,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
if (stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) { if (stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) {
list_for_each_entry(link, &bus->hlink_list, list) { list_for_each_entry(link, &bus->hlink_list, list) {
if (link->index == params->link_index) if (link->index == params->link_index)
snd_hdac_ext_link_set_stream_id(link, snd_hdac_ext_bus_link_set_stream_id(link,
stream_tag); stream_tag);
} }
} }
...@@ -649,7 +649,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, ...@@ -649,7 +649,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
stream_tag = hdac_stream(link_dev)->stream_tag; stream_tag = hdac_stream(link_dev)->stream_tag;
snd_hdac_ext_link_clear_stream_id(link, stream_tag); snd_hdac_ext_bus_link_clear_stream_id(link, stream_tag);
} }
snd_hdac_ext_stream_release(link_dev, HDAC_EXT_STREAM_TYPE_LINK); snd_hdac_ext_stream_release(link_dev, HDAC_EXT_STREAM_TYPE_LINK);
......
...@@ -158,7 +158,7 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream, ...@@ -158,7 +158,7 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
stream_tag = hdac_stream(hext_stream)->stream_tag; stream_tag = hdac_stream(hext_stream)->stream_tag;
snd_hdac_ext_link_clear_stream_id(hlink, stream_tag); snd_hdac_ext_bus_link_clear_stream_id(hlink, stream_tag);
} }
snd_soc_dai_set_dma_data(cpu_dai, substream, NULL); snd_soc_dai_set_dma_data(cpu_dai, substream, NULL);
snd_hdac_ext_stream_release(hext_stream, HDAC_EXT_STREAM_TYPE_LINK); snd_hdac_ext_stream_release(hext_stream, HDAC_EXT_STREAM_TYPE_LINK);
...@@ -194,7 +194,7 @@ static int hda_link_dma_params(struct hdac_ext_stream *hext_stream, ...@@ -194,7 +194,7 @@ static int hda_link_dma_params(struct hdac_ext_stream *hext_stream,
if (hext_stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) { if (hext_stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) {
list_for_each_entry(hlink, &bus->hlink_list, list) { list_for_each_entry(hlink, &bus->hlink_list, list) {
if (hlink->index == params->link_index) if (hlink->index == params->link_index)
snd_hdac_ext_link_set_stream_id(hlink, snd_hdac_ext_bus_link_set_stream_id(hlink,
stream_tag); stream_tag);
} }
} }
......
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