aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc/pmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/ppc/pmac.c')
-rw-r--r--sound/ppc/pmac.c202
1 files changed, 104 insertions, 98 deletions
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index dd28187ec0e9..222765fd0dc5 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -37,10 +37,10 @@
37 37
38 38
39#ifdef CONFIG_PM 39#ifdef CONFIG_PM
40static int snd_pmac_register_sleep_notifier(pmac_t *chip); 40static int snd_pmac_register_sleep_notifier(struct snd_pmac *chip);
41static int snd_pmac_unregister_sleep_notifier(pmac_t *chip); 41static int snd_pmac_unregister_sleep_notifier(struct snd_pmac *chip);
42static int snd_pmac_suspend(snd_card_t *card, pm_message_t state); 42static int snd_pmac_suspend(struct snd_card *card, pm_message_t state);
43static int snd_pmac_resume(snd_card_t *card); 43static int snd_pmac_resume(struct snd_card *card);
44#endif 44#endif
45 45
46 46
@@ -56,7 +56,7 @@ static int tumbler_freqs[1] = {
56/* 56/*
57 * allocate DBDMA command arrays 57 * allocate DBDMA command arrays
58 */ 58 */
59static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size) 59static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, int size)
60{ 60{
61 unsigned int rsize = sizeof(struct dbdma_cmd) * (size + 1); 61 unsigned int rsize = sizeof(struct dbdma_cmd) * (size + 1);
62 62
@@ -72,7 +72,7 @@ static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size)
72 return 0; 72 return 0;
73} 73}
74 74
75static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec) 75static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec)
76{ 76{
77 if (rec) { 77 if (rec) {
78 unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); 78 unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1);
@@ -90,7 +90,7 @@ static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec)
90 * look up frequency table 90 * look up frequency table
91 */ 91 */
92 92
93unsigned int snd_pmac_rate_index(pmac_t *chip, pmac_stream_t *rec, unsigned int rate) 93unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec, unsigned int rate)
94{ 94{
95 int i, ok, found; 95 int i, ok, found;
96 96
@@ -119,8 +119,8 @@ static inline int another_stream(int stream)
119/* 119/*
120 * allocate buffers 120 * allocate buffers
121 */ 121 */
122static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs, 122static int snd_pmac_pcm_hw_params(struct snd_pcm_substream *subs,
123 snd_pcm_hw_params_t *hw_params) 123 struct snd_pcm_hw_params *hw_params)
124{ 124{
125 return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params)); 125 return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params));
126} 126}
@@ -128,7 +128,7 @@ static int snd_pmac_pcm_hw_params(snd_pcm_substream_t *subs,
128/* 128/*
129 * release buffers 129 * release buffers
130 */ 130 */
131static int snd_pmac_pcm_hw_free(snd_pcm_substream_t *subs) 131static int snd_pmac_pcm_hw_free(struct snd_pcm_substream *subs)
132{ 132{
133 snd_pcm_lib_free_pages(subs); 133 snd_pcm_lib_free_pages(subs);
134 return 0; 134 return 0;
@@ -137,7 +137,7 @@ static int snd_pmac_pcm_hw_free(snd_pcm_substream_t *subs)
137/* 137/*
138 * get a stream of the opposite direction 138 * get a stream of the opposite direction
139 */ 139 */
140static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream) 140static struct pmac_stream *snd_pmac_get_stream(struct snd_pmac *chip, int stream)
141{ 141{
142 switch (stream) { 142 switch (stream) {
143 case SNDRV_PCM_STREAM_PLAYBACK: 143 case SNDRV_PCM_STREAM_PLAYBACK:
@@ -154,7 +154,7 @@ static pmac_stream_t *snd_pmac_get_stream(pmac_t *chip, int stream)
154 * wait while run status is on 154 * wait while run status is on
155 */ 155 */
156static inline void 156static inline void
157snd_pmac_wait_ack(pmac_stream_t *rec) 157snd_pmac_wait_ack(struct pmac_stream *rec)
158{ 158{
159 int timeout = 50000; 159 int timeout = 50000;
160 while ((in_le32(&rec->dma->status) & RUN) && timeout-- > 0) 160 while ((in_le32(&rec->dma->status) & RUN) && timeout-- > 0)
@@ -165,7 +165,7 @@ snd_pmac_wait_ack(pmac_stream_t *rec)
165 * set the format and rate to the chip. 165 * set the format and rate to the chip.
166 * call the lowlevel function if defined (e.g. for AWACS). 166 * call the lowlevel function if defined (e.g. for AWACS).
167 */ 167 */
168static void snd_pmac_pcm_set_format(pmac_t *chip) 168static void snd_pmac_pcm_set_format(struct snd_pmac *chip)
169{ 169{
170 /* set up frequency and format */ 170 /* set up frequency and format */
171 out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8)); 171 out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8));
@@ -177,7 +177,7 @@ static void snd_pmac_pcm_set_format(pmac_t *chip)
177/* 177/*
178 * stop the DMA transfer 178 * stop the DMA transfer
179 */ 179 */
180static inline void snd_pmac_dma_stop(pmac_stream_t *rec) 180static inline void snd_pmac_dma_stop(struct pmac_stream *rec)
181{ 181{
182 out_le32(&rec->dma->control, (RUN|WAKE|FLUSH|PAUSE) << 16); 182 out_le32(&rec->dma->control, (RUN|WAKE|FLUSH|PAUSE) << 16);
183 snd_pmac_wait_ack(rec); 183 snd_pmac_wait_ack(rec);
@@ -186,7 +186,7 @@ static inline void snd_pmac_dma_stop(pmac_stream_t *rec)
186/* 186/*
187 * set the command pointer address 187 * set the command pointer address
188 */ 188 */
189static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cmd) 189static inline void snd_pmac_dma_set_command(struct pmac_stream *rec, struct pmac_dbdma *cmd)
190{ 190{
191 out_le32(&rec->dma->cmdptr, cmd->addr); 191 out_le32(&rec->dma->cmdptr, cmd->addr);
192} 192}
@@ -194,7 +194,7 @@ static inline void snd_pmac_dma_set_command(pmac_stream_t *rec, pmac_dbdma_t *cm
194/* 194/*
195 * start the DMA 195 * start the DMA
196 */ 196 */
197static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status) 197static inline void snd_pmac_dma_run(struct pmac_stream *rec, int status)
198{ 198{
199 out_le32(&rec->dma->control, status | (status << 16)); 199 out_le32(&rec->dma->control, status | (status << 16));
200} 200}
@@ -203,14 +203,14 @@ static inline void snd_pmac_dma_run(pmac_stream_t *rec, int status)
203/* 203/*
204 * prepare playback/capture stream 204 * prepare playback/capture stream
205 */ 205 */
206static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) 206static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec, struct snd_pcm_substream *subs)
207{ 207{
208 int i; 208 int i;
209 volatile struct dbdma_cmd __iomem *cp; 209 volatile struct dbdma_cmd __iomem *cp;
210 snd_pcm_runtime_t *runtime = subs->runtime; 210 struct snd_pcm_runtime *runtime = subs->runtime;
211 int rate_index; 211 int rate_index;
212 long offset; 212 long offset;
213 pmac_stream_t *astr; 213 struct pmac_stream *astr;
214 214
215 rec->dma_size = snd_pcm_lib_buffer_bytes(subs); 215 rec->dma_size = snd_pcm_lib_buffer_bytes(subs);
216 rec->period_size = snd_pcm_lib_period_bytes(subs); 216 rec->period_size = snd_pcm_lib_period_bytes(subs);
@@ -267,8 +267,8 @@ static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substr
267/* 267/*
268 * PCM trigger/stop 268 * PCM trigger/stop
269 */ 269 */
270static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec, 270static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec,
271 snd_pcm_substream_t *subs, int cmd) 271 struct snd_pcm_substream *subs, int cmd)
272{ 272{
273 volatile struct dbdma_cmd __iomem *cp; 273 volatile struct dbdma_cmd __iomem *cp;
274 int i, command; 274 int i, command;
@@ -314,8 +314,9 @@ static int snd_pmac_pcm_trigger(pmac_t *chip, pmac_stream_t *rec,
314 * return the current pointer 314 * return the current pointer
315 */ 315 */
316inline 316inline
317static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec, 317static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip,
318 snd_pcm_substream_t *subs) 318 struct pmac_stream *rec,
319 struct snd_pcm_substream *subs)
319{ 320{
320 int count = 0; 321 int count = 0;
321 322
@@ -338,22 +339,22 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(pmac_t *chip, pmac_stream_t *rec,
338 * playback 339 * playback
339 */ 340 */
340 341
341static int snd_pmac_playback_prepare(snd_pcm_substream_t *subs) 342static int snd_pmac_playback_prepare(struct snd_pcm_substream *subs)
342{ 343{
343 pmac_t *chip = snd_pcm_substream_chip(subs); 344 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
344 return snd_pmac_pcm_prepare(chip, &chip->playback, subs); 345 return snd_pmac_pcm_prepare(chip, &chip->playback, subs);
345} 346}
346 347
347static int snd_pmac_playback_trigger(snd_pcm_substream_t *subs, 348static int snd_pmac_playback_trigger(struct snd_pcm_substream *subs,
348 int cmd) 349 int cmd)
349{ 350{
350 pmac_t *chip = snd_pcm_substream_chip(subs); 351 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
351 return snd_pmac_pcm_trigger(chip, &chip->playback, subs, cmd); 352 return snd_pmac_pcm_trigger(chip, &chip->playback, subs, cmd);
352} 353}
353 354
354static snd_pcm_uframes_t snd_pmac_playback_pointer(snd_pcm_substream_t *subs) 355static snd_pcm_uframes_t snd_pmac_playback_pointer(struct snd_pcm_substream *subs)
355{ 356{
356 pmac_t *chip = snd_pcm_substream_chip(subs); 357 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
357 return snd_pmac_pcm_pointer(chip, &chip->playback, subs); 358 return snd_pmac_pcm_pointer(chip, &chip->playback, subs);
358} 359}
359 360
@@ -362,22 +363,22 @@ static snd_pcm_uframes_t snd_pmac_playback_pointer(snd_pcm_substream_t *subs)
362 * capture 363 * capture
363 */ 364 */
364 365
365static int snd_pmac_capture_prepare(snd_pcm_substream_t *subs) 366static int snd_pmac_capture_prepare(struct snd_pcm_substream *subs)
366{ 367{
367 pmac_t *chip = snd_pcm_substream_chip(subs); 368 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
368 return snd_pmac_pcm_prepare(chip, &chip->capture, subs); 369 return snd_pmac_pcm_prepare(chip, &chip->capture, subs);
369} 370}
370 371
371static int snd_pmac_capture_trigger(snd_pcm_substream_t *subs, 372static int snd_pmac_capture_trigger(struct snd_pcm_substream *subs,
372 int cmd) 373 int cmd)
373{ 374{
374 pmac_t *chip = snd_pcm_substream_chip(subs); 375 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
375 return snd_pmac_pcm_trigger(chip, &chip->capture, subs, cmd); 376 return snd_pmac_pcm_trigger(chip, &chip->capture, subs, cmd);
376} 377}
377 378
378static snd_pcm_uframes_t snd_pmac_capture_pointer(snd_pcm_substream_t *subs) 379static snd_pcm_uframes_t snd_pmac_capture_pointer(struct snd_pcm_substream *subs)
379{ 380{
380 pmac_t *chip = snd_pcm_substream_chip(subs); 381 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
381 return snd_pmac_pcm_pointer(chip, &chip->capture, subs); 382 return snd_pmac_pcm_pointer(chip, &chip->capture, subs);
382} 383}
383 384
@@ -385,7 +386,7 @@ static snd_pcm_uframes_t snd_pmac_capture_pointer(snd_pcm_substream_t *subs)
385/* 386/*
386 * update playback/capture pointer from interrupts 387 * update playback/capture pointer from interrupts
387 */ 388 */
388static void snd_pmac_pcm_update(pmac_t *chip, pmac_stream_t *rec) 389static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec)
389{ 390{
390 volatile struct dbdma_cmd __iomem *cp; 391 volatile struct dbdma_cmd __iomem *cp;
391 int c; 392 int c;
@@ -421,7 +422,7 @@ static void snd_pmac_pcm_update(pmac_t *chip, pmac_stream_t *rec)
421 * hw info 422 * hw info
422 */ 423 */
423 424
424static snd_pcm_hardware_t snd_pmac_playback = 425static struct snd_pcm_hardware snd_pmac_playback =
425{ 426{
426 .info = (SNDRV_PCM_INFO_INTERLEAVED | 427 .info = (SNDRV_PCM_INFO_INTERLEAVED |
427 SNDRV_PCM_INFO_MMAP | 428 SNDRV_PCM_INFO_MMAP |
@@ -440,7 +441,7 @@ static snd_pcm_hardware_t snd_pmac_playback =
440 .periods_max = PMAC_MAX_FRAGS, 441 .periods_max = PMAC_MAX_FRAGS,
441}; 442};
442 443
443static snd_pcm_hardware_t snd_pmac_capture = 444static struct snd_pcm_hardware snd_pmac_capture =
444{ 445{
445 .info = (SNDRV_PCM_INFO_INTERLEAVED | 446 .info = (SNDRV_PCM_INFO_INTERLEAVED |
446 SNDRV_PCM_INFO_MMAP | 447 SNDRV_PCM_INFO_MMAP |
@@ -461,11 +462,11 @@ static snd_pcm_hardware_t snd_pmac_capture =
461 462
462 463
463#if 0 // NYI 464#if 0 // NYI
464static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, 465static int snd_pmac_hw_rule_rate(struct snd_pcm_hw_params *params,
465 snd_pcm_hw_rule_t *rule) 466 struct snd_pcm_hw_rule *rule)
466{ 467{
467 pmac_t *chip = rule->private; 468 struct snd_pmac *chip = rule->private;
468 pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); 469 struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]);
469 int i, freq_table[8], num_freqs; 470 int i, freq_table[8], num_freqs;
470 471
471 if (! rec) 472 if (! rec)
@@ -480,11 +481,11 @@ static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params,
480 num_freqs, freq_table, 0); 481 num_freqs, freq_table, 0);
481} 482}
482 483
483static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, 484static int snd_pmac_hw_rule_format(struct snd_pcm_hw_params *params,
484 snd_pcm_hw_rule_t *rule) 485 struct snd_pcm_hw_rule *rule)
485{ 486{
486 pmac_t *chip = rule->private; 487 struct snd_pmac *chip = rule->private;
487 pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); 488 struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]);
488 489
489 if (! rec) 490 if (! rec)
490 return -EINVAL; 491 return -EINVAL;
@@ -493,9 +494,10 @@ static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params,
493} 494}
494#endif // NYI 495#endif // NYI
495 496
496static int snd_pmac_pcm_open(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) 497static int snd_pmac_pcm_open(struct snd_pmac *chip, struct pmac_stream *rec,
498 struct snd_pcm_substream *subs)
497{ 499{
498 snd_pcm_runtime_t *runtime = subs->runtime; 500 struct snd_pcm_runtime *runtime = subs->runtime;
499 int i, j, fflags; 501 int i, j, fflags;
500 static int typical_freqs[] = { 502 static int typical_freqs[] = {
501 44100, 503 44100,
@@ -565,9 +567,10 @@ static int snd_pmac_pcm_open(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream
565 return 0; 567 return 0;
566} 568}
567 569
568static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substream_t *subs) 570static int snd_pmac_pcm_close(struct snd_pmac *chip, struct pmac_stream *rec,
571 struct snd_pcm_substream *subs)
569{ 572{
570 pmac_stream_t *astr; 573 struct pmac_stream *astr;
571 574
572 snd_pmac_dma_stop(rec); 575 snd_pmac_dma_stop(rec);
573 576
@@ -582,32 +585,32 @@ static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substrea
582 return 0; 585 return 0;
583} 586}
584 587
585static int snd_pmac_playback_open(snd_pcm_substream_t *subs) 588static int snd_pmac_playback_open(struct snd_pcm_substream *subs)
586{ 589{
587 pmac_t *chip = snd_pcm_substream_chip(subs); 590 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
588 591
589 subs->runtime->hw = snd_pmac_playback; 592 subs->runtime->hw = snd_pmac_playback;
590 return snd_pmac_pcm_open(chip, &chip->playback, subs); 593 return snd_pmac_pcm_open(chip, &chip->playback, subs);
591} 594}
592 595
593static int snd_pmac_capture_open(snd_pcm_substream_t *subs) 596static int snd_pmac_capture_open(struct snd_pcm_substream *subs)
594{ 597{
595 pmac_t *chip = snd_pcm_substream_chip(subs); 598 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
596 599
597 subs->runtime->hw = snd_pmac_capture; 600 subs->runtime->hw = snd_pmac_capture;
598 return snd_pmac_pcm_open(chip, &chip->capture, subs); 601 return snd_pmac_pcm_open(chip, &chip->capture, subs);
599} 602}
600 603
601static int snd_pmac_playback_close(snd_pcm_substream_t *subs) 604static int snd_pmac_playback_close(struct snd_pcm_substream *subs)
602{ 605{
603 pmac_t *chip = snd_pcm_substream_chip(subs); 606 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
604 607
605 return snd_pmac_pcm_close(chip, &chip->playback, subs); 608 return snd_pmac_pcm_close(chip, &chip->playback, subs);
606} 609}
607 610
608static int snd_pmac_capture_close(snd_pcm_substream_t *subs) 611static int snd_pmac_capture_close(struct snd_pcm_substream *subs)
609{ 612{
610 pmac_t *chip = snd_pcm_substream_chip(subs); 613 struct snd_pmac *chip = snd_pcm_substream_chip(subs);
611 614
612 return snd_pmac_pcm_close(chip, &chip->capture, subs); 615 return snd_pmac_pcm_close(chip, &chip->capture, subs);
613} 616}
@@ -615,7 +618,7 @@ static int snd_pmac_capture_close(snd_pcm_substream_t *subs)
615/* 618/*
616 */ 619 */
617 620
618static snd_pcm_ops_t snd_pmac_playback_ops = { 621static struct snd_pcm_ops snd_pmac_playback_ops = {
619 .open = snd_pmac_playback_open, 622 .open = snd_pmac_playback_open,
620 .close = snd_pmac_playback_close, 623 .close = snd_pmac_playback_close,
621 .ioctl = snd_pcm_lib_ioctl, 624 .ioctl = snd_pcm_lib_ioctl,
@@ -626,7 +629,7 @@ static snd_pcm_ops_t snd_pmac_playback_ops = {
626 .pointer = snd_pmac_playback_pointer, 629 .pointer = snd_pmac_playback_pointer,
627}; 630};
628 631
629static snd_pcm_ops_t snd_pmac_capture_ops = { 632static struct snd_pcm_ops snd_pmac_capture_ops = {
630 .open = snd_pmac_capture_open, 633 .open = snd_pmac_capture_open,
631 .close = snd_pmac_capture_close, 634 .close = snd_pmac_capture_close,
632 .ioctl = snd_pcm_lib_ioctl, 635 .ioctl = snd_pcm_lib_ioctl,
@@ -637,9 +640,9 @@ static snd_pcm_ops_t snd_pmac_capture_ops = {
637 .pointer = snd_pmac_capture_pointer, 640 .pointer = snd_pmac_capture_pointer,
638}; 641};
639 642
640int __init snd_pmac_pcm_new(pmac_t *chip) 643int __init snd_pmac_pcm_new(struct snd_pmac *chip)
641{ 644{
642 snd_pcm_t *pcm; 645 struct snd_pcm *pcm;
643 int err; 646 int err;
644 int num_captures = 1; 647 int num_captures = 1;
645 648
@@ -676,7 +679,7 @@ int __init snd_pmac_pcm_new(pmac_t *chip)
676} 679}
677 680
678 681
679static void snd_pmac_dbdma_reset(pmac_t *chip) 682static void snd_pmac_dbdma_reset(struct snd_pmac *chip)
680{ 683{
681 out_le32(&chip->playback.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16); 684 out_le32(&chip->playback.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16);
682 snd_pmac_wait_ack(&chip->playback); 685 snd_pmac_wait_ack(&chip->playback);
@@ -688,9 +691,9 @@ static void snd_pmac_dbdma_reset(pmac_t *chip)
688/* 691/*
689 * handling beep 692 * handling beep
690 */ 693 */
691void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int speed) 694void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long addr, int speed)
692{ 695{
693 pmac_stream_t *rec = &chip->playback; 696 struct pmac_stream *rec = &chip->playback;
694 697
695 snd_pmac_dma_stop(rec); 698 snd_pmac_dma_stop(rec);
696 st_le16(&chip->extra_dma.cmds->req_count, bytes); 699 st_le16(&chip->extra_dma.cmds->req_count, bytes);
@@ -706,7 +709,7 @@ void snd_pmac_beep_dma_start(pmac_t *chip, int bytes, unsigned long addr, int sp
706 snd_pmac_dma_run(rec, RUN); 709 snd_pmac_dma_run(rec, RUN);
707} 710}
708 711
709void snd_pmac_beep_dma_stop(pmac_t *chip) 712void snd_pmac_beep_dma_stop(struct snd_pmac *chip)
710{ 713{
711 snd_pmac_dma_stop(&chip->playback); 714 snd_pmac_dma_stop(&chip->playback);
712 st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); 715 st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP);
@@ -720,7 +723,7 @@ void snd_pmac_beep_dma_stop(pmac_t *chip)
720static irqreturn_t 723static irqreturn_t
721snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs) 724snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs)
722{ 725{
723 pmac_t *chip = devid; 726 struct snd_pmac *chip = devid;
724 snd_pmac_pcm_update(chip, &chip->playback); 727 snd_pmac_pcm_update(chip, &chip->playback);
725 return IRQ_HANDLED; 728 return IRQ_HANDLED;
726} 729}
@@ -729,7 +732,7 @@ snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs)
729static irqreturn_t 732static irqreturn_t
730snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs) 733snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs)
731{ 734{
732 pmac_t *chip = devid; 735 struct snd_pmac *chip = devid;
733 snd_pmac_pcm_update(chip, &chip->capture); 736 snd_pmac_pcm_update(chip, &chip->capture);
734 return IRQ_HANDLED; 737 return IRQ_HANDLED;
735} 738}
@@ -738,7 +741,7 @@ snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs)
738static irqreturn_t 741static irqreturn_t
739snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) 742snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs)
740{ 743{
741 pmac_t *chip = devid; 744 struct snd_pmac *chip = devid;
742 int ctrl = in_le32(&chip->awacs->control); 745 int ctrl = in_le32(&chip->awacs->control);
743 746
744 /*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/ 747 /*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/
@@ -761,7 +764,7 @@ snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs)
761/* 764/*
762 * a wrapper to feature call for compatibility 765 * a wrapper to feature call for compatibility
763 */ 766 */
764static void snd_pmac_sound_feature(pmac_t *chip, int enable) 767static void snd_pmac_sound_feature(struct snd_pmac *chip, int enable)
765{ 768{
766 if (ppc_md.feature_call) 769 if (ppc_md.feature_call)
767 ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); 770 ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable);
@@ -771,7 +774,7 @@ static void snd_pmac_sound_feature(pmac_t *chip, int enable)
771 * release resources 774 * release resources
772 */ 775 */
773 776
774static int snd_pmac_free(pmac_t *chip) 777static int snd_pmac_free(struct snd_pmac *chip)
775{ 778{
776 /* stop sounds */ 779 /* stop sounds */
777 if (chip->initialized) { 780 if (chip->initialized) {
@@ -836,9 +839,9 @@ static int snd_pmac_free(pmac_t *chip)
836/* 839/*
837 * free the device 840 * free the device
838 */ 841 */
839static int snd_pmac_dev_free(snd_device_t *device) 842static int snd_pmac_dev_free(struct snd_device *device)
840{ 843{
841 pmac_t *chip = device->device_data; 844 struct snd_pmac *chip = device->device_data;
842 return snd_pmac_free(chip); 845 return snd_pmac_free(chip);
843} 846}
844 847
@@ -847,7 +850,7 @@ static int snd_pmac_dev_free(snd_device_t *device)
847 * check the machine support byteswap (little-endian) 850 * check the machine support byteswap (little-endian)
848 */ 851 */
849 852
850static void __init detect_byte_swap(pmac_t *chip) 853static void __init detect_byte_swap(struct snd_pmac *chip)
851{ 854{
852 struct device_node *mio; 855 struct device_node *mio;
853 856
@@ -873,7 +876,7 @@ static void __init detect_byte_swap(pmac_t *chip)
873/* 876/*
874 * detect a sound chip 877 * detect a sound chip
875 */ 878 */
876static int __init snd_pmac_detect(pmac_t *chip) 879static int __init snd_pmac_detect(struct snd_pmac *chip)
877{ 880{
878 struct device_node *sound = NULL; 881 struct device_node *sound = NULL;
879 unsigned int *prop, l; 882 unsigned int *prop, l;
@@ -1061,8 +1064,8 @@ static int __init snd_pmac_detect(pmac_t *chip)
1061/* 1064/*
1062 * exported - boolean info callbacks for ease of programming 1065 * exported - boolean info callbacks for ease of programming
1063 */ 1066 */
1064int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, 1067int snd_pmac_boolean_stereo_info(struct snd_kcontrol *kcontrol,
1065 snd_ctl_elem_info_t *uinfo) 1068 struct snd_ctl_elem_info *uinfo)
1066{ 1069{
1067 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1070 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1068 uinfo->count = 2; 1071 uinfo->count = 2;
@@ -1071,8 +1074,8 @@ int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol,
1071 return 0; 1074 return 0;
1072} 1075}
1073 1076
1074int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, 1077int snd_pmac_boolean_mono_info(struct snd_kcontrol *kcontrol,
1075 snd_ctl_elem_info_t *uinfo) 1078 struct snd_ctl_elem_info *uinfo)
1076{ 1079{
1077 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1080 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1078 uinfo->count = 1; 1081 uinfo->count = 1;
@@ -1085,16 +1088,18 @@ int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol,
1085/* 1088/*
1086 * auto-mute 1089 * auto-mute
1087 */ 1090 */
1088static int pmac_auto_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1091static int pmac_auto_mute_get(struct snd_kcontrol *kcontrol,
1092 struct snd_ctl_elem_value *ucontrol)
1089{ 1093{
1090 pmac_t *chip = snd_kcontrol_chip(kcontrol); 1094 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
1091 ucontrol->value.integer.value[0] = chip->auto_mute; 1095 ucontrol->value.integer.value[0] = chip->auto_mute;
1092 return 0; 1096 return 0;
1093} 1097}
1094 1098
1095static int pmac_auto_mute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1099static int pmac_auto_mute_put(struct snd_kcontrol *kcontrol,
1100 struct snd_ctl_elem_value *ucontrol)
1096{ 1101{
1097 pmac_t *chip = snd_kcontrol_chip(kcontrol); 1102 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
1098 if (ucontrol->value.integer.value[0] != chip->auto_mute) { 1103 if (ucontrol->value.integer.value[0] != chip->auto_mute) {
1099 chip->auto_mute = ucontrol->value.integer.value[0]; 1104 chip->auto_mute = ucontrol->value.integer.value[0];
1100 if (chip->update_automute) 1105 if (chip->update_automute)
@@ -1104,9 +1109,10 @@ static int pmac_auto_mute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
1104 return 0; 1109 return 0;
1105} 1110}
1106 1111
1107static int pmac_hp_detect_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1112static int pmac_hp_detect_get(struct snd_kcontrol *kcontrol,
1113 struct snd_ctl_elem_value *ucontrol)
1108{ 1114{
1109 pmac_t *chip = snd_kcontrol_chip(kcontrol); 1115 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
1110 if (chip->detect_headphone) 1116 if (chip->detect_headphone)
1111 ucontrol->value.integer.value[0] = chip->detect_headphone(chip); 1117 ucontrol->value.integer.value[0] = chip->detect_headphone(chip);
1112 else 1118 else
@@ -1114,7 +1120,7 @@ static int pmac_hp_detect_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
1114 return 0; 1120 return 0;
1115} 1121}
1116 1122
1117static snd_kcontrol_new_t auto_mute_controls[] __initdata = { 1123static struct snd_kcontrol_new auto_mute_controls[] __initdata = {
1118 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1124 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1119 .name = "Auto Mute Switch", 1125 .name = "Auto Mute Switch",
1120 .info = snd_pmac_boolean_mono_info, 1126 .info = snd_pmac_boolean_mono_info,
@@ -1129,7 +1135,7 @@ static snd_kcontrol_new_t auto_mute_controls[] __initdata = {
1129 }, 1135 },
1130}; 1136};
1131 1137
1132int __init snd_pmac_add_automute(pmac_t *chip) 1138int __init snd_pmac_add_automute(struct snd_pmac *chip)
1133{ 1139{
1134 int err; 1140 int err;
1135 chip->auto_mute = 1; 1141 chip->auto_mute = 1;
@@ -1146,13 +1152,13 @@ int __init snd_pmac_add_automute(pmac_t *chip)
1146/* 1152/*
1147 * create and detect a pmac chip record 1153 * create and detect a pmac chip record
1148 */ 1154 */
1149int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) 1155int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1150{ 1156{
1151 pmac_t *chip; 1157 struct snd_pmac *chip;
1152 struct device_node *np; 1158 struct device_node *np;
1153 int i, err; 1159 int i, err;
1154 unsigned long ctrl_addr, txdma_addr, rxdma_addr; 1160 unsigned long ctrl_addr, txdma_addr, rxdma_addr;
1155 static snd_device_ops_t ops = { 1161 static struct snd_device_ops ops = {
1156 .dev_free = snd_pmac_dev_free, 1162 .dev_free = snd_pmac_dev_free,
1157 }; 1163 };
1158 1164
@@ -1322,9 +1328,9 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return)
1322 * Save state when going to sleep, restore it afterwards. 1328 * Save state when going to sleep, restore it afterwards.
1323 */ 1329 */
1324 1330
1325static int snd_pmac_suspend(snd_card_t *card, pm_message_t state) 1331static int snd_pmac_suspend(struct snd_card *card, pm_message_t state)
1326{ 1332{
1327 pmac_t *chip = card->pm_private_data; 1333 struct snd_pmac *chip = card->pm_private_data;
1328 unsigned long flags; 1334 unsigned long flags;
1329 1335
1330 if (chip->suspend) 1336 if (chip->suspend)
@@ -1343,9 +1349,9 @@ static int snd_pmac_suspend(snd_card_t *card, pm_message_t state)
1343 return 0; 1349 return 0;
1344} 1350}
1345 1351
1346static int snd_pmac_resume(snd_card_t *card) 1352static int snd_pmac_resume(struct snd_card *card)
1347{ 1353{
1348 pmac_t *chip = card->pm_private_data; 1354 struct snd_pmac *chip = card->pm_private_data;
1349 1355
1350 snd_pmac_sound_feature(chip, 1); 1356 snd_pmac_sound_feature(chip, 1);
1351 if (chip->resume) 1357 if (chip->resume)
@@ -1372,11 +1378,11 @@ static int snd_pmac_resume(snd_card_t *card)
1372/* the chip is stored statically by snd_pmac_register_sleep_notifier 1378/* the chip is stored statically by snd_pmac_register_sleep_notifier
1373 * because we can't have any private data for notify callback. 1379 * because we can't have any private data for notify callback.
1374 */ 1380 */
1375static pmac_t *sleeping_pmac = NULL; 1381static struct snd_pmac *sleeping_pmac = NULL;
1376 1382
1377static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when) 1383static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when)
1378{ 1384{
1379 pmac_t *chip; 1385 struct snd_pmac *chip;
1380 1386
1381 chip = sleeping_pmac; 1387 chip = sleeping_pmac;
1382 if (! chip) 1388 if (! chip)
@@ -1397,7 +1403,7 @@ static struct pmu_sleep_notifier snd_pmac_sleep_notifier = {
1397 snd_pmac_sleep_notify, SLEEP_LEVEL_SOUND, 1403 snd_pmac_sleep_notify, SLEEP_LEVEL_SOUND,
1398}; 1404};
1399 1405
1400static int __init snd_pmac_register_sleep_notifier(pmac_t *chip) 1406static int __init snd_pmac_register_sleep_notifier(struct snd_pmac *chip)
1401{ 1407{
1402 /* should be protected here.. */ 1408 /* should be protected here.. */
1403 snd_assert(! sleeping_pmac, return -EBUSY); 1409 snd_assert(! sleeping_pmac, return -EBUSY);
@@ -1406,7 +1412,7 @@ static int __init snd_pmac_register_sleep_notifier(pmac_t *chip)
1406 return 0; 1412 return 0;
1407} 1413}
1408 1414
1409static int snd_pmac_unregister_sleep_notifier(pmac_t *chip) 1415static int snd_pmac_unregister_sleep_notifier(struct snd_pmac *chip)
1410{ 1416{
1411 /* should be protected here.. */ 1417 /* should be protected here.. */
1412 snd_assert(sleeping_pmac == chip, return -ENODEV); 1418 snd_assert(sleeping_pmac == chip, return -ENODEV);