diff options
author | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-02-18 21:08:19 +0800 |
---|---|---|
committer | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-02-19 18:50:21 +0800 |
commit | 98fb01a0ac1f8e394f8026e01c5a819b0db8bd10 (patch) | |
tree | 900df484b992718f817a02e100a375e7948f4161 /sound | |
parent | 354ee3eab94ed890237d6d6700955a774eba9393 (diff) |
ENGR00299756-5 ASoC: fsl_esai: Add default init for ESAI after probe()
This patch extracts the register init code for ESAI along with the default slot
number which is more common to I2S and LEFT_J mode.
Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
(cherry picked from commit ad9c7ab4ff75488c0cc44bcc5d87af2d5d1139cf)
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_esai.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 1eda08f7b490..44ba41072b37 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -566,6 +566,32 @@ static const struct snd_soc_component_driver fsl_esai_component = { .name = "fsl-esai", }; +static int fsl_esai_reg_init(struct fsl_esai *esai) +{ + u32 xccr, slots = 2; + + clk_enable(esai->clk); + + /* Reset and enable the ESAI module */ + writel(ESAI_ECR_ERST, esai->base + ESAI_ECR); + writel(ESAI_ECR_ESAIEN, esai->base + ESAI_ECR); + + /* Set default slot number to 2 for common DAI FMTs */ + xccr = readl(esai->base + ESAI_TCCR); + xccr &= ESAI_TCCR_TDC_MASK; + xccr |= ESAI_TCCR_TDC(slots - 1); + writel(xccr, esai->base + ESAI_TCCR); + + xccr = readl(esai->base + ESAI_RCCR); + xccr &= ESAI_RCCR_RDC_MASK; + xccr |= ESAI_RCCR_RDC(slots - 1); + writel(xccr, esai->base + ESAI_RCCR); + + clk_disable(esai->clk); + + return 0; +} + static int fsl_esai_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -670,8 +696,8 @@ static int fsl_esai_probe(struct platform_device *pdev) goto failed_pcm_init; } - writel(ESAI_ECR_ERST, esai->base + ESAI_ECR); - writel(ESAI_ECR_ESAIEN, esai->base + ESAI_ECR); + fsl_esai_reg_init(esai); + return 0; failed_pcm_init: |