OSDN Git Service

ASoC: Intel: avs: Count low power streams
authorCezary Rojewski <cezary.rojewski@intel.com>
Thu, 27 Oct 2022 12:46:59 +0000 (14:46 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 28 Oct 2022 12:04:36 +0000 (13:04 +0100)
Streaming in S0iX differs from SX scenarios. Store the number of
so-called low-power streams to be able to differentiate between the two.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221027124702.1761002-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/avs.h
sound/soc/intel/avs/pcm.c

index 91f78eb..fb73d20 100644 (file)
@@ -127,6 +127,7 @@ struct avs_dev {
        struct list_head fw_list;
        int *core_refs;         /* reference count per core */
        char **lib_names;
+       int num_lp_paths;
 
        struct completion fw_ready;
        struct work_struct probe_work;
index 6601295..157d25e 100644 (file)
@@ -60,6 +60,8 @@ avs_dai_find_path_template(struct snd_soc_dai *dai, bool is_fe, int direction)
 static int avs_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai, bool is_fe,
                           const struct snd_soc_dai_ops *ops)
 {
+       struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
+       struct avs_dev *adev = to_avs_dev(dai->dev);
        struct avs_tplg_path_template *template;
        struct avs_dma_data *data;
 
@@ -78,6 +80,9 @@ static int avs_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_d
        data->template = template;
        snd_soc_dai_set_dma_data(dai, substream, data);
 
+       if (rtd->dai_link->ignore_suspend)
+               adev->num_lp_paths++;
+
        return 0;
 }
 
@@ -164,8 +169,13 @@ static int avs_dai_nonhda_be_startup(struct snd_pcm_substream *substream, struct
 
 static void avs_dai_nonhda_be_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
 {
+       struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
+       struct avs_dev *adev = to_avs_dev(dai->dev);
        struct avs_dma_data *data;
 
+       if (rtd->dai_link->ignore_suspend)
+               adev->num_lp_paths--;
+
        data = snd_soc_dai_get_dma_data(dai, substream);
 
        snd_soc_dai_set_dma_data(dai, substream, NULL);
@@ -479,8 +489,13 @@ static int avs_dai_fe_startup(struct snd_pcm_substream *substream, struct snd_so
 
 static void avs_dai_fe_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
 {
+       struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
+       struct avs_dev *adev = to_avs_dev(dai->dev);
        struct avs_dma_data *data;
 
+       if (rtd->dai_link->ignore_suspend)
+               adev->num_lp_paths--;
+
        data = snd_soc_dai_get_dma_data(dai, substream);
 
        snd_soc_dai_set_dma_data(dai, substream, NULL);