mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-09 07:23:14 +00:00
ASoC: ti: j721e-evm: Convert the audio domain IDs to enum
Convert the J721E_AUDIO_DOMAIN_* from defines to enum to make it possible to extend the number of domains in the future. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com> Link: https://lore.kernel.org/r/20210717122820.1467-4-peter.ujfalusi@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
d9dbe1f9ae
commit
cfc9d37ab7
@ -23,8 +23,11 @@
|
||||
*/
|
||||
#define J721E_CODEC_CONF_COUNT 5
|
||||
|
||||
#define J721E_AUDIO_DOMAIN_CPB 0
|
||||
#define J721E_AUDIO_DOMAIN_IVI 1
|
||||
enum j721e_audio_domain_id {
|
||||
J721E_AUDIO_DOMAIN_CPB = 0,
|
||||
J721E_AUDIO_DOMAIN_IVI,
|
||||
J721E_AUDIO_DOMAIN_LAST,
|
||||
};
|
||||
|
||||
#define J721E_CLK_PARENT_48000 0
|
||||
#define J721E_CLK_PARENT_44100 1
|
||||
@ -78,7 +81,7 @@ struct j721e_priv {
|
||||
u32 pll_rates[2];
|
||||
unsigned int hsdiv_rates[2];
|
||||
|
||||
struct j721e_audio_domain audio_domains[2];
|
||||
struct j721e_audio_domain audio_domains[J721E_AUDIO_DOMAIN_LAST];
|
||||
|
||||
struct mutex mutex;
|
||||
};
|
||||
@ -199,9 +202,8 @@ static int j721e_configure_refclk(struct j721e_priv *priv,
|
||||
|
||||
if (priv->hsdiv_rates[domain->parent_clk_id] != scki) {
|
||||
dev_dbg(priv->dev,
|
||||
"%s configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n",
|
||||
audio_domain == J721E_AUDIO_DOMAIN_CPB ? "CPB" : "IVI",
|
||||
rate,
|
||||
"domain%u configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n",
|
||||
audio_domain, rate,
|
||||
clk_id == J721E_CLK_PARENT_48000 ? "PLL4" : "PLL15",
|
||||
ratios_for_pcm3168a[i], scki);
|
||||
|
||||
@ -263,10 +265,11 @@ static int j721e_audio_startup(struct snd_pcm_substream *substream)
|
||||
|
||||
domain->active++;
|
||||
|
||||
if (priv->audio_domains[J721E_AUDIO_DOMAIN_CPB].rate)
|
||||
active_rate = priv->audio_domains[J721E_AUDIO_DOMAIN_CPB].rate;
|
||||
else
|
||||
active_rate = priv->audio_domains[J721E_AUDIO_DOMAIN_IVI].rate;
|
||||
for (i = 0; i < J721E_AUDIO_DOMAIN_LAST; i++) {
|
||||
active_rate = priv->audio_domains[i].rate;
|
||||
if (active_rate)
|
||||
break;
|
||||
}
|
||||
|
||||
if (active_rate)
|
||||
ret = snd_pcm_hw_constraint_single(substream->runtime,
|
||||
@ -819,7 +822,7 @@ static int j721e_soc_probe(struct platform_device *pdev)
|
||||
struct snd_soc_card *card;
|
||||
const struct of_device_id *match;
|
||||
struct j721e_priv *priv;
|
||||
int link_cnt, conf_cnt, ret;
|
||||
int link_cnt, conf_cnt, ret, i;
|
||||
|
||||
if (!node) {
|
||||
dev_err(&pdev->dev, "of node is missing.\n");
|
||||
@ -843,8 +846,9 @@ static int j721e_soc_probe(struct platform_device *pdev)
|
||||
if (!priv->dai_links)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->audio_domains[J721E_AUDIO_DOMAIN_CPB].parent_clk_id = -1;
|
||||
priv->audio_domains[J721E_AUDIO_DOMAIN_IVI].parent_clk_id = -1;
|
||||
for (i = 0; i < J721E_AUDIO_DOMAIN_LAST; i++)
|
||||
priv->audio_domains[i].parent_clk_id = -1;
|
||||
|
||||
priv->dev = &pdev->dev;
|
||||
card = &priv->card;
|
||||
card->dev = &pdev->dev;
|
||||
|
Loading…
Reference in New Issue
Block a user