ASoC: dwc: Added a quirk DW_I2S_QUIRK_16BIT_IDX_OVERRIDE to dwc driver
authorVijendar Mukunda <Vijendar.Mukunda@amd.com>
Fri, 23 Jun 2017 16:35:00 +0000 (12:35 -0400)
committerMark Brown <broonie@kernel.org>
Wed, 28 Jun 2017 18:01:12 +0000 (19:01 +0100)
Added quirk DW_I2S_QUIRK_16BIT_IDX_OVERRIDE to Designware
driver. This quirk will set idx value to 1.

By setting this quirk, it will override supported format
as 16 bit resolution and bus width as 2 Bytes.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/designware_i2s.h
sound/soc/dwc/dwc-i2s.c

index 5681855396c411210b51fffe1b368d6ccf5a1027..830f5caa915cc6a94085b838aec5a92eecbb9b71 100644 (file)
@@ -47,6 +47,7 @@ struct i2s_platform_data {
 
        #define DW_I2S_QUIRK_COMP_REG_OFFSET    (1 << 0)
        #define DW_I2S_QUIRK_COMP_PARAM1        (1 << 1)
+       #define DW_I2S_QUIRK_16BIT_IDX_OVERRIDE (1 << 2)
        unsigned int quirks;
        unsigned int i2s_reg_comp1;
        unsigned int i2s_reg_comp2;
index 9c46e411202649a31c5a597cebd4af83e2826ce7..91606763818089ffe2c4d058eb214f1e5714765a 100644 (file)
@@ -496,6 +496,8 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
                idx = COMP1_TX_WORDSIZE_0(comp1);
                if (WARN_ON(idx >= ARRAY_SIZE(formats)))
                        return -EINVAL;
+               if (dev->quirks & DW_I2S_QUIRK_16BIT_IDX_OVERRIDE)
+                       idx = 1;
                dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM;
                dw_i2s_dai->playback.channels_max =
                                1 << (COMP1_TX_CHANNELS(comp1) + 1);
@@ -508,6 +510,8 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
                idx = COMP2_RX_WORDSIZE_0(comp2);
                if (WARN_ON(idx >= ARRAY_SIZE(formats)))
                        return -EINVAL;
+               if (dev->quirks & DW_I2S_QUIRK_16BIT_IDX_OVERRIDE)
+                       idx = 1;
                dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM;
                dw_i2s_dai->capture.channels_max =
                                1 << (COMP1_RX_CHANNELS(comp1) + 1);
@@ -543,6 +547,8 @@ static int dw_configure_dai_by_pd(struct dw_i2s_dev *dev,
        if (ret < 0)
                return ret;
 
+       if (dev->quirks & DW_I2S_QUIRK_16BIT_IDX_OVERRIDE)
+               idx = 1;
        /* Set DMA slaves info */
        dev->play_dma_data.pd.data = pdata->play_dma_data;
        dev->capture_dma_data.pd.data = pdata->capture_dma_data;