ASoC: rt5645: Add TDM support for rt5650
rt5650 and rt5645 use different register bits for TDM configuration. This patch modifies rt5645_set_tdm_slot to support both codecs. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
c517d838eb
Коммит
42ce5b8ab8
|
@ -2285,23 +2285,42 @@ static int rt5645_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||||
unsigned int rx_mask, int slots, int slot_width)
|
unsigned int rx_mask, int slots, int slot_width)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = dai->codec;
|
struct snd_soc_codec *codec = dai->codec;
|
||||||
unsigned int val = 0;
|
struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec);
|
||||||
|
unsigned int i_slot_sft, o_slot_sft, i_width_sht, o_width_sht, en_sft;
|
||||||
|
unsigned int mask, val = 0;
|
||||||
|
|
||||||
|
switch (rt5645->codec_type) {
|
||||||
|
case CODEC_TYPE_RT5650:
|
||||||
|
en_sft = 15;
|
||||||
|
i_slot_sft = 10;
|
||||||
|
o_slot_sft = 8;
|
||||||
|
i_width_sht = 6;
|
||||||
|
o_width_sht = 4;
|
||||||
|
mask = 0x8ff0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
en_sft = 14;
|
||||||
|
i_slot_sft = o_slot_sft = 12;
|
||||||
|
i_width_sht = o_width_sht = 10;
|
||||||
|
mask = 0x7c00;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (rx_mask || tx_mask) {
|
if (rx_mask || tx_mask) {
|
||||||
val |= (1 << 14);
|
val |= (1 << en_sft);
|
||||||
snd_soc_update_bits(codec, RT5645_BASS_BACK,
|
if (rt5645->codec_type == CODEC_TYPE_RT5645)
|
||||||
RT5645_G_BB_BST_MASK, RT5645_G_BB_BST_25DB);
|
snd_soc_update_bits(codec, RT5645_BASS_BACK,
|
||||||
|
RT5645_G_BB_BST_MASK, RT5645_G_BB_BST_25DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (slots) {
|
switch (slots) {
|
||||||
case 4:
|
case 4:
|
||||||
val |= (1 << 12);
|
val |= (1 << i_slot_sft) | (1 << o_slot_sft);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
val |= (2 << 12);
|
val |= (2 << i_slot_sft) | (2 << o_slot_sft);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
val |= (3 << 12);
|
val |= (3 << i_slot_sft) | (3 << o_slot_sft);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
default:
|
default:
|
||||||
|
@ -2310,20 +2329,20 @@ static int rt5645_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||||
|
|
||||||
switch (slot_width) {
|
switch (slot_width) {
|
||||||
case 20:
|
case 20:
|
||||||
val |= (1 << 10);
|
val |= (1 << i_width_sht) | (1 << o_width_sht);
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
val |= (2 << 10);
|
val |= (2 << i_width_sht) | (2 << o_width_sht);
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
val |= (3 << 10);
|
val |= (3 << i_width_sht) | (3 << o_width_sht);
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_soc_update_bits(codec, RT5645_TDM_CTRL_1, 0x7c00, val);
|
snd_soc_update_bits(codec, RT5645_TDM_CTRL_1, mask, val);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче