Commit graph

20 commits

Author SHA1 Message Date
Nicolin Chen
ef33bc3217 ASoC: fsl_sai: Fix Bit Clock Polarity configurations
The BCP bit in TCR4/RCR4 register rules as followings:
  0 Bit clock is active high with drive outputs on rising edge
    and sample inputs on falling edge.
  1 Bit clock is active low with drive outputs on falling edge
    and sample inputs on rising edge.

For all formats currently supported in the fsl_sai driver, they're exactly
sending data on the falling edge and sampling on the rising edge.

However, the driver clears this BCP bit for all of them which results click
noise when working with SGTL5000 and big noise with WM8962.

Thus this patch corrects the BCP settings for all the formats here to fix
the nosie issue.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Acked-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-08 12:49:55 +01:00
Nicolin Chen
e2681a1bf5 ASoC: fsl_sai: Add isr to deal with error flag
It's quite cricial to clear error flags because SAI might hang if getting
FIFO underrun during playback (I haven't confirmed the same issue on Rx
overflow though).

So this patch enables those irq and adds isr() to clear the flags so as to
keep playback entirely safe.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-27 13:21:07 +00:00
Xiubo Li
a3f7dcc9cc ASoC: fsl-sai: Add SND_SOC_DAIFMT_DSP_A/B support.
o Add SND_SOC_DAIFMT_DSP_A support.
o Add SND_SOC_DAIFMT_DSP_B support.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-27 13:36:01 +09:00
Xiubo Li
13cde09003 ASoC: fsl-sai: fix Freescale SAI DAI format setting.
o Fix some bugs of fsl_sai_set_dai_fmt_tr().
o Add SND_SOC_DAIFMT_LEFT_J support.
o Add SND_SOC_DAIFMT_CBS_CFM support.
o Add SND_SOC_DAIFMT_CBM_CFS support.
o And SND_SOC_DAIFMT_RIGHT_J need to be done in the future.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-26 08:51:24 +09:00
Xiubo Li
78957fc349 ASoC: fsl-sai: convert to use regmap API for Freeacale SAI
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 13:25:53 +00:00
Xiubo Li
633ff8f8a4 ASoC: fsl-sai: Clean up the code
Makes the code slightly shorter.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08 12:24:01 +00:00
Xiubo Li
72aa62bed3 ASoC: fsl_sai: fix the endianess for SAI fifo data.
Revert the SAI's endianess for fifo data to/from DMA engine.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:23:10 +00:00
Xiubo Li
496a39d9ec ASoC: fsl_sai: Fix one bug for hardware limitation.
This is maybe one bug or a limitation of the hardware that the {T,R}CR2's
Synchronous Mode bits must be set as late as possible, or the SAI device
maybe hanged up, and there has not any explaination about this limitation
in the SAI Data Sheet.

And the {T,R}CR2's Synchronous Mode bits must be set at the same time whether
for Tx or Rx stream.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:23:10 +00:00
Xiubo Li
e5d0fa9c3e ASoC: fsl_sai: Add disable operation for the corresponding data channel.
Enables/Disables the corresponding data channel for tx/rx operation.
A channel must be enabled before its FIFO is accessed, and then disable
it when tx/rx is stopped or idle.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-30 12:17:07 +00:00
Xiubo Li
e6dc12d719 ASoC: fsl_sai: Move the global registers setting to _dai_probe()
Because we cannot make sure which one of _dai_fmt() and _dai_sysclk()
will be firstly called. So move the RCSR/TCSR and TCR1/RCR1's
initialization to _dai_probe(), and this can make sure that before any
of {T,R}CR{1~5} register to be set the RCSR/TCSR's RE/TE bit has been
cleared for the hareware limitation.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-30 12:00:56 +00:00
Nicolin Chen
4e3a99f5b0 ASoC: fsl_sai: Sort local variable in general way
Generally we would write code for local variable like:
static new_func()
{
	struct xxx *yyy;
	...
	int ret;
}

But this driver only follows this pattern for some functions, not all.
Thus this patch sorts the local variable in the general way.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:47:40 +00:00
Nicolin Chen
190af12dad ASoC: fsl_sai: Make dev_err information neater
Since using dev_err() there's no need to mention SAI any more, it will
print the full name of the driver -- fsl_sai.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:47:36 +00:00
Nicolin Chen
15b29dae66 ASoC: fsl_sai: Drop useless ret in startup()
We can save this ret to make the code neater.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:47:33 +00:00
Nicolin Chen
d22e28cce8 ASoC: fsl_sai: Drop useless channels check in hw_params()
SAi only supports two data channels on hardware level and the driver also does
register the min->1 and max->2, so no need to check channels.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:47:29 +00:00
Nicolin Chen
1d70030927 ASoC: fsl_sai: Use snd_pcm_format_width()
Use common helper function snd_pcm_format_width() to make code neater.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:47:24 +00:00
Nicolin Chen
1fb2d9d746 ASoC: fsl_sai: Keep symmetry for clk_enable() and clk_disable()
There are two functions haven't clk_disable_unprepare() if having error.
Thus fix them.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:47:10 +00:00
Xiubo Li
dd9f40602e ASoC: fsl-sai: Use snd_soc_dai_init_dma_data()
Makes the code slightly shorter

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:33:10 +00:00
Xiubo Li
e5180df396 ASoC: fsl-sai: Use devm_snd_dmaengine_pcm_register()
Makes the code slightly shorter

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:33:10 +00:00
Xiubo Li
a6af47ae53 ASoC: fsl-sai: Remove fsl_sai_remove()
There is no need of this function and makes the code slightly shorter

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:33:10 +00:00
Xiubo Li
4355082149 ASoC: Add SAI SoC Digital Audio Interface driver.
This adds Freescale SAI ASoC Audio support.
This implementation is only compatible with device tree definition.
Features:
o Supports playback/capture
o Supports 16/20/24 bit PCM
o Supports 8k - 96k sample rates
o Supports master and slave mode.

Signed-off-by: Alison Wang <b18965@freescale.com>
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-18 18:27:59 +00:00