static int s3c64xx_i2s_probe(struct snd_soc_dai *dai) { struct s3c_i2sv2_info *i2s; int ret; if (dai->id >= MAX_I2SV3) { dev_err(dai->dev, "id %d out of range\n", dai->id); return -EINVAL; } i2s = &s3c64xx_i2s[dai->id]; snd_soc_dai_set_drvdata(dai, i2s); i2s->iis_cclk = clk_get(dai->dev, "audio-bus"); if (IS_ERR(i2s->iis_cclk)) { dev_err(dai->dev, "failed to get audio-bus\n"); ret = PTR_ERR(i2s->iis_cclk); goto err; } clk_enable(i2s->iis_cclk); ret = s3c_i2sv2_probe(dai, i2s, i2s->base); if (ret) goto err_clk; return 0; err_clk: clk_disable(i2s->iis_cclk); clk_put(i2s->iis_cclk); err: kfree(i2s); return ret; }
static int s3c2412_i2s_probe(struct snd_soc_dai *dai) { int ret; pr_debug("Entered %s\n", __func__); snd_soc_dai_init_dma_data(dai, &s3c2412_i2s_pcm_stereo_out, &s3c2412_i2s_pcm_stereo_in); ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS); if (ret) return ret; s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; s3c2412_i2s.iis_cclk = devm_clk_get(dai->dev, "i2sclk"); if (IS_ERR(s3c2412_i2s.iis_cclk)) { pr_err("failed to get i2sclk clock\n"); return PTR_ERR(s3c2412_i2s.iis_cclk); } /* Set MPLL as the source for IIS CLK */ clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, "mpll")); clk_prepare_enable(s3c2412_i2s.iis_cclk); s3c2412_i2s.iis_cclk = s3c2412_i2s.iis_pclk; /* 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); return 0; }
static int s3c64xx_i2sv4_probe(struct snd_soc_dai *dai) { struct s3c_i2sv2_info *i2s = &s3c64xx_i2sv4; int ret = 0; snd_soc_dai_set_drvdata(dai, i2s); ret = s3c_i2sv2_probe(dai, i2s, i2s->base); return ret; }
static int s3c64xx_i2s_probe(struct platform_device *pdev, struct snd_soc_dai *dai) { struct device *dev = &pdev->dev; struct s3c_i2sv2_info *i2s; int ret; dev_dbg(dev, "%s: probing dai %d\n", __func__, pdev->id); if (pdev->id < 0 || pdev->id > ARRAY_SIZE(s3c64xx_i2s)) { dev_err(dev, "id %d out of range\n", pdev->id); return -EINVAL; } i2s = &s3c64xx_i2s[pdev->id]; ret = s3c_i2sv2_probe(pdev, dai, i2s, pdev->id ? S3C64XX_PA_IIS1 : S3C64XX_PA_IIS0); if (ret) return ret; i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; i2s->iis_cclk = clk_get(dev, "audio-bus"); if (IS_ERR(i2s->iis_cclk)) { dev_err(dev, "failed to get audio-bus"); iounmap(i2s->regs); return -ENODEV; } /* configure GPIO for i2s port */ switch (pdev->id) { case 0: s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_I2S0_CLK); s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_I2S0_CDCLK); s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_I2S0_LRCLK); s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_I2S0_DI); s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_I2S0_D0); break; case 1: s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_I2S1_CLK); s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_I2S1_CDCLK); s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_I2S1_LRCLK); s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_I2S1_DI); s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_I2S1_D0); } return 0; }
static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) { struct s3c_i2sv2_info *i2s; struct snd_soc_dai *dai; int ret; if (pdev->id >= ARRAY_SIZE(s3c64xx_i2s)) { dev_err(&pdev->dev, "id %d out of range\n", pdev->id); return -EINVAL; } i2s = &s3c64xx_i2s[pdev->id]; dai = &s3c64xx_i2s_dai[pdev->id]; //dai->dev = &pdev->dev; i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; i2s->iis_cclk = clk_get(&pdev->dev, "audio-bus"); if (IS_ERR(i2s->iis_cclk)) { dev_err(&pdev->dev, "failed to get audio-bus\n"); ret = PTR_ERR(i2s->iis_cclk); goto err; } clk_enable(i2s->iis_cclk); ret = s3c_i2sv2_probe(pdev, dai, i2s, 0); if (ret) { goto err_clk; } ret = s3c_i2sv2_register_dai(dai); if (ret != 0) { goto err_i2sv2; } return 0; err_i2sv2: /* Not implemented for I2Sv2 core yet */ err_clk: clk_put(i2s->iis_cclk); err: return ret; }
static int s3c2412_i2s_probe(struct platform_device *pdev, struct snd_soc_dai *dai) { int ret; pr_debug("Entered %s\n", __func__); ret = s3c_i2sv2_probe(pdev, dai, &s3c2412_i2s, S3C2410_PA_IIS); if (ret) return ret; s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; s3c2412_i2s.iis_cclk = clk_get(&pdev->dev, "i2sclk"); if (s3c2412_i2s.iis_cclk == NULL) { pr_debug("failed to get i2sclk clock\n"); iounmap(s3c2412_i2s.regs); return -ENODEV; } /* Set MPLL as the source for IIS CLK */ clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, "mpll")); clk_enable(s3c2412_i2s.iis_cclk); s3c2412_i2s.iis_cclk = s3c2412_i2s.iis_pclk; /* 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); return 0; }
static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) { struct s3c_i2sv2_info *i2s; struct snd_soc_dai *dai; int ret; if (pdev->id >= MAX_I2SV3) { dev_err(&pdev->dev, "id %d out of range\n", pdev->id); return -EINVAL; } i2s = &s3c64xx_i2s[pdev->id]; dai = &s3c64xx_i2s_dai[pdev->id]; dai->dev = &pdev->dev; dai->name = "s3c64xx-i2s"; dai->id = pdev->id; dai->symmetric_rates = 1; dai->playback.channels_min = 2; dai->playback.channels_max = 2; dai->playback.rates = S3C64XX_I2S_RATES; dai->playback.formats = S3C64XX_I2S_FMTS; dai->capture.channels_min = 2; dai->capture.channels_max = 2; dai->capture.rates = S3C64XX_I2S_RATES; dai->capture.formats = S3C64XX_I2S_FMTS; dai->probe = s3c64xx_i2s_probe; dai->ops = &s3c64xx_i2s_dai_ops; i2s->feature |= S3C_FEATURE_CDCLKCON; i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; if (pdev->id == 0) { i2s->dma_capture->channel = DMACH_I2S0_IN; i2s->dma_capture->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISRXD; i2s->dma_playback->channel = DMACH_I2S0_OUT; i2s->dma_playback->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISTXD; } else { i2s->dma_capture->channel = DMACH_I2S1_IN; i2s->dma_capture->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISRXD; i2s->dma_playback->channel = DMACH_I2S1_OUT; i2s->dma_playback->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISTXD; } i2s->dma_capture->client = &s3c64xx_dma_client_in; i2s->dma_capture->dma_size = 4; i2s->dma_playback->client = &s3c64xx_dma_client_out; i2s->dma_playback->dma_size = 4; i2s->iis_cclk = clk_get(&pdev->dev, "audio-bus"); if (IS_ERR(i2s->iis_cclk)) { dev_err(&pdev->dev, "failed to get audio-bus\n"); ret = PTR_ERR(i2s->iis_cclk); goto err; } clk_enable(i2s->iis_cclk); ret = s3c_i2sv2_probe(pdev, dai, i2s, 0); if (ret) goto err_clk; ret = s3c_i2sv2_register_dai(dai); if (ret != 0) goto err_i2sv2; return 0; err_i2sv2: /* Not implemented for I2Sv2 core yet */ err_clk: clk_put(i2s->iis_cclk); err: return ret; }