aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652/hdspm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/rme9652/hdspm.c')
-rw-r--r--sound/pci/rme9652/hdspm.c592
1 files changed, 294 insertions, 298 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index ae2013a8492d..3dec616bad6b 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -318,25 +318,22 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
318#define HDSPM_DMA_AREA_BYTES (HDSPM_MAX_CHANNELS * HDSPM_CHANNEL_BUFFER_BYTES) 318#define HDSPM_DMA_AREA_BYTES (HDSPM_MAX_CHANNELS * HDSPM_CHANNEL_BUFFER_BYTES)
319#define HDSPM_DMA_AREA_KILOBYTES (HDSPM_DMA_AREA_BYTES/1024) 319#define HDSPM_DMA_AREA_KILOBYTES (HDSPM_DMA_AREA_BYTES/1024)
320 320
321typedef struct _hdspm hdspm_t; 321struct hdspm_midi {
322typedef struct _hdspm_midi hdspm_midi_t; 322 struct hdspm *hdspm;
323
324struct _hdspm_midi {
325 hdspm_t *hdspm;
326 int id; 323 int id;
327 snd_rawmidi_t *rmidi; 324 struct snd_rawmidi *rmidi;
328 snd_rawmidi_substream_t *input; 325 struct snd_rawmidi_substream *input;
329 snd_rawmidi_substream_t *output; 326 struct snd_rawmidi_substream *output;
330 char istimer; /* timer in use */ 327 char istimer; /* timer in use */
331 struct timer_list timer; 328 struct timer_list timer;
332 spinlock_t lock; 329 spinlock_t lock;
333 int pending; 330 int pending;
334}; 331};
335 332
336struct _hdspm { 333struct hdspm {
337 spinlock_t lock; 334 spinlock_t lock;
338 snd_pcm_substream_t *capture_substream; /* only one playback */ 335 struct snd_pcm_substream *capture_substream; /* only one playback */
339 snd_pcm_substream_t *playback_substream; /* and/or capture stream */ 336 struct snd_pcm_substream *playback_substream; /* and/or capture stream */
340 337
341 char *card_name; /* for procinfo */ 338 char *card_name; /* for procinfo */
342 unsigned short firmware_rev; /* dont know if relevant */ 339 unsigned short firmware_rev; /* dont know if relevant */
@@ -347,7 +344,7 @@ struct _hdspm {
347 u32 control_register; /* cached value */ 344 u32 control_register; /* cached value */
348 u32 control2_register; /* cached value */ 345 u32 control2_register; /* cached value */
349 346
350 hdspm_midi_t midi[2]; 347 struct hdspm_midi midi[2];
351 struct tasklet_struct midi_tasklet; 348 struct tasklet_struct midi_tasklet;
352 349
353 size_t period_bytes; 350 size_t period_bytes;
@@ -375,15 +372,15 @@ struct _hdspm {
375 372
376 int irq_count; /* for debug */ 373 int irq_count; /* for debug */
377 374
378 snd_card_t *card; /* one card */ 375 struct snd_card *card; /* one card */
379 snd_pcm_t *pcm; /* has one pcm */ 376 struct snd_pcm *pcm; /* has one pcm */
380 snd_hwdep_t *hwdep; /* and a hwdep for additional ioctl */ 377 struct snd_hwdep *hwdep; /* and a hwdep for additional ioctl */
381 struct pci_dev *pci; /* and an pci info */ 378 struct pci_dev *pci; /* and an pci info */
382 379
383 /* Mixer vars */ 380 /* Mixer vars */
384 snd_kcontrol_t *playback_mixer_ctls[HDSPM_MAX_CHANNELS]; /* fast alsa mixer */ 381 struct snd_kcontrol *playback_mixer_ctls[HDSPM_MAX_CHANNELS]; /* fast alsa mixer */
385 snd_kcontrol_t *input_mixer_ctls[HDSPM_MAX_CHANNELS]; /* but input to much, so not used */ 382 struct snd_kcontrol *input_mixer_ctls[HDSPM_MAX_CHANNELS]; /* but input to much, so not used */
386 hdspm_mixer_t *mixer; /* full mixer accessable over mixer ioctl or hwdep-device */ 383 struct hdspm_mixer *mixer; /* full mixer accessable over mixer ioctl or hwdep-device */
387 384
388}; 385};
389 386
@@ -444,28 +441,28 @@ static struct pci_device_id snd_hdspm_ids[] = {
444MODULE_DEVICE_TABLE(pci, snd_hdspm_ids); 441MODULE_DEVICE_TABLE(pci, snd_hdspm_ids);
445 442
446/* prototypes */ 443/* prototypes */
447static int __devinit snd_hdspm_create_alsa_devices(snd_card_t * card, 444static int __devinit snd_hdspm_create_alsa_devices(struct snd_card *card,
448 hdspm_t * hdspm); 445 struct hdspm * hdspm);
449static int __devinit snd_hdspm_create_pcm(snd_card_t * card, 446static int __devinit snd_hdspm_create_pcm(struct snd_card *card,
450 hdspm_t * hdspm); 447 struct hdspm * hdspm);
451 448
452static inline void snd_hdspm_initialize_midi_flush(hdspm_t * hdspm); 449static inline void snd_hdspm_initialize_midi_flush(struct hdspm * hdspm);
453static int hdspm_update_simple_mixer_controls(hdspm_t * hdspm); 450static int hdspm_update_simple_mixer_controls(struct hdspm * hdspm);
454static int hdspm_autosync_ref(hdspm_t * hdspm); 451static int hdspm_autosync_ref(struct hdspm * hdspm);
455static int snd_hdspm_set_defaults(hdspm_t * hdspm); 452static int snd_hdspm_set_defaults(struct hdspm * hdspm);
456static void hdspm_set_sgbuf(hdspm_t * hdspm, struct snd_sg_buf *sgbuf, 453static void hdspm_set_sgbuf(struct hdspm * hdspm, struct snd_sg_buf *sgbuf,
457 unsigned int reg, int channels); 454 unsigned int reg, int channels);
458 455
459/* Write/read to/from HDSPM with Adresses in Bytes 456/* Write/read to/from HDSPM with Adresses in Bytes
460 not words but only 32Bit writes are allowed */ 457 not words but only 32Bit writes are allowed */
461 458
462static inline void hdspm_write(hdspm_t * hdspm, unsigned int reg, 459static inline void hdspm_write(struct hdspm * hdspm, unsigned int reg,
463 unsigned int val) 460 unsigned int val)
464{ 461{
465 writel(val, hdspm->iobase + reg); 462 writel(val, hdspm->iobase + reg);
466} 463}
467 464
468static inline unsigned int hdspm_read(hdspm_t * hdspm, unsigned int reg) 465static inline unsigned int hdspm_read(struct hdspm * hdspm, unsigned int reg)
469{ 466{
470 return readl(hdspm->iobase + reg); 467 return readl(hdspm->iobase + reg);
471} 468}
@@ -474,7 +471,7 @@ static inline unsigned int hdspm_read(hdspm_t * hdspm, unsigned int reg)
474 mixer is write only on hardware so we have to cache him for read 471 mixer is write only on hardware so we have to cache him for read
475 each fader is a u32, but uses only the first 16 bit */ 472 each fader is a u32, but uses only the first 16 bit */
476 473
477static inline int hdspm_read_in_gain(hdspm_t * hdspm, unsigned int chan, 474static inline int hdspm_read_in_gain(struct hdspm * hdspm, unsigned int chan,
478 unsigned int in) 475 unsigned int in)
479{ 476{
480 if (chan > HDSPM_MIXER_CHANNELS || in > HDSPM_MIXER_CHANNELS) 477 if (chan > HDSPM_MIXER_CHANNELS || in > HDSPM_MIXER_CHANNELS)
@@ -483,7 +480,7 @@ static inline int hdspm_read_in_gain(hdspm_t * hdspm, unsigned int chan,
483 return hdspm->mixer->ch[chan].in[in]; 480 return hdspm->mixer->ch[chan].in[in];
484} 481}
485 482
486static inline int hdspm_read_pb_gain(hdspm_t * hdspm, unsigned int chan, 483static inline int hdspm_read_pb_gain(struct hdspm * hdspm, unsigned int chan,
487 unsigned int pb) 484 unsigned int pb)
488{ 485{
489 if (chan > HDSPM_MIXER_CHANNELS || pb > HDSPM_MIXER_CHANNELS) 486 if (chan > HDSPM_MIXER_CHANNELS || pb > HDSPM_MIXER_CHANNELS)
@@ -491,7 +488,7 @@ static inline int hdspm_read_pb_gain(hdspm_t * hdspm, unsigned int chan,
491 return hdspm->mixer->ch[chan].pb[pb]; 488 return hdspm->mixer->ch[chan].pb[pb];
492} 489}
493 490
494static inline int hdspm_write_in_gain(hdspm_t * hdspm, unsigned int chan, 491static inline int hdspm_write_in_gain(struct hdspm * hdspm, unsigned int chan,
495 unsigned int in, unsigned short data) 492 unsigned int in, unsigned short data)
496{ 493{
497 if (chan >= HDSPM_MIXER_CHANNELS || in >= HDSPM_MIXER_CHANNELS) 494 if (chan >= HDSPM_MIXER_CHANNELS || in >= HDSPM_MIXER_CHANNELS)
@@ -504,7 +501,7 @@ static inline int hdspm_write_in_gain(hdspm_t * hdspm, unsigned int chan,
504 return 0; 501 return 0;
505} 502}
506 503
507static inline int hdspm_write_pb_gain(hdspm_t * hdspm, unsigned int chan, 504static inline int hdspm_write_pb_gain(struct hdspm * hdspm, unsigned int chan,
508 unsigned int pb, unsigned short data) 505 unsigned int pb, unsigned short data)
509{ 506{
510 if (chan >= HDSPM_MIXER_CHANNELS || pb >= HDSPM_MIXER_CHANNELS) 507 if (chan >= HDSPM_MIXER_CHANNELS || pb >= HDSPM_MIXER_CHANNELS)
@@ -519,18 +516,18 @@ static inline int hdspm_write_pb_gain(hdspm_t * hdspm, unsigned int chan,
519 516
520 517
521/* enable DMA for specific channels, now available for DSP-MADI */ 518/* enable DMA for specific channels, now available for DSP-MADI */
522static inline void snd_hdspm_enable_in(hdspm_t * hdspm, int i, int v) 519static inline void snd_hdspm_enable_in(struct hdspm * hdspm, int i, int v)
523{ 520{
524 hdspm_write(hdspm, HDSPM_inputEnableBase + (4 * i), v); 521 hdspm_write(hdspm, HDSPM_inputEnableBase + (4 * i), v);
525} 522}
526 523
527static inline void snd_hdspm_enable_out(hdspm_t * hdspm, int i, int v) 524static inline void snd_hdspm_enable_out(struct hdspm * hdspm, int i, int v)
528{ 525{
529 hdspm_write(hdspm, HDSPM_outputEnableBase + (4 * i), v); 526 hdspm_write(hdspm, HDSPM_outputEnableBase + (4 * i), v);
530} 527}
531 528
532/* check if same process is writing and reading */ 529/* check if same process is writing and reading */
533static inline int snd_hdspm_use_is_exclusive(hdspm_t * hdspm) 530static inline int snd_hdspm_use_is_exclusive(struct hdspm * hdspm)
534{ 531{
535 unsigned long flags; 532 unsigned long flags;
536 int ret = 1; 533 int ret = 1;
@@ -545,7 +542,7 @@ static inline int snd_hdspm_use_is_exclusive(hdspm_t * hdspm)
545} 542}
546 543
547/* check for external sample rate */ 544/* check for external sample rate */
548static inline int hdspm_external_sample_rate(hdspm_t * hdspm) 545static inline int hdspm_external_sample_rate(struct hdspm * hdspm)
549{ 546{
550 unsigned int status2 = hdspm_read(hdspm, HDSPM_statusRegister2); 547 unsigned int status2 = hdspm_read(hdspm, HDSPM_statusRegister2);
551 unsigned int status = hdspm_read(hdspm, HDSPM_statusRegister); 548 unsigned int status = hdspm_read(hdspm, HDSPM_statusRegister);
@@ -630,13 +627,13 @@ static inline int hdspm_external_sample_rate(hdspm_t * hdspm)
630} 627}
631 628
632/* Latency function */ 629/* Latency function */
633static inline void hdspm_compute_period_size(hdspm_t * hdspm) 630static inline void hdspm_compute_period_size(struct hdspm * hdspm)
634{ 631{
635 hdspm->period_bytes = 632 hdspm->period_bytes =
636 1 << ((hdspm_decode_latency(hdspm->control_register) + 8)); 633 1 << ((hdspm_decode_latency(hdspm->control_register) + 8));
637} 634}
638 635
639static snd_pcm_uframes_t hdspm_hw_pointer(hdspm_t * hdspm) 636static snd_pcm_uframes_t hdspm_hw_pointer(struct hdspm * hdspm)
640{ 637{
641 int position; 638 int position;
642 639
@@ -660,20 +657,20 @@ static snd_pcm_uframes_t hdspm_hw_pointer(hdspm_t * hdspm)
660} 657}
661 658
662 659
663static inline void hdspm_start_audio(hdspm_t * s) 660static inline void hdspm_start_audio(struct hdspm * s)
664{ 661{
665 s->control_register |= (HDSPM_AudioInterruptEnable | HDSPM_Start); 662 s->control_register |= (HDSPM_AudioInterruptEnable | HDSPM_Start);
666 hdspm_write(s, HDSPM_controlRegister, s->control_register); 663 hdspm_write(s, HDSPM_controlRegister, s->control_register);
667} 664}
668 665
669static inline void hdspm_stop_audio(hdspm_t * s) 666static inline void hdspm_stop_audio(struct hdspm * s)
670{ 667{
671 s->control_register &= ~(HDSPM_Start | HDSPM_AudioInterruptEnable); 668 s->control_register &= ~(HDSPM_Start | HDSPM_AudioInterruptEnable);
672 hdspm_write(s, HDSPM_controlRegister, s->control_register); 669 hdspm_write(s, HDSPM_controlRegister, s->control_register);
673} 670}
674 671
675/* should I silence all or only opened ones ? doit all for first even is 4MB*/ 672/* should I silence all or only opened ones ? doit all for first even is 4MB*/
676static inline void hdspm_silence_playback(hdspm_t * hdspm) 673static inline void hdspm_silence_playback(struct hdspm * hdspm)
677{ 674{
678 int i; 675 int i;
679 int n = hdspm->period_bytes; 676 int n = hdspm->period_bytes;
@@ -687,7 +684,7 @@ static inline void hdspm_silence_playback(hdspm_t * hdspm)
687 } 684 }
688} 685}
689 686
690static int hdspm_set_interrupt_interval(hdspm_t * s, unsigned int frames) 687static int hdspm_set_interrupt_interval(struct hdspm * s, unsigned int frames)
691{ 688{
692 int n; 689 int n;
693 690
@@ -713,7 +710,7 @@ static int hdspm_set_interrupt_interval(hdspm_t * s, unsigned int frames)
713 710
714 711
715/* dummy set rate lets see what happens */ 712/* dummy set rate lets see what happens */
716static int hdspm_set_rate(hdspm_t * hdspm, int rate, int called_internally) 713static int hdspm_set_rate(struct hdspm * hdspm, int rate, int called_internally)
717{ 714{
718 int reject_if_open = 0; 715 int reject_if_open = 0;
719 int current_rate; 716 int current_rate;
@@ -838,7 +835,7 @@ static int hdspm_set_rate(hdspm_t * hdspm, int rate, int called_internally)
838} 835}
839 836
840/* mainly for init to 0 on load */ 837/* mainly for init to 0 on load */
841static void all_in_all_mixer(hdspm_t * hdspm, int sgain) 838static void all_in_all_mixer(struct hdspm * hdspm, int sgain)
842{ 839{
843 int i, j; 840 int i, j;
844 unsigned int gain = 841 unsigned int gain =
@@ -855,7 +852,7 @@ static void all_in_all_mixer(hdspm_t * hdspm, int sgain)
855 MIDI 852 MIDI
856 ----------------------------------------------------------------------------*/ 853 ----------------------------------------------------------------------------*/
857 854
858static inline unsigned char snd_hdspm_midi_read_byte (hdspm_t *hdspm, int id) 855static inline unsigned char snd_hdspm_midi_read_byte (struct hdspm *hdspm, int id)
859{ 856{
860 /* the hardware already does the relevant bit-mask with 0xff */ 857 /* the hardware already does the relevant bit-mask with 0xff */
861 if (id) 858 if (id)
@@ -864,7 +861,7 @@ static inline unsigned char snd_hdspm_midi_read_byte (hdspm_t *hdspm, int id)
864 return hdspm_read(hdspm, HDSPM_midiDataIn0); 861 return hdspm_read(hdspm, HDSPM_midiDataIn0);
865} 862}
866 863
867static inline void snd_hdspm_midi_write_byte (hdspm_t *hdspm, int id, int val) 864static inline void snd_hdspm_midi_write_byte (struct hdspm *hdspm, int id, int val)
868{ 865{
869 /* the hardware already does the relevant bit-mask with 0xff */ 866 /* the hardware already does the relevant bit-mask with 0xff */
870 if (id) 867 if (id)
@@ -873,7 +870,7 @@ static inline void snd_hdspm_midi_write_byte (hdspm_t *hdspm, int id, int val)
873 return hdspm_write(hdspm, HDSPM_midiDataOut0, val); 870 return hdspm_write(hdspm, HDSPM_midiDataOut0, val);
874} 871}
875 872
876static inline int snd_hdspm_midi_input_available (hdspm_t *hdspm, int id) 873static inline int snd_hdspm_midi_input_available (struct hdspm *hdspm, int id)
877{ 874{
878 if (id) 875 if (id)
879 return (hdspm_read(hdspm, HDSPM_midiStatusIn1) & 0xff); 876 return (hdspm_read(hdspm, HDSPM_midiStatusIn1) & 0xff);
@@ -881,7 +878,7 @@ static inline int snd_hdspm_midi_input_available (hdspm_t *hdspm, int id)
881 return (hdspm_read(hdspm, HDSPM_midiStatusIn0) & 0xff); 878 return (hdspm_read(hdspm, HDSPM_midiStatusIn0) & 0xff);
882} 879}
883 880
884static inline int snd_hdspm_midi_output_possible (hdspm_t *hdspm, int id) 881static inline int snd_hdspm_midi_output_possible (struct hdspm *hdspm, int id)
885{ 882{
886 int fifo_bytes_used; 883 int fifo_bytes_used;
887 884
@@ -896,13 +893,13 @@ static inline int snd_hdspm_midi_output_possible (hdspm_t *hdspm, int id)
896 return 0; 893 return 0;
897} 894}
898 895
899static inline void snd_hdspm_flush_midi_input (hdspm_t *hdspm, int id) 896static inline void snd_hdspm_flush_midi_input (struct hdspm *hdspm, int id)
900{ 897{
901 while (snd_hdspm_midi_input_available (hdspm, id)) 898 while (snd_hdspm_midi_input_available (hdspm, id))
902 snd_hdspm_midi_read_byte (hdspm, id); 899 snd_hdspm_midi_read_byte (hdspm, id);
903} 900}
904 901
905static int snd_hdspm_midi_output_write (hdspm_midi_t *hmidi) 902static int snd_hdspm_midi_output_write (struct hdspm_midi *hmidi)
906{ 903{
907 unsigned long flags; 904 unsigned long flags;
908 int n_pending; 905 int n_pending;
@@ -930,7 +927,7 @@ static int snd_hdspm_midi_output_write (hdspm_midi_t *hmidi)
930 return 0; 927 return 0;
931} 928}
932 929
933static int snd_hdspm_midi_input_read (hdspm_midi_t *hmidi) 930static int snd_hdspm_midi_input_read (struct hdspm_midi *hmidi)
934{ 931{
935 unsigned char buf[128]; /* this buffer is designed to match the MIDI input FIFO size */ 932 unsigned char buf[128]; /* this buffer is designed to match the MIDI input FIFO size */
936 unsigned long flags; 933 unsigned long flags;
@@ -967,14 +964,14 @@ static int snd_hdspm_midi_input_read (hdspm_midi_t *hmidi)
967 return snd_hdspm_midi_output_write (hmidi); 964 return snd_hdspm_midi_output_write (hmidi);
968} 965}
969 966
970static void snd_hdspm_midi_input_trigger(snd_rawmidi_substream_t * substream, int up) 967static void snd_hdspm_midi_input_trigger(struct snd_rawmidi_substream *substream, int up)
971{ 968{
972 hdspm_t *hdspm; 969 struct hdspm *hdspm;
973 hdspm_midi_t *hmidi; 970 struct hdspm_midi *hmidi;
974 unsigned long flags; 971 unsigned long flags;
975 u32 ie; 972 u32 ie;
976 973
977 hmidi = (hdspm_midi_t *) substream->rmidi->private_data; 974 hmidi = (struct hdspm_midi *) substream->rmidi->private_data;
978 hdspm = hmidi->hdspm; 975 hdspm = hmidi->hdspm;
979 ie = hmidi->id ? HDSPM_Midi1InterruptEnable : HDSPM_Midi0InterruptEnable; 976 ie = hmidi->id ? HDSPM_Midi1InterruptEnable : HDSPM_Midi0InterruptEnable;
980 spin_lock_irqsave (&hdspm->lock, flags); 977 spin_lock_irqsave (&hdspm->lock, flags);
@@ -993,7 +990,7 @@ static void snd_hdspm_midi_input_trigger(snd_rawmidi_substream_t * substream, in
993 990
994static void snd_hdspm_midi_output_timer(unsigned long data) 991static void snd_hdspm_midi_output_timer(unsigned long data)
995{ 992{
996 hdspm_midi_t *hmidi = (hdspm_midi_t *) data; 993 struct hdspm_midi *hmidi = (struct hdspm_midi *) data;
997 unsigned long flags; 994 unsigned long flags;
998 995
999 snd_hdspm_midi_output_write(hmidi); 996 snd_hdspm_midi_output_write(hmidi);
@@ -1013,12 +1010,12 @@ static void snd_hdspm_midi_output_timer(unsigned long data)
1013 spin_unlock_irqrestore (&hmidi->lock, flags); 1010 spin_unlock_irqrestore (&hmidi->lock, flags);
1014} 1011}
1015 1012
1016static void snd_hdspm_midi_output_trigger(snd_rawmidi_substream_t * substream, int up) 1013static void snd_hdspm_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
1017{ 1014{
1018 hdspm_midi_t *hmidi; 1015 struct hdspm_midi *hmidi;
1019 unsigned long flags; 1016 unsigned long flags;
1020 1017
1021 hmidi = (hdspm_midi_t *) substream->rmidi->private_data; 1018 hmidi = (struct hdspm_midi *) substream->rmidi->private_data;
1022 spin_lock_irqsave (&hmidi->lock, flags); 1019 spin_lock_irqsave (&hmidi->lock, flags);
1023 if (up) { 1020 if (up) {
1024 if (!hmidi->istimer) { 1021 if (!hmidi->istimer) {
@@ -1039,11 +1036,11 @@ static void snd_hdspm_midi_output_trigger(snd_rawmidi_substream_t * substream, i
1039 snd_hdspm_midi_output_write(hmidi); 1036 snd_hdspm_midi_output_write(hmidi);
1040} 1037}
1041 1038
1042static int snd_hdspm_midi_input_open(snd_rawmidi_substream_t * substream) 1039static int snd_hdspm_midi_input_open(struct snd_rawmidi_substream *substream)
1043{ 1040{
1044 hdspm_midi_t *hmidi; 1041 struct hdspm_midi *hmidi;
1045 1042
1046 hmidi = (hdspm_midi_t *) substream->rmidi->private_data; 1043 hmidi = (struct hdspm_midi *) substream->rmidi->private_data;
1047 spin_lock_irq (&hmidi->lock); 1044 spin_lock_irq (&hmidi->lock);
1048 snd_hdspm_flush_midi_input (hmidi->hdspm, hmidi->id); 1045 snd_hdspm_flush_midi_input (hmidi->hdspm, hmidi->id);
1049 hmidi->input = substream; 1046 hmidi->input = substream;
@@ -1052,11 +1049,11 @@ static int snd_hdspm_midi_input_open(snd_rawmidi_substream_t * substream)
1052 return 0; 1049 return 0;
1053} 1050}
1054 1051
1055static int snd_hdspm_midi_output_open(snd_rawmidi_substream_t * substream) 1052static int snd_hdspm_midi_output_open(struct snd_rawmidi_substream *substream)
1056{ 1053{
1057 hdspm_midi_t *hmidi; 1054 struct hdspm_midi *hmidi;
1058 1055
1059 hmidi = (hdspm_midi_t *) substream->rmidi->private_data; 1056 hmidi = (struct hdspm_midi *) substream->rmidi->private_data;
1060 spin_lock_irq (&hmidi->lock); 1057 spin_lock_irq (&hmidi->lock);
1061 hmidi->output = substream; 1058 hmidi->output = substream;
1062 spin_unlock_irq (&hmidi->lock); 1059 spin_unlock_irq (&hmidi->lock);
@@ -1064,13 +1061,13 @@ static int snd_hdspm_midi_output_open(snd_rawmidi_substream_t * substream)
1064 return 0; 1061 return 0;
1065} 1062}
1066 1063
1067static int snd_hdspm_midi_input_close(snd_rawmidi_substream_t * substream) 1064static int snd_hdspm_midi_input_close(struct snd_rawmidi_substream *substream)
1068{ 1065{
1069 hdspm_midi_t *hmidi; 1066 struct hdspm_midi *hmidi;
1070 1067
1071 snd_hdspm_midi_input_trigger (substream, 0); 1068 snd_hdspm_midi_input_trigger (substream, 0);
1072 1069
1073 hmidi = (hdspm_midi_t *) substream->rmidi->private_data; 1070 hmidi = (struct hdspm_midi *) substream->rmidi->private_data;
1074 spin_lock_irq (&hmidi->lock); 1071 spin_lock_irq (&hmidi->lock);
1075 hmidi->input = NULL; 1072 hmidi->input = NULL;
1076 spin_unlock_irq (&hmidi->lock); 1073 spin_unlock_irq (&hmidi->lock);
@@ -1078,13 +1075,13 @@ static int snd_hdspm_midi_input_close(snd_rawmidi_substream_t * substream)
1078 return 0; 1075 return 0;
1079} 1076}
1080 1077
1081static int snd_hdspm_midi_output_close(snd_rawmidi_substream_t * substream) 1078static int snd_hdspm_midi_output_close(struct snd_rawmidi_substream *substream)
1082{ 1079{
1083 hdspm_midi_t *hmidi; 1080 struct hdspm_midi *hmidi;
1084 1081
1085 snd_hdspm_midi_output_trigger (substream, 0); 1082 snd_hdspm_midi_output_trigger (substream, 0);
1086 1083
1087 hmidi = (hdspm_midi_t *) substream->rmidi->private_data; 1084 hmidi = (struct hdspm_midi *) substream->rmidi->private_data;
1088 spin_lock_irq (&hmidi->lock); 1085 spin_lock_irq (&hmidi->lock);
1089 hmidi->output = NULL; 1086 hmidi->output = NULL;
1090 spin_unlock_irq (&hmidi->lock); 1087 spin_unlock_irq (&hmidi->lock);
@@ -1092,21 +1089,21 @@ static int snd_hdspm_midi_output_close(snd_rawmidi_substream_t * substream)
1092 return 0; 1089 return 0;
1093} 1090}
1094 1091
1095static snd_rawmidi_ops_t snd_hdspm_midi_output = 1092static struct snd_rawmidi_ops snd_hdspm_midi_output =
1096{ 1093{
1097 .open = snd_hdspm_midi_output_open, 1094 .open = snd_hdspm_midi_output_open,
1098 .close = snd_hdspm_midi_output_close, 1095 .close = snd_hdspm_midi_output_close,
1099 .trigger = snd_hdspm_midi_output_trigger, 1096 .trigger = snd_hdspm_midi_output_trigger,
1100}; 1097};
1101 1098
1102static snd_rawmidi_ops_t snd_hdspm_midi_input = 1099static struct snd_rawmidi_ops snd_hdspm_midi_input =
1103{ 1100{
1104 .open = snd_hdspm_midi_input_open, 1101 .open = snd_hdspm_midi_input_open,
1105 .close = snd_hdspm_midi_input_close, 1102 .close = snd_hdspm_midi_input_close,
1106 .trigger = snd_hdspm_midi_input_trigger, 1103 .trigger = snd_hdspm_midi_input_trigger,
1107}; 1104};
1108 1105
1109static int __devinit snd_hdspm_create_midi (snd_card_t *card, hdspm_t *hdspm, int id) 1106static int __devinit snd_hdspm_create_midi (struct snd_card *card, struct hdspm *hdspm, int id)
1110{ 1107{
1111 int err; 1108 int err;
1112 char buf[32]; 1109 char buf[32];
@@ -1140,7 +1137,7 @@ static int __devinit snd_hdspm_create_midi (snd_card_t *card, hdspm_t *hdspm, in
1140 1137
1141static void hdspm_midi_tasklet(unsigned long arg) 1138static void hdspm_midi_tasklet(unsigned long arg)
1142{ 1139{
1143 hdspm_t *hdspm = (hdspm_t *)arg; 1140 struct hdspm *hdspm = (struct hdspm *)arg;
1144 1141
1145 if (hdspm->midi[0].pending) 1142 if (hdspm->midi[0].pending)
1146 snd_hdspm_midi_input_read (&hdspm->midi[0]); 1143 snd_hdspm_midi_input_read (&hdspm->midi[0]);
@@ -1164,19 +1161,19 @@ static void hdspm_midi_tasklet(unsigned long arg)
1164 .get = snd_hdspm_get_system_sample_rate \ 1161 .get = snd_hdspm_get_system_sample_rate \
1165} 1162}
1166 1163
1167static int snd_hdspm_info_system_sample_rate(snd_kcontrol_t * kcontrol, 1164static int snd_hdspm_info_system_sample_rate(struct snd_kcontrol *kcontrol,
1168 snd_ctl_elem_info_t * uinfo) 1165 struct snd_ctl_elem_info *uinfo)
1169{ 1166{
1170 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1167 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1171 uinfo->count = 1; 1168 uinfo->count = 1;
1172 return 0; 1169 return 0;
1173} 1170}
1174 1171
1175static int snd_hdspm_get_system_sample_rate(snd_kcontrol_t * kcontrol, 1172static int snd_hdspm_get_system_sample_rate(struct snd_kcontrol *kcontrol,
1176 snd_ctl_elem_value_t * 1173 struct snd_ctl_elem_value *
1177 ucontrol) 1174 ucontrol)
1178{ 1175{
1179 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1176 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1180 1177
1181 ucontrol->value.enumerated.item[0] = hdspm->system_sample_rate; 1178 ucontrol->value.enumerated.item[0] = hdspm->system_sample_rate;
1182 return 0; 1179 return 0;
@@ -1191,8 +1188,8 @@ static int snd_hdspm_get_system_sample_rate(snd_kcontrol_t * kcontrol,
1191 .get = snd_hdspm_get_autosync_sample_rate \ 1188 .get = snd_hdspm_get_autosync_sample_rate \
1192} 1189}
1193 1190
1194static int snd_hdspm_info_autosync_sample_rate(snd_kcontrol_t * kcontrol, 1191static int snd_hdspm_info_autosync_sample_rate(struct snd_kcontrol *kcontrol,
1195 snd_ctl_elem_info_t * uinfo) 1192 struct snd_ctl_elem_info *uinfo)
1196{ 1193{
1197 static char *texts[] = { "32000", "44100", "48000", 1194 static char *texts[] = { "32000", "44100", "48000",
1198 "64000", "88200", "96000", 1195 "64000", "88200", "96000",
@@ -1210,11 +1207,11 @@ static int snd_hdspm_info_autosync_sample_rate(snd_kcontrol_t * kcontrol,
1210 return 0; 1207 return 0;
1211} 1208}
1212 1209
1213static int snd_hdspm_get_autosync_sample_rate(snd_kcontrol_t * kcontrol, 1210static int snd_hdspm_get_autosync_sample_rate(struct snd_kcontrol *kcontrol,
1214 snd_ctl_elem_value_t * 1211 struct snd_ctl_elem_value *
1215 ucontrol) 1212 ucontrol)
1216{ 1213{
1217 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1214 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1218 1215
1219 switch (hdspm_external_sample_rate(hdspm)) { 1216 switch (hdspm_external_sample_rate(hdspm)) {
1220 case 32000: 1217 case 32000:
@@ -1262,7 +1259,7 @@ static int snd_hdspm_get_autosync_sample_rate(snd_kcontrol_t * kcontrol,
1262 1259
1263 1260
1264 1261
1265static int hdspm_system_clock_mode(hdspm_t * hdspm) 1262static int hdspm_system_clock_mode(struct hdspm * hdspm)
1266{ 1263{
1267 /* Always reflect the hardware info, rme is never wrong !!!! */ 1264 /* Always reflect the hardware info, rme is never wrong !!!! */
1268 1265
@@ -1271,8 +1268,8 @@ static int hdspm_system_clock_mode(hdspm_t * hdspm)
1271 return 1; 1268 return 1;
1272} 1269}
1273 1270
1274static int snd_hdspm_info_system_clock_mode(snd_kcontrol_t * kcontrol, 1271static int snd_hdspm_info_system_clock_mode(struct snd_kcontrol *kcontrol,
1275 snd_ctl_elem_info_t * uinfo) 1272 struct snd_ctl_elem_info *uinfo)
1276{ 1273{
1277 static char *texts[] = { "Master", "Slave" }; 1274 static char *texts[] = { "Master", "Slave" };
1278 1275
@@ -1287,10 +1284,10 @@ static int snd_hdspm_info_system_clock_mode(snd_kcontrol_t * kcontrol,
1287 return 0; 1284 return 0;
1288} 1285}
1289 1286
1290static int snd_hdspm_get_system_clock_mode(snd_kcontrol_t * kcontrol, 1287static int snd_hdspm_get_system_clock_mode(struct snd_kcontrol *kcontrol,
1291 snd_ctl_elem_value_t * ucontrol) 1288 struct snd_ctl_elem_value *ucontrol)
1292{ 1289{
1293 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1290 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1294 1291
1295 ucontrol->value.enumerated.item[0] = 1292 ucontrol->value.enumerated.item[0] =
1296 hdspm_system_clock_mode(hdspm); 1293 hdspm_system_clock_mode(hdspm);
@@ -1306,7 +1303,7 @@ static int snd_hdspm_get_system_clock_mode(snd_kcontrol_t * kcontrol,
1306 .put = snd_hdspm_put_clock_source \ 1303 .put = snd_hdspm_put_clock_source \
1307} 1304}
1308 1305
1309static int hdspm_clock_source(hdspm_t * hdspm) 1306static int hdspm_clock_source(struct hdspm * hdspm)
1310{ 1307{
1311 if (hdspm->control_register & HDSPM_ClockModeMaster) { 1308 if (hdspm->control_register & HDSPM_ClockModeMaster) {
1312 switch (hdspm->system_sample_rate) { 1309 switch (hdspm->system_sample_rate) {
@@ -1336,7 +1333,7 @@ static int hdspm_clock_source(hdspm_t * hdspm)
1336 } 1333 }
1337} 1334}
1338 1335
1339static int hdspm_set_clock_source(hdspm_t * hdspm, int mode) 1336static int hdspm_set_clock_source(struct hdspm * hdspm, int mode)
1340{ 1337{
1341 int rate; 1338 int rate;
1342 switch (mode) { 1339 switch (mode) {
@@ -1386,8 +1383,8 @@ static int hdspm_set_clock_source(hdspm_t * hdspm, int mode)
1386 return 0; 1383 return 0;
1387} 1384}
1388 1385
1389static int snd_hdspm_info_clock_source(snd_kcontrol_t * kcontrol, 1386static int snd_hdspm_info_clock_source(struct snd_kcontrol *kcontrol,
1390 snd_ctl_elem_info_t * uinfo) 1387 struct snd_ctl_elem_info *uinfo)
1391{ 1388{
1392 static char *texts[] = { "AutoSync", 1389 static char *texts[] = { "AutoSync",
1393 "Internal 32.0 kHz", "Internal 44.1 kHz", 1390 "Internal 32.0 kHz", "Internal 44.1 kHz",
@@ -1412,19 +1409,19 @@ static int snd_hdspm_info_clock_source(snd_kcontrol_t * kcontrol,
1412 return 0; 1409 return 0;
1413} 1410}
1414 1411
1415static int snd_hdspm_get_clock_source(snd_kcontrol_t * kcontrol, 1412static int snd_hdspm_get_clock_source(struct snd_kcontrol *kcontrol,
1416 snd_ctl_elem_value_t * ucontrol) 1413 struct snd_ctl_elem_value *ucontrol)
1417{ 1414{
1418 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1415 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1419 1416
1420 ucontrol->value.enumerated.item[0] = hdspm_clock_source(hdspm); 1417 ucontrol->value.enumerated.item[0] = hdspm_clock_source(hdspm);
1421 return 0; 1418 return 0;
1422} 1419}
1423 1420
1424static int snd_hdspm_put_clock_source(snd_kcontrol_t * kcontrol, 1421static int snd_hdspm_put_clock_source(struct snd_kcontrol *kcontrol,
1425 snd_ctl_elem_value_t * ucontrol) 1422 struct snd_ctl_elem_value *ucontrol)
1426{ 1423{
1427 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1424 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1428 int change; 1425 int change;
1429 int val; 1426 int val;
1430 1427
@@ -1453,7 +1450,7 @@ static int snd_hdspm_put_clock_source(snd_kcontrol_t * kcontrol,
1453 .put = snd_hdspm_put_pref_sync_ref \ 1450 .put = snd_hdspm_put_pref_sync_ref \
1454} 1451}
1455 1452
1456static int hdspm_pref_sync_ref(hdspm_t * hdspm) 1453static int hdspm_pref_sync_ref(struct hdspm * hdspm)
1457{ 1454{
1458 /* Notice that this looks at the requested sync source, 1455 /* Notice that this looks at the requested sync source,
1459 not the one actually in use. 1456 not the one actually in use.
@@ -1468,7 +1465,7 @@ static int hdspm_pref_sync_ref(hdspm_t * hdspm)
1468 return HDSPM_SYNC_FROM_WORD; 1465 return HDSPM_SYNC_FROM_WORD;
1469} 1466}
1470 1467
1471static int hdspm_set_pref_sync_ref(hdspm_t * hdspm, int pref) 1468static int hdspm_set_pref_sync_ref(struct hdspm * hdspm, int pref)
1472{ 1469{
1473 hdspm->control_register &= ~HDSPM_SyncRefMask; 1470 hdspm->control_register &= ~HDSPM_SyncRefMask;
1474 1471
@@ -1486,8 +1483,8 @@ static int hdspm_set_pref_sync_ref(hdspm_t * hdspm, int pref)
1486 return 0; 1483 return 0;
1487} 1484}
1488 1485
1489static int snd_hdspm_info_pref_sync_ref(snd_kcontrol_t * kcontrol, 1486static int snd_hdspm_info_pref_sync_ref(struct snd_kcontrol *kcontrol,
1490 snd_ctl_elem_info_t * uinfo) 1487 struct snd_ctl_elem_info *uinfo)
1491{ 1488{
1492 static char *texts[] = { "Word", "MADI" }; 1489 static char *texts[] = { "Word", "MADI" };
1493 1490
@@ -1504,19 +1501,19 @@ static int snd_hdspm_info_pref_sync_ref(snd_kcontrol_t * kcontrol,
1504 return 0; 1501 return 0;
1505} 1502}
1506 1503
1507static int snd_hdspm_get_pref_sync_ref(snd_kcontrol_t * kcontrol, 1504static int snd_hdspm_get_pref_sync_ref(struct snd_kcontrol *kcontrol,
1508 snd_ctl_elem_value_t * ucontrol) 1505 struct snd_ctl_elem_value *ucontrol)
1509{ 1506{
1510 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1507 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1511 1508
1512 ucontrol->value.enumerated.item[0] = hdspm_pref_sync_ref(hdspm); 1509 ucontrol->value.enumerated.item[0] = hdspm_pref_sync_ref(hdspm);
1513 return 0; 1510 return 0;
1514} 1511}
1515 1512
1516static int snd_hdspm_put_pref_sync_ref(snd_kcontrol_t * kcontrol, 1513static int snd_hdspm_put_pref_sync_ref(struct snd_kcontrol *kcontrol,
1517 snd_ctl_elem_value_t * ucontrol) 1514 struct snd_ctl_elem_value *ucontrol)
1518{ 1515{
1519 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1516 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1520 int change, max; 1517 int change, max;
1521 unsigned int val; 1518 unsigned int val;
1522 1519
@@ -1543,7 +1540,7 @@ static int snd_hdspm_put_pref_sync_ref(snd_kcontrol_t * kcontrol,
1543 .get = snd_hdspm_get_autosync_ref, \ 1540 .get = snd_hdspm_get_autosync_ref, \
1544} 1541}
1545 1542
1546static int hdspm_autosync_ref(hdspm_t * hdspm) 1543static int hdspm_autosync_ref(struct hdspm * hdspm)
1547{ 1544{
1548 /* This looks at the autosync selected sync reference */ 1545 /* This looks at the autosync selected sync reference */
1549 unsigned int status2 = hdspm_read(hdspm, HDSPM_statusRegister2); 1546 unsigned int status2 = hdspm_read(hdspm, HDSPM_statusRegister2);
@@ -1566,8 +1563,8 @@ static int hdspm_autosync_ref(hdspm_t * hdspm)
1566 return 0; 1563 return 0;
1567} 1564}
1568 1565
1569static int snd_hdspm_info_autosync_ref(snd_kcontrol_t * kcontrol, 1566static int snd_hdspm_info_autosync_ref(struct snd_kcontrol *kcontrol,
1570 snd_ctl_elem_info_t * uinfo) 1567 struct snd_ctl_elem_info *uinfo)
1571{ 1568{
1572 static char *texts[] = { "WordClock", "MADI", "None" }; 1569 static char *texts[] = { "WordClock", "MADI", "None" };
1573 1570
@@ -1582,10 +1579,10 @@ static int snd_hdspm_info_autosync_ref(snd_kcontrol_t * kcontrol,
1582 return 0; 1579 return 0;
1583} 1580}
1584 1581
1585static int snd_hdspm_get_autosync_ref(snd_kcontrol_t * kcontrol, 1582static int snd_hdspm_get_autosync_ref(struct snd_kcontrol *kcontrol,
1586 snd_ctl_elem_value_t * ucontrol) 1583 struct snd_ctl_elem_value *ucontrol)
1587{ 1584{
1588 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1585 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1589 1586
1590 ucontrol->value.enumerated.item[0] = hdspm_pref_sync_ref(hdspm); 1587 ucontrol->value.enumerated.item[0] = hdspm_pref_sync_ref(hdspm);
1591 return 0; 1588 return 0;
@@ -1600,13 +1597,13 @@ static int snd_hdspm_get_autosync_ref(snd_kcontrol_t * kcontrol,
1600 .put = snd_hdspm_put_line_out \ 1597 .put = snd_hdspm_put_line_out \
1601} 1598}
1602 1599
1603static int hdspm_line_out(hdspm_t * hdspm) 1600static int hdspm_line_out(struct hdspm * hdspm)
1604{ 1601{
1605 return (hdspm->control_register & HDSPM_LineOut) ? 1 : 0; 1602 return (hdspm->control_register & HDSPM_LineOut) ? 1 : 0;
1606} 1603}
1607 1604
1608 1605
1609static int hdspm_set_line_output(hdspm_t * hdspm, int out) 1606static int hdspm_set_line_output(struct hdspm * hdspm, int out)
1610{ 1607{
1611 if (out) 1608 if (out)
1612 hdspm->control_register |= HDSPM_LineOut; 1609 hdspm->control_register |= HDSPM_LineOut;
@@ -1617,8 +1614,8 @@ static int hdspm_set_line_output(hdspm_t * hdspm, int out)
1617 return 0; 1614 return 0;
1618} 1615}
1619 1616
1620static int snd_hdspm_info_line_out(snd_kcontrol_t * kcontrol, 1617static int snd_hdspm_info_line_out(struct snd_kcontrol *kcontrol,
1621 snd_ctl_elem_info_t * uinfo) 1618 struct snd_ctl_elem_info *uinfo)
1622{ 1619{
1623 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1620 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1624 uinfo->count = 1; 1621 uinfo->count = 1;
@@ -1627,10 +1624,10 @@ static int snd_hdspm_info_line_out(snd_kcontrol_t * kcontrol,
1627 return 0; 1624 return 0;
1628} 1625}
1629 1626
1630static int snd_hdspm_get_line_out(snd_kcontrol_t * kcontrol, 1627static int snd_hdspm_get_line_out(struct snd_kcontrol *kcontrol,
1631 snd_ctl_elem_value_t * ucontrol) 1628 struct snd_ctl_elem_value *ucontrol)
1632{ 1629{
1633 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1630 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1634 1631
1635 spin_lock_irq(&hdspm->lock); 1632 spin_lock_irq(&hdspm->lock);
1636 ucontrol->value.integer.value[0] = hdspm_line_out(hdspm); 1633 ucontrol->value.integer.value[0] = hdspm_line_out(hdspm);
@@ -1638,10 +1635,10 @@ static int snd_hdspm_get_line_out(snd_kcontrol_t * kcontrol,
1638 return 0; 1635 return 0;
1639} 1636}
1640 1637
1641static int snd_hdspm_put_line_out(snd_kcontrol_t * kcontrol, 1638static int snd_hdspm_put_line_out(struct snd_kcontrol *kcontrol,
1642 snd_ctl_elem_value_t * ucontrol) 1639 struct snd_ctl_elem_value *ucontrol)
1643{ 1640{
1644 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1641 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1645 int change; 1642 int change;
1646 unsigned int val; 1643 unsigned int val;
1647 1644
@@ -1664,12 +1661,12 @@ static int snd_hdspm_put_line_out(snd_kcontrol_t * kcontrol,
1664 .put = snd_hdspm_put_tx_64 \ 1661 .put = snd_hdspm_put_tx_64 \
1665} 1662}
1666 1663
1667static int hdspm_tx_64(hdspm_t * hdspm) 1664static int hdspm_tx_64(struct hdspm * hdspm)
1668{ 1665{
1669 return (hdspm->control_register & HDSPM_TX_64ch) ? 1 : 0; 1666 return (hdspm->control_register & HDSPM_TX_64ch) ? 1 : 0;
1670} 1667}
1671 1668
1672static int hdspm_set_tx_64(hdspm_t * hdspm, int out) 1669static int hdspm_set_tx_64(struct hdspm * hdspm, int out)
1673{ 1670{
1674 if (out) 1671 if (out)
1675 hdspm->control_register |= HDSPM_TX_64ch; 1672 hdspm->control_register |= HDSPM_TX_64ch;
@@ -1680,8 +1677,8 @@ static int hdspm_set_tx_64(hdspm_t * hdspm, int out)
1680 return 0; 1677 return 0;
1681} 1678}
1682 1679
1683static int snd_hdspm_info_tx_64(snd_kcontrol_t * kcontrol, 1680static int snd_hdspm_info_tx_64(struct snd_kcontrol *kcontrol,
1684 snd_ctl_elem_info_t * uinfo) 1681 struct snd_ctl_elem_info *uinfo)
1685{ 1682{
1686 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1683 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1687 uinfo->count = 1; 1684 uinfo->count = 1;
@@ -1690,10 +1687,10 @@ static int snd_hdspm_info_tx_64(snd_kcontrol_t * kcontrol,
1690 return 0; 1687 return 0;
1691} 1688}
1692 1689
1693static int snd_hdspm_get_tx_64(snd_kcontrol_t * kcontrol, 1690static int snd_hdspm_get_tx_64(struct snd_kcontrol *kcontrol,
1694 snd_ctl_elem_value_t * ucontrol) 1691 struct snd_ctl_elem_value *ucontrol)
1695{ 1692{
1696 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1693 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1697 1694
1698 spin_lock_irq(&hdspm->lock); 1695 spin_lock_irq(&hdspm->lock);
1699 ucontrol->value.integer.value[0] = hdspm_tx_64(hdspm); 1696 ucontrol->value.integer.value[0] = hdspm_tx_64(hdspm);
@@ -1701,10 +1698,10 @@ static int snd_hdspm_get_tx_64(snd_kcontrol_t * kcontrol,
1701 return 0; 1698 return 0;
1702} 1699}
1703 1700
1704static int snd_hdspm_put_tx_64(snd_kcontrol_t * kcontrol, 1701static int snd_hdspm_put_tx_64(struct snd_kcontrol *kcontrol,
1705 snd_ctl_elem_value_t * ucontrol) 1702 struct snd_ctl_elem_value *ucontrol)
1706{ 1703{
1707 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1704 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1708 int change; 1705 int change;
1709 unsigned int val; 1706 unsigned int val;
1710 1707
@@ -1727,12 +1724,12 @@ static int snd_hdspm_put_tx_64(snd_kcontrol_t * kcontrol,
1727 .put = snd_hdspm_put_c_tms \ 1724 .put = snd_hdspm_put_c_tms \
1728} 1725}
1729 1726
1730static int hdspm_c_tms(hdspm_t * hdspm) 1727static int hdspm_c_tms(struct hdspm * hdspm)
1731{ 1728{
1732 return (hdspm->control_register & HDSPM_clr_tms) ? 1 : 0; 1729 return (hdspm->control_register & HDSPM_clr_tms) ? 1 : 0;
1733} 1730}
1734 1731
1735static int hdspm_set_c_tms(hdspm_t * hdspm, int out) 1732static int hdspm_set_c_tms(struct hdspm * hdspm, int out)
1736{ 1733{
1737 if (out) 1734 if (out)
1738 hdspm->control_register |= HDSPM_clr_tms; 1735 hdspm->control_register |= HDSPM_clr_tms;
@@ -1743,8 +1740,8 @@ static int hdspm_set_c_tms(hdspm_t * hdspm, int out)
1743 return 0; 1740 return 0;
1744} 1741}
1745 1742
1746static int snd_hdspm_info_c_tms(snd_kcontrol_t * kcontrol, 1743static int snd_hdspm_info_c_tms(struct snd_kcontrol *kcontrol,
1747 snd_ctl_elem_info_t * uinfo) 1744 struct snd_ctl_elem_info *uinfo)
1748{ 1745{
1749 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1746 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1750 uinfo->count = 1; 1747 uinfo->count = 1;
@@ -1753,10 +1750,10 @@ static int snd_hdspm_info_c_tms(snd_kcontrol_t * kcontrol,
1753 return 0; 1750 return 0;
1754} 1751}
1755 1752
1756static int snd_hdspm_get_c_tms(snd_kcontrol_t * kcontrol, 1753static int snd_hdspm_get_c_tms(struct snd_kcontrol *kcontrol,
1757 snd_ctl_elem_value_t * ucontrol) 1754 struct snd_ctl_elem_value *ucontrol)
1758{ 1755{
1759 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1756 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1760 1757
1761 spin_lock_irq(&hdspm->lock); 1758 spin_lock_irq(&hdspm->lock);
1762 ucontrol->value.integer.value[0] = hdspm_c_tms(hdspm); 1759 ucontrol->value.integer.value[0] = hdspm_c_tms(hdspm);
@@ -1764,10 +1761,10 @@ static int snd_hdspm_get_c_tms(snd_kcontrol_t * kcontrol,
1764 return 0; 1761 return 0;
1765} 1762}
1766 1763
1767static int snd_hdspm_put_c_tms(snd_kcontrol_t * kcontrol, 1764static int snd_hdspm_put_c_tms(struct snd_kcontrol *kcontrol,
1768 snd_ctl_elem_value_t * ucontrol) 1765 struct snd_ctl_elem_value *ucontrol)
1769{ 1766{
1770 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1767 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1771 int change; 1768 int change;
1772 unsigned int val; 1769 unsigned int val;
1773 1770
@@ -1790,12 +1787,12 @@ static int snd_hdspm_put_c_tms(snd_kcontrol_t * kcontrol,
1790 .put = snd_hdspm_put_safe_mode \ 1787 .put = snd_hdspm_put_safe_mode \
1791} 1788}
1792 1789
1793static int hdspm_safe_mode(hdspm_t * hdspm) 1790static int hdspm_safe_mode(struct hdspm * hdspm)
1794{ 1791{
1795 return (hdspm->control_register & HDSPM_AutoInp) ? 1 : 0; 1792 return (hdspm->control_register & HDSPM_AutoInp) ? 1 : 0;
1796} 1793}
1797 1794
1798static int hdspm_set_safe_mode(hdspm_t * hdspm, int out) 1795static int hdspm_set_safe_mode(struct hdspm * hdspm, int out)
1799{ 1796{
1800 if (out) 1797 if (out)
1801 hdspm->control_register |= HDSPM_AutoInp; 1798 hdspm->control_register |= HDSPM_AutoInp;
@@ -1806,8 +1803,8 @@ static int hdspm_set_safe_mode(hdspm_t * hdspm, int out)
1806 return 0; 1803 return 0;
1807} 1804}
1808 1805
1809static int snd_hdspm_info_safe_mode(snd_kcontrol_t * kcontrol, 1806static int snd_hdspm_info_safe_mode(struct snd_kcontrol *kcontrol,
1810 snd_ctl_elem_info_t * uinfo) 1807 struct snd_ctl_elem_info *uinfo)
1811{ 1808{
1812 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1809 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1813 uinfo->count = 1; 1810 uinfo->count = 1;
@@ -1816,10 +1813,10 @@ static int snd_hdspm_info_safe_mode(snd_kcontrol_t * kcontrol,
1816 return 0; 1813 return 0;
1817} 1814}
1818 1815
1819static int snd_hdspm_get_safe_mode(snd_kcontrol_t * kcontrol, 1816static int snd_hdspm_get_safe_mode(struct snd_kcontrol *kcontrol,
1820 snd_ctl_elem_value_t * ucontrol) 1817 struct snd_ctl_elem_value *ucontrol)
1821{ 1818{
1822 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1819 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1823 1820
1824 spin_lock_irq(&hdspm->lock); 1821 spin_lock_irq(&hdspm->lock);
1825 ucontrol->value.integer.value[0] = hdspm_safe_mode(hdspm); 1822 ucontrol->value.integer.value[0] = hdspm_safe_mode(hdspm);
@@ -1827,10 +1824,10 @@ static int snd_hdspm_get_safe_mode(snd_kcontrol_t * kcontrol,
1827 return 0; 1824 return 0;
1828} 1825}
1829 1826
1830static int snd_hdspm_put_safe_mode(snd_kcontrol_t * kcontrol, 1827static int snd_hdspm_put_safe_mode(struct snd_kcontrol *kcontrol,
1831 snd_ctl_elem_value_t * ucontrol) 1828 struct snd_ctl_elem_value *ucontrol)
1832{ 1829{
1833 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1830 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1834 int change; 1831 int change;
1835 unsigned int val; 1832 unsigned int val;
1836 1833
@@ -1853,12 +1850,12 @@ static int snd_hdspm_put_safe_mode(snd_kcontrol_t * kcontrol,
1853 .put = snd_hdspm_put_input_select \ 1850 .put = snd_hdspm_put_input_select \
1854} 1851}
1855 1852
1856static int hdspm_input_select(hdspm_t * hdspm) 1853static int hdspm_input_select(struct hdspm * hdspm)
1857{ 1854{
1858 return (hdspm->control_register & HDSPM_InputSelect0) ? 1 : 0; 1855 return (hdspm->control_register & HDSPM_InputSelect0) ? 1 : 0;
1859} 1856}
1860 1857
1861static int hdspm_set_input_select(hdspm_t * hdspm, int out) 1858static int hdspm_set_input_select(struct hdspm * hdspm, int out)
1862{ 1859{
1863 if (out) 1860 if (out)
1864 hdspm->control_register |= HDSPM_InputSelect0; 1861 hdspm->control_register |= HDSPM_InputSelect0;
@@ -1869,8 +1866,8 @@ static int hdspm_set_input_select(hdspm_t * hdspm, int out)
1869 return 0; 1866 return 0;
1870} 1867}
1871 1868
1872static int snd_hdspm_info_input_select(snd_kcontrol_t * kcontrol, 1869static int snd_hdspm_info_input_select(struct snd_kcontrol *kcontrol,
1873 snd_ctl_elem_info_t * uinfo) 1870 struct snd_ctl_elem_info *uinfo)
1874{ 1871{
1875 static char *texts[] = { "optical", "coaxial" }; 1872 static char *texts[] = { "optical", "coaxial" };
1876 1873
@@ -1887,10 +1884,10 @@ static int snd_hdspm_info_input_select(snd_kcontrol_t * kcontrol,
1887 return 0; 1884 return 0;
1888} 1885}
1889 1886
1890static int snd_hdspm_get_input_select(snd_kcontrol_t * kcontrol, 1887static int snd_hdspm_get_input_select(struct snd_kcontrol *kcontrol,
1891 snd_ctl_elem_value_t * ucontrol) 1888 struct snd_ctl_elem_value *ucontrol)
1892{ 1889{
1893 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1890 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1894 1891
1895 spin_lock_irq(&hdspm->lock); 1892 spin_lock_irq(&hdspm->lock);
1896 ucontrol->value.enumerated.item[0] = hdspm_input_select(hdspm); 1893 ucontrol->value.enumerated.item[0] = hdspm_input_select(hdspm);
@@ -1898,10 +1895,10 @@ static int snd_hdspm_get_input_select(snd_kcontrol_t * kcontrol,
1898 return 0; 1895 return 0;
1899} 1896}
1900 1897
1901static int snd_hdspm_put_input_select(snd_kcontrol_t * kcontrol, 1898static int snd_hdspm_put_input_select(struct snd_kcontrol *kcontrol,
1902 snd_ctl_elem_value_t * ucontrol) 1899 struct snd_ctl_elem_value *ucontrol)
1903{ 1900{
1904 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1901 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1905 int change; 1902 int change;
1906 unsigned int val; 1903 unsigned int val;
1907 1904
@@ -1937,8 +1934,8 @@ static int snd_hdspm_put_input_select(snd_kcontrol_t * kcontrol,
1937 .put = snd_hdspm_put_mixer \ 1934 .put = snd_hdspm_put_mixer \
1938} 1935}
1939 1936
1940static int snd_hdspm_info_mixer(snd_kcontrol_t * kcontrol, 1937static int snd_hdspm_info_mixer(struct snd_kcontrol *kcontrol,
1941 snd_ctl_elem_info_t * uinfo) 1938 struct snd_ctl_elem_info *uinfo)
1942{ 1939{
1943 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1940 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1944 uinfo->count = 3; 1941 uinfo->count = 3;
@@ -1948,10 +1945,10 @@ static int snd_hdspm_info_mixer(snd_kcontrol_t * kcontrol,
1948 return 0; 1945 return 0;
1949} 1946}
1950 1947
1951static int snd_hdspm_get_mixer(snd_kcontrol_t * kcontrol, 1948static int snd_hdspm_get_mixer(struct snd_kcontrol *kcontrol,
1952 snd_ctl_elem_value_t * ucontrol) 1949 struct snd_ctl_elem_value *ucontrol)
1953{ 1950{
1954 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1951 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1955 int source; 1952 int source;
1956 int destination; 1953 int destination;
1957 1954
@@ -1981,10 +1978,10 @@ static int snd_hdspm_get_mixer(snd_kcontrol_t * kcontrol,
1981 return 0; 1978 return 0;
1982} 1979}
1983 1980
1984static int snd_hdspm_put_mixer(snd_kcontrol_t * kcontrol, 1981static int snd_hdspm_put_mixer(struct snd_kcontrol *kcontrol,
1985 snd_ctl_elem_value_t * ucontrol) 1982 struct snd_ctl_elem_value *ucontrol)
1986{ 1983{
1987 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 1984 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
1988 int change; 1985 int change;
1989 int source; 1986 int source;
1990 int destination; 1987 int destination;
@@ -2041,8 +2038,8 @@ static int snd_hdspm_put_mixer(snd_kcontrol_t * kcontrol,
2041 .put = snd_hdspm_put_playback_mixer \ 2038 .put = snd_hdspm_put_playback_mixer \
2042} 2039}
2043 2040
2044static int snd_hdspm_info_playback_mixer(snd_kcontrol_t * kcontrol, 2041static int snd_hdspm_info_playback_mixer(struct snd_kcontrol *kcontrol,
2045 snd_ctl_elem_info_t * uinfo) 2042 struct snd_ctl_elem_info *uinfo)
2046{ 2043{
2047 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2044 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2048 uinfo->count = 1; 2045 uinfo->count = 1;
@@ -2052,10 +2049,10 @@ static int snd_hdspm_info_playback_mixer(snd_kcontrol_t * kcontrol,
2052 return 0; 2049 return 0;
2053} 2050}
2054 2051
2055static int snd_hdspm_get_playback_mixer(snd_kcontrol_t * kcontrol, 2052static int snd_hdspm_get_playback_mixer(struct snd_kcontrol *kcontrol,
2056 snd_ctl_elem_value_t * ucontrol) 2053 struct snd_ctl_elem_value *ucontrol)
2057{ 2054{
2058 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 2055 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2059 int channel; 2056 int channel;
2060 int mapped_channel; 2057 int mapped_channel;
2061 2058
@@ -2079,10 +2076,10 @@ static int snd_hdspm_get_playback_mixer(snd_kcontrol_t * kcontrol,
2079 return 0; 2076 return 0;
2080} 2077}
2081 2078
2082static int snd_hdspm_put_playback_mixer(snd_kcontrol_t * kcontrol, 2079static int snd_hdspm_put_playback_mixer(struct snd_kcontrol *kcontrol,
2083 snd_ctl_elem_value_t * ucontrol) 2080 struct snd_ctl_elem_value *ucontrol)
2084{ 2081{
2085 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 2082 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2086 int change; 2083 int change;
2087 int channel; 2084 int channel;
2088 int mapped_channel; 2085 int mapped_channel;
@@ -2121,8 +2118,8 @@ static int snd_hdspm_put_playback_mixer(snd_kcontrol_t * kcontrol,
2121 .get = snd_hdspm_get_wc_sync_check \ 2118 .get = snd_hdspm_get_wc_sync_check \
2122} 2119}
2123 2120
2124static int snd_hdspm_info_sync_check(snd_kcontrol_t * kcontrol, 2121static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol,
2125 snd_ctl_elem_info_t * uinfo) 2122 struct snd_ctl_elem_info *uinfo)
2126{ 2123{
2127 static char *texts[] = { "No Lock", "Lock", "Sync" }; 2124 static char *texts[] = { "No Lock", "Lock", "Sync" };
2128 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2125 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -2136,7 +2133,7 @@ static int snd_hdspm_info_sync_check(snd_kcontrol_t * kcontrol,
2136 return 0; 2133 return 0;
2137} 2134}
2138 2135
2139static int hdspm_wc_sync_check(hdspm_t * hdspm) 2136static int hdspm_wc_sync_check(struct hdspm * hdspm)
2140{ 2137{
2141 int status2 = hdspm_read(hdspm, HDSPM_statusRegister2); 2138 int status2 = hdspm_read(hdspm, HDSPM_statusRegister2);
2142 if (status2 & HDSPM_wcLock) { 2139 if (status2 & HDSPM_wcLock) {
@@ -2148,10 +2145,10 @@ static int hdspm_wc_sync_check(hdspm_t * hdspm)
2148 return 0; 2145 return 0;
2149} 2146}
2150 2147
2151static int snd_hdspm_get_wc_sync_check(snd_kcontrol_t * kcontrol, 2148static int snd_hdspm_get_wc_sync_check(struct snd_kcontrol *kcontrol,
2152 snd_ctl_elem_value_t * ucontrol) 2149 struct snd_ctl_elem_value *ucontrol)
2153{ 2150{
2154 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 2151 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2155 2152
2156 ucontrol->value.enumerated.item[0] = hdspm_wc_sync_check(hdspm); 2153 ucontrol->value.enumerated.item[0] = hdspm_wc_sync_check(hdspm);
2157 return 0; 2154 return 0;
@@ -2167,7 +2164,7 @@ static int snd_hdspm_get_wc_sync_check(snd_kcontrol_t * kcontrol,
2167 .get = snd_hdspm_get_madisync_sync_check \ 2164 .get = snd_hdspm_get_madisync_sync_check \
2168} 2165}
2169 2166
2170static int hdspm_madisync_sync_check(hdspm_t * hdspm) 2167static int hdspm_madisync_sync_check(struct hdspm * hdspm)
2171{ 2168{
2172 int status = hdspm_read(hdspm, HDSPM_statusRegister); 2169 int status = hdspm_read(hdspm, HDSPM_statusRegister);
2173 if (status & HDSPM_madiLock) { 2170 if (status & HDSPM_madiLock) {
@@ -2179,11 +2176,11 @@ static int hdspm_madisync_sync_check(hdspm_t * hdspm)
2179 return 0; 2176 return 0;
2180} 2177}
2181 2178
2182static int snd_hdspm_get_madisync_sync_check(snd_kcontrol_t * kcontrol, 2179static int snd_hdspm_get_madisync_sync_check(struct snd_kcontrol *kcontrol,
2183 snd_ctl_elem_value_t * 2180 struct snd_ctl_elem_value *
2184 ucontrol) 2181 ucontrol)
2185{ 2182{
2186 hdspm_t *hdspm = snd_kcontrol_chip(kcontrol); 2183 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2187 2184
2188 ucontrol->value.enumerated.item[0] = 2185 ucontrol->value.enumerated.item[0] =
2189 hdspm_madisync_sync_check(hdspm); 2186 hdspm_madisync_sync_check(hdspm);
@@ -2193,7 +2190,7 @@ static int snd_hdspm_get_madisync_sync_check(snd_kcontrol_t * kcontrol,
2193 2190
2194 2191
2195 2192
2196static snd_kcontrol_new_t snd_hdspm_controls[] = { 2193static struct snd_kcontrol_new snd_hdspm_controls[] = {
2197 2194
2198 HDSPM_MIXER("Mixer", 0), 2195 HDSPM_MIXER("Mixer", 0),
2199/* 'Sample Clock Source' complies with the alsa control naming scheme */ 2196/* 'Sample Clock Source' complies with the alsa control naming scheme */
@@ -2214,10 +2211,10 @@ static snd_kcontrol_new_t snd_hdspm_controls[] = {
2214 HDSPM_INPUT_SELECT("Input Select", 0), 2211 HDSPM_INPUT_SELECT("Input Select", 0),
2215}; 2212};
2216 2213
2217static snd_kcontrol_new_t snd_hdspm_playback_mixer = HDSPM_PLAYBACK_MIXER; 2214static struct snd_kcontrol_new snd_hdspm_playback_mixer = HDSPM_PLAYBACK_MIXER;
2218 2215
2219 2216
2220static int hdspm_update_simple_mixer_controls(hdspm_t * hdspm) 2217static int hdspm_update_simple_mixer_controls(struct hdspm * hdspm)
2221{ 2218{
2222 int i; 2219 int i;
2223 2220
@@ -2241,11 +2238,11 @@ static int hdspm_update_simple_mixer_controls(hdspm_t * hdspm)
2241} 2238}
2242 2239
2243 2240
2244static int snd_hdspm_create_controls(snd_card_t * card, hdspm_t * hdspm) 2241static int snd_hdspm_create_controls(struct snd_card *card, struct hdspm * hdspm)
2245{ 2242{
2246 unsigned int idx, limit; 2243 unsigned int idx, limit;
2247 int err; 2244 int err;
2248 snd_kcontrol_t *kctl; 2245 struct snd_kcontrol *kctl;
2249 2246
2250 /* add control list first */ 2247 /* add control list first */
2251 2248
@@ -2292,9 +2289,9 @@ static int snd_hdspm_create_controls(snd_card_t * card, hdspm_t * hdspm)
2292 ------------------------------------------------------------*/ 2289 ------------------------------------------------------------*/
2293 2290
2294static void 2291static void
2295snd_hdspm_proc_read(snd_info_entry_t * entry, snd_info_buffer_t * buffer) 2292snd_hdspm_proc_read(struct snd_info_entry * entry, struct snd_info_buffer *buffer)
2296{ 2293{
2297 hdspm_t *hdspm = (hdspm_t *) entry->private_data; 2294 struct hdspm *hdspm = (struct hdspm *) entry->private_data;
2298 unsigned int status; 2295 unsigned int status;
2299 unsigned int status2; 2296 unsigned int status2;
2300 char *pref_sync_ref; 2297 char *pref_sync_ref;
@@ -2487,9 +2484,9 @@ snd_hdspm_proc_read(snd_info_entry_t * entry, snd_info_buffer_t * buffer)
2487 snd_iprintf(buffer, "\n"); 2484 snd_iprintf(buffer, "\n");
2488} 2485}
2489 2486
2490static void __devinit snd_hdspm_proc_init(hdspm_t * hdspm) 2487static void __devinit snd_hdspm_proc_init(struct hdspm * hdspm)
2491{ 2488{
2492 snd_info_entry_t *entry; 2489 struct snd_info_entry *entry;
2493 2490
2494 if (!snd_card_proc_new(hdspm->card, "hdspm", &entry)) 2491 if (!snd_card_proc_new(hdspm->card, "hdspm", &entry))
2495 snd_info_set_text_ops(entry, hdspm, 1024, 2492 snd_info_set_text_ops(entry, hdspm, 1024,
@@ -2500,7 +2497,7 @@ static void __devinit snd_hdspm_proc_init(hdspm_t * hdspm)
2500 hdspm intitialize 2497 hdspm intitialize
2501 ------------------------------------------------------------*/ 2498 ------------------------------------------------------------*/
2502 2499
2503static int snd_hdspm_set_defaults(hdspm_t * hdspm) 2500static int snd_hdspm_set_defaults(struct hdspm * hdspm)
2504{ 2501{
2505 unsigned int i; 2502 unsigned int i;
2506 2503
@@ -2562,7 +2559,7 @@ static int snd_hdspm_set_defaults(hdspm_t * hdspm)
2562static irqreturn_t snd_hdspm_interrupt(int irq, void *dev_id, 2559static irqreturn_t snd_hdspm_interrupt(int irq, void *dev_id,
2563 struct pt_regs *regs) 2560 struct pt_regs *regs)
2564{ 2561{
2565 hdspm_t *hdspm = (hdspm_t *) dev_id; 2562 struct hdspm *hdspm = (struct hdspm *) dev_id;
2566 unsigned int status; 2563 unsigned int status;
2567 int audio; 2564 int audio;
2568 int midi0; 2565 int midi0;
@@ -2627,14 +2624,14 @@ static irqreturn_t snd_hdspm_interrupt(int irq, void *dev_id,
2627 ------------------------------------------------------------*/ 2624 ------------------------------------------------------------*/
2628 2625
2629 2626
2630static snd_pcm_uframes_t snd_hdspm_hw_pointer(snd_pcm_substream_t * 2627static snd_pcm_uframes_t snd_hdspm_hw_pointer(struct snd_pcm_substream *
2631 substream) 2628 substream)
2632{ 2629{
2633 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2630 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2634 return hdspm_hw_pointer(hdspm); 2631 return hdspm_hw_pointer(hdspm);
2635} 2632}
2636 2633
2637static char *hdspm_channel_buffer_location(hdspm_t * hdspm, 2634static char *hdspm_channel_buffer_location(struct hdspm * hdspm,
2638 int stream, int channel) 2635 int stream, int channel)
2639{ 2636{
2640 int mapped_channel; 2637 int mapped_channel;
@@ -2656,11 +2653,11 @@ static char *hdspm_channel_buffer_location(hdspm_t * hdspm,
2656 2653
2657 2654
2658/* dont know why need it ??? */ 2655/* dont know why need it ??? */
2659static int snd_hdspm_playback_copy(snd_pcm_substream_t * substream, 2656static int snd_hdspm_playback_copy(struct snd_pcm_substream *substream,
2660 int channel, snd_pcm_uframes_t pos, 2657 int channel, snd_pcm_uframes_t pos,
2661 void __user *src, snd_pcm_uframes_t count) 2658 void __user *src, snd_pcm_uframes_t count)
2662{ 2659{
2663 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2660 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2664 char *channel_buf; 2661 char *channel_buf;
2665 2662
2666 snd_assert(pos + count <= HDSPM_CHANNEL_BUFFER_BYTES / 4, 2663 snd_assert(pos + count <= HDSPM_CHANNEL_BUFFER_BYTES / 4,
@@ -2675,11 +2672,11 @@ static int snd_hdspm_playback_copy(snd_pcm_substream_t * substream,
2675 return copy_from_user(channel_buf + pos * 4, src, count * 4); 2672 return copy_from_user(channel_buf + pos * 4, src, count * 4);
2676} 2673}
2677 2674
2678static int snd_hdspm_capture_copy(snd_pcm_substream_t * substream, 2675static int snd_hdspm_capture_copy(struct snd_pcm_substream *substream,
2679 int channel, snd_pcm_uframes_t pos, 2676 int channel, snd_pcm_uframes_t pos,
2680 void __user *dst, snd_pcm_uframes_t count) 2677 void __user *dst, snd_pcm_uframes_t count)
2681{ 2678{
2682 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2679 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2683 char *channel_buf; 2680 char *channel_buf;
2684 2681
2685 snd_assert(pos + count <= HDSPM_CHANNEL_BUFFER_BYTES / 4, 2682 snd_assert(pos + count <= HDSPM_CHANNEL_BUFFER_BYTES / 4,
@@ -2692,11 +2689,11 @@ static int snd_hdspm_capture_copy(snd_pcm_substream_t * substream,
2692 return copy_to_user(dst, channel_buf + pos * 4, count * 4); 2689 return copy_to_user(dst, channel_buf + pos * 4, count * 4);
2693} 2690}
2694 2691
2695static int snd_hdspm_hw_silence(snd_pcm_substream_t * substream, 2692static int snd_hdspm_hw_silence(struct snd_pcm_substream *substream,
2696 int channel, snd_pcm_uframes_t pos, 2693 int channel, snd_pcm_uframes_t pos,
2697 snd_pcm_uframes_t count) 2694 snd_pcm_uframes_t count)
2698{ 2695{
2699 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2696 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2700 char *channel_buf; 2697 char *channel_buf;
2701 2698
2702 channel_buf = 2699 channel_buf =
@@ -2707,11 +2704,11 @@ static int snd_hdspm_hw_silence(snd_pcm_substream_t * substream,
2707 return 0; 2704 return 0;
2708} 2705}
2709 2706
2710static int snd_hdspm_reset(snd_pcm_substream_t * substream) 2707static int snd_hdspm_reset(struct snd_pcm_substream *substream)
2711{ 2708{
2712 snd_pcm_runtime_t *runtime = substream->runtime; 2709 struct snd_pcm_runtime *runtime = substream->runtime;
2713 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2710 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2714 snd_pcm_substream_t *other; 2711 struct snd_pcm_substream *other;
2715 2712
2716 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 2713 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
2717 other = hdspm->capture_substream; 2714 other = hdspm->capture_substream;
@@ -2724,8 +2721,8 @@ static int snd_hdspm_reset(snd_pcm_substream_t * substream)
2724 runtime->status->hw_ptr = 0; 2721 runtime->status->hw_ptr = 0;
2725 if (other) { 2722 if (other) {
2726 struct list_head *pos; 2723 struct list_head *pos;
2727 snd_pcm_substream_t *s; 2724 struct snd_pcm_substream *s;
2728 snd_pcm_runtime_t *oruntime = other->runtime; 2725 struct snd_pcm_runtime *oruntime = other->runtime;
2729 snd_pcm_group_for_each(pos, substream) { 2726 snd_pcm_group_for_each(pos, substream) {
2730 s = snd_pcm_group_substream_entry(pos); 2727 s = snd_pcm_group_substream_entry(pos);
2731 if (s == other) { 2728 if (s == other) {
@@ -2738,10 +2735,10 @@ static int snd_hdspm_reset(snd_pcm_substream_t * substream)
2738 return 0; 2735 return 0;
2739} 2736}
2740 2737
2741static int snd_hdspm_hw_params(snd_pcm_substream_t * substream, 2738static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
2742 snd_pcm_hw_params_t * params) 2739 struct snd_pcm_hw_params *params)
2743{ 2740{
2744 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2741 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2745 int err; 2742 int err;
2746 int i; 2743 int i;
2747 pid_t this_pid; 2744 pid_t this_pid;
@@ -2839,10 +2836,10 @@ static int snd_hdspm_hw_params(snd_pcm_substream_t * substream,
2839 return 0; 2836 return 0;
2840} 2837}
2841 2838
2842static int snd_hdspm_hw_free(snd_pcm_substream_t * substream) 2839static int snd_hdspm_hw_free(struct snd_pcm_substream *substream)
2843{ 2840{
2844 int i; 2841 int i;
2845 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2842 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2846 2843
2847 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 2844 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
2848 2845
@@ -2865,10 +2862,10 @@ static int snd_hdspm_hw_free(snd_pcm_substream_t * substream)
2865 return 0; 2862 return 0;
2866} 2863}
2867 2864
2868static int snd_hdspm_channel_info(snd_pcm_substream_t * substream, 2865static int snd_hdspm_channel_info(struct snd_pcm_substream *substream,
2869 snd_pcm_channel_info_t * info) 2866 struct snd_pcm_channel_info * info)
2870{ 2867{
2871 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2868 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2872 int mapped_channel; 2869 int mapped_channel;
2873 2870
2874 snd_assert(info->channel < HDSPM_MAX_CHANNELS, return -EINVAL); 2871 snd_assert(info->channel < HDSPM_MAX_CHANNELS, return -EINVAL);
@@ -2882,7 +2879,7 @@ static int snd_hdspm_channel_info(snd_pcm_substream_t * substream,
2882 return 0; 2879 return 0;
2883} 2880}
2884 2881
2885static int snd_hdspm_ioctl(snd_pcm_substream_t * substream, 2882static int snd_hdspm_ioctl(struct snd_pcm_substream *substream,
2886 unsigned int cmd, void *arg) 2883 unsigned int cmd, void *arg)
2887{ 2884{
2888 switch (cmd) { 2885 switch (cmd) {
@@ -2893,7 +2890,7 @@ static int snd_hdspm_ioctl(snd_pcm_substream_t * substream,
2893 2890
2894 case SNDRV_PCM_IOCTL1_CHANNEL_INFO: 2891 case SNDRV_PCM_IOCTL1_CHANNEL_INFO:
2895 { 2892 {
2896 snd_pcm_channel_info_t *info = arg; 2893 struct snd_pcm_channel_info *info = arg;
2897 return snd_hdspm_channel_info(substream, info); 2894 return snd_hdspm_channel_info(substream, info);
2898 } 2895 }
2899 default: 2896 default:
@@ -2903,10 +2900,10 @@ static int snd_hdspm_ioctl(snd_pcm_substream_t * substream,
2903 return snd_pcm_lib_ioctl(substream, cmd, arg); 2900 return snd_pcm_lib_ioctl(substream, cmd, arg);
2904} 2901}
2905 2902
2906static int snd_hdspm_trigger(snd_pcm_substream_t * substream, int cmd) 2903static int snd_hdspm_trigger(struct snd_pcm_substream *substream, int cmd)
2907{ 2904{
2908 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 2905 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
2909 snd_pcm_substream_t *other; 2906 struct snd_pcm_substream *other;
2910 int running; 2907 int running;
2911 2908
2912 spin_lock(&hdspm->lock); 2909 spin_lock(&hdspm->lock);
@@ -2930,7 +2927,7 @@ static int snd_hdspm_trigger(snd_pcm_substream_t * substream, int cmd)
2930 2927
2931 if (other) { 2928 if (other) {
2932 struct list_head *pos; 2929 struct list_head *pos;
2933 snd_pcm_substream_t *s; 2930 struct snd_pcm_substream *s;
2934 snd_pcm_group_for_each(pos, substream) { 2931 snd_pcm_group_for_each(pos, substream) {
2935 s = snd_pcm_group_substream_entry(pos); 2932 s = snd_pcm_group_substream_entry(pos);
2936 if (s == other) { 2933 if (s == other) {
@@ -2968,7 +2965,7 @@ static int snd_hdspm_trigger(snd_pcm_substream_t * substream, int cmd)
2968 return 0; 2965 return 0;
2969} 2966}
2970 2967
2971static int snd_hdspm_prepare(snd_pcm_substream_t * substream) 2968static int snd_hdspm_prepare(struct snd_pcm_substream *substream)
2972{ 2969{
2973 return 0; 2970 return 0;
2974} 2971}
@@ -2976,7 +2973,7 @@ static int snd_hdspm_prepare(snd_pcm_substream_t * substream)
2976static unsigned int period_sizes[] = 2973static unsigned int period_sizes[] =
2977 { 64, 128, 256, 512, 1024, 2048, 4096, 8192 }; 2974 { 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
2978 2975
2979static snd_pcm_hardware_t snd_hdspm_playback_subinfo = { 2976static struct snd_pcm_hardware snd_hdspm_playback_subinfo = {
2980 .info = (SNDRV_PCM_INFO_MMAP | 2977 .info = (SNDRV_PCM_INFO_MMAP |
2981 SNDRV_PCM_INFO_MMAP_VALID | 2978 SNDRV_PCM_INFO_MMAP_VALID |
2982 SNDRV_PCM_INFO_NONINTERLEAVED | 2979 SNDRV_PCM_INFO_NONINTERLEAVED |
@@ -3000,7 +2997,7 @@ static snd_pcm_hardware_t snd_hdspm_playback_subinfo = {
3000 .fifo_size = 0 2997 .fifo_size = 0
3001}; 2998};
3002 2999
3003static snd_pcm_hardware_t snd_hdspm_capture_subinfo = { 3000static struct snd_pcm_hardware snd_hdspm_capture_subinfo = {
3004 .info = (SNDRV_PCM_INFO_MMAP | 3001 .info = (SNDRV_PCM_INFO_MMAP |
3005 SNDRV_PCM_INFO_MMAP_VALID | 3002 SNDRV_PCM_INFO_MMAP_VALID |
3006 SNDRV_PCM_INFO_NONINTERLEAVED | 3003 SNDRV_PCM_INFO_NONINTERLEAVED |
@@ -3024,31 +3021,31 @@ static snd_pcm_hardware_t snd_hdspm_capture_subinfo = {
3024 .fifo_size = 0 3021 .fifo_size = 0
3025}; 3022};
3026 3023
3027static snd_pcm_hw_constraint_list_t hw_constraints_period_sizes = { 3024static struct snd_pcm_hw_constraint_list hw_constraints_period_sizes = {
3028 .count = ARRAY_SIZE(period_sizes), 3025 .count = ARRAY_SIZE(period_sizes),
3029 .list = period_sizes, 3026 .list = period_sizes,
3030 .mask = 0 3027 .mask = 0
3031}; 3028};
3032 3029
3033 3030
3034static int snd_hdspm_hw_rule_channels_rate(snd_pcm_hw_params_t * params, 3031static int snd_hdspm_hw_rule_channels_rate(struct snd_pcm_hw_params *params,
3035 snd_pcm_hw_rule_t * rule) 3032 struct snd_pcm_hw_rule * rule)
3036{ 3033{
3037 hdspm_t *hdspm = rule->private; 3034 struct hdspm *hdspm = rule->private;
3038 snd_interval_t *c = 3035 struct snd_interval *c =
3039 hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 3036 hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
3040 snd_interval_t *r = 3037 struct snd_interval *r =
3041 hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); 3038 hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
3042 3039
3043 if (r->min > 48000) { 3040 if (r->min > 48000) {
3044 snd_interval_t t = { 3041 struct snd_interval t = {
3045 .min = 1, 3042 .min = 1,
3046 .max = hdspm->ds_channels, 3043 .max = hdspm->ds_channels,
3047 .integer = 1, 3044 .integer = 1,
3048 }; 3045 };
3049 return snd_interval_refine(c, &t); 3046 return snd_interval_refine(c, &t);
3050 } else if (r->max < 64000) { 3047 } else if (r->max < 64000) {
3051 snd_interval_t t = { 3048 struct snd_interval t = {
3052 .min = 1, 3049 .min = 1,
3053 .max = hdspm->ss_channels, 3050 .max = hdspm->ss_channels,
3054 .integer = 1, 3051 .integer = 1,
@@ -3058,24 +3055,24 @@ static int snd_hdspm_hw_rule_channels_rate(snd_pcm_hw_params_t * params,
3058 return 0; 3055 return 0;
3059} 3056}
3060 3057
3061static int snd_hdspm_hw_rule_rate_channels(snd_pcm_hw_params_t * params, 3058static int snd_hdspm_hw_rule_rate_channels(struct snd_pcm_hw_params *params,
3062 snd_pcm_hw_rule_t * rule) 3059 struct snd_pcm_hw_rule * rule)
3063{ 3060{
3064 hdspm_t *hdspm = rule->private; 3061 struct hdspm *hdspm = rule->private;
3065 snd_interval_t *c = 3062 struct snd_interval *c =
3066 hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 3063 hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
3067 snd_interval_t *r = 3064 struct snd_interval *r =
3068 hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); 3065 hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
3069 3066
3070 if (c->min <= hdspm->ss_channels) { 3067 if (c->min <= hdspm->ss_channels) {
3071 snd_interval_t t = { 3068 struct snd_interval t = {
3072 .min = 32000, 3069 .min = 32000,
3073 .max = 48000, 3070 .max = 48000,
3074 .integer = 1, 3071 .integer = 1,
3075 }; 3072 };
3076 return snd_interval_refine(r, &t); 3073 return snd_interval_refine(r, &t);
3077 } else if (c->max > hdspm->ss_channels) { 3074 } else if (c->max > hdspm->ss_channels) {
3078 snd_interval_t t = { 3075 struct snd_interval t = {
3079 .min = 64000, 3076 .min = 64000,
3080 .max = 96000, 3077 .max = 96000,
3081 .integer = 1, 3078 .integer = 1,
@@ -3086,10 +3083,10 @@ static int snd_hdspm_hw_rule_rate_channels(snd_pcm_hw_params_t * params,
3086 return 0; 3083 return 0;
3087} 3084}
3088 3085
3089static int snd_hdspm_playback_open(snd_pcm_substream_t * substream) 3086static int snd_hdspm_playback_open(struct snd_pcm_substream *substream)
3090{ 3087{
3091 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 3088 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
3092 snd_pcm_runtime_t *runtime = substream->runtime; 3089 struct snd_pcm_runtime *runtime = substream->runtime;
3093 3090
3094 snd_printdd("Open device substream %d\n", substream->stream); 3091 snd_printdd("Open device substream %d\n", substream->stream);
3095 3092
@@ -3124,9 +3121,9 @@ static int snd_hdspm_playback_open(snd_pcm_substream_t * substream)
3124 return 0; 3121 return 0;
3125} 3122}
3126 3123
3127static int snd_hdspm_playback_release(snd_pcm_substream_t * substream) 3124static int snd_hdspm_playback_release(struct snd_pcm_substream *substream)
3128{ 3125{
3129 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 3126 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
3130 3127
3131 spin_lock_irq(&hdspm->lock); 3128 spin_lock_irq(&hdspm->lock);
3132 3129
@@ -3139,10 +3136,10 @@ static int snd_hdspm_playback_release(snd_pcm_substream_t * substream)
3139} 3136}
3140 3137
3141 3138
3142static int snd_hdspm_capture_open(snd_pcm_substream_t * substream) 3139static int snd_hdspm_capture_open(struct snd_pcm_substream *substream)
3143{ 3140{
3144 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 3141 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
3145 snd_pcm_runtime_t *runtime = substream->runtime; 3142 struct snd_pcm_runtime *runtime = substream->runtime;
3146 3143
3147 spin_lock_irq(&hdspm->lock); 3144 spin_lock_irq(&hdspm->lock);
3148 snd_pcm_set_sync(substream); 3145 snd_pcm_set_sync(substream);
@@ -3171,9 +3168,9 @@ static int snd_hdspm_capture_open(snd_pcm_substream_t * substream)
3171 return 0; 3168 return 0;
3172} 3169}
3173 3170
3174static int snd_hdspm_capture_release(snd_pcm_substream_t * substream) 3171static int snd_hdspm_capture_release(struct snd_pcm_substream *substream)
3175{ 3172{
3176 hdspm_t *hdspm = snd_pcm_substream_chip(substream); 3173 struct hdspm *hdspm = snd_pcm_substream_chip(substream);
3177 3174
3178 spin_lock_irq(&hdspm->lock); 3175 spin_lock_irq(&hdspm->lock);
3179 3176
@@ -3184,21 +3181,21 @@ static int snd_hdspm_capture_release(snd_pcm_substream_t * substream)
3184 return 0; 3181 return 0;
3185} 3182}
3186 3183
3187static int snd_hdspm_hwdep_dummy_op(snd_hwdep_t * hw, struct file *file) 3184static int snd_hdspm_hwdep_dummy_op(struct snd_hwdep * hw, struct file *file)
3188{ 3185{
3189 /* we have nothing to initialize but the call is required */ 3186 /* we have nothing to initialize but the call is required */
3190 return 0; 3187 return 0;
3191} 3188}
3192 3189
3193 3190
3194static int snd_hdspm_hwdep_ioctl(snd_hwdep_t * hw, struct file *file, 3191static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file,
3195 unsigned int cmd, unsigned long arg) 3192 unsigned int cmd, unsigned long arg)
3196{ 3193{
3197 hdspm_t *hdspm = (hdspm_t *) hw->private_data; 3194 struct hdspm *hdspm = (struct hdspm *) hw->private_data;
3198 struct sndrv_hdspm_mixer_ioctl mixer; 3195 struct hdspm_mixer_ioctl mixer;
3199 hdspm_config_info_t info; 3196 struct hdspm_config_info info;
3200 hdspm_version_t hdspm_version; 3197 struct hdspm_version hdspm_version;
3201 struct sndrv_hdspm_peak_rms_ioctl rms; 3198 struct hdspm_peak_rms_ioctl rms;
3202 3199
3203 switch (cmd) { 3200 switch (cmd) {
3204 3201
@@ -3209,7 +3206,7 @@ static int snd_hdspm_hwdep_ioctl(snd_hwdep_t * hw, struct file *file,
3209 /* maybe there is a chance to memorymap in future so dont touch just copy */ 3206 /* maybe there is a chance to memorymap in future so dont touch just copy */
3210 if(copy_to_user_fromio((void __user *)rms.peak, 3207 if(copy_to_user_fromio((void __user *)rms.peak,
3211 hdspm->iobase+HDSPM_MADI_peakrmsbase, 3208 hdspm->iobase+HDSPM_MADI_peakrmsbase,
3212 sizeof(hdspm_peak_rms_t)) != 0 ) 3209 sizeof(struct hdspm_peak_rms)) != 0 )
3213 return -EFAULT; 3210 return -EFAULT;
3214 3211
3215 break; 3212 break;
@@ -3250,7 +3247,7 @@ static int snd_hdspm_hwdep_ioctl(snd_hwdep_t * hw, struct file *file,
3250 if (copy_from_user(&mixer, (void __user *)arg, sizeof(mixer))) 3247 if (copy_from_user(&mixer, (void __user *)arg, sizeof(mixer)))
3251 return -EFAULT; 3248 return -EFAULT;
3252 if (copy_to_user 3249 if (copy_to_user
3253 ((void __user *)mixer.mixer, hdspm->mixer, sizeof(hdspm_mixer_t))) 3250 ((void __user *)mixer.mixer, hdspm->mixer, sizeof(struct hdspm_mixer)))
3254 return -EFAULT; 3251 return -EFAULT;
3255 break; 3252 break;
3256 3253
@@ -3260,7 +3257,7 @@ static int snd_hdspm_hwdep_ioctl(snd_hwdep_t * hw, struct file *file,
3260 return 0; 3257 return 0;
3261} 3258}
3262 3259
3263static snd_pcm_ops_t snd_hdspm_playback_ops = { 3260static struct snd_pcm_ops snd_hdspm_playback_ops = {
3264 .open = snd_hdspm_playback_open, 3261 .open = snd_hdspm_playback_open,
3265 .close = snd_hdspm_playback_release, 3262 .close = snd_hdspm_playback_release,
3266 .ioctl = snd_hdspm_ioctl, 3263 .ioctl = snd_hdspm_ioctl,
@@ -3274,7 +3271,7 @@ static snd_pcm_ops_t snd_hdspm_playback_ops = {
3274 .page = snd_pcm_sgbuf_ops_page, 3271 .page = snd_pcm_sgbuf_ops_page,
3275}; 3272};
3276 3273
3277static snd_pcm_ops_t snd_hdspm_capture_ops = { 3274static struct snd_pcm_ops snd_hdspm_capture_ops = {
3278 .open = snd_hdspm_capture_open, 3275 .open = snd_hdspm_capture_open,
3279 .close = snd_hdspm_capture_release, 3276 .close = snd_hdspm_capture_release,
3280 .ioctl = snd_hdspm_ioctl, 3277 .ioctl = snd_hdspm_ioctl,
@@ -3287,10 +3284,10 @@ static snd_pcm_ops_t snd_hdspm_capture_ops = {
3287 .page = snd_pcm_sgbuf_ops_page, 3284 .page = snd_pcm_sgbuf_ops_page,
3288}; 3285};
3289 3286
3290static int __devinit snd_hdspm_create_hwdep(snd_card_t * card, 3287static int __devinit snd_hdspm_create_hwdep(struct snd_card *card,
3291 hdspm_t * hdspm) 3288 struct hdspm * hdspm)
3292{ 3289{
3293 snd_hwdep_t *hw; 3290 struct snd_hwdep *hw;
3294 int err; 3291 int err;
3295 3292
3296 if ((err = snd_hwdep_new(card, "HDSPM hwdep", 0, &hw)) < 0) 3293 if ((err = snd_hwdep_new(card, "HDSPM hwdep", 0, &hw)) < 0)
@@ -3311,10 +3308,10 @@ static int __devinit snd_hdspm_create_hwdep(snd_card_t * card,
3311/*------------------------------------------------------------ 3308/*------------------------------------------------------------
3312 memory interface 3309 memory interface
3313 ------------------------------------------------------------*/ 3310 ------------------------------------------------------------*/
3314static int __devinit snd_hdspm_preallocate_memory(hdspm_t * hdspm) 3311static int __devinit snd_hdspm_preallocate_memory(struct hdspm * hdspm)
3315{ 3312{
3316 int err; 3313 int err;
3317 snd_pcm_t *pcm; 3314 struct snd_pcm *pcm;
3318 size_t wanted; 3315 size_t wanted;
3319 3316
3320 pcm = hdspm->pcm; 3317 pcm = hdspm->pcm;
@@ -3336,7 +3333,7 @@ static int __devinit snd_hdspm_preallocate_memory(hdspm_t * hdspm)
3336 return 0; 3333 return 0;
3337} 3334}
3338 3335
3339static void hdspm_set_sgbuf(hdspm_t * hdspm, struct snd_sg_buf *sgbuf, 3336static void hdspm_set_sgbuf(struct hdspm * hdspm, struct snd_sg_buf *sgbuf,
3340 unsigned int reg, int channels) 3337 unsigned int reg, int channels)
3341{ 3338{
3342 int i; 3339 int i;
@@ -3347,10 +3344,10 @@ static void hdspm_set_sgbuf(hdspm_t * hdspm, struct snd_sg_buf *sgbuf,
3347} 3344}
3348 3345
3349/* ------------- ALSA Devices ---------------------------- */ 3346/* ------------- ALSA Devices ---------------------------- */
3350static int __devinit snd_hdspm_create_pcm(snd_card_t * card, 3347static int __devinit snd_hdspm_create_pcm(struct snd_card *card,
3351 hdspm_t * hdspm) 3348 struct hdspm * hdspm)
3352{ 3349{
3353 snd_pcm_t *pcm; 3350 struct snd_pcm *pcm;
3354 int err; 3351 int err;
3355 3352
3356 if ((err = snd_pcm_new(card, hdspm->card_name, 0, 1, 1, &pcm)) < 0) 3353 if ((err = snd_pcm_new(card, hdspm->card_name, 0, 1, 1, &pcm)) < 0)
@@ -3373,14 +3370,14 @@ static int __devinit snd_hdspm_create_pcm(snd_card_t * card,
3373 return 0; 3370 return 0;
3374} 3371}
3375 3372
3376static inline void snd_hdspm_initialize_midi_flush(hdspm_t * hdspm) 3373static inline void snd_hdspm_initialize_midi_flush(struct hdspm * hdspm)
3377{ 3374{
3378 snd_hdspm_flush_midi_input(hdspm, 0); 3375 snd_hdspm_flush_midi_input(hdspm, 0);
3379 snd_hdspm_flush_midi_input(hdspm, 1); 3376 snd_hdspm_flush_midi_input(hdspm, 1);
3380} 3377}
3381 3378
3382static int __devinit snd_hdspm_create_alsa_devices(snd_card_t * card, 3379static int __devinit snd_hdspm_create_alsa_devices(struct snd_card *card,
3383 hdspm_t * hdspm) 3380 struct hdspm * hdspm)
3384{ 3381{
3385 int err; 3382 int err;
3386 3383
@@ -3430,7 +3427,7 @@ static int __devinit snd_hdspm_create_alsa_devices(snd_card_t * card,
3430 return 0; 3427 return 0;
3431} 3428}
3432 3429
3433static int __devinit snd_hdspm_create(snd_card_t * card, hdspm_t * hdspm, 3430static int __devinit snd_hdspm_create(struct snd_card *card, struct hdspm * hdspm,
3434 int precise_ptr, int enable_monitor) 3431 int precise_ptr, int enable_monitor)
3435{ 3432{
3436 struct pci_dev *pci = hdspm->pci; 3433 struct pci_dev *pci = hdspm->pci;
@@ -3514,12 +3511,11 @@ static int __devinit snd_hdspm_create(snd_card_t * card, hdspm_t * hdspm,
3514 hdspm->monitor_outs = enable_monitor; 3511 hdspm->monitor_outs = enable_monitor;
3515 3512
3516 snd_printdd("kmalloc Mixer memory of %d Bytes\n", 3513 snd_printdd("kmalloc Mixer memory of %d Bytes\n",
3517 sizeof(hdspm_mixer_t)); 3514 sizeof(struct hdspm_mixer));
3518 if ((hdspm->mixer = 3515 if ((hdspm->mixer = kmalloc(sizeof(struct hdspm_mixer), GFP_KERNEL))
3519 (hdspm_mixer_t *) kmalloc(sizeof(hdspm_mixer_t), GFP_KERNEL))
3520 == NULL) { 3516 == NULL) {
3521 snd_printk(KERN_ERR "HDSPM: unable to kmalloc Mixer memory of %d Bytes\n", 3517 snd_printk(KERN_ERR "HDSPM: unable to kmalloc Mixer memory of %d Bytes\n",
3522 (int)sizeof(hdspm_mixer_t)); 3518 (int)sizeof(struct hdspm_mixer));
3523 return err; 3519 return err;
3524 } 3520 }
3525 3521
@@ -3536,7 +3532,7 @@ static int __devinit snd_hdspm_create(snd_card_t * card, hdspm_t * hdspm,
3536 return 0; 3532 return 0;
3537} 3533}
3538 3534
3539static int snd_hdspm_free(hdspm_t * hdspm) 3535static int snd_hdspm_free(struct hdspm * hdspm)
3540{ 3536{
3541 3537
3542 if (hdspm->port) { 3538 if (hdspm->port) {
@@ -3566,9 +3562,9 @@ static int snd_hdspm_free(hdspm_t * hdspm)
3566 return 0; 3562 return 0;
3567} 3563}
3568 3564
3569static void snd_hdspm_card_free(snd_card_t * card) 3565static void snd_hdspm_card_free(struct snd_card *card)
3570{ 3566{
3571 hdspm_t *hdspm = (hdspm_t *) card->private_data; 3567 struct hdspm *hdspm = (struct hdspm *) card->private_data;
3572 3568
3573 if (hdspm) 3569 if (hdspm)
3574 snd_hdspm_free(hdspm); 3570 snd_hdspm_free(hdspm);
@@ -3578,8 +3574,8 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
3578 const struct pci_device_id *pci_id) 3574 const struct pci_device_id *pci_id)
3579{ 3575{
3580 static int dev; 3576 static int dev;
3581 hdspm_t *hdspm; 3577 struct hdspm *hdspm;
3582 snd_card_t *card; 3578 struct snd_card *card;
3583 int err; 3579 int err;
3584 3580
3585 if (dev >= SNDRV_CARDS) 3581 if (dev >= SNDRV_CARDS)
@@ -3590,10 +3586,10 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
3590 } 3586 }
3591 3587
3592 if (!(card = snd_card_new(index[dev], id[dev], 3588 if (!(card = snd_card_new(index[dev], id[dev],
3593 THIS_MODULE, sizeof(hdspm_t)))) 3589 THIS_MODULE, sizeof(struct hdspm))))
3594 return -ENOMEM; 3590 return -ENOMEM;
3595 3591
3596 hdspm = (hdspm_t *) card->private_data; 3592 hdspm = (struct hdspm *) card->private_data;
3597 card->private_free = snd_hdspm_card_free; 3593 card->private_free = snd_hdspm_card_free;
3598 hdspm->dev = dev; 3594 hdspm->dev = dev;
3599 hdspm->pci = pci; 3595 hdspm->pci = pci;