]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ASoC: rt1308-sdw: use slot and rx_mask to configure stream
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Wed, 25 Mar 2020 21:29:05 +0000 (16:29 -0500)
committerMark Brown <broonie@kernel.org>
Thu, 26 Mar 2020 18:48:09 +0000 (18:48 +0000)
If the DAI was configured with a set_tdm_slots() call, use the information.

A platform or machine driver may configure each amplifier to extract
different bitSlots from the frame, or extract the same data and use
processing to generate the relevant output. The latter case is easier
to handle in case of orientation changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200325212905.28145-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt1308-sdw.c

index 8763192434c480a8045375218976d3d8bf0b3dd3..a5a7e46de246a4cb4433bb2ff950fae75722bd18 100644 (file)
@@ -539,7 +539,7 @@ static int rt1308_sdw_hw_params(struct snd_pcm_substream *substream,
        struct sdw_port_config port_config;
        enum sdw_data_direction direction;
        struct sdw_stream_data *stream;
-       int retval, port, num_channels;
+       int retval, port, num_channels, ch_mask;
 
        dev_dbg(dai->dev, "%s %s", __func__, dai->name);
        stream = snd_soc_dai_get_dma_data(dai, substream);
@@ -559,13 +559,20 @@ static int rt1308_sdw_hw_params(struct snd_pcm_substream *substream,
                return -EINVAL;
        }
 
+       if (rt1308->slots) {
+               num_channels = rt1308->slots;
+               ch_mask = rt1308->rx_mask;
+       } else {
+               num_channels = params_channels(params);
+               ch_mask = (1 << num_channels) - 1;
+       }
+
        stream_config.frame_rate = params_rate(params);
-       stream_config.ch_count = params_channels(params);
+       stream_config.ch_count = num_channels;
        stream_config.bps = snd_pcm_format_width(params_format(params));
        stream_config.direction = direction;
 
-       num_channels = params_channels(params);
-       port_config.ch_mask = (1 << (num_channels)) - 1;
+       port_config.ch_mask = ch_mask;
        port_config.num = port;
 
        retval = sdw_stream_add_slave(rt1308->sdw_slave, &stream_config,