~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/pci/cs5535audio/cs5535audio.h

Version: ~ [ linux-5.4-rc7 ] ~ [ linux-5.3.11 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.84 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.154 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.201 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.201 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.77 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __SOUND_CS5535AUDIO_H
  2 #define __SOUND_CS5535AUDIO_H
  3 
  4 #define cs_writel(cs5535au, reg, val)   outl(val, (cs5535au)->port + reg)
  5 #define cs_writeb(cs5535au, reg, val)   outb(val, (cs5535au)->port + reg)
  6 #define cs_readl(cs5535au, reg)         inl((cs5535au)->port + reg)
  7 #define cs_readw(cs5535au, reg)         inw((cs5535au)->port + reg)
  8 #define cs_readb(cs5535au, reg)         inb((cs5535au)->port + reg)
  9 
 10 #define CS5535AUDIO_MAX_DESCRIPTORS     128
 11 
 12 /* acc_codec bar0 reg addrs */
 13 #define ACC_GPIO_STATUS                 0x00
 14 #define ACC_CODEC_STATUS                0x08
 15 #define ACC_CODEC_CNTL                  0x0C
 16 #define ACC_IRQ_STATUS                  0x12
 17 #define ACC_BM0_CMD                     0x20
 18 #define ACC_BM1_CMD                     0x28
 19 #define ACC_BM0_PRD                     0x24
 20 #define ACC_BM1_PRD                     0x2C
 21 #define ACC_BM0_STATUS                  0x21
 22 #define ACC_BM1_STATUS                  0x29
 23 #define ACC_BM0_PNTR                    0x60
 24 #define ACC_BM1_PNTR                    0x64
 25 
 26 /* acc_codec bar0 reg bits */
 27 /* ACC_IRQ_STATUS */
 28 #define IRQ_STS                         0
 29 #define WU_IRQ_STS                      1
 30 #define BM0_IRQ_STS                     2
 31 #define BM1_IRQ_STS                     3
 32 /* ACC_BMX_STATUS */
 33 #define EOP                             (1<<0)
 34 #define BM_EOP_ERR                      (1<<1)
 35 /* ACC_BMX_CTL */
 36 #define BM_CTL_EN                       0x01
 37 #define BM_CTL_PAUSE                    0x03
 38 #define BM_CTL_DIS                      0x00
 39 #define BM_CTL_BYTE_ORD_LE              0x00
 40 #define BM_CTL_BYTE_ORD_BE              0x04
 41 /* cs5535 specific ac97 codec register defines */
 42 #define CMD_MASK                        0xFF00FFFF
 43 #define CMD_NEW                         0x00010000
 44 #define STS_NEW                         0x00020000
 45 #define PRM_RDY_STS                     0x00800000
 46 #define ACC_CODEC_CNTL_WR_CMD           (~0x80000000)
 47 #define ACC_CODEC_CNTL_RD_CMD           0x80000000
 48 #define ACC_CODEC_CNTL_LNK_SHUTDOWN     0x00040000
 49 #define ACC_CODEC_CNTL_LNK_WRM_RST      0x00020000
 50 #define PRD_JMP                         0x2000
 51 #define PRD_EOP                         0x4000
 52 #define PRD_EOT                         0x8000
 53 
 54 enum { CS5535AUDIO_DMA_PLAYBACK, CS5535AUDIO_DMA_CAPTURE, NUM_CS5535AUDIO_DMAS };
 55 
 56 struct cs5535audio;
 57 
 58 struct cs5535audio_dma_ops {
 59         int type;
 60         void (*enable_dma)(struct cs5535audio *cs5535au);
 61         void (*disable_dma)(struct cs5535audio *cs5535au);
 62         void (*pause_dma)(struct cs5535audio *cs5535au);
 63         void (*setup_prd)(struct cs5535audio *cs5535au, u32 prd_addr);
 64         u32 (*read_prd)(struct cs5535audio *cs5535au);
 65         u32 (*read_dma_pntr)(struct cs5535audio *cs5535au);
 66 };
 67 
 68 struct cs5535audio_dma_desc {
 69         u32 addr;
 70         u16 size;
 71         u16 ctlreserved;
 72 };
 73 
 74 struct cs5535audio_dma {
 75         const struct cs5535audio_dma_ops *ops;
 76         struct snd_dma_buffer desc_buf;
 77         struct snd_pcm_substream *substream;
 78         unsigned int buf_addr, buf_bytes;
 79         unsigned int period_bytes, periods;
 80         u32 saved_prd;
 81         int pcm_open_flag;
 82 };
 83 
 84 struct cs5535audio {
 85         struct snd_card *card;
 86         struct snd_ac97 *ac97;
 87         struct snd_pcm *pcm;
 88         int irq;
 89         struct pci_dev *pci;
 90         unsigned long port;
 91         spinlock_t reg_lock;
 92         struct snd_pcm_substream *playback_substream;
 93         struct snd_pcm_substream *capture_substream;
 94         struct cs5535audio_dma dmas[NUM_CS5535AUDIO_DMAS];
 95 };
 96 
 97 extern const struct dev_pm_ops snd_cs5535audio_pm;
 98 
 99 #ifdef CONFIG_OLPC
100 void olpc_prequirks(struct snd_card *card,
101                     struct snd_ac97_template *ac97);
102 int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);
103 void olpc_quirks_cleanup(void);
104 void olpc_analog_input(struct snd_ac97 *ac97, int on);
105 void olpc_mic_bias(struct snd_ac97 *ac97, int on);
106 
107 static inline void olpc_capture_open(struct snd_ac97 *ac97)
108 {
109         /* default to Analog Input off */
110         olpc_analog_input(ac97, 0);
111         /* enable MIC Bias for recording */
112         olpc_mic_bias(ac97, 1);
113 }
114 
115 static inline void olpc_capture_close(struct snd_ac97 *ac97)
116 {
117         /* disable Analog Input */
118         olpc_analog_input(ac97, 0);
119         /* disable the MIC Bias (so the recording LED turns off) */
120         olpc_mic_bias(ac97, 0);
121 }
122 #else
123 static inline void olpc_prequirks(struct snd_card *card,
124                 struct snd_ac97_template *ac97) { }
125 static inline int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
126 {
127         return 0;
128 }
129 static inline void olpc_quirks_cleanup(void) { }
130 static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { }
131 static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { }
132 static inline void olpc_capture_open(struct snd_ac97 *ac97) { }
133 static inline void olpc_capture_close(struct snd_ac97 *ac97) { }
134 #endif
135 
136 int snd_cs5535audio_pcm(struct cs5535audio *cs5535audio);
137 
138 #endif /* __SOUND_CS5535AUDIO_H */
139 
140 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp