Re: [PATCH V2] ASoC: SAMSUNG: Add quirk to support Exynos4 PCM audio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 28, 2011 at 6:53 AM, Sangbeom Kim <sbkim73@xxxxxxxxxxx> wrote:
> Exynos4 pcm block is different from previous one.
> Unlike previous one, Exynos4 doesn't have SCLK divider in the pcm block.
> For this reason, This patch added quirk handling for Exynos4 pcm cpu driver.
>
> Signed-off-by: Sangbeom Kim <sbkim73@xxxxxxxxxxx>
> ---
> Âsound/soc/samsung/pcm.c | Â 46 +++++++++++++++++++++++++++++-----------------
> Â1 files changed, 29 insertions(+), 17 deletions(-)
>
> diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
> index 9c7e8b4..adfb251 100644
> --- a/sound/soc/samsung/pcm.c
> +++ b/sound/soc/samsung/pcm.c
> @@ -10,7 +10,6 @@
> Â* it under the terms of the GNU General Public License version 2 as
> Â* published by the Free Software Foundation.
> Â*/
> -
> Â#include <linux/clk.h>
> Â#include <linux/io.h>
>
> @@ -128,6 +127,7 @@ struct s3c_pcm_info {
>
>    Âstruct s3c_dma_params  *dma_playback;
>    Âstruct s3c_dma_params  *dma_capture;
> + Â Â Â u32 Â Â quirks;
> Â};
>
> Âstatic struct s3c2410_dma_client s3c_pcm_dma_client_out = {
> @@ -278,7 +278,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,
> Â Â Â Âstruct clk *clk;
> Â Â Â Âint sclk_div, sync_div;
> Â Â Â Âunsigned long flags;
> - Â Â Â u32 clkctl;
> + Â Â Â u32 clkctl = 0;
>
> Â Â Â Âdev_dbg(pcm->dev, "Entered %s\n", __func__);
>
> @@ -299,25 +299,34 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,
>
> Â Â Â Âspin_lock_irqsave(&pcm->lock, flags);
>
> - Â Â Â /* Get hold of the PCMSOURCE_CLK */
> - Â Â Â clkctl = readl(regs + S3C_PCM_CLKCTL);
> - Â Â Â if (clkctl & S3C_PCM_CLKCTL_SERCLKSEL_PCLK)
> - Â Â Â Â Â Â Â clk = pcm->pclk;
> - Â Â Â else
> + Â Â Â if (pcm->quirks == QUIRK_NO_DIV) {
> Â Â Â Â Â Â Â Âclk = pcm->cclk;
> + Â Â Â Â Â Â Â if (clk_get_rate(clk) != (pcm->sclk_per_fs*params_rate(params))) {
> + Â Â Â Â Â Â Â Â Â Â Â clk_set_rate(clk, pcm->sclk_per_fs*params_rate(params));
> + Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â sync_div = clk_get_rate(clk)/(params_rate(params))-1;
> + Â Â Â }
> + Â Â Â else {
> + Â Â Â Â Â Â Â /* Get hold of the PCMSOURCE_CLK */
> + Â Â Â Â Â Â Â clkctl = readl(regs + S3C_PCM_CLKCTL);
> + Â Â Â Â Â Â Â if (clkctl & S3C_PCM_CLKCTL_SERCLKSEL_PCLK)
> + Â Â Â Â Â Â Â Â Â Â Â clk = pcm->pclk;
> + Â Â Â Â Â Â Â else
> + Â Â Â Â Â Â Â Â Â Â Â clk = pcm->cclk;
>
> - Â Â Â /* Set the SCLK divider */
> - Â Â Â sclk_div = clk_get_rate(clk) / pcm->sclk_per_fs /
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â params_rate(params) / 2 - 1;
> + Â Â Â Â Â Â Â /* Set the SCLK divider */
> + Â Â Â Â Â Â Â sclk_div = clk_get_rate(clk) / pcm->sclk_per_fs /
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â params_rate(params) / 2 - 1;
>
> - Â Â Â clkctl &= ~(S3C_PCM_CLKCTL_SCLKDIV_MASK
> - Â Â Â Â Â Â Â Â Â Â Â << S3C_PCM_CLKCTL_SCLKDIV_SHIFT);
> - Â Â Â clkctl |= ((sclk_div & S3C_PCM_CLKCTL_SCLKDIV_MASK)
> - Â Â Â Â Â Â Â Â Â Â Â << S3C_PCM_CLKCTL_SCLKDIV_SHIFT);
> + Â Â Â Â Â Â Â clkctl &= ~(S3C_PCM_CLKCTL_SCLKDIV_MASK
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â << S3C_PCM_CLKCTL_SCLKDIV_SHIFT);
> + Â Â Â Â Â Â Â clkctl |= ((sclk_div & S3C_PCM_CLKCTL_SCLKDIV_MASK)
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â << S3C_PCM_CLKCTL_SCLKDIV_SHIFT);
>
> - Â Â Â /* Set the SYNC divider */
> - Â Â Â sync_div = pcm->sclk_per_fs - 1;
> + Â Â Â Â Â Â Â sync_div = pcm->sclk_per_fs - 1;
> + Â Â Â }
>
> + Â Â Â /* Set the SYNC divider */
> Â Â Â Âclkctl &= ~(S3C_PCM_CLKCTL_SYNCDIV_MASK
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â<< S3C_PCM_CLKCTL_SYNCDIV_SHIFT);
> Â Â Â Âclkctl |= ((sync_div & S3C_PCM_CLKCTL_SYNCDIV_MASK)
> @@ -330,7 +339,6 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,
> Â Â Â Âdev_dbg(pcm->dev, "PCMSOURCE_CLK-%lu SCLK=%ufs SCLK_DIV=%d SYNC_DIV=%d\n",
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âclk_get_rate(clk), pcm->sclk_per_fs,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âsclk_div, sync_div);
> -
> Â Â Â Âreturn 0;
> Â}
>
> @@ -494,6 +502,7 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev)
> Â Â Â Âstruct s3c_pcm_info *pcm;
> Â Â Â Âstruct resource *mem_res, *dmatx_res, *dmarx_res;
> Â Â Â Âstruct s3c_audio_pdata *pcm_pdata;
> + Â Â Â struct samsung_i2s *pcm_cfg;

Oh dear, perhaps you forgot to test before sending ?
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux