aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/es1938.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:04:01 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:19:33 -0500
commite571f59436d1827b5f00f3fba90b30ad7a5ff01e (patch)
treea0f6a73785923030f8139d5d7061720ff334fffb /sound/pci/es1938.c
parenteb3414b4652344972e86c85ce094cc4a780e1a55 (diff)
[ALSA] Remove xxx_t typedefs: PCI ES1938
Modules: ES1938 driver Remove xxx_t typedefs from the PCI ES1938 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/es1938.c')
-rw-r--r--sound/pci/es1938.c320
1 files changed, 173 insertions, 147 deletions
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index d05c3d2b330c..577877dad2eb 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -191,11 +191,9 @@ MODULE_PARM_DESC(enable, "Enable ESS Solo-1 soundcard.");
191 191
192 */ 192 */
193 193
194typedef struct _snd_es1938 es1938_t;
195
196#define SAVED_REG_SIZE 32 /* max. number of registers to save */ 194#define SAVED_REG_SIZE 32 /* max. number of registers to save */
197 195
198struct _snd_es1938 { 196struct es1938 {
199 int irq; 197 int irq;
200 198
201 unsigned long io_port; 199 unsigned long io_port;
@@ -208,19 +206,18 @@ struct _snd_es1938 {
208 unsigned char irqmask; 206 unsigned char irqmask;
209 unsigned char revision; 207 unsigned char revision;
210 208
211 snd_kcontrol_t *hw_volume; 209 struct snd_kcontrol *hw_volume;
212 snd_kcontrol_t *hw_switch; 210 struct snd_kcontrol *hw_switch;
213 snd_kcontrol_t *master_volume; 211 struct snd_kcontrol *master_volume;
214 snd_kcontrol_t *master_switch; 212 struct snd_kcontrol *master_switch;
215 213
216 struct pci_dev *pci; 214 struct pci_dev *pci;
217 snd_card_t *card; 215 struct snd_card *card;
218 snd_pcm_t *pcm; 216 struct snd_pcm *pcm;
219 snd_pcm_substream_t *capture_substream; 217 struct snd_pcm_substream *capture_substream;
220 snd_pcm_substream_t *playback1_substream; 218 struct snd_pcm_substream *playback1_substream;
221 snd_pcm_substream_t *playback2_substream; 219 struct snd_pcm_substream *playback2_substream;
222 snd_kmixer_t *mixer; 220 struct snd_rawmidi *rmidi;
223 snd_rawmidi_t *rmidi;
224 221
225 unsigned int dma1_size; 222 unsigned int dma1_size;
226 unsigned int dma2_size; 223 unsigned int dma2_size;
@@ -232,7 +229,7 @@ struct _snd_es1938 {
232 229
233 spinlock_t reg_lock; 230 spinlock_t reg_lock;
234 spinlock_t mixer_lock; 231 spinlock_t mixer_lock;
235 snd_info_entry_t *proc_entry; 232 struct snd_info_entry *proc_entry;
236 233
237#ifdef SUPPORT_JOYSTICK 234#ifdef SUPPORT_JOYSTICK
238 struct gameport *gameport; 235 struct gameport *gameport;
@@ -259,7 +256,7 @@ MODULE_DEVICE_TABLE(pci, snd_es1938_ids);
259/* ----------------------------------------------------------------- 256/* -----------------------------------------------------------------
260 * Write to a mixer register 257 * Write to a mixer register
261 * -----------------------------------------------------------------*/ 258 * -----------------------------------------------------------------*/
262static void snd_es1938_mixer_write(es1938_t *chip, unsigned char reg, unsigned char val) 259static void snd_es1938_mixer_write(struct es1938 *chip, unsigned char reg, unsigned char val)
263{ 260{
264 unsigned long flags; 261 unsigned long flags;
265 spin_lock_irqsave(&chip->mixer_lock, flags); 262 spin_lock_irqsave(&chip->mixer_lock, flags);
@@ -274,7 +271,7 @@ static void snd_es1938_mixer_write(es1938_t *chip, unsigned char reg, unsigned c
274/* ----------------------------------------------------------------- 271/* -----------------------------------------------------------------
275 * Read from a mixer register 272 * Read from a mixer register
276 * -----------------------------------------------------------------*/ 273 * -----------------------------------------------------------------*/
277static int snd_es1938_mixer_read(es1938_t *chip, unsigned char reg) 274static int snd_es1938_mixer_read(struct es1938 *chip, unsigned char reg)
278{ 275{
279 int data; 276 int data;
280 unsigned long flags; 277 unsigned long flags;
@@ -291,7 +288,8 @@ static int snd_es1938_mixer_read(es1938_t *chip, unsigned char reg)
291/* ----------------------------------------------------------------- 288/* -----------------------------------------------------------------
292 * Write to some bits of a mixer register (return old value) 289 * Write to some bits of a mixer register (return old value)
293 * -----------------------------------------------------------------*/ 290 * -----------------------------------------------------------------*/
294static int snd_es1938_mixer_bits(es1938_t *chip, unsigned char reg, unsigned char mask, unsigned char val) 291static int snd_es1938_mixer_bits(struct es1938 *chip, unsigned char reg,
292 unsigned char mask, unsigned char val)
295{ 293{
296 unsigned long flags; 294 unsigned long flags;
297 unsigned char old, new, oval; 295 unsigned char old, new, oval;
@@ -314,7 +312,7 @@ static int snd_es1938_mixer_bits(es1938_t *chip, unsigned char reg, unsigned cha
314/* ----------------------------------------------------------------- 312/* -----------------------------------------------------------------
315 * Write command to Controller Registers 313 * Write command to Controller Registers
316 * -----------------------------------------------------------------*/ 314 * -----------------------------------------------------------------*/
317static void snd_es1938_write_cmd(es1938_t *chip, unsigned char cmd) 315static void snd_es1938_write_cmd(struct es1938 *chip, unsigned char cmd)
318{ 316{
319 int i; 317 int i;
320 unsigned char v; 318 unsigned char v;
@@ -330,7 +328,7 @@ static void snd_es1938_write_cmd(es1938_t *chip, unsigned char cmd)
330/* ----------------------------------------------------------------- 328/* -----------------------------------------------------------------
331 * Read the Read Data Buffer 329 * Read the Read Data Buffer
332 * -----------------------------------------------------------------*/ 330 * -----------------------------------------------------------------*/
333static int snd_es1938_get_byte(es1938_t *chip) 331static int snd_es1938_get_byte(struct es1938 *chip)
334{ 332{
335 int i; 333 int i;
336 unsigned char v; 334 unsigned char v;
@@ -344,7 +342,7 @@ static int snd_es1938_get_byte(es1938_t *chip)
344/* ----------------------------------------------------------------- 342/* -----------------------------------------------------------------
345 * Write value cmd register 343 * Write value cmd register
346 * -----------------------------------------------------------------*/ 344 * -----------------------------------------------------------------*/
347static void snd_es1938_write(es1938_t *chip, unsigned char reg, unsigned char val) 345static void snd_es1938_write(struct es1938 *chip, unsigned char reg, unsigned char val)
348{ 346{
349 unsigned long flags; 347 unsigned long flags;
350 spin_lock_irqsave(&chip->reg_lock, flags); 348 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -359,7 +357,7 @@ static void snd_es1938_write(es1938_t *chip, unsigned char reg, unsigned char va
359/* ----------------------------------------------------------------- 357/* -----------------------------------------------------------------
360 * Read data from cmd register and return it 358 * Read data from cmd register and return it
361 * -----------------------------------------------------------------*/ 359 * -----------------------------------------------------------------*/
362static unsigned char snd_es1938_read(es1938_t *chip, unsigned char reg) 360static unsigned char snd_es1938_read(struct es1938 *chip, unsigned char reg)
363{ 361{
364 unsigned char val; 362 unsigned char val;
365 unsigned long flags; 363 unsigned long flags;
@@ -377,7 +375,8 @@ static unsigned char snd_es1938_read(es1938_t *chip, unsigned char reg)
377/* ----------------------------------------------------------------- 375/* -----------------------------------------------------------------
378 * Write data to cmd register and return old value 376 * Write data to cmd register and return old value
379 * -----------------------------------------------------------------*/ 377 * -----------------------------------------------------------------*/
380static int snd_es1938_bits(es1938_t *chip, unsigned char reg, unsigned char mask, unsigned char val) 378static int snd_es1938_bits(struct es1938 *chip, unsigned char reg, unsigned char mask,
379 unsigned char val)
381{ 380{
382 unsigned long flags; 381 unsigned long flags;
383 unsigned char old, new, oval; 382 unsigned char old, new, oval;
@@ -402,7 +401,7 @@ static int snd_es1938_bits(es1938_t *chip, unsigned char reg, unsigned char mask
402/* -------------------------------------------------------------------- 401/* --------------------------------------------------------------------
403 * Reset the chip 402 * Reset the chip
404 * --------------------------------------------------------------------*/ 403 * --------------------------------------------------------------------*/
405static void snd_es1938_reset(es1938_t *chip) 404static void snd_es1938_reset(struct es1938 *chip)
406{ 405{
407 int i; 406 int i;
408 407
@@ -441,13 +440,13 @@ static void snd_es1938_reset(es1938_t *chip)
441/* -------------------------------------------------------------------- 440/* --------------------------------------------------------------------
442 * Reset the FIFOs 441 * Reset the FIFOs
443 * --------------------------------------------------------------------*/ 442 * --------------------------------------------------------------------*/
444static void snd_es1938_reset_fifo(es1938_t *chip) 443static void snd_es1938_reset_fifo(struct es1938 *chip)
445{ 444{
446 outb(2, SLSB_REG(chip, RESET)); 445 outb(2, SLSB_REG(chip, RESET));
447 outb(0, SLSB_REG(chip, RESET)); 446 outb(0, SLSB_REG(chip, RESET));
448} 447}
449 448
450static ratnum_t clocks[2] = { 449static struct snd_ratnum clocks[2] = {
451 { 450 {
452 .num = 793800, 451 .num = 793800,
453 .den_min = 1, 452 .den_min = 1,
@@ -462,18 +461,18 @@ static ratnum_t clocks[2] = {
462 } 461 }
463}; 462};
464 463
465static snd_pcm_hw_constraint_ratnums_t hw_constraints_clocks = { 464static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {
466 .nrats = 2, 465 .nrats = 2,
467 .rats = clocks, 466 .rats = clocks,
468}; 467};
469 468
470 469
471static void snd_es1938_rate_set(es1938_t *chip, 470static void snd_es1938_rate_set(struct es1938 *chip,
472 snd_pcm_substream_t *substream, 471 struct snd_pcm_substream *substream,
473 int mode) 472 int mode)
474{ 473{
475 unsigned int bits, div0; 474 unsigned int bits, div0;
476 snd_pcm_runtime_t *runtime = substream->runtime; 475 struct snd_pcm_runtime *runtime = substream->runtime;
477 if (runtime->rate_num == clocks[0].num) 476 if (runtime->rate_num == clocks[0].num)
478 bits = 128 - runtime->rate_den; 477 bits = 128 - runtime->rate_den;
479 else 478 else
@@ -495,7 +494,7 @@ static void snd_es1938_rate_set(es1938_t *chip,
495 * Configure Solo1 builtin DMA Controller 494 * Configure Solo1 builtin DMA Controller
496 * --------------------------------------------------------------------*/ 495 * --------------------------------------------------------------------*/
497 496
498static void snd_es1938_playback1_setdma(es1938_t *chip) 497static void snd_es1938_playback1_setdma(struct es1938 *chip)
499{ 498{
500 outb(0x00, SLIO_REG(chip, AUDIO2MODE)); 499 outb(0x00, SLIO_REG(chip, AUDIO2MODE));
501 outl(chip->dma2_start, SLIO_REG(chip, AUDIO2DMAADDR)); 500 outl(chip->dma2_start, SLIO_REG(chip, AUDIO2DMAADDR));
@@ -503,7 +502,7 @@ static void snd_es1938_playback1_setdma(es1938_t *chip)
503 outw(chip->dma2_size, SLIO_REG(chip, AUDIO2DMACOUNT)); 502 outw(chip->dma2_size, SLIO_REG(chip, AUDIO2DMACOUNT));
504} 503}
505 504
506static void snd_es1938_playback2_setdma(es1938_t *chip) 505static void snd_es1938_playback2_setdma(struct es1938 *chip)
507{ 506{
508 /* Enable DMA controller */ 507 /* Enable DMA controller */
509 outb(0xc4, SLDM_REG(chip, DMACOMMAND)); 508 outb(0xc4, SLDM_REG(chip, DMACOMMAND));
@@ -518,7 +517,7 @@ static void snd_es1938_playback2_setdma(es1938_t *chip)
518 outb(0, SLDM_REG(chip, DMAMASK)); 517 outb(0, SLDM_REG(chip, DMAMASK));
519} 518}
520 519
521static void snd_es1938_capture_setdma(es1938_t *chip) 520static void snd_es1938_capture_setdma(struct es1938 *chip)
522{ 521{
523 /* Enable DMA controller */ 522 /* Enable DMA controller */
524 outb(0xc4, SLDM_REG(chip, DMACOMMAND)); 523 outb(0xc4, SLDM_REG(chip, DMACOMMAND));
@@ -538,10 +537,10 @@ static void snd_es1938_capture_setdma(es1938_t *chip)
538 * *** PCM part *** 537 * *** PCM part ***
539 */ 538 */
540 539
541static int snd_es1938_capture_trigger(snd_pcm_substream_t * substream, 540static int snd_es1938_capture_trigger(struct snd_pcm_substream *substream,
542 int cmd) 541 int cmd)
543{ 542{
544 es1938_t *chip = snd_pcm_substream_chip(substream); 543 struct es1938 *chip = snd_pcm_substream_chip(substream);
545 int val; 544 int val;
546 switch (cmd) { 545 switch (cmd) {
547 case SNDRV_PCM_TRIGGER_START: 546 case SNDRV_PCM_TRIGGER_START:
@@ -561,10 +560,10 @@ static int snd_es1938_capture_trigger(snd_pcm_substream_t * substream,
561 return 0; 560 return 0;
562} 561}
563 562
564static int snd_es1938_playback1_trigger(snd_pcm_substream_t * substream, 563static int snd_es1938_playback1_trigger(struct snd_pcm_substream *substream,
565 int cmd) 564 int cmd)
566{ 565{
567 es1938_t *chip = snd_pcm_substream_chip(substream); 566 struct es1938 *chip = snd_pcm_substream_chip(substream);
568 switch (cmd) { 567 switch (cmd) {
569 case SNDRV_PCM_TRIGGER_START: 568 case SNDRV_PCM_TRIGGER_START:
570 case SNDRV_PCM_TRIGGER_RESUME: 569 case SNDRV_PCM_TRIGGER_RESUME:
@@ -591,10 +590,10 @@ static int snd_es1938_playback1_trigger(snd_pcm_substream_t * substream,
591 return 0; 590 return 0;
592} 591}
593 592
594static int snd_es1938_playback2_trigger(snd_pcm_substream_t * substream, 593static int snd_es1938_playback2_trigger(struct snd_pcm_substream *substream,
595 int cmd) 594 int cmd)
596{ 595{
597 es1938_t *chip = snd_pcm_substream_chip(substream); 596 struct es1938 *chip = snd_pcm_substream_chip(substream);
598 int val; 597 int val;
599 switch (cmd) { 598 switch (cmd) {
600 case SNDRV_PCM_TRIGGER_START: 599 case SNDRV_PCM_TRIGGER_START:
@@ -614,7 +613,7 @@ static int snd_es1938_playback2_trigger(snd_pcm_substream_t * substream,
614 return 0; 613 return 0;
615} 614}
616 615
617static int snd_es1938_playback_trigger(snd_pcm_substream_t *substream, 616static int snd_es1938_playback_trigger(struct snd_pcm_substream *substream,
618 int cmd) 617 int cmd)
619{ 618{
620 switch (substream->number) { 619 switch (substream->number) {
@@ -630,10 +629,10 @@ static int snd_es1938_playback_trigger(snd_pcm_substream_t *substream,
630/* -------------------------------------------------------------------- 629/* --------------------------------------------------------------------
631 * First channel for Extended Mode Audio 1 ADC Operation 630 * First channel for Extended Mode Audio 1 ADC Operation
632 * --------------------------------------------------------------------*/ 631 * --------------------------------------------------------------------*/
633static int snd_es1938_capture_prepare(snd_pcm_substream_t * substream) 632static int snd_es1938_capture_prepare(struct snd_pcm_substream *substream)
634{ 633{
635 es1938_t *chip = snd_pcm_substream_chip(substream); 634 struct es1938 *chip = snd_pcm_substream_chip(substream);
636 snd_pcm_runtime_t *runtime = substream->runtime; 635 struct snd_pcm_runtime *runtime = substream->runtime;
637 int u, is8, mono; 636 int u, is8, mono;
638 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 637 unsigned int size = snd_pcm_lib_buffer_bytes(substream);
639 unsigned int count = snd_pcm_lib_period_bytes(substream); 638 unsigned int count = snd_pcm_lib_period_bytes(substream);
@@ -678,10 +677,10 @@ static int snd_es1938_capture_prepare(snd_pcm_substream_t * substream)
678/* ------------------------------------------------------------------------------ 677/* ------------------------------------------------------------------------------
679 * Second Audio channel DAC Operation 678 * Second Audio channel DAC Operation
680 * ------------------------------------------------------------------------------*/ 679 * ------------------------------------------------------------------------------*/
681static int snd_es1938_playback1_prepare(snd_pcm_substream_t * substream) 680static int snd_es1938_playback1_prepare(struct snd_pcm_substream *substream)
682{ 681{
683 es1938_t *chip = snd_pcm_substream_chip(substream); 682 struct es1938 *chip = snd_pcm_substream_chip(substream);
684 snd_pcm_runtime_t *runtime = substream->runtime; 683 struct snd_pcm_runtime *runtime = substream->runtime;
685 int u, is8, mono; 684 int u, is8, mono;
686 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 685 unsigned int size = snd_pcm_lib_buffer_bytes(substream);
687 unsigned int count = snd_pcm_lib_period_bytes(substream); 686 unsigned int count = snd_pcm_lib_period_bytes(substream);
@@ -706,7 +705,8 @@ static int snd_es1938_playback1_prepare(snd_pcm_substream_t * substream)
706 snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2TCOUNTH, count >> 8); 705 snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2TCOUNTH, count >> 8);
707 706
708 /* initialize and configure Audio 2 DAC */ 707 /* initialize and configure Audio 2 DAC */
709 snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL2, 0x40 | (u ? 0 : 4) | (mono ? 0 : 2) | (is8 ? 0 : 1)); 708 snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL2, 0x40 | (u ? 0 : 4) |
709 (mono ? 0 : 2) | (is8 ? 0 : 1));
710 710
711 /* program DMA */ 711 /* program DMA */
712 snd_es1938_playback1_setdma(chip); 712 snd_es1938_playback1_setdma(chip);
@@ -714,10 +714,10 @@ static int snd_es1938_playback1_prepare(snd_pcm_substream_t * substream)
714 return 0; 714 return 0;
715} 715}
716 716
717static int snd_es1938_playback2_prepare(snd_pcm_substream_t * substream) 717static int snd_es1938_playback2_prepare(struct snd_pcm_substream *substream)
718{ 718{
719 es1938_t *chip = snd_pcm_substream_chip(substream); 719 struct es1938 *chip = snd_pcm_substream_chip(substream);
720 snd_pcm_runtime_t *runtime = substream->runtime; 720 struct snd_pcm_runtime *runtime = substream->runtime;
721 int u, is8, mono; 721 int u, is8, mono;
722 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 722 unsigned int size = snd_pcm_lib_buffer_bytes(substream);
723 unsigned int count = snd_pcm_lib_period_bytes(substream); 723 unsigned int count = snd_pcm_lib_period_bytes(substream);
@@ -756,7 +756,7 @@ static int snd_es1938_playback2_prepare(snd_pcm_substream_t * substream)
756 return 0; 756 return 0;
757} 757}
758 758
759static int snd_es1938_playback_prepare(snd_pcm_substream_t *substream) 759static int snd_es1938_playback_prepare(struct snd_pcm_substream *substream)
760{ 760{
761 switch (substream->number) { 761 switch (substream->number) {
762 case 0: 762 case 0:
@@ -768,9 +768,9 @@ static int snd_es1938_playback_prepare(snd_pcm_substream_t *substream)
768 return -EINVAL; 768 return -EINVAL;
769} 769}
770 770
771static snd_pcm_uframes_t snd_es1938_capture_pointer(snd_pcm_substream_t * substream) 771static snd_pcm_uframes_t snd_es1938_capture_pointer(struct snd_pcm_substream *substream)
772{ 772{
773 es1938_t *chip = snd_pcm_substream_chip(substream); 773 struct es1938 *chip = snd_pcm_substream_chip(substream);
774 size_t ptr; 774 size_t ptr;
775 size_t old, new; 775 size_t old, new;
776#if 1 776#if 1
@@ -785,9 +785,9 @@ static snd_pcm_uframes_t snd_es1938_capture_pointer(snd_pcm_substream_t * substr
785 return ptr >> chip->dma1_shift; 785 return ptr >> chip->dma1_shift;
786} 786}
787 787
788static snd_pcm_uframes_t snd_es1938_playback1_pointer(snd_pcm_substream_t * substream) 788static snd_pcm_uframes_t snd_es1938_playback1_pointer(struct snd_pcm_substream *substream)
789{ 789{
790 es1938_t *chip = snd_pcm_substream_chip(substream); 790 struct es1938 *chip = snd_pcm_substream_chip(substream);
791 size_t ptr; 791 size_t ptr;
792#if 1 792#if 1
793 ptr = chip->dma2_size - inw(SLIO_REG(chip, AUDIO2DMACOUNT)); 793 ptr = chip->dma2_size - inw(SLIO_REG(chip, AUDIO2DMACOUNT));
@@ -797,9 +797,9 @@ static snd_pcm_uframes_t snd_es1938_playback1_pointer(snd_pcm_substream_t * subs
797 return ptr >> chip->dma2_shift; 797 return ptr >> chip->dma2_shift;
798} 798}
799 799
800static snd_pcm_uframes_t snd_es1938_playback2_pointer(snd_pcm_substream_t * substream) 800static snd_pcm_uframes_t snd_es1938_playback2_pointer(struct snd_pcm_substream *substream)
801{ 801{
802 es1938_t *chip = snd_pcm_substream_chip(substream); 802 struct es1938 *chip = snd_pcm_substream_chip(substream);
803 size_t ptr; 803 size_t ptr;
804 size_t old, new; 804 size_t old, new;
805#if 1 805#if 1
@@ -814,7 +814,7 @@ static snd_pcm_uframes_t snd_es1938_playback2_pointer(snd_pcm_substream_t * subs
814 return ptr >> chip->dma1_shift; 814 return ptr >> chip->dma1_shift;
815} 815}
816 816
817static snd_pcm_uframes_t snd_es1938_playback_pointer(snd_pcm_substream_t *substream) 817static snd_pcm_uframes_t snd_es1938_playback_pointer(struct snd_pcm_substream *substream)
818{ 818{
819 switch (substream->number) { 819 switch (substream->number) {
820 case 0: 820 case 0:
@@ -826,14 +826,14 @@ static snd_pcm_uframes_t snd_es1938_playback_pointer(snd_pcm_substream_t *substr
826 return -EINVAL; 826 return -EINVAL;
827} 827}
828 828
829static int snd_es1938_capture_copy(snd_pcm_substream_t *substream, 829static int snd_es1938_capture_copy(struct snd_pcm_substream *substream,
830 int channel, 830 int channel,
831 snd_pcm_uframes_t pos, 831 snd_pcm_uframes_t pos,
832 void __user *dst, 832 void __user *dst,
833 snd_pcm_uframes_t count) 833 snd_pcm_uframes_t count)
834{ 834{
835 snd_pcm_runtime_t *runtime = substream->runtime; 835 struct snd_pcm_runtime *runtime = substream->runtime;
836 es1938_t *chip = snd_pcm_substream_chip(substream); 836 struct es1938 *chip = snd_pcm_substream_chip(substream);
837 pos <<= chip->dma1_shift; 837 pos <<= chip->dma1_shift;
838 count <<= chip->dma1_shift; 838 count <<= chip->dma1_shift;
839 snd_assert(pos + count <= chip->dma1_size, return -EINVAL); 839 snd_assert(pos + count <= chip->dma1_size, return -EINVAL);
@@ -852,8 +852,8 @@ static int snd_es1938_capture_copy(snd_pcm_substream_t *substream,
852/* 852/*
853 * buffer management 853 * buffer management
854 */ 854 */
855static int snd_es1938_pcm_hw_params(snd_pcm_substream_t *substream, 855static int snd_es1938_pcm_hw_params(struct snd_pcm_substream *substream,
856 snd_pcm_hw_params_t * hw_params) 856 struct snd_pcm_hw_params *hw_params)
857 857
858{ 858{
859 int err; 859 int err;
@@ -863,7 +863,7 @@ static int snd_es1938_pcm_hw_params(snd_pcm_substream_t *substream,
863 return 0; 863 return 0;
864} 864}
865 865
866static int snd_es1938_pcm_hw_free(snd_pcm_substream_t *substream) 866static int snd_es1938_pcm_hw_free(struct snd_pcm_substream *substream)
867{ 867{
868 return snd_pcm_lib_free_pages(substream); 868 return snd_pcm_lib_free_pages(substream);
869} 869}
@@ -871,11 +871,12 @@ static int snd_es1938_pcm_hw_free(snd_pcm_substream_t *substream)
871/* ---------------------------------------------------------------------- 871/* ----------------------------------------------------------------------
872 * Audio1 Capture (ADC) 872 * Audio1 Capture (ADC)
873 * ----------------------------------------------------------------------*/ 873 * ----------------------------------------------------------------------*/
874static snd_pcm_hardware_t snd_es1938_capture = 874static struct snd_pcm_hardware snd_es1938_capture =
875{ 875{
876 .info = (SNDRV_PCM_INFO_INTERLEAVED | 876 .info = (SNDRV_PCM_INFO_INTERLEAVED |
877 SNDRV_PCM_INFO_BLOCK_TRANSFER), 877 SNDRV_PCM_INFO_BLOCK_TRANSFER),
878 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE, 878 .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE |
879 SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE),
879 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, 880 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
880 .rate_min = 6000, 881 .rate_min = 6000,
881 .rate_max = 48000, 882 .rate_max = 48000,
@@ -892,12 +893,13 @@ static snd_pcm_hardware_t snd_es1938_capture =
892/* ----------------------------------------------------------------------- 893/* -----------------------------------------------------------------------
893 * Audio2 Playback (DAC) 894 * Audio2 Playback (DAC)
894 * -----------------------------------------------------------------------*/ 895 * -----------------------------------------------------------------------*/
895static snd_pcm_hardware_t snd_es1938_playback = 896static struct snd_pcm_hardware snd_es1938_playback =
896{ 897{
897 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 898 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
898 SNDRV_PCM_INFO_BLOCK_TRANSFER | 899 SNDRV_PCM_INFO_BLOCK_TRANSFER |
899 SNDRV_PCM_INFO_MMAP_VALID), 900 SNDRV_PCM_INFO_MMAP_VALID),
900 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE, 901 .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE |
902 SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE),
901 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, 903 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
902 .rate_min = 6000, 904 .rate_min = 6000,
903 .rate_max = 48000, 905 .rate_max = 48000,
@@ -911,10 +913,10 @@ static snd_pcm_hardware_t snd_es1938_playback =
911 .fifo_size = 256, 913 .fifo_size = 256,
912}; 914};
913 915
914static int snd_es1938_capture_open(snd_pcm_substream_t * substream) 916static int snd_es1938_capture_open(struct snd_pcm_substream *substream)
915{ 917{
916 es1938_t *chip = snd_pcm_substream_chip(substream); 918 struct es1938 *chip = snd_pcm_substream_chip(substream);
917 snd_pcm_runtime_t *runtime = substream->runtime; 919 struct snd_pcm_runtime *runtime = substream->runtime;
918 920
919 if (chip->playback2_substream) 921 if (chip->playback2_substream)
920 return -EAGAIN; 922 return -EAGAIN;
@@ -926,10 +928,10 @@ static int snd_es1938_capture_open(snd_pcm_substream_t * substream)
926 return 0; 928 return 0;
927} 929}
928 930
929static int snd_es1938_playback_open(snd_pcm_substream_t * substream) 931static int snd_es1938_playback_open(struct snd_pcm_substream *substream)
930{ 932{
931 es1938_t *chip = snd_pcm_substream_chip(substream); 933 struct es1938 *chip = snd_pcm_substream_chip(substream);
932 snd_pcm_runtime_t *runtime = substream->runtime; 934 struct snd_pcm_runtime *runtime = substream->runtime;
933 935
934 switch (substream->number) { 936 switch (substream->number) {
935 case 0: 937 case 0:
@@ -951,17 +953,17 @@ static int snd_es1938_playback_open(snd_pcm_substream_t * substream)
951 return 0; 953 return 0;
952} 954}
953 955
954static int snd_es1938_capture_close(snd_pcm_substream_t * substream) 956static int snd_es1938_capture_close(struct snd_pcm_substream *substream)
955{ 957{
956 es1938_t *chip = snd_pcm_substream_chip(substream); 958 struct es1938 *chip = snd_pcm_substream_chip(substream);
957 959
958 chip->capture_substream = NULL; 960 chip->capture_substream = NULL;
959 return 0; 961 return 0;
960} 962}
961 963
962static int snd_es1938_playback_close(snd_pcm_substream_t * substream) 964static int snd_es1938_playback_close(struct snd_pcm_substream *substream)
963{ 965{
964 es1938_t *chip = snd_pcm_substream_chip(substream); 966 struct es1938 *chip = snd_pcm_substream_chip(substream);
965 967
966 switch (substream->number) { 968 switch (substream->number) {
967 case 0: 969 case 0:
@@ -977,7 +979,7 @@ static int snd_es1938_playback_close(snd_pcm_substream_t * substream)
977 return 0; 979 return 0;
978} 980}
979 981
980static snd_pcm_ops_t snd_es1938_playback_ops = { 982static struct snd_pcm_ops snd_es1938_playback_ops = {
981 .open = snd_es1938_playback_open, 983 .open = snd_es1938_playback_open,
982 .close = snd_es1938_playback_close, 984 .close = snd_es1938_playback_close,
983 .ioctl = snd_pcm_lib_ioctl, 985 .ioctl = snd_pcm_lib_ioctl,
@@ -988,7 +990,7 @@ static snd_pcm_ops_t snd_es1938_playback_ops = {
988 .pointer = snd_es1938_playback_pointer, 990 .pointer = snd_es1938_playback_pointer,
989}; 991};
990 992
991static snd_pcm_ops_t snd_es1938_capture_ops = { 993static struct snd_pcm_ops snd_es1938_capture_ops = {
992 .open = snd_es1938_capture_open, 994 .open = snd_es1938_capture_open,
993 .close = snd_es1938_capture_close, 995 .close = snd_es1938_capture_close,
994 .ioctl = snd_pcm_lib_ioctl, 996 .ioctl = snd_pcm_lib_ioctl,
@@ -1000,9 +1002,9 @@ static snd_pcm_ops_t snd_es1938_capture_ops = {
1000 .copy = snd_es1938_capture_copy, 1002 .copy = snd_es1938_capture_copy,
1001}; 1003};
1002 1004
1003static int __devinit snd_es1938_new_pcm(es1938_t *chip, int device) 1005static int __devinit snd_es1938_new_pcm(struct es1938 *chip, int device)
1004{ 1006{
1005 snd_pcm_t *pcm; 1007 struct snd_pcm *pcm;
1006 int err; 1008 int err;
1007 1009
1008 if ((err = snd_pcm_new(chip->card, "es-1938-1946", device, 2, 1, &pcm)) < 0) 1010 if ((err = snd_pcm_new(chip->card, "es-1938-1946", device, 2, 1, &pcm)) < 0)
@@ -1026,7 +1028,8 @@ static int __devinit snd_es1938_new_pcm(es1938_t *chip, int device)
1026 * *** Mixer part *** 1028 * *** Mixer part ***
1027 */ 1029 */
1028 1030
1029static int snd_es1938_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1031static int snd_es1938_info_mux(struct snd_kcontrol *kcontrol,
1032 struct snd_ctl_elem_info *uinfo)
1030{ 1033{
1031 static char *texts[8] = { 1034 static char *texts[8] = {
1032 "Mic", "Mic Master", "CD", "AOUT", 1035 "Mic", "Mic Master", "CD", "AOUT",
@@ -1042,16 +1045,18 @@ static int snd_es1938_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * u
1042 return 0; 1045 return 0;
1043} 1046}
1044 1047
1045static int snd_es1938_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1048static int snd_es1938_get_mux(struct snd_kcontrol *kcontrol,
1049 struct snd_ctl_elem_value *ucontrol)
1046{ 1050{
1047 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1051 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1048 ucontrol->value.enumerated.item[0] = snd_es1938_mixer_read(chip, 0x1c) & 0x07; 1052 ucontrol->value.enumerated.item[0] = snd_es1938_mixer_read(chip, 0x1c) & 0x07;
1049 return 0; 1053 return 0;
1050} 1054}
1051 1055
1052static int snd_es1938_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1056static int snd_es1938_put_mux(struct snd_kcontrol *kcontrol,
1057 struct snd_ctl_elem_value *ucontrol)
1053{ 1058{
1054 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1059 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1055 unsigned char val = ucontrol->value.enumerated.item[0]; 1060 unsigned char val = ucontrol->value.enumerated.item[0];
1056 1061
1057 if (val > 7) 1062 if (val > 7)
@@ -1059,7 +1064,8 @@ static int snd_es1938_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *
1059 return snd_es1938_mixer_bits(chip, 0x1c, 0x07, val) != val; 1064 return snd_es1938_mixer_bits(chip, 0x1c, 0x07, val) != val;
1060} 1065}
1061 1066
1062static int snd_es1938_info_spatializer_enable(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1067static int snd_es1938_info_spatializer_enable(struct snd_kcontrol *kcontrol,
1068 struct snd_ctl_elem_info *uinfo)
1063{ 1069{
1064 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1070 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1065 uinfo->count = 1; 1071 uinfo->count = 1;
@@ -1068,17 +1074,19 @@ static int snd_es1938_info_spatializer_enable(snd_kcontrol_t *kcontrol, snd_ctl_
1068 return 0; 1074 return 0;
1069} 1075}
1070 1076
1071static int snd_es1938_get_spatializer_enable(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1077static int snd_es1938_get_spatializer_enable(struct snd_kcontrol *kcontrol,
1078 struct snd_ctl_elem_value *ucontrol)
1072{ 1079{
1073 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1080 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1074 unsigned char val = snd_es1938_mixer_read(chip, 0x50); 1081 unsigned char val = snd_es1938_mixer_read(chip, 0x50);
1075 ucontrol->value.integer.value[0] = !!(val & 8); 1082 ucontrol->value.integer.value[0] = !!(val & 8);
1076 return 0; 1083 return 0;
1077} 1084}
1078 1085
1079static int snd_es1938_put_spatializer_enable(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1086static int snd_es1938_put_spatializer_enable(struct snd_kcontrol *kcontrol,
1087 struct snd_ctl_elem_value *ucontrol)
1080{ 1088{
1081 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1089 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1082 unsigned char oval, nval; 1090 unsigned char oval, nval;
1083 int change; 1091 int change;
1084 nval = ucontrol->value.integer.value[0] ? 0x0c : 0x04; 1092 nval = ucontrol->value.integer.value[0] ? 0x0c : 0x04;
@@ -1091,7 +1099,8 @@ static int snd_es1938_put_spatializer_enable(snd_kcontrol_t * kcontrol, snd_ctl_
1091 return change; 1099 return change;
1092} 1100}
1093 1101
1094static int snd_es1938_info_hw_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1102static int snd_es1938_info_hw_volume(struct snd_kcontrol *kcontrol,
1103 struct snd_ctl_elem_info *uinfo)
1095{ 1104{
1096 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1105 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1097 uinfo->count = 2; 1106 uinfo->count = 2;
@@ -1100,15 +1109,17 @@ static int snd_es1938_info_hw_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info
1100 return 0; 1109 return 0;
1101} 1110}
1102 1111
1103static int snd_es1938_get_hw_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1112static int snd_es1938_get_hw_volume(struct snd_kcontrol *kcontrol,
1113 struct snd_ctl_elem_value *ucontrol)
1104{ 1114{
1105 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1115 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1106 ucontrol->value.integer.value[0] = snd_es1938_mixer_read(chip, 0x61) & 0x3f; 1116 ucontrol->value.integer.value[0] = snd_es1938_mixer_read(chip, 0x61) & 0x3f;
1107 ucontrol->value.integer.value[1] = snd_es1938_mixer_read(chip, 0x63) & 0x3f; 1117 ucontrol->value.integer.value[1] = snd_es1938_mixer_read(chip, 0x63) & 0x3f;
1108 return 0; 1118 return 0;
1109} 1119}
1110 1120
1111static int snd_es1938_info_hw_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1121static int snd_es1938_info_hw_switch(struct snd_kcontrol *kcontrol,
1122 struct snd_ctl_elem_info *uinfo)
1112{ 1123{
1113 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1124 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1114 uinfo->count = 2; 1125 uinfo->count = 2;
@@ -1117,24 +1128,25 @@ static int snd_es1938_info_hw_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_info
1117 return 0; 1128 return 0;
1118} 1129}
1119 1130
1120static int snd_es1938_get_hw_switch(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1131static int snd_es1938_get_hw_switch(struct snd_kcontrol *kcontrol,
1132 struct snd_ctl_elem_value *ucontrol)
1121{ 1133{
1122 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1134 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1123 ucontrol->value.integer.value[0] = !(snd_es1938_mixer_read(chip, 0x61) & 0x40); 1135 ucontrol->value.integer.value[0] = !(snd_es1938_mixer_read(chip, 0x61) & 0x40);
1124 ucontrol->value.integer.value[1] = !(snd_es1938_mixer_read(chip, 0x63) & 0x40); 1136 ucontrol->value.integer.value[1] = !(snd_es1938_mixer_read(chip, 0x63) & 0x40);
1125 return 0; 1137 return 0;
1126} 1138}
1127 1139
1128static void snd_es1938_hwv_free(snd_kcontrol_t *kcontrol) 1140static void snd_es1938_hwv_free(struct snd_kcontrol *kcontrol)
1129{ 1141{
1130 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1142 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1131 chip->master_volume = NULL; 1143 chip->master_volume = NULL;
1132 chip->master_switch = NULL; 1144 chip->master_switch = NULL;
1133 chip->hw_volume = NULL; 1145 chip->hw_volume = NULL;
1134 chip->hw_switch = NULL; 1146 chip->hw_switch = NULL;
1135} 1147}
1136 1148
1137static int snd_es1938_reg_bits(es1938_t *chip, unsigned char reg, 1149static int snd_es1938_reg_bits(struct es1938 *chip, unsigned char reg,
1138 unsigned char mask, unsigned char val) 1150 unsigned char mask, unsigned char val)
1139{ 1151{
1140 if (reg < 0xa0) 1152 if (reg < 0xa0)
@@ -1143,7 +1155,7 @@ static int snd_es1938_reg_bits(es1938_t *chip, unsigned char reg,
1143 return snd_es1938_bits(chip, reg, mask, val); 1155 return snd_es1938_bits(chip, reg, mask, val);
1144} 1156}
1145 1157
1146static int snd_es1938_reg_read(es1938_t *chip, unsigned char reg) 1158static int snd_es1938_reg_read(struct es1938 *chip, unsigned char reg)
1147{ 1159{
1148 if (reg < 0xa0) 1160 if (reg < 0xa0)
1149 return snd_es1938_mixer_read(chip, reg); 1161 return snd_es1938_mixer_read(chip, reg);
@@ -1157,7 +1169,8 @@ static int snd_es1938_reg_read(es1938_t *chip, unsigned char reg)
1157 .get = snd_es1938_get_single, .put = snd_es1938_put_single, \ 1169 .get = snd_es1938_get_single, .put = snd_es1938_put_single, \
1158 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 1170 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
1159 1171
1160static int snd_es1938_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1172static int snd_es1938_info_single(struct snd_kcontrol *kcontrol,
1173 struct snd_ctl_elem_info *uinfo)
1161{ 1174{
1162 int mask = (kcontrol->private_value >> 16) & 0xff; 1175 int mask = (kcontrol->private_value >> 16) & 0xff;
1163 1176
@@ -1168,9 +1181,10 @@ static int snd_es1938_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
1168 return 0; 1181 return 0;
1169} 1182}
1170 1183
1171static int snd_es1938_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1184static int snd_es1938_get_single(struct snd_kcontrol *kcontrol,
1185 struct snd_ctl_elem_value *ucontrol)
1172{ 1186{
1173 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1187 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1174 int reg = kcontrol->private_value & 0xff; 1188 int reg = kcontrol->private_value & 0xff;
1175 int shift = (kcontrol->private_value >> 8) & 0xff; 1189 int shift = (kcontrol->private_value >> 8) & 0xff;
1176 int mask = (kcontrol->private_value >> 16) & 0xff; 1190 int mask = (kcontrol->private_value >> 16) & 0xff;
@@ -1184,9 +1198,10 @@ static int snd_es1938_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1184 return 0; 1198 return 0;
1185} 1199}
1186 1200
1187static int snd_es1938_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1201static int snd_es1938_put_single(struct snd_kcontrol *kcontrol,
1202 struct snd_ctl_elem_value *ucontrol)
1188{ 1203{
1189 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1204 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1190 int reg = kcontrol->private_value & 0xff; 1205 int reg = kcontrol->private_value & 0xff;
1191 int shift = (kcontrol->private_value >> 8) & 0xff; 1206 int shift = (kcontrol->private_value >> 8) & 0xff;
1192 int mask = (kcontrol->private_value >> 16) & 0xff; 1207 int mask = (kcontrol->private_value >> 16) & 0xff;
@@ -1207,7 +1222,8 @@ static int snd_es1938_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1207 .get = snd_es1938_get_double, .put = snd_es1938_put_double, \ 1222 .get = snd_es1938_get_double, .put = snd_es1938_put_double, \
1208 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 1223 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
1209 1224
1210static int snd_es1938_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1225static int snd_es1938_info_double(struct snd_kcontrol *kcontrol,
1226 struct snd_ctl_elem_info *uinfo)
1211{ 1227{
1212 int mask = (kcontrol->private_value >> 24) & 0xff; 1228 int mask = (kcontrol->private_value >> 24) & 0xff;
1213 1229
@@ -1218,9 +1234,10 @@ static int snd_es1938_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
1218 return 0; 1234 return 0;
1219} 1235}
1220 1236
1221static int snd_es1938_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1237static int snd_es1938_get_double(struct snd_kcontrol *kcontrol,
1238 struct snd_ctl_elem_value *ucontrol)
1222{ 1239{
1223 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1240 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1224 int left_reg = kcontrol->private_value & 0xff; 1241 int left_reg = kcontrol->private_value & 0xff;
1225 int right_reg = (kcontrol->private_value >> 8) & 0xff; 1242 int right_reg = (kcontrol->private_value >> 8) & 0xff;
1226 int shift_left = (kcontrol->private_value >> 16) & 0x07; 1243 int shift_left = (kcontrol->private_value >> 16) & 0x07;
@@ -1243,9 +1260,10 @@ static int snd_es1938_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1243 return 0; 1260 return 0;
1244} 1261}
1245 1262
1246static int snd_es1938_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1263static int snd_es1938_put_double(struct snd_kcontrol *kcontrol,
1264 struct snd_ctl_elem_value *ucontrol)
1247{ 1265{
1248 es1938_t *chip = snd_kcontrol_chip(kcontrol); 1266 struct es1938 *chip = snd_kcontrol_chip(kcontrol);
1249 int left_reg = kcontrol->private_value & 0xff; 1267 int left_reg = kcontrol->private_value & 0xff;
1250 int right_reg = (kcontrol->private_value >> 8) & 0xff; 1268 int right_reg = (kcontrol->private_value >> 8) & 0xff;
1251 int shift_left = (kcontrol->private_value >> 16) & 0x07; 1269 int shift_left = (kcontrol->private_value >> 16) & 0x07;
@@ -1278,7 +1296,7 @@ static int snd_es1938_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1278 return change; 1296 return change;
1279} 1297}
1280 1298
1281static snd_kcontrol_new_t snd_es1938_controls[] = { 1299static struct snd_kcontrol_new snd_es1938_controls[] = {
1282ES1938_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0), 1300ES1938_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0),
1283ES1938_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1), 1301ES1938_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1),
1284{ 1302{
@@ -1341,7 +1359,7 @@ ES1938_SINGLE("Mic Boost (+26dB)", 0, 0x7d, 3, 1, 0)
1341/* 1359/*
1342 * initialize the chip - used by resume callback, too 1360 * initialize the chip - used by resume callback, too
1343 */ 1361 */
1344static void snd_es1938_chip_init(es1938_t *chip) 1362static void snd_es1938_chip_init(struct es1938 *chip)
1345{ 1363{
1346 /* reset chip */ 1364 /* reset chip */
1347 snd_es1938_reset(chip); 1365 snd_es1938_reset(chip);
@@ -1380,9 +1398,9 @@ static unsigned char saved_regs[SAVED_REG_SIZE+1] = {
1380}; 1398};
1381 1399
1382 1400
1383static int es1938_suspend(snd_card_t *card, pm_message_t state) 1401static int es1938_suspend(struct snd_card *card, pm_message_t state)
1384{ 1402{
1385 es1938_t *chip = card->pm_private_data; 1403 struct es1938 *chip = card->pm_private_data;
1386 unsigned char *s, *d; 1404 unsigned char *s, *d;
1387 1405
1388 snd_pcm_suspend_all(chip->pcm); 1406 snd_pcm_suspend_all(chip->pcm);
@@ -1393,19 +1411,19 @@ static int es1938_suspend(snd_card_t *card, pm_message_t state)
1393 1411
1394 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ 1412 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */
1395 if (chip->irq >= 0) 1413 if (chip->irq >= 0)
1396 free_irq(chip->irq, (void *)chip); 1414 free_irq(chip->irq, chip);
1397 pci_disable_device(chip->pci); 1415 pci_disable_device(chip->pci);
1398 return 0; 1416 return 0;
1399} 1417}
1400 1418
1401static int es1938_resume(snd_card_t *card) 1419static int es1938_resume(struct snd_card *card)
1402{ 1420{
1403 es1938_t *chip = card->pm_private_data; 1421 struct es1938 *chip = card->pm_private_data;
1404 unsigned char *s, *d; 1422 unsigned char *s, *d;
1405 1423
1406 pci_enable_device(chip->pci); 1424 pci_enable_device(chip->pci);
1407 request_irq(chip->pci->irq, snd_es1938_interrupt, 1425 request_irq(chip->pci->irq, snd_es1938_interrupt,
1408 SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip); 1426 SA_INTERRUPT|SA_SHIRQ, "ES1938", chip);
1409 chip->irq = chip->pci->irq; 1427 chip->irq = chip->pci->irq;
1410 snd_es1938_chip_init(chip); 1428 snd_es1938_chip_init(chip);
1411 1429
@@ -1422,7 +1440,7 @@ static int es1938_resume(snd_card_t *card)
1422#endif /* CONFIG_PM */ 1440#endif /* CONFIG_PM */
1423 1441
1424#ifdef SUPPORT_JOYSTICK 1442#ifdef SUPPORT_JOYSTICK
1425static int __devinit snd_es1938_create_gameport(es1938_t *chip) 1443static int __devinit snd_es1938_create_gameport(struct es1938 *chip)
1426{ 1444{
1427 struct gameport *gp; 1445 struct gameport *gp;
1428 1446
@@ -1442,7 +1460,7 @@ static int __devinit snd_es1938_create_gameport(es1938_t *chip)
1442 return 0; 1460 return 0;
1443} 1461}
1444 1462
1445static void snd_es1938_free_gameport(es1938_t *chip) 1463static void snd_es1938_free_gameport(struct es1938 *chip)
1446{ 1464{
1447 if (chip->gameport) { 1465 if (chip->gameport) {
1448 gameport_unregister_port(chip->gameport); 1466 gameport_unregister_port(chip->gameport);
@@ -1450,11 +1468,11 @@ static void snd_es1938_free_gameport(es1938_t *chip)
1450 } 1468 }
1451} 1469}
1452#else 1470#else
1453static inline int snd_es1938_create_gameport(es1938_t *chip) { return -ENOSYS; } 1471static inline int snd_es1938_create_gameport(struct es1938 *chip) { return -ENOSYS; }
1454static inline void snd_es1938_free_gameport(es1938_t *chip) { } 1472static inline void snd_es1938_free_gameport(struct es1938 *chip) { }
1455#endif /* SUPPORT_JOYSTICK */ 1473#endif /* SUPPORT_JOYSTICK */
1456 1474
1457static int snd_es1938_free(es1938_t *chip) 1475static int snd_es1938_free(struct es1938 *chip)
1458{ 1476{
1459 /* disable irqs */ 1477 /* disable irqs */
1460 outb(0x00, SLIO_REG(chip, IRQCONTROL)); 1478 outb(0x00, SLIO_REG(chip, IRQCONTROL));
@@ -1464,26 +1482,26 @@ static int snd_es1938_free(es1938_t *chip)
1464 snd_es1938_free_gameport(chip); 1482 snd_es1938_free_gameport(chip);
1465 1483
1466 if (chip->irq >= 0) 1484 if (chip->irq >= 0)
1467 free_irq(chip->irq, (void *)chip); 1485 free_irq(chip->irq, chip);
1468 pci_release_regions(chip->pci); 1486 pci_release_regions(chip->pci);
1469 pci_disable_device(chip->pci); 1487 pci_disable_device(chip->pci);
1470 kfree(chip); 1488 kfree(chip);
1471 return 0; 1489 return 0;
1472} 1490}
1473 1491
1474static int snd_es1938_dev_free(snd_device_t *device) 1492static int snd_es1938_dev_free(struct snd_device *device)
1475{ 1493{
1476 es1938_t *chip = device->device_data; 1494 struct es1938 *chip = device->device_data;
1477 return snd_es1938_free(chip); 1495 return snd_es1938_free(chip);
1478} 1496}
1479 1497
1480static int __devinit snd_es1938_create(snd_card_t * card, 1498static int __devinit snd_es1938_create(struct snd_card *card,
1481 struct pci_dev * pci, 1499 struct pci_dev * pci,
1482 es1938_t ** rchip) 1500 struct es1938 ** rchip)
1483{ 1501{
1484 es1938_t *chip; 1502 struct es1938 *chip;
1485 int err; 1503 int err;
1486 static snd_device_ops_t ops = { 1504 static struct snd_device_ops ops = {
1487 .dev_free = snd_es1938_dev_free, 1505 .dev_free = snd_es1938_dev_free,
1488 }; 1506 };
1489 1507
@@ -1519,7 +1537,8 @@ static int __devinit snd_es1938_create(snd_card_t * card,
1519 chip->vc_port = pci_resource_start(pci, 2); 1537 chip->vc_port = pci_resource_start(pci, 2);
1520 chip->mpu_port = pci_resource_start(pci, 3); 1538 chip->mpu_port = pci_resource_start(pci, 3);
1521 chip->game_port = pci_resource_start(pci, 4); 1539 chip->game_port = pci_resource_start(pci, 4);
1522 if (request_irq(pci->irq, snd_es1938_interrupt, SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip)) { 1540 if (request_irq(pci->irq, snd_es1938_interrupt, SA_INTERRUPT|SA_SHIRQ,
1541 "ES1938", chip)) {
1523 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1542 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1524 snd_es1938_free(chip); 1543 snd_es1938_free(chip);
1525 return -EBUSY; 1544 return -EBUSY;
@@ -1552,7 +1571,7 @@ static int __devinit snd_es1938_create(snd_card_t * card,
1552 * -------------------------------------------------------------------- */ 1571 * -------------------------------------------------------------------- */
1553static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1572static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1554{ 1573{
1555 es1938_t *chip = dev_id; 1574 struct es1938 *chip = dev_id;
1556 unsigned char status, audiostatus; 1575 unsigned char status, audiostatus;
1557 int handled = 0; 1576 int handled = 0;
1558 1577
@@ -1565,9 +1584,12 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id, struct pt_regs *r
1565 if (status & 0x10) { 1584 if (status & 0x10) {
1566#if 0 1585#if 0
1567 printk("Es1938debug - AUDIO channel 1 interrupt\n"); 1586 printk("Es1938debug - AUDIO channel 1 interrupt\n");
1568 printk("Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", inw(SLDM_REG(chip, DMACOUNT))); 1587 printk("Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n",
1569 printk("Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n", inl(SLDM_REG(chip, DMAADDR))); 1588 inw(SLDM_REG(chip, DMACOUNT)));
1570 printk("Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n", inl(SLDM_REG(chip, DMASTATUS))); 1589 printk("Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n",
1590 inl(SLDM_REG(chip, DMAADDR)));
1591 printk("Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n",
1592 inl(SLDM_REG(chip, DMASTATUS)));
1571#endif 1593#endif
1572 /* clear irq */ 1594 /* clear irq */
1573 handled = 1; 1595 handled = 1;
@@ -1582,8 +1604,10 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id, struct pt_regs *r
1582 if (status & 0x20) { 1604 if (status & 0x20) {
1583#if 0 1605#if 0
1584 printk("Es1938debug - AUDIO channel 2 interrupt\n"); 1606 printk("Es1938debug - AUDIO channel 2 interrupt\n");
1585 printk("Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", inw(SLIO_REG(chip, AUDIO2DMACOUNT))); 1607 printk("Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n",
1586 printk("Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n", inl(SLIO_REG(chip, AUDIO2DMAADDR))); 1608 inw(SLIO_REG(chip, AUDIO2DMACOUNT)));
1609 printk("Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n",
1610 inl(SLIO_REG(chip, AUDIO2DMAADDR)));
1587 1611
1588#endif 1612#endif
1589 /* clear irq */ 1613 /* clear irq */
@@ -1600,8 +1624,10 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id, struct pt_regs *r
1600 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); 1624 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id);
1601 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); 1625 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id);
1602 if (!split) { 1626 if (!split) {
1603 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); 1627 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
1604 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); 1628 &chip->master_switch->id);
1629 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
1630 &chip->master_volume->id);
1605 } 1631 }
1606 /* ack interrupt */ 1632 /* ack interrupt */
1607 snd_es1938_mixer_write(chip, 0x66, 0x00); 1633 snd_es1938_mixer_write(chip, 0x66, 0x00);
@@ -1623,9 +1649,9 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id, struct pt_regs *r
1623 1649
1624#define ES1938_DMA_SIZE 64 1650#define ES1938_DMA_SIZE 64
1625 1651
1626static int __devinit snd_es1938_mixer(es1938_t *chip) 1652static int __devinit snd_es1938_mixer(struct es1938 *chip)
1627{ 1653{
1628 snd_card_t *card; 1654 struct snd_card *card;
1629 unsigned int idx; 1655 unsigned int idx;
1630 int err; 1656 int err;
1631 1657
@@ -1634,7 +1660,7 @@ static int __devinit snd_es1938_mixer(es1938_t *chip)
1634 strcpy(card->mixername, "ESS Solo-1"); 1660 strcpy(card->mixername, "ESS Solo-1");
1635 1661
1636 for (idx = 0; idx < ARRAY_SIZE(snd_es1938_controls); idx++) { 1662 for (idx = 0; idx < ARRAY_SIZE(snd_es1938_controls); idx++) {
1637 snd_kcontrol_t *kctl; 1663 struct snd_kcontrol *kctl;
1638 kctl = snd_ctl_new1(&snd_es1938_controls[idx], chip); 1664 kctl = snd_ctl_new1(&snd_es1938_controls[idx], chip);
1639 switch (idx) { 1665 switch (idx) {
1640 case 0: 1666 case 0:
@@ -1665,9 +1691,9 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
1665 const struct pci_device_id *pci_id) 1691 const struct pci_device_id *pci_id)
1666{ 1692{
1667 static int dev; 1693 static int dev;
1668 snd_card_t *card; 1694 struct snd_card *card;
1669 es1938_t *chip; 1695 struct es1938 *chip;
1670 opl3_t *opl3; 1696 struct snd_opl3 *opl3;
1671 int idx, err; 1697 int idx, err;
1672 1698
1673 if (dev >= SNDRV_CARDS) 1699 if (dev >= SNDRV_CARDS)