diff options
author | Oder Chiou <oder_chiou@realtek.com> | 2017-05-01 22:42:56 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-05-14 06:14:33 -0400 |
commit | d60bc8d6c6d7e5f9765852b0be57de639ba65808 (patch) | |
tree | 2262cb5714f2ba14c5d80e6f21b6ffaf1cfd2377 | |
parent | 2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff) |
ASoC: rt5514: Add more width and channels support in the TDM mode
This patch adds more width and channels support in the TDM mode.
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/rt5514.c | 23 | ||||
-rw-r--r-- | sound/soc/codecs/rt5514.h | 6 |
2 files changed, 27 insertions, 2 deletions
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c index f91221b1ddf0..ff97360c03db 100644 --- a/sound/soc/codecs/rt5514.c +++ b/sound/soc/codecs/rt5514.c | |||
@@ -906,9 +906,23 @@ static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
906 | if (rx_mask || tx_mask) | 906 | if (rx_mask || tx_mask) |
907 | val |= RT5514_TDM_MODE; | 907 | val |= RT5514_TDM_MODE; |
908 | 908 | ||
909 | if (slots == 4) | 909 | switch (slots) { |
910 | case 4: | ||
910 | val |= RT5514_TDMSLOT_SEL_RX_4CH | RT5514_TDMSLOT_SEL_TX_4CH; | 911 | val |= RT5514_TDMSLOT_SEL_RX_4CH | RT5514_TDMSLOT_SEL_TX_4CH; |
912 | break; | ||
913 | |||
914 | case 6: | ||
915 | val |= RT5514_TDMSLOT_SEL_RX_6CH | RT5514_TDMSLOT_SEL_TX_6CH; | ||
916 | break; | ||
917 | |||
918 | case 8: | ||
919 | val |= RT5514_TDMSLOT_SEL_RX_8CH | RT5514_TDMSLOT_SEL_TX_8CH; | ||
920 | break; | ||
911 | 921 | ||
922 | case 2: | ||
923 | default: | ||
924 | break; | ||
925 | } | ||
912 | 926 | ||
913 | switch (slot_width) { | 927 | switch (slot_width) { |
914 | case 20: | 928 | case 20: |
@@ -919,6 +933,10 @@ static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
919 | val |= RT5514_CH_LEN_RX_24 | RT5514_CH_LEN_TX_24; | 933 | val |= RT5514_CH_LEN_RX_24 | RT5514_CH_LEN_TX_24; |
920 | break; | 934 | break; |
921 | 935 | ||
936 | case 25: | ||
937 | val |= RT5514_TDM_MODE2; | ||
938 | break; | ||
939 | |||
922 | case 32: | 940 | case 32: |
923 | val |= RT5514_CH_LEN_RX_32 | RT5514_CH_LEN_TX_32; | 941 | val |= RT5514_CH_LEN_RX_32 | RT5514_CH_LEN_TX_32; |
924 | break; | 942 | break; |
@@ -930,7 +948,8 @@ static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
930 | 948 | ||
931 | regmap_update_bits(rt5514->regmap, RT5514_I2S_CTRL1, RT5514_TDM_MODE | | 949 | regmap_update_bits(rt5514->regmap, RT5514_I2S_CTRL1, RT5514_TDM_MODE | |
932 | RT5514_TDMSLOT_SEL_RX_MASK | RT5514_TDMSLOT_SEL_TX_MASK | | 950 | RT5514_TDMSLOT_SEL_RX_MASK | RT5514_TDMSLOT_SEL_TX_MASK | |
933 | RT5514_CH_LEN_RX_MASK | RT5514_CH_LEN_TX_MASK, val); | 951 | RT5514_CH_LEN_RX_MASK | RT5514_CH_LEN_TX_MASK | |
952 | RT5514_TDM_MODE2, val); | ||
934 | 953 | ||
935 | return 0; | 954 | return 0; |
936 | } | 955 | } |
diff --git a/sound/soc/codecs/rt5514.h b/sound/soc/codecs/rt5514.h index 5d343fb6d125..02bc212a86d9 100644 --- a/sound/soc/codecs/rt5514.h +++ b/sound/soc/codecs/rt5514.h | |||
@@ -117,6 +117,8 @@ | |||
117 | #define RT5514_POW_ADCFEDL_BIT 0 | 117 | #define RT5514_POW_ADCFEDL_BIT 0 |
118 | 118 | ||
119 | /* RT5514_I2S_CTRL1 (0x2010) */ | 119 | /* RT5514_I2S_CTRL1 (0x2010) */ |
120 | #define RT5514_TDM_MODE2 (0x1 << 30) | ||
121 | #define RT5514_TDM_MODE2_SFT 30 | ||
120 | #define RT5514_TDM_MODE (0x1 << 28) | 122 | #define RT5514_TDM_MODE (0x1 << 28) |
121 | #define RT5514_TDM_MODE_SFT 28 | 123 | #define RT5514_TDM_MODE_SFT 28 |
122 | #define RT5514_I2S_LR_MASK (0x1 << 26) | 124 | #define RT5514_I2S_LR_MASK (0x1 << 26) |
@@ -136,6 +138,8 @@ | |||
136 | #define RT5514_TDMSLOT_SEL_RX_MASK (0x3 << 10) | 138 | #define RT5514_TDMSLOT_SEL_RX_MASK (0x3 << 10) |
137 | #define RT5514_TDMSLOT_SEL_RX_SFT 10 | 139 | #define RT5514_TDMSLOT_SEL_RX_SFT 10 |
138 | #define RT5514_TDMSLOT_SEL_RX_4CH (0x1 << 10) | 140 | #define RT5514_TDMSLOT_SEL_RX_4CH (0x1 << 10) |
141 | #define RT5514_TDMSLOT_SEL_RX_6CH (0x2 << 10) | ||
142 | #define RT5514_TDMSLOT_SEL_RX_8CH (0x3 << 10) | ||
139 | #define RT5514_CH_LEN_RX_MASK (0x3 << 8) | 143 | #define RT5514_CH_LEN_RX_MASK (0x3 << 8) |
140 | #define RT5514_CH_LEN_RX_SFT 8 | 144 | #define RT5514_CH_LEN_RX_SFT 8 |
141 | #define RT5514_CH_LEN_RX_16 (0x0 << 8) | 145 | #define RT5514_CH_LEN_RX_16 (0x0 << 8) |
@@ -145,6 +149,8 @@ | |||
145 | #define RT5514_TDMSLOT_SEL_TX_MASK (0x3 << 6) | 149 | #define RT5514_TDMSLOT_SEL_TX_MASK (0x3 << 6) |
146 | #define RT5514_TDMSLOT_SEL_TX_SFT 6 | 150 | #define RT5514_TDMSLOT_SEL_TX_SFT 6 |
147 | #define RT5514_TDMSLOT_SEL_TX_4CH (0x1 << 6) | 151 | #define RT5514_TDMSLOT_SEL_TX_4CH (0x1 << 6) |
152 | #define RT5514_TDMSLOT_SEL_TX_6CH (0x2 << 6) | ||
153 | #define RT5514_TDMSLOT_SEL_TX_8CH (0x3 << 6) | ||
148 | #define RT5514_CH_LEN_TX_MASK (0x3 << 4) | 154 | #define RT5514_CH_LEN_TX_MASK (0x3 << 4) |
149 | #define RT5514_CH_LEN_TX_SFT 4 | 155 | #define RT5514_CH_LEN_TX_SFT 4 |
150 | #define RT5514_CH_LEN_TX_16 (0x0 << 4) | 156 | #define RT5514_CH_LEN_TX_16 (0x0 << 4) |