aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_intel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-05-28 06:26:15 -0400
committerTakashi Iwai <tiwai@suse.de>2009-05-28 06:26:15 -0400
commitb21fadb9c1852c91622ca1dccfeb144bc535e36e (patch)
tree375135f7694f0913549d16a23eb10fe5442a273e /sound/pci/hda/hda_intel.c
parentb05a7d4fed7e51dca37d0a31baf1466de30b1f01 (diff)
ALSA: hda - Add more register bits definitions
Added some missing register bits definitions to reduce magic numbers. Also renamed some to follow the names on the datasheet. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r--sound/pci/hda/hda_intel.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 31a695e6e37d..f63bc6510e0f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -138,14 +138,23 @@ MODULE_DESCRIPTION("Intel HDA driver");
138 * registers 138 * registers
139 */ 139 */
140#define ICH6_REG_GCAP 0x00 140#define ICH6_REG_GCAP 0x00
141#define ICH6_GCAP_64OK (1 << 0) /* 64bit address support */
142#define ICH6_GCAP_NSDO (3 << 1) /* # of serial data out signals */
143#define ICH6_GCAP_BSS (31 << 3) /* # of bidirectional streams */
144#define ICH6_GCAP_ISS (15 << 8) /* # of input streams */
145#define ICH6_GCAP_OSS (15 << 12) /* # of output streams */
141#define ICH6_REG_VMIN 0x02 146#define ICH6_REG_VMIN 0x02
142#define ICH6_REG_VMAJ 0x03 147#define ICH6_REG_VMAJ 0x03
143#define ICH6_REG_OUTPAY 0x04 148#define ICH6_REG_OUTPAY 0x04
144#define ICH6_REG_INPAY 0x06 149#define ICH6_REG_INPAY 0x06
145#define ICH6_REG_GCTL 0x08 150#define ICH6_REG_GCTL 0x08
151#define ICH6_GCTL_RESET (1 << 1) /* controller reset */
152#define ICH6_GCTL_FCNTRL (1 << 1) /* flush control */
153#define ICH6_GCTL_UNSOL (1 << 8) /* accept unsol. response enable */
146#define ICH6_REG_WAKEEN 0x0c 154#define ICH6_REG_WAKEEN 0x0c
147#define ICH6_REG_STATESTS 0x0e 155#define ICH6_REG_STATESTS 0x0e
148#define ICH6_REG_GSTS 0x10 156#define ICH6_REG_GSTS 0x10
157#define ICH6_GSTS_FSTS (1 << 1) /* flush status */
149#define ICH6_REG_INTCTL 0x20 158#define ICH6_REG_INTCTL 0x20
150#define ICH6_REG_INTSTS 0x24 159#define ICH6_REG_INTSTS 0x24
151#define ICH6_REG_WALCLK 0x30 160#define ICH6_REG_WALCLK 0x30
@@ -153,17 +162,27 @@ MODULE_DESCRIPTION("Intel HDA driver");
153#define ICH6_REG_CORBLBASE 0x40 162#define ICH6_REG_CORBLBASE 0x40
154#define ICH6_REG_CORBUBASE 0x44 163#define ICH6_REG_CORBUBASE 0x44
155#define ICH6_REG_CORBWP 0x48 164#define ICH6_REG_CORBWP 0x48
156#define ICH6_REG_CORBRP 0x4A 165#define ICH6_REG_CORBRP 0x4a
166#define ICH6_CORBRP_RST (1 << 15) /* read pointer reset */
157#define ICH6_REG_CORBCTL 0x4c 167#define ICH6_REG_CORBCTL 0x4c
168#define ICH6_CORBCTL_RUN (1 << 1) /* enable DMA */
169#define ICH6_CORBCTL_CMEIE (1 << 0) /* enable memory error irq */
158#define ICH6_REG_CORBSTS 0x4d 170#define ICH6_REG_CORBSTS 0x4d
171#define ICH6_CORBSTS_CMEI (1 << 0) /* memory error indication */
159#define ICH6_REG_CORBSIZE 0x4e 172#define ICH6_REG_CORBSIZE 0x4e
160 173
161#define ICH6_REG_RIRBLBASE 0x50 174#define ICH6_REG_RIRBLBASE 0x50
162#define ICH6_REG_RIRBUBASE 0x54 175#define ICH6_REG_RIRBUBASE 0x54
163#define ICH6_REG_RIRBWP 0x58 176#define ICH6_REG_RIRBWP 0x58
177#define ICH6_RIRBWP_RST (1 << 15) /* write pointer reset */
164#define ICH6_REG_RINTCNT 0x5a 178#define ICH6_REG_RINTCNT 0x5a
165#define ICH6_REG_RIRBCTL 0x5c 179#define ICH6_REG_RIRBCTL 0x5c
180#define ICH6_RBCTL_IRQ_EN (1 << 0) /* enable IRQ */
181#define ICH6_RBCTL_DMA_EN (1 << 1) /* enable DMA */
182#define ICH6_RBCTL_OVERRUN_EN (1 << 2) /* enable overrun irq */
166#define ICH6_REG_RIRBSTS 0x5d 183#define ICH6_REG_RIRBSTS 0x5d
184#define ICH6_RBSTS_IRQ (1 << 0) /* response irq */
185#define ICH6_RBSTS_OVERRUN (1 << 2) /* overrun irq */
167#define ICH6_REG_RIRBSIZE 0x5e 186#define ICH6_REG_RIRBSIZE 0x5e
168 187
169#define ICH6_REG_IC 0x60 188#define ICH6_REG_IC 0x60
@@ -260,16 +279,6 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
260#define ICH6_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */ 279#define ICH6_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */
261#define ICH6_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */ 280#define ICH6_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */
262 281
263/* GCTL unsolicited response enable bit */
264#define ICH6_GCTL_UREN (1<<8)
265
266/* GCTL reset bit */
267#define ICH6_GCTL_RESET (1<<0)
268
269/* CORB/RIRB control, read/write pointer */
270#define ICH6_RBCTL_DMA_EN 0x02 /* enable DMA */
271#define ICH6_RBCTL_IRQ_EN 0x01 /* enable IRQ */
272#define ICH6_RBRWP_CLR 0x8000 /* read/write pointer clear */
273/* below are so far hardcoded - should read registers in future */ 282/* below are so far hardcoded - should read registers in future */
274#define ICH6_MAX_CORB_ENTRIES 256 283#define ICH6_MAX_CORB_ENTRIES 256
275#define ICH6_MAX_RIRB_ENTRIES 256 284#define ICH6_MAX_RIRB_ENTRIES 256
@@ -515,9 +524,9 @@ static void azx_init_cmd_io(struct azx *chip)
515 /* set the corb write pointer to 0 */ 524 /* set the corb write pointer to 0 */
516 azx_writew(chip, CORBWP, 0); 525 azx_writew(chip, CORBWP, 0);
517 /* reset the corb hw read pointer */ 526 /* reset the corb hw read pointer */
518 azx_writew(chip, CORBRP, ICH6_RBRWP_CLR); 527 azx_writew(chip, CORBRP, ICH6_CORBRP_RST);
519 /* enable corb dma */ 528 /* enable corb dma */
520 azx_writeb(chip, CORBCTL, ICH6_RBCTL_DMA_EN); 529 azx_writeb(chip, CORBCTL, ICH6_CORBCTL_RUN);
521 530
522 /* RIRB set up */ 531 /* RIRB set up */
523 chip->rirb.addr = chip->rb.addr + 2048; 532 chip->rirb.addr = chip->rb.addr + 2048;
@@ -529,7 +538,7 @@ static void azx_init_cmd_io(struct azx *chip)
529 /* set the rirb size to 256 entries (ULI requires explicitly) */ 538 /* set the rirb size to 256 entries (ULI requires explicitly) */
530 azx_writeb(chip, RIRBSIZE, 0x02); 539 azx_writeb(chip, RIRBSIZE, 0x02);
531 /* reset the rirb hw write pointer */ 540 /* reset the rirb hw write pointer */
532 azx_writew(chip, RIRBWP, ICH6_RBRWP_CLR); 541 azx_writew(chip, RIRBWP, ICH6_RIRBWP_RST);
533 /* set N=1, get RIRB response interrupt for new entry */ 542 /* set N=1, get RIRB response interrupt for new entry */
534 azx_writew(chip, RINTCNT, 1); 543 azx_writew(chip, RINTCNT, 1);
535 /* enable rirb dma and response irq */ 544 /* enable rirb dma and response irq */
@@ -796,7 +805,7 @@ static int azx_reset(struct azx *chip)
796 } 805 }
797 806
798 /* Accept unsolicited responses */ 807 /* Accept unsolicited responses */
799 azx_writel(chip, GCTL, azx_readl(chip, GCTL) | ICH6_GCTL_UREN); 808 azx_writel(chip, GCTL, azx_readl(chip, GCTL) | ICH6_GCTL_UNSOL);
800 809
801 /* detect codecs */ 810 /* detect codecs */
802 if (!chip->codec_mask) { 811 if (!chip->codec_mask) {
@@ -2284,10 +2293,10 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2284 2293
2285 /* ATI chips seems buggy about 64bit DMA addresses */ 2294 /* ATI chips seems buggy about 64bit DMA addresses */
2286 if (chip->driver_type == AZX_DRIVER_ATI) 2295 if (chip->driver_type == AZX_DRIVER_ATI)
2287 gcap &= ~0x01; 2296 gcap &= ~ICH6_GCAP_64OK;
2288 2297
2289 /* allow 64bit DMA address if supported by H/W */ 2298 /* allow 64bit DMA address if supported by H/W */
2290 if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) 2299 if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
2291 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); 2300 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
2292 else { 2301 else {
2293 pci_set_dma_mask(pci, DMA_BIT_MASK(32)); 2302 pci_set_dma_mask(pci, DMA_BIT_MASK(32));