19 #include <linux/module.h>
22 #include <linux/wait.h>
42 #define CR_CR (1 << 15)
43 #define CR_CDRT (1 << 11)
44 #define CR_WMRT (1 << 10)
45 #define CR_B9 (1 << 9)
46 #define CR_ST (1 << 5)
48 #define CSAR_RD (1 << 19)
51 #define TSR_CMDAMT (1 << 31)
52 #define TSR_CMDDMT (1 << 30)
54 #define RSR_STARY (1 << 22)
55 #define RSR_STDRY (1 << 21)
57 #define ACR_DMARX16 (1 << 30)
58 #define ACR_DMATX16 (1 << 29)
59 #define ACR_TX12ATOM (1 << 26)
60 #define ACR_DMARX20 ((1 << 24) | (1 << 22))
61 #define ACR_DMATX20 ((1 << 23) | (1 << 21))
64 #define CSDR_MASK (0xffff << CSDR_SHIFT)
66 #define CSAR_MASK (0x7f << CSAR_SHIFT)
68 #define AC97_WRITE_RETRY 1
69 #define AC97_READ_RETRY 5
80 #if defined(CONFIG_CPU_SUBTYPE_SH7760)
87 #elif defined(CONFIG_CPU_SUBTYPE_SH7780)
92 #error "Unsupported SuperH SoC"
96 #define HACREG(reg) (*(unsigned long *)(hac->mmio + (reg)))
101 static int hac_get_codec_data(
struct hac_priv *hac,
unsigned short r,
104 unsigned int to1, to2,
i;
137 static unsigned short hac_read_codec_aux(
struct hac_priv *hac,
157 if (hac_get_codec_data(hac, reg, &val) != 0)
164 static void hac_ac97_write(
struct snd_ac97 *ac97,
unsigned short reg,
192 static unsigned short hac_ac97_read(
struct snd_ac97 *ac97,
197 return hac_read_codec_aux(hac, reg);
200 static void hac_ac97_warmrst(
struct snd_ac97 *ac97)
218 static void hac_ac97_coldrst(
struct snd_ac97 *ac97)
227 hac_ac97_warmrst(ac97);
231 .read = hac_ac97_read,
232 .write = hac_ac97_write,
233 .reset = hac_ac97_coldrst,
234 .warm_reset = hac_ac97_warmrst,
264 SNDRV_PCM_RATE_8000_192000
267 SNDRV_PCM_FMTBIT_S16_LE
270 .hw_params = hac_hw_params,
291 #ifdef CONFIG_CPU_SUBTYPE_SH7760
327 .name =
"hac-pcm-audio",
331 .probe = hac_soc_platform_probe,