ASoC: Intel Skylake: Switch to new stream-format interface
authorCezary Rojewski <cezary.rojewski@intel.com>
Fri, 17 Nov 2023 12:06:05 +0000 (13:06 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 27 Nov 2023 16:28:29 +0000 (17:28 +0100)
To provide option for selecting different bit-per-sample than just the
maximum one, use the new format calculation mechanism.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-12-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/soc/intel/skylake/skl-pcm.c

index d0c02e8a67854c3d6c38102c9bde12238a422ba2..4d52e3b35850c613582f7c612968c50b280e4996 100644 (file)
@@ -127,6 +127,7 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
        unsigned int format_val;
        struct hdac_stream *hstream;
        struct hdac_ext_stream *stream;
+       unsigned int bits;
        int err;
 
        hstream = snd_hdac_get_stream(bus, params->stream,
@@ -137,8 +138,9 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
        stream = stream_to_hdac_ext_stream(hstream);
        snd_hdac_ext_stream_decouple(bus, stream, true);
 
-       format_val = snd_hdac_calc_stream_format(params->s_freq,
-                       params->ch, params->format, params->host_bps, 0);
+       bits = snd_hdac_stream_format_bits(params->format, SNDRV_PCM_SUBFORMAT_STD,
+                                          params->host_bps);
+       format_val = snd_hdac_stream_format(params->ch, bits, params->s_freq);
 
        dev_dbg(dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
                format_val, params->s_freq, params->ch, params->format);
@@ -165,6 +167,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
        struct hdac_ext_stream *stream;
        struct hdac_ext_link *link;
        unsigned char stream_tag;
+       unsigned int bits;
 
        hstream = snd_hdac_get_stream(bus, params->stream,
                                        params->link_dma_id + 1);
@@ -173,8 +176,10 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
 
        stream = stream_to_hdac_ext_stream(hstream);
        snd_hdac_ext_stream_decouple(bus, stream, true);
-       format_val = snd_hdac_calc_stream_format(params->s_freq, params->ch,
-                                       params->format, params->link_bps, 0);
+
+       bits = snd_hdac_stream_format_bits(params->format, SNDRV_PCM_SUBFORMAT_STD,
+                                          params->link_bps);
+       format_val = snd_hdac_stream_format(params->ch, bits, params->s_freq);
 
        dev_dbg(dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
                format_val, params->s_freq, params->ch, params->format);