aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/intel8x0m.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:04:53 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:19:38 -0500
commit6b75a9d8b6c794d4c41d1b875c3e8e920b09e151 (patch)
treeb75b956a7695a3f63c9fbdf5350ebbb90aca99c2 /sound/pci/intel8x0m.c
parenta5f22156e03d40f1da24a1b19a8a84c4fb3208f2 (diff)
[ALSA] Remove xxx_t typedefs: PCI Intel8x0
Modules: Intel8x0 driver,Intel8x0-modem driver Remove xxx_t typedefs from the PCI Intel8x0 and modem drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/intel8x0m.c')
-rw-r--r--sound/pci/intel8x0m.c228
1 files changed, 122 insertions, 106 deletions
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 3244df9c1e92..3b6724e02e4e 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -38,7 +38,8 @@
38#include <sound/initval.h> 38#include <sound/initval.h>
39 39
40MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 40MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
41MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; SiS 7013; NVidia MCP/2/2S/3 modems"); 41MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; "
42 "SiS 7013; NVidia MCP/2/2S/3 modems");
42MODULE_LICENSE("GPL"); 43MODULE_LICENSE("GPL");
43MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH}," 44MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH},"
44 "{Intel,82901AB-ICH0}," 45 "{Intel,82901AB-ICH0},"
@@ -163,14 +164,14 @@ DEFINE_REGSET(OFF, 0); /* offset */
163enum { ICHD_MDMIN, ICHD_MDMOUT, ICHD_MDMLAST = ICHD_MDMOUT }; 164enum { ICHD_MDMIN, ICHD_MDMOUT, ICHD_MDMLAST = ICHD_MDMOUT };
164enum { ALID_MDMIN, ALID_MDMOUT, ALID_MDMLAST = ALID_MDMOUT }; 165enum { ALID_MDMIN, ALID_MDMOUT, ALID_MDMLAST = ALID_MDMOUT };
165 166
166#define get_ichdev(substream) (ichdev_t *)(substream->runtime->private_data) 167#define get_ichdev(substream) (substream->runtime->private_data)
167 168
168typedef struct { 169struct ichdev {
169 unsigned int ichd; /* ich device number */ 170 unsigned int ichd; /* ich device number */
170 unsigned long reg_offset; /* offset to bmaddr */ 171 unsigned long reg_offset; /* offset to bmaddr */
171 u32 *bdbar; /* CPU address (32bit) */ 172 u32 *bdbar; /* CPU address (32bit) */
172 unsigned int bdbar_addr; /* PCI bus address (32bit) */ 173 unsigned int bdbar_addr; /* PCI bus address (32bit) */
173 snd_pcm_substream_t *substream; 174 struct snd_pcm_substream *substream;
174 unsigned int physbuf; /* physical address (32bit) */ 175 unsigned int physbuf; /* physical address (32bit) */
175 unsigned int size; 176 unsigned int size;
176 unsigned int fragsize; 177 unsigned int fragsize;
@@ -187,12 +188,10 @@ typedef struct {
187 unsigned int roff_picb; 188 unsigned int roff_picb;
188 unsigned int int_sta_mask; /* interrupt status mask */ 189 unsigned int int_sta_mask; /* interrupt status mask */
189 unsigned int ali_slot; /* ALI DMA slot */ 190 unsigned int ali_slot; /* ALI DMA slot */
190 ac97_t *ac97; 191 struct snd_ac97 *ac97;
191} ichdev_t; 192};
192
193typedef struct _snd_intel8x0m intel8x0_t;
194 193
195struct _snd_intel8x0m { 194struct intel8x0m {
196 unsigned int device_type; 195 unsigned int device_type;
197 196
198 int irq; 197 int irq;
@@ -205,16 +204,16 @@ struct _snd_intel8x0m {
205 void __iomem *remap_bmaddr; 204 void __iomem *remap_bmaddr;
206 205
207 struct pci_dev *pci; 206 struct pci_dev *pci;
208 snd_card_t *card; 207 struct snd_card *card;
209 208
210 int pcm_devs; 209 int pcm_devs;
211 snd_pcm_t *pcm[2]; 210 struct snd_pcm *pcm[2];
212 ichdev_t ichd[2]; 211 struct ichdev ichd[2];
213 212
214 unsigned int in_ac97_init: 1; 213 unsigned int in_ac97_init: 1;
215 214
216 ac97_bus_t *ac97_bus; 215 struct snd_ac97_bus *ac97_bus;
217 ac97_t *ac97; 216 struct snd_ac97 *ac97;
218 217
219 spinlock_t reg_lock; 218 spinlock_t reg_lock;
220 219
@@ -254,7 +253,7 @@ MODULE_DEVICE_TABLE(pci, snd_intel8x0m_ids);
254 * Lowlevel I/O - busmaster 253 * Lowlevel I/O - busmaster
255 */ 254 */
256 255
257static u8 igetbyte(intel8x0_t *chip, u32 offset) 256static u8 igetbyte(struct intel8x0m *chip, u32 offset)
258{ 257{
259 if (chip->bm_mmio) 258 if (chip->bm_mmio)
260 return readb(chip->remap_bmaddr + offset); 259 return readb(chip->remap_bmaddr + offset);
@@ -262,7 +261,7 @@ static u8 igetbyte(intel8x0_t *chip, u32 offset)
262 return inb(chip->bmaddr + offset); 261 return inb(chip->bmaddr + offset);
263} 262}
264 263
265static u16 igetword(intel8x0_t *chip, u32 offset) 264static u16 igetword(struct intel8x0m *chip, u32 offset)
266{ 265{
267 if (chip->bm_mmio) 266 if (chip->bm_mmio)
268 return readw(chip->remap_bmaddr + offset); 267 return readw(chip->remap_bmaddr + offset);
@@ -270,7 +269,7 @@ static u16 igetword(intel8x0_t *chip, u32 offset)
270 return inw(chip->bmaddr + offset); 269 return inw(chip->bmaddr + offset);
271} 270}
272 271
273static u32 igetdword(intel8x0_t *chip, u32 offset) 272static u32 igetdword(struct intel8x0m *chip, u32 offset)
274{ 273{
275 if (chip->bm_mmio) 274 if (chip->bm_mmio)
276 return readl(chip->remap_bmaddr + offset); 275 return readl(chip->remap_bmaddr + offset);
@@ -278,7 +277,7 @@ static u32 igetdword(intel8x0_t *chip, u32 offset)
278 return inl(chip->bmaddr + offset); 277 return inl(chip->bmaddr + offset);
279} 278}
280 279
281static void iputbyte(intel8x0_t *chip, u32 offset, u8 val) 280static void iputbyte(struct intel8x0m *chip, u32 offset, u8 val)
282{ 281{
283 if (chip->bm_mmio) 282 if (chip->bm_mmio)
284 writeb(val, chip->remap_bmaddr + offset); 283 writeb(val, chip->remap_bmaddr + offset);
@@ -286,7 +285,7 @@ static void iputbyte(intel8x0_t *chip, u32 offset, u8 val)
286 outb(val, chip->bmaddr + offset); 285 outb(val, chip->bmaddr + offset);
287} 286}
288 287
289static void iputword(intel8x0_t *chip, u32 offset, u16 val) 288static void iputword(struct intel8x0m *chip, u32 offset, u16 val)
290{ 289{
291 if (chip->bm_mmio) 290 if (chip->bm_mmio)
292 writew(val, chip->remap_bmaddr + offset); 291 writew(val, chip->remap_bmaddr + offset);
@@ -294,7 +293,7 @@ static void iputword(intel8x0_t *chip, u32 offset, u16 val)
294 outw(val, chip->bmaddr + offset); 293 outw(val, chip->bmaddr + offset);
295} 294}
296 295
297static void iputdword(intel8x0_t *chip, u32 offset, u32 val) 296static void iputdword(struct intel8x0m *chip, u32 offset, u32 val)
298{ 297{
299 if (chip->bm_mmio) 298 if (chip->bm_mmio)
300 writel(val, chip->remap_bmaddr + offset); 299 writel(val, chip->remap_bmaddr + offset);
@@ -306,7 +305,7 @@ static void iputdword(intel8x0_t *chip, u32 offset, u32 val)
306 * Lowlevel I/O - AC'97 registers 305 * Lowlevel I/O - AC'97 registers
307 */ 306 */
308 307
309static u16 iagetword(intel8x0_t *chip, u32 offset) 308static u16 iagetword(struct intel8x0m *chip, u32 offset)
310{ 309{
311 if (chip->mmio) 310 if (chip->mmio)
312 return readw(chip->remap_addr + offset); 311 return readw(chip->remap_addr + offset);
@@ -314,7 +313,7 @@ static u16 iagetword(intel8x0_t *chip, u32 offset)
314 return inw(chip->addr + offset); 313 return inw(chip->addr + offset);
315} 314}
316 315
317static void iaputword(intel8x0_t *chip, u32 offset, u16 val) 316static void iaputword(struct intel8x0m *chip, u32 offset, u16 val)
318{ 317{
319 if (chip->mmio) 318 if (chip->mmio)
320 writew(val, chip->remap_addr + offset); 319 writew(val, chip->remap_addr + offset);
@@ -331,7 +330,7 @@ static void iaputword(intel8x0_t *chip, u32 offset, u16 val)
331 */ 330 */
332 331
333/* return the GLOB_STA bit for the corresponding codec */ 332/* return the GLOB_STA bit for the corresponding codec */
334static unsigned int get_ich_codec_bit(intel8x0_t *chip, unsigned int codec) 333static unsigned int get_ich_codec_bit(struct intel8x0m *chip, unsigned int codec)
335{ 334{
336 static unsigned int codec_bit[3] = { 335 static unsigned int codec_bit[3] = {
337 ICH_PCR, ICH_SCR, ICH_TCR 336 ICH_PCR, ICH_SCR, ICH_TCR
@@ -340,7 +339,7 @@ static unsigned int get_ich_codec_bit(intel8x0_t *chip, unsigned int codec)
340 return codec_bit[codec]; 339 return codec_bit[codec];
341} 340}
342 341
343static int snd_intel8x0m_codec_semaphore(intel8x0_t *chip, unsigned int codec) 342static int snd_intel8x0m_codec_semaphore(struct intel8x0m *chip, unsigned int codec)
344{ 343{
345 int time; 344 int time;
346 345
@@ -370,11 +369,11 @@ static int snd_intel8x0m_codec_semaphore(intel8x0_t *chip, unsigned int codec)
370 return -EBUSY; 369 return -EBUSY;
371} 370}
372 371
373static void snd_intel8x0_codec_write(ac97_t *ac97, 372static void snd_intel8x0_codec_write(struct snd_ac97 *ac97,
374 unsigned short reg, 373 unsigned short reg,
375 unsigned short val) 374 unsigned short val)
376{ 375{
377 intel8x0_t *chip = ac97->private_data; 376 struct intel8x0m *chip = ac97->private_data;
378 377
379 if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { 378 if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) {
380 if (! chip->in_ac97_init) 379 if (! chip->in_ac97_init)
@@ -383,10 +382,10 @@ static void snd_intel8x0_codec_write(ac97_t *ac97,
383 iaputword(chip, reg + ac97->num * 0x80, val); 382 iaputword(chip, reg + ac97->num * 0x80, val);
384} 383}
385 384
386static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, 385static unsigned short snd_intel8x0_codec_read(struct snd_ac97 *ac97,
387 unsigned short reg) 386 unsigned short reg)
388{ 387{
389 intel8x0_t *chip = ac97->private_data; 388 struct intel8x0m *chip = ac97->private_data;
390 unsigned short res; 389 unsigned short res;
391 unsigned int tmp; 390 unsigned int tmp;
392 391
@@ -398,7 +397,8 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
398 res = iagetword(chip, reg + ac97->num * 0x80); 397 res = iagetword(chip, reg + ac97->num * 0x80);
399 if ((tmp = igetdword(chip, ICHREG(GLOB_STA))) & ICH_RCS) { 398 if ((tmp = igetdword(chip, ICHREG(GLOB_STA))) & ICH_RCS) {
400 /* reset RCS and preserve other R/WC bits */ 399 /* reset RCS and preserve other R/WC bits */
401 iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); 400 iputdword(chip, ICHREG(GLOB_STA),
401 tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI));
402 if (! chip->in_ac97_init) 402 if (! chip->in_ac97_init)
403 snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); 403 snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg);
404 res = 0xffff; 404 res = 0xffff;
@@ -413,7 +413,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
413/* 413/*
414 * DMA I/O 414 * DMA I/O
415 */ 415 */
416static void snd_intel8x0_setup_periods(intel8x0_t *chip, ichdev_t *ichdev) 416static void snd_intel8x0_setup_periods(struct intel8x0m *chip, struct ichdev *ichdev)
417{ 417{
418 int idx; 418 int idx;
419 u32 *bdbar = ichdev->bdbar; 419 u32 *bdbar = ichdev->bdbar;
@@ -460,7 +460,7 @@ static void snd_intel8x0_setup_periods(intel8x0_t *chip, ichdev_t *ichdev)
460 * Interrupt handler 460 * Interrupt handler
461 */ 461 */
462 462
463static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev) 463static inline void snd_intel8x0_update(struct intel8x0m *chip, struct ichdev *ichdev)
464{ 464{
465 unsigned long port = ichdev->reg_offset; 465 unsigned long port = ichdev->reg_offset;
466 int civ, i, step; 466 int civ, i, step;
@@ -489,8 +489,15 @@ static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev)
489 for (i = 0; i < step; i++) { 489 for (i = 0; i < step; i++) {
490 ichdev->lvi_frag++; 490 ichdev->lvi_frag++;
491 ichdev->lvi_frag %= ichdev->frags; 491 ichdev->lvi_frag %= ichdev->frags;
492 ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize1); 492 ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf +
493 // printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n", ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), inl(port + 4), inb(port + ICH_REG_OFF_CR)); 493 ichdev->lvi_frag *
494 ichdev->fragsize1);
495#if 0
496 printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n",
497 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2],
498 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port),
499 inl(port + 4), inb(port + ICH_REG_OFF_CR));
500#endif
494 if (--ichdev->ack == 0) { 501 if (--ichdev->ack == 0) {
495 ichdev->ack = ichdev->ack_reload; 502 ichdev->ack = ichdev->ack_reload;
496 ack = 1; 503 ack = 1;
@@ -506,8 +513,8 @@ static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev)
506 513
507static irqreturn_t snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs *regs) 514static irqreturn_t snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs *regs)
508{ 515{
509 intel8x0_t *chip = dev_id; 516 struct intel8x0m *chip = dev_id;
510 ichdev_t *ichdev; 517 struct ichdev *ichdev;
511 unsigned int status; 518 unsigned int status;
512 unsigned int i; 519 unsigned int i;
513 520
@@ -541,10 +548,10 @@ static irqreturn_t snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs
541 * PCM part 548 * PCM part
542 */ 549 */
543 550
544static int snd_intel8x0_pcm_trigger(snd_pcm_substream_t *substream, int cmd) 551static int snd_intel8x0_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
545{ 552{
546 intel8x0_t *chip = snd_pcm_substream_chip(substream); 553 struct intel8x0m *chip = snd_pcm_substream_chip(substream);
547 ichdev_t *ichdev = get_ichdev(substream); 554 struct ichdev *ichdev = get_ichdev(substream);
548 unsigned char val = 0; 555 unsigned char val = 0;
549 unsigned long port = ichdev->reg_offset; 556 unsigned long port = ichdev->reg_offset;
550 557
@@ -576,21 +583,21 @@ static int snd_intel8x0_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
576 return 0; 583 return 0;
577} 584}
578 585
579static int snd_intel8x0_hw_params(snd_pcm_substream_t * substream, 586static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream,
580 snd_pcm_hw_params_t * hw_params) 587 struct snd_pcm_hw_params *hw_params)
581{ 588{
582 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 589 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
583} 590}
584 591
585static int snd_intel8x0_hw_free(snd_pcm_substream_t * substream) 592static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream)
586{ 593{
587 return snd_pcm_lib_free_pages(substream); 594 return snd_pcm_lib_free_pages(substream);
588} 595}
589 596
590static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(snd_pcm_substream_t * substream) 597static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *substream)
591{ 598{
592 intel8x0_t *chip = snd_pcm_substream_chip(substream); 599 struct intel8x0m *chip = snd_pcm_substream_chip(substream);
593 ichdev_t *ichdev = get_ichdev(substream); 600 struct ichdev *ichdev = get_ichdev(substream);
594 size_t ptr1, ptr; 601 size_t ptr1, ptr;
595 602
596 ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << chip->pcm_pos_shift; 603 ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << chip->pcm_pos_shift;
@@ -604,11 +611,11 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(snd_pcm_substream_t * substrea
604 return bytes_to_frames(substream->runtime, ptr); 611 return bytes_to_frames(substream->runtime, ptr);
605} 612}
606 613
607static int snd_intel8x0m_pcm_prepare(snd_pcm_substream_t * substream) 614static int snd_intel8x0m_pcm_prepare(struct snd_pcm_substream *substream)
608{ 615{
609 intel8x0_t *chip = snd_pcm_substream_chip(substream); 616 struct intel8x0m *chip = snd_pcm_substream_chip(substream);
610 snd_pcm_runtime_t *runtime = substream->runtime; 617 struct snd_pcm_runtime *runtime = substream->runtime;
611 ichdev_t *ichdev = get_ichdev(substream); 618 struct ichdev *ichdev = get_ichdev(substream);
612 619
613 ichdev->physbuf = runtime->dma_addr; 620 ichdev->physbuf = runtime->dma_addr;
614 ichdev->size = snd_pcm_lib_buffer_bytes(substream); 621 ichdev->size = snd_pcm_lib_buffer_bytes(substream);
@@ -619,7 +626,7 @@ static int snd_intel8x0m_pcm_prepare(snd_pcm_substream_t * substream)
619 return 0; 626 return 0;
620} 627}
621 628
622static snd_pcm_hardware_t snd_intel8x0m_stream = 629static struct snd_pcm_hardware snd_intel8x0m_stream =
623{ 630{
624 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 631 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
625 SNDRV_PCM_INFO_BLOCK_TRANSFER | 632 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -641,58 +648,59 @@ static snd_pcm_hardware_t snd_intel8x0m_stream =
641}; 648};
642 649
643 650
644static int snd_intel8x0m_pcm_open(snd_pcm_substream_t * substream, ichdev_t *ichdev) 651static int snd_intel8x0m_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev)
645{ 652{
646 static unsigned int rates[] = { 8000, 9600, 12000, 16000 }; 653 static unsigned int rates[] = { 8000, 9600, 12000, 16000 };
647 static snd_pcm_hw_constraint_list_t hw_constraints_rates = { 654 static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
648 .count = ARRAY_SIZE(rates), 655 .count = ARRAY_SIZE(rates),
649 .list = rates, 656 .list = rates,
650 .mask = 0, 657 .mask = 0,
651 }; 658 };
652 snd_pcm_runtime_t *runtime = substream->runtime; 659 struct snd_pcm_runtime *runtime = substream->runtime;
653 int err; 660 int err;
654 661
655 ichdev->substream = substream; 662 ichdev->substream = substream;
656 runtime->hw = snd_intel8x0m_stream; 663 runtime->hw = snd_intel8x0m_stream;
657 err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); 664 err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
665 &hw_constraints_rates);
658 if ( err < 0 ) 666 if ( err < 0 )
659 return err; 667 return err;
660 runtime->private_data = ichdev; 668 runtime->private_data = ichdev;
661 return 0; 669 return 0;
662} 670}
663 671
664static int snd_intel8x0m_playback_open(snd_pcm_substream_t * substream) 672static int snd_intel8x0m_playback_open(struct snd_pcm_substream *substream)
665{ 673{
666 intel8x0_t *chip = snd_pcm_substream_chip(substream); 674 struct intel8x0m *chip = snd_pcm_substream_chip(substream);
667 675
668 return snd_intel8x0m_pcm_open(substream, &chip->ichd[ICHD_MDMOUT]); 676 return snd_intel8x0m_pcm_open(substream, &chip->ichd[ICHD_MDMOUT]);
669} 677}
670 678
671static int snd_intel8x0m_playback_close(snd_pcm_substream_t * substream) 679static int snd_intel8x0m_playback_close(struct snd_pcm_substream *substream)
672{ 680{
673 intel8x0_t *chip = snd_pcm_substream_chip(substream); 681 struct intel8x0m *chip = snd_pcm_substream_chip(substream);
674 682
675 chip->ichd[ICHD_MDMOUT].substream = NULL; 683 chip->ichd[ICHD_MDMOUT].substream = NULL;
676 return 0; 684 return 0;
677} 685}
678 686
679static int snd_intel8x0m_capture_open(snd_pcm_substream_t * substream) 687static int snd_intel8x0m_capture_open(struct snd_pcm_substream *substream)
680{ 688{
681 intel8x0_t *chip = snd_pcm_substream_chip(substream); 689 struct intel8x0m *chip = snd_pcm_substream_chip(substream);
682 690
683 return snd_intel8x0m_pcm_open(substream, &chip->ichd[ICHD_MDMIN]); 691 return snd_intel8x0m_pcm_open(substream, &chip->ichd[ICHD_MDMIN]);
684} 692}
685 693
686static int snd_intel8x0m_capture_close(snd_pcm_substream_t * substream) 694static int snd_intel8x0m_capture_close(struct snd_pcm_substream *substream)
687{ 695{
688 intel8x0_t *chip = snd_pcm_substream_chip(substream); 696 struct intel8x0m *chip = snd_pcm_substream_chip(substream);
689 697
690 chip->ichd[ICHD_MDMIN].substream = NULL; 698 chip->ichd[ICHD_MDMIN].substream = NULL;
691 return 0; 699 return 0;
692} 700}
693 701
694 702
695static snd_pcm_ops_t snd_intel8x0m_playback_ops = { 703static struct snd_pcm_ops snd_intel8x0m_playback_ops = {
696 .open = snd_intel8x0m_playback_open, 704 .open = snd_intel8x0m_playback_open,
697 .close = snd_intel8x0m_playback_close, 705 .close = snd_intel8x0m_playback_close,
698 .ioctl = snd_pcm_lib_ioctl, 706 .ioctl = snd_pcm_lib_ioctl,
@@ -703,7 +711,7 @@ static snd_pcm_ops_t snd_intel8x0m_playback_ops = {
703 .pointer = snd_intel8x0_pcm_pointer, 711 .pointer = snd_intel8x0_pcm_pointer,
704}; 712};
705 713
706static snd_pcm_ops_t snd_intel8x0m_capture_ops = { 714static struct snd_pcm_ops snd_intel8x0m_capture_ops = {
707 .open = snd_intel8x0m_capture_open, 715 .open = snd_intel8x0m_capture_open,
708 .close = snd_intel8x0m_capture_close, 716 .close = snd_intel8x0m_capture_close,
709 .ioctl = snd_pcm_lib_ioctl, 717 .ioctl = snd_pcm_lib_ioctl,
@@ -717,16 +725,17 @@ static snd_pcm_ops_t snd_intel8x0m_capture_ops = {
717 725
718struct ich_pcm_table { 726struct ich_pcm_table {
719 char *suffix; 727 char *suffix;
720 snd_pcm_ops_t *playback_ops; 728 struct snd_pcm_ops *playback_ops;
721 snd_pcm_ops_t *capture_ops; 729 struct snd_pcm_ops *capture_ops;
722 size_t prealloc_size; 730 size_t prealloc_size;
723 size_t prealloc_max_size; 731 size_t prealloc_max_size;
724 int ac97_idx; 732 int ac97_idx;
725}; 733};
726 734
727static int __devinit snd_intel8x0_pcm1(intel8x0_t *chip, int device, struct ich_pcm_table *rec) 735static int __devinit snd_intel8x0_pcm1(struct intel8x0m *chip, int device,
736 struct ich_pcm_table *rec)
728{ 737{
729 snd_pcm_t *pcm; 738 struct snd_pcm *pcm;
730 int err; 739 int err;
731 char name[32]; 740 char name[32];
732 741
@@ -772,7 +781,7 @@ static struct ich_pcm_table intel_pcms[] __devinitdata = {
772 }, 781 },
773}; 782};
774 783
775static int __devinit snd_intel8x0_pcm(intel8x0_t *chip) 784static int __devinit snd_intel8x0_pcm(struct intel8x0m *chip)
776{ 785{
777 int i, tblsize, device, err; 786 int i, tblsize, device, err;
778 struct ich_pcm_table *tbl, *rec; 787 struct ich_pcm_table *tbl, *rec;
@@ -819,27 +828,27 @@ static int __devinit snd_intel8x0_pcm(intel8x0_t *chip)
819 * Mixer part 828 * Mixer part
820 */ 829 */
821 830
822static void snd_intel8x0_mixer_free_ac97_bus(ac97_bus_t *bus) 831static void snd_intel8x0_mixer_free_ac97_bus(struct snd_ac97_bus *bus)
823{ 832{
824 intel8x0_t *chip = bus->private_data; 833 struct intel8x0m *chip = bus->private_data;
825 chip->ac97_bus = NULL; 834 chip->ac97_bus = NULL;
826} 835}
827 836
828static void snd_intel8x0_mixer_free_ac97(ac97_t *ac97) 837static void snd_intel8x0_mixer_free_ac97(struct snd_ac97 *ac97)
829{ 838{
830 intel8x0_t *chip = ac97->private_data; 839 struct intel8x0m *chip = ac97->private_data;
831 chip->ac97 = NULL; 840 chip->ac97 = NULL;
832} 841}
833 842
834 843
835static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock) 844static int __devinit snd_intel8x0_mixer(struct intel8x0m *chip, int ac97_clock)
836{ 845{
837 ac97_bus_t *pbus; 846 struct snd_ac97_bus *pbus;
838 ac97_template_t ac97; 847 struct snd_ac97_template ac97;
839 ac97_t *x97; 848 struct snd_ac97 *x97;
840 int err; 849 int err;
841 unsigned int glob_sta = 0; 850 unsigned int glob_sta = 0;
842 static ac97_bus_ops_t ops = { 851 static struct snd_ac97_bus_ops ops = {
843 .write = snd_intel8x0_codec_write, 852 .write = snd_intel8x0_codec_write,
844 .read = snd_intel8x0_codec_read, 853 .read = snd_intel8x0_codec_read,
845 }; 854 };
@@ -880,7 +889,8 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
880 __err: 889 __err:
881 /* clear the cold-reset bit for the next chance */ 890 /* clear the cold-reset bit for the next chance */
882 if (chip->device_type != DEVICE_ALI) 891 if (chip->device_type != DEVICE_ALI)
883 iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD); 892 iputdword(chip, ICHREG(GLOB_CNT),
893 igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD);
884 return err; 894 return err;
885} 895}
886 896
@@ -889,7 +899,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
889 * 899 *
890 */ 900 */
891 901
892static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) 902static int snd_intel8x0m_ich_chip_init(struct intel8x0m *chip, int probing)
893{ 903{
894 unsigned long end_time; 904 unsigned long end_time;
895 unsigned int cnt, status, nstatus; 905 unsigned int cnt, status, nstatus;
@@ -912,7 +922,8 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
912 goto __ok; 922 goto __ok;
913 schedule_timeout_uninterruptible(1); 923 schedule_timeout_uninterruptible(1);
914 } while (time_after_eq(end_time, jiffies)); 924 } while (time_after_eq(end_time, jiffies));
915 snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); 925 snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n",
926 igetdword(chip, ICHREG(GLOB_CNT)));
916 return -EIO; 927 return -EIO;
917 928
918 __ok: 929 __ok:
@@ -923,14 +934,16 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
923 */ 934 */
924 end_time = jiffies + HZ; 935 end_time = jiffies + HZ;
925 do { 936 do {
926 status = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR); 937 status = igetdword(chip, ICHREG(GLOB_STA)) &
938 (ICH_PCR | ICH_SCR | ICH_TCR);
927 if (status) 939 if (status)
928 break; 940 break;
929 schedule_timeout_uninterruptible(1); 941 schedule_timeout_uninterruptible(1);
930 } while (time_after_eq(end_time, jiffies)); 942 } while (time_after_eq(end_time, jiffies));
931 if (! status) { 943 if (! status) {
932 /* no codec is found */ 944 /* no codec is found */
933 snd_printk(KERN_ERR "codec_ready: codec is not ready [0x%x]\n", igetdword(chip, ICHREG(GLOB_STA))); 945 snd_printk(KERN_ERR "codec_ready: codec is not ready [0x%x]\n",
946 igetdword(chip, ICHREG(GLOB_STA)));
934 return -EIO; 947 return -EIO;
935 } 948 }
936 949
@@ -952,7 +965,8 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
952 /* wait until all the probed codecs are ready */ 965 /* wait until all the probed codecs are ready */
953 end_time = jiffies + HZ; 966 end_time = jiffies + HZ;
954 do { 967 do {
955 nstatus = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR); 968 nstatus = igetdword(chip, ICHREG(GLOB_STA)) &
969 (ICH_PCR | ICH_SCR | ICH_TCR);
956 if (status == nstatus) 970 if (status == nstatus)
957 break; 971 break;
958 schedule_timeout_uninterruptible(1); 972 schedule_timeout_uninterruptible(1);
@@ -967,7 +981,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
967 return 0; 981 return 0;
968} 982}
969 983
970static int snd_intel8x0_chip_init(intel8x0_t *chip, int probing) 984static int snd_intel8x0_chip_init(struct intel8x0m *chip, int probing)
971{ 985{
972 unsigned int i; 986 unsigned int i;
973 int err; 987 int err;
@@ -988,7 +1002,7 @@ static int snd_intel8x0_chip_init(intel8x0_t *chip, int probing)
988 return 0; 1002 return 0;
989} 1003}
990 1004
991static int snd_intel8x0_free(intel8x0_t *chip) 1005static int snd_intel8x0_free(struct intel8x0m *chip)
992{ 1006{
993 unsigned int i; 1007 unsigned int i;
994 1008
@@ -1010,7 +1024,7 @@ static int snd_intel8x0_free(intel8x0_t *chip)
1010 if (chip->remap_bmaddr) 1024 if (chip->remap_bmaddr)
1011 iounmap(chip->remap_bmaddr); 1025 iounmap(chip->remap_bmaddr);
1012 if (chip->irq >= 0) 1026 if (chip->irq >= 0)
1013 free_irq(chip->irq, (void *)chip); 1027 free_irq(chip->irq, chip);
1014 pci_release_regions(chip->pci); 1028 pci_release_regions(chip->pci);
1015 pci_disable_device(chip->pci); 1029 pci_disable_device(chip->pci);
1016 kfree(chip); 1030 kfree(chip);
@@ -1021,9 +1035,9 @@ static int snd_intel8x0_free(intel8x0_t *chip)
1021/* 1035/*
1022 * power management 1036 * power management
1023 */ 1037 */
1024static int intel8x0m_suspend(snd_card_t *card, pm_message_t state) 1038static int intel8x0m_suspend(struct snd_card *card, pm_message_t state)
1025{ 1039{
1026 intel8x0_t *chip = card->pm_private_data; 1040 struct intel8x0m *chip = card->pm_private_data;
1027 int i; 1041 int i;
1028 1042
1029 for (i = 0; i < chip->pcm_devs; i++) 1043 for (i = 0; i < chip->pcm_devs; i++)
@@ -1034,9 +1048,9 @@ static int intel8x0m_suspend(snd_card_t *card, pm_message_t state)
1034 return 0; 1048 return 0;
1035} 1049}
1036 1050
1037static int intel8x0m_resume(snd_card_t *card) 1051static int intel8x0m_resume(struct snd_card *card)
1038{ 1052{
1039 intel8x0_t *chip = card->pm_private_data; 1053 struct intel8x0m *chip = card->pm_private_data;
1040 pci_enable_device(chip->pci); 1054 pci_enable_device(chip->pci);
1041 pci_set_master(chip->pci); 1055 pci_set_master(chip->pci);
1042 snd_intel8x0_chip_init(chip, 0); 1056 snd_intel8x0_chip_init(chip, 0);
@@ -1047,17 +1061,18 @@ static int intel8x0m_resume(snd_card_t *card)
1047} 1061}
1048#endif /* CONFIG_PM */ 1062#endif /* CONFIG_PM */
1049 1063
1050static void snd_intel8x0m_proc_read(snd_info_entry_t * entry, 1064static void snd_intel8x0m_proc_read(struct snd_info_entry * entry,
1051 snd_info_buffer_t * buffer) 1065 struct snd_info_buffer *buffer)
1052{ 1066{
1053 intel8x0_t *chip = entry->private_data; 1067 struct intel8x0m *chip = entry->private_data;
1054 unsigned int tmp; 1068 unsigned int tmp;
1055 1069
1056 snd_iprintf(buffer, "Intel8x0m\n\n"); 1070 snd_iprintf(buffer, "Intel8x0m\n\n");
1057 if (chip->device_type == DEVICE_ALI) 1071 if (chip->device_type == DEVICE_ALI)
1058 return; 1072 return;
1059 tmp = igetdword(chip, ICHREG(GLOB_STA)); 1073 tmp = igetdword(chip, ICHREG(GLOB_STA));
1060 snd_iprintf(buffer, "Global control : 0x%08x\n", igetdword(chip, ICHREG(GLOB_CNT))); 1074 snd_iprintf(buffer, "Global control : 0x%08x\n",
1075 igetdword(chip, ICHREG(GLOB_CNT)));
1061 snd_iprintf(buffer, "Global status : 0x%08x\n", tmp); 1076 snd_iprintf(buffer, "Global status : 0x%08x\n", tmp);
1062 snd_iprintf(buffer, "AC'97 codecs ready :%s%s%s%s\n", 1077 snd_iprintf(buffer, "AC'97 codecs ready :%s%s%s%s\n",
1063 tmp & ICH_PCR ? " primary" : "", 1078 tmp & ICH_PCR ? " primary" : "",
@@ -1066,17 +1081,17 @@ static void snd_intel8x0m_proc_read(snd_info_entry_t * entry,
1066 (tmp & (ICH_PCR | ICH_SCR | ICH_TCR)) == 0 ? " none" : ""); 1081 (tmp & (ICH_PCR | ICH_SCR | ICH_TCR)) == 0 ? " none" : "");
1067} 1082}
1068 1083
1069static void __devinit snd_intel8x0m_proc_init(intel8x0_t * chip) 1084static void __devinit snd_intel8x0m_proc_init(struct intel8x0m * chip)
1070{ 1085{
1071 snd_info_entry_t *entry; 1086 struct snd_info_entry *entry;
1072 1087
1073 if (! snd_card_proc_new(chip->card, "intel8x0m", &entry)) 1088 if (! snd_card_proc_new(chip->card, "intel8x0m", &entry))
1074 snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0m_proc_read); 1089 snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0m_proc_read);
1075} 1090}
1076 1091
1077static int snd_intel8x0_dev_free(snd_device_t *device) 1092static int snd_intel8x0_dev_free(struct snd_device *device)
1078{ 1093{
1079 intel8x0_t *chip = device->device_data; 1094 struct intel8x0m *chip = device->device_data;
1080 return snd_intel8x0_free(chip); 1095 return snd_intel8x0_free(chip);
1081} 1096}
1082 1097
@@ -1085,17 +1100,17 @@ struct ich_reg_info {
1085 unsigned int offset; 1100 unsigned int offset;
1086}; 1101};
1087 1102
1088static int __devinit snd_intel8x0m_create(snd_card_t * card, 1103static int __devinit snd_intel8x0m_create(struct snd_card *card,
1089 struct pci_dev *pci, 1104 struct pci_dev *pci,
1090 unsigned long device_type, 1105 unsigned long device_type,
1091 intel8x0_t ** r_intel8x0) 1106 struct intel8x0m ** r_intel8x0)
1092{ 1107{
1093 intel8x0_t *chip; 1108 struct intel8x0m *chip;
1094 int err; 1109 int err;
1095 unsigned int i; 1110 unsigned int i;
1096 unsigned int int_sta_masks; 1111 unsigned int int_sta_masks;
1097 ichdev_t *ichdev; 1112 struct ichdev *ichdev;
1098 static snd_device_ops_t ops = { 1113 static struct snd_device_ops ops = {
1099 .dev_free = snd_intel8x0_dev_free, 1114 .dev_free = snd_intel8x0_dev_free,
1100 }; 1115 };
1101 static struct ich_reg_info intel_regs[2] = { 1116 static struct ich_reg_info intel_regs[2] = {
@@ -1160,7 +1175,8 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
1160 } 1175 }
1161 1176
1162 port_inited: 1177 port_inited:
1163 if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { 1178 if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ,
1179 card->shortname, chip)) {
1164 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1180 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1165 snd_intel8x0_free(chip); 1181 snd_intel8x0_free(chip);
1166 return -EBUSY; 1182 return -EBUSY;
@@ -1259,8 +1275,8 @@ static struct shortname_table {
1259static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, 1275static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
1260 const struct pci_device_id *pci_id) 1276 const struct pci_device_id *pci_id)
1261{ 1277{
1262 snd_card_t *card; 1278 struct snd_card *card;
1263 intel8x0_t *chip; 1279 struct intel8x0m *chip;
1264 int err; 1280 int err;
1265 struct shortname_table *name; 1281 struct shortname_table *name;
1266 1282