mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
ASoC: es8328: Add support for slave mode
Currently, the function that changes the DAI format only supports master mode. Trying to use a slave mode exits the function with -EINVAL and leave the codec misconfigured. This commits adds support for enabling the slave mode. Signed-off-by: Romain Perier <romain.perier@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
5f166156db
commit
b9b044e296
@@ -589,9 +589,21 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
|||||||
u8 dac_mode = 0;
|
u8 dac_mode = 0;
|
||||||
u8 adc_mode = 0;
|
u8 adc_mode = 0;
|
||||||
|
|
||||||
/* set master/slave audio interface */
|
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||||
if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBM_CFM)
|
case SND_SOC_DAIFMT_CBM_CFM:
|
||||||
|
/* Master serial port mode, with BCLK generated automatically */
|
||||||
|
snd_soc_update_bits(codec, ES8328_MASTERMODE,
|
||||||
|
ES8328_MASTERMODE_MSC,
|
||||||
|
ES8328_MASTERMODE_MSC);
|
||||||
|
break;
|
||||||
|
case SND_SOC_DAIFMT_CBS_CFS:
|
||||||
|
/* Slave serial port mode */
|
||||||
|
snd_soc_update_bits(codec, ES8328_MASTERMODE,
|
||||||
|
ES8328_MASTERMODE_MSC, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* interface format */
|
/* interface format */
|
||||||
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||||
@@ -620,10 +632,6 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
|||||||
snd_soc_update_bits(codec, ES8328_ADCCONTROL4,
|
snd_soc_update_bits(codec, ES8328_ADCCONTROL4,
|
||||||
ES8328_ADCCONTROL4_ADCFORMAT_MASK, adc_mode);
|
ES8328_ADCCONTROL4_ADCFORMAT_MASK, adc_mode);
|
||||||
|
|
||||||
/* Master serial port mode, with BCLK generated automatically */
|
|
||||||
snd_soc_update_bits(codec, ES8328_MASTERMODE,
|
|
||||||
ES8328_MASTERMODE_MSC, ES8328_MASTERMODE_MSC);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user