| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 1 | #ifndef __SOUND_CS5535AUDIO_H | 
|  | 2 | #define __SOUND_CS5535AUDIO_H | 
|  | 3 |  | 
| Takashi Iwai | 3e87317 | 2005-11-17 10:15:37 +0100 | [diff] [blame] | 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) | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 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_BM2_CMD			0x30 | 
|  | 20 | #define ACC_BM3_CMD			0x38 | 
|  | 21 | #define ACC_BM4_CMD			0x40 | 
|  | 22 | #define ACC_BM5_CMD			0x48 | 
|  | 23 | #define ACC_BM6_CMD			0x50 | 
|  | 24 | #define ACC_BM7_CMD			0x58 | 
|  | 25 | #define ACC_BM0_PRD			0x24 | 
|  | 26 | #define ACC_BM1_PRD			0x2C | 
|  | 27 | #define ACC_BM2_PRD			0x34 | 
|  | 28 | #define ACC_BM3_PRD			0x3C | 
|  | 29 | #define ACC_BM4_PRD			0x44 | 
|  | 30 | #define ACC_BM5_PRD			0x4C | 
|  | 31 | #define ACC_BM6_PRD			0x54 | 
|  | 32 | #define ACC_BM7_PRD			0x5C | 
|  | 33 | #define ACC_BM0_STATUS			0x21 | 
|  | 34 | #define ACC_BM1_STATUS			0x29 | 
|  | 35 | #define ACC_BM2_STATUS			0x31 | 
|  | 36 | #define ACC_BM3_STATUS			0x39 | 
|  | 37 | #define ACC_BM4_STATUS			0x41 | 
|  | 38 | #define ACC_BM5_STATUS			0x49 | 
|  | 39 | #define ACC_BM6_STATUS			0x51 | 
|  | 40 | #define ACC_BM7_STATUS			0x59 | 
|  | 41 | #define ACC_BM0_PNTR			0x60 | 
|  | 42 | #define ACC_BM1_PNTR			0x64 | 
|  | 43 | #define ACC_BM2_PNTR			0x68 | 
|  | 44 | #define ACC_BM3_PNTR			0x6C | 
|  | 45 | #define ACC_BM4_PNTR			0x70 | 
|  | 46 | #define ACC_BM5_PNTR			0x74 | 
|  | 47 | #define ACC_BM6_PNTR			0x78 | 
|  | 48 | #define ACC_BM7_PNTR			0x7C | 
|  | 49 | /* acc_codec bar0 reg bits */ | 
|  | 50 | /* ACC_IRQ_STATUS */ | 
|  | 51 | #define IRQ_STS 			0 | 
|  | 52 | #define WU_IRQ_STS 			1 | 
|  | 53 | #define BM0_IRQ_STS 			2 | 
|  | 54 | #define BM1_IRQ_STS 			3 | 
|  | 55 | #define BM2_IRQ_STS 			4 | 
|  | 56 | #define BM3_IRQ_STS 			5 | 
|  | 57 | #define BM4_IRQ_STS 			6 | 
|  | 58 | #define BM5_IRQ_STS		 	7 | 
|  | 59 | #define BM6_IRQ_STS 			8 | 
|  | 60 | #define BM7_IRQ_STS 			9 | 
|  | 61 | /* ACC_BMX_STATUS */ | 
|  | 62 | #define EOP				(1<<0) | 
|  | 63 | #define BM_EOP_ERR			(1<<1) | 
|  | 64 | /* ACC_BMX_CTL */ | 
|  | 65 | #define BM_CTL_EN			0x00000001 | 
|  | 66 | #define BM_CTL_PAUSE			0x00000011 | 
|  | 67 | #define BM_CTL_DIS			0x00000000 | 
|  | 68 | #define BM_CTL_BYTE_ORD_LE		0x00000000 | 
|  | 69 | #define BM_CTL_BYTE_ORD_BE		0x00000100 | 
|  | 70 | /* cs5535 specific ac97 codec register defines */ | 
|  | 71 | #define CMD_MASK			0xFF00FFFF | 
|  | 72 | #define CMD_NEW				0x00010000 | 
|  | 73 | #define STS_NEW				0x00020000 | 
|  | 74 | #define PRM_RDY_STS			0x00800000 | 
|  | 75 | #define ACC_CODEC_CNTL_WR_CMD		(~0x80000000) | 
|  | 76 | #define ACC_CODEC_CNTL_RD_CMD		0x80000000 | 
| Jaya Kumar | 9ac2559 | 2006-04-28 14:34:49 +0200 | [diff] [blame] | 77 | #define ACC_CODEC_CNTL_LNK_SHUTDOWN	0x00040000 | 
|  | 78 | #define ACC_CODEC_CNTL_LNK_WRM_RST	0x00020000 | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 79 | #define PRD_JMP				0x2000 | 
|  | 80 | #define PRD_EOP				0x4000 | 
|  | 81 | #define PRD_EOT				0x8000 | 
|  | 82 |  | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 83 | enum { CS5535AUDIO_DMA_PLAYBACK, CS5535AUDIO_DMA_CAPTURE, NUM_CS5535AUDIO_DMAS }; | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 84 |  | 
|  | 85 | struct cs5535audio; | 
|  | 86 |  | 
|  | 87 | struct cs5535audio_dma_ops { | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 88 | int type; | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 89 | void (*enable_dma)(struct cs5535audio *cs5535au); | 
|  | 90 | void (*disable_dma)(struct cs5535audio *cs5535au); | 
|  | 91 | void (*pause_dma)(struct cs5535audio *cs5535au); | 
|  | 92 | void (*setup_prd)(struct cs5535audio *cs5535au, u32 prd_addr); | 
| Jaya Kumar | 9ac2559 | 2006-04-28 14:34:49 +0200 | [diff] [blame] | 93 | u32 (*read_prd)(struct cs5535audio *cs5535au); | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 94 | u32 (*read_dma_pntr)(struct cs5535audio *cs5535au); | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 95 | }; | 
|  | 96 |  | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 97 | struct cs5535audio_dma_desc { | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 98 | u32 addr; | 
|  | 99 | u16 size; | 
|  | 100 | u16 ctlreserved; | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 101 | }; | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 102 |  | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 103 | struct cs5535audio_dma { | 
|  | 104 | const struct cs5535audio_dma_ops *ops; | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 105 | struct snd_dma_buffer desc_buf; | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 106 | struct snd_pcm_substream *substream; | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 107 | unsigned int buf_addr, buf_bytes; | 
|  | 108 | unsigned int period_bytes, periods; | 
| Jaya Kumar | 9ac2559 | 2006-04-28 14:34:49 +0200 | [diff] [blame] | 109 | int suspended; | 
|  | 110 | u32 saved_prd; | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 111 | }; | 
|  | 112 |  | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 113 | struct cs5535audio { | 
|  | 114 | struct snd_card *card; | 
|  | 115 | struct snd_ac97 *ac97; | 
| Jaya Kumar | 9ac2559 | 2006-04-28 14:34:49 +0200 | [diff] [blame] | 116 | struct snd_pcm *pcm; | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 117 | int irq; | 
|  | 118 | struct pci_dev *pci; | 
|  | 119 | unsigned long port; | 
|  | 120 | spinlock_t reg_lock; | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 121 | struct snd_pcm_substream *playback_substream; | 
|  | 122 | struct snd_pcm_substream *capture_substream; | 
|  | 123 | struct cs5535audio_dma dmas[NUM_CS5535AUDIO_DMAS]; | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 124 | }; | 
|  | 125 |  | 
| Jaya Kumar | 9ac2559 | 2006-04-28 14:34:49 +0200 | [diff] [blame] | 126 | int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state); | 
|  | 127 | int snd_cs5535audio_resume(struct pci_dev *pci); | 
| Takashi Iwai | 66f8df6 | 2005-11-17 14:56:21 +0100 | [diff] [blame] | 128 | int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535audio); | 
|  | 129 |  | 
| Jaya Kumar | 9b4ffa4 | 2005-11-17 10:12:23 +0100 | [diff] [blame] | 130 | #endif /* __SOUND_CS5535AUDIO_H */ | 
|  | 131 |  |