diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2007-09-10 17:06:55 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 10:49:18 -0400 |
commit | 9e9abb4f1ee0412e5430c88a61df02ec0a3c11ff (patch) | |
tree | f06c2418c06c54043ea207d392ce6b1854a1e1e1 | |
parent | d1761d1b14158498d4782d555a9b367ea4647224 (diff) |
[ALSA] sun-cs4231: checkpatch fixes
This patch fixes white spaces and issues pointed by
the checkpatch.pl script.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r-- | sound/sparc/cs4231.c | 380 |
1 files changed, 230 insertions, 150 deletions
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 20daf261d03d..bd1e35580f3a 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Copyright (C) 2002 David S. Miller <davem@redhat.com> | 3 | * Copyright (C) 2002 David S. Miller <davem@redhat.com> |
4 | * | 4 | * |
5 | * Based entirely upon drivers/sbus/audio/cs4231.c which is: | 5 | * Based entirely upon drivers/sbus/audio/cs4231.c which is: |
6 | * Copyright (C) 1996, 1997, 1998, 1998 Derrick J Brashear (shadow@andrew.cmu.edu) | 6 | * Copyright (C) 1996, 1997, 1998 Derrick J Brashear (shadow@andrew.cmu.edu) |
7 | * and also sound/isa/cs423x/cs4231_lib.c which is: | 7 | * and also sound/isa/cs423x/cs4231_lib.c which is: |
8 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz> | 8 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz> |
9 | */ | 9 | */ |
@@ -15,6 +15,9 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/irq.h> | ||
19 | #include <linux/io.h> | ||
20 | |||
18 | 21 | ||
19 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
20 | #include <sound/core.h> | 23 | #include <sound/core.h> |
@@ -25,9 +28,6 @@ | |||
25 | #include <sound/initval.h> | 28 | #include <sound/initval.h> |
26 | #include <sound/pcm_params.h> | 29 | #include <sound/pcm_params.h> |
27 | 30 | ||
28 | #include <asm/io.h> | ||
29 | #include <asm/irq.h> | ||
30 | |||
31 | #ifdef CONFIG_SBUS | 31 | #ifdef CONFIG_SBUS |
32 | #define SBUS_SUPPORT | 32 | #define SBUS_SUPPORT |
33 | #include <asm/sbus.h> | 33 | #include <asm/sbus.h> |
@@ -41,7 +41,8 @@ | |||
41 | 41 | ||
42 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 42 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
43 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 43 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
44 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 44 | /* Enable this card */ |
45 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | ||
45 | 46 | ||
46 | module_param_array(index, int, NULL, 0444); | 47 | module_param_array(index, int, NULL, 0444); |
47 | MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard."); | 48 | MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard."); |
@@ -56,19 +57,22 @@ MODULE_SUPPORTED_DEVICE("{{Sun,CS4231}}"); | |||
56 | 57 | ||
57 | #ifdef SBUS_SUPPORT | 58 | #ifdef SBUS_SUPPORT |
58 | struct sbus_dma_info { | 59 | struct sbus_dma_info { |
59 | spinlock_t lock; | 60 | spinlock_t lock; /* DMA access lock */ |
60 | int dir; | 61 | int dir; |
61 | void __iomem *regs; | 62 | void __iomem *regs; |
62 | }; | 63 | }; |
63 | #endif | 64 | #endif |
64 | 65 | ||
65 | struct snd_cs4231; | 66 | struct snd_cs4231; |
66 | struct cs4231_dma_control { | 67 | struct cs4231_dma_control { |
67 | void (*prepare)(struct cs4231_dma_control *dma_cont, int dir); | 68 | void (*prepare)(struct cs4231_dma_control *dma_cont, |
68 | void (*enable)(struct cs4231_dma_control *dma_cont, int on); | 69 | int dir); |
69 | int (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len); | 70 | void (*enable)(struct cs4231_dma_control *dma_cont, int on); |
70 | unsigned int (*address)(struct cs4231_dma_control *dma_cont); | 71 | int (*request)(struct cs4231_dma_control *dma_cont, |
71 | void (*preallocate)(struct snd_cs4231 *chip, struct snd_pcm *pcm); | 72 | dma_addr_t bus_addr, size_t len); |
73 | unsigned int (*address)(struct cs4231_dma_control *dma_cont); | ||
74 | void (*preallocate)(struct snd_cs4231 *chip, | ||
75 | struct snd_pcm *pcm); | ||
72 | #ifdef EBUS_SUPPORT | 76 | #ifdef EBUS_SUPPORT |
73 | struct ebus_dma_info ebus_info; | 77 | struct ebus_dma_info ebus_info; |
74 | #endif | 78 | #endif |
@@ -78,7 +82,7 @@ struct cs4231_dma_control { | |||
78 | }; | 82 | }; |
79 | 83 | ||
80 | struct snd_cs4231 { | 84 | struct snd_cs4231 { |
81 | spinlock_t lock; | 85 | spinlock_t lock; /* registers access lock */ |
82 | void __iomem *port; | 86 | void __iomem *port; |
83 | 87 | ||
84 | struct cs4231_dma_control p_dma; | 88 | struct cs4231_dma_control p_dma; |
@@ -102,13 +106,14 @@ struct snd_cs4231 { | |||
102 | #define CS4231_MODE_PLAY 0x0001 | 106 | #define CS4231_MODE_PLAY 0x0001 |
103 | #define CS4231_MODE_RECORD 0x0002 | 107 | #define CS4231_MODE_RECORD 0x0002 |
104 | #define CS4231_MODE_TIMER 0x0004 | 108 | #define CS4231_MODE_TIMER 0x0004 |
105 | #define CS4231_MODE_OPEN (CS4231_MODE_PLAY|CS4231_MODE_RECORD|CS4231_MODE_TIMER) | 109 | #define CS4231_MODE_OPEN (CS4231_MODE_PLAY | CS4231_MODE_RECORD | \ |
110 | CS4231_MODE_TIMER) | ||
106 | 111 | ||
107 | unsigned char image[32]; /* registers image */ | 112 | unsigned char image[32]; /* registers image */ |
108 | int mce_bit; | 113 | int mce_bit; |
109 | int calibrate_mute; | 114 | int calibrate_mute; |
110 | struct mutex mce_mutex; | 115 | struct mutex mce_mutex; /* mutex for mce register */ |
111 | struct mutex open_mutex; | 116 | struct mutex open_mutex; /* mutex for ALSA open/close */ |
112 | 117 | ||
113 | union { | 118 | union { |
114 | #ifdef SBUS_SUPPORT | 119 | #ifdef SBUS_SUPPORT |
@@ -392,7 +397,8 @@ static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr) | |||
392 | #endif | 397 | #endif |
393 | } | 398 | } |
394 | 399 | ||
395 | static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, void __iomem *reg_addr) | 400 | static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, |
401 | void __iomem *reg_addr) | ||
396 | { | 402 | { |
397 | #ifdef EBUS_SUPPORT | 403 | #ifdef EBUS_SUPPORT |
398 | if (cp->flags & CS4231_FLAG_EBUS) | 404 | if (cp->flags & CS4231_FLAG_EBUS) |
@@ -418,7 +424,8 @@ static void snd_cs4231_ready(struct snd_cs4231 *chip) | |||
418 | udelay(100); | 424 | udelay(100); |
419 | } | 425 | } |
420 | 426 | ||
421 | static void snd_cs4231_dout(struct snd_cs4231 *chip, unsigned char reg, unsigned char value) | 427 | static void snd_cs4231_dout(struct snd_cs4231 *chip, unsigned char reg, |
428 | unsigned char value) | ||
422 | { | 429 | { |
423 | snd_cs4231_ready(chip); | 430 | snd_cs4231_ready(chip); |
424 | #ifdef CONFIG_SND_DEBUG | 431 | #ifdef CONFIG_SND_DEBUG |
@@ -472,7 +479,7 @@ static void snd_cs4231_busy_wait(struct snd_cs4231 *chip) | |||
472 | { | 479 | { |
473 | int timeout; | 480 | int timeout; |
474 | 481 | ||
475 | /* huh.. looks like this sequence is proper for CS4231A chip (GUS MAX) */ | 482 | /* looks like this sequence is proper for CS4231A chip (GUS MAX) */ |
476 | for (timeout = 5; timeout > 0; timeout--) | 483 | for (timeout = 5; timeout > 0; timeout--) |
477 | __cs4231_readb(chip, CS4231P(chip, REGSEL)); | 484 | __cs4231_readb(chip, CS4231P(chip, REGSEL)); |
478 | 485 | ||
@@ -497,7 +504,9 @@ static void snd_cs4231_mce_up(struct snd_cs4231 *chip) | |||
497 | chip->mce_bit |= CS4231_MCE; | 504 | chip->mce_bit |= CS4231_MCE; |
498 | timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); | 505 | timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); |
499 | if (timeout == 0x80) | 506 | if (timeout == 0x80) |
500 | snd_printdd("mce_up [%p]: serious init problem - codec still busy\n", chip->port); | 507 | snd_printdd("mce_up [%p]: serious init problem - " |
508 | "codec still busy\n", | ||
509 | chip->port); | ||
501 | if (!(timeout & CS4231_MCE)) | 510 | if (!(timeout & CS4231_MCE)) |
502 | __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); | 511 | __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); |
503 | spin_unlock_irqrestore(&chip->lock, flags); | 512 | spin_unlock_irqrestore(&chip->lock, flags); |
@@ -518,7 +527,9 @@ static void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
518 | timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); | 527 | timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); |
519 | __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); | 528 | __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); |
520 | if (timeout == 0x80) | 529 | if (timeout == 0x80) |
521 | snd_printdd("mce_down [%p]: serious init problem - codec still busy\n", chip->port); | 530 | snd_printdd("mce_down [%p]: serious init problem - " |
531 | "codec still busy\n", | ||
532 | chip->port); | ||
522 | if ((timeout & CS4231_MCE) == 0) { | 533 | if ((timeout & CS4231_MCE) == 0) { |
523 | spin_unlock_irqrestore(&chip->lock, flags); | 534 | spin_unlock_irqrestore(&chip->lock, flags); |
524 | return; | 535 | return; |
@@ -529,7 +540,8 @@ static void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
529 | 540 | ||
530 | snd_cs4231_ready(chip); | 541 | snd_cs4231_ready(chip); |
531 | snd_cs4231_ready(chip); | 542 | snd_cs4231_ready(chip); |
532 | if ((snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) == 0) { | 543 | timeout = snd_cs4231_in(chip, CS4231_TEST_INIT); |
544 | if ((timeout & CS4231_CALIB_IN_PROGRESS) == 0) { | ||
533 | snd_printd("cs4231_mce_down - auto calibration time out (1)\n"); | 545 | snd_printd("cs4231_mce_down - auto calibration time out (1)\n"); |
534 | spin_unlock_irqrestore(&chip->lock, flags); | 546 | spin_unlock_irqrestore(&chip->lock, flags); |
535 | return; | 547 | return; |
@@ -537,10 +549,13 @@ static void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
537 | 549 | ||
538 | /* in 10ms increments, check condition, up to 250ms */ | 550 | /* in 10ms increments, check condition, up to 250ms */ |
539 | timeout = 25; | 551 | timeout = 25; |
540 | while (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) { | 552 | while (snd_cs4231_in(chip, CS4231_TEST_INIT) & |
553 | CS4231_CALIB_IN_PROGRESS) { | ||
554 | |||
541 | spin_unlock_irqrestore(&chip->lock, flags); | 555 | spin_unlock_irqrestore(&chip->lock, flags); |
542 | if (--timeout < 0) { | 556 | if (--timeout < 0) { |
543 | snd_printk("mce_down - auto calibration time out (2)\n"); | 557 | snd_printk("mce_down - " |
558 | "auto calibration time out (2)\n"); | ||
544 | return; | 559 | return; |
545 | } | 560 | } |
546 | msleep(10); | 561 | msleep(10); |
@@ -552,7 +567,8 @@ static void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
552 | while (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) { | 567 | while (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) { |
553 | spin_unlock_irqrestore(&chip->lock, flags); | 568 | spin_unlock_irqrestore(&chip->lock, flags); |
554 | if (--timeout < 0) { | 569 | if (--timeout < 0) { |
555 | snd_printk("mce_down - auto calibration time out (3)\n"); | 570 | snd_printk("mce_down - " |
571 | "auto calibration time out (3)\n"); | ||
556 | return; | 572 | return; |
557 | } | 573 | } |
558 | msleep(10); | 574 | msleep(10); |
@@ -573,7 +589,8 @@ static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont, | |||
573 | 589 | ||
574 | BUG_ON(period_size >= (1 << 24)); | 590 | BUG_ON(period_size >= (1 << 24)); |
575 | 591 | ||
576 | if (dma_cont->request(dma_cont, runtime->dma_addr + offset, period_size)) | 592 | if (dma_cont->request(dma_cont, |
593 | runtime->dma_addr + offset, period_size)) | ||
577 | return; | 594 | return; |
578 | (*periods_sent) = ((*periods_sent) + 1) % runtime->periods; | 595 | (*periods_sent) = ((*periods_sent) + 1) % runtime->periods; |
579 | } | 596 | } |
@@ -666,21 +683,32 @@ static unsigned char snd_cs4231_get_rate(unsigned int rate) | |||
666 | for (i = 0; i < 14; i++) | 683 | for (i = 0; i < 14; i++) |
667 | if (rate == rates[i]) | 684 | if (rate == rates[i]) |
668 | return freq_bits[i]; | 685 | return freq_bits[i]; |
669 | // snd_BUG(); | 686 | |
670 | return freq_bits[13]; | 687 | return freq_bits[13]; |
671 | } | 688 | } |
672 | 689 | ||
673 | static unsigned char snd_cs4231_get_format(struct snd_cs4231 *chip, int format, int channels) | 690 | static unsigned char snd_cs4231_get_format(struct snd_cs4231 *chip, int format, |
691 | int channels) | ||
674 | { | 692 | { |
675 | unsigned char rformat; | 693 | unsigned char rformat; |
676 | 694 | ||
677 | rformat = CS4231_LINEAR_8; | 695 | rformat = CS4231_LINEAR_8; |
678 | switch (format) { | 696 | switch (format) { |
679 | case SNDRV_PCM_FORMAT_MU_LAW: rformat = CS4231_ULAW_8; break; | 697 | case SNDRV_PCM_FORMAT_MU_LAW: |
680 | case SNDRV_PCM_FORMAT_A_LAW: rformat = CS4231_ALAW_8; break; | 698 | rformat = CS4231_ULAW_8; |
681 | case SNDRV_PCM_FORMAT_S16_LE: rformat = CS4231_LINEAR_16; break; | 699 | break; |
682 | case SNDRV_PCM_FORMAT_S16_BE: rformat = CS4231_LINEAR_16_BIG; break; | 700 | case SNDRV_PCM_FORMAT_A_LAW: |
683 | case SNDRV_PCM_FORMAT_IMA_ADPCM: rformat = CS4231_ADPCM_16; break; | 701 | rformat = CS4231_ALAW_8; |
702 | break; | ||
703 | case SNDRV_PCM_FORMAT_S16_LE: | ||
704 | rformat = CS4231_LINEAR_16; | ||
705 | break; | ||
706 | case SNDRV_PCM_FORMAT_S16_BE: | ||
707 | rformat = CS4231_LINEAR_16_BIG; | ||
708 | break; | ||
709 | case SNDRV_PCM_FORMAT_IMA_ADPCM: | ||
710 | rformat = CS4231_ADPCM_16; | ||
711 | break; | ||
684 | } | 712 | } |
685 | if (channels > 1) | 713 | if (channels > 1) |
686 | rformat |= CS4231_STEREO; | 714 | rformat |= CS4231_STEREO; |
@@ -727,7 +755,8 @@ static void snd_cs4231_calibrate_mute(struct snd_cs4231 *chip, int mute) | |||
727 | spin_unlock_irqrestore(&chip->lock, flags); | 755 | spin_unlock_irqrestore(&chip->lock, flags); |
728 | } | 756 | } |
729 | 757 | ||
730 | static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, | 758 | static void snd_cs4231_playback_format(struct snd_cs4231 *chip, |
759 | struct snd_pcm_hw_params *params, | ||
731 | unsigned char pdfr) | 760 | unsigned char pdfr) |
732 | { | 761 | { |
733 | unsigned long flags; | 762 | unsigned long flags; |
@@ -750,8 +779,9 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_h | |||
750 | mutex_unlock(&chip->mce_mutex); | 779 | mutex_unlock(&chip->mce_mutex); |
751 | } | 780 | } |
752 | 781 | ||
753 | static void snd_cs4231_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, | 782 | static void snd_cs4231_capture_format(struct snd_cs4231 *chip, |
754 | unsigned char cdfr) | 783 | struct snd_pcm_hw_params *params, |
784 | unsigned char cdfr) | ||
755 | { | 785 | { |
756 | unsigned long flags; | 786 | unsigned long flags; |
757 | 787 | ||
@@ -808,7 +838,8 @@ static int snd_cs4231_timer_start(struct snd_timer *timer) | |||
808 | chip->image[CS4231_TIMER_LOW] = | 838 | chip->image[CS4231_TIMER_LOW] = |
809 | (unsigned char) ticks); | 839 | (unsigned char) ticks); |
810 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, | 840 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, |
811 | chip->image[CS4231_ALT_FEATURE_1] | CS4231_TIMER_ENABLE); | 841 | chip->image[CS4231_ALT_FEATURE_1] | |
842 | CS4231_TIMER_ENABLE); | ||
812 | } | 843 | } |
813 | spin_unlock_irqrestore(&chip->lock, flags); | 844 | spin_unlock_irqrestore(&chip->lock, flags); |
814 | 845 | ||
@@ -821,8 +852,9 @@ static int snd_cs4231_timer_stop(struct snd_timer *timer) | |||
821 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 852 | struct snd_cs4231 *chip = snd_timer_chip(timer); |
822 | 853 | ||
823 | spin_lock_irqsave(&chip->lock, flags); | 854 | spin_lock_irqsave(&chip->lock, flags); |
855 | chip->image[CS4231_ALT_FEATURE_1] &= ~CS4231_TIMER_ENABLE; | ||
824 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, | 856 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, |
825 | chip->image[CS4231_ALT_FEATURE_1] &= ~CS4231_TIMER_ENABLE); | 857 | chip->image[CS4231_ALT_FEATURE_1]); |
826 | spin_unlock_irqrestore(&chip->lock, flags); | 858 | spin_unlock_irqrestore(&chip->lock, flags); |
827 | 859 | ||
828 | return 0; | 860 | return 0; |
@@ -839,8 +871,10 @@ static void __init snd_cs4231_init(struct snd_cs4231 *chip) | |||
839 | #endif | 871 | #endif |
840 | snd_cs4231_mce_up(chip); | 872 | snd_cs4231_mce_up(chip); |
841 | spin_lock_irqsave(&chip->lock, flags); | 873 | spin_lock_irqsave(&chip->lock, flags); |
842 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | | 874 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | |
843 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO | | 875 | CS4231_PLAYBACK_PIO | |
876 | CS4231_RECORD_ENABLE | | ||
877 | CS4231_RECORD_PIO | | ||
844 | CS4231_CALIB_MODE); | 878 | CS4231_CALIB_MODE); |
845 | chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB; | 879 | chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB; |
846 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | 880 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); |
@@ -853,21 +887,25 @@ static void __init snd_cs4231_init(struct snd_cs4231 *chip) | |||
853 | 887 | ||
854 | snd_cs4231_mce_up(chip); | 888 | snd_cs4231_mce_up(chip); |
855 | spin_lock_irqsave(&chip->lock, flags); | 889 | spin_lock_irqsave(&chip->lock, flags); |
856 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); | 890 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, |
891 | chip->image[CS4231_ALT_FEATURE_1]); | ||
857 | spin_unlock_irqrestore(&chip->lock, flags); | 892 | spin_unlock_irqrestore(&chip->lock, flags); |
858 | snd_cs4231_mce_down(chip); | 893 | snd_cs4231_mce_down(chip); |
859 | 894 | ||
860 | #ifdef SNDRV_DEBUG_MCE | 895 | #ifdef SNDRV_DEBUG_MCE |
861 | snd_printdd("init: (3) - afei = 0x%x\n", chip->image[CS4231_ALT_FEATURE_1]); | 896 | snd_printdd("init: (3) - afei = 0x%x\n", |
897 | chip->image[CS4231_ALT_FEATURE_1]); | ||
862 | #endif | 898 | #endif |
863 | 899 | ||
864 | spin_lock_irqsave(&chip->lock, flags); | 900 | spin_lock_irqsave(&chip->lock, flags); |
865 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_2, chip->image[CS4231_ALT_FEATURE_2]); | 901 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_2, |
902 | chip->image[CS4231_ALT_FEATURE_2]); | ||
866 | spin_unlock_irqrestore(&chip->lock, flags); | 903 | spin_unlock_irqrestore(&chip->lock, flags); |
867 | 904 | ||
868 | snd_cs4231_mce_up(chip); | 905 | snd_cs4231_mce_up(chip); |
869 | spin_lock_irqsave(&chip->lock, flags); | 906 | spin_lock_irqsave(&chip->lock, flags); |
870 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT]); | 907 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, |
908 | chip->image[CS4231_PLAYBK_FORMAT]); | ||
871 | spin_unlock_irqrestore(&chip->lock, flags); | 909 | spin_unlock_irqrestore(&chip->lock, flags); |
872 | snd_cs4231_mce_down(chip); | 910 | snd_cs4231_mce_down(chip); |
873 | 911 | ||
@@ -950,7 +988,8 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) | |||
950 | chip->image[CS4231_IFACE_CTRL] &= | 988 | chip->image[CS4231_IFACE_CTRL] &= |
951 | ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | | 989 | ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | |
952 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); | 990 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); |
953 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | 991 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, |
992 | chip->image[CS4231_IFACE_CTRL]); | ||
954 | spin_unlock_irqrestore(&chip->lock, flags); | 993 | spin_unlock_irqrestore(&chip->lock, flags); |
955 | snd_cs4231_mce_down(chip); | 994 | snd_cs4231_mce_down(chip); |
956 | spin_lock_irqsave(&chip->lock, flags); | 995 | spin_lock_irqsave(&chip->lock, flags); |
@@ -979,15 +1018,14 @@ static int snd_cs4231_timer_open(struct snd_timer *timer) | |||
979 | return 0; | 1018 | return 0; |
980 | } | 1019 | } |
981 | 1020 | ||
982 | static int snd_cs4231_timer_close(struct snd_timer * timer) | 1021 | static int snd_cs4231_timer_close(struct snd_timer *timer) |
983 | { | 1022 | { |
984 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 1023 | struct snd_cs4231 *chip = snd_timer_chip(timer); |
985 | snd_cs4231_close(chip, CS4231_MODE_TIMER); | 1024 | snd_cs4231_close(chip, CS4231_MODE_TIMER); |
986 | return 0; | 1025 | return 0; |
987 | } | 1026 | } |
988 | 1027 | ||
989 | static struct snd_timer_hardware snd_cs4231_timer_table = | 1028 | static struct snd_timer_hardware snd_cs4231_timer_table = { |
990 | { | ||
991 | .flags = SNDRV_TIMER_HW_AUTO, | 1029 | .flags = SNDRV_TIMER_HW_AUTO, |
992 | .resolution = 9945, | 1030 | .resolution = 9945, |
993 | .ticks = 65535, | 1031 | .ticks = 65535, |
@@ -1009,8 +1047,9 @@ static int snd_cs4231_playback_hw_params(struct snd_pcm_substream *substream, | |||
1009 | unsigned char new_pdfr; | 1047 | unsigned char new_pdfr; |
1010 | int err; | 1048 | int err; |
1011 | 1049 | ||
1012 | if ((err = snd_pcm_lib_malloc_pages(substream, | 1050 | err = snd_pcm_lib_malloc_pages(substream, |
1013 | params_buffer_bytes(hw_params))) < 0) | 1051 | params_buffer_bytes(hw_params)); |
1052 | if (err < 0) | ||
1014 | return err; | 1053 | return err; |
1015 | new_pdfr = snd_cs4231_get_format(chip, params_format(hw_params), | 1054 | new_pdfr = snd_cs4231_get_format(chip, params_format(hw_params), |
1016 | params_channels(hw_params)) | | 1055 | params_channels(hw_params)) | |
@@ -1046,8 +1085,9 @@ static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream, | |||
1046 | unsigned char new_cdfr; | 1085 | unsigned char new_cdfr; |
1047 | int err; | 1086 | int err; |
1048 | 1087 | ||
1049 | if ((err = snd_pcm_lib_malloc_pages(substream, | 1088 | err = snd_pcm_lib_malloc_pages(substream, |
1050 | params_buffer_bytes(hw_params))) < 0) | 1089 | params_buffer_bytes(hw_params)); |
1090 | if (err < 0) | ||
1051 | return err; | 1091 | return err; |
1052 | new_cdfr = snd_cs4231_get_format(chip, params_format(hw_params), | 1092 | new_cdfr = snd_cs4231_get_format(chip, params_format(hw_params), |
1053 | params_channels(hw_params)) | | 1093 | params_channels(hw_params)) | |
@@ -1082,7 +1122,8 @@ static void snd_cs4231_overrange(struct snd_cs4231 *chip) | |||
1082 | res = snd_cs4231_in(chip, CS4231_TEST_INIT); | 1122 | res = snd_cs4231_in(chip, CS4231_TEST_INIT); |
1083 | spin_unlock_irqrestore(&chip->lock, flags); | 1123 | spin_unlock_irqrestore(&chip->lock, flags); |
1084 | 1124 | ||
1085 | if (res & (0x08 | 0x02)) /* detect overrange only above 0dB; may be user selectable? */ | 1125 | /* detect overrange only above 0dB; may be user selectable? */ |
1126 | if (res & (0x08 | 0x02)) | ||
1086 | chip->capture_substream->runtime->overrange++; | 1127 | chip->capture_substream->runtime->overrange++; |
1087 | } | 1128 | } |
1088 | 1129 | ||
@@ -1104,47 +1145,50 @@ static void snd_cs4231_capture_callback(struct snd_cs4231 *chip) | |||
1104 | } | 1145 | } |
1105 | } | 1146 | } |
1106 | 1147 | ||
1107 | static snd_pcm_uframes_t snd_cs4231_playback_pointer(struct snd_pcm_substream *substream) | 1148 | static snd_pcm_uframes_t snd_cs4231_playback_pointer( |
1149 | struct snd_pcm_substream *substream) | ||
1108 | { | 1150 | { |
1109 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1151 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); |
1110 | struct cs4231_dma_control *dma_cont = &chip->p_dma; | 1152 | struct cs4231_dma_control *dma_cont = &chip->p_dma; |
1111 | size_t ptr; | 1153 | size_t ptr; |
1112 | 1154 | ||
1113 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) | 1155 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) |
1114 | return 0; | 1156 | return 0; |
1115 | ptr = dma_cont->address(dma_cont); | 1157 | ptr = dma_cont->address(dma_cont); |
1116 | if (ptr != 0) | 1158 | if (ptr != 0) |
1117 | ptr -= substream->runtime->dma_addr; | 1159 | ptr -= substream->runtime->dma_addr; |
1118 | 1160 | ||
1119 | return bytes_to_frames(substream->runtime, ptr); | 1161 | return bytes_to_frames(substream->runtime, ptr); |
1120 | } | 1162 | } |
1121 | 1163 | ||
1122 | static snd_pcm_uframes_t snd_cs4231_capture_pointer(struct snd_pcm_substream *substream) | 1164 | static snd_pcm_uframes_t snd_cs4231_capture_pointer( |
1165 | struct snd_pcm_substream *substream) | ||
1123 | { | 1166 | { |
1124 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1167 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); |
1125 | struct cs4231_dma_control *dma_cont = &chip->c_dma; | 1168 | struct cs4231_dma_control *dma_cont = &chip->c_dma; |
1126 | size_t ptr; | 1169 | size_t ptr; |
1127 | 1170 | ||
1128 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE)) | 1171 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE)) |
1129 | return 0; | 1172 | return 0; |
1130 | ptr = dma_cont->address(dma_cont); | 1173 | ptr = dma_cont->address(dma_cont); |
1131 | if (ptr != 0) | 1174 | if (ptr != 0) |
1132 | ptr -= substream->runtime->dma_addr; | 1175 | ptr -= substream->runtime->dma_addr; |
1133 | 1176 | ||
1134 | return bytes_to_frames(substream->runtime, ptr); | 1177 | return bytes_to_frames(substream->runtime, ptr); |
1135 | } | 1178 | } |
1136 | 1179 | ||
1137 | static int __init snd_cs4231_probe(struct snd_cs4231 *chip) | 1180 | static int __init snd_cs4231_probe(struct snd_cs4231 *chip) |
1138 | { | 1181 | { |
1139 | unsigned long flags; | 1182 | unsigned long flags; |
1140 | int i, id, vers; | 1183 | int i; |
1184 | int id = 0; | ||
1185 | int vers = 0; | ||
1141 | unsigned char *ptr; | 1186 | unsigned char *ptr; |
1142 | 1187 | ||
1143 | id = vers = 0; | ||
1144 | for (i = 0; i < 50; i++) { | 1188 | for (i = 0; i < 50; i++) { |
1145 | mb(); | 1189 | mb(); |
1146 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) | 1190 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) |
1147 | udelay(2000); | 1191 | msleep(2); |
1148 | else { | 1192 | else { |
1149 | spin_lock_irqsave(&chip->lock, flags); | 1193 | spin_lock_irqsave(&chip->lock, flags); |
1150 | snd_cs4231_out(chip, CS4231_MISC_INFO, CS4231_MODE2); | 1194 | snd_cs4231_out(chip, CS4231_MISC_INFO, CS4231_MODE2); |
@@ -1195,42 +1239,50 @@ static int __init snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1195 | return 0; /* all things are ok.. */ | 1239 | return 0; /* all things are ok.. */ |
1196 | } | 1240 | } |
1197 | 1241 | ||
1198 | static struct snd_pcm_hardware snd_cs4231_playback = | 1242 | static struct snd_pcm_hardware snd_cs4231_playback = { |
1199 | { | 1243 | .info = SNDRV_PCM_INFO_MMAP | |
1200 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1244 | SNDRV_PCM_INFO_INTERLEAVED | |
1201 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START), | 1245 | SNDRV_PCM_INFO_MMAP_VALID | |
1202 | .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | | 1246 | SNDRV_PCM_INFO_SYNC_START, |
1203 | SNDRV_PCM_FMTBIT_IMA_ADPCM | | 1247 | .formats = SNDRV_PCM_FMTBIT_MU_LAW | |
1204 | SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | | 1248 | SNDRV_PCM_FMTBIT_A_LAW | |
1205 | SNDRV_PCM_FMTBIT_S16_BE), | 1249 | SNDRV_PCM_FMTBIT_IMA_ADPCM | |
1206 | .rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000, | 1250 | SNDRV_PCM_FMTBIT_U8 | |
1251 | SNDRV_PCM_FMTBIT_S16_LE | | ||
1252 | SNDRV_PCM_FMTBIT_S16_BE, | ||
1253 | .rates = SNDRV_PCM_RATE_KNOT | | ||
1254 | SNDRV_PCM_RATE_8000_48000, | ||
1207 | .rate_min = 5510, | 1255 | .rate_min = 5510, |
1208 | .rate_max = 48000, | 1256 | .rate_max = 48000, |
1209 | .channels_min = 1, | 1257 | .channels_min = 1, |
1210 | .channels_max = 2, | 1258 | .channels_max = 2, |
1211 | .buffer_bytes_max = (32*1024), | 1259 | .buffer_bytes_max = 32 * 1024, |
1212 | .period_bytes_min = 64, | 1260 | .period_bytes_min = 64, |
1213 | .period_bytes_max = (32*1024), | 1261 | .period_bytes_max = 32 * 1024, |
1214 | .periods_min = 1, | 1262 | .periods_min = 1, |
1215 | .periods_max = 1024, | 1263 | .periods_max = 1024, |
1216 | }; | 1264 | }; |
1217 | 1265 | ||
1218 | static struct snd_pcm_hardware snd_cs4231_capture = | 1266 | static struct snd_pcm_hardware snd_cs4231_capture = { |
1219 | { | 1267 | .info = SNDRV_PCM_INFO_MMAP | |
1220 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1268 | SNDRV_PCM_INFO_INTERLEAVED | |
1221 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START), | 1269 | SNDRV_PCM_INFO_MMAP_VALID | |
1222 | .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | | 1270 | SNDRV_PCM_INFO_SYNC_START, |
1223 | SNDRV_PCM_FMTBIT_IMA_ADPCM | | 1271 | .formats = SNDRV_PCM_FMTBIT_MU_LAW | |
1224 | SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | | 1272 | SNDRV_PCM_FMTBIT_A_LAW | |
1225 | SNDRV_PCM_FMTBIT_S16_BE), | 1273 | SNDRV_PCM_FMTBIT_IMA_ADPCM | |
1226 | .rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000, | 1274 | SNDRV_PCM_FMTBIT_U8 | |
1275 | SNDRV_PCM_FMTBIT_S16_LE | | ||
1276 | SNDRV_PCM_FMTBIT_S16_BE, | ||
1277 | .rates = SNDRV_PCM_RATE_KNOT | | ||
1278 | SNDRV_PCM_RATE_8000_48000, | ||
1227 | .rate_min = 5510, | 1279 | .rate_min = 5510, |
1228 | .rate_max = 48000, | 1280 | .rate_max = 48000, |
1229 | .channels_min = 1, | 1281 | .channels_min = 1, |
1230 | .channels_max = 2, | 1282 | .channels_max = 2, |
1231 | .buffer_bytes_max = (32*1024), | 1283 | .buffer_bytes_max = 32 * 1024, |
1232 | .period_bytes_min = 64, | 1284 | .period_bytes_min = 64, |
1233 | .period_bytes_max = (32*1024), | 1285 | .period_bytes_max = 32 * 1024, |
1234 | .periods_min = 1, | 1286 | .periods_min = 1, |
1235 | .periods_max = 1024, | 1287 | .periods_max = 1024, |
1236 | }; | 1288 | }; |
@@ -1243,7 +1295,8 @@ static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) | |||
1243 | 1295 | ||
1244 | runtime->hw = snd_cs4231_playback; | 1296 | runtime->hw = snd_cs4231_playback; |
1245 | 1297 | ||
1246 | if ((err = snd_cs4231_open(chip, CS4231_MODE_PLAY)) < 0) { | 1298 | err = snd_cs4231_open(chip, CS4231_MODE_PLAY); |
1299 | if (err < 0) { | ||
1247 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); | 1300 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); |
1248 | return err; | 1301 | return err; |
1249 | } | 1302 | } |
@@ -1263,7 +1316,8 @@ static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) | |||
1263 | 1316 | ||
1264 | runtime->hw = snd_cs4231_capture; | 1317 | runtime->hw = snd_cs4231_capture; |
1265 | 1318 | ||
1266 | if ((err = snd_cs4231_open(chip, CS4231_MODE_RECORD)) < 0) { | 1319 | err = snd_cs4231_open(chip, CS4231_MODE_RECORD); |
1320 | if (err < 0) { | ||
1267 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); | 1321 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); |
1268 | return err; | 1322 | return err; |
1269 | } | 1323 | } |
@@ -1331,9 +1385,11 @@ static int __init snd_cs4231_pcm(struct snd_card *card) | |||
1331 | if (err < 0) | 1385 | if (err < 0) |
1332 | return err; | 1386 | return err; |
1333 | 1387 | ||
1334 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops); | 1388 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1335 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops); | 1389 | &snd_cs4231_playback_ops); |
1336 | 1390 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | |
1391 | &snd_cs4231_capture_ops); | ||
1392 | |||
1337 | /* global setup */ | 1393 | /* global setup */ |
1338 | pcm->private_data = chip; | 1394 | pcm->private_data = chip; |
1339 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; | 1395 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; |
@@ -1369,7 +1425,7 @@ static int __init snd_cs4231_timer(struct snd_card *card) | |||
1369 | 1425 | ||
1370 | return 0; | 1426 | return 0; |
1371 | } | 1427 | } |
1372 | 1428 | ||
1373 | /* | 1429 | /* |
1374 | * MIXER part | 1430 | * MIXER part |
1375 | */ | 1431 | */ |
@@ -1386,7 +1442,8 @@ static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol, | |||
1386 | uinfo->value.enumerated.items = 4; | 1442 | uinfo->value.enumerated.items = 4; |
1387 | if (uinfo->value.enumerated.item > 3) | 1443 | if (uinfo->value.enumerated.item > 3) |
1388 | uinfo->value.enumerated.item = 3; | 1444 | uinfo->value.enumerated.item = 3; |
1389 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 1445 | strcpy(uinfo->value.enumerated.name, |
1446 | texts[uinfo->value.enumerated.item]); | ||
1390 | 1447 | ||
1391 | return 0; | 1448 | return 0; |
1392 | } | 1449 | } |
@@ -1396,7 +1453,7 @@ static int snd_cs4231_get_mux(struct snd_kcontrol *kcontrol, | |||
1396 | { | 1453 | { |
1397 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1454 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); |
1398 | unsigned long flags; | 1455 | unsigned long flags; |
1399 | 1456 | ||
1400 | spin_lock_irqsave(&chip->lock, flags); | 1457 | spin_lock_irqsave(&chip->lock, flags); |
1401 | ucontrol->value.enumerated.item[0] = | 1458 | ucontrol->value.enumerated.item[0] = |
1402 | (chip->image[CS4231_LEFT_INPUT] & CS4231_MIXS_ALL) >> 6; | 1459 | (chip->image[CS4231_LEFT_INPUT] & CS4231_MIXS_ALL) >> 6; |
@@ -1414,7 +1471,7 @@ static int snd_cs4231_put_mux(struct snd_kcontrol *kcontrol, | |||
1414 | unsigned long flags; | 1471 | unsigned long flags; |
1415 | unsigned short left, right; | 1472 | unsigned short left, right; |
1416 | int change; | 1473 | int change; |
1417 | 1474 | ||
1418 | if (ucontrol->value.enumerated.item[0] > 3 || | 1475 | if (ucontrol->value.enumerated.item[0] > 3 || |
1419 | ucontrol->value.enumerated.item[1] > 3) | 1476 | ucontrol->value.enumerated.item[1] > 3) |
1420 | return -EINVAL; | 1477 | return -EINVAL; |
@@ -1426,7 +1483,7 @@ static int snd_cs4231_put_mux(struct snd_kcontrol *kcontrol, | |||
1426 | left = (chip->image[CS4231_LEFT_INPUT] & ~CS4231_MIXS_ALL) | left; | 1483 | left = (chip->image[CS4231_LEFT_INPUT] & ~CS4231_MIXS_ALL) | left; |
1427 | right = (chip->image[CS4231_RIGHT_INPUT] & ~CS4231_MIXS_ALL) | right; | 1484 | right = (chip->image[CS4231_RIGHT_INPUT] & ~CS4231_MIXS_ALL) | right; |
1428 | change = left != chip->image[CS4231_LEFT_INPUT] || | 1485 | change = left != chip->image[CS4231_LEFT_INPUT] || |
1429 | right != chip->image[CS4231_RIGHT_INPUT]; | 1486 | right != chip->image[CS4231_RIGHT_INPUT]; |
1430 | snd_cs4231_out(chip, CS4231_LEFT_INPUT, left); | 1487 | snd_cs4231_out(chip, CS4231_LEFT_INPUT, left); |
1431 | snd_cs4231_out(chip, CS4231_RIGHT_INPUT, right); | 1488 | snd_cs4231_out(chip, CS4231_RIGHT_INPUT, right); |
1432 | 1489 | ||
@@ -1458,7 +1515,7 @@ static int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, | |||
1458 | int shift = (kcontrol->private_value >> 8) & 0xff; | 1515 | int shift = (kcontrol->private_value >> 8) & 0xff; |
1459 | int mask = (kcontrol->private_value >> 16) & 0xff; | 1516 | int mask = (kcontrol->private_value >> 16) & 0xff; |
1460 | int invert = (kcontrol->private_value >> 24) & 0xff; | 1517 | int invert = (kcontrol->private_value >> 24) & 0xff; |
1461 | 1518 | ||
1462 | spin_lock_irqsave(&chip->lock, flags); | 1519 | spin_lock_irqsave(&chip->lock, flags); |
1463 | 1520 | ||
1464 | ucontrol->value.integer.value[0] = (chip->image[reg] >> shift) & mask; | 1521 | ucontrol->value.integer.value[0] = (chip->image[reg] >> shift) & mask; |
@@ -1483,7 +1540,7 @@ static int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, | |||
1483 | int invert = (kcontrol->private_value >> 24) & 0xff; | 1540 | int invert = (kcontrol->private_value >> 24) & 0xff; |
1484 | int change; | 1541 | int change; |
1485 | unsigned short val; | 1542 | unsigned short val; |
1486 | 1543 | ||
1487 | val = (ucontrol->value.integer.value[0] & mask); | 1544 | val = (ucontrol->value.integer.value[0] & mask); |
1488 | if (invert) | 1545 | if (invert) |
1489 | val = mask - val; | 1546 | val = mask - val; |
@@ -1525,11 +1582,13 @@ static int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, | |||
1525 | int shift_right = (kcontrol->private_value >> 19) & 0x07; | 1582 | int shift_right = (kcontrol->private_value >> 19) & 0x07; |
1526 | int mask = (kcontrol->private_value >> 24) & 0xff; | 1583 | int mask = (kcontrol->private_value >> 24) & 0xff; |
1527 | int invert = (kcontrol->private_value >> 22) & 1; | 1584 | int invert = (kcontrol->private_value >> 22) & 1; |
1528 | 1585 | ||
1529 | spin_lock_irqsave(&chip->lock, flags); | 1586 | spin_lock_irqsave(&chip->lock, flags); |
1530 | 1587 | ||
1531 | ucontrol->value.integer.value[0] = (chip->image[left_reg] >> shift_left) & mask; | 1588 | ucontrol->value.integer.value[0] = |
1532 | ucontrol->value.integer.value[1] = (chip->image[right_reg] >> shift_right) & mask; | 1589 | (chip->image[left_reg] >> shift_left) & mask; |
1590 | ucontrol->value.integer.value[1] = | ||
1591 | (chip->image[right_reg] >> shift_right) & mask; | ||
1533 | 1592 | ||
1534 | spin_unlock_irqrestore(&chip->lock, flags); | 1593 | spin_unlock_irqrestore(&chip->lock, flags); |
1535 | 1594 | ||
@@ -1556,7 +1615,7 @@ static int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, | |||
1556 | int invert = (kcontrol->private_value >> 22) & 1; | 1615 | int invert = (kcontrol->private_value >> 22) & 1; |
1557 | int change; | 1616 | int change; |
1558 | unsigned short val1, val2; | 1617 | unsigned short val1, val2; |
1559 | 1618 | ||
1560 | val1 = ucontrol->value.integer.value[0] & mask; | 1619 | val1 = ucontrol->value.integer.value[0] & mask; |
1561 | val2 = ucontrol->value.integer.value[1] & mask; | 1620 | val2 = ucontrol->value.integer.value[1] & mask; |
1562 | if (invert) { | 1621 | if (invert) { |
@@ -1570,7 +1629,8 @@ static int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, | |||
1570 | 1629 | ||
1571 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; | 1630 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; |
1572 | val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2; | 1631 | val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2; |
1573 | change = val1 != chip->image[left_reg] || val2 != chip->image[right_reg]; | 1632 | change = val1 != chip->image[left_reg]; |
1633 | change |= val2 != chip->image[right_reg]; | ||
1574 | snd_cs4231_out(chip, left_reg, val1); | 1634 | snd_cs4231_out(chip, left_reg, val1); |
1575 | snd_cs4231_out(chip, right_reg, val2); | 1635 | snd_cs4231_out(chip, right_reg, val2); |
1576 | 1636 | ||
@@ -1580,31 +1640,42 @@ static int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, | |||
1580 | } | 1640 | } |
1581 | 1641 | ||
1582 | #define CS4231_SINGLE(xname, xindex, reg, shift, mask, invert) \ | 1642 | #define CS4231_SINGLE(xname, xindex, reg, shift, mask, invert) \ |
1583 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 1643 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), .index = (xindex), \ |
1584 | .info = snd_cs4231_info_single, \ | 1644 | .info = snd_cs4231_info_single, \ |
1585 | .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ | 1645 | .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ |
1586 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } | 1646 | .private_value = (reg) | ((shift) << 8) | ((mask) << 16) | ((invert) << 24) } |
1587 | 1647 | ||
1588 | #define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ | 1648 | #define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, \ |
1589 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 1649 | shift_right, mask, invert) \ |
1590 | .info = snd_cs4231_info_double, \ | 1650 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), .index = (xindex), \ |
1591 | .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ | 1651 | .info = snd_cs4231_info_double, \ |
1592 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } | 1652 | .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ |
1653 | .private_value = (left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | \ | ||
1654 | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22) } | ||
1593 | 1655 | ||
1594 | static struct snd_kcontrol_new snd_cs4231_controls[] __initdata = { | 1656 | static struct snd_kcontrol_new snd_cs4231_controls[] __initdata = { |
1595 | CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 1657 | CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, |
1596 | CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | 1658 | CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
1597 | CS4231_DOUBLE("Line Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 1659 | CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, |
1598 | CS4231_DOUBLE("Line Playback Volume", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | 1660 | CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), |
1599 | CS4231_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 1661 | CS4231_DOUBLE("Line Playback Switch", 0, CS4231_LEFT_LINE_IN, |
1600 | CS4231_DOUBLE("Aux Playback Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | 1662 | CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
1601 | CS4231_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 1663 | CS4231_DOUBLE("Line Playback Volume", 0, CS4231_LEFT_LINE_IN, |
1602 | CS4231_DOUBLE("Aux Playback Volume", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | 1664 | CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), |
1665 | CS4231_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, | ||
1666 | CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | ||
1667 | CS4231_DOUBLE("Aux Playback Volume", 0, CS4231_AUX1_LEFT_INPUT, | ||
1668 | CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | ||
1669 | CS4231_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, | ||
1670 | CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | ||
1671 | CS4231_DOUBLE("Aux Playback Volume", 1, CS4231_AUX2_LEFT_INPUT, | ||
1672 | CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | ||
1603 | CS4231_SINGLE("Mono Playback Switch", 0, CS4231_MONO_CTRL, 7, 1, 1), | 1673 | CS4231_SINGLE("Mono Playback Switch", 0, CS4231_MONO_CTRL, 7, 1, 1), |
1604 | CS4231_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | 1674 | CS4231_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), |
1605 | CS4231_SINGLE("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, 6, 1, 1), | 1675 | CS4231_SINGLE("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, 6, 1, 1), |
1606 | CS4231_SINGLE("Mono Output Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), | 1676 | CS4231_SINGLE("Mono Output Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), |
1607 | CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | 1677 | CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, |
1678 | 15, 0), | ||
1608 | { | 1679 | { |
1609 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1680 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1610 | .name = "Capture Source", | 1681 | .name = "Capture Source", |
@@ -1612,14 +1683,15 @@ CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, | |||
1612 | .get = snd_cs4231_get_mux, | 1683 | .get = snd_cs4231_get_mux, |
1613 | .put = snd_cs4231_put_mux, | 1684 | .put = snd_cs4231_put_mux, |
1614 | }, | 1685 | }, |
1615 | CS4231_DOUBLE("Mic Boost", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | 1686 | CS4231_DOUBLE("Mic Boost", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, |
1687 | 1, 0), | ||
1616 | CS4231_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | 1688 | CS4231_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), |
1617 | CS4231_SINGLE("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1), | 1689 | CS4231_SINGLE("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1), |
1618 | /* SPARC specific uses of XCTL{0,1} general purpose outputs. */ | 1690 | /* SPARC specific uses of XCTL{0,1} general purpose outputs. */ |
1619 | CS4231_SINGLE("Line Out Switch", 0, CS4231_PIN_CTRL, 6, 1, 1), | 1691 | CS4231_SINGLE("Line Out Switch", 0, CS4231_PIN_CTRL, 6, 1, 1), |
1620 | CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1) | 1692 | CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1) |
1621 | }; | 1693 | }; |
1622 | 1694 | ||
1623 | static int __init snd_cs4231_mixer(struct snd_card *card) | 1695 | static int __init snd_cs4231_mixer(struct snd_card *card) |
1624 | { | 1696 | { |
1625 | struct snd_cs4231 *chip = card->private_data; | 1697 | struct snd_cs4231 *chip = card->private_data; |
@@ -1720,24 +1792,24 @@ static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id) | |||
1720 | 1792 | ||
1721 | sbus_writel(csr, chip->port + APCCSR); | 1793 | sbus_writel(csr, chip->port + APCCSR); |
1722 | 1794 | ||
1723 | if ((csr & APC_PDMA_READY) && | 1795 | if ((csr & APC_PDMA_READY) && |
1724 | (csr & APC_PLAY_INT) && | 1796 | (csr & APC_PLAY_INT) && |
1725 | (csr & APC_XINT_PNVA) && | 1797 | (csr & APC_XINT_PNVA) && |
1726 | !(csr & APC_XINT_EMPT)) | 1798 | !(csr & APC_XINT_EMPT)) |
1727 | snd_cs4231_play_callback(chip); | 1799 | snd_cs4231_play_callback(chip); |
1728 | 1800 | ||
1729 | if ((csr & APC_CDMA_READY) && | 1801 | if ((csr & APC_CDMA_READY) && |
1730 | (csr & APC_CAPT_INT) && | 1802 | (csr & APC_CAPT_INT) && |
1731 | (csr & APC_XINT_CNVA) && | 1803 | (csr & APC_XINT_CNVA) && |
1732 | !(csr & APC_XINT_EMPT)) | 1804 | !(csr & APC_XINT_EMPT)) |
1733 | snd_cs4231_capture_callback(chip); | 1805 | snd_cs4231_capture_callback(chip); |
1734 | 1806 | ||
1735 | status = snd_cs4231_in(chip, CS4231_IRQ_STATUS); | 1807 | status = snd_cs4231_in(chip, CS4231_IRQ_STATUS); |
1736 | 1808 | ||
1737 | if (status & CS4231_TIMER_IRQ) { | 1809 | if (status & CS4231_TIMER_IRQ) { |
1738 | if (chip->timer) | 1810 | if (chip->timer) |
1739 | snd_timer_interrupt(chip->timer, chip->timer->sticks); | 1811 | snd_timer_interrupt(chip->timer, chip->timer->sticks); |
1740 | } | 1812 | } |
1741 | 1813 | ||
1742 | if ((status & CS4231_RECORD_IRQ) && (csr & APC_CDMA_READY)) | 1814 | if ((status & CS4231_RECORD_IRQ) && (csr & APC_CDMA_READY)) |
1743 | snd_cs4231_overrange(chip); | 1815 | snd_cs4231_overrange(chip); |
@@ -1754,26 +1826,27 @@ static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id) | |||
1754 | * SBUS DMA routines | 1826 | * SBUS DMA routines |
1755 | */ | 1827 | */ |
1756 | 1828 | ||
1757 | static int sbus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len) | 1829 | static int sbus_dma_request(struct cs4231_dma_control *dma_cont, |
1830 | dma_addr_t bus_addr, size_t len) | ||
1758 | { | 1831 | { |
1759 | unsigned long flags; | 1832 | unsigned long flags; |
1760 | u32 test, csr; | 1833 | u32 test, csr; |
1761 | int err; | 1834 | int err; |
1762 | struct sbus_dma_info *base = &dma_cont->sbus_info; | 1835 | struct sbus_dma_info *base = &dma_cont->sbus_info; |
1763 | 1836 | ||
1764 | if (len >= (1 << 24)) | 1837 | if (len >= (1 << 24)) |
1765 | return -EINVAL; | 1838 | return -EINVAL; |
1766 | spin_lock_irqsave(&base->lock, flags); | 1839 | spin_lock_irqsave(&base->lock, flags); |
1767 | csr = sbus_readl(base->regs + APCCSR); | 1840 | csr = sbus_readl(base->regs + APCCSR); |
1768 | err = -EINVAL; | 1841 | err = -EINVAL; |
1769 | test = APC_CDMA_READY; | 1842 | test = APC_CDMA_READY; |
1770 | if ( base->dir == APC_PLAY ) | 1843 | if (base->dir == APC_PLAY) |
1771 | test = APC_PDMA_READY; | 1844 | test = APC_PDMA_READY; |
1772 | if (!(csr & test)) | 1845 | if (!(csr & test)) |
1773 | goto out; | 1846 | goto out; |
1774 | err = -EBUSY; | 1847 | err = -EBUSY; |
1775 | test = APC_XINT_CNVA; | 1848 | test = APC_XINT_CNVA; |
1776 | if ( base->dir == APC_PLAY ) | 1849 | if (base->dir == APC_PLAY) |
1777 | test = APC_XINT_PNVA; | 1850 | test = APC_XINT_PNVA; |
1778 | if (!(csr & test)) | 1851 | if (!(csr & test)) |
1779 | goto out; | 1852 | goto out; |
@@ -1796,7 +1869,7 @@ static void sbus_dma_prepare(struct cs4231_dma_control *dma_cont, int d) | |||
1796 | test = APC_GENL_INT | APC_PLAY_INT | APC_XINT_ENA | | 1869 | test = APC_GENL_INT | APC_PLAY_INT | APC_XINT_ENA | |
1797 | APC_XINT_PLAY | APC_XINT_PEMP | APC_XINT_GENL | | 1870 | APC_XINT_PLAY | APC_XINT_PEMP | APC_XINT_GENL | |
1798 | APC_XINT_PENA; | 1871 | APC_XINT_PENA; |
1799 | if ( base->dir == APC_RECORD ) | 1872 | if (base->dir == APC_RECORD) |
1800 | test = APC_GENL_INT | APC_CAPT_INT | APC_XINT_ENA | | 1873 | test = APC_GENL_INT | APC_CAPT_INT | APC_XINT_ENA | |
1801 | APC_XINT_CAPT | APC_XINT_CEMP | APC_XINT_GENL; | 1874 | APC_XINT_CAPT | APC_XINT_CEMP | APC_XINT_GENL; |
1802 | csr |= test; | 1875 | csr |= test; |
@@ -1814,28 +1887,28 @@ static void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on) | |||
1814 | if (!on) { | 1887 | if (!on) { |
1815 | sbus_writel(0, base->regs + base->dir + APCNC); | 1888 | sbus_writel(0, base->regs + base->dir + APCNC); |
1816 | sbus_writel(0, base->regs + base->dir + APCNVA); | 1889 | sbus_writel(0, base->regs + base->dir + APCNVA); |
1817 | if ( base->dir == APC_PLAY ) { | 1890 | if (base->dir == APC_PLAY) { |
1818 | sbus_writel(0, base->regs + base->dir + APCC); | 1891 | sbus_writel(0, base->regs + base->dir + APCC); |
1819 | sbus_writel(0, base->regs + base->dir + APCVA); | 1892 | sbus_writel(0, base->regs + base->dir + APCVA); |
1820 | } | 1893 | } |
1821 | 1894 | ||
1822 | udelay(1200); | 1895 | udelay(1200); |
1823 | } | 1896 | } |
1824 | csr = sbus_readl(base->regs + APCCSR); | 1897 | csr = sbus_readl(base->regs + APCCSR); |
1825 | shift = 0; | 1898 | shift = 0; |
1826 | if ( base->dir == APC_PLAY ) | 1899 | if (base->dir == APC_PLAY) |
1827 | shift = 1; | 1900 | shift = 1; |
1828 | if (on) | 1901 | if (on) |
1829 | csr &= ~(APC_CPAUSE << shift); | 1902 | csr &= ~(APC_CPAUSE << shift); |
1830 | else | 1903 | else |
1831 | csr |= (APC_CPAUSE << shift); | 1904 | csr |= (APC_CPAUSE << shift); |
1832 | sbus_writel(csr, base->regs + APCCSR); | 1905 | sbus_writel(csr, base->regs + APCCSR); |
1833 | if (on) | 1906 | if (on) |
1834 | csr |= (APC_CDMA_READY << shift); | 1907 | csr |= (APC_CDMA_READY << shift); |
1835 | else | 1908 | else |
1836 | csr &= ~(APC_CDMA_READY << shift); | 1909 | csr &= ~(APC_CDMA_READY << shift); |
1837 | sbus_writel(csr, base->regs + APCCSR); | 1910 | sbus_writel(csr, base->regs + APCCSR); |
1838 | 1911 | ||
1839 | spin_unlock_irqrestore(&base->lock, flags); | 1912 | spin_unlock_irqrestore(&base->lock, flags); |
1840 | } | 1913 | } |
1841 | 1914 | ||
@@ -1843,14 +1916,14 @@ static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont) | |||
1843 | { | 1916 | { |
1844 | struct sbus_dma_info *base = &dma_cont->sbus_info; | 1917 | struct sbus_dma_info *base = &dma_cont->sbus_info; |
1845 | 1918 | ||
1846 | return sbus_readl(base->regs + base->dir + APCVA); | 1919 | return sbus_readl(base->regs + base->dir + APCVA); |
1847 | } | 1920 | } |
1848 | 1921 | ||
1849 | static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) | 1922 | static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) |
1850 | { | 1923 | { |
1851 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS, | 1924 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS, |
1852 | snd_dma_sbus_data(chip->dev_u.sdev), | 1925 | snd_dma_sbus_data(chip->dev_u.sdev), |
1853 | 64*1024, 128*1024); | 1926 | 64 * 1024, 128 * 1024); |
1854 | } | 1927 | } |
1855 | 1928 | ||
1856 | /* | 1929 | /* |
@@ -1972,14 +2045,16 @@ static int __init cs4231_sbus_attach(struct sbus_dev *sdev) | |||
1972 | 2045 | ||
1973 | #ifdef EBUS_SUPPORT | 2046 | #ifdef EBUS_SUPPORT |
1974 | 2047 | ||
1975 | static void snd_cs4231_ebus_play_callback(struct ebus_dma_info *p, int event, void *cookie) | 2048 | static void snd_cs4231_ebus_play_callback(struct ebus_dma_info *p, int event, |
2049 | void *cookie) | ||
1976 | { | 2050 | { |
1977 | struct snd_cs4231 *chip = cookie; | 2051 | struct snd_cs4231 *chip = cookie; |
1978 | 2052 | ||
1979 | snd_cs4231_play_callback(chip); | 2053 | snd_cs4231_play_callback(chip); |
1980 | } | 2054 | } |
1981 | 2055 | ||
1982 | static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event, void *cookie) | 2056 | static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, |
2057 | int event, void *cookie) | ||
1983 | { | 2058 | { |
1984 | struct snd_cs4231 *chip = cookie; | 2059 | struct snd_cs4231 *chip = cookie; |
1985 | 2060 | ||
@@ -1990,7 +2065,8 @@ static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event, | |||
1990 | * EBUS DMA wrappers | 2065 | * EBUS DMA wrappers |
1991 | */ | 2066 | */ |
1992 | 2067 | ||
1993 | static int _ebus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len) | 2068 | static int _ebus_dma_request(struct cs4231_dma_control *dma_cont, |
2069 | dma_addr_t bus_addr, size_t len) | ||
1994 | { | 2070 | { |
1995 | return ebus_dma_request(&dma_cont->ebus_info, bus_addr, len); | 2071 | return ebus_dma_request(&dma_cont->ebus_info, bus_addr, len); |
1996 | } | 2072 | } |
@@ -2091,7 +2167,8 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card, | |||
2091 | chip->port = ioremap(edev->resource[0].start, 0x10); | 2167 | chip->port = ioremap(edev->resource[0].start, 0x10); |
2092 | chip->p_dma.ebus_info.regs = ioremap(edev->resource[1].start, 0x10); | 2168 | chip->p_dma.ebus_info.regs = ioremap(edev->resource[1].start, 0x10); |
2093 | chip->c_dma.ebus_info.regs = ioremap(edev->resource[2].start, 0x10); | 2169 | chip->c_dma.ebus_info.regs = ioremap(edev->resource[2].start, 0x10); |
2094 | if (!chip->port || !chip->p_dma.ebus_info.regs || !chip->c_dma.ebus_info.regs) { | 2170 | if (!chip->port || !chip->p_dma.ebus_info.regs || |
2171 | !chip->c_dma.ebus_info.regs) { | ||
2095 | snd_cs4231_ebus_free(chip); | 2172 | snd_cs4231_ebus_free(chip); |
2096 | snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); | 2173 | snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); |
2097 | return -EIO; | 2174 | return -EIO; |
@@ -2099,18 +2176,21 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card, | |||
2099 | 2176 | ||
2100 | if (ebus_dma_register(&chip->c_dma.ebus_info)) { | 2177 | if (ebus_dma_register(&chip->c_dma.ebus_info)) { |
2101 | snd_cs4231_ebus_free(chip); | 2178 | snd_cs4231_ebus_free(chip); |
2102 | snd_printdd("cs4231-%d: Unable to register EBUS capture DMA\n", dev); | 2179 | snd_printdd("cs4231-%d: Unable to register EBUS capture DMA\n", |
2180 | dev); | ||
2103 | return -EBUSY; | 2181 | return -EBUSY; |
2104 | } | 2182 | } |
2105 | if (ebus_dma_irq_enable(&chip->c_dma.ebus_info, 1)) { | 2183 | if (ebus_dma_irq_enable(&chip->c_dma.ebus_info, 1)) { |
2106 | snd_cs4231_ebus_free(chip); | 2184 | snd_cs4231_ebus_free(chip); |
2107 | snd_printdd("cs4231-%d: Unable to enable EBUS capture IRQ\n", dev); | 2185 | snd_printdd("cs4231-%d: Unable to enable EBUS capture IRQ\n", |
2186 | dev); | ||
2108 | return -EBUSY; | 2187 | return -EBUSY; |
2109 | } | 2188 | } |
2110 | 2189 | ||
2111 | if (ebus_dma_register(&chip->p_dma.ebus_info)) { | 2190 | if (ebus_dma_register(&chip->p_dma.ebus_info)) { |
2112 | snd_cs4231_ebus_free(chip); | 2191 | snd_cs4231_ebus_free(chip); |
2113 | snd_printdd("cs4231-%d: Unable to register EBUS play DMA\n", dev); | 2192 | snd_printdd("cs4231-%d: Unable to register EBUS play DMA\n", |
2193 | dev); | ||
2114 | return -EBUSY; | 2194 | return -EBUSY; |
2115 | } | 2195 | } |
2116 | if (ebus_dma_irq_enable(&chip->p_dma.ebus_info, 1)) { | 2196 | if (ebus_dma_irq_enable(&chip->p_dma.ebus_info, 1)) { |