mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:44:45 +01:00
ASoC: codecs: tas2780: tidyup format check in tas2780_set_fmt()
Current code is using messy code to check format. Let's cleanup it by using switch(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/87h5trrljz.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
3e43a8c033
commit
f764645cb8
1 changed files with 14 additions and 17 deletions
|
|
@ -319,25 +319,22 @@ static int tas2780_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S)
|
||||
|| ((fmt & SND_SOC_DAIFMT_FORMAT_MASK)
|
||||
== SND_SOC_DAIFMT_DSP_A)){
|
||||
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
case SND_SOC_DAIFMT_I2S:
|
||||
case SND_SOC_DAIFMT_DSP_A:
|
||||
iface = TAS2780_TDM_CFG2_SCFG_I2S;
|
||||
tdm_rx_start_slot = 1;
|
||||
} else {
|
||||
if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK)
|
||||
== SND_SOC_DAIFMT_DSP_B)
|
||||
|| ((fmt & SND_SOC_DAIFMT_FORMAT_MASK)
|
||||
== SND_SOC_DAIFMT_LEFT_J)) {
|
||||
iface = TAS2780_TDM_CFG2_SCFG_LEFT_J;
|
||||
tdm_rx_start_slot = 0;
|
||||
} else {
|
||||
dev_err(tas2780->dev,
|
||||
"%s:DAI Format is not found, fmt=0x%x\n",
|
||||
__func__, fmt);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
case SND_SOC_DAIFMT_LEFT_J:
|
||||
case SND_SOC_DAIFMT_DSP_B:
|
||||
iface = TAS2780_TDM_CFG2_SCFG_LEFT_J;
|
||||
tdm_rx_start_slot = 0;
|
||||
break;
|
||||
default:
|
||||
dev_err(tas2780->dev,
|
||||
"%s:DAI Format is not found, fmt=0x%x\n", __func__, fmt);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
ret = snd_soc_component_update_bits(component, TAS2780_TDM_CFG1,
|
||||
TAS2780_TDM_CFG1_MASK,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue