ALSA/ASoC: hda: cleanup sound/hda/ext code
Subsystems (4)
cover ALSA/ASoC: hda: cleanup sound/hda/ext code
The code in sound/hda/ext can be cleaned-up. This patchset suggests a more consistent use of prefixes and variable names. It also removes useless code, uses helpers when possible, and clarifies an incorrect assumption that SPIB/DRMS capabilities are tied to Intel multi-link and DSP extensions (they are not).
This is a rather invasive set of changes touching sound/hda, sound/soc/intel/skylake, sound/soc/intel/avs and sound/soc/sof/intel, but there should be no change in terms of functionality.
I would recommend merging these changes through the ASoC tree.
Pierre-Louis Bossart (10):
ALSA: hda: ext: hdac_ext_controller: use helpers in loop
ALSA: hda: ext: hda_ext_controller: use hlink variable/parameter
ASoC: SOF: Intel: hda-dai: use hlink variable/parameter ALSA/ASoC: hda: clarify bus_get_link() and bus_link_get() helpers ALSA/ASoC: hda: ext: add 'ext' prefix to snd_hdac_link_free_all ALSA/ASoC: hda: ext: remove 'link' prefix for stream-related
operations
ALSA/ASoC: hda: ext: add 'bus' prefix for multi-link stream setting
ALSA: hda: ext: reduce ambiguity between 'multi-link' and 'link' DMA
ALSA: hda: hdac_ext_controller: remove useless loop ALSA/ASoC: hda: move SPIB/DRMS functionality from ext layer
include/sound/hdaudio.h | 26 ++++ include/sound/hdaudio_ext.h | 66 ++------ sound/hda/ext/hdac_ext_controller.c | 116 ++++++++------ sound/hda/ext/hdac_ext_stream.c | 203 +++---------------------- sound/hda/hdac_stream.c | 136 +++++++++++++++++ sound/soc/codecs/hda.c | 4 +- sound/soc/codecs/hdac_hda.c | 6 +- sound/soc/codecs/hdac_hdmi.c | 8 +- sound/soc/intel/avs/core.c | 2 +- sound/soc/intel/avs/loader.c | 16 +- sound/soc/intel/avs/pcm.c | 16 +- sound/soc/intel/skylake/skl-messages.c | 6 +- sound/soc/intel/skylake/skl-pcm.c | 35 +++-- sound/soc/intel/skylake/skl.c | 2 +- sound/soc/sof/intel/hda-dai.c | 42 ++--- sound/soc/sof/intel/hda-pcm.c | 3 +- sound/soc/sof/intel/hda-stream.c | 16 +- sound/soc/sof/intel/hda.c | 2 +- 18 files changed, 343 insertions(+), 362 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/10 ALSA: hda: ext: hdac_ext_controller: use helpers in loop
No need to copy/paste code, use helper instead.
--- sound/hda/ext/hdac_ext_controller.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
sound/hda/ext/hdac_ext_controller.c +2 -6
@@ -225,9 +225,7 @@ int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus)int ret;list_for_each_entry (hlink, &bus->hlink_list, list) { -snd_hdac_updatel (hlink->ml_addr,AZX_REG_ML_LCTL , -AZX_ML_LCTL_SPA ,AZX_ML_LCTL_SPA ); - ret =check_hdac_link_power_active (hlink, true); + ret =snd_hdac_ext_bus_link_power_up (hlink);if (ret <0 )return ret; }
@@ -246,9 +244,7 @@ int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus)int ret;list_for_each_entry (hlink, &bus->hlink_list, list) { -snd_hdac_updatel (hlink->ml_addr,AZX_REG_ML_LCTL , -AZX_ML_LCTL_SPA ,0 ); - ret =check_hdac_link_power_active (hlink, false); + ret =snd_hdac_ext_bus_link_power_down (hlink);if (ret <0 )return ret; }
Signature · 1 line
2.34.1
Re: [PATCH 01/10] ALSA: hda: ext: hdac_ext_controller: use helpers in loop
Quoted 6 lines · Pierre-Louis Bossart
No need to copy/paste code, use helper instead.
Signed-off-by Pierre-Louis Bossart <[email protected]>Reviewed-by Ranjani Sridharan <[email protected]>Reviewed-by Rander Wang <[email protected]>Reviewed-by Péter Ujfalusi <[email protected]>
LGTM
PATCH 2/10 ALSA: hda: ext: hda_ext_controller: use hlink variable/parameter
In reply to Pierre-Louis BossartFollow the convention and use hlink for consistency. No functionality change.
--- include/sound/hdaudio_ext.h | 16 +++++----- sound/hda/ext/hdac_ext_controller.c | 48 ++++++++++++++--------------- 2 files changed, 32 insertions(+), 32 deletions(-)
include/sound/hdaudio_ext.h +8 -8
@@ -117,17 +117,17 @@ struct hdac_ext_link {struct list_head list; }; -int snd_hdac_ext_bus_link_power_up (struct hdac_ext_link *link); -int snd_hdac_ext_bus_link_power_down (struct hdac_ext_link *link); +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_up_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 *link, -int stream); -void snd_hdac_ext_link_clear_stream_id (struct hdac_ext_link *link, -int stream); +void snd_hdac_ext_link_set_stream_id (struct hdac_ext_link *hlink, +int stream); +void snd_hdac_ext_link_clear_stream_id (struct hdac_ext_link *hlink, +int stream); -int snd_hdac_ext_bus_link_get (struct hdac_bus *bus,struct hdac_ext_link *link); -int snd_hdac_ext_bus_link_put (struct hdac_bus *bus,struct hdac_ext_link *link); +int snd_hdac_ext_bus_link_get (struct hdac_bus *bus,struct hdac_ext_link *hlink); +int snd_hdac_ext_bus_link_put (struct hdac_bus *bus,struct hdac_ext_link *hlink);void snd_hdac_ext_bus_link_power (struct hdac_device *codec,bool enable);
sound/hda/ext/hdac_ext_controller.c +24 -24
126 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 02/10] ALSA: hda: ext: hda_ext_controller: use hlink variable/parameter
Quoted 7 lines · Pierre-Louis Bossart
Follow the convention and use hlink for consistency. No functionality change.
Signed-off-by Pierre-Louis Bossart <[email protected]>Reviewed-by Ranjani Sridharan <[email protected]>Reviewed-by Rander Wang <[email protected]>Reviewed-by Péter Ujfalusi <[email protected]>
LGTM
PATCH 3/10 ASoC: SOF: Intel: hda-dai: use hlink variable/parameter
In reply to Pierre-Louis BossartFollow the convention and use hlink for consistency. No functionality change.
--- sound/soc/sof/intel/hda-dai.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
sound/soc/sof/intel/hda-dai.c +12 -12
@@ -146,11 +146,11 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,struct hdac_ext_stream *hext_stream =snd_soc_dai_get_dma_data (cpu_dai, substream);struct hdac_bus *bus = hstream->bus;struct sof_intel_hda_stream *hda_stream; -struct hdac_ext_link *link; +struct hdac_ext_link *hlink;int stream_tag; - link =snd_hdac_ext_bus_get_link (bus, codec_dai->component->name); -if (!link) + hlink =snd_hdac_ext_bus_get_link (bus, codec_dai->component->name); +if (!hlink)return -EINVAL ;if (trigger_suspend_stop)
@@ -158,7 +158,7 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { stream_tag =hdac_stream (hext_stream)->stream_tag; -snd_hdac_ext_link_clear_stream_id (link, stream_tag); +snd_hdac_ext_link_clear_stream_id (hlink, stream_tag); }snd_soc_dai_set_dma_data (cpu_dai, substream,NULL );snd_hdac_ext_stream_release (hext_stream,HDAC_EXT_STREAM_TYPE_LINK );
@@ -177,7 +177,7 @@ static int hda_link_dma_params(struct hdac_ext_stream *hext_stream,struct hdac_stream *hstream = &hext_stream->hstream;unsigned char stream_tag = hstream->stream_tag;struct hdac_bus *bus = hstream->bus; -struct hdac_ext_link *link; +struct hdac_ext_link *hlink;unsigned int format_val;snd_hdac_ext_link_stream_reset (hext_stream);
@@ -192,9 +192,9 @@ static int hda_link_dma_params(struct hdac_ext_stream *hext_stream,snd_hdac_ext_link_stream_setup (hext_stream, format_val);if (hext_stream->hstream.direction ==SNDRV_PCM_STREAM_PLAYBACK ) { -list_for_each_entry (link, &bus->hlink_list, list) { -if (link->index == params->link_index) -snd_hdac_ext_link_set_stream_id (link, +list_for_each_entry (hlink, &bus->hlink_list, list) { +if (hlink->index == params->link_index) +snd_hdac_ext_link_set_stream_id (hlink, stream_tag); } }
@@ -214,7 +214,7 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,struct snd_soc_dai *codec_dai =asoc_rtd_to_codec (rtd,0 );struct hda_pipe_params p_params = {0 };struct hdac_bus *bus = hstream->bus; -struct hdac_ext_link *link; +struct hdac_ext_link *hlink; hext_stream =snd_soc_dai_get_dma_data (cpu_dai, substream);if (!hext_stream) {
@@ -225,8 +225,8 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,snd_soc_dai_set_dma_data (cpu_dai, substream, (void *)hext_stream); } - link =snd_hdac_ext_bus_get_link (bus, codec_dai->component->name); -if (!link) + hlink =snd_hdac_ext_bus_get_link (bus, codec_dai->component->name); +if (!hlink)return -EINVAL ;/* set the hdac_stream in the codec dai */
@@ -236,7 +236,7 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream, p_params.ch =params_channels (params); p_params.s_freq =params_rate (params); p_params.stream = substream->stream; - p_params.link_index = link->index; + p_params.link_index = hlink->index; p_params.format =params_format (params);if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK )
Signature · 1 line
2.34.1
Re: [PATCH 03/10] ASoC: SOF: Intel: hda-dai: use hlink variable/parameter
Quoted 2 lines · Pierre-Louis Bossart
Follow the convention and use hlink for consistency. No functionality change.
PATCH 4/10 ALSA/ASoC: hda: clarify bus_get_link() and bus_link_get() helpers
In reply to Pierre-Louis BossartWe have two helpers with confusing names and different purposes.
Rename bus_get_link() and bus_get_link_at() as bus_get_hlink_by_name() and bus_get_hlink_by_addr() respectively.
No functionality change
--- include/sound/hdaudio_ext.h | 6 +++--- sound/hda/ext/hdac_ext_controller.c | 24 ++++++++++++------------ sound/soc/codecs/hda.c | 4 ++-- sound/soc/codecs/hdac_hda.c | 6 +++--- sound/soc/codecs/hdac_hdmi.c | 8 ++++---- sound/soc/intel/avs/pcm.c | 4 ++-- sound/soc/intel/skylake/skl-pcm.c | 4 ++-- sound/soc/sof/intel/hda-dai.c | 4 ++-- 8 files changed, 30 insertions(+), 30 deletions(-)
include/sound/hdaudio_ext.h +3 -3
@@ -27,9 +27,9 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *chip, bool enable, int index);int snd_hdac_ext_bus_get_ml_capabilities (struct hdac_bus *bus); -struct hdac_ext_link *snd_hdac_ext_bus_link_at (struct hdac_bus *bus,int addr); -struct hdac_ext_link *snd_hdac_ext_bus_get_link (struct hdac_bus *bus, -const char *codec_name); +struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr (struct hdac_bus *bus,int addr); +struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name (struct hdac_bus *bus, +const char *codec_name);enum hdac_ext_stream_type {HDAC_EXT_STREAM_TYPE_COUPLED =0 ,
sound/hda/ext/hdac_ext_controller.c +12 -12
@@ -126,13 +126,13 @@ void snd_hdac_link_free_all(struct hdac_bus *bus)EXPORT_SYMBOL_GPL (snd_hdac_link_free_all);/** -* snd_hdac_ext_bus_link_at - get link at specified address -* @bus: link's parent bus device +* snd_hdac_ext_bus_get_hlink_by_addr - get hlink at specified address +* @bus: hlink's parent bus device * @addr: codec device address * -* Returns link object or NULL if matching link is not found. +* Returns hlink object or NULL if matching hlink is not found. */ -struct hdac_ext_link *snd_hdac_ext_bus_link_at (struct hdac_bus *bus,int addr) +struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr (struct hdac_bus *bus,int addr) {struct hdac_ext_link *hlink;int i;
@@ -143,15 +143,15 @@ struct hdac_ext_link *snd_hdac_ext_bus_link_at(struct hdac_bus *bus, int addr)return hlink;return NULL ; } -EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_link_at); +EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_get_hlink_by_addr);/** -* snd_hdac_ext_bus_get_link - get link based on codec name +* 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_link (struct hdac_bus *bus, -const char *codec_name) +struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name (struct hdac_bus *bus, +const char *codec_name) {int bus_idx, addr;
@@ -162,9 +162,9 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,if (addr <0 || addr >31 )return NULL ; -return snd_hdac_ext_bus_link_at (bus, addr); +return snd_hdac_ext_bus_get_hlink_by_addr (bus, addr); } -EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_get_link); +EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_get_hlink_by_name);static int check_hdac_link_power_active (struct hdac_ext_link *hlink,bool enable) {
@@ -337,7 +337,7 @@ static void hdac_ext_codec_link_up(struct hdac_device *codec) {const char *devname =dev_name (&codec->dev);struct hdac_ext_link *hlink = -snd_hdac_ext_bus_get_link (codec->bus, devname); +snd_hdac_ext_bus_get_hlink_by_name (codec->bus, devname);if (hlink)snd_hdac_ext_bus_link_get (codec->bus, hlink);
@@ -347,7 +347,7 @@ static void hdac_ext_codec_link_down(struct hdac_device *codec) {const char *devname =dev_name (&codec->dev);struct hdac_ext_link *hlink = -snd_hdac_ext_bus_get_link (codec->bus, devname); +snd_hdac_ext_bus_get_hlink_by_name (codec->bus, devname);if (hlink)snd_hdac_ext_bus_link_put (codec->bus, hlink);
sound/soc/codecs/hda.c +2 -2
@@ -181,7 +181,7 @@ static int hda_codec_probe(struct snd_soc_component *component) !pm_runtime_status_suspended(&hdev->dev));#endif - hlink =snd_hdac_ext_bus_link_at (bus, hdev->addr); + hlink =snd_hdac_ext_bus_get_hlink_by_addr (bus, hdev->addr);if (!hlink) {dev_err (&hdev->dev,"hdac link not found\n" );return -EIO ;
@@ -289,7 +289,7 @@ static void hda_codec_remove(struct snd_soc_component *component)if (hda_codec_is_display (codec))snd_hdac_display_power (bus, hdev->addr, false); - hlink =snd_hdac_ext_bus_link_at (bus, hdev->addr); + hlink =snd_hdac_ext_bus_get_hlink_by_addr (bus, hdev->addr);if (hlink)snd_hdac_ext_bus_link_put (bus, hlink);/*
sound/soc/codecs/hdac_hda.c +3 -3
@@ -400,7 +400,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)hda_codec_patch_t patch;int ret; - hlink =snd_hdac_ext_bus_get_link (hdev->bus,dev_name (&hdev->dev)); + hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) {dev_err (&hdev->dev,"hdac link not found\n" );return -EIO ;
@@ -516,7 +516,7 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)struct hda_codec *codec = hda_pvt->codec;struct hdac_ext_link *hlink =NULL ; - hlink =snd_hdac_ext_bus_get_link (hdev->bus,dev_name (&hdev->dev)); + hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) {dev_err (&hdev->dev,"hdac link not found\n" );return ;
@@ -584,7 +584,7 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)int ret;/* hold the ref while we probe */ - hlink =snd_hdac_ext_bus_get_link (hdev->bus,dev_name (&hdev->dev)); + hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) {dev_err (&hdev->dev,"hdac link not found\n" );return -EIO ;
sound/soc/codecs/hdac_hdmi.c +4 -4
@@ -1967,7 +1967,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component)* hold the ref while we probe, also no need to drop the ref on * exit, we call pm_runtime_suspend() so that will do for us */ - hlink =snd_hdac_ext_bus_get_link (hdev->bus,dev_name (&hdev->dev)); + hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) {dev_err (&hdev->dev,"hdac link not found\n" );return -EIO ;
@@ -2144,7 +2144,7 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev)const struct hda_device_id *hdac_id =hdac_get_device_id (hdev, hdrv);/* hold the ref while we probe */ - hlink =snd_hdac_ext_bus_get_link (hdev->bus,dev_name (&hdev->dev)); + hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) {dev_err (&hdev->dev,"hdac link not found\n" );return -EIO ;
@@ -2244,7 +2244,7 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)snd_hdac_codec_read (hdev, hdev->afg,0 ,AC_VERB_SET_POWER_STATE ,AC_PWRST_D3 ); - hlink =snd_hdac_ext_bus_get_link (bus,dev_name (dev)); + hlink =snd_hdac_ext_bus_get_hlink_by_name (bus,dev_name (dev));if (!hlink) {dev_err (dev,"hdac link not found\n" );return -EIO ;
@@ -2270,7 +2270,7 @@ static int hdac_hdmi_runtime_resume(struct device *dev)if (!bus)return 0 ; - hlink =snd_hdac_ext_bus_get_link (bus,dev_name (dev)); + hlink =snd_hdac_ext_bus_get_hlink_by_name (bus,dev_name (dev));if (!hlink) {dev_err (dev,"hdac link not found\n" );return -EIO ;
sound/soc/intel/avs/pcm.c +2 -2
@@ -292,7 +292,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn/* clear link <-> stream mapping */ codec =dev_to_hda_codec (asoc_rtd_to_codec (rtd,0 )->dev); - link =snd_hdac_ext_bus_link_at (&codec->bus->core, codec->core.addr); + link =snd_hdac_ext_bus_get_hlink_by_addr (&codec->bus->core, codec->core.addr);if (!link)return -EINVAL ;
@@ -325,7 +325,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct snsnd_hdac_ext_link_stream_reset (link_stream);snd_hdac_ext_link_stream_setup (link_stream, format_val); - link =snd_hdac_ext_bus_link_at (bus, codec->core.addr); + link =snd_hdac_ext_bus_get_hlink_by_addr (bus, codec->core.addr);if (!link)return -EINVAL ;
sound/soc/intel/skylake/skl-pcm.c +2 -2
@@ -558,7 +558,7 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,snd_soc_dai_set_dma_data (dai, substream, (void *)link_dev); - link =snd_hdac_ext_bus_get_link (bus, codec_dai->component->name); + link =snd_hdac_ext_bus_get_hlink_by_name (bus, codec_dai->component->name);if (!link)return -EINVAL ;
@@ -643,7 +643,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, link_dev->link_prepared =0 ; - link =snd_hdac_ext_bus_get_link (bus,asoc_rtd_to_codec (rtd,0 )->component->name); + link =snd_hdac_ext_bus_get_hlink_by_name (bus,asoc_rtd_to_codec (rtd,0 )->component->name);if (!link)return -EINVAL ;
sound/soc/sof/intel/hda-dai.c +2 -2
@@ -149,7 +149,7 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,struct hdac_ext_link *hlink;int stream_tag; - hlink =snd_hdac_ext_bus_get_link (bus, codec_dai->component->name); + hlink =snd_hdac_ext_bus_get_hlink_by_name (bus, codec_dai->component->name);if (!hlink)return -EINVAL ;
@@ -225,7 +225,7 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,snd_soc_dai_set_dma_data (cpu_dai, substream, (void *)hext_stream); } - hlink =snd_hdac_ext_bus_get_link (bus, codec_dai->component->name); + hlink =snd_hdac_ext_bus_get_hlink_by_name (bus, codec_dai->component->name);if (!hlink)return -EINVAL ;
Signature · 1 line
2.34.1
Re: [PATCH 04/10] ALSA/ASoC: hda: clarify bus_get_link() and bus_link_get() helpers
Quoted 4 lines · Pierre-Louis Bossart
We have two helpers with confusing names and different purposes.
Rename
bus_get_link()andbus_get_link_at()asbus_get_hlink_by_name()andbus_get_hlink_by_addr()respectively.
PATCH 5/10 ALSA/ASoC: hda: ext: add 'ext' prefix to snd_hdac_link_free_all
In reply to Pierre-Louis BossartNo functionality change, just prefix addition to clearly identify that the helper only applies to the 'ext' part for Intel platforms.
--- include/sound/hdaudio_ext.h | 2 +- sound/hda/ext/hdac_ext_controller.c | 6 +++--- sound/soc/intel/avs/core.c | 2 +- sound/soc/intel/skylake/skl.c | 2 +- sound/soc/sof/intel/hda.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
include/sound/hdaudio_ext.h +1 -1
@@ -80,7 +80,7 @@ struct hdac_ext_stream {int snd_hdac_ext_stream_init_all (struct hdac_bus *bus,int start_idx,int num_stream,int dir);void snd_hdac_ext_stream_free_all (struct hdac_bus *bus); -void snd_hdac_link_free_all (struct hdac_bus *bus); +void snd_hdac_ext_link_free_all (struct hdac_bus *bus);struct hdac_ext_stream *snd_hdac_ext_stream_assign (struct hdac_bus *bus,struct snd_pcm_substream *substream,int type);
sound/hda/ext/hdac_ext_controller.c +3 -3
@@ -108,12 +108,12 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus)EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_get_ml_capabilities);/** -* snd_hdac_link_free_all- free hdac extended link objects +* snd_hdac_ext_link_free_all- free hdac extended link objects * * @bus: the pointer to HDAC bus object */ -void snd_hdac_link_free_all (struct hdac_bus *bus) +void snd_hdac_ext_link_free_all (struct hdac_bus *bus) {struct hdac_ext_link *hlink;
@@ -123,7 +123,7 @@ void snd_hdac_link_free_all(struct hdac_bus *bus)kfree (hlink); } } -EXPORT_SYMBOL_GPL (snd_hdac_link_free_all); +EXPORT_SYMBOL_GPL (snd_hdac_ext_link_free_all);/** * snd_hdac_ext_bus_get_hlink_by_addr - get hlink at specified address
sound/soc/intel/avs/core.c +1 -1
@@ -504,7 +504,7 @@ static void avs_pci_remove(struct pci_dev *pci)snd_hdac_bus_free_stream_pages (bus);snd_hdac_ext_stream_free_all (bus);/* reverse ml_capabilities */ -snd_hdac_link_free_all (bus); +snd_hdac_ext_link_free_all (bus);snd_hdac_ext_bus_exit (bus);avs_dsp_core_disable (adev,GENMASK (adev->hw_cfg.dsp_cores -1 ,0 ));
sound/soc/intel/skylake/skl.c +1 -1
@@ -436,7 +436,7 @@ static int skl_free(struct hdac_bus *bus)free_irq (bus->irq, (void *)bus);snd_hdac_bus_free_stream_pages (bus);snd_hdac_ext_stream_free_all (bus); -snd_hdac_link_free_all (bus); +snd_hdac_ext_link_free_all (bus);if (bus->remap_addr)iounmap (bus->remap_addr);
sound/soc/sof/intel/hda.c +1 -1
@@ -1224,7 +1224,7 @@ int hda_dsp_remove(struct snd_sof_dev *sdev)hda_dsp_stream_free (sdev);#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA ) -snd_hdac_link_free_all (bus); +snd_hdac_ext_link_free_all (bus);#endif iounmap (sdev->bar[HDA_DSP_BAR ]);
Signature · 1 line
2.34.1
Re: [PATCH 05/10] ALSA/ASoC: hda: ext: add 'ext' prefix to snd_hdac_link_free_all
Quoted 2 lines · Pierre-Louis Bossart
No functionality change, just prefix addition to clearly identify that the helper only applies to the 'ext' part for Intel platforms.
PATCH 6/10 ALSA/ASoC: hda: ext: remove 'link' prefix for stream-related operations
In reply to Pierre-Louis BossartWe should only use 'link' in the context of multi-link configurations. Streams are configured from a different register space and are not dependent on link except for LOSIDV settings.
Not functionality change, just pure rename.
--- include/sound/hdaudio_ext.h | 8 ++++---- sound/hda/ext/hdac_ext_stream.c | 28 ++++++++++++++-------------- sound/soc/intel/avs/pcm.c | 8 ++++---- sound/soc/intel/skylake/skl-pcm.c | 8 ++++---- sound/soc/sof/intel/hda-dai.c | 16 ++++++++-------- 5 files changed, 34 insertions(+), 34 deletions(-)
include/sound/hdaudio_ext.h +4 -4
@@ -100,10 +100,10 @@ int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus, struct hdac_ext_stream *hext_stream, u32 value);int snd_hdac_ext_stream_set_lpib (struct hdac_ext_stream *hext_stream,u32 value); -void snd_hdac_ext_link_stream_start (struct hdac_ext_stream *hext_stream); -void snd_hdac_ext_link_stream_clear (struct hdac_ext_stream *hext_stream); -void snd_hdac_ext_link_stream_reset (struct hdac_ext_stream *hext_stream); -int snd_hdac_ext_link_stream_setup (struct hdac_ext_stream *hext_stream,int fmt); +void snd_hdac_ext_stream_start (struct hdac_ext_stream *hext_stream); +void snd_hdac_ext_stream_clear (struct hdac_ext_stream *hext_stream); +void snd_hdac_ext_stream_reset (struct hdac_ext_stream *hext_stream); +int snd_hdac_ext_stream_setup (struct hdac_ext_stream *hext_stream,int fmt);struct hdac_ext_link {struct hdac_bus *bus;
sound/hda/ext/hdac_ext_stream.c +14 -14
@@ -140,36 +140,36 @@ void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,EXPORT_SYMBOL_GPL (snd_hdac_ext_stream_decouple);/** -* snd_hdac_ext_link_stream_start - start a stream +* snd_hdac_ext_stream_start - start a stream * @hext_stream: HD-audio ext core stream to start */ -void snd_hdac_ext_link_stream_start (struct hdac_ext_stream *hext_stream) +void snd_hdac_ext_stream_start (struct hdac_ext_stream *hext_stream) {snd_hdac_updatel (hext_stream->pplc_addr,AZX_REG_PPLCCTL ,AZX_PPLCCTL_RUN ,AZX_PPLCCTL_RUN ); } -EXPORT_SYMBOL_GPL (snd_hdac_ext_link_stream_start); +EXPORT_SYMBOL_GPL (snd_hdac_ext_stream_start);/** -* snd_hdac_ext_link_stream_clear - stop a stream DMA +* snd_hdac_ext_stream_clear - stop a stream DMA * @hext_stream: HD-audio ext core stream to stop */ -void snd_hdac_ext_link_stream_clear (struct hdac_ext_stream *hext_stream) +void snd_hdac_ext_stream_clear (struct hdac_ext_stream *hext_stream) {snd_hdac_updatel (hext_stream->pplc_addr,AZX_REG_PPLCCTL ,AZX_PPLCCTL_RUN ,0 ); } -EXPORT_SYMBOL_GPL (snd_hdac_ext_link_stream_clear); +EXPORT_SYMBOL_GPL (snd_hdac_ext_stream_clear);/** -* snd_hdac_ext_link_stream_reset - reset a stream +* snd_hdac_ext_stream_reset - reset a stream * @hext_stream: HD-audio ext core stream to reset */ -void snd_hdac_ext_link_stream_reset (struct hdac_ext_stream *hext_stream) +void snd_hdac_ext_stream_reset (struct hdac_ext_stream *hext_stream) {unsigned char val;int timeout; -snd_hdac_ext_link_stream_clear (hext_stream); +snd_hdac_ext_stream_clear (hext_stream);snd_hdac_updatel (hext_stream->pplc_addr,AZX_REG_PPLCCTL ,AZX_PPLCCTL_STRST ,AZX_PPLCCTL_STRST );
@@ -196,20 +196,20 @@ void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *hext_stream) }while (--timeout); } -EXPORT_SYMBOL_GPL (snd_hdac_ext_link_stream_reset); +EXPORT_SYMBOL_GPL (snd_hdac_ext_stream_reset);/** -* snd_hdac_ext_link_stream_setup - set up the SD for streaming +* snd_hdac_ext_stream_setup - set up the SD for streaming * @hext_stream: HD-audio ext core stream to set up * @fmt: stream format */ -int snd_hdac_ext_link_stream_setup (struct hdac_ext_stream *hext_stream,int fmt) +int snd_hdac_ext_stream_setup (struct hdac_ext_stream *hext_stream,int fmt) {struct hdac_stream *hstream = &hext_stream->hstream;unsigned int val;/* make sure the run bit is zero for SD */ -snd_hdac_ext_link_stream_clear (hext_stream); +snd_hdac_ext_stream_clear (hext_stream);/* program the stream_tag */ val =readl (hext_stream->pplc_addr +AZX_REG_PPLCCTL ); val = (val & ~AZX_PPLCCTL_STRM_MASK) |
@@ -221,7 +221,7 @@ int snd_hdac_ext_link_stream_setup(struct hdac_ext_stream *hext_stream, int fmt)return 0 ; } -EXPORT_SYMBOL_GPL (snd_hdac_ext_link_stream_setup); +EXPORT_SYMBOL_GPL (snd_hdac_ext_stream_setup);/** * snd_hdac_ext_link_set_stream_id - maps stream id to link output
sound/soc/intel/avs/pcm.c +4 -4
@@ -322,8 +322,8 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn runtime->sample_bits, 0);snd_hdac_ext_stream_decouple (bus, link_stream, true); -snd_hdac_ext_link_stream_reset (link_stream); -snd_hdac_ext_link_stream_setup (link_stream, format_val); +snd_hdac_ext_stream_reset (link_stream); +snd_hdac_ext_stream_setup (link_stream, format_val); link =snd_hdac_ext_bus_get_hlink_by_addr (bus, codec->core.addr);if (!link)
@@ -355,7 +355,7 @@ static int avs_dai_hda_be_trigger(struct snd_pcm_substream *substream, int cmd,switch (cmd) {case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : -snd_hdac_ext_link_stream_start (link_stream); +snd_hdac_ext_stream_start (link_stream); ret =avs_path_run (data->path,AVS_TPLG_TRIGGER_AUTO );if (ret <0 )
@@ -368,7 +368,7 @@ static int avs_dai_hda_be_trigger(struct snd_pcm_substream *substream, int cmd,if (ret <0 )dev_err (dai->dev,"pause BE path failed: %d\n" , ret); -snd_hdac_ext_link_stream_clear (link_stream); +snd_hdac_ext_stream_clear (link_stream);if (cmd ==SNDRV_PCM_TRIGGER_STOP ) { ret =avs_path_reset (data->path);
sound/soc/intel/skylake/skl-pcm.c +4 -4
@@ -190,9 +190,9 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)dev_dbg (dev,"format_val=%d, rate=%d, ch=%d, format=%d\n" , format_val, params->s_freq, params->ch, params->format); -snd_hdac_ext_link_stream_reset (stream); +snd_hdac_ext_stream_reset (stream); -snd_hdac_ext_link_stream_setup (stream, format_val); +snd_hdac_ext_stream_setup (stream, format_val); stream_tag = hstream->stream_tag;if (stream->hstream.direction ==SNDRV_PCM_STREAM_PLAYBACK ) {
@@ -612,13 +612,13 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,case SNDRV_PCM_TRIGGER_RESUME :case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : -snd_hdac_ext_link_stream_start (link_dev); +snd_hdac_ext_stream_start (link_dev);break ;case SNDRV_PCM_TRIGGER_PAUSE_PUSH :case SNDRV_PCM_TRIGGER_SUSPEND :case SNDRV_PCM_TRIGGER_STOP : -snd_hdac_ext_link_stream_clear (link_dev); +snd_hdac_ext_stream_clear (link_dev);if (cmd ==SNDRV_PCM_TRIGGER_SUSPEND )snd_hdac_ext_stream_decouple (bus, stream, false);break ;
sound/soc/sof/intel/hda-dai.c +8 -8
@@ -154,7 +154,7 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,return -EINVAL ;if (trigger_suspend_stop) -snd_hdac_ext_link_stream_clear (hext_stream); +snd_hdac_ext_stream_clear (hext_stream);if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { stream_tag =hdac_stream (hext_stream)->stream_tag;
@@ -180,7 +180,7 @@ static int hda_link_dma_params(struct hdac_ext_stream *hext_stream,struct hdac_ext_link *hlink;unsigned int format_val; -snd_hdac_ext_link_stream_reset (hext_stream); +snd_hdac_ext_stream_reset (hext_stream); format_val = snd_hdac_calc_stream_format(params->s_freq, params->ch, params->format,
@@ -189,7 +189,7 @@ static int hda_link_dma_params(struct hdac_ext_stream *hext_stream,dev_dbg (bus->dev,"format_val=%d, rate=%d, ch=%d, format=%d\n" , format_val, params->s_freq, params->ch, params->format); -snd_hdac_ext_link_stream_setup (hext_stream, format_val); +snd_hdac_ext_stream_setup (hext_stream, format_val);if (hext_stream->hstream.direction ==SNDRV_PCM_STREAM_PLAYBACK ) {list_for_each_entry (hlink, &bus->hlink_list, list) {
@@ -270,7 +270,7 @@ static int hda_link_dma_trigger(struct snd_pcm_substream *substream, int cmd)switch (cmd) {case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : -snd_hdac_ext_link_stream_start (hext_stream); +snd_hdac_ext_stream_start (hext_stream);break ;case SNDRV_PCM_TRIGGER_SUSPEND :case SNDRV_PCM_TRIGGER_STOP :
@@ -280,7 +280,7 @@ static int hda_link_dma_trigger(struct snd_pcm_substream *substream, int cmd)break ;case SNDRV_PCM_TRIGGER_PAUSE_PUSH : -snd_hdac_ext_link_stream_clear (hext_stream); +snd_hdac_ext_stream_clear (hext_stream);break ;default :
@@ -476,7 +476,7 @@ static int ipc4_hda_dai_trigger(struct snd_pcm_substream *substream,switch (cmd) {case SNDRV_PCM_TRIGGER_START :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : -snd_hdac_ext_link_stream_start (hext_stream); +snd_hdac_ext_stream_start (hext_stream);break ;case SNDRV_PCM_TRIGGER_SUSPEND :case SNDRV_PCM_TRIGGER_STOP :
@@ -491,7 +491,7 @@ static int ipc4_hda_dai_trigger(struct snd_pcm_substream *substream, pipeline->state =SOF_IPC4_PIPE_PAUSED ; -snd_hdac_ext_link_stream_clear (hext_stream); +snd_hdac_ext_stream_clear (hext_stream); ret =sof_ipc4_set_pipeline_state (sdev, swidget->pipeline_id,SOF_IPC4_PIPE_RESET );
@@ -519,7 +519,7 @@ static int ipc4_hda_dai_trigger(struct snd_pcm_substream *substream, pipeline->state =SOF_IPC4_PIPE_PAUSED ; -snd_hdac_ext_link_stream_clear (hext_stream); +snd_hdac_ext_stream_clear (hext_stream);break ; }default :
Signature · 1 line
2.34.1
Re: [PATCH 06/10] ALSA/ASoC: hda: ext: remove 'link' prefix for stream-related operations
Quoted 3 lines · Pierre-Louis Bossart
We should only use 'link' in the context of multi-link configurations. Streams are configured from a different register space and are not dependent on link except for LOSIDV settings.
PATCH 7/10 ALSA/ASoC: hda: ext: add 'bus' prefix for multi-link stream setting
In reply to Pierre-Louis BossartAll 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.
--- include/sound/hdaudio_ext.h | 8 ++++---- sound/hda/ext/hdac_ext_controller.c | 24 ++++++++++++++++++++++++ sound/hda/ext/hdac_ext_stream.c | 24 ------------------------ sound/soc/intel/avs/pcm.c | 4 ++-- sound/soc/intel/skylake/skl-pcm.c | 6 +++--- sound/soc/sof/intel/hda-dai.c | 6 +++--- 6 files changed, 36 insertions(+), 36 deletions(-)
include/sound/hdaudio_ext.h +4 -4
@@ -121,10 +121,10 @@ 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_up_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, -int stream); -void snd_hdac_ext_link_clear_stream_id (struct hdac_ext_link *hlink, -int stream); +void snd_hdac_ext_bus_link_set_stream_id (struct hdac_ext_link *hlink, +int stream); +void snd_hdac_ext_bus_link_clear_stream_id (struct hdac_ext_link *hlink, +int stream);int snd_hdac_ext_bus_link_get (struct hdac_bus *bus,struct hdac_ext_link *hlink);int snd_hdac_ext_bus_link_put (struct hdac_bus *bus,struct hdac_ext_link *hlink);
sound/hda/ext/hdac_ext_controller.c +24 -0
@@ -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); +/** +* 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) {
sound/hda/ext/hdac_ext_stream.c +0 -24
@@ -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); -/** -* 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 *hdac_ext_link_stream_assign (struct hdac_bus *bus,struct snd_pcm_substream *substream)
sound/soc/intel/avs/pcm.c +2 -2
@@ -297,7 +297,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct snreturn -EINVAL ;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 ; }
@@ -330,7 +330,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct snreturn -EINVAL ;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);if (ret)
sound/soc/intel/skylake/skl-pcm.c +3 -3
@@ -198,8 +198,8 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)if (stream->hstream.direction ==SNDRV_PCM_STREAM_PLAYBACK ) {list_for_each_entry (link, &bus->hlink_list, list) {if (link->index == params->link_index) -snd_hdac_ext_link_set_stream_id (link, - stream_tag); +snd_hdac_ext_bus_link_set_stream_id (link, + stream_tag); } }
@@ -649,7 +649,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { 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 );
sound/soc/sof/intel/hda-dai.c +3 -3
@@ -158,7 +158,7 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { 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_hdac_ext_stream_release (hext_stream,HDAC_EXT_STREAM_TYPE_LINK );
@@ -194,8 +194,8 @@ static int hda_link_dma_params(struct hdac_ext_stream *hext_stream,if (hext_stream->hstream.direction ==SNDRV_PCM_STREAM_PLAYBACK ) {list_for_each_entry (hlink, &bus->hlink_list, list) {if (hlink->index == params->link_index) -snd_hdac_ext_link_set_stream_id (hlink, - stream_tag); +snd_hdac_ext_bus_link_set_stream_id (hlink, + stream_tag); } }
Signature · 1 line
2.34.1
Re: [PATCH 07/10] ALSA/ASoC: hda: ext: add 'bus' prefix for multi-link stream setting
Quoted 3 lines · Pierre-Louis Bossart
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.
PATCH 8/10 ALSA: hda: ext: reduce ambiguity between 'multi-link' and 'link' DMA
In reply to Pierre-Louis BossartMy esteemed colleagues keep using the same words for different things.
The multi-link structure needs to be handled whether the DSP is enabled or not.
The host and link DMAs are only relevant when the DSP is enabled.
Things get convoluted when there's an ambiguity between the LOSIDV settings in the multi-link register space and the selection of the stream_tag for the link DMA.
Clarify with a rename that the static functions used are related to the host and link DMAs only.
No functionality change, pure rename.
--- sound/hda/ext/hdac_ext_stream.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/hda/ext/hdac_ext_stream.c +6 -6
@@ -224,8 +224,8 @@ int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt)EXPORT_SYMBOL_GPL (snd_hdac_ext_stream_setup);static struct hdac_ext_stream * -hdac_ext_link_stream_assign (struct hdac_bus *bus, -struct snd_pcm_substream *substream) +hdac_ext_link_dma_stream_assign (struct hdac_bus *bus, +struct snd_pcm_substream *substream) {struct hdac_ext_stream *res =NULL ;struct hdac_stream *hstream =NULL ;
@@ -260,8 +260,8 @@ hdac_ext_link_stream_assign(struct hdac_bus *bus, }static struct hdac_ext_stream * -hdac_ext_host_stream_assign (struct hdac_bus *bus, -struct snd_pcm_substream *substream) +hdac_ext_host_dma_stream_assign (struct hdac_bus *bus, +struct snd_pcm_substream *substream) {struct hdac_ext_stream *res =NULL ;struct hdac_stream *hstream =NULL ;
@@ -329,10 +329,10 @@ struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,return hext_stream;case HDAC_EXT_STREAM_TYPE_HOST : -return hdac_ext_host_stream_assign (bus, substream); +return hdac_ext_host_dma_stream_assign (bus, substream);case HDAC_EXT_STREAM_TYPE_LINK : -return hdac_ext_link_stream_assign (bus, substream); +return hdac_ext_link_dma_stream_assign (bus, substream);default :return NULL ;
Signature · 1 line
2.34.1
PATCH 9/10 ALSA: hda: hdac_ext_controller: remove useless loop
In reply to Pierre-Louis Bossartcommit 0b00a5615dc40 ("ALSA: hdac_ext: add hdac extended controller") introduced a for() loop on the number of HDaudio codecs that seems completely useless.
a) the body of the loop does not make use of the loop index, and
b) the LSDIID register is related to the SDI line, so there can only be one codec per multi-link descriptor.
--- sound/hda/ext/hdac_ext_controller.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/hda/ext/hdac_ext_controller.c +2 -4
@@ -135,12 +135,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_link_free_all);struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr (struct hdac_bus *bus,int addr) {struct hdac_ext_link *hlink; -int i;list_for_each_entry (hlink, &bus->hlink_list, list) -for (i =0 ; i <HDA_MAX_CODECS ; i++) -if (hlink->lsdiid & (0x1 << addr)) -return hlink; +if (hlink->lsdiid & (0x1 << addr)) +return hlink;return NULL ; }EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_get_hlink_by_addr);
Signature · 1 line
2.34.1
PATCH 10/10 ALSA/ASoC: hda: move SPIB/DRMS functionality from ext layer
In reply to Pierre-Louis BossartThe SPIB and DRMS capabilities are orthogonal to the DSP enablement and can be used whether the stream is coupled or not.
The existing code partitioning makes limited sense, the capabilities are parsed at the sound/hda level but helpers are located in sound/hda/ext.
This patch moves all the SPIB/DRMS functionality to the sound/hda layer. This reduces the complexity of the sound/hda/ext layer which is now limited to handling the multi-link extensions and stream coupling/decoupling helpers.
Note that this is an iso-functionality code move and rename, the HDaudio legacy driver would need additional changes to make use of these capabilities.
--- include/sound/hdaudio.h | 26 +++++ include/sound/hdaudio_ext.h | 34 ------ sound/hda/ext/hdac_ext_stream.c | 139 ------------------------- sound/hda/hdac_stream.c | 136 ++++++++++++++++++++++++ sound/soc/intel/avs/loader.c | 16 +-- sound/soc/intel/skylake/skl-messages.c | 6 +- sound/soc/intel/skylake/skl-pcm.c | 17 ++- sound/soc/sof/intel/hda-pcm.c | 3 +- sound/soc/sof/intel/hda-stream.c | 16 +-- 9 files changed, 190 insertions(+), 203 deletions(-)
include/sound/hdaudio.h +26 -0
@@ -495,6 +495,13 @@ static inline u16 snd_hdac_reg_readw(struct hdac_bus *bus, void __iomem *addr)snd_hdac_chip_writeb (chip, reg, \ (snd_hdac_chip_readb (chip, reg) & ~(mask)) | (val)) +/* update register macro */ +#define snd_hdac_updatel (addr, reg, mask, val) \ + writel(((readl(addr + reg) & ~(mask)) | (val)), addr + reg) + +#define snd_hdac_updatew (addr, reg, mask, val) \ + writew(((readw(addr + reg) & ~(mask)) | (val)), addr + reg) +/* * HD-audio stream */
@@ -511,6 +518,13 @@ struct hdac_stream {void __iomem *sd_addr;/* stream descriptor pointer */ +void __iomem *spib_addr;/* software position in buffers stream pointer */ +void __iomem *fifo_addr;/* software position Max fifos stream pointer */ + +void __iomem *dpibr_addr;/* DMA position in buffer resume pointer */ +u32 dpib;/* DMA position in buffer */ +u32 lpib;/* Linear position in buffer */ +u32 sd_int_sta_mask;/* stream int status mask */ /* pcm support */
@@ -575,6 +589,18 @@ void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev,int snd_hdac_get_stream_stripe_ctl (struct hdac_bus *bus,struct snd_pcm_substream *substream); +void snd_hdac_stream_spbcap_enable (struct hdac_bus *chip, +bool enable,int index); +int snd_hdac_stream_set_spib (struct hdac_bus *bus, +struct hdac_stream *azx_dev,u32 value); +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_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); +/* * macros for easy use */
include/sound/hdaudio_ext.h +0 -34
@@ -23,9 +23,6 @@ void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus);void snd_hdac_ext_bus_ppcap_enable (struct hdac_bus *chip,bool enable);void snd_hdac_ext_bus_ppcap_int_enable (struct hdac_bus *chip,bool enable); -void snd_hdac_ext_stream_spbcap_enable (struct hdac_bus *chip, -bool enable,int index); -int snd_hdac_ext_bus_get_ml_capabilities (struct hdac_bus *bus);struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr (struct hdac_bus *bus,int addr); struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name(struct hdac_bus *bus,
@@ -43,11 +40,6 @@ enum hdac_ext_stream_type {* @hstream: hdac_stream * @pphc_addr: processing pipe host stream pointer * @pplc_addr: processing pipe link stream pointer -* @spib_addr: software position in buffers stream pointer -* @fifo_addr: software position Max fifos stream pointer -* @dpibr_addr: DMA position in buffer resume pointer -* @dpib: DMA position in buffer -* @lpib: Linear position in buffer * @decoupled: stream host and link is decoupled * @link_locked: link is locked * @link_prepared: link is prepared
@@ -59,13 +51,6 @@ struct hdac_ext_stream {void __iomem *pphc_addr;void __iomem *pplc_addr; -void __iomem *spib_addr; -void __iomem *fifo_addr; - -void __iomem *dpibr_addr; - -u32 dpib; -u32 lpib; bool decoupled:1; bool link_locked:1;bool link_prepared;
@@ -90,16 +75,6 @@ void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,void snd_hdac_ext_stream_decouple (struct hdac_bus *bus,struct hdac_ext_stream *azx_dev,bool decouple); -int snd_hdac_ext_stream_set_spib (struct hdac_bus *bus, -struct hdac_ext_stream *hext_stream,u32 value); -int snd_hdac_ext_stream_get_spbmaxfifo (struct hdac_bus *bus, -struct hdac_ext_stream *hext_stream); -void snd_hdac_ext_stream_drsm_enable (struct hdac_bus *bus, -bool enable,int index); -int snd_hdac_ext_stream_set_dpibr (struct hdac_bus *bus, -struct hdac_ext_stream *hext_stream,u32 value); -int snd_hdac_ext_stream_set_lpib (struct hdac_ext_stream *hext_stream,u32 value); -void snd_hdac_ext_stream_start (struct hdac_ext_stream *hext_stream);void snd_hdac_ext_stream_clear (struct hdac_ext_stream *hext_stream);void snd_hdac_ext_stream_reset (struct hdac_ext_stream *hext_stream);
@@ -131,15 +106,6 @@ int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *hlink)void snd_hdac_ext_bus_link_power (struct hdac_device *codec,bool enable); -/* update register macro */ -#define snd_hdac_updatel (addr, reg, mask, val) \ - writel(((readl(addr + reg) & ~(mask)) | (val)), \ - addr + reg) - -#define snd_hdac_updatew (addr, reg, mask, val) \ - writew(((readw(addr + reg) & ~(mask)) | (val)), \ - addr + reg) -#define snd_hdac_adsp_writeb (chip, reg, value) \ snd_hdac_reg_writeb(chip, (chip)->dsp_ba + (reg), value)#define snd_hdac_adsp_readb (chip, reg) \
sound/hda/ext/hdac_ext_stream.c +0 -139
148 lines not on this page · raw message
sound/hda/hdac_stream.c +136 -0
148 lines not on this page · raw message
sound/soc/intel/avs/loader.c +8 -8
@@ -369,8 +369,8 @@ int avs_hda_load_basefw(struct avs_dev *adev, struct firmware *fw) goto release_stream;/* enable SPIB for hda stream */ -snd_hdac_ext_stream_spbcap_enable (bus, true, hstream->index); - ret =snd_hdac_ext_stream_set_spib (bus, estream, fw->size); +snd_hdac_stream_spbcap_enable (bus, true, hstream->index); + ret =snd_hdac_stream_set_spib (bus, hstream, fw->size);if (ret) goto cleanup_resources;
@@ -400,8 +400,8 @@ int avs_hda_load_basefw(struct avs_dev *adev, struct firmware *fw) cleanup_resources:/* disable SPIB for hda stream */ -snd_hdac_ext_stream_spbcap_enable (bus, false, hstream->index); -snd_hdac_ext_stream_set_spib (bus, estream,0 ); +snd_hdac_stream_spbcap_enable (bus, false, hstream->index); +snd_hdac_stream_set_spib (bus, hstream,0 );snd_hdac_dsp_cleanup (hstream, &dmab); release_stream:
@@ -436,8 +436,8 @@ int avs_hda_load_library(struct avs_dev *adev, struct firmware *lib, u32 id) goto release_stream;/* enable SPIB for hda stream */ -snd_hdac_ext_stream_spbcap_enable (bus, true, stream->index); -snd_hdac_ext_stream_set_spib (bus, estream, lib->size); +snd_hdac_stream_spbcap_enable (bus, true, stream->index); +snd_hdac_stream_set_spib (bus, stream, lib->size);memcpy (dmab.area, lib->data, lib->size);
@@ -451,8 +451,8 @@ int avs_hda_load_library(struct avs_dev *adev, struct firmware *lib, u32 id) }/* disable SPIB for hda stream */ -snd_hdac_ext_stream_spbcap_enable (bus, false, stream->index); -snd_hdac_ext_stream_set_spib (bus, estream,0 ); +snd_hdac_stream_spbcap_enable (bus, false, stream->index); +snd_hdac_stream_set_spib (bus, stream,0 );snd_hdac_dsp_cleanup (stream, &dmab); release_stream:
sound/soc/intel/skylake/skl-messages.c +2 -4
@@ -53,17 +53,15 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size,struct hdac_bus *bus =dev_get_drvdata (dev);struct hdac_stream *stream =snd_hdac_get_stream (bus,SNDRV_PCM_STREAM_PLAYBACK , stream_tag); -struct hdac_ext_stream *estream;if (!stream)return -EINVAL ; - estream =stream_to_hdac_ext_stream (stream);/* enable/disable SPIB for this hdac stream */ -snd_hdac_ext_stream_spbcap_enable (bus, enable, stream->index); +snd_hdac_stream_spbcap_enable (bus, enable, stream->index);/* set the spib value */ -snd_hdac_ext_stream_set_spib (bus, estream, size); +snd_hdac_stream_set_spib (bus, stream, size);return 0 ; }
sound/soc/intel/skylake/skl-pcm.c +8 -9
@@ -467,6 +467,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,struct skl_module_cfg *mconfig;struct hdac_bus *bus =get_bus_ctx (substream);struct hdac_ext_stream *stream =get_hdac_ext_stream (substream); +struct hdac_stream *hstream =hdac_stream (stream);struct snd_soc_dapm_widget *w;int ret;
@@ -484,11 +485,9 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,* dpib & lpib position to resume before starting the * DMA */ -snd_hdac_ext_stream_drsm_enable (bus, true, -hdac_stream (stream)->index); -snd_hdac_ext_stream_set_dpibr (bus, stream, - stream->lpib); -snd_hdac_ext_stream_set_lpib (stream, stream->lpib); +snd_hdac_stream_drsm_enable (bus, true, hstream->index); +snd_hdac_stream_set_dpibr (bus, hstream, hstream->lpib); +snd_hdac_stream_set_lpib (hstream, hstream->lpib); } fallthrough;
@@ -520,13 +519,13 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd, ret =skl_decoupled_trigger (substream, cmd);if ((cmd ==SNDRV_PCM_TRIGGER_SUSPEND ) && !w->ignore_suspend) {/* save the dpib and lpib positions */ - stream->dpib =readl (bus->remap_addr + + hstream->dpib =readl (bus->remap_addr +AZX_REG_VS_SDXDPIB_XBASE + (AZX_REG_VS_SDXDPIB_XINTERVAL * -hdac_stream (stream)->index)); + hstream->index)); + + hstream->lpib =snd_hdac_stream_get_pos_lpib (hstream); - stream->lpib =snd_hdac_stream_get_pos_lpib ( -hdac_stream (stream));snd_hdac_ext_stream_decouple (bus, stream, false); }break ;
sound/soc/sof/intel/hda-pcm.c +1 -2
@@ -142,7 +142,6 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev,int hda_dsp_pcm_ack (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream) {struct hdac_stream *hstream = substream->runtime->private_data; -struct hdac_ext_stream *hext_stream =stream_to_hdac_ext_stream (hstream);struct snd_pcm_runtime *runtime = substream->runtime;ssize_t appl_pos, buf_size;u32 spib;
@@ -156,7 +155,7 @@ int hda_dsp_pcm_ack(struct snd_sof_dev *sdev, struct snd_pcm_substream *substreaif (!spib) spib = buf_size; -sof_io_write (sdev, hext_stream->spib_addr, spib); +sof_io_write (sdev, hstream->spib_addr, spib);return 0 ; }
sound/soc/sof/intel/hda-stream.c +9 -7
@@ -173,7 +173,7 @@ int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev, enable << hstream->index);/* set the SPIB value */ -sof_io_write (sdev, hext_stream->spib_addr, size); +sof_io_write (sdev, hstream->spib_addr, size);return 0 ; }
@@ -883,18 +883,19 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev)SOF_HDA_PPLC_BASE +SOF_HDA_PPLC_MULTI * num_total +SOF_HDA_PPLC_INTERVAL * i; + hstream = &hext_stream->hstream; +/* do we support SPIB */ if (sdev->bar[HDA_DSP_SPIB_BAR ]) { - hext_stream->spib_addr = sdev->bar[HDA_DSP_SPIB_BAR ] + + hstream->spib_addr = sdev->bar[HDA_DSP_SPIB_BAR ] +SOF_HDA_SPIB_BASE +SOF_HDA_SPIB_INTERVAL * i +SOF_HDA_SPIB_SPIB ; - hext_stream->fifo_addr = sdev->bar[HDA_DSP_SPIB_BAR ] + + hstream->fifo_addr = sdev->bar[HDA_DSP_SPIB_BAR ] +SOF_HDA_SPIB_BASE +SOF_HDA_SPIB_INTERVAL * i +SOF_HDA_SPIB_MAXFIFO ; } - hstream = &hext_stream->hstream; hstream->bus = bus; hstream->sd_int_sta_mask =1 << i; hstream->index = i;
@@ -939,18 +940,19 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev)SOF_HDA_PPLC_BASE +SOF_HDA_PPLC_MULTI * num_total +SOF_HDA_PPLC_INTERVAL * i; + hstream = &hext_stream->hstream; +/* do we support SPIB */ if (sdev->bar[HDA_DSP_SPIB_BAR ]) { - hext_stream->spib_addr = sdev->bar[HDA_DSP_SPIB_BAR ] + + hstream->spib_addr = sdev->bar[HDA_DSP_SPIB_BAR ] +SOF_HDA_SPIB_BASE +SOF_HDA_SPIB_INTERVAL * i +SOF_HDA_SPIB_SPIB ; - hext_stream->fifo_addr = sdev->bar[HDA_DSP_SPIB_BAR ] + + hstream->fifo_addr = sdev->bar[HDA_DSP_SPIB_BAR ] +SOF_HDA_SPIB_BASE +SOF_HDA_SPIB_INTERVAL * i +SOF_HDA_SPIB_MAXFIFO ; } - hstream = &hext_stream->hstream; hstream->bus = bus; hstream->sd_int_sta_mask =1 << i; hstream->index = i;
Signature · 1 line
2.34.1
Re: [PATCH 10/10] ALSA/ASoC: hda: move SPIB/DRMS functionality from ext layer
Quoted 6 lines · Pierre-Louis Bossart
The SPIB and DRMS capabilities are orthogonal to the DSP enablement and can be used whether the stream is coupled or not.
The existing code partitioning makes limited sense, the capabilities are parsed at the
sound/hdalevel but helpers are located insound/hda/ext.
Quoted 13 lines · Pierre-Louis Bossart
The code in
sound/hda/extcan be cleaned-up. This patchset suggests a more consistent use of prefixes and variable names. It also removes useless code, uses helpers when possible, and clarifies an incorrect assumption that SPIB/DRMS capabilities are tied to Intel multi-link and DSP extensions (they are not).This is a rather invasive set of changes touching
sound/hda,sound/soc/intel/skylake,sound/soc/intel/avsandsound/soc/sof/intel, but there should be no change in terms of functionality.I would recommend merging these changes through the ASoC tree.
Quoted 12 lines
Pierre-Louis Bossart (10):
ALSA: hda: ext:hdac_ext_controller: use helpers in loop
ALSA: hda: ext:hda_ext_controller: use hlink variable/parameter
ASoC: SOF: Intel: hda-dai: use hlink variable/parameter ALSA/ASoC: hda: clarifybus_get_link()andbus_link_get()helpers ALSA/ASoC: hda: ext: add 'ext' prefix tosnd_hdac_link_free_allALSA/ASoC: hda: ext: remove 'link' prefix for stream-related
operations
ALSA/ASoC: hda: ext: add 'bus' prefix for multi-link stream setting
ALSA: hda: ext: reduce ambiguity between 'multi-link' and 'link' DMA
ALSA: hda:hdac_ext_controller: remove useless loop ALSA/ASoC: hda: move SPIB/DRMS functionality from ext layer
Applied now to for-next branch.
Mark, if you need those changes in your tree, feel free to pull from topic/hda-ext-cleanup branch of my tree. I can add the tag if needed, too.
thanks,
Takashi
Cezary Rojewski
maintainerOn 2022-10-20 3:38 PM, Takashi Iwai wrote:
...
Quoted 5 lines
Applied now to for-next branch.
Mark, if you need those changes in your tree, feel free to pull from topic/hda-ext-cleanup branch of my tree. I can add the tag if needed, too.
I'd very much appreciate if you merged this series into your tree, Mark. As Pierre mentioned, recent PCM suspend/resume() series for the avs-driver needs to be rebased onto this one to eliminate any conflicts.
Regards,
Czarek
Mark Brown
maintainerQuoted 3 lines · Cezary Rojewski
I'd very much appreciate if you merged this series into your tree, Mark. As Pierre mentioned, recent PCM suspend/resume() series for the avs-driver needs to be rebased onto this one to eliminate any conflicts.
Pulled now.