ASoC: SOF: define INFO_ flags in dsp_ops
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 24 Oct 2019 21:03:17 +0000 (16:03 -0500)
committerMark Brown <broonie@kernel.org>
Fri, 25 Oct 2019 10:07:45 +0000 (11:07 +0100)
Currently the INFO_ flags such as PAUSE/NO_PERIOD_WAKEUP are defined
in the SOF PCM core, which doesn't scale. To account for platform
variations, these flags need to be set in DSP ops.

This patch only moves the definitions and does not change any
functionality.

Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191024210318.30068-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/imx/imx8.c
sound/soc/sof/intel/apl.c
sound/soc/sof/intel/bdw.c
sound/soc/sof/intel/byt.c
sound/soc/sof/intel/cnl.c
sound/soc/sof/pcm.c
sound/soc/sof/sof-priv.h

index 2a22b18e5ec07661fc72f83b55e09ff0922c1afe..cfefcfd927986d537fd59476c1a1f479f4d5003c 100644 (file)
@@ -388,6 +388,13 @@ struct snd_sof_dsp_ops sof_imx8_ops = {
        /* DAI drivers */
        .drv = imx8_dai,
        .num_drv = 1, /* we have only 1 ESAI interface on i.MX8 */
+
+       /* ALSA HW info flags */
+       .hw_info =      SNDRV_PCM_INFO_MMAP |
+                       SNDRV_PCM_INFO_MMAP_VALID |
+                       SNDRV_PCM_INFO_INTERLEAVED |
+                       SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_NO_PERIOD_WAKEUP
 };
 EXPORT_SYMBOL(sof_imx8_ops);
 
index 8dc7a5558da4da1d371a3bbaebcedefa720aad05..15d26e8d90a945e7747c2a5255668db53396124e 100644 (file)
@@ -97,6 +97,13 @@ const struct snd_sof_dsp_ops sof_apl_ops = {
        .runtime_resume         = hda_dsp_runtime_resume,
        .runtime_idle           = hda_dsp_runtime_idle,
        .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
+
+       /* ALSA HW info flags */
+       .hw_info =      SNDRV_PCM_INFO_MMAP |
+                       SNDRV_PCM_INFO_MMAP_VALID |
+                       SNDRV_PCM_INFO_INTERLEAVED |
+                       SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 EXPORT_SYMBOL(sof_apl_ops);
 
index bf961a8798a704e3ac00ea86e3f9c2ece07c5686..7b4cd1f456bf1153724ad5e51e5116efbfdcc1e8 100644 (file)
@@ -591,7 +591,14 @@ const struct snd_sof_dsp_ops sof_bdw_ops = {
 
        /* DAI drivers */
        .drv = bdw_dai,
-       .num_drv = ARRAY_SIZE(bdw_dai)
+       .num_drv = ARRAY_SIZE(bdw_dai),
+
+       /* ALSA HW info flags */
+       .hw_info =      SNDRV_PCM_INFO_MMAP |
+                       SNDRV_PCM_INFO_MMAP_VALID |
+                       SNDRV_PCM_INFO_INTERLEAVED |
+                       SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 EXPORT_SYMBOL(sof_bdw_ops);
 
index 07e5efe4945c996d7c8e216b468063d99c9dcec4..62edb959f1fcb7346fae77463ce7dac98f4fe30c 100644 (file)
@@ -532,6 +532,13 @@ const struct snd_sof_dsp_ops sof_tng_ops = {
        /* DAI drivers */
        .drv = byt_dai,
        .num_drv = 3, /* we have only 3 SSPs on byt*/
+
+       /* ALSA HW info flags */
+       .hw_info =      SNDRV_PCM_INFO_MMAP |
+                       SNDRV_PCM_INFO_MMAP_VALID |
+                       SNDRV_PCM_INFO_INTERLEAVED |
+                       SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 EXPORT_SYMBOL(sof_tng_ops);
 
@@ -693,6 +700,13 @@ const struct snd_sof_dsp_ops sof_byt_ops = {
        /* DAI drivers */
        .drv = byt_dai,
        .num_drv = 3, /* we have only 3 SSPs on byt*/
+
+       /* ALSA HW info flags */
+       .hw_info =      SNDRV_PCM_INFO_MMAP |
+                       SNDRV_PCM_INFO_MMAP_VALID |
+                       SNDRV_PCM_INFO_INTERLEAVED |
+                       SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 EXPORT_SYMBOL(sof_byt_ops);
 
@@ -753,6 +767,13 @@ const struct snd_sof_dsp_ops sof_cht_ops = {
        .drv = byt_dai,
        /* all 6 SSPs may be available for cherrytrail */
        .num_drv = ARRAY_SIZE(byt_dai),
+
+       /* ALSA HW info flags */
+       .hw_info =      SNDRV_PCM_INFO_MMAP |
+                       SNDRV_PCM_INFO_MMAP_VALID |
+                       SNDRV_PCM_INFO_INTERLEAVED |
+                       SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 EXPORT_SYMBOL(sof_cht_ops);
 
index 5b97bdfba8231ca7dfbf7ab4a22fa4460c0759bf..e9cdcc040fb5d5560025eb37a7cc5e2dcf76d275 100644 (file)
@@ -255,6 +255,13 @@ const struct snd_sof_dsp_ops sof_cnl_ops = {
        .runtime_resume         = hda_dsp_runtime_resume,
        .runtime_idle           = hda_dsp_runtime_idle,
        .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
+
+       /* ALSA HW info flags */
+       .hw_info =      SNDRV_PCM_INFO_MMAP |
+                       SNDRV_PCM_INFO_MMAP_VALID |
+                       SNDRV_PCM_INFO_INTERLEAVED |
+                       SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 EXPORT_SYMBOL(sof_cnl_ops);
 
index d72798d2b3026f825c8f520a254046f862e37140..9ba505cf596657c43d6f18a04061646965a3ad05 100644 (file)
@@ -440,6 +440,7 @@ static int sof_pcm_open(struct snd_soc_component *component,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
+       const struct snd_sof_dsp_ops *ops = sof_ops(sdev);
        struct snd_sof_pcm *spcm;
        struct snd_soc_tplg_stream_caps *caps;
        int ret;
@@ -469,11 +470,8 @@ static int sof_pcm_open(struct snd_soc_component *component,
                                   le32_to_cpu(caps->period_size_min));
 
        /* set runtime config */
-       runtime->hw.info = SNDRV_PCM_INFO_MMAP |
-                         SNDRV_PCM_INFO_MMAP_VALID |
-                         SNDRV_PCM_INFO_INTERLEAVED |
-                         SNDRV_PCM_INFO_PAUSE |
-                         SNDRV_PCM_INFO_NO_PERIOD_WAKEUP;
+       runtime->hw.info = ops->hw_info; /* platform-specific */
+
        runtime->hw.formats = le64_to_cpu(caps->formats);
        runtime->hw.period_bytes_min = le32_to_cpu(caps->period_size_min);
        runtime->hw.period_bytes_max = le32_to_cpu(caps->period_size_max);
index 5a11a8517fa5f7e946389dff7c86aacaeaf0a574..2d40de5ee28511a72042705150be098e8410ee2c 100644 (file)
@@ -211,6 +211,9 @@ struct snd_sof_dsp_ops {
        /* DAI ops */
        struct snd_soc_dai_driver *drv;
        int num_drv;
+
+       /* ALSA HW info flags, will be stored in snd_pcm_runtime.hw.info */
+       u32 hw_info;
 };
 
 /* DSP architecture specific callbacks for oops and stack dumps */