ASoC: soc-core: add snd_soc_daifmt_clock_provider_from_bitmap()
This patch adds snd_soc_daifmt_clock_provider_from_bitmap() function to judge clock/frame master from its bitmap. This is prepare for snd_soc_of_parse_daifmt() cleanup. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87a6ntw9f5.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
45ce213392
commit
91ae447762
|
@ -1232,6 +1232,7 @@ void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
|
||||||
int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
||||||
const char *propname);
|
const char *propname);
|
||||||
int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname);
|
int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname);
|
||||||
|
unsigned int snd_soc_daifmt_clock_provider_from_bitmap(unsigned int bit_frame);
|
||||||
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
|
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
|
||||||
const char *prefix,
|
const char *prefix,
|
||||||
struct device_node **bitclkmaster,
|
struct device_node **bitclkmaster,
|
||||||
|
|
|
@ -3017,6 +3017,24 @@ int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(snd_soc_of_parse_aux_devs);
|
EXPORT_SYMBOL_GPL(snd_soc_of_parse_aux_devs);
|
||||||
|
|
||||||
|
unsigned int snd_soc_daifmt_clock_provider_from_bitmap(unsigned int bit_frame)
|
||||||
|
{
|
||||||
|
/* Codec base */
|
||||||
|
switch (bit_frame) {
|
||||||
|
case 0x11:
|
||||||
|
return SND_SOC_DAIFMT_CBP_CFP;
|
||||||
|
case 0x10:
|
||||||
|
return SND_SOC_DAIFMT_CBP_CFC;
|
||||||
|
case 0x01:
|
||||||
|
return SND_SOC_DAIFMT_CBC_CFP;
|
||||||
|
default:
|
||||||
|
return SND_SOC_DAIFMT_CBC_CFC;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_from_bitmap);
|
||||||
|
|
||||||
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
|
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
|
||||||
const char *prefix,
|
const char *prefix,
|
||||||
struct device_node **bitclkmaster,
|
struct device_node **bitclkmaster,
|
||||||
|
@ -3115,20 +3133,7 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
|
||||||
if (frame && framemaster)
|
if (frame && framemaster)
|
||||||
*framemaster = of_parse_phandle(np, prop, 0);
|
*framemaster = of_parse_phandle(np, prop, 0);
|
||||||
|
|
||||||
switch ((bit << 4) + frame) {
|
format |= snd_soc_daifmt_clock_provider_from_bitmap((bit << 4) + frame);
|
||||||
case 0x11:
|
|
||||||
format |= SND_SOC_DAIFMT_CBM_CFM;
|
|
||||||
break;
|
|
||||||
case 0x10:
|
|
||||||
format |= SND_SOC_DAIFMT_CBM_CFS;
|
|
||||||
break;
|
|
||||||
case 0x01:
|
|
||||||
format |= SND_SOC_DAIFMT_CBS_CFM;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
format |= SND_SOC_DAIFMT_CBS_CFS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue