ASoC: Intel: Skylake: Fix to remove channel_map calculation
authorJeeja KP <jeeja.kp@intel.com>
Tue, 27 Oct 2015 00:22:59 +0000 (09:22 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 16 Nov 2015 10:08:09 +0000 (10:08 +0000)
Widget FW topology private data already has the information
on the channel map, ch_cfg and interleaving. This patch removes
the calculation of channel_map in driver and reads the value
directly from widget private data.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/skylake/skl-messages.c

index 07d3bf4a8bdd98e8d59130cd3c3587c3a36ab93f..bfde60bb8119ab68f04b1dd88c17c08419310776 100644 (file)
@@ -182,94 +182,6 @@ enum skl_bitdepth skl_get_bit_depth(int params)
        }
 }
 
-static u32 skl_create_channel_map(enum skl_ch_cfg ch_cfg)
-{
-       u32 config;
-
-       switch (ch_cfg) {
-       case SKL_CH_CFG_MONO:
-               config =  (0xFFFFFFF0 | SKL_CHANNEL_LEFT);
-               break;
-
-       case SKL_CH_CFG_STEREO:
-               config = (0xFFFFFF00 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_RIGHT << 4));
-               break;
-
-       case SKL_CH_CFG_2_1:
-               config = (0xFFFFF000 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_RIGHT << 4)
-                       | (SKL_CHANNEL_LFE << 8));
-               break;
-
-       case SKL_CH_CFG_3_0:
-               config =  (0xFFFFF000 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_CENTER << 4)
-                       | (SKL_CHANNEL_RIGHT << 8));
-               break;
-
-       case SKL_CH_CFG_3_1:
-               config = (0xFFFF0000 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_CENTER << 4)
-                       | (SKL_CHANNEL_RIGHT << 8)
-                       | (SKL_CHANNEL_LFE << 12));
-               break;
-
-       case SKL_CH_CFG_QUATRO:
-               config = (0xFFFF0000 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_RIGHT << 4)
-                       | (SKL_CHANNEL_LEFT_SURROUND << 8)
-                       | (SKL_CHANNEL_RIGHT_SURROUND << 12));
-               break;
-
-       case SKL_CH_CFG_4_0:
-               config = (0xFFFF0000 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_CENTER << 4)
-                       | (SKL_CHANNEL_RIGHT << 8)
-                       | (SKL_CHANNEL_CENTER_SURROUND << 12));
-               break;
-
-       case SKL_CH_CFG_5_0:
-               config = (0xFFF00000 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_CENTER << 4)
-                       | (SKL_CHANNEL_RIGHT << 8)
-                       | (SKL_CHANNEL_LEFT_SURROUND << 12)
-                       | (SKL_CHANNEL_RIGHT_SURROUND << 16));
-               break;
-
-       case SKL_CH_CFG_5_1:
-               config = (0xFF000000 | SKL_CHANNEL_CENTER
-                       | (SKL_CHANNEL_LEFT << 4)
-                       | (SKL_CHANNEL_RIGHT << 8)
-                       | (SKL_CHANNEL_LEFT_SURROUND << 12)
-                       | (SKL_CHANNEL_RIGHT_SURROUND << 16)
-                       | (SKL_CHANNEL_LFE << 20));
-               break;
-
-       case SKL_CH_CFG_DUAL_MONO:
-               config = (0xFFFFFF00 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_LEFT << 4));
-               break;
-
-       case SKL_CH_CFG_I2S_DUAL_STEREO_0:
-               config = (0xFFFFFF00 | SKL_CHANNEL_LEFT
-                       | (SKL_CHANNEL_RIGHT << 4));
-               break;
-
-       case SKL_CH_CFG_I2S_DUAL_STEREO_1:
-               config = (0xFFFF00FF | (SKL_CHANNEL_LEFT << 8)
-                       | (SKL_CHANNEL_RIGHT << 12));
-               break;
-
-       default:
-               config =  0xFFFFFFFF;
-               break;
-
-       }
-
-       return config;
-}
-
 /*
  * Each module in DSP expects a base module configuration, which consists of
  * PCM format information, which we calculate in driver and resource values
@@ -293,10 +205,9 @@ static void skl_set_base_module_format(struct skl_sst *ctx,
                        format->bit_depth, format->valid_bit_depth,
                        format->ch_cfg);
 
-       base_cfg->audio_fmt.channel_map = skl_create_channel_map(
-                                       base_cfg->audio_fmt.ch_cfg);
+       base_cfg->audio_fmt.channel_map = format->ch_map;
 
-       base_cfg->audio_fmt.interleaving = SKL_INTERLEAVING_PER_CHANNEL;
+       base_cfg->audio_fmt.interleaving = format->interleaving_style;
 
        base_cfg->cps = mconfig->mcps;
        base_cfg->ibs = mconfig->ibs;
@@ -407,8 +318,9 @@ static void skl_setup_out_format(struct skl_sst *ctx,
        out_fmt->valid_bit_depth = format->valid_bit_depth;
        out_fmt->ch_cfg = format->ch_cfg;
 
-       out_fmt->channel_map = skl_create_channel_map(out_fmt->ch_cfg);
-       out_fmt->interleaving = SKL_INTERLEAVING_PER_CHANNEL;
+       out_fmt->channel_map = format->ch_map;
+       out_fmt->interleaving = format->interleaving_style;
+       out_fmt->sample_type = format->sample_type;
 
        dev_dbg(ctx->dev, "copier out format chan=%d fre=%d bitdepth=%d\n",
                out_fmt->number_of_channels, format->s_freq, format->bit_depth);