10 #include <linux/module.h>
11 #include <linux/slab.h>
23 #define I2S_ENABLE 0x08
25 #define CFG_XU (1 << 25)
26 #define CFG_XO (1 << 24)
27 #define CFG_RU (1 << 23)
28 #define CFG_RO (1 << 22)
29 #define CFG_TR (1 << 21)
30 #define CFG_TE (1 << 20)
31 #define CFG_TF (1 << 19)
32 #define CFG_RR (1 << 18)
33 #define CFG_RF (1 << 17)
34 #define CFG_ICK (1 << 12)
35 #define CFG_PD (1 << 11)
36 #define CFG_LB (1 << 10)
37 #define CFG_IC (1 << 9)
38 #define CFG_FM_I2S (0 << 7)
39 #define CFG_FM_LJ (1 << 7)
40 #define CFG_FM_RJ (2 << 7)
41 #define CFG_FM_MASK (3 << 7)
42 #define CFG_TN (1 << 6)
43 #define CFG_RN (1 << 5)
44 #define CFG_SZ_8 (0x08)
45 #define CFG_SZ_16 (0x10)
46 #define CFG_SZ_18 (0x12)
47 #define CFG_SZ_20 (0x14)
48 #define CFG_SZ_24 (0x18)
49 #define CFG_SZ_MASK (0x1f)
51 #define EN_CE (1 << 0)
54 #define AU1XI2SC_RATES \
55 SNDRV_PCM_RATE_CONTINUOUS
57 #define AU1XI2SC_FMTS \
58 (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | \
59 SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | \
60 SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE | \
61 SNDRV_PCM_FMTBIT_S18_3LE | SNDRV_PCM_FMTBIT_U18_3LE | \
62 SNDRV_PCM_FMTBIT_S18_3BE | SNDRV_PCM_FMTBIT_U18_3BE | \
63 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_U20_3LE | \
64 SNDRV_PCM_FMTBIT_S20_3BE | SNDRV_PCM_FMTBIT_U20_3BE | \
65 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE | \
66 SNDRV_PCM_FMTBIT_U24_LE | SNDRV_PCM_FMTBIT_U24_BE | \
80 static int au1xi2s_set_fmt(
struct snd_soc_dai *cpu_dai,
unsigned int fmt)
139 int stype = SUBSTREAM_TYPE(substream);
163 static unsigned long msbits_to_reg(
int msbits)
187 v = msbits_to_reg(params->
msbits);
200 snd_soc_dai_set_dma_data(dai, substream, &ctx->
dmaids[0]);
205 .startup = au1xi2s_startup,
206 .trigger = au1xi2s_trigger,
207 .hw_params = au1xi2s_hw_params,
208 .set_fmt = au1xi2s_set_fmt,
212 .symmetric_rates = 1,
225 .ops = &au1xi2s_dai_ops,
242 resource_size(iores),
247 resource_size(iores));
261 platform_set_drvdata(pdev, ctx);
278 static int au1xi2s_drvsuspend(
struct device *
dev)
287 static int au1xi2s_drvresume(
struct device *
dev)
292 static const struct dev_pm_ops au1xi2sc_pmops = {
294 .resume = au1xi2s_drvresume,
297 #define AU1XI2SC_PMOPS (&au1xi2sc_pmops)
301 #define AU1XI2SC_PMOPS NULL
307 .name =
"alchemy-i2sc",
311 .probe = au1xi2s_drvprobe,