31 #include <linux/module.h>
42 #define CR_DMAEN (1 << 28)
43 #define CR_CHNL_SHIFT 22
44 #define CR_CHNL_MASK (3 << CR_CHNL_SHIFT)
45 #define CR_DWL_SHIFT 19
46 #define CR_DWL_MASK (7 << CR_DWL_SHIFT)
47 #define CR_SWL_SHIFT 16
48 #define CR_SWL_MASK (7 << CR_SWL_SHIFT)
49 #define CR_SCK_MASTER (1 << 15)
50 #define CR_SWS_MASTER (1 << 14)
51 #define CR_SCKP (1 << 13)
52 #define CR_SWSP (1 << 12)
53 #define CR_SPDP (1 << 11)
54 #define CR_SDTA (1 << 10)
55 #define CR_PDTA (1 << 9)
56 #define CR_DEL (1 << 8)
57 #define CR_BREN (1 << 7)
58 #define CR_CKDIV_SHIFT 4
59 #define CR_CKDIV_MASK (7 << CR_CKDIV_SHIFT)
60 #define CR_MUTE (1 << 3)
61 #define CR_CPEN (1 << 2)
62 #define CR_TRMD (1 << 1)
63 #define CR_EN (1 << 0)
65 #define SSIREG(reg) (*(unsigned long *)(ssi->mmio + (reg)))
72 #if defined(CONFIG_CPU_SUBTYPE_SH7760)
79 #elif defined(CONFIG_CPU_SUBTYPE_SH7780)
84 #error "Unsupported SuperH SoC"
143 pr_debug(
"ssi_hw_params() enter\nssicr was %08lx\n", ssicr);
144 pr_debug(
"bits: %u channels: %u\n", bits, channels);
154 if ((channels < 2) || (channels > 8) || (channels & 1)) {
155 pr_debug(
"ssi: invalid number of channels\n");
172 pr_debug(
"ssi: invalid sample width\n");
185 if ((bits > 16) && (bits <= 24)) {
201 pr_debug(
"ssi: invalid system word length computed\n");
207 pr_debug(
"ssi_hw_params() leave\nssicr is now %08lx\n", ssicr);
211 static int ssi_set_sysclk(
struct snd_soc_dai *cpu_dai,
int clk_id,
212 unsigned int freq,
int dir)
225 static int ssi_set_clkdiv(
struct snd_soc_dai *dai,
int did,
int div)
241 pr_debug(
"ssi: invalid sck divider %d\n", div);
253 pr_debug(
"ssi_set_fmt()\nssicr was 0x%08lx\n", ssicr);
268 pr_debug(
"ssi: unsupported format\n");
293 pr_debug(
"ssi: invalid inversion\n");
310 pr_debug(
"ssi: invalid master/slave configuration\n");
315 pr_debug(
"ssi_set_fmt() leave\nssicr is now 0x%08lx\n", ssicr);
325 SNDRV_PCM_RATE_8000_192000
329 (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | \
330 SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE | \
331 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_U20_3LE | \
332 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_U24_3LE | \
333 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_U32_LE)
336 .startup = ssi_startup,
337 .shutdown = ssi_shutdown,
338 .trigger = ssi_trigger,
339 .hw_params = ssi_hw_params,
340 .set_sysclk = ssi_set_sysclk,
341 .set_clkdiv = ssi_set_clkdiv,
342 .set_fmt = ssi_set_fmt,
362 #ifdef CONFIG_CPU_SUBTYPE_SH7760
396 .name =
"sh4-ssi-dai",
400 .probe = sh4_soc_dai_probe,