summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHonghao Liu <honghaol@codeaurora.org>2017-03-17 10:45:15 -0400
committerGerrit - the friendly Code Review server <code-review@localhost>2017-03-23 11:13:12 -0700
commit55df1580aa9ca4041e135abdeea578ba7aa376b0 (patch)
treee64ed3cc4b6e5c0469737843d03f830e008ffe32
parentf7d9f43f02d3d2838a55414d15367dc91c1ce00a (diff)
ASoC: msm: support 5 and 7 channel for TDM hw param
Add support for 5 and 7 channel for TDM hw param configuration. CRs-fixed: 2021342 Change-Id: I933d5aa29c5c5578c884a3533772747db721fc0f Signed-off-by: Honghao Liu <honghaol@codeaurora.org>
-rw-r--r--sound/soc/msm/apq8096-auto.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/sound/soc/msm/apq8096-auto.c b/sound/soc/msm/apq8096-auto.c
index 94367b5f680b..7b363bdca291 100644
--- a/sound/soc/msm/apq8096-auto.c
+++ b/sound/soc/msm/apq8096-auto.c
@@ -2315,44 +2315,38 @@ static int apq8096_tdm_snd_hw_params(struct snd_pcm_substream *substream,
pr_debug("%s: dai id = 0x%x\n", __func__, cpu_dai->id);
channels = params_channels(params);
- switch (channels) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 6:
- case 8:
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S32_LE:
- case SNDRV_PCM_FORMAT_S24_LE:
- case SNDRV_PCM_FORMAT_S16_LE:
- /*
- * up to 8 channel HW configuration should
- * use 32 bit slot width for max support of
- * stream bit width. (slot_width > bit_width)
- */
- slot_width = msm_tdm_slot_width;
- break;
- default:
- pr_err("%s: invalid param format 0x%x\n",
- __func__, params_format(params));
- return -EINVAL;
- }
- slots = msm_tdm_num_slots;
- slot_mask = tdm_param_set_slot_mask(cpu_dai->id,
- slot_width, slots);
- if (!slot_mask) {
- pr_err("%s: invalid slot_mask 0x%x\n",
- __func__, slot_mask);
- return -EINVAL;
- }
- break;
- default:
+ if (channels < 1 || channels > 8) {
pr_err("%s: invalid param channels %d\n",
__func__, channels);
return -EINVAL;
}
+ switch (params_format(params)) {
+ case SNDRV_PCM_FORMAT_S32_LE:
+ case SNDRV_PCM_FORMAT_S24_LE:
+ case SNDRV_PCM_FORMAT_S16_LE:
+ /*
+ * up to 8 channel HW configuration should
+ * use 32 bit slot width for max support of
+ * stream bit width. (slot_width > bit_width)
+ */
+ slot_width = msm_tdm_slot_width;
+ break;
+ default:
+ pr_err("%s: invalid param format 0x%x\n",
+ __func__, params_format(params));
+ return -EINVAL;
+ }
+
+ slots = msm_tdm_num_slots;
+ slot_mask = tdm_param_set_slot_mask(cpu_dai->id,
+ slot_width, slots);
+ if (!slot_mask) {
+ pr_err("%s: invalid slot_mask 0x%x\n",
+ __func__, slot_mask);
+ return -EINVAL;
+ }
+
switch (cpu_dai->id) {
case AFE_PORT_ID_SECONDARY_TDM_RX:
slot_offset = tdm_slot_offset[SECONDARY_TDM_RX_0];