Beispiel #1
0
static int s3c24xx_i2s_probe(struct platform_device *pdev,
			     struct snd_soc_dai *dai)
{
	pr_debug("Entered %s\n", __func__);

	s3c24xx_i2s.regs = ioremap(S3C2410_PA_IIS, 0x100);
	if (s3c24xx_i2s.regs == NULL)
		return -ENXIO;

	s3c24xx_i2s.iis_clk = clk_get(&pdev->dev, "iis");
	if (s3c24xx_i2s.iis_clk == NULL) {
		pr_err("failed to get iis_clock\n");
		iounmap(s3c24xx_i2s.regs);
		return -ENODEV;
	}
	clk_enable(s3c24xx_i2s.iis_clk);

	/* Configure the I2S pins in correct mode */
	s3c2410_gpio_cfgpin(S3C2410_GPE0, S3C2410_GPE0_I2SLRCK);
	s3c2410_gpio_cfgpin(S3C2410_GPE1, S3C2410_GPE1_I2SSCLK);
	s3c2410_gpio_cfgpin(S3C2410_GPE2, S3C2410_GPE2_CDCLK);
	s3c2410_gpio_cfgpin(S3C2410_GPE3, S3C2410_GPE3_I2SSDI);
	s3c2410_gpio_cfgpin(S3C2410_GPE4, S3C2410_GPE4_I2SSDO);

	writel(S3C2410_IISCON_IISEN, s3c24xx_i2s.regs + S3C2410_IISCON);

	s3c24xx_snd_txctrl(0);
	s3c24xx_snd_rxctrl(0);

	return 0;
}
Beispiel #2
0
static int s3c24xx_i2s_probe(struct snd_soc_dai *dai)
{
    pr_debug("Entered %s\n", __func__);

    samsung_asoc_init_dma_data(dai, &s3c24xx_i2s_pcm_stereo_out,
                               &s3c24xx_i2s_pcm_stereo_in);

    s3c24xx_i2s.iis_clk = devm_clk_get(dai->dev, "iis");
    if (IS_ERR(s3c24xx_i2s.iis_clk)) {
        pr_err("failed to get iis_clock\n");
        return PTR_ERR(s3c24xx_i2s.iis_clk);
    }
    clk_prepare_enable(s3c24xx_i2s.iis_clk);

    /* Configure the I2S pins (GPE0...GPE4) in correct mode */
    s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
                          S3C_GPIO_PULL_NONE);

    writel(S3C2410_IISCON_IISEN, s3c24xx_i2s.regs + S3C2410_IISCON);

    s3c24xx_snd_txctrl(0);
    s3c24xx_snd_rxctrl(0);

    return 0;
}
Beispiel #3
0
static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
			       struct snd_soc_dai *dai)
{
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct s3c_dma_params *dma_data =
		snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream);

	pr_debug("Entered %s\n", __func__);

	switch (cmd) {
	case SNDRV_PCM_TRIGGER_START:
	case SNDRV_PCM_TRIGGER_RESUME:
	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
		if (!s3c24xx_snd_is_clkmaster()) {
			ret = s3c24xx_snd_lrsync();
			if (ret)
				goto exit_err;
		}

		if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
			s3c24xx_snd_rxctrl(1);
		else
			s3c24xx_snd_txctrl(1);

		s3c2410_dma_ctrl(dma_data->channel, S3C2410_DMAOP_STARTED);
		break;
	case SNDRV_PCM_TRIGGER_STOP:
	case SNDRV_PCM_TRIGGER_SUSPEND:
	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
		if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
			s3c24xx_snd_rxctrl(0);
		else
			s3c24xx_snd_txctrl(0);
		break;
	default:
		ret = -EINVAL;
		break;
	}

exit_err:
	return ret;
}
Beispiel #4
0
static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
                               struct snd_soc_dai *dai)
{
    int ret = 0;

    pr_debug("Entered %s\n", __func__);

    switch (cmd) {
    case SNDRV_PCM_TRIGGER_START:
    case SNDRV_PCM_TRIGGER_RESUME:
    case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
        if (!s3c24xx_snd_is_clkmaster()) {
            ret = s3c24xx_snd_lrsync();
            if (ret)
                goto exit_err;
        }

        if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
            s3c24xx_snd_rxctrl(1);
        else
            s3c24xx_snd_txctrl(1);

        break;
    case SNDRV_PCM_TRIGGER_STOP:
    case SNDRV_PCM_TRIGGER_SUSPEND:
    case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
        if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
            s3c24xx_snd_rxctrl(0);
        else
            s3c24xx_snd_txctrl(0);
        break;
    default:
        ret = -EINVAL;
        break;
    }

exit_err:
    return ret;
}