14 #include <linux/module.h>
17 #include <linux/slab.h>
27 #define DRV_NAME "kirkwood-i2s"
29 #define KIRKWOOD_I2S_RATES \
30 (SNDRV_PCM_RATE_44100 | \
31 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000)
32 #define KIRKWOOD_I2S_FORMATS \
33 (SNDRV_PCM_FMTBIT_S16_LE | \
34 SNDRV_PCM_FMTBIT_S24_LE | \
35 SNDRV_PCM_FMTBIT_S32_LE)
37 static int kirkwood_i2s_set_fmt(
struct snd_soc_dai *cpu_dai,
75 static inline void kirkwood_set_dco(
void __iomem *
io,
unsigned long rate)
107 snd_soc_dai_set_dma_data(dai, substream, priv);
116 unsigned int i2s_reg,
reg;
117 unsigned long i2s_value,
value;
130 i2s_value =
readl(priv->
io+i2s_reg);
173 writel(i2s_value, priv->
io+i2s_reg);
202 dev_notice(dai->
dev,
"timed out waiting for busy to deassert: %08x\n",
217 if (priv->
burst == 32)
279 if (priv->
burst == 32)
329 return kirkwood_i2s_play_trigger(substream, cmd, dai);
331 return kirkwood_i2s_rec_trigger(substream, cmd, dai);
336 static int kirkwood_i2s_probe(
struct snd_soc_dai *dai)
347 reg_data =
readl(priv->
io + 0x1200);
348 reg_data &= (~(0x333FF8));
349 reg_data |= 0x111D18;
350 writel(reg_data, priv->
io + 0x1200);
354 reg_data =
readl(priv->
io + 0x1200);
355 reg_data &= (~(0x333FF8));
356 reg_data |= 0x111D18;
357 writel(reg_data, priv->
io + 0x1200);
372 static int kirkwood_i2s_remove(
struct snd_soc_dai *dai)
378 .startup = kirkwood_i2s_startup,
379 .trigger = kirkwood_i2s_trigger,
380 .hw_params = kirkwood_i2s_hw_params,
381 .set_fmt = kirkwood_i2s_set_fmt,
386 .probe = kirkwood_i2s_probe,
387 .remove = kirkwood_i2s_remove,
398 .ops = &kirkwood_i2s_dai_ops,
405 pdev->
dev.platform_data;
419 dev_err(&pdev->
dev,
"platform_get_resource failed\n");
426 dev_err(&pdev->
dev,
"request_mem_region failed\n");
439 if (priv->
irq <= 0) {
440 dev_err(&pdev->
dev,
"platform_get_irq failed\n");
454 if (IS_ERR(priv->
clk)) {
456 err = PTR_ERR(priv->
clk);
459 clk_prepare_enable(priv->
clk);
464 dev_err(&pdev->
dev,
"snd_soc_register_dai failed\n");
466 clk_disable_unprepare(priv->
clk);
485 clk_disable_unprepare(priv->
clk);
496 .probe = kirkwood_i2s_dev_probe,