diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-12-01 09:58:10 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-12-01 09:58:10 -0500 |
commit | 75639e7ee1401b3876c7a00ffe96ea8027668690 (patch) | |
tree | 3d6813cd3fe0d974e0a40237d003a22c5f7438dd /sound | |
parent | 7584af10cf46e0f4aa1696f1be79fa0f19a945ba (diff) | |
parent | ad1cd745060ae2f24026b3b3d09da3426df6ab36 (diff) |
Merge branch 'topic/beep-rename' into topic/core-change
Diffstat (limited to 'sound')
40 files changed, 1077 insertions, 2130 deletions
diff --git a/sound/core/isadma.c b/sound/core/isadma.c index 79f0f16af339..950e19ba91fc 100644 --- a/sound/core/isadma.c +++ b/sound/core/isadma.c | |||
@@ -85,16 +85,24 @@ EXPORT_SYMBOL(snd_dma_disable); | |||
85 | unsigned int snd_dma_pointer(unsigned long dma, unsigned int size) | 85 | unsigned int snd_dma_pointer(unsigned long dma, unsigned int size) |
86 | { | 86 | { |
87 | unsigned long flags; | 87 | unsigned long flags; |
88 | unsigned int result; | 88 | unsigned int result, result1; |
89 | 89 | ||
90 | flags = claim_dma_lock(); | 90 | flags = claim_dma_lock(); |
91 | clear_dma_ff(dma); | 91 | clear_dma_ff(dma); |
92 | if (!isa_dma_bridge_buggy) | 92 | if (!isa_dma_bridge_buggy) |
93 | disable_dma(dma); | 93 | disable_dma(dma); |
94 | result = get_dma_residue(dma); | 94 | result = get_dma_residue(dma); |
95 | /* | ||
96 | * HACK - read the counter again and choose higher value in order to | ||
97 | * avoid reading during counter lower byte roll over if the | ||
98 | * isa_dma_bridge_buggy is set. | ||
99 | */ | ||
100 | result1 = get_dma_residue(dma); | ||
95 | if (!isa_dma_bridge_buggy) | 101 | if (!isa_dma_bridge_buggy) |
96 | enable_dma(dma); | 102 | enable_dma(dma); |
97 | release_dma_lock(flags); | 103 | release_dma_lock(flags); |
104 | if (unlikely(result < result1)) | ||
105 | result = result1; | ||
98 | #ifdef CONFIG_SND_DEBUG | 106 | #ifdef CONFIG_SND_DEBUG |
99 | if (result > size) | 107 | if (result > size) |
100 | snd_printk(KERN_ERR "pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size); | 108 | snd_printk(KERN_ERR "pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size); |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 772423889eb3..54e2eb56e4c2 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -1251,7 +1251,9 @@ static void snd_mixer_oss_build(struct snd_mixer_oss *mixer) | |||
1251 | { SOUND_MIXER_SYNTH, "FM", 0 }, /* fallback */ | 1251 | { SOUND_MIXER_SYNTH, "FM", 0 }, /* fallback */ |
1252 | { SOUND_MIXER_SYNTH, "Music", 0 }, /* fallback */ | 1252 | { SOUND_MIXER_SYNTH, "Music", 0 }, /* fallback */ |
1253 | { SOUND_MIXER_PCM, "PCM", 0 }, | 1253 | { SOUND_MIXER_PCM, "PCM", 0 }, |
1254 | { SOUND_MIXER_SPEAKER, "PC Speaker", 0 }, | 1254 | { SOUND_MIXER_SPEAKER, "Beep", 0 }, |
1255 | { SOUND_MIXER_SPEAKER, "PC Speaker", 0 }, /* fallback */ | ||
1256 | { SOUND_MIXER_SPEAKER, "Speaker", 0 }, /* fallback */ | ||
1255 | { SOUND_MIXER_LINE, "Line", 0 }, | 1257 | { SOUND_MIXER_LINE, "Line", 0 }, |
1256 | { SOUND_MIXER_MIC, "Mic", 0 }, | 1258 | { SOUND_MIXER_MIC, "Mic", 0 }, |
1257 | { SOUND_MIXER_CD, "CD", 0 }, | 1259 | { SOUND_MIXER_CD, "CD", 0 }, |
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index b60cef257b58..f165c77d6273 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c | |||
@@ -26,6 +26,7 @@ MODULE_ALIAS("platform:pcspkr"); | |||
26 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 26 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
27 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 27 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
28 | static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ | 28 | static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ |
29 | static int nopcm; /* Disable PCM capability of the driver */ | ||
29 | 30 | ||
30 | module_param(index, int, 0444); | 31 | module_param(index, int, 0444); |
31 | MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); | 32 | MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); |
@@ -33,6 +34,8 @@ module_param(id, charp, 0444); | |||
33 | MODULE_PARM_DESC(id, "ID string for pcsp soundcard."); | 34 | MODULE_PARM_DESC(id, "ID string for pcsp soundcard."); |
34 | module_param(enable, bool, 0444); | 35 | module_param(enable, bool, 0444); |
35 | MODULE_PARM_DESC(enable, "Enable PC-Speaker sound."); | 36 | MODULE_PARM_DESC(enable, "Enable PC-Speaker sound."); |
37 | module_param(nopcm, bool, 0444); | ||
38 | MODULE_PARM_DESC(nopcm, "Disable PC-Speaker PCM sound. Only beeps remain."); | ||
36 | 39 | ||
37 | struct snd_pcsp pcsp_chip; | 40 | struct snd_pcsp pcsp_chip; |
38 | 41 | ||
@@ -43,13 +46,16 @@ static int __devinit snd_pcsp_create(struct snd_card *card) | |||
43 | int err; | 46 | int err; |
44 | int div, min_div, order; | 47 | int div, min_div, order; |
45 | 48 | ||
46 | hrtimer_get_res(CLOCK_MONOTONIC, &tp); | 49 | if (!nopcm) { |
47 | if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) { | 50 | hrtimer_get_res(CLOCK_MONOTONIC, &tp); |
48 | printk(KERN_ERR "PCSP: Timer resolution is not sufficient " | 51 | if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) { |
49 | "(%linS)\n", tp.tv_nsec); | 52 | printk(KERN_ERR "PCSP: Timer resolution is not sufficient " |
50 | printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI " | 53 | "(%linS)\n", tp.tv_nsec); |
51 | "enabled.\n"); | 54 | printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI " |
52 | return -EIO; | 55 | "enabled.\n"); |
56 | printk(KERN_ERR "PCSP: Turned into nopcm mode.\n"); | ||
57 | nopcm = 1; | ||
58 | } | ||
53 | } | 59 | } |
54 | 60 | ||
55 | if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS) | 61 | if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS) |
@@ -107,12 +113,14 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev) | |||
107 | snd_card_free(card); | 113 | snd_card_free(card); |
108 | return err; | 114 | return err; |
109 | } | 115 | } |
110 | err = snd_pcsp_new_pcm(&pcsp_chip); | 116 | if (!nopcm) { |
111 | if (err < 0) { | 117 | err = snd_pcsp_new_pcm(&pcsp_chip); |
112 | snd_card_free(card); | 118 | if (err < 0) { |
113 | return err; | 119 | snd_card_free(card); |
120 | return err; | ||
121 | } | ||
114 | } | 122 | } |
115 | err = snd_pcsp_new_mixer(&pcsp_chip); | 123 | err = snd_pcsp_new_mixer(&pcsp_chip, nopcm); |
116 | if (err < 0) { | 124 | if (err < 0) { |
117 | snd_card_free(card); | 125 | snd_card_free(card); |
118 | return err; | 126 | return err; |
diff --git a/sound/drivers/pcsp/pcsp.h b/sound/drivers/pcsp/pcsp.h index 174dd2ff0f22..1e123077923d 100644 --- a/sound/drivers/pcsp/pcsp.h +++ b/sound/drivers/pcsp/pcsp.h | |||
@@ -83,6 +83,6 @@ extern enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle); | |||
83 | extern void pcsp_sync_stop(struct snd_pcsp *chip); | 83 | extern void pcsp_sync_stop(struct snd_pcsp *chip); |
84 | 84 | ||
85 | extern int snd_pcsp_new_pcm(struct snd_pcsp *chip); | 85 | extern int snd_pcsp_new_pcm(struct snd_pcsp *chip); |
86 | extern int snd_pcsp_new_mixer(struct snd_pcsp *chip); | 86 | extern int snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm); |
87 | 87 | ||
88 | #endif | 88 | #endif |
diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c index 903bc846763f..6f633f4f3b96 100644 --- a/sound/drivers/pcsp/pcsp_mixer.c +++ b/sound/drivers/pcsp/pcsp_mixer.c | |||
@@ -119,24 +119,43 @@ static int pcsp_pcspkr_put(struct snd_kcontrol *kcontrol, | |||
119 | .put = pcsp_##ctl_type##_put, \ | 119 | .put = pcsp_##ctl_type##_put, \ |
120 | } | 120 | } |
121 | 121 | ||
122 | static struct snd_kcontrol_new __devinitdata snd_pcsp_controls[] = { | 122 | static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_pcm[] = { |
123 | PCSP_MIXER_CONTROL(enable, "Master Playback Switch"), | 123 | PCSP_MIXER_CONTROL(enable, "Master Playback Switch"), |
124 | PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"), | 124 | PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"), |
125 | PCSP_MIXER_CONTROL(pcspkr, "PC Speaker Playback Switch"), | ||
126 | }; | 125 | }; |
127 | 126 | ||
128 | int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip) | 127 | static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_spkr[] = { |
128 | PCSP_MIXER_CONTROL(pcspkr, "Beep Playback Switch"), | ||
129 | }; | ||
130 | |||
131 | static int __devinit snd_pcsp_ctls_add(struct snd_pcsp *chip, | ||
132 | struct snd_kcontrol_new *ctls, int num) | ||
129 | { | 133 | { |
130 | struct snd_card *card = chip->card; | ||
131 | int i, err; | 134 | int i, err; |
135 | struct snd_card *card = chip->card; | ||
136 | for (i = 0; i < num; i++) { | ||
137 | err = snd_ctl_add(card, snd_ctl_new1(ctls + i, chip)); | ||
138 | if (err < 0) | ||
139 | return err; | ||
140 | } | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm) | ||
145 | { | ||
146 | int err; | ||
147 | struct snd_card *card = chip->card; | ||
132 | 148 | ||
133 | for (i = 0; i < ARRAY_SIZE(snd_pcsp_controls); i++) { | 149 | if (!nopcm) { |
134 | err = snd_ctl_add(card, | 150 | err = snd_pcsp_ctls_add(chip, snd_pcsp_controls_pcm, |
135 | snd_ctl_new1(snd_pcsp_controls + i, | 151 | ARRAY_SIZE(snd_pcsp_controls_pcm)); |
136 | chip)); | ||
137 | if (err < 0) | 152 | if (err < 0) |
138 | return err; | 153 | return err; |
139 | } | 154 | } |
155 | err = snd_pcsp_ctls_add(chip, snd_pcsp_controls_spkr, | ||
156 | ARRAY_SIZE(snd_pcsp_controls_spkr)); | ||
157 | if (err < 0) | ||
158 | return err; | ||
140 | 159 | ||
141 | strcpy(card->mixername, "PC-Speaker"); | 160 | strcpy(card->mixername, "PC-Speaker"); |
142 | 161 | ||
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 51a7e3777e17..02fe81ca88fd 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig | |||
@@ -372,15 +372,21 @@ config SND_SGALAXY | |||
372 | 372 | ||
373 | config SND_SSCAPE | 373 | config SND_SSCAPE |
374 | tristate "Ensoniq SoundScape driver" | 374 | tristate "Ensoniq SoundScape driver" |
375 | select SND_HWDEP | ||
376 | select SND_MPU401_UART | 375 | select SND_MPU401_UART |
377 | select SND_WSS_LIB | 376 | select SND_WSS_LIB |
377 | select FW_LOADER | ||
378 | help | 378 | help |
379 | Say Y here to include support for Ensoniq SoundScape | 379 | Say Y here to include support for Ensoniq SoundScape |
380 | soundcards. | 380 | and Ensoniq OEM soundcards. |
381 | 381 | ||
382 | The PCM audio is supported on SoundScape Classic, Elite, PnP | 382 | The PCM audio is supported on SoundScape Classic, Elite, PnP |
383 | and VIVO cards. The MIDI support is very experimental. | 383 | and VIVO cards. The supported OEM cards are SPEA Media FX and |
384 | Reveal SC-600. | ||
385 | The MIDI support is very experimental and requires binary | ||
386 | firmware files called "scope.cod" and "sndscape.co?" where the | ||
387 | ? is digit 0, 1, 2, 3 or 4. The firmware files can be found | ||
388 | in DOS or Windows driver packages. One has to put the firmware | ||
389 | files into the /lib/firmware directory. | ||
384 | 390 | ||
385 | To compile this driver as a module, choose M here: the module | 391 | To compile this driver as a module, choose M here: the module |
386 | will be called snd-sscape. | 392 | will be called snd-sscape. |
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 02f79d252718..8246aae32ab4 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c | |||
@@ -237,7 +237,7 @@ WSS_DOUBLE("Wavetable Capture Volume", 0, | |||
237 | CMI8330_WAVGAIN, CMI8330_WAVGAIN, 4, 0, 15, 0), | 237 | CMI8330_WAVGAIN, CMI8330_WAVGAIN, 4, 0, 15, 0), |
238 | WSS_SINGLE("3D Control - Switch", 0, | 238 | WSS_SINGLE("3D Control - Switch", 0, |
239 | CMI8330_RMUX3D, 5, 1, 1), | 239 | CMI8330_RMUX3D, 5, 1, 1), |
240 | WSS_SINGLE("PC Speaker Playback Volume", 0, | 240 | WSS_SINGLE("Beep Playback Volume", 0, |
241 | CMI8330_OUTPUTVOL, 3, 3, 0), | 241 | CMI8330_OUTPUTVOL, 3, 3, 0), |
242 | WSS_DOUBLE("FM Playback Switch", 0, | 242 | WSS_DOUBLE("FM Playback Switch", 0, |
243 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 243 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
@@ -262,7 +262,7 @@ SB_DOUBLE("SB Line Playback Switch", SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, | |||
262 | SB_DOUBLE("SB Line Playback Volume", SB_DSP4_LINE_DEV, (SB_DSP4_LINE_DEV + 1), 3, 3, 31), | 262 | SB_DOUBLE("SB Line Playback Volume", SB_DSP4_LINE_DEV, (SB_DSP4_LINE_DEV + 1), 3, 3, 31), |
263 | SB_SINGLE("SB Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1), | 263 | SB_SINGLE("SB Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1), |
264 | SB_SINGLE("SB Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), | 264 | SB_SINGLE("SB Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), |
265 | SB_SINGLE("SB PC Speaker Volume", SB_DSP4_SPEAKER_DEV, 6, 3), | 265 | SB_SINGLE("SB Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3), |
266 | SB_DOUBLE("SB Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3), | 266 | SB_DOUBLE("SB Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3), |
267 | SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3), | 267 | SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3), |
268 | SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), | 268 | SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), |
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 4c6e14f87f2d..c76bb00c9d15 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c | |||
@@ -982,7 +982,7 @@ ES1688_DOUBLE("CD Playback Volume", 0, ES1688_CD_DEV, ES1688_CD_DEV, 4, 0, 15, 0 | |||
982 | ES1688_DOUBLE("FM Playback Volume", 0, ES1688_FM_DEV, ES1688_FM_DEV, 4, 0, 15, 0), | 982 | ES1688_DOUBLE("FM Playback Volume", 0, ES1688_FM_DEV, ES1688_FM_DEV, 4, 0, 15, 0), |
983 | ES1688_DOUBLE("Mic Playback Volume", 0, ES1688_MIC_DEV, ES1688_MIC_DEV, 4, 0, 15, 0), | 983 | ES1688_DOUBLE("Mic Playback Volume", 0, ES1688_MIC_DEV, ES1688_MIC_DEV, 4, 0, 15, 0), |
984 | ES1688_DOUBLE("Aux Playback Volume", 0, ES1688_AUX_DEV, ES1688_AUX_DEV, 4, 0, 15, 0), | 984 | ES1688_DOUBLE("Aux Playback Volume", 0, ES1688_AUX_DEV, ES1688_AUX_DEV, 4, 0, 15, 0), |
985 | ES1688_SINGLE("PC Speaker Playback Volume", 0, ES1688_SPEAKER_DEV, 0, 7, 0), | 985 | ES1688_SINGLE("Beep Playback Volume", 0, ES1688_SPEAKER_DEV, 0, 7, 0), |
986 | ES1688_DOUBLE("Capture Volume", 0, ES1688_RECLEV_DEV, ES1688_RECLEV_DEV, 4, 0, 15, 0), | 986 | ES1688_DOUBLE("Capture Volume", 0, ES1688_RECLEV_DEV, ES1688_RECLEV_DEV, 4, 0, 15, 0), |
987 | ES1688_SINGLE("Capture Switch", 0, ES1688_REC_DEV, 4, 1, 1), | 987 | ES1688_SINGLE("Capture Switch", 0, ES1688_REC_DEV, 4, 1, 1), |
988 | { | 988 | { |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 8cfbff73a835..e5bf3355d2ca 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -121,7 +121,6 @@ struct snd_es18xx { | |||
121 | unsigned int dma1_shift; | 121 | unsigned int dma1_shift; |
122 | unsigned int dma2_shift; | 122 | unsigned int dma2_shift; |
123 | 123 | ||
124 | struct snd_card *card; | ||
125 | struct snd_pcm *pcm; | 124 | struct snd_pcm *pcm; |
126 | struct snd_pcm_substream *playback_a_substream; | 125 | struct snd_pcm_substream *playback_a_substream; |
127 | struct snd_pcm_substream *capture_a_substream; | 126 | struct snd_pcm_substream *capture_a_substream; |
@@ -140,10 +139,6 @@ struct snd_es18xx { | |||
140 | #ifdef CONFIG_PM | 139 | #ifdef CONFIG_PM |
141 | unsigned char pm_reg; | 140 | unsigned char pm_reg; |
142 | #endif | 141 | #endif |
143 | }; | ||
144 | |||
145 | struct snd_audiodrive { | ||
146 | struct snd_es18xx *chip; | ||
147 | #ifdef CONFIG_PNP | 142 | #ifdef CONFIG_PNP |
148 | struct pnp_dev *dev; | 143 | struct pnp_dev *dev; |
149 | struct pnp_dev *devc; | 144 | struct pnp_dev *devc; |
@@ -755,7 +750,8 @@ static int snd_es18xx_playback_trigger(struct snd_pcm_substream *substream, | |||
755 | 750 | ||
756 | static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) | 751 | static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) |
757 | { | 752 | { |
758 | struct snd_es18xx *chip = dev_id; | 753 | struct snd_card *card = dev_id; |
754 | struct snd_es18xx *chip = card->private_data; | ||
759 | unsigned char status; | 755 | unsigned char status; |
760 | 756 | ||
761 | if (chip->caps & ES18XX_CONTROL) { | 757 | if (chip->caps & ES18XX_CONTROL) { |
@@ -805,12 +801,16 @@ static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) | |||
805 | int split = 0; | 801 | int split = 0; |
806 | if (chip->caps & ES18XX_HWV) { | 802 | if (chip->caps & ES18XX_HWV) { |
807 | split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; | 803 | split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; |
808 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); | 804 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, |
809 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); | 805 | &chip->hw_switch->id); |
806 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
807 | &chip->hw_volume->id); | ||
810 | } | 808 | } |
811 | if (!split) { | 809 | if (!split) { |
812 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); | 810 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, |
813 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); | 811 | &chip->master_switch->id); |
812 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
813 | &chip->master_volume->id); | ||
814 | } | 814 | } |
815 | /* ack interrupt */ | 815 | /* ack interrupt */ |
816 | snd_es18xx_mixer_write(chip, 0x66, 0x00); | 816 | snd_es18xx_mixer_write(chip, 0x66, 0x00); |
@@ -1313,7 +1313,7 @@ ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0) | |||
1313 | * The chipset specific mixer controls | 1313 | * The chipset specific mixer controls |
1314 | */ | 1314 | */ |
1315 | static struct snd_kcontrol_new snd_es18xx_opt_speaker = | 1315 | static struct snd_kcontrol_new snd_es18xx_opt_speaker = |
1316 | ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0); | 1316 | ES18XX_SINGLE("Beep Playback Volume", 0, 0x3c, 0, 7, 0); |
1317 | 1317 | ||
1318 | static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { | 1318 | static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { |
1319 | ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), | 1319 | ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), |
@@ -1691,8 +1691,10 @@ static struct snd_pcm_ops snd_es18xx_capture_ops = { | |||
1691 | .pointer = snd_es18xx_capture_pointer, | 1691 | .pointer = snd_es18xx_capture_pointer, |
1692 | }; | 1692 | }; |
1693 | 1693 | ||
1694 | static int __devinit snd_es18xx_pcm(struct snd_es18xx *chip, int device, struct snd_pcm ** rpcm) | 1694 | static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, |
1695 | struct snd_pcm **rpcm) | ||
1695 | { | 1696 | { |
1697 | struct snd_es18xx *chip = card->private_data; | ||
1696 | struct snd_pcm *pcm; | 1698 | struct snd_pcm *pcm; |
1697 | char str[16]; | 1699 | char str[16]; |
1698 | int err; | 1700 | int err; |
@@ -1701,9 +1703,9 @@ static int __devinit snd_es18xx_pcm(struct snd_es18xx *chip, int device, struct | |||
1701 | *rpcm = NULL; | 1703 | *rpcm = NULL; |
1702 | sprintf(str, "ES%x", chip->version); | 1704 | sprintf(str, "ES%x", chip->version); |
1703 | if (chip->caps & ES18XX_PCM2) | 1705 | if (chip->caps & ES18XX_PCM2) |
1704 | err = snd_pcm_new(chip->card, str, device, 2, 1, &pcm); | 1706 | err = snd_pcm_new(card, str, device, 2, 1, &pcm); |
1705 | else | 1707 | else |
1706 | err = snd_pcm_new(chip->card, str, device, 1, 1, &pcm); | 1708 | err = snd_pcm_new(card, str, device, 1, 1, &pcm); |
1707 | if (err < 0) | 1709 | if (err < 0) |
1708 | return err; | 1710 | return err; |
1709 | 1711 | ||
@@ -1734,10 +1736,9 @@ static int __devinit snd_es18xx_pcm(struct snd_es18xx *chip, int device, struct | |||
1734 | #ifdef CONFIG_PM | 1736 | #ifdef CONFIG_PM |
1735 | static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) | 1737 | static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) |
1736 | { | 1738 | { |
1737 | struct snd_audiodrive *acard = card->private_data; | 1739 | struct snd_es18xx *chip = card->private_data; |
1738 | struct snd_es18xx *chip = acard->chip; | ||
1739 | 1740 | ||
1740 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); | 1741 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1741 | 1742 | ||
1742 | snd_pcm_suspend_all(chip->pcm); | 1743 | snd_pcm_suspend_all(chip->pcm); |
1743 | 1744 | ||
@@ -1752,24 +1753,25 @@ static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) | |||
1752 | 1753 | ||
1753 | static int snd_es18xx_resume(struct snd_card *card) | 1754 | static int snd_es18xx_resume(struct snd_card *card) |
1754 | { | 1755 | { |
1755 | struct snd_audiodrive *acard = card->private_data; | 1756 | struct snd_es18xx *chip = card->private_data; |
1756 | struct snd_es18xx *chip = acard->chip; | ||
1757 | 1757 | ||
1758 | /* restore PM register, we won't wake till (not 0x07) i/o activity though */ | 1758 | /* restore PM register, we won't wake till (not 0x07) i/o activity though */ |
1759 | snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM); | 1759 | snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM); |
1760 | 1760 | ||
1761 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); | 1761 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
1762 | return 0; | 1762 | return 0; |
1763 | } | 1763 | } |
1764 | #endif /* CONFIG_PM */ | 1764 | #endif /* CONFIG_PM */ |
1765 | 1765 | ||
1766 | static int snd_es18xx_free(struct snd_es18xx *chip) | 1766 | static int snd_es18xx_free(struct snd_card *card) |
1767 | { | 1767 | { |
1768 | struct snd_es18xx *chip = card->private_data; | ||
1769 | |||
1768 | release_and_free_resource(chip->res_port); | 1770 | release_and_free_resource(chip->res_port); |
1769 | release_and_free_resource(chip->res_ctrl_port); | 1771 | release_and_free_resource(chip->res_ctrl_port); |
1770 | release_and_free_resource(chip->res_mpu_port); | 1772 | release_and_free_resource(chip->res_mpu_port); |
1771 | if (chip->irq >= 0) | 1773 | if (chip->irq >= 0) |
1772 | free_irq(chip->irq, (void *) chip); | 1774 | free_irq(chip->irq, (void *) card); |
1773 | if (chip->dma1 >= 0) { | 1775 | if (chip->dma1 >= 0) { |
1774 | disable_dma(chip->dma1); | 1776 | disable_dma(chip->dma1); |
1775 | free_dma(chip->dma1); | 1777 | free_dma(chip->dma1); |
@@ -1778,37 +1780,29 @@ static int snd_es18xx_free(struct snd_es18xx *chip) | |||
1778 | disable_dma(chip->dma2); | 1780 | disable_dma(chip->dma2); |
1779 | free_dma(chip->dma2); | 1781 | free_dma(chip->dma2); |
1780 | } | 1782 | } |
1781 | kfree(chip); | ||
1782 | return 0; | 1783 | return 0; |
1783 | } | 1784 | } |
1784 | 1785 | ||
1785 | static int snd_es18xx_dev_free(struct snd_device *device) | 1786 | static int snd_es18xx_dev_free(struct snd_device *device) |
1786 | { | 1787 | { |
1787 | struct snd_es18xx *chip = device->device_data; | 1788 | return snd_es18xx_free(device->card); |
1788 | return snd_es18xx_free(chip); | ||
1789 | } | 1789 | } |
1790 | 1790 | ||
1791 | static int __devinit snd_es18xx_new_device(struct snd_card *card, | 1791 | static int __devinit snd_es18xx_new_device(struct snd_card *card, |
1792 | unsigned long port, | 1792 | unsigned long port, |
1793 | unsigned long mpu_port, | 1793 | unsigned long mpu_port, |
1794 | unsigned long fm_port, | 1794 | unsigned long fm_port, |
1795 | int irq, int dma1, int dma2, | 1795 | int irq, int dma1, int dma2) |
1796 | struct snd_es18xx ** rchip) | ||
1797 | { | 1796 | { |
1798 | struct snd_es18xx *chip; | 1797 | struct snd_es18xx *chip = card->private_data; |
1799 | static struct snd_device_ops ops = { | 1798 | static struct snd_device_ops ops = { |
1800 | .dev_free = snd_es18xx_dev_free, | 1799 | .dev_free = snd_es18xx_dev_free, |
1801 | }; | 1800 | }; |
1802 | int err; | 1801 | int err; |
1803 | 1802 | ||
1804 | *rchip = NULL; | ||
1805 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | ||
1806 | if (chip == NULL) | ||
1807 | return -ENOMEM; | ||
1808 | spin_lock_init(&chip->reg_lock); | 1803 | spin_lock_init(&chip->reg_lock); |
1809 | spin_lock_init(&chip->mixer_lock); | 1804 | spin_lock_init(&chip->mixer_lock); |
1810 | spin_lock_init(&chip->ctrl_lock); | 1805 | spin_lock_init(&chip->ctrl_lock); |
1811 | chip->card = card; | ||
1812 | chip->port = port; | 1806 | chip->port = port; |
1813 | chip->mpu_port = mpu_port; | 1807 | chip->mpu_port = mpu_port; |
1814 | chip->fm_port = fm_port; | 1808 | chip->fm_port = fm_port; |
@@ -1818,53 +1812,53 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, | |||
1818 | chip->audio2_vol = 0x00; | 1812 | chip->audio2_vol = 0x00; |
1819 | chip->active = 0; | 1813 | chip->active = 0; |
1820 | 1814 | ||
1821 | if ((chip->res_port = request_region(port, 16, "ES18xx")) == NULL) { | 1815 | chip->res_port = request_region(port, 16, "ES18xx"); |
1822 | snd_es18xx_free(chip); | 1816 | if (chip->res_port == NULL) { |
1817 | snd_es18xx_free(card); | ||
1823 | snd_printk(KERN_ERR PFX "unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1); | 1818 | snd_printk(KERN_ERR PFX "unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1); |
1824 | return -EBUSY; | 1819 | return -EBUSY; |
1825 | } | 1820 | } |
1826 | 1821 | ||
1827 | if (request_irq(irq, snd_es18xx_interrupt, IRQF_DISABLED, "ES18xx", (void *) chip)) { | 1822 | if (request_irq(irq, snd_es18xx_interrupt, IRQF_DISABLED, "ES18xx", |
1828 | snd_es18xx_free(chip); | 1823 | (void *) card)) { |
1824 | snd_es18xx_free(card); | ||
1829 | snd_printk(KERN_ERR PFX "unable to grap IRQ %d\n", irq); | 1825 | snd_printk(KERN_ERR PFX "unable to grap IRQ %d\n", irq); |
1830 | return -EBUSY; | 1826 | return -EBUSY; |
1831 | } | 1827 | } |
1832 | chip->irq = irq; | 1828 | chip->irq = irq; |
1833 | 1829 | ||
1834 | if (request_dma(dma1, "ES18xx DMA 1")) { | 1830 | if (request_dma(dma1, "ES18xx DMA 1")) { |
1835 | snd_es18xx_free(chip); | 1831 | snd_es18xx_free(card); |
1836 | snd_printk(KERN_ERR PFX "unable to grap DMA1 %d\n", dma1); | 1832 | snd_printk(KERN_ERR PFX "unable to grap DMA1 %d\n", dma1); |
1837 | return -EBUSY; | 1833 | return -EBUSY; |
1838 | } | 1834 | } |
1839 | chip->dma1 = dma1; | 1835 | chip->dma1 = dma1; |
1840 | 1836 | ||
1841 | if (dma2 != dma1 && request_dma(dma2, "ES18xx DMA 2")) { | 1837 | if (dma2 != dma1 && request_dma(dma2, "ES18xx DMA 2")) { |
1842 | snd_es18xx_free(chip); | 1838 | snd_es18xx_free(card); |
1843 | snd_printk(KERN_ERR PFX "unable to grap DMA2 %d\n", dma2); | 1839 | snd_printk(KERN_ERR PFX "unable to grap DMA2 %d\n", dma2); |
1844 | return -EBUSY; | 1840 | return -EBUSY; |
1845 | } | 1841 | } |
1846 | chip->dma2 = dma2; | 1842 | chip->dma2 = dma2; |
1847 | 1843 | ||
1848 | if (snd_es18xx_probe(chip) < 0) { | 1844 | if (snd_es18xx_probe(chip) < 0) { |
1849 | snd_es18xx_free(chip); | 1845 | snd_es18xx_free(card); |
1850 | return -ENODEV; | 1846 | return -ENODEV; |
1851 | } | 1847 | } |
1852 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 1848 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, NULL, &ops); |
1853 | snd_es18xx_free(chip); | 1849 | if (err < 0) { |
1850 | snd_es18xx_free(card); | ||
1854 | return err; | 1851 | return err; |
1855 | } | 1852 | } |
1856 | *rchip = chip; | ||
1857 | return 0; | 1853 | return 0; |
1858 | } | 1854 | } |
1859 | 1855 | ||
1860 | static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip) | 1856 | static int __devinit snd_es18xx_mixer(struct snd_card *card) |
1861 | { | 1857 | { |
1862 | struct snd_card *card; | 1858 | struct snd_es18xx *chip = card->private_data; |
1863 | int err; | 1859 | int err; |
1864 | unsigned int idx; | 1860 | unsigned int idx; |
1865 | 1861 | ||
1866 | card = chip->card; | ||
1867 | |||
1868 | strcpy(card->mixername, chip->pcm->name); | 1862 | strcpy(card->mixername, chip->pcm->name); |
1869 | 1863 | ||
1870 | for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_base_controls); idx++) { | 1864 | for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_base_controls); idx++) { |
@@ -2063,11 +2057,11 @@ static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev) | |||
2063 | return 0; | 2057 | return 0; |
2064 | } | 2058 | } |
2065 | 2059 | ||
2066 | static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, | 2060 | static int __devinit snd_audiodrive_pnp(int dev, struct snd_es18xx *chip, |
2067 | struct pnp_dev *pdev) | 2061 | struct pnp_dev *pdev) |
2068 | { | 2062 | { |
2069 | acard->dev = pdev; | 2063 | chip->dev = pdev; |
2070 | if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0) | 2064 | if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) |
2071 | return -EBUSY; | 2065 | return -EBUSY; |
2072 | return 0; | 2066 | return 0; |
2073 | } | 2067 | } |
@@ -2093,26 +2087,26 @@ static struct pnp_card_device_id snd_audiodrive_pnpids[] = { | |||
2093 | 2087 | ||
2094 | MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids); | 2088 | MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids); |
2095 | 2089 | ||
2096 | static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, | 2090 | static int __devinit snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip, |
2097 | struct pnp_card_link *card, | 2091 | struct pnp_card_link *card, |
2098 | const struct pnp_card_device_id *id) | 2092 | const struct pnp_card_device_id *id) |
2099 | { | 2093 | { |
2100 | acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); | 2094 | chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL); |
2101 | if (acard->dev == NULL) | 2095 | if (chip->dev == NULL) |
2102 | return -EBUSY; | 2096 | return -EBUSY; |
2103 | 2097 | ||
2104 | acard->devc = pnp_request_card_device(card, id->devs[1].id, NULL); | 2098 | chip->devc = pnp_request_card_device(card, id->devs[1].id, NULL); |
2105 | if (acard->devc == NULL) | 2099 | if (chip->devc == NULL) |
2106 | return -EBUSY; | 2100 | return -EBUSY; |
2107 | 2101 | ||
2108 | /* Control port initialization */ | 2102 | /* Control port initialization */ |
2109 | if (pnp_activate_dev(acard->devc) < 0) { | 2103 | if (pnp_activate_dev(chip->devc) < 0) { |
2110 | snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); | 2104 | snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); |
2111 | return -EAGAIN; | 2105 | return -EAGAIN; |
2112 | } | 2106 | } |
2113 | snd_printdd("pnp: port=0x%llx\n", | 2107 | snd_printdd("pnp: port=0x%llx\n", |
2114 | (unsigned long long)pnp_port_start(acard->devc, 0)); | 2108 | (unsigned long long)pnp_port_start(chip->devc, 0)); |
2115 | if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0) | 2109 | if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) |
2116 | return -EBUSY; | 2110 | return -EBUSY; |
2117 | 2111 | ||
2118 | return 0; | 2112 | return 0; |
@@ -2128,24 +2122,20 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, | |||
2128 | static int snd_es18xx_card_new(int dev, struct snd_card **cardp) | 2122 | static int snd_es18xx_card_new(int dev, struct snd_card **cardp) |
2129 | { | 2123 | { |
2130 | return snd_card_create(index[dev], id[dev], THIS_MODULE, | 2124 | return snd_card_create(index[dev], id[dev], THIS_MODULE, |
2131 | sizeof(struct snd_audiodrive), cardp); | 2125 | sizeof(struct snd_es18xx), cardp); |
2132 | } | 2126 | } |
2133 | 2127 | ||
2134 | static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) | 2128 | static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) |
2135 | { | 2129 | { |
2136 | struct snd_audiodrive *acard = card->private_data; | 2130 | struct snd_es18xx *chip = card->private_data; |
2137 | struct snd_es18xx *chip; | ||
2138 | struct snd_opl3 *opl3; | 2131 | struct snd_opl3 *opl3; |
2139 | int err; | 2132 | int err; |
2140 | 2133 | ||
2141 | if ((err = snd_es18xx_new_device(card, | 2134 | err = snd_es18xx_new_device(card, |
2142 | port[dev], | 2135 | port[dev], mpu_port[dev], fm_port[dev], |
2143 | mpu_port[dev], | 2136 | irq[dev], dma1[dev], dma2[dev]); |
2144 | fm_port[dev], | 2137 | if (err < 0) |
2145 | irq[dev], dma1[dev], dma2[dev], | ||
2146 | &chip)) < 0) | ||
2147 | return err; | 2138 | return err; |
2148 | acard->chip = chip; | ||
2149 | 2139 | ||
2150 | sprintf(card->driver, "ES%x", chip->version); | 2140 | sprintf(card->driver, "ES%x", chip->version); |
2151 | 2141 | ||
@@ -2161,10 +2151,12 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) | |||
2161 | chip->port, | 2151 | chip->port, |
2162 | irq[dev], dma1[dev]); | 2152 | irq[dev], dma1[dev]); |
2163 | 2153 | ||
2164 | if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) | 2154 | err = snd_es18xx_pcm(card, 0, NULL); |
2155 | if (err < 0) | ||
2165 | return err; | 2156 | return err; |
2166 | 2157 | ||
2167 | if ((err = snd_es18xx_mixer(chip)) < 0) | 2158 | err = snd_es18xx_mixer(card); |
2159 | if (err < 0) | ||
2168 | return err; | 2160 | return err; |
2169 | 2161 | ||
2170 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { | 2162 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { |
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 475220bbcc96..318ff0c823e7 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c | |||
@@ -631,7 +631,7 @@ static struct sbmix_elem snd_sb16_ctl_mic_play_switch = | |||
631 | static struct sbmix_elem snd_sb16_ctl_mic_play_vol = | 631 | static struct sbmix_elem snd_sb16_ctl_mic_play_vol = |
632 | SB_SINGLE("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31); | 632 | SB_SINGLE("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31); |
633 | static struct sbmix_elem snd_sb16_ctl_pc_speaker_vol = | 633 | static struct sbmix_elem snd_sb16_ctl_pc_speaker_vol = |
634 | SB_SINGLE("PC Speaker Volume", SB_DSP4_SPEAKER_DEV, 6, 3); | 634 | SB_SINGLE("Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3); |
635 | static struct sbmix_elem snd_sb16_ctl_capture_vol = | 635 | static struct sbmix_elem snd_sb16_ctl_capture_vol = |
636 | SB_DOUBLE("Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3); | 636 | SB_DOUBLE("Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3); |
637 | static struct sbmix_elem snd_sb16_ctl_play_vol = | 637 | static struct sbmix_elem snd_sb16_ctl_play_vol = |
@@ -689,7 +689,7 @@ static struct sbmix_elem snd_dt019x_ctl_cd_play_vol = | |||
689 | static struct sbmix_elem snd_dt019x_ctl_mic_play_vol = | 689 | static struct sbmix_elem snd_dt019x_ctl_mic_play_vol = |
690 | SB_SINGLE("Mic Playback Volume", SB_DT019X_MIC_DEV, 4, 7); | 690 | SB_SINGLE("Mic Playback Volume", SB_DT019X_MIC_DEV, 4, 7); |
691 | static struct sbmix_elem snd_dt019x_ctl_pc_speaker_vol = | 691 | static struct sbmix_elem snd_dt019x_ctl_pc_speaker_vol = |
692 | SB_SINGLE("PC Speaker Volume", SB_DT019X_SPKR_DEV, 0, 7); | 692 | SB_SINGLE("Beep Volume", SB_DT019X_SPKR_DEV, 0, 7); |
693 | static struct sbmix_elem snd_dt019x_ctl_line_play_vol = | 693 | static struct sbmix_elem snd_dt019x_ctl_line_play_vol = |
694 | SB_DOUBLE("Line Playback Volume", SB_DT019X_LINE_DEV, SB_DT019X_LINE_DEV, 4,0, 15); | 694 | SB_DOUBLE("Line Playback Volume", SB_DT019X_LINE_DEV, SB_DT019X_LINE_DEV, 4,0, 15); |
695 | static struct sbmix_elem snd_dt019x_ctl_pcm_play_switch = | 695 | static struct sbmix_elem snd_dt019x_ctl_pcm_play_switch = |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 66187122377c..e2d5d2d3ed96 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Low-level ALSA driver for the ENSONIQ SoundScape PnP | 2 | * Low-level ALSA driver for the ENSONIQ SoundScape |
3 | * Copyright (c) by Chris Rankin | 3 | * Copyright (c) by Chris Rankin |
4 | * | 4 | * |
5 | * This driver was written in part using information obtained from | 5 | * This driver was written in part using information obtained from |
@@ -25,31 +25,36 @@ | |||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/isa.h> | 26 | #include <linux/isa.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/firmware.h> | ||
28 | #include <linux/pnp.h> | 29 | #include <linux/pnp.h> |
29 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
30 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
31 | #include <asm/dma.h> | 32 | #include <asm/dma.h> |
32 | #include <sound/core.h> | 33 | #include <sound/core.h> |
33 | #include <sound/hwdep.h> | ||
34 | #include <sound/wss.h> | 34 | #include <sound/wss.h> |
35 | #include <sound/mpu401.h> | 35 | #include <sound/mpu401.h> |
36 | #include <sound/initval.h> | 36 | #include <sound/initval.h> |
37 | 37 | ||
38 | #include <sound/sscape_ioctl.h> | ||
39 | |||
40 | 38 | ||
41 | MODULE_AUTHOR("Chris Rankin"); | 39 | MODULE_AUTHOR("Chris Rankin"); |
42 | MODULE_DESCRIPTION("ENSONIQ SoundScape PnP driver"); | 40 | MODULE_DESCRIPTION("ENSONIQ SoundScape driver"); |
43 | MODULE_LICENSE("GPL"); | 41 | MODULE_LICENSE("GPL"); |
44 | 42 | MODULE_FIRMWARE("sndscape.co0"); | |
45 | static int index[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IDX; | 43 | MODULE_FIRMWARE("sndscape.co1"); |
46 | static char* id[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_STR; | 44 | MODULE_FIRMWARE("sndscape.co2"); |
47 | static long port[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_PORT; | 45 | MODULE_FIRMWARE("sndscape.co3"); |
48 | static long wss_port[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_PORT; | 46 | MODULE_FIRMWARE("sndscape.co4"); |
49 | static int irq[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IRQ; | 47 | MODULE_FIRMWARE("scope.cod"); |
50 | static int mpu_irq[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IRQ; | 48 | |
51 | static int dma[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_DMA; | 49 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
52 | static int dma2[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_DMA; | 50 | static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
51 | static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; | ||
52 | static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; | ||
53 | static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; | ||
54 | static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; | ||
55 | static int dma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; | ||
56 | static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; | ||
57 | static bool joystick[SNDRV_CARDS]; | ||
53 | 58 | ||
54 | module_param_array(index, int, NULL, 0444); | 59 | module_param_array(index, int, NULL, 0444); |
55 | MODULE_PARM_DESC(index, "Index number for SoundScape soundcard"); | 60 | MODULE_PARM_DESC(index, "Index number for SoundScape soundcard"); |
@@ -75,6 +80,9 @@ MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); | |||
75 | module_param_array(dma2, int, NULL, 0444); | 80 | module_param_array(dma2, int, NULL, 0444); |
76 | MODULE_PARM_DESC(dma2, "DMA2 # for SoundScape driver."); | 81 | MODULE_PARM_DESC(dma2, "DMA2 # for SoundScape driver."); |
77 | 82 | ||
83 | module_param_array(joystick, bool, NULL, 0444); | ||
84 | MODULE_PARM_DESC(joystick, "Enable gameport."); | ||
85 | |||
78 | #ifdef CONFIG_PNP | 86 | #ifdef CONFIG_PNP |
79 | static int isa_registered; | 87 | static int isa_registered; |
80 | static int pnp_registered; | 88 | static int pnp_registered; |
@@ -101,14 +109,14 @@ MODULE_DEVICE_TABLE(pnp_card, sscape_pnpids); | |||
101 | #define RX_READY 0x01 | 109 | #define RX_READY 0x01 |
102 | #define TX_READY 0x02 | 110 | #define TX_READY 0x02 |
103 | 111 | ||
104 | #define CMD_ACK 0x80 | 112 | #define CMD_ACK 0x80 |
105 | #define CMD_SET_MIDI_VOL 0x84 | 113 | #define CMD_SET_MIDI_VOL 0x84 |
106 | #define CMD_GET_MIDI_VOL 0x85 | 114 | #define CMD_GET_MIDI_VOL 0x85 |
107 | #define CMD_XXX_MIDI_VOL 0x86 | 115 | #define CMD_XXX_MIDI_VOL 0x86 |
108 | #define CMD_SET_EXTMIDI 0x8a | 116 | #define CMD_SET_EXTMIDI 0x8a |
109 | #define CMD_GET_EXTMIDI 0x8b | 117 | #define CMD_GET_EXTMIDI 0x8b |
110 | #define CMD_SET_MT32 0x8c | 118 | #define CMD_SET_MT32 0x8c |
111 | #define CMD_GET_MT32 0x8d | 119 | #define CMD_GET_MT32 0x8d |
112 | 120 | ||
113 | enum GA_REG { | 121 | enum GA_REG { |
114 | GA_INTSTAT_REG = 0, | 122 | GA_INTSTAT_REG = 0, |
@@ -127,7 +135,8 @@ enum GA_REG { | |||
127 | 135 | ||
128 | 136 | ||
129 | enum card_type { | 137 | enum card_type { |
130 | SSCAPE, | 138 | MEDIA_FX, /* Sequoia S-1000 */ |
139 | SSCAPE, /* Sequoia S-2000 */ | ||
131 | SSCAPE_PNP, | 140 | SSCAPE_PNP, |
132 | SSCAPE_VIVO, | 141 | SSCAPE_VIVO, |
133 | }; | 142 | }; |
@@ -140,16 +149,7 @@ struct soundscape { | |||
140 | struct resource *io_res; | 149 | struct resource *io_res; |
141 | struct resource *wss_res; | 150 | struct resource *wss_res; |
142 | struct snd_wss *chip; | 151 | struct snd_wss *chip; |
143 | struct snd_mpu401 *mpu; | ||
144 | struct snd_hwdep *hw; | ||
145 | 152 | ||
146 | /* | ||
147 | * The MIDI device won't work until we've loaded | ||
148 | * its firmware via a hardware-dependent device IOCTL | ||
149 | */ | ||
150 | spinlock_t fwlock; | ||
151 | int hw_in_use; | ||
152 | unsigned long midi_usage; | ||
153 | unsigned char midi_vol; | 153 | unsigned char midi_vol; |
154 | }; | 154 | }; |
155 | 155 | ||
@@ -161,28 +161,21 @@ static inline struct soundscape *get_card_soundscape(struct snd_card *c) | |||
161 | return (struct soundscape *) (c->private_data); | 161 | return (struct soundscape *) (c->private_data); |
162 | } | 162 | } |
163 | 163 | ||
164 | static inline struct soundscape *get_mpu401_soundscape(struct snd_mpu401 * mpu) | ||
165 | { | ||
166 | return (struct soundscape *) (mpu->private_data); | ||
167 | } | ||
168 | |||
169 | static inline struct soundscape *get_hwdep_soundscape(struct snd_hwdep * hw) | ||
170 | { | ||
171 | return (struct soundscape *) (hw->private_data); | ||
172 | } | ||
173 | |||
174 | |||
175 | /* | 164 | /* |
176 | * Allocates some kernel memory that we can use for DMA. | 165 | * Allocates some kernel memory that we can use for DMA. |
177 | * I think this means that the memory has to map to | 166 | * I think this means that the memory has to map to |
178 | * contiguous pages of physical memory. | 167 | * contiguous pages of physical memory. |
179 | */ | 168 | */ |
180 | static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, unsigned long size) | 169 | static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, |
170 | unsigned long size) | ||
181 | { | 171 | { |
182 | if (buf) { | 172 | if (buf) { |
183 | if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, snd_dma_isa_data(), | 173 | if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, |
174 | snd_dma_isa_data(), | ||
184 | size, buf) < 0) { | 175 | size, buf) < 0) { |
185 | snd_printk(KERN_ERR "sscape: Failed to allocate %lu bytes for DMA\n", size); | 176 | snd_printk(KERN_ERR "sscape: Failed to allocate " |
177 | "%lu bytes for DMA\n", | ||
178 | size); | ||
186 | return NULL; | 179 | return NULL; |
187 | } | 180 | } |
188 | } | 181 | } |
@@ -199,13 +192,13 @@ static void free_dmabuf(struct snd_dma_buffer *buf) | |||
199 | snd_dma_free_pages(buf); | 192 | snd_dma_free_pages(buf); |
200 | } | 193 | } |
201 | 194 | ||
202 | |||
203 | /* | 195 | /* |
204 | * This function writes to the SoundScape's control registers, | 196 | * This function writes to the SoundScape's control registers, |
205 | * but doesn't do any locking. It's up to the caller to do that. | 197 | * but doesn't do any locking. It's up to the caller to do that. |
206 | * This is why this function is "unsafe" ... | 198 | * This is why this function is "unsafe" ... |
207 | */ | 199 | */ |
208 | static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, unsigned char val) | 200 | static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, |
201 | unsigned char val) | ||
209 | { | 202 | { |
210 | outb(reg, ODIE_ADDR_IO(io_base)); | 203 | outb(reg, ODIE_ADDR_IO(io_base)); |
211 | outb(val, ODIE_DATA_IO(io_base)); | 204 | outb(val, ODIE_DATA_IO(io_base)); |
@@ -215,7 +208,8 @@ static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, unsign | |||
215 | * Write to the SoundScape's control registers, and do the | 208 | * Write to the SoundScape's control registers, and do the |
216 | * necessary locking ... | 209 | * necessary locking ... |
217 | */ | 210 | */ |
218 | static void sscape_write(struct soundscape *s, enum GA_REG reg, unsigned char val) | 211 | static void sscape_write(struct soundscape *s, enum GA_REG reg, |
212 | unsigned char val) | ||
219 | { | 213 | { |
220 | unsigned long flags; | 214 | unsigned long flags; |
221 | 215 | ||
@@ -228,7 +222,8 @@ static void sscape_write(struct soundscape *s, enum GA_REG reg, unsigned char va | |||
228 | * Read from the SoundScape's control registers, but leave any | 222 | * Read from the SoundScape's control registers, but leave any |
229 | * locking to the caller. This is why the function is "unsafe" ... | 223 | * locking to the caller. This is why the function is "unsafe" ... |
230 | */ | 224 | */ |
231 | static inline unsigned char sscape_read_unsafe(unsigned io_base, enum GA_REG reg) | 225 | static inline unsigned char sscape_read_unsafe(unsigned io_base, |
226 | enum GA_REG reg) | ||
232 | { | 227 | { |
233 | outb(reg, ODIE_ADDR_IO(io_base)); | 228 | outb(reg, ODIE_ADDR_IO(io_base)); |
234 | return inb(ODIE_DATA_IO(io_base)); | 229 | return inb(ODIE_DATA_IO(io_base)); |
@@ -257,9 +252,8 @@ static inline void set_midi_mode_unsafe(unsigned io_base) | |||
257 | static inline int host_read_unsafe(unsigned io_base) | 252 | static inline int host_read_unsafe(unsigned io_base) |
258 | { | 253 | { |
259 | int data = -1; | 254 | int data = -1; |
260 | if ((inb(HOST_CTRL_IO(io_base)) & RX_READY) != 0) { | 255 | if ((inb(HOST_CTRL_IO(io_base)) & RX_READY) != 0) |
261 | data = inb(HOST_DATA_IO(io_base)); | 256 | data = inb(HOST_DATA_IO(io_base)); |
262 | } | ||
263 | 257 | ||
264 | return data; | 258 | return data; |
265 | } | 259 | } |
@@ -301,7 +295,7 @@ static inline int host_write_unsafe(unsigned io_base, unsigned char data) | |||
301 | * Also leaves all locking-issues to the caller ... | 295 | * Also leaves all locking-issues to the caller ... |
302 | */ | 296 | */ |
303 | static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, | 297 | static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, |
304 | unsigned timeout) | 298 | unsigned timeout) |
305 | { | 299 | { |
306 | int err; | 300 | int err; |
307 | 301 | ||
@@ -320,7 +314,7 @@ static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, | |||
320 | * | 314 | * |
321 | * NOTE: This check is based upon observation, not documentation. | 315 | * NOTE: This check is based upon observation, not documentation. |
322 | */ | 316 | */ |
323 | static inline int verify_mpu401(const struct snd_mpu401 * mpu) | 317 | static inline int verify_mpu401(const struct snd_mpu401 *mpu) |
324 | { | 318 | { |
325 | return ((inb(MPU401C(mpu)) & 0xc0) == 0x80); | 319 | return ((inb(MPU401C(mpu)) & 0xc0) == 0x80); |
326 | } | 320 | } |
@@ -328,7 +322,7 @@ static inline int verify_mpu401(const struct snd_mpu401 * mpu) | |||
328 | /* | 322 | /* |
329 | * This is apparently the standard way to initailise an MPU-401 | 323 | * This is apparently the standard way to initailise an MPU-401 |
330 | */ | 324 | */ |
331 | static inline void initialise_mpu401(const struct snd_mpu401 * mpu) | 325 | static inline void initialise_mpu401(const struct snd_mpu401 *mpu) |
332 | { | 326 | { |
333 | outb(0, MPU401D(mpu)); | 327 | outb(0, MPU401D(mpu)); |
334 | } | 328 | } |
@@ -338,9 +332,10 @@ static inline void initialise_mpu401(const struct snd_mpu401 * mpu) | |||
338 | * The AD1845 detection fails if we *don't* do this, so I | 332 | * The AD1845 detection fails if we *don't* do this, so I |
339 | * think that this is a good idea ... | 333 | * think that this is a good idea ... |
340 | */ | 334 | */ |
341 | static inline void activate_ad1845_unsafe(unsigned io_base) | 335 | static void activate_ad1845_unsafe(unsigned io_base) |
342 | { | 336 | { |
343 | sscape_write_unsafe(io_base, GA_HMCTL_REG, (sscape_read_unsafe(io_base, GA_HMCTL_REG) & 0xcf) | 0x10); | 337 | unsigned char val = sscape_read_unsafe(io_base, GA_HMCTL_REG); |
338 | sscape_write_unsafe(io_base, GA_HMCTL_REG, (val & 0xcf) | 0x10); | ||
344 | sscape_write_unsafe(io_base, GA_CDCFG_REG, 0x80); | 339 | sscape_write_unsafe(io_base, GA_CDCFG_REG, 0x80); |
345 | } | 340 | } |
346 | 341 | ||
@@ -359,24 +354,27 @@ static void soundscape_free(struct snd_card *c) | |||
359 | * Tell the SoundScape to begin a DMA tranfer using the given channel. | 354 | * Tell the SoundScape to begin a DMA tranfer using the given channel. |
360 | * All locking issues are left to the caller. | 355 | * All locking issues are left to the caller. |
361 | */ | 356 | */ |
362 | static inline void sscape_start_dma_unsafe(unsigned io_base, enum GA_REG reg) | 357 | static void sscape_start_dma_unsafe(unsigned io_base, enum GA_REG reg) |
363 | { | 358 | { |
364 | sscape_write_unsafe(io_base, reg, sscape_read_unsafe(io_base, reg) | 0x01); | 359 | sscape_write_unsafe(io_base, reg, |
365 | sscape_write_unsafe(io_base, reg, sscape_read_unsafe(io_base, reg) & 0xfe); | 360 | sscape_read_unsafe(io_base, reg) | 0x01); |
361 | sscape_write_unsafe(io_base, reg, | ||
362 | sscape_read_unsafe(io_base, reg) & 0xfe); | ||
366 | } | 363 | } |
367 | 364 | ||
368 | /* | 365 | /* |
369 | * Wait for a DMA transfer to complete. This is a "limited busy-wait", | 366 | * Wait for a DMA transfer to complete. This is a "limited busy-wait", |
370 | * and all locking issues are left to the caller. | 367 | * and all locking issues are left to the caller. |
371 | */ | 368 | */ |
372 | static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, unsigned timeout) | 369 | static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, |
370 | unsigned timeout) | ||
373 | { | 371 | { |
374 | while (!(sscape_read_unsafe(io_base, reg) & 0x01) && (timeout != 0)) { | 372 | while (!(sscape_read_unsafe(io_base, reg) & 0x01) && (timeout != 0)) { |
375 | udelay(100); | 373 | udelay(100); |
376 | --timeout; | 374 | --timeout; |
377 | } /* while */ | 375 | } /* while */ |
378 | 376 | ||
379 | return (sscape_read_unsafe(io_base, reg) & 0x01); | 377 | return sscape_read_unsafe(io_base, reg) & 0x01; |
380 | } | 378 | } |
381 | 379 | ||
382 | /* | 380 | /* |
@@ -392,12 +390,12 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout) | |||
392 | 390 | ||
393 | do { | 391 | do { |
394 | unsigned long flags; | 392 | unsigned long flags; |
395 | unsigned char x; | 393 | int x; |
396 | 394 | ||
397 | spin_lock_irqsave(&s->lock, flags); | 395 | spin_lock_irqsave(&s->lock, flags); |
398 | x = inb(HOST_DATA_IO(s->io_base)); | 396 | x = host_read_unsafe(s->io_base); |
399 | spin_unlock_irqrestore(&s->lock, flags); | 397 | spin_unlock_irqrestore(&s->lock, flags); |
400 | if ((x & 0xfe) == 0xfe) | 398 | if (x == 0xfe || x == 0xff) |
401 | return 1; | 399 | return 1; |
402 | 400 | ||
403 | msleep(10); | 401 | msleep(10); |
@@ -419,10 +417,10 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) | |||
419 | 417 | ||
420 | do { | 418 | do { |
421 | unsigned long flags; | 419 | unsigned long flags; |
422 | unsigned char x; | 420 | int x; |
423 | 421 | ||
424 | spin_lock_irqsave(&s->lock, flags); | 422 | spin_lock_irqsave(&s->lock, flags); |
425 | x = inb(HOST_DATA_IO(s->io_base)); | 423 | x = host_read_unsafe(s->io_base); |
426 | spin_unlock_irqrestore(&s->lock, flags); | 424 | spin_unlock_irqrestore(&s->lock, flags); |
427 | if (x == 0xfe) | 425 | if (x == 0xfe) |
428 | return 1; | 426 | return 1; |
@@ -436,15 +434,15 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) | |||
436 | /* | 434 | /* |
437 | * Upload a byte-stream into the SoundScape using DMA channel A. | 435 | * Upload a byte-stream into the SoundScape using DMA channel A. |
438 | */ | 436 | */ |
439 | static int upload_dma_data(struct soundscape *s, | 437 | static int upload_dma_data(struct soundscape *s, const unsigned char *data, |
440 | const unsigned char __user *data, | 438 | size_t size) |
441 | size_t size) | ||
442 | { | 439 | { |
443 | unsigned long flags; | 440 | unsigned long flags; |
444 | struct snd_dma_buffer dma; | 441 | struct snd_dma_buffer dma; |
445 | int ret; | 442 | int ret; |
443 | unsigned char val; | ||
446 | 444 | ||
447 | if (!get_dmabuf(&dma, PAGE_ALIGN(size))) | 445 | if (!get_dmabuf(&dma, PAGE_ALIGN(32 * 1024))) |
448 | return -ENOMEM; | 446 | return -ENOMEM; |
449 | 447 | ||
450 | spin_lock_irqsave(&s->lock, flags); | 448 | spin_lock_irqsave(&s->lock, flags); |
@@ -452,70 +450,57 @@ static int upload_dma_data(struct soundscape *s, | |||
452 | /* | 450 | /* |
453 | * Reset the board ... | 451 | * Reset the board ... |
454 | */ | 452 | */ |
455 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f); | 453 | val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); |
454 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val & 0x3f); | ||
456 | 455 | ||
457 | /* | 456 | /* |
458 | * Enable the DMA channels and configure them ... | 457 | * Enable the DMA channels and configure them ... |
459 | */ | 458 | */ |
460 | sscape_write_unsafe(s->io_base, GA_DMACFG_REG, 0x50); | 459 | val = (s->chip->dma1 << 4) | DMA_8BIT; |
461 | sscape_write_unsafe(s->io_base, GA_DMAA_REG, (s->chip->dma1 << 4) | DMA_8BIT); | 460 | sscape_write_unsafe(s->io_base, GA_DMAA_REG, val); |
462 | sscape_write_unsafe(s->io_base, GA_DMAB_REG, 0x20); | 461 | sscape_write_unsafe(s->io_base, GA_DMAB_REG, 0x20); |
463 | 462 | ||
464 | /* | 463 | /* |
465 | * Take the board out of reset ... | 464 | * Take the board out of reset ... |
466 | */ | 465 | */ |
467 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) | 0x80); | 466 | val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); |
467 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val | 0x80); | ||
468 | 468 | ||
469 | /* | 469 | /* |
470 | * Upload the user's data (firmware?) to the SoundScape | 470 | * Upload the firmware to the SoundScape |
471 | * board through the DMA channel ... | 471 | * board through the DMA channel ... |
472 | */ | 472 | */ |
473 | while (size != 0) { | 473 | while (size != 0) { |
474 | unsigned long len; | 474 | unsigned long len; |
475 | 475 | ||
476 | /* | ||
477 | * Apparently, copying to/from userspace can sleep. | ||
478 | * We are therefore forbidden from holding any | ||
479 | * spinlocks while we copy ... | ||
480 | */ | ||
481 | spin_unlock_irqrestore(&s->lock, flags); | ||
482 | |||
483 | /* | ||
484 | * Remember that the data that we want to DMA | ||
485 | * comes from USERSPACE. We have already verified | ||
486 | * the userspace pointer ... | ||
487 | */ | ||
488 | len = min(size, dma.bytes); | 476 | len = min(size, dma.bytes); |
489 | len -= __copy_from_user(dma.area, data, len); | 477 | memcpy(dma.area, data, len); |
490 | data += len; | 478 | data += len; |
491 | size -= len; | 479 | size -= len; |
492 | 480 | ||
493 | /* | ||
494 | * Grab that spinlock again, now that we've | ||
495 | * finished copying! | ||
496 | */ | ||
497 | spin_lock_irqsave(&s->lock, flags); | ||
498 | |||
499 | snd_dma_program(s->chip->dma1, dma.addr, len, DMA_MODE_WRITE); | 481 | snd_dma_program(s->chip->dma1, dma.addr, len, DMA_MODE_WRITE); |
500 | sscape_start_dma_unsafe(s->io_base, GA_DMAA_REG); | 482 | sscape_start_dma_unsafe(s->io_base, GA_DMAA_REG); |
501 | if (!sscape_wait_dma_unsafe(s->io_base, GA_DMAA_REG, 5000)) { | 483 | if (!sscape_wait_dma_unsafe(s->io_base, GA_DMAA_REG, 5000)) { |
502 | /* | 484 | /* |
503 | * Don't forget to release this spinlock we're holding ... | 485 | * Don't forget to release this spinlock we're holding |
504 | */ | 486 | */ |
505 | spin_unlock_irqrestore(&s->lock, flags); | 487 | spin_unlock_irqrestore(&s->lock, flags); |
506 | 488 | ||
507 | snd_printk(KERN_ERR "sscape: DMA upload has timed out\n"); | 489 | snd_printk(KERN_ERR |
490 | "sscape: DMA upload has timed out\n"); | ||
508 | ret = -EAGAIN; | 491 | ret = -EAGAIN; |
509 | goto _release_dma; | 492 | goto _release_dma; |
510 | } | 493 | } |
511 | } /* while */ | 494 | } /* while */ |
512 | 495 | ||
513 | set_host_mode_unsafe(s->io_base); | 496 | set_host_mode_unsafe(s->io_base); |
497 | outb(0x0, s->io_base); | ||
514 | 498 | ||
515 | /* | 499 | /* |
516 | * Boot the board ... (I think) | 500 | * Boot the board ... (I think) |
517 | */ | 501 | */ |
518 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) | 0x40); | 502 | val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); |
503 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val | 0x40); | ||
519 | spin_unlock_irqrestore(&s->lock, flags); | 504 | spin_unlock_irqrestore(&s->lock, flags); |
520 | 505 | ||
521 | /* | 506 | /* |
@@ -525,10 +510,12 @@ static int upload_dma_data(struct soundscape *s, | |||
525 | */ | 510 | */ |
526 | ret = 0; | 511 | ret = 0; |
527 | if (!obp_startup_ack(s, 5000)) { | 512 | if (!obp_startup_ack(s, 5000)) { |
528 | snd_printk(KERN_ERR "sscape: No response from on-board processor after upload\n"); | 513 | snd_printk(KERN_ERR "sscape: No response " |
514 | "from on-board processor after upload\n"); | ||
529 | ret = -EAGAIN; | 515 | ret = -EAGAIN; |
530 | } else if (!host_startup_ack(s, 5000)) { | 516 | } else if (!host_startup_ack(s, 5000)) { |
531 | snd_printk(KERN_ERR "sscape: SoundScape failed to initialise\n"); | 517 | snd_printk(KERN_ERR |
518 | "sscape: SoundScape failed to initialise\n"); | ||
532 | ret = -EAGAIN; | 519 | ret = -EAGAIN; |
533 | } | 520 | } |
534 | 521 | ||
@@ -536,7 +523,7 @@ _release_dma: | |||
536 | /* | 523 | /* |
537 | * NOTE!!! We are NOT holding any spinlocks at this point !!! | 524 | * NOTE!!! We are NOT holding any spinlocks at this point !!! |
538 | */ | 525 | */ |
539 | sscape_write(s, GA_DMAA_REG, (s->ic_type == IC_ODIE ? 0x70 : 0x40)); | 526 | sscape_write(s, GA_DMAA_REG, (s->ic_type == IC_OPUS ? 0x40 : 0x70)); |
540 | free_dmabuf(&dma); | 527 | free_dmabuf(&dma); |
541 | 528 | ||
542 | return ret; | 529 | return ret; |
@@ -546,167 +533,76 @@ _release_dma: | |||
546 | * Upload the bootblock(?) into the SoundScape. The only | 533 | * Upload the bootblock(?) into the SoundScape. The only |
547 | * purpose of this block of code seems to be to tell | 534 | * purpose of this block of code seems to be to tell |
548 | * us which version of the microcode we should be using. | 535 | * us which version of the microcode we should be using. |
549 | * | ||
550 | * NOTE: The boot-block data resides in USER-SPACE!!! | ||
551 | * However, we have already verified its memory | ||
552 | * addresses by the time we get here. | ||
553 | */ | 536 | */ |
554 | static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_bootblock __user *bb) | 537 | static int sscape_upload_bootblock(struct snd_card *card) |
555 | { | 538 | { |
539 | struct soundscape *sscape = get_card_soundscape(card); | ||
556 | unsigned long flags; | 540 | unsigned long flags; |
541 | const struct firmware *init_fw = NULL; | ||
557 | int data = 0; | 542 | int data = 0; |
558 | int ret; | 543 | int ret; |
559 | 544 | ||
560 | ret = upload_dma_data(sscape, bb->code, sizeof(bb->code)); | 545 | ret = request_firmware(&init_fw, "scope.cod", card->dev); |
561 | 546 | if (ret < 0) { | |
562 | spin_lock_irqsave(&sscape->lock, flags); | 547 | snd_printk(KERN_ERR "sscape: Error loading scope.cod"); |
563 | if (ret == 0) { | 548 | return ret; |
564 | data = host_read_ctrl_unsafe(sscape->io_base, 100); | ||
565 | } | ||
566 | set_midi_mode_unsafe(sscape->io_base); | ||
567 | spin_unlock_irqrestore(&sscape->lock, flags); | ||
568 | |||
569 | if (ret == 0) { | ||
570 | if (data < 0) { | ||
571 | snd_printk(KERN_ERR "sscape: timeout reading firmware version\n"); | ||
572 | ret = -EAGAIN; | ||
573 | } | ||
574 | else if (__copy_to_user(&bb->version, &data, sizeof(bb->version))) { | ||
575 | ret = -EFAULT; | ||
576 | } | ||
577 | } | 549 | } |
550 | ret = upload_dma_data(sscape, init_fw->data, init_fw->size); | ||
578 | 551 | ||
579 | return ret; | 552 | release_firmware(init_fw); |
580 | } | ||
581 | |||
582 | /* | ||
583 | * Upload the microcode into the SoundScape. The | ||
584 | * microcode is 64K of data, and if we try to copy | ||
585 | * it into a local variable then we will SMASH THE | ||
586 | * KERNEL'S STACK! We therefore leave it in USER | ||
587 | * SPACE, and save ourselves from copying it at all. | ||
588 | */ | ||
589 | static int sscape_upload_microcode(struct soundscape *sscape, | ||
590 | const struct sscape_microcode __user *mc) | ||
591 | { | ||
592 | unsigned long flags; | ||
593 | char __user *code; | ||
594 | int err; | ||
595 | 553 | ||
596 | /* | 554 | spin_lock_irqsave(&sscape->lock, flags); |
597 | * We are going to have to copy this data into a special | 555 | if (ret == 0) |
598 | * DMA-able buffer before we can upload it. We shall therefore | 556 | data = host_read_ctrl_unsafe(sscape->io_base, 100); |
599 | * just check that the data pointer is valid for now. | ||
600 | * | ||
601 | * NOTE: This buffer is 64K long! That's WAY too big to | ||
602 | * copy into a stack-temporary anyway. | ||
603 | */ | ||
604 | if ( get_user(code, &mc->code) || | ||
605 | !access_ok(VERIFY_READ, code, SSCAPE_MICROCODE_SIZE) ) | ||
606 | return -EFAULT; | ||
607 | 557 | ||
608 | if ((err = upload_dma_data(sscape, code, SSCAPE_MICROCODE_SIZE)) == 0) { | 558 | if (data & 0x10) |
609 | snd_printk(KERN_INFO "sscape: MIDI firmware loaded\n"); | 559 | sscape_write_unsafe(sscape->io_base, GA_SMCFGA_REG, 0x2f); |
610 | } | ||
611 | 560 | ||
612 | spin_lock_irqsave(&sscape->lock, flags); | ||
613 | set_midi_mode_unsafe(sscape->io_base); | ||
614 | spin_unlock_irqrestore(&sscape->lock, flags); | 561 | spin_unlock_irqrestore(&sscape->lock, flags); |
615 | 562 | ||
616 | initialise_mpu401(sscape->mpu); | 563 | data &= 0xf; |
564 | if (ret == 0 && data > 7) { | ||
565 | snd_printk(KERN_ERR | ||
566 | "sscape: timeout reading firmware version\n"); | ||
567 | ret = -EAGAIN; | ||
568 | } | ||
617 | 569 | ||
618 | return err; | 570 | return (ret == 0) ? data : ret; |
619 | } | 571 | } |
620 | 572 | ||
621 | /* | 573 | /* |
622 | * Hardware-specific device functions, to implement special | 574 | * Upload the microcode into the SoundScape. |
623 | * IOCTLs for the SoundScape card. This is how we upload | ||
624 | * the microcode into the card, for example, and so we | ||
625 | * must ensure that no two processes can open this device | ||
626 | * simultaneously, and that we can't open it at all if | ||
627 | * someone is using the MIDI device. | ||
628 | */ | 575 | */ |
629 | static int sscape_hw_open(struct snd_hwdep * hw, struct file *file) | 576 | static int sscape_upload_microcode(struct snd_card *card, int version) |
630 | { | 577 | { |
631 | register struct soundscape *sscape = get_hwdep_soundscape(hw); | 578 | struct soundscape *sscape = get_card_soundscape(card); |
632 | unsigned long flags; | 579 | const struct firmware *init_fw = NULL; |
580 | char name[14]; | ||
633 | int err; | 581 | int err; |
634 | 582 | ||
635 | spin_lock_irqsave(&sscape->fwlock, flags); | 583 | snprintf(name, sizeof(name), "sndscape.co%d", version); |
636 | 584 | ||
637 | if ((sscape->midi_usage != 0) || sscape->hw_in_use) { | 585 | err = request_firmware(&init_fw, name, card->dev); |
638 | err = -EBUSY; | 586 | if (err < 0) { |
639 | } else { | 587 | snd_printk(KERN_ERR "sscape: Error loading sndscape.co%d", |
640 | sscape->hw_in_use = 1; | 588 | version); |
641 | err = 0; | 589 | return err; |
642 | } | 590 | } |
591 | err = upload_dma_data(sscape, init_fw->data, init_fw->size); | ||
592 | if (err == 0) | ||
593 | snd_printk(KERN_INFO "sscape: MIDI firmware loaded %d KBs\n", | ||
594 | init_fw->size >> 10); | ||
643 | 595 | ||
644 | spin_unlock_irqrestore(&sscape->fwlock, flags); | 596 | release_firmware(init_fw); |
645 | return err; | ||
646 | } | ||
647 | |||
648 | static int sscape_hw_release(struct snd_hwdep * hw, struct file *file) | ||
649 | { | ||
650 | register struct soundscape *sscape = get_hwdep_soundscape(hw); | ||
651 | unsigned long flags; | ||
652 | |||
653 | spin_lock_irqsave(&sscape->fwlock, flags); | ||
654 | sscape->hw_in_use = 0; | ||
655 | spin_unlock_irqrestore(&sscape->fwlock, flags); | ||
656 | return 0; | ||
657 | } | ||
658 | |||
659 | static int sscape_hw_ioctl(struct snd_hwdep * hw, struct file *file, | ||
660 | unsigned int cmd, unsigned long arg) | ||
661 | { | ||
662 | struct soundscape *sscape = get_hwdep_soundscape(hw); | ||
663 | int err = -EBUSY; | ||
664 | |||
665 | switch (cmd) { | ||
666 | case SND_SSCAPE_LOAD_BOOTB: | ||
667 | { | ||
668 | register struct sscape_bootblock __user *bb = (struct sscape_bootblock __user *) arg; | ||
669 | |||
670 | /* | ||
671 | * We are going to have to copy this data into a special | ||
672 | * DMA-able buffer before we can upload it. We shall therefore | ||
673 | * just check that the data pointer is valid for now ... | ||
674 | */ | ||
675 | if ( !access_ok(VERIFY_READ, bb->code, sizeof(bb->code)) ) | ||
676 | return -EFAULT; | ||
677 | |||
678 | /* | ||
679 | * Now check that we can write the firmware version number too... | ||
680 | */ | ||
681 | if ( !access_ok(VERIFY_WRITE, &bb->version, sizeof(bb->version)) ) | ||
682 | return -EFAULT; | ||
683 | |||
684 | err = sscape_upload_bootblock(sscape, bb); | ||
685 | } | ||
686 | break; | ||
687 | |||
688 | case SND_SSCAPE_LOAD_MCODE: | ||
689 | { | ||
690 | register const struct sscape_microcode __user *mc = (const struct sscape_microcode __user *) arg; | ||
691 | |||
692 | err = sscape_upload_microcode(sscape, mc); | ||
693 | } | ||
694 | break; | ||
695 | |||
696 | default: | ||
697 | err = -EINVAL; | ||
698 | break; | ||
699 | } /* switch */ | ||
700 | 597 | ||
701 | return err; | 598 | return err; |
702 | } | 599 | } |
703 | 600 | ||
704 | |||
705 | /* | 601 | /* |
706 | * Mixer control for the SoundScape's MIDI device. | 602 | * Mixer control for the SoundScape's MIDI device. |
707 | */ | 603 | */ |
708 | static int sscape_midi_info(struct snd_kcontrol *ctl, | 604 | static int sscape_midi_info(struct snd_kcontrol *ctl, |
709 | struct snd_ctl_elem_info *uinfo) | 605 | struct snd_ctl_elem_info *uinfo) |
710 | { | 606 | { |
711 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 607 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
712 | uinfo->count = 1; | 608 | uinfo->count = 1; |
@@ -716,7 +612,7 @@ static int sscape_midi_info(struct snd_kcontrol *ctl, | |||
716 | } | 612 | } |
717 | 613 | ||
718 | static int sscape_midi_get(struct snd_kcontrol *kctl, | 614 | static int sscape_midi_get(struct snd_kcontrol *kctl, |
719 | struct snd_ctl_elem_value *uctl) | 615 | struct snd_ctl_elem_value *uctl) |
720 | { | 616 | { |
721 | struct snd_wss *chip = snd_kcontrol_chip(kctl); | 617 | struct snd_wss *chip = snd_kcontrol_chip(kctl); |
722 | struct snd_card *card = chip->card; | 618 | struct snd_card *card = chip->card; |
@@ -730,16 +626,18 @@ static int sscape_midi_get(struct snd_kcontrol *kctl, | |||
730 | } | 626 | } |
731 | 627 | ||
732 | static int sscape_midi_put(struct snd_kcontrol *kctl, | 628 | static int sscape_midi_put(struct snd_kcontrol *kctl, |
733 | struct snd_ctl_elem_value *uctl) | 629 | struct snd_ctl_elem_value *uctl) |
734 | { | 630 | { |
735 | struct snd_wss *chip = snd_kcontrol_chip(kctl); | 631 | struct snd_wss *chip = snd_kcontrol_chip(kctl); |
736 | struct snd_card *card = chip->card; | 632 | struct snd_card *card = chip->card; |
737 | register struct soundscape *s = get_card_soundscape(card); | 633 | struct soundscape *s = get_card_soundscape(card); |
738 | unsigned long flags; | 634 | unsigned long flags; |
739 | int change; | 635 | int change; |
636 | unsigned char new_val; | ||
740 | 637 | ||
741 | spin_lock_irqsave(&s->lock, flags); | 638 | spin_lock_irqsave(&s->lock, flags); |
742 | 639 | ||
640 | new_val = uctl->value.integer.value[0] & 127; | ||
743 | /* | 641 | /* |
744 | * We need to put the board into HOST mode before we | 642 | * We need to put the board into HOST mode before we |
745 | * can send any volume-changing HOST commands ... | 643 | * can send any volume-changing HOST commands ... |
@@ -752,15 +650,16 @@ static int sscape_midi_put(struct snd_kcontrol *kctl, | |||
752 | * and then perform another volume-related command. Perhaps the | 650 | * and then perform another volume-related command. Perhaps the |
753 | * first command is an "open" and the second command is a "close"? | 651 | * first command is an "open" and the second command is a "close"? |
754 | */ | 652 | */ |
755 | if (s->midi_vol == ((unsigned char) uctl->value.integer. value[0] & 127)) { | 653 | if (s->midi_vol == new_val) { |
756 | change = 0; | 654 | change = 0; |
757 | goto __skip_change; | 655 | goto __skip_change; |
758 | } | 656 | } |
759 | change = (host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) | 657 | change = host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) |
760 | && host_write_ctrl_unsafe(s->io_base, ((unsigned char) uctl->value.integer. value[0]) & 127, 100) | 658 | && host_write_ctrl_unsafe(s->io_base, new_val, 100) |
761 | && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100)); | 659 | && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100) |
762 | s->midi_vol = (unsigned char) uctl->value.integer.value[0] & 127; | 660 | && host_write_ctrl_unsafe(s->io_base, new_val, 100); |
763 | __skip_change: | 661 | s->midi_vol = new_val; |
662 | __skip_change: | ||
764 | 663 | ||
765 | /* | 664 | /* |
766 | * Take the board out of HOST mode and back into MIDI mode ... | 665 | * Take the board out of HOST mode and back into MIDI mode ... |
@@ -784,20 +683,25 @@ static struct snd_kcontrol_new midi_mixer_ctl = { | |||
784 | * These IRQs are encoded as bit patterns so that they can be | 683 | * These IRQs are encoded as bit patterns so that they can be |
785 | * written to the control registers. | 684 | * written to the control registers. |
786 | */ | 685 | */ |
787 | static unsigned __devinit get_irq_config(int irq) | 686 | static unsigned __devinit get_irq_config(int sscape_type, int irq) |
788 | { | 687 | { |
789 | static const int valid_irq[] = { 9, 5, 7, 10 }; | 688 | static const int valid_irq[] = { 9, 5, 7, 10 }; |
689 | static const int old_irq[] = { 9, 7, 5, 15 }; | ||
790 | unsigned cfg; | 690 | unsigned cfg; |
791 | 691 | ||
792 | for (cfg = 0; cfg < ARRAY_SIZE(valid_irq); ++cfg) { | 692 | if (sscape_type == MEDIA_FX) { |
793 | if (irq == valid_irq[cfg]) | 693 | for (cfg = 0; cfg < ARRAY_SIZE(old_irq); ++cfg) |
794 | return cfg; | 694 | if (irq == old_irq[cfg]) |
795 | } /* for */ | 695 | return cfg; |
696 | } else { | ||
697 | for (cfg = 0; cfg < ARRAY_SIZE(valid_irq); ++cfg) | ||
698 | if (irq == valid_irq[cfg]) | ||
699 | return cfg; | ||
700 | } | ||
796 | 701 | ||
797 | return INVALID_IRQ; | 702 | return INVALID_IRQ; |
798 | } | 703 | } |
799 | 704 | ||
800 | |||
801 | /* | 705 | /* |
802 | * Perform certain arcane port-checks to see whether there | 706 | * Perform certain arcane port-checks to see whether there |
803 | * is a SoundScape board lurking behind the given ports. | 707 | * is a SoundScape board lurking behind the given ports. |
@@ -842,11 +746,38 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) | |||
842 | if (s->type != SSCAPE_VIVO && (d & 0x9f) != 0x0e) | 746 | if (s->type != SSCAPE_VIVO && (d & 0x9f) != 0x0e) |
843 | goto _done; | 747 | goto _done; |
844 | 748 | ||
845 | d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; | 749 | if (s->ic_type == IC_OPUS) |
846 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); | 750 | activate_ad1845_unsafe(s->io_base); |
847 | 751 | ||
848 | if (s->type == SSCAPE_VIVO) | 752 | if (s->type == SSCAPE_VIVO) |
849 | wss_io += 4; | 753 | wss_io += 4; |
754 | |||
755 | d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); | ||
756 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); | ||
757 | |||
758 | /* wait for WSS codec */ | ||
759 | for (d = 0; d < 500; d++) { | ||
760 | if ((inb(wss_io) & 0x80) == 0) | ||
761 | break; | ||
762 | spin_unlock_irqrestore(&s->lock, flags); | ||
763 | msleep(1); | ||
764 | spin_lock_irqsave(&s->lock, flags); | ||
765 | } | ||
766 | |||
767 | if ((inb(wss_io) & 0x80) != 0) | ||
768 | goto _done; | ||
769 | |||
770 | if (inb(wss_io + 2) == 0xff) | ||
771 | goto _done; | ||
772 | |||
773 | d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; | ||
774 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d); | ||
775 | |||
776 | if ((inb(wss_io) & 0x80) != 0) | ||
777 | s->type = MEDIA_FX; | ||
778 | |||
779 | d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); | ||
780 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); | ||
850 | /* wait for WSS codec */ | 781 | /* wait for WSS codec */ |
851 | for (d = 0; d < 500; d++) { | 782 | for (d = 0; d < 500; d++) { |
852 | if ((inb(wss_io) & 0x80) == 0) | 783 | if ((inb(wss_io) & 0x80) == 0) |
@@ -855,14 +786,13 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) | |||
855 | msleep(1); | 786 | msleep(1); |
856 | spin_lock_irqsave(&s->lock, flags); | 787 | spin_lock_irqsave(&s->lock, flags); |
857 | } | 788 | } |
858 | snd_printd(KERN_INFO "init delay = %d ms\n", d); | ||
859 | 789 | ||
860 | /* | 790 | /* |
861 | * SoundScape successfully detected! | 791 | * SoundScape successfully detected! |
862 | */ | 792 | */ |
863 | retval = 1; | 793 | retval = 1; |
864 | 794 | ||
865 | _done: | 795 | _done: |
866 | spin_unlock_irqrestore(&s->lock, flags); | 796 | spin_unlock_irqrestore(&s->lock, flags); |
867 | return retval; | 797 | return retval; |
868 | } | 798 | } |
@@ -873,63 +803,35 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) | |||
873 | * to crash the machine. Also check that someone isn't using the hardware | 803 | * to crash the machine. Also check that someone isn't using the hardware |
874 | * IOCTL device. | 804 | * IOCTL device. |
875 | */ | 805 | */ |
876 | static int mpu401_open(struct snd_mpu401 * mpu) | 806 | static int mpu401_open(struct snd_mpu401 *mpu) |
877 | { | 807 | { |
878 | int err; | ||
879 | |||
880 | if (!verify_mpu401(mpu)) { | 808 | if (!verify_mpu401(mpu)) { |
881 | snd_printk(KERN_ERR "sscape: MIDI disabled, please load firmware\n"); | 809 | snd_printk(KERN_ERR "sscape: MIDI disabled, " |
882 | err = -ENODEV; | 810 | "please load firmware\n"); |
883 | } else { | 811 | return -ENODEV; |
884 | register struct soundscape *sscape = get_mpu401_soundscape(mpu); | ||
885 | unsigned long flags; | ||
886 | |||
887 | spin_lock_irqsave(&sscape->fwlock, flags); | ||
888 | |||
889 | if (sscape->hw_in_use || (sscape->midi_usage == ULONG_MAX)) { | ||
890 | err = -EBUSY; | ||
891 | } else { | ||
892 | ++(sscape->midi_usage); | ||
893 | err = 0; | ||
894 | } | ||
895 | |||
896 | spin_unlock_irqrestore(&sscape->fwlock, flags); | ||
897 | } | 812 | } |
898 | 813 | ||
899 | return err; | 814 | return 0; |
900 | } | ||
901 | |||
902 | static void mpu401_close(struct snd_mpu401 * mpu) | ||
903 | { | ||
904 | register struct soundscape *sscape = get_mpu401_soundscape(mpu); | ||
905 | unsigned long flags; | ||
906 | |||
907 | spin_lock_irqsave(&sscape->fwlock, flags); | ||
908 | --(sscape->midi_usage); | ||
909 | spin_unlock_irqrestore(&sscape->fwlock, flags); | ||
910 | } | 815 | } |
911 | 816 | ||
912 | /* | 817 | /* |
913 | * Initialse an MPU-401 subdevice for MIDI support on the SoundScape. | 818 | * Initialse an MPU-401 subdevice for MIDI support on the SoundScape. |
914 | */ | 819 | */ |
915 | static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned long port, int irq) | 820 | static int __devinit create_mpu401(struct snd_card *card, int devnum, |
821 | unsigned long port, int irq) | ||
916 | { | 822 | { |
917 | struct soundscape *sscape = get_card_soundscape(card); | 823 | struct soundscape *sscape = get_card_soundscape(card); |
918 | struct snd_rawmidi *rawmidi; | 824 | struct snd_rawmidi *rawmidi; |
919 | int err; | 825 | int err; |
920 | 826 | ||
921 | if ((err = snd_mpu401_uart_new(card, devnum, | 827 | err = snd_mpu401_uart_new(card, devnum, MPU401_HW_MPU401, port, |
922 | MPU401_HW_MPU401, | 828 | MPU401_INFO_INTEGRATED, irq, IRQF_DISABLED, |
923 | port, MPU401_INFO_INTEGRATED, | 829 | &rawmidi); |
924 | irq, IRQF_DISABLED, | 830 | if (err == 0) { |
925 | &rawmidi)) == 0) { | 831 | struct snd_mpu401 *mpu = rawmidi->private_data; |
926 | struct snd_mpu401 *mpu = (struct snd_mpu401 *) rawmidi->private_data; | ||
927 | mpu->open_input = mpu401_open; | 832 | mpu->open_input = mpu401_open; |
928 | mpu->open_output = mpu401_open; | 833 | mpu->open_output = mpu401_open; |
929 | mpu->close_input = mpu401_close; | ||
930 | mpu->close_output = mpu401_close; | ||
931 | mpu->private_data = sscape; | 834 | mpu->private_data = sscape; |
932 | sscape->mpu = mpu; | ||
933 | 835 | ||
934 | initialise_mpu401(mpu); | 836 | initialise_mpu401(mpu); |
935 | } | 837 | } |
@@ -950,32 +852,34 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
950 | register struct soundscape *sscape = get_card_soundscape(card); | 852 | register struct soundscape *sscape = get_card_soundscape(card); |
951 | struct snd_wss *chip; | 853 | struct snd_wss *chip; |
952 | int err; | 854 | int err; |
855 | int codec_type = WSS_HW_DETECT; | ||
953 | 856 | ||
954 | if (sscape->type == SSCAPE_VIVO) | 857 | switch (sscape->type) { |
955 | port += 4; | 858 | case MEDIA_FX: |
859 | case SSCAPE: | ||
860 | /* | ||
861 | * There are some freak examples of early Soundscape cards | ||
862 | * with CS4231 instead of AD1848/CS4248. Unfortunately, the | ||
863 | * CS4231 works only in CS4248 compatibility mode on | ||
864 | * these cards so force it. | ||
865 | */ | ||
866 | if (sscape->ic_type != IC_OPUS) | ||
867 | codec_type = WSS_HW_AD1848; | ||
868 | break; | ||
956 | 869 | ||
957 | if (dma1 == dma2) | 870 | case SSCAPE_VIVO: |
958 | dma2 = -1; | 871 | port += 4; |
872 | break; | ||
873 | default: | ||
874 | break; | ||
875 | } | ||
959 | 876 | ||
960 | err = snd_wss_create(card, port, -1, irq, dma1, dma2, | 877 | err = snd_wss_create(card, port, -1, irq, dma1, dma2, |
961 | WSS_HW_DETECT, WSS_HWSHARE_DMA1, &chip); | 878 | codec_type, WSS_HWSHARE_DMA1, &chip); |
962 | if (!err) { | 879 | if (!err) { |
963 | unsigned long flags; | 880 | unsigned long flags; |
964 | struct snd_pcm *pcm; | 881 | struct snd_pcm *pcm; |
965 | 882 | ||
966 | /* | ||
967 | * It turns out that the PLAYBACK_ENABLE bit is set | ||
968 | * by the lowlevel driver ... | ||
969 | * | ||
970 | #define AD1845_IFACE_CONFIG \ | ||
971 | (CS4231_AUTOCALIB | CS4231_RECORD_ENABLE | CS4231_PLAYBACK_ENABLE) | ||
972 | snd_wss_mce_up(chip); | ||
973 | spin_lock_irqsave(&chip->reg_lock, flags); | ||
974 | snd_wss_out(chip, CS4231_IFACE_CTRL, AD1845_IFACE_CONFIG); | ||
975 | spin_unlock_irqrestore(&chip->reg_lock, flags); | ||
976 | snd_wss_mce_down(chip); | ||
977 | */ | ||
978 | |||
979 | if (sscape->type != SSCAPE_VIVO) { | 883 | if (sscape->type != SSCAPE_VIVO) { |
980 | /* | 884 | /* |
981 | * The input clock frequency on the SoundScape must | 885 | * The input clock frequency on the SoundScape must |
@@ -1022,17 +926,10 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
1022 | } | 926 | } |
1023 | } | 927 | } |
1024 | 928 | ||
1025 | strcpy(card->driver, "SoundScape"); | ||
1026 | strcpy(card->shortname, pcm->name); | ||
1027 | snprintf(card->longname, sizeof(card->longname), | ||
1028 | "%s at 0x%lx, IRQ %d, DMA1 %d, DMA2 %d\n", | ||
1029 | pcm->name, chip->port, chip->irq, | ||
1030 | chip->dma1, chip->dma2); | ||
1031 | |||
1032 | sscape->chip = chip; | 929 | sscape->chip = chip; |
1033 | } | 930 | } |
1034 | 931 | ||
1035 | _error: | 932 | _error: |
1036 | return err; | 933 | return err; |
1037 | } | 934 | } |
1038 | 935 | ||
@@ -1051,21 +948,8 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1051 | struct resource *wss_res; | 948 | struct resource *wss_res; |
1052 | unsigned long flags; | 949 | unsigned long flags; |
1053 | int err; | 950 | int err; |
1054 | 951 | int val; | |
1055 | /* | 952 | const char *name; |
1056 | * Check that the user didn't pass us garbage data ... | ||
1057 | */ | ||
1058 | irq_cfg = get_irq_config(irq[dev]); | ||
1059 | if (irq_cfg == INVALID_IRQ) { | ||
1060 | snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", irq[dev]); | ||
1061 | return -ENXIO; | ||
1062 | } | ||
1063 | |||
1064 | mpu_irq_cfg = get_irq_config(mpu_irq[dev]); | ||
1065 | if (mpu_irq_cfg == INVALID_IRQ) { | ||
1066 | printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); | ||
1067 | return -ENXIO; | ||
1068 | } | ||
1069 | 953 | ||
1070 | /* | 954 | /* |
1071 | * Grab IO ports that we will need to probe so that we | 955 | * Grab IO ports that we will need to probe so that we |
@@ -1098,41 +982,51 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1098 | } | 982 | } |
1099 | 983 | ||
1100 | spin_lock_init(&sscape->lock); | 984 | spin_lock_init(&sscape->lock); |
1101 | spin_lock_init(&sscape->fwlock); | ||
1102 | sscape->io_res = io_res; | 985 | sscape->io_res = io_res; |
1103 | sscape->wss_res = wss_res; | 986 | sscape->wss_res = wss_res; |
1104 | sscape->io_base = port[dev]; | 987 | sscape->io_base = port[dev]; |
1105 | 988 | ||
1106 | if (!detect_sscape(sscape, wss_port[dev])) { | 989 | if (!detect_sscape(sscape, wss_port[dev])) { |
1107 | printk(KERN_ERR "sscape: hardware not detected at 0x%x\n", sscape->io_base); | 990 | printk(KERN_ERR "sscape: hardware not detected at 0x%x\n", |
991 | sscape->io_base); | ||
1108 | err = -ENODEV; | 992 | err = -ENODEV; |
1109 | goto _release_dma; | 993 | goto _release_dma; |
1110 | } | 994 | } |
1111 | 995 | ||
1112 | printk(KERN_INFO "sscape: hardware detected at 0x%x, using IRQ %d, DMA %d\n", | 996 | switch (sscape->type) { |
1113 | sscape->io_base, irq[dev], dma[dev]); | 997 | case MEDIA_FX: |
998 | name = "MediaFX/SoundFX"; | ||
999 | break; | ||
1000 | case SSCAPE: | ||
1001 | name = "Soundscape"; | ||
1002 | break; | ||
1003 | case SSCAPE_PNP: | ||
1004 | name = "Soundscape PnP"; | ||
1005 | break; | ||
1006 | case SSCAPE_VIVO: | ||
1007 | name = "Soundscape VIVO"; | ||
1008 | break; | ||
1009 | default: | ||
1010 | name = "unknown Soundscape"; | ||
1011 | break; | ||
1012 | } | ||
1114 | 1013 | ||
1115 | if (sscape->type != SSCAPE_VIVO) { | 1014 | printk(KERN_INFO "sscape: %s card detected at 0x%x, using IRQ %d, DMA %d\n", |
1116 | /* | 1015 | name, sscape->io_base, irq[dev], dma[dev]); |
1117 | * Now create the hardware-specific device so that we can | 1016 | |
1118 | * load the microcode into the on-board processor. | 1017 | /* |
1119 | * We cannot use the MPU-401 MIDI system until this firmware | 1018 | * Check that the user didn't pass us garbage data ... |
1120 | * has been loaded into the card. | 1019 | */ |
1121 | */ | 1020 | irq_cfg = get_irq_config(sscape->type, irq[dev]); |
1122 | err = snd_hwdep_new(card, "MC68EC000", 0, &(sscape->hw)); | 1021 | if (irq_cfg == INVALID_IRQ) { |
1123 | if (err < 0) { | 1022 | snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", irq[dev]); |
1124 | printk(KERN_ERR "sscape: Failed to create " | 1023 | return -ENXIO; |
1125 | "firmware device\n"); | 1024 | } |
1126 | goto _release_dma; | 1025 | |
1127 | } | 1026 | mpu_irq_cfg = get_irq_config(sscape->type, mpu_irq[dev]); |
1128 | strlcpy(sscape->hw->name, "SoundScape M68K", | 1027 | if (mpu_irq_cfg == INVALID_IRQ) { |
1129 | sizeof(sscape->hw->name)); | 1028 | snd_printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); |
1130 | sscape->hw->name[sizeof(sscape->hw->name) - 1] = '\0'; | 1029 | return -ENXIO; |
1131 | sscape->hw->iface = SNDRV_HWDEP_IFACE_SSCAPE; | ||
1132 | sscape->hw->ops.open = sscape_hw_open; | ||
1133 | sscape->hw->ops.release = sscape_hw_release; | ||
1134 | sscape->hw->ops.ioctl = sscape_hw_ioctl; | ||
1135 | sscape->hw->private_data = sscape; | ||
1136 | } | 1030 | } |
1137 | 1031 | ||
1138 | /* | 1032 | /* |
@@ -1141,9 +1035,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1141 | */ | 1035 | */ |
1142 | spin_lock_irqsave(&sscape->lock, flags); | 1036 | spin_lock_irqsave(&sscape->lock, flags); |
1143 | 1037 | ||
1144 | activate_ad1845_unsafe(sscape->io_base); | ||
1145 | |||
1146 | sscape_write_unsafe(sscape->io_base, GA_INTENA_REG, 0x00); /* disable */ | ||
1147 | sscape_write_unsafe(sscape->io_base, GA_SMCFGA_REG, 0x2e); | 1038 | sscape_write_unsafe(sscape->io_base, GA_SMCFGA_REG, 0x2e); |
1148 | sscape_write_unsafe(sscape->io_base, GA_SMCFGB_REG, 0x00); | 1039 | sscape_write_unsafe(sscape->io_base, GA_SMCFGB_REG, 0x00); |
1149 | 1040 | ||
@@ -1151,15 +1042,23 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1151 | * Enable and configure the DMA channels ... | 1042 | * Enable and configure the DMA channels ... |
1152 | */ | 1043 | */ |
1153 | sscape_write_unsafe(sscape->io_base, GA_DMACFG_REG, 0x50); | 1044 | sscape_write_unsafe(sscape->io_base, GA_DMACFG_REG, 0x50); |
1154 | dma_cfg = (sscape->ic_type == IC_ODIE ? 0x70 : 0x40); | 1045 | dma_cfg = (sscape->ic_type == IC_OPUS ? 0x40 : 0x70); |
1155 | sscape_write_unsafe(sscape->io_base, GA_DMAA_REG, dma_cfg); | 1046 | sscape_write_unsafe(sscape->io_base, GA_DMAA_REG, dma_cfg); |
1156 | sscape_write_unsafe(sscape->io_base, GA_DMAB_REG, 0x20); | 1047 | sscape_write_unsafe(sscape->io_base, GA_DMAB_REG, 0x20); |
1157 | 1048 | ||
1158 | sscape_write_unsafe(sscape->io_base, | 1049 | mpu_irq_cfg |= mpu_irq_cfg << 2; |
1159 | GA_INTCFG_REG, 0xf0 | (mpu_irq_cfg << 2) | mpu_irq_cfg); | 1050 | val = sscape_read_unsafe(sscape->io_base, GA_HMCTL_REG) & 0xF7; |
1051 | if (joystick[dev]) | ||
1052 | val |= 8; | ||
1053 | sscape_write_unsafe(sscape->io_base, GA_HMCTL_REG, val | 0x10); | ||
1054 | sscape_write_unsafe(sscape->io_base, GA_INTCFG_REG, 0xf0 | mpu_irq_cfg); | ||
1160 | sscape_write_unsafe(sscape->io_base, | 1055 | sscape_write_unsafe(sscape->io_base, |
1161 | GA_CDCFG_REG, 0x09 | DMA_8BIT | 1056 | GA_CDCFG_REG, 0x09 | DMA_8BIT |
1162 | | (dma[dev] << 4) | (irq_cfg << 1)); | 1057 | | (dma[dev] << 4) | (irq_cfg << 1)); |
1058 | /* | ||
1059 | * Enable the master IRQ ... | ||
1060 | */ | ||
1061 | sscape_write_unsafe(sscape->io_base, GA_INTENA_REG, 0x80); | ||
1163 | 1062 | ||
1164 | spin_unlock_irqrestore(&sscape->lock, flags); | 1063 | spin_unlock_irqrestore(&sscape->lock, flags); |
1165 | 1064 | ||
@@ -1170,32 +1069,56 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1170 | err = create_ad1845(card, wss_port[dev], irq[dev], | 1069 | err = create_ad1845(card, wss_port[dev], irq[dev], |
1171 | dma[dev], dma2[dev]); | 1070 | dma[dev], dma2[dev]); |
1172 | if (err < 0) { | 1071 | if (err < 0) { |
1173 | printk(KERN_ERR "sscape: No AD1845 device at 0x%lx, IRQ %d\n", | 1072 | snd_printk(KERN_ERR |
1174 | wss_port[dev], irq[dev]); | 1073 | "sscape: No AD1845 device at 0x%lx, IRQ %d\n", |
1074 | wss_port[dev], irq[dev]); | ||
1175 | goto _release_dma; | 1075 | goto _release_dma; |
1176 | } | 1076 | } |
1077 | strcpy(card->driver, "SoundScape"); | ||
1078 | strcpy(card->shortname, name); | ||
1079 | snprintf(card->longname, sizeof(card->longname), | ||
1080 | "%s at 0x%lx, IRQ %d, DMA1 %d, DMA2 %d\n", | ||
1081 | name, sscape->chip->port, sscape->chip->irq, | ||
1082 | sscape->chip->dma1, sscape->chip->dma2); | ||
1083 | |||
1177 | #define MIDI_DEVNUM 0 | 1084 | #define MIDI_DEVNUM 0 |
1178 | if (sscape->type != SSCAPE_VIVO) { | 1085 | if (sscape->type != SSCAPE_VIVO) { |
1179 | err = create_mpu401(card, MIDI_DEVNUM, port[dev], mpu_irq[dev]); | 1086 | err = sscape_upload_bootblock(card); |
1180 | if (err < 0) { | 1087 | if (err >= 0) |
1181 | printk(KERN_ERR "sscape: Failed to create " | 1088 | err = sscape_upload_microcode(card, err); |
1182 | "MPU-401 device at 0x%lx\n", | ||
1183 | port[dev]); | ||
1184 | goto _release_dma; | ||
1185 | } | ||
1186 | 1089 | ||
1187 | /* | 1090 | if (err == 0) { |
1188 | * Enable the master IRQ ... | 1091 | err = create_mpu401(card, MIDI_DEVNUM, port[dev], |
1189 | */ | 1092 | mpu_irq[dev]); |
1190 | sscape_write(sscape, GA_INTENA_REG, 0x80); | 1093 | if (err < 0) { |
1094 | snd_printk(KERN_ERR "sscape: Failed to create " | ||
1095 | "MPU-401 device at 0x%lx\n", | ||
1096 | port[dev]); | ||
1097 | goto _release_dma; | ||
1098 | } | ||
1191 | 1099 | ||
1192 | /* | 1100 | /* |
1193 | * Initialize mixer | 1101 | * Initialize mixer |
1194 | */ | 1102 | */ |
1195 | sscape->midi_vol = 0; | 1103 | spin_lock_irqsave(&sscape->lock, flags); |
1196 | host_write_ctrl_unsafe(sscape->io_base, CMD_SET_MIDI_VOL, 100); | 1104 | sscape->midi_vol = 0; |
1197 | host_write_ctrl_unsafe(sscape->io_base, 0, 100); | 1105 | host_write_ctrl_unsafe(sscape->io_base, |
1198 | host_write_ctrl_unsafe(sscape->io_base, CMD_XXX_MIDI_VOL, 100); | 1106 | CMD_SET_MIDI_VOL, 100); |
1107 | host_write_ctrl_unsafe(sscape->io_base, | ||
1108 | sscape->midi_vol, 100); | ||
1109 | host_write_ctrl_unsafe(sscape->io_base, | ||
1110 | CMD_XXX_MIDI_VOL, 100); | ||
1111 | host_write_ctrl_unsafe(sscape->io_base, | ||
1112 | sscape->midi_vol, 100); | ||
1113 | host_write_ctrl_unsafe(sscape->io_base, | ||
1114 | CMD_SET_EXTMIDI, 100); | ||
1115 | host_write_ctrl_unsafe(sscape->io_base, | ||
1116 | 0, 100); | ||
1117 | host_write_ctrl_unsafe(sscape->io_base, CMD_ACK, 100); | ||
1118 | |||
1119 | set_midi_mode_unsafe(sscape->io_base); | ||
1120 | spin_unlock_irqrestore(&sscape->lock, flags); | ||
1121 | } | ||
1199 | } | 1122 | } |
1200 | 1123 | ||
1201 | /* | 1124 | /* |
@@ -1231,7 +1154,8 @@ static int __devinit snd_sscape_match(struct device *pdev, unsigned int i) | |||
1231 | mpu_irq[i] == SNDRV_AUTO_IRQ || | 1154 | mpu_irq[i] == SNDRV_AUTO_IRQ || |
1232 | dma[i] == SNDRV_AUTO_DMA) { | 1155 | dma[i] == SNDRV_AUTO_DMA) { |
1233 | printk(KERN_INFO | 1156 | printk(KERN_INFO |
1234 | "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); | 1157 | "sscape: insufficient parameters, " |
1158 | "need IO, IRQ, MPU-IRQ and DMA\n"); | ||
1235 | return 0; | 1159 | return 0; |
1236 | } | 1160 | } |
1237 | 1161 | ||
@@ -1253,13 +1177,15 @@ static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) | |||
1253 | sscape->type = SSCAPE; | 1177 | sscape->type = SSCAPE; |
1254 | 1178 | ||
1255 | dma[dev] &= 0x03; | 1179 | dma[dev] &= 0x03; |
1180 | snd_card_set_dev(card, pdev); | ||
1181 | |||
1256 | ret = create_sscape(dev, card); | 1182 | ret = create_sscape(dev, card); |
1257 | if (ret < 0) | 1183 | if (ret < 0) |
1258 | goto _release_card; | 1184 | goto _release_card; |
1259 | 1185 | ||
1260 | snd_card_set_dev(card, pdev); | 1186 | ret = snd_card_register(card); |
1261 | if ((ret = snd_card_register(card)) < 0) { | 1187 | if (ret < 0) { |
1262 | printk(KERN_ERR "sscape: Failed to register sound card\n"); | 1188 | snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); |
1263 | goto _release_card; | 1189 | goto _release_card; |
1264 | } | 1190 | } |
1265 | dev_set_drvdata(pdev, card); | 1191 | dev_set_drvdata(pdev, card); |
@@ -1311,36 +1237,20 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, | |||
1311 | * Allow this function to fail *quietly* if all the ISA PnP | 1237 | * Allow this function to fail *quietly* if all the ISA PnP |
1312 | * devices were configured using module parameters instead. | 1238 | * devices were configured using module parameters instead. |
1313 | */ | 1239 | */ |
1314 | if ((idx = get_next_autoindex(idx)) >= SNDRV_CARDS) | 1240 | idx = get_next_autoindex(idx); |
1241 | if (idx >= SNDRV_CARDS) | ||
1315 | return -ENOSPC; | 1242 | return -ENOSPC; |
1316 | 1243 | ||
1317 | /* | 1244 | /* |
1318 | * We have found a candidate ISA PnP card. Now we | ||
1319 | * have to check that it has the devices that we | ||
1320 | * expect it to have. | ||
1321 | * | ||
1322 | * We will NOT try and autoconfigure all of the resources | ||
1323 | * needed and then activate the card as we are assuming that | ||
1324 | * has already been done at boot-time using /proc/isapnp. | ||
1325 | * We shall simply try to give each active card the resources | ||
1326 | * that it wants. This is a sensible strategy for a modular | ||
1327 | * system where unused modules are unloaded regularly. | ||
1328 | * | ||
1329 | * This strategy is utterly useless if we compile the driver | ||
1330 | * into the kernel, of course. | ||
1331 | */ | ||
1332 | // printk(KERN_INFO "sscape: %s\n", card->name); | ||
1333 | |||
1334 | /* | ||
1335 | * Check that we still have room for another sound card ... | 1245 | * Check that we still have room for another sound card ... |
1336 | */ | 1246 | */ |
1337 | dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); | 1247 | dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); |
1338 | if (! dev) | 1248 | if (!dev) |
1339 | return -ENODEV; | 1249 | return -ENODEV; |
1340 | 1250 | ||
1341 | if (!pnp_is_active(dev)) { | 1251 | if (!pnp_is_active(dev)) { |
1342 | if (pnp_activate_dev(dev) < 0) { | 1252 | if (pnp_activate_dev(dev) < 0) { |
1343 | printk(KERN_INFO "sscape: device is inactive\n"); | 1253 | snd_printk(KERN_INFO "sscape: device is inactive\n"); |
1344 | return -EBUSY; | 1254 | return -EBUSY; |
1345 | } | 1255 | } |
1346 | } | 1256 | } |
@@ -1378,14 +1288,15 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, | |||
1378 | wss_port[idx] = pnp_port_start(dev, 1); | 1288 | wss_port[idx] = pnp_port_start(dev, 1); |
1379 | dma2[idx] = pnp_dma(dev, 1); | 1289 | dma2[idx] = pnp_dma(dev, 1); |
1380 | } | 1290 | } |
1291 | snd_card_set_dev(card, &pcard->card->dev); | ||
1381 | 1292 | ||
1382 | ret = create_sscape(idx, card); | 1293 | ret = create_sscape(idx, card); |
1383 | if (ret < 0) | 1294 | if (ret < 0) |
1384 | goto _release_card; | 1295 | goto _release_card; |
1385 | 1296 | ||
1386 | snd_card_set_dev(card, &pcard->card->dev); | 1297 | ret = snd_card_register(card); |
1387 | if ((ret = snd_card_register(card)) < 0) { | 1298 | if (ret < 0) { |
1388 | printk(KERN_ERR "sscape: Failed to register sound card\n"); | 1299 | snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); |
1389 | goto _release_card; | 1300 | goto _release_card; |
1390 | } | 1301 | } |
1391 | 1302 | ||
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 5d2ba1b749ab..2ba18978b419 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c | |||
@@ -2198,84 +2198,61 @@ EXPORT_SYMBOL(snd_wss_put_double); | |||
2198 | static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); | 2198 | static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); |
2199 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); | 2199 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); |
2200 | static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); | 2200 | static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); |
2201 | static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); | ||
2201 | 2202 | ||
2202 | static struct snd_kcontrol_new snd_ad1848_controls[] = { | 2203 | static struct snd_kcontrol_new snd_wss_controls[] = { |
2203 | WSS_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, | 2204 | WSS_DOUBLE("PCM Playback Switch", 0, |
2204 | 7, 7, 1, 1), | 2205 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
2205 | WSS_DOUBLE_TLV("PCM Playback Volume", 0, | 2206 | WSS_DOUBLE_TLV("PCM Playback Volume", 0, |
2206 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, | 2207 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, |
2207 | db_scale_6bit), | 2208 | db_scale_6bit), |
2208 | WSS_DOUBLE("Aux Playback Switch", 0, | 2209 | WSS_DOUBLE("Aux Playback Switch", 0, |
2209 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 2210 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
2210 | WSS_DOUBLE_TLV("Aux Playback Volume", 0, | 2211 | WSS_DOUBLE_TLV("Aux Playback Volume", 0, |
2211 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, | 2212 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, |
2212 | db_scale_5bit_12db_max), | 2213 | db_scale_5bit_12db_max), |
2213 | WSS_DOUBLE("Aux Playback Switch", 1, | 2214 | WSS_DOUBLE("Aux Playback Switch", 1, |
2214 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 2215 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
2215 | WSS_DOUBLE_TLV("Aux Playback Volume", 1, | 2216 | WSS_DOUBLE_TLV("Aux Playback Volume", 1, |
2216 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, | 2217 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, |
2217 | db_scale_5bit_12db_max), | 2218 | db_scale_5bit_12db_max), |
2218 | WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, | 2219 | WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, |
2219 | 0, 0, 15, 0, db_scale_rec_gain), | 2220 | 0, 0, 15, 0, db_scale_rec_gain), |
2220 | { | 2221 | { |
2221 | .name = "Capture Source", | ||
2222 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2222 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2223 | .name = "Capture Source", | ||
2223 | .info = snd_wss_info_mux, | 2224 | .info = snd_wss_info_mux, |
2224 | .get = snd_wss_get_mux, | 2225 | .get = snd_wss_get_mux, |
2225 | .put = snd_wss_put_mux, | 2226 | .put = snd_wss_put_mux, |
2226 | }, | 2227 | }, |
2227 | WSS_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | 2228 | WSS_DOUBLE("Mic Boost", 0, |
2228 | WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 1, 63, 0, | 2229 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), |
2229 | db_scale_6bit), | 2230 | WSS_SINGLE("Loopback Capture Switch", 0, |
2230 | }; | 2231 | CS4231_LOOPBACK, 0, 1, 0), |
2231 | 2232 | WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1, | |
2232 | static struct snd_kcontrol_new snd_wss_controls[] = { | 2233 | db_scale_6bit), |
2233 | WSS_DOUBLE("PCM Playback Switch", 0, | ||
2234 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | ||
2235 | WSS_DOUBLE("PCM Playback Volume", 0, | ||
2236 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | ||
2237 | WSS_DOUBLE("Line Playback Switch", 0, | 2234 | WSS_DOUBLE("Line Playback Switch", 0, |
2238 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 2235 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
2239 | WSS_DOUBLE("Line Playback Volume", 0, | 2236 | WSS_DOUBLE_TLV("Line Playback Volume", 0, |
2240 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | 2237 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, |
2241 | WSS_DOUBLE("Aux Playback Switch", 0, | 2238 | db_scale_5bit_12db_max), |
2242 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | ||
2243 | WSS_DOUBLE("Aux Playback Volume", 0, | ||
2244 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | ||
2245 | WSS_DOUBLE("Aux Playback Switch", 1, | ||
2246 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | ||
2247 | WSS_DOUBLE("Aux Playback Volume", 1, | ||
2248 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | ||
2249 | WSS_SINGLE("Mono Playback Switch", 0, | 2239 | WSS_SINGLE("Mono Playback Switch", 0, |
2250 | CS4231_MONO_CTRL, 7, 1, 1), | 2240 | CS4231_MONO_CTRL, 7, 1, 1), |
2251 | WSS_SINGLE("Mono Playback Volume", 0, | 2241 | WSS_SINGLE_TLV("Mono Playback Volume", 0, |
2252 | CS4231_MONO_CTRL, 0, 15, 1), | 2242 | CS4231_MONO_CTRL, 0, 15, 1, |
2243 | db_scale_4bit), | ||
2253 | WSS_SINGLE("Mono Output Playback Switch", 0, | 2244 | WSS_SINGLE("Mono Output Playback Switch", 0, |
2254 | CS4231_MONO_CTRL, 6, 1, 1), | 2245 | CS4231_MONO_CTRL, 6, 1, 1), |
2255 | WSS_SINGLE("Mono Output Playback Bypass", 0, | 2246 | WSS_SINGLE("Mono Output Playback Bypass", 0, |
2256 | CS4231_MONO_CTRL, 5, 1, 0), | 2247 | CS4231_MONO_CTRL, 5, 1, 0), |
2257 | WSS_DOUBLE("Capture Volume", 0, | ||
2258 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | ||
2259 | { | ||
2260 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2261 | .name = "Capture Source", | ||
2262 | .info = snd_wss_info_mux, | ||
2263 | .get = snd_wss_get_mux, | ||
2264 | .put = snd_wss_put_mux, | ||
2265 | }, | ||
2266 | WSS_DOUBLE("Mic Boost", 0, | ||
2267 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | ||
2268 | WSS_SINGLE("Loopback Capture Switch", 0, | ||
2269 | CS4231_LOOPBACK, 0, 1, 0), | ||
2270 | WSS_SINGLE("Loopback Capture Volume", 0, | ||
2271 | CS4231_LOOPBACK, 2, 63, 1) | ||
2272 | }; | 2248 | }; |
2273 | 2249 | ||
2274 | static struct snd_kcontrol_new snd_opti93x_controls[] = { | 2250 | static struct snd_kcontrol_new snd_opti93x_controls[] = { |
2275 | WSS_DOUBLE("Master Playback Switch", 0, | 2251 | WSS_DOUBLE("Master Playback Switch", 0, |
2276 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), | 2252 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), |
2277 | WSS_DOUBLE("Master Playback Volume", 0, | 2253 | WSS_DOUBLE_TLV("Master Playback Volume", 0, |
2278 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), | 2254 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1, |
2255 | db_scale_6bit), | ||
2279 | WSS_DOUBLE("PCM Playback Switch", 0, | 2256 | WSS_DOUBLE("PCM Playback Switch", 0, |
2280 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 2257 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
2281 | WSS_DOUBLE("PCM Playback Volume", 0, | 2258 | WSS_DOUBLE("PCM Playback Volume", 0, |
@@ -2334,22 +2311,21 @@ int snd_wss_mixer(struct snd_wss *chip) | |||
2334 | if (err < 0) | 2311 | if (err < 0) |
2335 | return err; | 2312 | return err; |
2336 | } | 2313 | } |
2337 | else if (chip->hardware & WSS_HW_AD1848_MASK) | 2314 | else { |
2338 | for (idx = 0; idx < ARRAY_SIZE(snd_ad1848_controls); idx++) { | 2315 | int count = ARRAY_SIZE(snd_wss_controls); |
2339 | err = snd_ctl_add(card, | 2316 | |
2340 | snd_ctl_new1(&snd_ad1848_controls[idx], | 2317 | /* Use only the first 11 entries on AD1848 */ |
2341 | chip)); | 2318 | if (chip->hardware & WSS_HW_AD1848_MASK) |
2342 | if (err < 0) | 2319 | count = 11; |
2343 | return err; | 2320 | |
2344 | } | 2321 | for (idx = 0; idx < count; idx++) { |
2345 | else | ||
2346 | for (idx = 0; idx < ARRAY_SIZE(snd_wss_controls); idx++) { | ||
2347 | err = snd_ctl_add(card, | 2322 | err = snd_ctl_add(card, |
2348 | snd_ctl_new1(&snd_wss_controls[idx], | 2323 | snd_ctl_new1(&snd_wss_controls[idx], |
2349 | chip)); | 2324 | chip)); |
2350 | if (err < 0) | 2325 | if (err < 0) |
2351 | return err; | 2326 | return err; |
2352 | } | 2327 | } |
2328 | } | ||
2353 | return 0; | 2329 | return 0; |
2354 | } | 2330 | } |
2355 | EXPORT_SYMBOL(snd_wss_mixer); | 2331 | EXPORT_SYMBOL(snd_wss_mixer); |
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index bcf2a0698d54..135a2b77cc4a 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig | |||
@@ -287,18 +287,6 @@ config SOUND_DMAP | |||
287 | 287 | ||
288 | Say Y unless you have 16MB or more RAM or a PCI sound card. | 288 | Say Y unless you have 16MB or more RAM or a PCI sound card. |
289 | 289 | ||
290 | config SOUND_SSCAPE | ||
291 | tristate "Ensoniq SoundScape support" | ||
292 | help | ||
293 | Answer Y if you have a sound card based on the Ensoniq SoundScape | ||
294 | chipset. Such cards are being manufactured at least by Ensoniq, Spea | ||
295 | and Reveal (Reveal makes also other cards). | ||
296 | |||
297 | If you compile the driver into the kernel, you have to add | ||
298 | "sscape=<io>,<irq>,<dma>,<mpuio>,<mpuirq>" to the kernel command | ||
299 | line. | ||
300 | |||
301 | |||
302 | config SOUND_VMIDI | 290 | config SOUND_VMIDI |
303 | tristate "Loopback MIDI device support" | 291 | tristate "Loopback MIDI device support" |
304 | help | 292 | help |
diff --git a/sound/oss/Makefile b/sound/oss/Makefile index e0ae4d4d6a5c..567b8a74178a 100644 --- a/sound/oss/Makefile +++ b/sound/oss/Makefile | |||
@@ -13,7 +13,6 @@ obj-$(CONFIG_SOUND_SH_DAC_AUDIO) += sh_dac_audio.o | |||
13 | obj-$(CONFIG_SOUND_AEDSP16) += aedsp16.o | 13 | obj-$(CONFIG_SOUND_AEDSP16) += aedsp16.o |
14 | obj-$(CONFIG_SOUND_PSS) += pss.o ad1848.o mpu401.o | 14 | obj-$(CONFIG_SOUND_PSS) += pss.o ad1848.o mpu401.o |
15 | obj-$(CONFIG_SOUND_TRIX) += trix.o ad1848.o sb_lib.o uart401.o | 15 | obj-$(CONFIG_SOUND_TRIX) += trix.o ad1848.o sb_lib.o uart401.o |
16 | obj-$(CONFIG_SOUND_SSCAPE) += sscape.o ad1848.o mpu401.o | ||
17 | obj-$(CONFIG_SOUND_MSS) += ad1848.o | 16 | obj-$(CONFIG_SOUND_MSS) += ad1848.o |
18 | obj-$(CONFIG_SOUND_PAS) += pas2.o sb.o sb_lib.o uart401.o | 17 | obj-$(CONFIG_SOUND_PAS) += pas2.o sb.o sb_lib.o uart401.o |
19 | obj-$(CONFIG_SOUND_SB) += sb.o sb_lib.o uart401.o | 18 | obj-$(CONFIG_SOUND_SB) += sb.o sb_lib.o uart401.o |
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index b2ed8757542a..4153752507e3 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c | |||
@@ -164,9 +164,6 @@ static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count, | |||
164 | int free; | 164 | int free; |
165 | int nbytes; | 165 | int nbytes; |
166 | 166 | ||
167 | if (count < 0) | ||
168 | return -EINVAL; | ||
169 | |||
170 | if (!count) { | 167 | if (!count) { |
171 | dac_audio_sync(); | 168 | dac_audio_sync(); |
172 | return 0; | 169 | return 0; |
diff --git a/sound/oss/sscape.c b/sound/oss/sscape.c deleted file mode 100644 index 30c36d1f35d7..000000000000 --- a/sound/oss/sscape.c +++ /dev/null | |||
@@ -1,1480 +0,0 @@ | |||
1 | /* | ||
2 | * sound/oss/sscape.c | ||
3 | * | ||
4 | * Low level driver for Ensoniq SoundScape | ||
5 | * | ||
6 | * | ||
7 | * Copyright (C) by Hannu Savolainen 1993-1997 | ||
8 | * | ||
9 | * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) | ||
10 | * Version 2 (June 1991). See the "COPYING" file distributed with this software | ||
11 | * for more info. | ||
12 | * | ||
13 | * | ||
14 | * Thomas Sailer : ioctl code reworked (vmalloc/vfree removed) | ||
15 | * Sergey Smitienko : ensoniq p'n'p support | ||
16 | * Christoph Hellwig : adapted to module_init/module_exit | ||
17 | * Bartlomiej Zolnierkiewicz : added __init to attach_sscape() | ||
18 | * Chris Rankin : Specify that this module owns the coprocessor | ||
19 | * Arnaldo C. de Melo : added missing restore_flags in sscape_pnp_upload_file | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | |||
25 | #include "sound_config.h" | ||
26 | #include "sound_firmware.h" | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | #include <linux/errno.h> | ||
30 | #include <linux/signal.h> | ||
31 | #include <linux/fcntl.h> | ||
32 | #include <linux/ctype.h> | ||
33 | #include <linux/stddef.h> | ||
34 | #include <linux/kmod.h> | ||
35 | #include <asm/dma.h> | ||
36 | #include <asm/io.h> | ||
37 | #include <linux/wait.h> | ||
38 | #include <linux/slab.h> | ||
39 | #include <linux/ioport.h> | ||
40 | #include <linux/delay.h> | ||
41 | #include <linux/proc_fs.h> | ||
42 | #include <linux/mm.h> | ||
43 | #include <linux/spinlock.h> | ||
44 | |||
45 | #include "coproc.h" | ||
46 | |||
47 | #include "ad1848.h" | ||
48 | #include "mpu401.h" | ||
49 | |||
50 | /* | ||
51 | * I/O ports | ||
52 | */ | ||
53 | #define MIDI_DATA 0 | ||
54 | #define MIDI_CTRL 1 | ||
55 | #define HOST_CTRL 2 | ||
56 | #define TX_READY 0x02 | ||
57 | #define RX_READY 0x01 | ||
58 | #define HOST_DATA 3 | ||
59 | #define ODIE_ADDR 4 | ||
60 | #define ODIE_DATA 5 | ||
61 | |||
62 | /* | ||
63 | * Indirect registers | ||
64 | */ | ||
65 | |||
66 | #define GA_INTSTAT_REG 0 | ||
67 | #define GA_INTENA_REG 1 | ||
68 | #define GA_DMAA_REG 2 | ||
69 | #define GA_DMAB_REG 3 | ||
70 | #define GA_INTCFG_REG 4 | ||
71 | #define GA_DMACFG_REG 5 | ||
72 | #define GA_CDCFG_REG 6 | ||
73 | #define GA_SMCFGA_REG 7 | ||
74 | #define GA_SMCFGB_REG 8 | ||
75 | #define GA_HMCTL_REG 9 | ||
76 | |||
77 | /* | ||
78 | * DMA channel identifiers (A and B) | ||
79 | */ | ||
80 | |||
81 | #define SSCAPE_DMA_A 0 | ||
82 | #define SSCAPE_DMA_B 1 | ||
83 | |||
84 | #define PORT(name) (devc->base+name) | ||
85 | |||
86 | /* | ||
87 | * Host commands recognized by the OBP microcode | ||
88 | */ | ||
89 | |||
90 | #define CMD_GEN_HOST_ACK 0x80 | ||
91 | #define CMD_GEN_MPU_ACK 0x81 | ||
92 | #define CMD_GET_BOARD_TYPE 0x82 | ||
93 | #define CMD_SET_CONTROL 0x88 /* Old firmware only */ | ||
94 | #define CMD_GET_CONTROL 0x89 /* Old firmware only */ | ||
95 | #define CTL_MASTER_VOL 0 | ||
96 | #define CTL_MIC_MODE 2 | ||
97 | #define CTL_SYNTH_VOL 4 | ||
98 | #define CTL_WAVE_VOL 7 | ||
99 | #define CMD_SET_EXTMIDI 0x8a | ||
100 | #define CMD_GET_EXTMIDI 0x8b | ||
101 | #define CMD_SET_MT32 0x8c | ||
102 | #define CMD_GET_MT32 0x8d | ||
103 | |||
104 | #define CMD_ACK 0x80 | ||
105 | |||
106 | #define IC_ODIE 1 | ||
107 | #define IC_OPUS 2 | ||
108 | |||
109 | typedef struct sscape_info | ||
110 | { | ||
111 | int base, irq, dma; | ||
112 | |||
113 | int codec, codec_irq; /* required to setup pnp cards*/ | ||
114 | int codec_type; | ||
115 | int ic_type; | ||
116 | char* raw_buf; | ||
117 | unsigned long raw_buf_phys; | ||
118 | int buffsize; /* -------------------------- */ | ||
119 | spinlock_t lock; | ||
120 | int ok; /* Properly detected */ | ||
121 | int failed; | ||
122 | int dma_allocated; | ||
123 | int codec_audiodev; | ||
124 | int opened; | ||
125 | int *osp; | ||
126 | int my_audiodev; | ||
127 | } sscape_info; | ||
128 | |||
129 | static struct sscape_info adev_info = { | ||
130 | 0 | ||
131 | }; | ||
132 | |||
133 | static struct sscape_info *devc = &adev_info; | ||
134 | static int sscape_mididev = -1; | ||
135 | |||
136 | /* Some older cards have assigned interrupt bits differently than new ones */ | ||
137 | static char valid_interrupts_old[] = { | ||
138 | 9, 7, 5, 15 | ||
139 | }; | ||
140 | |||
141 | static char valid_interrupts_new[] = { | ||
142 | 9, 5, 7, 10 | ||
143 | }; | ||
144 | |||
145 | static char *valid_interrupts = valid_interrupts_new; | ||
146 | |||
147 | /* | ||
148 | * See the bottom of the driver. This can be set by spea =0/1. | ||
149 | */ | ||
150 | |||
151 | #ifdef REVEAL_SPEA | ||
152 | static char old_hardware = 1; | ||
153 | #else | ||
154 | static char old_hardware; | ||
155 | #endif | ||
156 | |||
157 | static void sleep(unsigned howlong) | ||
158 | { | ||
159 | current->state = TASK_INTERRUPTIBLE; | ||
160 | schedule_timeout(howlong); | ||
161 | } | ||
162 | |||
163 | static unsigned char sscape_read(struct sscape_info *devc, int reg) | ||
164 | { | ||
165 | unsigned long flags; | ||
166 | unsigned char val; | ||
167 | |||
168 | spin_lock_irqsave(&devc->lock,flags); | ||
169 | outb(reg, PORT(ODIE_ADDR)); | ||
170 | val = inb(PORT(ODIE_DATA)); | ||
171 | spin_unlock_irqrestore(&devc->lock,flags); | ||
172 | return val; | ||
173 | } | ||
174 | |||
175 | static void __sscape_write(int reg, int data) | ||
176 | { | ||
177 | outb(reg, PORT(ODIE_ADDR)); | ||
178 | outb(data, PORT(ODIE_DATA)); | ||
179 | } | ||
180 | |||
181 | static void sscape_write(struct sscape_info *devc, int reg, int data) | ||
182 | { | ||
183 | unsigned long flags; | ||
184 | |||
185 | spin_lock_irqsave(&devc->lock,flags); | ||
186 | __sscape_write(reg, data); | ||
187 | spin_unlock_irqrestore(&devc->lock,flags); | ||
188 | } | ||
189 | |||
190 | static unsigned char sscape_pnp_read_codec(sscape_info* devc, unsigned char reg) | ||
191 | { | ||
192 | unsigned char res; | ||
193 | unsigned long flags; | ||
194 | |||
195 | spin_lock_irqsave(&devc->lock,flags); | ||
196 | outb( reg, devc -> codec); | ||
197 | res = inb (devc -> codec + 1); | ||
198 | spin_unlock_irqrestore(&devc->lock,flags); | ||
199 | return res; | ||
200 | |||
201 | } | ||
202 | |||
203 | static void sscape_pnp_write_codec(sscape_info* devc, unsigned char reg, unsigned char data) | ||
204 | { | ||
205 | unsigned long flags; | ||
206 | |||
207 | spin_lock_irqsave(&devc->lock,flags); | ||
208 | outb( reg, devc -> codec); | ||
209 | outb( data, devc -> codec + 1); | ||
210 | spin_unlock_irqrestore(&devc->lock,flags); | ||
211 | } | ||
212 | |||
213 | static void host_open(struct sscape_info *devc) | ||
214 | { | ||
215 | outb((0x00), PORT(HOST_CTRL)); /* Put the board to the host mode */ | ||
216 | } | ||
217 | |||
218 | static void host_close(struct sscape_info *devc) | ||
219 | { | ||
220 | outb((0x03), PORT(HOST_CTRL)); /* Put the board to the MIDI mode */ | ||
221 | } | ||
222 | |||
223 | static int host_write(struct sscape_info *devc, unsigned char *data, int count) | ||
224 | { | ||
225 | unsigned long flags; | ||
226 | int i, timeout_val; | ||
227 | |||
228 | spin_lock_irqsave(&devc->lock,flags); | ||
229 | /* | ||
230 | * Send the command and data bytes | ||
231 | */ | ||
232 | |||
233 | for (i = 0; i < count; i++) | ||
234 | { | ||
235 | for (timeout_val = 10000; timeout_val > 0; timeout_val--) | ||
236 | if (inb(PORT(HOST_CTRL)) & TX_READY) | ||
237 | break; | ||
238 | |||
239 | if (timeout_val <= 0) | ||
240 | { | ||
241 | spin_unlock_irqrestore(&devc->lock,flags); | ||
242 | return 0; | ||
243 | } | ||
244 | outb(data[i], PORT(HOST_DATA)); | ||
245 | } | ||
246 | spin_unlock_irqrestore(&devc->lock,flags); | ||
247 | return 1; | ||
248 | } | ||
249 | |||
250 | static int host_read(struct sscape_info *devc) | ||
251 | { | ||
252 | unsigned long flags; | ||
253 | int timeout_val; | ||
254 | unsigned char data; | ||
255 | |||
256 | spin_lock_irqsave(&devc->lock,flags); | ||
257 | /* | ||
258 | * Read a byte | ||
259 | */ | ||
260 | |||
261 | for (timeout_val = 10000; timeout_val > 0; timeout_val--) | ||
262 | if (inb(PORT(HOST_CTRL)) & RX_READY) | ||
263 | break; | ||
264 | |||
265 | if (timeout_val <= 0) | ||
266 | { | ||
267 | spin_unlock_irqrestore(&devc->lock,flags); | ||
268 | return -1; | ||
269 | } | ||
270 | data = inb(PORT(HOST_DATA)); | ||
271 | spin_unlock_irqrestore(&devc->lock,flags); | ||
272 | return data; | ||
273 | } | ||
274 | |||
275 | #if 0 /* unused */ | ||
276 | static int host_command1(struct sscape_info *devc, int cmd) | ||
277 | { | ||
278 | unsigned char buf[10]; | ||
279 | buf[0] = (unsigned char) (cmd & 0xff); | ||
280 | return host_write(devc, buf, 1); | ||
281 | } | ||
282 | #endif /* unused */ | ||
283 | |||
284 | |||
285 | static int host_command2(struct sscape_info *devc, int cmd, int parm1) | ||
286 | { | ||
287 | unsigned char buf[10]; | ||
288 | |||
289 | buf[0] = (unsigned char) (cmd & 0xff); | ||
290 | buf[1] = (unsigned char) (parm1 & 0xff); | ||
291 | |||
292 | return host_write(devc, buf, 2); | ||
293 | } | ||
294 | |||
295 | static int host_command3(struct sscape_info *devc, int cmd, int parm1, int parm2) | ||
296 | { | ||
297 | unsigned char buf[10]; | ||
298 | |||
299 | buf[0] = (unsigned char) (cmd & 0xff); | ||
300 | buf[1] = (unsigned char) (parm1 & 0xff); | ||
301 | buf[2] = (unsigned char) (parm2 & 0xff); | ||
302 | return host_write(devc, buf, 3); | ||
303 | } | ||
304 | |||
305 | static void set_mt32(struct sscape_info *devc, int value) | ||
306 | { | ||
307 | host_open(devc); | ||
308 | host_command2(devc, CMD_SET_MT32, value ? 1 : 0); | ||
309 | if (host_read(devc) != CMD_ACK) | ||
310 | { | ||
311 | /* printk( "SNDSCAPE: Setting MT32 mode failed\n"); */ | ||
312 | } | ||
313 | host_close(devc); | ||
314 | } | ||
315 | |||
316 | static void set_control(struct sscape_info *devc, int ctrl, int value) | ||
317 | { | ||
318 | host_open(devc); | ||
319 | host_command3(devc, CMD_SET_CONTROL, ctrl, value); | ||
320 | if (host_read(devc) != CMD_ACK) | ||
321 | { | ||
322 | /* printk( "SNDSCAPE: Setting control (%d) failed\n", ctrl); */ | ||
323 | } | ||
324 | host_close(devc); | ||
325 | } | ||
326 | |||
327 | static void do_dma(struct sscape_info *devc, int dma_chan, unsigned long buf, int blk_size, int mode) | ||
328 | { | ||
329 | unsigned char temp; | ||
330 | |||
331 | if (dma_chan != SSCAPE_DMA_A) | ||
332 | { | ||
333 | printk(KERN_WARNING "soundscape: Tried to use DMA channel != A. Why?\n"); | ||
334 | return; | ||
335 | } | ||
336 | audio_devs[devc->codec_audiodev]->flags &= ~DMA_AUTOMODE; | ||
337 | DMAbuf_start_dma(devc->codec_audiodev, buf, blk_size, mode); | ||
338 | audio_devs[devc->codec_audiodev]->flags |= DMA_AUTOMODE; | ||
339 | |||
340 | temp = devc->dma << 4; /* Setup DMA channel select bits */ | ||
341 | if (devc->dma <= 3) | ||
342 | temp |= 0x80; /* 8 bit DMA channel */ | ||
343 | |||
344 | temp |= 1; /* Trigger DMA */ | ||
345 | sscape_write(devc, GA_DMAA_REG, temp); | ||
346 | temp &= 0xfe; /* Clear DMA trigger */ | ||
347 | sscape_write(devc, GA_DMAA_REG, temp); | ||
348 | } | ||
349 | |||
350 | static int verify_mpu(struct sscape_info *devc) | ||
351 | { | ||
352 | /* | ||
353 | * The SoundScape board could be in three modes (MPU, 8250 and host). | ||
354 | * If the card is not in the MPU mode, enabling the MPU driver will | ||
355 | * cause infinite loop (the driver believes that there is always some | ||
356 | * received data in the buffer. | ||
357 | * | ||
358 | * Detect this by looking if there are more than 10 received MIDI bytes | ||
359 | * (0x00) in the buffer. | ||
360 | */ | ||
361 | |||
362 | int i; | ||
363 | |||
364 | for (i = 0; i < 10; i++) | ||
365 | { | ||
366 | if (inb(devc->base + HOST_CTRL) & 0x80) | ||
367 | return 1; | ||
368 | |||
369 | if (inb(devc->base) != 0x00) | ||
370 | return 1; | ||
371 | } | ||
372 | printk(KERN_WARNING "SoundScape: The device is not in the MPU-401 mode\n"); | ||
373 | return 0; | ||
374 | } | ||
375 | |||
376 | static int sscape_coproc_open(void *dev_info, int sub_device) | ||
377 | { | ||
378 | if (sub_device == COPR_MIDI) | ||
379 | { | ||
380 | set_mt32(devc, 0); | ||
381 | if (!verify_mpu(devc)) | ||
382 | return -EIO; | ||
383 | } | ||
384 | return 0; | ||
385 | } | ||
386 | |||
387 | static void sscape_coproc_close(void *dev_info, int sub_device) | ||
388 | { | ||
389 | struct sscape_info *devc = dev_info; | ||
390 | unsigned long flags; | ||
391 | |||
392 | spin_lock_irqsave(&devc->lock,flags); | ||
393 | if (devc->dma_allocated) | ||
394 | { | ||
395 | __sscape_write(GA_DMAA_REG, 0x20); /* DMA channel disabled */ | ||
396 | devc->dma_allocated = 0; | ||
397 | } | ||
398 | spin_unlock_irqrestore(&devc->lock,flags); | ||
399 | return; | ||
400 | } | ||
401 | |||
402 | static void sscape_coproc_reset(void *dev_info) | ||
403 | { | ||
404 | } | ||
405 | |||
406 | static int sscape_download_boot(struct sscape_info *devc, unsigned char *block, int size, int flag) | ||
407 | { | ||
408 | unsigned long flags; | ||
409 | unsigned char temp; | ||
410 | volatile int done, timeout_val; | ||
411 | static unsigned char codec_dma_bits; | ||
412 | |||
413 | if (flag & CPF_FIRST) | ||
414 | { | ||
415 | /* | ||
416 | * First block. Have to allocate DMA and to reset the board | ||
417 | * before continuing. | ||
418 | */ | ||
419 | |||
420 | spin_lock_irqsave(&devc->lock,flags); | ||
421 | codec_dma_bits = sscape_read(devc, GA_CDCFG_REG); | ||
422 | |||
423 | if (devc->dma_allocated == 0) | ||
424 | devc->dma_allocated = 1; | ||
425 | |||
426 | spin_unlock_irqrestore(&devc->lock,flags); | ||
427 | |||
428 | sscape_write(devc, GA_HMCTL_REG, | ||
429 | (temp = sscape_read(devc, GA_HMCTL_REG)) & 0x3f); /*Reset */ | ||
430 | |||
431 | for (timeout_val = 10000; timeout_val > 0; timeout_val--) | ||
432 | sscape_read(devc, GA_HMCTL_REG); /* Delay */ | ||
433 | |||
434 | /* Take board out of reset */ | ||
435 | sscape_write(devc, GA_HMCTL_REG, | ||
436 | (temp = sscape_read(devc, GA_HMCTL_REG)) | 0x80); | ||
437 | } | ||
438 | /* | ||
439 | * Transfer one code block using DMA | ||
440 | */ | ||
441 | if (audio_devs[devc->codec_audiodev]->dmap_out->raw_buf == NULL) | ||
442 | { | ||
443 | printk(KERN_WARNING "soundscape: DMA buffer not available\n"); | ||
444 | return 0; | ||
445 | } | ||
446 | memcpy(audio_devs[devc->codec_audiodev]->dmap_out->raw_buf, block, size); | ||
447 | |||
448 | spin_lock_irqsave(&devc->lock,flags); | ||
449 | |||
450 | /******** INTERRUPTS DISABLED NOW ********/ | ||
451 | |||
452 | do_dma(devc, SSCAPE_DMA_A, | ||
453 | audio_devs[devc->codec_audiodev]->dmap_out->raw_buf_phys, | ||
454 | size, DMA_MODE_WRITE); | ||
455 | |||
456 | /* | ||
457 | * Wait until transfer completes. | ||
458 | */ | ||
459 | |||
460 | done = 0; | ||
461 | timeout_val = 30; | ||
462 | while (!done && timeout_val-- > 0) | ||
463 | { | ||
464 | int resid; | ||
465 | |||
466 | if (HZ / 50) | ||
467 | sleep(HZ / 50); | ||
468 | clear_dma_ff(devc->dma); | ||
469 | if ((resid = get_dma_residue(devc->dma)) == 0) | ||
470 | done = 1; | ||
471 | } | ||
472 | |||
473 | spin_unlock_irqrestore(&devc->lock,flags); | ||
474 | if (!done) | ||
475 | return 0; | ||
476 | |||
477 | if (flag & CPF_LAST) | ||
478 | { | ||
479 | /* | ||
480 | * Take the board out of reset | ||
481 | */ | ||
482 | outb((0x00), PORT(HOST_CTRL)); | ||
483 | outb((0x00), PORT(MIDI_CTRL)); | ||
484 | |||
485 | temp = sscape_read(devc, GA_HMCTL_REG); | ||
486 | temp |= 0x40; | ||
487 | sscape_write(devc, GA_HMCTL_REG, temp); /* Kickstart the board */ | ||
488 | |||
489 | /* | ||
490 | * Wait until the ODB wakes up | ||
491 | */ | ||
492 | spin_lock_irqsave(&devc->lock,flags); | ||
493 | done = 0; | ||
494 | timeout_val = 5 * HZ; | ||
495 | while (!done && timeout_val-- > 0) | ||
496 | { | ||
497 | unsigned char x; | ||
498 | |||
499 | sleep(1); | ||
500 | x = inb(PORT(HOST_DATA)); | ||
501 | if (x == 0xff || x == 0xfe) /* OBP startup acknowledge */ | ||
502 | { | ||
503 | DDB(printk("Soundscape: Acknowledge = %x\n", x)); | ||
504 | done = 1; | ||
505 | } | ||
506 | } | ||
507 | sscape_write(devc, GA_CDCFG_REG, codec_dma_bits); | ||
508 | |||
509 | spin_unlock_irqrestore(&devc->lock,flags); | ||
510 | if (!done) | ||
511 | { | ||
512 | printk(KERN_ERR "soundscape: The OBP didn't respond after code download\n"); | ||
513 | return 0; | ||
514 | } | ||
515 | spin_lock_irqsave(&devc->lock,flags); | ||
516 | done = 0; | ||
517 | timeout_val = 5 * HZ; | ||
518 | while (!done && timeout_val-- > 0) | ||
519 | { | ||
520 | sleep(1); | ||
521 | if (inb(PORT(HOST_DATA)) == 0xfe) /* Host startup acknowledge */ | ||
522 | done = 1; | ||
523 | } | ||
524 | spin_unlock_irqrestore(&devc->lock,flags); | ||
525 | if (!done) | ||
526 | { | ||
527 | printk(KERN_ERR "soundscape: OBP Initialization failed.\n"); | ||
528 | return 0; | ||
529 | } | ||
530 | printk(KERN_INFO "SoundScape board initialized OK\n"); | ||
531 | set_control(devc, CTL_MASTER_VOL, 100); | ||
532 | set_control(devc, CTL_SYNTH_VOL, 100); | ||
533 | |||
534 | #ifdef SSCAPE_DEBUG3 | ||
535 | /* | ||
536 | * Temporary debugging aid. Print contents of the registers after | ||
537 | * downloading the code. | ||
538 | */ | ||
539 | { | ||
540 | int i; | ||
541 | |||
542 | for (i = 0; i < 13; i++) | ||
543 | printk("I%d = %02x (new value)\n", i, sscape_read(devc, i)); | ||
544 | } | ||
545 | #endif | ||
546 | |||
547 | } | ||
548 | return 1; | ||
549 | } | ||
550 | |||
551 | static int download_boot_block(void *dev_info, copr_buffer * buf) | ||
552 | { | ||
553 | if (buf->len <= 0 || buf->len > sizeof(buf->data)) | ||
554 | return -EINVAL; | ||
555 | |||
556 | if (!sscape_download_boot(devc, buf->data, buf->len, buf->flags)) | ||
557 | { | ||
558 | printk(KERN_ERR "soundscape: Unable to load microcode block to the OBP.\n"); | ||
559 | return -EIO; | ||
560 | } | ||
561 | return 0; | ||
562 | } | ||
563 | |||
564 | static int sscape_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, int local) | ||
565 | { | ||
566 | copr_buffer *buf; | ||
567 | int err; | ||
568 | |||
569 | switch (cmd) | ||
570 | { | ||
571 | case SNDCTL_COPR_RESET: | ||
572 | sscape_coproc_reset(dev_info); | ||
573 | return 0; | ||
574 | |||
575 | case SNDCTL_COPR_LOAD: | ||
576 | buf = (copr_buffer *) vmalloc(sizeof(copr_buffer)); | ||
577 | if (buf == NULL) | ||
578 | return -ENOSPC; | ||
579 | if (copy_from_user(buf, arg, sizeof(copr_buffer))) | ||
580 | { | ||
581 | vfree(buf); | ||
582 | return -EFAULT; | ||
583 | } | ||
584 | err = download_boot_block(dev_info, buf); | ||
585 | vfree(buf); | ||
586 | return err; | ||
587 | |||
588 | default: | ||
589 | return -EINVAL; | ||
590 | } | ||
591 | } | ||
592 | |||
593 | static coproc_operations sscape_coproc_operations = | ||
594 | { | ||
595 | "SoundScape M68K", | ||
596 | THIS_MODULE, | ||
597 | sscape_coproc_open, | ||
598 | sscape_coproc_close, | ||
599 | sscape_coproc_ioctl, | ||
600 | sscape_coproc_reset, | ||
601 | &adev_info | ||
602 | }; | ||
603 | |||
604 | static struct resource *sscape_ports; | ||
605 | static int sscape_is_pnp; | ||
606 | |||
607 | static void __init attach_sscape(struct address_info *hw_config) | ||
608 | { | ||
609 | #ifndef SSCAPE_REGS | ||
610 | /* | ||
611 | * Config register values for Spea/V7 Media FX and Ensoniq S-2000. | ||
612 | * These values are card | ||
613 | * dependent. If you have another SoundScape based card, you have to | ||
614 | * find the correct values. Do the following: | ||
615 | * - Compile this driver with SSCAPE_DEBUG1 defined. | ||
616 | * - Shut down and power off your machine. | ||
617 | * - Boot with DOS so that the SSINIT.EXE program is run. | ||
618 | * - Warm boot to {Linux|SYSV|BSD} and write down the lines displayed | ||
619 | * when detecting the SoundScape. | ||
620 | * - Modify the following list to use the values printed during boot. | ||
621 | * Undefine the SSCAPE_DEBUG1 | ||
622 | */ | ||
623 | #define SSCAPE_REGS { \ | ||
624 | /* I0 */ 0x00, \ | ||
625 | /* I1 */ 0xf0, /* Note! Ignored. Set always to 0xf0 */ \ | ||
626 | /* I2 */ 0x20, /* Note! Ignored. Set always to 0x20 */ \ | ||
627 | /* I3 */ 0x20, /* Note! Ignored. Set always to 0x20 */ \ | ||
628 | /* I4 */ 0xf5, /* Ignored */ \ | ||
629 | /* I5 */ 0x10, \ | ||
630 | /* I6 */ 0x00, \ | ||
631 | /* I7 */ 0x2e, /* I7 MEM config A. Likely to vary between models */ \ | ||
632 | /* I8 */ 0x00, /* I8 MEM config B. Likely to vary between models */ \ | ||
633 | /* I9 */ 0x40 /* Ignored */ \ | ||
634 | } | ||
635 | #endif | ||
636 | |||
637 | unsigned long flags; | ||
638 | static unsigned char regs[10] = SSCAPE_REGS; | ||
639 | |||
640 | int i, irq_bits = 0xff; | ||
641 | |||
642 | if (old_hardware) | ||
643 | { | ||
644 | valid_interrupts = valid_interrupts_old; | ||
645 | conf_printf("Ensoniq SoundScape (old)", hw_config); | ||
646 | } | ||
647 | else | ||
648 | conf_printf("Ensoniq SoundScape", hw_config); | ||
649 | |||
650 | for (i = 0; i < 4; i++) | ||
651 | { | ||
652 | if (hw_config->irq == valid_interrupts[i]) | ||
653 | { | ||
654 | irq_bits = i; | ||
655 | break; | ||
656 | } | ||
657 | } | ||
658 | if (hw_config->irq > 15 || (regs[4] = irq_bits == 0xff)) | ||
659 | { | ||
660 | printk(KERN_ERR "Invalid IRQ%d\n", hw_config->irq); | ||
661 | release_region(devc->base, 2); | ||
662 | release_region(devc->base + 2, 6); | ||
663 | if (sscape_is_pnp) | ||
664 | release_region(devc->codec, 2); | ||
665 | return; | ||
666 | } | ||
667 | |||
668 | if (!sscape_is_pnp) { | ||
669 | |||
670 | spin_lock_irqsave(&devc->lock,flags); | ||
671 | /* Host interrupt enable */ | ||
672 | sscape_write(devc, 1, 0xf0); /* All interrupts enabled */ | ||
673 | /* DMA A status/trigger register */ | ||
674 | sscape_write(devc, 2, 0x20); /* DMA channel disabled */ | ||
675 | /* DMA B status/trigger register */ | ||
676 | sscape_write(devc, 3, 0x20); /* DMA channel disabled */ | ||
677 | /* Host interrupt config reg */ | ||
678 | sscape_write(devc, 4, 0xf0 | (irq_bits << 2) | irq_bits); | ||
679 | /* Don't destroy CD-ROM DMA config bits (0xc0) */ | ||
680 | sscape_write(devc, 5, (regs[5] & 0x3f) | (sscape_read(devc, 5) & 0xc0)); | ||
681 | /* CD-ROM config (WSS codec actually) */ | ||
682 | sscape_write(devc, 6, regs[6]); | ||
683 | sscape_write(devc, 7, regs[7]); | ||
684 | sscape_write(devc, 8, regs[8]); | ||
685 | /* Master control reg. Don't modify CR-ROM bits. Disable SB emul */ | ||
686 | sscape_write(devc, 9, (sscape_read(devc, 9) & 0xf0) | 0x08); | ||
687 | spin_unlock_irqrestore(&devc->lock,flags); | ||
688 | } | ||
689 | #ifdef SSCAPE_DEBUG2 | ||
690 | /* | ||
691 | * Temporary debugging aid. Print contents of the registers after | ||
692 | * changing them. | ||
693 | */ | ||
694 | { | ||
695 | int i; | ||
696 | |||
697 | for (i = 0; i < 13; i++) | ||
698 | printk("I%d = %02x (new value)\n", i, sscape_read(devc, i)); | ||
699 | } | ||
700 | #endif | ||
701 | |||
702 | if (probe_mpu401(hw_config, sscape_ports)) | ||
703 | hw_config->always_detect = 1; | ||
704 | hw_config->name = "SoundScape"; | ||
705 | |||
706 | hw_config->irq *= -1; /* Negative value signals IRQ sharing */ | ||
707 | attach_mpu401(hw_config, THIS_MODULE); | ||
708 | hw_config->irq *= -1; /* Restore it */ | ||
709 | |||
710 | if (hw_config->slots[1] != -1) /* The MPU driver installed itself */ | ||
711 | { | ||
712 | sscape_mididev = hw_config->slots[1]; | ||
713 | midi_devs[hw_config->slots[1]]->coproc = &sscape_coproc_operations; | ||
714 | } | ||
715 | sscape_write(devc, GA_INTENA_REG, 0x80); /* Master IRQ enable */ | ||
716 | devc->ok = 1; | ||
717 | devc->failed = 0; | ||
718 | } | ||
719 | |||
720 | static int detect_ga(sscape_info * devc) | ||
721 | { | ||
722 | unsigned char save; | ||
723 | |||
724 | DDB(printk("Entered Soundscape detect_ga(%x)\n", devc->base)); | ||
725 | |||
726 | /* | ||
727 | * First check that the address register of "ODIE" is | ||
728 | * there and that it has exactly 4 writable bits. | ||
729 | * First 4 bits | ||
730 | */ | ||
731 | |||
732 | if ((save = inb(PORT(ODIE_ADDR))) & 0xf0) | ||
733 | { | ||
734 | DDB(printk("soundscape: Detect error A\n")); | ||
735 | return 0; | ||
736 | } | ||
737 | outb((0x00), PORT(ODIE_ADDR)); | ||
738 | if (inb(PORT(ODIE_ADDR)) != 0x00) | ||
739 | { | ||
740 | DDB(printk("soundscape: Detect error B\n")); | ||
741 | return 0; | ||
742 | } | ||
743 | outb((0xff), PORT(ODIE_ADDR)); | ||
744 | if (inb(PORT(ODIE_ADDR)) != 0x0f) | ||
745 | { | ||
746 | DDB(printk("soundscape: Detect error C\n")); | ||
747 | return 0; | ||
748 | } | ||
749 | outb((save), PORT(ODIE_ADDR)); | ||
750 | |||
751 | /* | ||
752 | * Now verify that some indirect registers return zero on some bits. | ||
753 | * This may break the driver with some future revisions of "ODIE" but... | ||
754 | */ | ||
755 | |||
756 | if (sscape_read(devc, 0) & 0x0c) | ||
757 | { | ||
758 | DDB(printk("soundscape: Detect error D (%x)\n", sscape_read(devc, 0))); | ||
759 | return 0; | ||
760 | } | ||
761 | if (sscape_read(devc, 1) & 0x0f) | ||
762 | { | ||
763 | DDB(printk("soundscape: Detect error E\n")); | ||
764 | return 0; | ||
765 | } | ||
766 | if (sscape_read(devc, 5) & 0x0f) | ||
767 | { | ||
768 | DDB(printk("soundscape: Detect error F\n")); | ||
769 | return 0; | ||
770 | } | ||
771 | return 1; | ||
772 | } | ||
773 | |||
774 | static int sscape_read_host_ctrl(sscape_info* devc) | ||
775 | { | ||
776 | return host_read(devc); | ||
777 | } | ||
778 | |||
779 | static void sscape_write_host_ctrl2(sscape_info *devc, int a, int b) | ||
780 | { | ||
781 | host_command2(devc, a, b); | ||
782 | } | ||
783 | |||
784 | static int sscape_alloc_dma(sscape_info *devc) | ||
785 | { | ||
786 | char *start_addr, *end_addr; | ||
787 | int dma_pagesize; | ||
788 | int sz, size; | ||
789 | struct page *page; | ||
790 | |||
791 | if (devc->raw_buf != NULL) return 0; /* Already done */ | ||
792 | dma_pagesize = (devc->dma < 4) ? (64 * 1024) : (128 * 1024); | ||
793 | devc->raw_buf = NULL; | ||
794 | devc->buffsize = 8192*4; | ||
795 | if (devc->buffsize > dma_pagesize) devc->buffsize = dma_pagesize; | ||
796 | start_addr = NULL; | ||
797 | /* | ||
798 | * Now loop until we get a free buffer. Try to get smaller buffer if | ||
799 | * it fails. Don't accept smaller than 8k buffer for performance | ||
800 | * reasons. | ||
801 | */ | ||
802 | while (start_addr == NULL && devc->buffsize > PAGE_SIZE) { | ||
803 | for (sz = 0, size = PAGE_SIZE; size < devc->buffsize; sz++, size <<= 1); | ||
804 | devc->buffsize = PAGE_SIZE * (1 << sz); | ||
805 | start_addr = (char *) __get_free_pages(GFP_ATOMIC|GFP_DMA, sz); | ||
806 | if (start_addr == NULL) devc->buffsize /= 2; | ||
807 | } | ||
808 | |||
809 | if (start_addr == NULL) { | ||
810 | printk(KERN_ERR "sscape pnp init error: Couldn't allocate DMA buffer\n"); | ||
811 | return 0; | ||
812 | } else { | ||
813 | /* make some checks */ | ||
814 | end_addr = start_addr + devc->buffsize - 1; | ||
815 | /* now check if it fits into the same dma-pagesize */ | ||
816 | |||
817 | if (((long) start_addr & ~(dma_pagesize - 1)) != ((long) end_addr & ~(dma_pagesize - 1)) | ||
818 | || end_addr >= (char *) (MAX_DMA_ADDRESS)) { | ||
819 | printk(KERN_ERR "sscape pnp: Got invalid address 0x%lx for %db DMA-buffer\n", (long) start_addr, devc->buffsize); | ||
820 | return 0; | ||
821 | } | ||
822 | } | ||
823 | devc->raw_buf = start_addr; | ||
824 | devc->raw_buf_phys = virt_to_bus(start_addr); | ||
825 | |||
826 | for (page = virt_to_page(start_addr); page <= virt_to_page(end_addr); page++) | ||
827 | SetPageReserved(page); | ||
828 | return 1; | ||
829 | } | ||
830 | |||
831 | static void sscape_free_dma(sscape_info *devc) | ||
832 | { | ||
833 | int sz, size; | ||
834 | unsigned long start_addr, end_addr; | ||
835 | struct page *page; | ||
836 | |||
837 | if (devc->raw_buf == NULL) return; | ||
838 | for (sz = 0, size = PAGE_SIZE; size < devc->buffsize; sz++, size <<= 1); | ||
839 | start_addr = (unsigned long) devc->raw_buf; | ||
840 | end_addr = start_addr + devc->buffsize; | ||
841 | |||
842 | for (page = virt_to_page(start_addr); page <= virt_to_page(end_addr); page++) | ||
843 | ClearPageReserved(page); | ||
844 | |||
845 | free_pages((unsigned long) devc->raw_buf, sz); | ||
846 | devc->raw_buf = NULL; | ||
847 | } | ||
848 | |||
849 | /* Intel version !!!!!!!!! */ | ||
850 | |||
851 | static int sscape_start_dma(int chan, unsigned long physaddr, int count, int dma_mode) | ||
852 | { | ||
853 | unsigned long flags; | ||
854 | |||
855 | flags = claim_dma_lock(); | ||
856 | disable_dma(chan); | ||
857 | clear_dma_ff(chan); | ||
858 | set_dma_mode(chan, dma_mode); | ||
859 | set_dma_addr(chan, physaddr); | ||
860 | set_dma_count(chan, count); | ||
861 | enable_dma(chan); | ||
862 | release_dma_lock(flags); | ||
863 | return 0; | ||
864 | } | ||
865 | |||
866 | static void sscape_pnp_start_dma(sscape_info* devc, int arg ) | ||
867 | { | ||
868 | int reg; | ||
869 | if (arg == 0) reg = 2; | ||
870 | else reg = 3; | ||
871 | |||
872 | sscape_write(devc, reg, sscape_read( devc, reg) | 0x01); | ||
873 | sscape_write(devc, reg, sscape_read( devc, reg) & 0xFE); | ||
874 | } | ||
875 | |||
876 | static int sscape_pnp_wait_dma (sscape_info* devc, int arg ) | ||
877 | { | ||
878 | int reg; | ||
879 | unsigned long i; | ||
880 | unsigned char d; | ||
881 | |||
882 | if (arg == 0) reg = 2; | ||
883 | else reg = 3; | ||
884 | |||
885 | sleep ( 1 ); | ||
886 | i = 0; | ||
887 | do { | ||
888 | d = sscape_read(devc, reg) & 1; | ||
889 | if ( d == 1) break; | ||
890 | i++; | ||
891 | } while (i < 500000); | ||
892 | d = sscape_read(devc, reg) & 1; | ||
893 | return d; | ||
894 | } | ||
895 | |||
896 | static int sscape_pnp_alloc_dma(sscape_info* devc) | ||
897 | { | ||
898 | /* printk(KERN_INFO "sscape: requesting dma\n"); */ | ||
899 | if (request_dma(devc -> dma, "sscape")) return 0; | ||
900 | /* printk(KERN_INFO "sscape: dma channel allocated\n"); */ | ||
901 | if (!sscape_alloc_dma(devc)) { | ||
902 | free_dma(devc -> dma); | ||
903 | return 0; | ||
904 | }; | ||
905 | return 1; | ||
906 | } | ||
907 | |||
908 | static void sscape_pnp_free_dma(sscape_info* devc) | ||
909 | { | ||
910 | sscape_free_dma( devc); | ||
911 | free_dma(devc -> dma ); | ||
912 | /* printk(KERN_INFO "sscape: dma released\n"); */ | ||
913 | } | ||
914 | |||
915 | static int sscape_pnp_upload_file(sscape_info* devc, char* fn) | ||
916 | { | ||
917 | int done = 0; | ||
918 | int timeout_val; | ||
919 | char* data,*dt; | ||
920 | int len,l; | ||
921 | unsigned long flags; | ||
922 | |||
923 | sscape_write( devc, 9, sscape_read(devc, 9 ) & 0x3F ); | ||
924 | sscape_write( devc, 2, (devc -> dma << 4) | 0x80 ); | ||
925 | sscape_write( devc, 3, 0x20 ); | ||
926 | sscape_write( devc, 9, sscape_read( devc, 9 ) | 0x80 ); | ||
927 | |||
928 | len = mod_firmware_load(fn, &data); | ||
929 | if (len == 0) { | ||
930 | printk(KERN_ERR "sscape: file not found: %s\n", fn); | ||
931 | return 0; | ||
932 | } | ||
933 | dt = data; | ||
934 | spin_lock_irqsave(&devc->lock,flags); | ||
935 | while ( len > 0 ) { | ||
936 | if (len > devc -> buffsize) l = devc->buffsize; | ||
937 | else l = len; | ||
938 | len -= l; | ||
939 | memcpy(devc->raw_buf, dt, l); dt += l; | ||
940 | sscape_start_dma(devc->dma, devc->raw_buf_phys, l, 0x48); | ||
941 | sscape_pnp_start_dma ( devc, 0 ); | ||
942 | if (sscape_pnp_wait_dma ( devc, 0 ) == 0) { | ||
943 | spin_unlock_irqrestore(&devc->lock,flags); | ||
944 | return 0; | ||
945 | } | ||
946 | } | ||
947 | |||
948 | spin_unlock_irqrestore(&devc->lock,flags); | ||
949 | vfree(data); | ||
950 | |||
951 | outb(0, devc -> base + 2); | ||
952 | outb(0, devc -> base); | ||
953 | |||
954 | sscape_write ( devc, 9, sscape_read( devc, 9 ) | 0x40); | ||
955 | |||
956 | timeout_val = 5 * HZ; | ||
957 | while (!done && timeout_val-- > 0) | ||
958 | { | ||
959 | unsigned char x; | ||
960 | sleep(1); | ||
961 | x = inb( devc -> base + 3); | ||
962 | if (x == 0xff || x == 0xfe) /* OBP startup acknowledge */ | ||
963 | { | ||
964 | //printk(KERN_ERR "Soundscape: Acknowledge = %x\n", x); | ||
965 | done = 1; | ||
966 | } | ||
967 | } | ||
968 | timeout_val = 5 * HZ; | ||
969 | done = 0; | ||
970 | while (!done && timeout_val-- > 0) | ||
971 | { | ||
972 | unsigned char x; | ||
973 | sleep(1); | ||
974 | x = inb( devc -> base + 3); | ||
975 | if (x == 0xfe) /* OBP startup acknowledge */ | ||
976 | { | ||
977 | //printk(KERN_ERR "Soundscape: Acknowledge = %x\n", x); | ||
978 | done = 1; | ||
979 | } | ||
980 | } | ||
981 | |||
982 | if ( !done ) printk(KERN_ERR "soundscape: OBP Initialization failed.\n"); | ||
983 | |||
984 | sscape_write( devc, 2, devc->ic_type == IC_ODIE ? 0x70 : 0x40); | ||
985 | sscape_write( devc, 3, (devc -> dma << 4) + 0x80); | ||
986 | return 1; | ||
987 | } | ||
988 | |||
989 | static void __init sscape_pnp_init_hw(sscape_info* devc) | ||
990 | { | ||
991 | unsigned char midi_irq = 0, sb_irq = 0; | ||
992 | unsigned i; | ||
993 | static char code_file_name[23] = "/sndscape/sndscape.cox"; | ||
994 | |||
995 | int sscape_joystic_enable = 0x7f; | ||
996 | int sscape_mic_enable = 0; | ||
997 | int sscape_ext_midi = 0; | ||
998 | |||
999 | if ( !sscape_pnp_alloc_dma(devc) ) { | ||
1000 | printk(KERN_ERR "sscape: faild to allocate dma\n"); | ||
1001 | return; | ||
1002 | } | ||
1003 | |||
1004 | for (i = 0; i < 4; i++) { | ||
1005 | if ( devc -> irq == valid_interrupts[i] ) | ||
1006 | midi_irq = i; | ||
1007 | if ( devc -> codec_irq == valid_interrupts[i] ) | ||
1008 | sb_irq = i; | ||
1009 | } | ||
1010 | |||
1011 | sscape_write( devc, 5, 0x50); | ||
1012 | sscape_write( devc, 7, 0x2e); | ||
1013 | sscape_write( devc, 8, 0x00); | ||
1014 | |||
1015 | sscape_write( devc, 2, devc->ic_type == IC_ODIE ? 0x70 : 0x40); | ||
1016 | sscape_write( devc, 3, ( devc -> dma << 4) | 0x80); | ||
1017 | |||
1018 | sscape_write (devc, 4, 0xF0 | (midi_irq<<2) | midi_irq); | ||
1019 | |||
1020 | i = 0x10; //sscape_read(devc, 9) & (devc->ic_type == IC_ODIE ? 0xf0 : 0xc0); | ||
1021 | if (sscape_joystic_enable) i |= 8; | ||
1022 | |||
1023 | sscape_write (devc, 9, i); | ||
1024 | sscape_write (devc, 6, 0x80); | ||
1025 | sscape_write (devc, 1, 0x80); | ||
1026 | |||
1027 | if (devc -> codec_type == 2) { | ||
1028 | sscape_pnp_write_codec( devc, 0x0C, 0x50); | ||
1029 | sscape_pnp_write_codec( devc, 0x10, sscape_pnp_read_codec( devc, 0x10) & 0x3F); | ||
1030 | sscape_pnp_write_codec( devc, 0x11, sscape_pnp_read_codec( devc, 0x11) | 0xC0); | ||
1031 | sscape_pnp_write_codec( devc, 29, 0x20); | ||
1032 | } | ||
1033 | |||
1034 | if (sscape_pnp_upload_file(devc, "/sndscape/scope.cod") == 0 ) { | ||
1035 | printk(KERN_ERR "sscape: faild to upload file /sndscape/scope.cod\n"); | ||
1036 | sscape_pnp_free_dma(devc); | ||
1037 | return; | ||
1038 | } | ||
1039 | |||
1040 | i = sscape_read_host_ctrl( devc ); | ||
1041 | |||
1042 | if ( (i & 0x0F) > 7 ) { | ||
1043 | printk(KERN_ERR "sscape: scope.cod faild\n"); | ||
1044 | sscape_pnp_free_dma(devc); | ||
1045 | return; | ||
1046 | } | ||
1047 | if ( i & 0x10 ) sscape_write( devc, 7, 0x2F); | ||
1048 | code_file_name[21] = (char) ( i & 0x0F) + 0x30; | ||
1049 | if (sscape_pnp_upload_file( devc, code_file_name) == 0) { | ||
1050 | printk(KERN_ERR "sscape: faild to upload file %s\n", code_file_name); | ||
1051 | sscape_pnp_free_dma(devc); | ||
1052 | return; | ||
1053 | } | ||
1054 | |||
1055 | if (devc->ic_type != IC_ODIE) { | ||
1056 | sscape_pnp_write_codec( devc, 10, (sscape_pnp_read_codec(devc, 10) & 0x7f) | | ||
1057 | ( sscape_mic_enable == 0 ? 0x00 : 0x80) ); | ||
1058 | } | ||
1059 | sscape_write_host_ctrl2( devc, 0x84, 0x64 ); /* MIDI volume */ | ||
1060 | sscape_write_host_ctrl2( devc, 0x86, 0x64 ); /* MIDI volume?? */ | ||
1061 | sscape_write_host_ctrl2( devc, 0x8A, sscape_ext_midi); | ||
1062 | |||
1063 | sscape_pnp_write_codec ( devc, 6, 0x3f ); //WAV_VOL | ||
1064 | sscape_pnp_write_codec ( devc, 7, 0x3f ); //WAV_VOL | ||
1065 | sscape_pnp_write_codec ( devc, 2, 0x1F ); //WD_CDXVOLL | ||
1066 | sscape_pnp_write_codec ( devc, 3, 0x1F ); //WD_CDXVOLR | ||
1067 | |||
1068 | if (devc -> codec_type == 1) { | ||
1069 | sscape_pnp_write_codec ( devc, 4, 0x1F ); | ||
1070 | sscape_pnp_write_codec ( devc, 5, 0x1F ); | ||
1071 | sscape_write_host_ctrl2( devc, 0x88, sscape_mic_enable); | ||
1072 | } else { | ||
1073 | int t; | ||
1074 | sscape_pnp_write_codec ( devc, 0x10, 0x1F << 1); | ||
1075 | sscape_pnp_write_codec ( devc, 0x11, 0xC0 | (0x1F << 1)); | ||
1076 | |||
1077 | t = sscape_pnp_read_codec( devc, 0x00) & 0xDF; | ||
1078 | if ( (sscape_mic_enable == 0)) t |= 0; | ||
1079 | else t |= 0x20; | ||
1080 | sscape_pnp_write_codec ( devc, 0x00, t); | ||
1081 | t = sscape_pnp_read_codec( devc, 0x01) & 0xDF; | ||
1082 | if ( (sscape_mic_enable == 0) ) t |= 0; | ||
1083 | else t |= 0x20; | ||
1084 | sscape_pnp_write_codec ( devc, 0x01, t); | ||
1085 | sscape_pnp_write_codec ( devc, 0x40 | 29 , 0x20); | ||
1086 | outb(0, devc -> codec); | ||
1087 | } | ||
1088 | if (devc -> ic_type == IC_OPUS ) { | ||
1089 | int i = sscape_read( devc, 9 ); | ||
1090 | sscape_write( devc, 9, i | 3 ); | ||
1091 | sscape_write( devc, 3, 0x40); | ||
1092 | |||
1093 | if (request_region(0x228, 1, "sscape setup junk")) { | ||
1094 | outb(0, 0x228); | ||
1095 | release_region(0x228,1); | ||
1096 | } | ||
1097 | sscape_write( devc, 3, (devc -> dma << 4) | 0x80); | ||
1098 | sscape_write( devc, 9, i ); | ||
1099 | } | ||
1100 | |||
1101 | host_close ( devc ); | ||
1102 | sscape_pnp_free_dma(devc); | ||
1103 | } | ||
1104 | |||
1105 | static int __init detect_sscape_pnp(sscape_info* devc) | ||
1106 | { | ||
1107 | long i, irq_bits = 0xff; | ||
1108 | unsigned int d; | ||
1109 | |||
1110 | DDB(printk("Entered detect_sscape_pnp(%x)\n", devc->base)); | ||
1111 | |||
1112 | if (!request_region(devc->codec, 2, "sscape codec")) { | ||
1113 | printk(KERN_ERR "detect_sscape_pnp: port %x is not free\n", devc->codec); | ||
1114 | return 0; | ||
1115 | } | ||
1116 | |||
1117 | if ((inb(devc->base + 2) & 0x78) != 0) | ||
1118 | goto fail; | ||
1119 | |||
1120 | d = inb ( devc -> base + 4) & 0xF0; | ||
1121 | if (d & 0x80) | ||
1122 | goto fail; | ||
1123 | |||
1124 | if (d == 0) { | ||
1125 | devc->codec_type = 1; | ||
1126 | devc->ic_type = IC_ODIE; | ||
1127 | } else if ( (d & 0x60) != 0) { | ||
1128 | devc->codec_type = 2; | ||
1129 | devc->ic_type = IC_OPUS; | ||
1130 | } else if ( (d & 0x40) != 0) { /* WTF? */ | ||
1131 | devc->codec_type = 2; | ||
1132 | devc->ic_type = IC_ODIE; | ||
1133 | } else | ||
1134 | goto fail; | ||
1135 | |||
1136 | sscape_is_pnp = 1; | ||
1137 | |||
1138 | outb(0xFA, devc -> base+4); | ||
1139 | if ((inb( devc -> base+4) & 0x9F) != 0x0A) | ||
1140 | goto fail; | ||
1141 | outb(0xFE, devc -> base+4); | ||
1142 | if ( (inb(devc -> base+4) & 0x9F) != 0x0E) | ||
1143 | goto fail; | ||
1144 | if ( (inb(devc -> base+5) & 0x9F) != 0x0E) | ||
1145 | goto fail; | ||
1146 | |||
1147 | if (devc->codec_type == 2) { | ||
1148 | if (devc->codec != devc->base + 8) { | ||
1149 | printk("soundscape warning: incorrect codec port specified\n"); | ||
1150 | goto fail; | ||
1151 | } | ||
1152 | d = 0x10 | (sscape_read(devc, 9) & 0xCF); | ||
1153 | sscape_write(devc, 9, d); | ||
1154 | sscape_write(devc, 6, 0x80); | ||
1155 | } else { | ||
1156 | //todo: check codec is not base + 8 | ||
1157 | } | ||
1158 | |||
1159 | d = (sscape_read(devc, 9) & 0x3F) | 0xC0; | ||
1160 | sscape_write(devc, 9, d); | ||
1161 | |||
1162 | for (i = 0; i < 550000; i++) | ||
1163 | if ( !(inb(devc -> codec) & 0x80) ) break; | ||
1164 | |||
1165 | d = inb(devc -> codec); | ||
1166 | if (d & 0x80) | ||
1167 | goto fail; | ||
1168 | if ( inb(devc -> codec + 2) == 0xFF) | ||
1169 | goto fail; | ||
1170 | |||
1171 | sscape_write(devc, 9, sscape_read(devc, 9) & 0x3F ); | ||
1172 | |||
1173 | d = inb(devc -> codec) & 0x80; | ||
1174 | if ( d == 0) { | ||
1175 | printk(KERN_INFO "soundscape: hardware detected\n"); | ||
1176 | valid_interrupts = valid_interrupts_new; | ||
1177 | } else { | ||
1178 | printk(KERN_INFO "soundscape: board looks like media fx\n"); | ||
1179 | valid_interrupts = valid_interrupts_old; | ||
1180 | old_hardware = 1; | ||
1181 | } | ||
1182 | |||
1183 | sscape_write( devc, 9, 0xC0 | (sscape_read(devc, 9) & 0x3F) ); | ||
1184 | |||
1185 | for (i = 0; i < 550000; i++) | ||
1186 | if ( !(inb(devc -> codec) & 0x80)) | ||
1187 | break; | ||
1188 | |||
1189 | sscape_pnp_init_hw(devc); | ||
1190 | |||
1191 | for (i = 0; i < 4; i++) | ||
1192 | { | ||
1193 | if (devc->codec_irq == valid_interrupts[i]) { | ||
1194 | irq_bits = i; | ||
1195 | break; | ||
1196 | } | ||
1197 | } | ||
1198 | sscape_write(devc, GA_INTENA_REG, 0x00); | ||
1199 | sscape_write(devc, GA_DMACFG_REG, 0x50); | ||
1200 | sscape_write(devc, GA_DMAA_REG, 0x70); | ||
1201 | sscape_write(devc, GA_DMAB_REG, 0x20); | ||
1202 | sscape_write(devc, GA_INTCFG_REG, 0xf0); | ||
1203 | sscape_write(devc, GA_CDCFG_REG, 0x89 | (devc->dma << 4) | (irq_bits << 1)); | ||
1204 | |||
1205 | sscape_pnp_write_codec( devc, 0, sscape_pnp_read_codec( devc, 0) | 0x20); | ||
1206 | sscape_pnp_write_codec( devc, 0, sscape_pnp_read_codec( devc, 1) | 0x20); | ||
1207 | |||
1208 | return 1; | ||
1209 | fail: | ||
1210 | release_region(devc->codec, 2); | ||
1211 | return 0; | ||
1212 | } | ||
1213 | |||
1214 | static int __init probe_sscape(struct address_info *hw_config) | ||
1215 | { | ||
1216 | devc->base = hw_config->io_base; | ||
1217 | devc->irq = hw_config->irq; | ||
1218 | devc->dma = hw_config->dma; | ||
1219 | devc->osp = hw_config->osp; | ||
1220 | |||
1221 | #ifdef SSCAPE_DEBUG1 | ||
1222 | /* | ||
1223 | * Temporary debugging aid. Print contents of the registers before | ||
1224 | * changing them. | ||
1225 | */ | ||
1226 | { | ||
1227 | int i; | ||
1228 | |||
1229 | for (i = 0; i < 13; i++) | ||
1230 | printk("I%d = %02x (old value)\n", i, sscape_read(devc, i)); | ||
1231 | } | ||
1232 | #endif | ||
1233 | devc->failed = 1; | ||
1234 | |||
1235 | sscape_ports = request_region(devc->base, 2, "mpu401"); | ||
1236 | if (!sscape_ports) | ||
1237 | return 0; | ||
1238 | |||
1239 | if (!request_region(devc->base + 2, 6, "SoundScape")) { | ||
1240 | release_region(devc->base, 2); | ||
1241 | return 0; | ||
1242 | } | ||
1243 | |||
1244 | if (!detect_ga(devc)) { | ||
1245 | if (detect_sscape_pnp(devc)) | ||
1246 | return 1; | ||
1247 | release_region(devc->base, 2); | ||
1248 | release_region(devc->base + 2, 6); | ||
1249 | return 0; | ||
1250 | } | ||
1251 | |||
1252 | if (old_hardware) /* Check that it's really an old Spea/Reveal card. */ | ||
1253 | { | ||
1254 | unsigned char tmp; | ||
1255 | int cc; | ||
1256 | |||
1257 | if (!((tmp = sscape_read(devc, GA_HMCTL_REG)) & 0xc0)) | ||
1258 | { | ||
1259 | sscape_write(devc, GA_HMCTL_REG, tmp | 0x80); | ||
1260 | for (cc = 0; cc < 200000; ++cc) | ||
1261 | inb(devc->base + ODIE_ADDR); | ||
1262 | } | ||
1263 | } | ||
1264 | return 1; | ||
1265 | } | ||
1266 | |||
1267 | static int __init init_ss_ms_sound(struct address_info *hw_config) | ||
1268 | { | ||
1269 | int i, irq_bits = 0xff; | ||
1270 | int ad_flags = 0; | ||
1271 | struct resource *ports; | ||
1272 | |||
1273 | if (devc->failed) | ||
1274 | { | ||
1275 | printk(KERN_ERR "soundscape: Card not detected\n"); | ||
1276 | return 0; | ||
1277 | } | ||
1278 | if (devc->ok == 0) | ||
1279 | { | ||
1280 | printk(KERN_ERR "soundscape: Invalid initialization order.\n"); | ||
1281 | return 0; | ||
1282 | } | ||
1283 | for (i = 0; i < 4; i++) | ||
1284 | { | ||
1285 | if (hw_config->irq == valid_interrupts[i]) | ||
1286 | { | ||
1287 | irq_bits = i; | ||
1288 | break; | ||
1289 | } | ||
1290 | } | ||
1291 | if (irq_bits == 0xff) { | ||
1292 | printk(KERN_ERR "soundscape: Invalid MSS IRQ%d\n", hw_config->irq); | ||
1293 | return 0; | ||
1294 | } | ||
1295 | |||
1296 | if (old_hardware) | ||
1297 | ad_flags = 0x12345677; /* Tell that we may have a CS4248 chip (Spea-V7 Media FX) */ | ||
1298 | else if (sscape_is_pnp) | ||
1299 | ad_flags = 0x87654321; /* Tell that we have a soundscape pnp with 1845 chip */ | ||
1300 | |||
1301 | ports = request_region(hw_config->io_base, 4, "ad1848"); | ||
1302 | if (!ports) { | ||
1303 | printk(KERN_ERR "soundscape: ports busy\n"); | ||
1304 | return 0; | ||
1305 | } | ||
1306 | |||
1307 | if (!ad1848_detect(ports, &ad_flags, hw_config->osp)) { | ||
1308 | release_region(hw_config->io_base, 4); | ||
1309 | return 0; | ||
1310 | } | ||
1311 | |||
1312 | if (!sscape_is_pnp) /*pnp is already setup*/ | ||
1313 | { | ||
1314 | /* | ||
1315 | * Setup the DMA polarity. | ||
1316 | */ | ||
1317 | sscape_write(devc, GA_DMACFG_REG, 0x50); | ||
1318 | |||
1319 | /* | ||
1320 | * Take the gate-array off of the DMA channel. | ||
1321 | */ | ||
1322 | sscape_write(devc, GA_DMAB_REG, 0x20); | ||
1323 | |||
1324 | /* | ||
1325 | * Init the AD1848 (CD-ROM) config reg. | ||
1326 | */ | ||
1327 | sscape_write(devc, GA_CDCFG_REG, 0x89 | (hw_config->dma << 4) | (irq_bits << 1)); | ||
1328 | } | ||
1329 | |||
1330 | if (hw_config->irq == devc->irq) | ||
1331 | printk(KERN_WARNING "soundscape: Warning! The WSS mode can't share IRQ with MIDI\n"); | ||
1332 | |||
1333 | hw_config->slots[0] = ad1848_init( | ||
1334 | sscape_is_pnp ? "SoundScape" : "SoundScape PNP", | ||
1335 | ports, | ||
1336 | hw_config->irq, | ||
1337 | hw_config->dma, | ||
1338 | hw_config->dma, | ||
1339 | 0, | ||
1340 | devc->osp, | ||
1341 | THIS_MODULE); | ||
1342 | |||
1343 | |||
1344 | if (hw_config->slots[0] != -1) /* The AD1848 driver installed itself */ | ||
1345 | { | ||
1346 | audio_devs[hw_config->slots[0]]->coproc = &sscape_coproc_operations; | ||
1347 | devc->codec_audiodev = hw_config->slots[0]; | ||
1348 | devc->my_audiodev = hw_config->slots[0]; | ||
1349 | |||
1350 | /* Set proper routings here (what are they) */ | ||
1351 | AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE); | ||
1352 | } | ||
1353 | |||
1354 | #ifdef SSCAPE_DEBUG5 | ||
1355 | /* | ||
1356 | * Temporary debugging aid. Print contents of the registers | ||
1357 | * after the AD1848 device has been initialized. | ||
1358 | */ | ||
1359 | { | ||
1360 | int i; | ||
1361 | |||
1362 | for (i = 0; i < 13; i++) | ||
1363 | printk("I%d = %02x\n", i, sscape_read(devc, i)); | ||
1364 | } | ||
1365 | #endif | ||
1366 | return 1; | ||
1367 | } | ||
1368 | |||
1369 | static void __exit unload_sscape(struct address_info *hw_config) | ||
1370 | { | ||
1371 | release_region(devc->base + 2, 6); | ||
1372 | unload_mpu401(hw_config); | ||
1373 | if (sscape_is_pnp) | ||
1374 | release_region(devc->codec, 2); | ||
1375 | } | ||
1376 | |||
1377 | static void __exit unload_ss_ms_sound(struct address_info *hw_config) | ||
1378 | { | ||
1379 | ad1848_unload(hw_config->io_base, | ||
1380 | hw_config->irq, | ||
1381 | devc->dma, | ||
1382 | devc->dma, | ||
1383 | 0); | ||
1384 | sound_unload_audiodev(hw_config->slots[0]); | ||
1385 | } | ||
1386 | |||
1387 | static struct address_info cfg; | ||
1388 | static struct address_info cfg_mpu; | ||
1389 | |||
1390 | static int __initdata spea = -1; | ||
1391 | static int mss = 0; | ||
1392 | static int __initdata dma = -1; | ||
1393 | static int __initdata irq = -1; | ||
1394 | static int __initdata io = -1; | ||
1395 | static int __initdata mpu_irq = -1; | ||
1396 | static int __initdata mpu_io = -1; | ||
1397 | |||
1398 | module_param(dma, int, 0); | ||
1399 | module_param(irq, int, 0); | ||
1400 | module_param(io, int, 0); | ||
1401 | module_param(spea, int, 0); /* spea=0/1 set the old_hardware */ | ||
1402 | module_param(mpu_irq, int, 0); | ||
1403 | module_param(mpu_io, int, 0); | ||
1404 | module_param(mss, int, 0); | ||
1405 | |||
1406 | static int __init init_sscape(void) | ||
1407 | { | ||
1408 | printk(KERN_INFO "Soundscape driver Copyright (C) by Hannu Savolainen 1993-1996\n"); | ||
1409 | |||
1410 | cfg.irq = irq; | ||
1411 | cfg.dma = dma; | ||
1412 | cfg.io_base = io; | ||
1413 | |||
1414 | cfg_mpu.irq = mpu_irq; | ||
1415 | cfg_mpu.io_base = mpu_io; | ||
1416 | /* WEH - Try to get right dma channel */ | ||
1417 | cfg_mpu.dma = dma; | ||
1418 | |||
1419 | devc->codec = cfg.io_base; | ||
1420 | devc->codec_irq = cfg.irq; | ||
1421 | devc->codec_type = 0; | ||
1422 | devc->ic_type = 0; | ||
1423 | devc->raw_buf = NULL; | ||
1424 | spin_lock_init(&devc->lock); | ||
1425 | |||
1426 | if (cfg.dma == -1 || cfg.irq == -1 || cfg.io_base == -1) { | ||
1427 | printk(KERN_ERR "DMA, IRQ, and IO port must be specified.\n"); | ||
1428 | return -EINVAL; | ||
1429 | } | ||
1430 | |||
1431 | if (cfg_mpu.irq == -1 && cfg_mpu.io_base != -1) { | ||
1432 | printk(KERN_ERR "MPU_IRQ must be specified if MPU_IO is set.\n"); | ||
1433 | return -EINVAL; | ||
1434 | } | ||
1435 | |||
1436 | if(spea != -1) { | ||
1437 | old_hardware = spea; | ||
1438 | printk(KERN_INFO "Forcing %s hardware support.\n", | ||
1439 | spea?"new":"old"); | ||
1440 | } | ||
1441 | if (probe_sscape(&cfg_mpu) == 0) | ||
1442 | return -ENODEV; | ||
1443 | |||
1444 | attach_sscape(&cfg_mpu); | ||
1445 | |||
1446 | mss = init_ss_ms_sound(&cfg); | ||
1447 | |||
1448 | return 0; | ||
1449 | } | ||
1450 | |||
1451 | static void __exit cleanup_sscape(void) | ||
1452 | { | ||
1453 | if (mss) | ||
1454 | unload_ss_ms_sound(&cfg); | ||
1455 | unload_sscape(&cfg_mpu); | ||
1456 | } | ||
1457 | |||
1458 | module_init(init_sscape); | ||
1459 | module_exit(cleanup_sscape); | ||
1460 | |||
1461 | #ifndef MODULE | ||
1462 | static int __init setup_sscape(char *str) | ||
1463 | { | ||
1464 | /* io, irq, dma, mpu_io, mpu_irq */ | ||
1465 | int ints[6]; | ||
1466 | |||
1467 | str = get_options(str, ARRAY_SIZE(ints), ints); | ||
1468 | |||
1469 | io = ints[1]; | ||
1470 | irq = ints[2]; | ||
1471 | dma = ints[3]; | ||
1472 | mpu_io = ints[4]; | ||
1473 | mpu_irq = ints[5]; | ||
1474 | |||
1475 | return 1; | ||
1476 | } | ||
1477 | |||
1478 | __setup("sscape=", setup_sscape); | ||
1479 | #endif | ||
1480 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 78288dbfc17a..20cb60afb200 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -603,8 +603,8 @@ AC97_SINGLE("Tone Control - Treble", AC97_MASTER_TONE, 0, 15, 1) | |||
603 | }; | 603 | }; |
604 | 604 | ||
605 | static const struct snd_kcontrol_new snd_ac97_controls_pc_beep[2] = { | 605 | static const struct snd_kcontrol_new snd_ac97_controls_pc_beep[2] = { |
606 | AC97_SINGLE("PC Speaker Playback Switch", AC97_PC_BEEP, 15, 1, 1), | 606 | AC97_SINGLE("Beep Playback Switch", AC97_PC_BEEP, 15, 1, 1), |
607 | AC97_SINGLE("PC Speaker Playback Volume", AC97_PC_BEEP, 1, 15, 1) | 607 | AC97_SINGLE("Beep Playback Volume", AC97_PC_BEEP, 1, 15, 1) |
608 | }; | 608 | }; |
609 | 609 | ||
610 | static const struct snd_kcontrol_new snd_ac97_controls_mic_boost = | 610 | static const struct snd_kcontrol_new snd_ac97_controls_mic_boost = |
@@ -1393,7 +1393,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97) | |||
1393 | } | 1393 | } |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | /* build PC Speaker controls */ | 1396 | /* build Beep controls */ |
1397 | if (!(ac97->flags & AC97_HAS_NO_PC_BEEP) && | 1397 | if (!(ac97->flags & AC97_HAS_NO_PC_BEEP) && |
1398 | ((ac97->flags & AC97_HAS_PC_BEEP) || | 1398 | ((ac97->flags & AC97_HAS_PC_BEEP) || |
1399 | snd_ac97_try_volume_mix(ac97, AC97_PC_BEEP))) { | 1399 | snd_ac97_try_volume_mix(ac97, AC97_PC_BEEP))) { |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 7337abdbe4e3..139cf3b2b9d7 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -800,12 +800,12 @@ AC97_SINGLE("Mono Switch", AC97_MASTER_TONE, 7, 1, 1), | |||
800 | AC97_SINGLE("Mono ZC Switch", AC97_MASTER_TONE, 6, 1, 0), | 800 | AC97_SINGLE("Mono ZC Switch", AC97_MASTER_TONE, 6, 1, 0), |
801 | AC97_SINGLE("Mono Volume", AC97_MASTER_TONE, 0, 31, 1), | 801 | AC97_SINGLE("Mono Volume", AC97_MASTER_TONE, 0, 31, 1), |
802 | 802 | ||
803 | AC97_SINGLE("PC Beep to Headphone Switch", AC97_AUX, 15, 1, 1), | 803 | AC97_SINGLE("Beep to Headphone Switch", AC97_AUX, 15, 1, 1), |
804 | AC97_SINGLE("PC Beep to Headphone Volume", AC97_AUX, 12, 7, 1), | 804 | AC97_SINGLE("Beep to Headphone Volume", AC97_AUX, 12, 7, 1), |
805 | AC97_SINGLE("PC Beep to Master Switch", AC97_AUX, 11, 1, 1), | 805 | AC97_SINGLE("Beep to Master Switch", AC97_AUX, 11, 1, 1), |
806 | AC97_SINGLE("PC Beep to Master Volume", AC97_AUX, 8, 7, 1), | 806 | AC97_SINGLE("Beep to Master Volume", AC97_AUX, 8, 7, 1), |
807 | AC97_SINGLE("PC Beep to Mono Switch", AC97_AUX, 7, 1, 1), | 807 | AC97_SINGLE("Beep to Mono Switch", AC97_AUX, 7, 1, 1), |
808 | AC97_SINGLE("PC Beep to Mono Volume", AC97_AUX, 4, 7, 1), | 808 | AC97_SINGLE("Beep to Mono Volume", AC97_AUX, 4, 7, 1), |
809 | 809 | ||
810 | AC97_SINGLE("Voice to Headphone Switch", AC97_PCM, 15, 1, 1), | 810 | AC97_SINGLE("Voice to Headphone Switch", AC97_PCM, 15, 1, 1), |
811 | AC97_SINGLE("Voice to Headphone Volume", AC97_PCM, 12, 7, 1), | 811 | AC97_SINGLE("Voice to Headphone Volume", AC97_PCM, 12, 7, 1), |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 8451a0169f32..69867ace7860 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -830,8 +830,8 @@ static struct snd_kcontrol_new snd_azf3328_mixer_controls[] __devinitdata = { | |||
830 | AZF3328_MIXER_SWITCH("Mic Boost (+20dB)", IDX_MIXER_MIC, 6, 0), | 830 | AZF3328_MIXER_SWITCH("Mic Boost (+20dB)", IDX_MIXER_MIC, 6, 0), |
831 | AZF3328_MIXER_SWITCH("Line Playback Switch", IDX_MIXER_LINEIN, 15, 1), | 831 | AZF3328_MIXER_SWITCH("Line Playback Switch", IDX_MIXER_LINEIN, 15, 1), |
832 | AZF3328_MIXER_VOL_STEREO("Line Playback Volume", IDX_MIXER_LINEIN, 0x1f, 1), | 832 | AZF3328_MIXER_VOL_STEREO("Line Playback Volume", IDX_MIXER_LINEIN, 0x1f, 1), |
833 | AZF3328_MIXER_SWITCH("PC Speaker Playback Switch", IDX_MIXER_PCBEEP, 15, 1), | 833 | AZF3328_MIXER_SWITCH("Beep Playback Switch", IDX_MIXER_PCBEEP, 15, 1), |
834 | AZF3328_MIXER_VOL_SPECIAL("PC Speaker Playback Volume", IDX_MIXER_PCBEEP, 0x0f, 1, 1), | 834 | AZF3328_MIXER_VOL_SPECIAL("Beep Playback Volume", IDX_MIXER_PCBEEP, 0x0f, 1, 1), |
835 | AZF3328_MIXER_SWITCH("Video Playback Switch", IDX_MIXER_VIDEO, 15, 1), | 835 | AZF3328_MIXER_SWITCH("Video Playback Switch", IDX_MIXER_VIDEO, 15, 1), |
836 | AZF3328_MIXER_VOL_STEREO("Video Playback Volume", IDX_MIXER_VIDEO, 0x1f, 1), | 836 | AZF3328_MIXER_VOL_STEREO("Video Playback Volume", IDX_MIXER_VIDEO, 0x1f, 1), |
837 | AZF3328_MIXER_SWITCH("Aux Playback Switch", IDX_MIXER_AUX, 15, 1), | 837 | AZF3328_MIXER_SWITCH("Aux Playback Switch", IDX_MIXER_AUX, 15, 1), |
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index c8c6f437f5b3..8f443a9d61ec 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c | |||
@@ -792,8 +792,8 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) | |||
792 | "Phone Playback Volume", | 792 | "Phone Playback Volume", |
793 | "Video Playback Switch", | 793 | "Video Playback Switch", |
794 | "Video Playback Volume", | 794 | "Video Playback Volume", |
795 | "PC Speaker Playback Switch", | 795 | "Beep Playback Switch", |
796 | "PC Speaker Playback Volume", | 796 | "Beep Playback Volume", |
797 | "Mono Output Select", | 797 | "Mono Output Select", |
798 | "Capture Source", | 798 | "Capture Source", |
799 | "Capture Switch", | 799 | "Capture Switch", |
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index c62b7d10ec61..15523e60351c 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c | |||
@@ -304,7 +304,7 @@ static void snd_ca0106_proc_reg_write32(struct snd_info_entry *entry, | |||
304 | while (!snd_info_get_line(buffer, line, sizeof(line))) { | 304 | while (!snd_info_get_line(buffer, line, sizeof(line))) { |
305 | if (sscanf(line, "%x %x", ®, &val) != 2) | 305 | if (sscanf(line, "%x %x", ®, &val) != 2) |
306 | continue; | 306 | continue; |
307 | if ((reg < 0x40) && (reg >=0) && (val <= 0xffffffff) ) { | 307 | if (reg < 0x40 && val <= 0xffffffff) { |
308 | spin_lock_irqsave(&emu->emu_lock, flags); | 308 | spin_lock_irqsave(&emu->emu_lock, flags); |
309 | outl(val, emu->port + (reg & 0xfffffffc)); | 309 | outl(val, emu->port + (reg & 0xfffffffc)); |
310 | spin_unlock_irqrestore(&emu->emu_lock, flags); | 310 | spin_unlock_irqrestore(&emu->emu_lock, flags); |
@@ -405,7 +405,7 @@ static void snd_ca0106_proc_reg_write(struct snd_info_entry *entry, | |||
405 | while (!snd_info_get_line(buffer, line, sizeof(line))) { | 405 | while (!snd_info_get_line(buffer, line, sizeof(line))) { |
406 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) | 406 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) |
407 | continue; | 407 | continue; |
408 | if ((reg < 0x80) && (reg >=0) && (val <= 0xffffffff) && (channel_id >=0) && (channel_id <= 3) ) | 408 | if (reg < 0x80 && val <= 0xffffffff && channel_id <= 3) |
409 | snd_ca0106_ptr_write(emu, reg, channel_id, val); | 409 | snd_ca0106_ptr_write(emu, reg, channel_id, val); |
410 | } | 410 | } |
411 | } | 411 | } |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index ddcd4a9fd7e6..a312bae08f52 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -2302,7 +2302,7 @@ static struct snd_kcontrol_new snd_cmipci_mixers[] __devinitdata = { | |||
2302 | CMIPCI_SB_VOL_MONO("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), | 2302 | CMIPCI_SB_VOL_MONO("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), |
2303 | CMIPCI_SB_SW_MONO("Mic Playback Switch", 0), | 2303 | CMIPCI_SB_SW_MONO("Mic Playback Switch", 0), |
2304 | CMIPCI_DOUBLE("Mic Capture Switch", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 0, 0, 1, 0, 0), | 2304 | CMIPCI_DOUBLE("Mic Capture Switch", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 0, 0, 1, 0, 0), |
2305 | CMIPCI_SB_VOL_MONO("PC Speaker Playback Volume", SB_DSP4_SPEAKER_DEV, 6, 3), | 2305 | CMIPCI_SB_VOL_MONO("Beep Playback Volume", SB_DSP4_SPEAKER_DEV, 6, 3), |
2306 | CMIPCI_MIXER_VOL_STEREO("Aux Playback Volume", CM_REG_AUX_VOL, 4, 0, 15), | 2306 | CMIPCI_MIXER_VOL_STEREO("Aux Playback Volume", CM_REG_AUX_VOL, 4, 0, 15), |
2307 | CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 0), | 2307 | CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 0), |
2308 | CMIPCI_MIXER_SW_STEREO("Aux Capture Switch", CM_REG_MIXER2, CM_RAUXLEN_SHIFT, CM_RAUXREN_SHIFT, 0), | 2308 | CMIPCI_MIXER_SW_STEREO("Aux Capture Switch", CM_REG_MIXER2, CM_RAUXLEN_SHIFT, CM_RAUXREN_SHIFT, 0), |
@@ -2310,7 +2310,7 @@ static struct snd_kcontrol_new snd_cmipci_mixers[] __devinitdata = { | |||
2310 | CMIPCI_MIXER_VOL_MONO("Mic Capture Volume", CM_REG_MIXER2, CM_VADMIC_SHIFT, 7), | 2310 | CMIPCI_MIXER_VOL_MONO("Mic Capture Volume", CM_REG_MIXER2, CM_VADMIC_SHIFT, 7), |
2311 | CMIPCI_SB_VOL_MONO("Phone Playback Volume", CM_REG_EXTENT_IND, 5, 7), | 2311 | CMIPCI_SB_VOL_MONO("Phone Playback Volume", CM_REG_EXTENT_IND, 5, 7), |
2312 | CMIPCI_DOUBLE("Phone Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 4, 4, 1, 0, 0), | 2312 | CMIPCI_DOUBLE("Phone Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 4, 4, 1, 0, 0), |
2313 | CMIPCI_DOUBLE("PC Speaker Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 3, 3, 1, 0, 0), | 2313 | CMIPCI_DOUBLE("Beep Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 3, 3, 1, 0, 0), |
2314 | CMIPCI_DOUBLE("Mic Boost Capture Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 0, 0, 1, 0, 0), | 2314 | CMIPCI_DOUBLE("Mic Boost Capture Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 0, 0, 1, 0, 0), |
2315 | }; | 2315 | }; |
2316 | 2316 | ||
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 75454648d50c..cb65bd0dd35b 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -240,7 +240,7 @@ static int select_rom(unsigned int pitch) | |||
240 | } else if (pitch == 0x02000000) { | 240 | } else if (pitch == 0x02000000) { |
241 | /* pitch == 2 */ | 241 | /* pitch == 2 */ |
242 | return 3; | 242 | return 3; |
243 | } else if (pitch >= 0x0 && pitch <= 0x08000000) { | 243 | } else if (pitch <= 0x08000000) { |
244 | /* 0 <= pitch <= 8 */ | 244 | /* 0 <= pitch <= 8 */ |
245 | return 0; | 245 | return 0; |
246 | } else { | 246 | } else { |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 36e08bd2b3cc..6b8ae7b5cd54 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -1040,8 +1040,7 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry, | |||
1040 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) | 1040 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) |
1041 | continue; | 1041 | continue; |
1042 | 1042 | ||
1043 | if ((reg < 0x49) && (reg >= 0) && (val <= 0xffffffff) | 1043 | if (reg < 0x49 && val <= 0xffffffff && channel_id <= 2) |
1044 | && (channel_id >= 0) && (channel_id <= 2) ) | ||
1045 | snd_emu10k1x_ptr_write(emu, reg, channel_id, val); | 1044 | snd_emu10k1x_ptr_write(emu, reg, channel_id, val); |
1046 | } | 1045 | } |
1047 | } | 1046 | } |
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index b0fb6c917c38..05afe06e353a 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c | |||
@@ -1818,8 +1818,8 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
1818 | "Master Playback Switch", "Master Capture Switch", | 1818 | "Master Playback Switch", "Master Capture Switch", |
1819 | "Master Playback Volume", "Master Capture Volume", | 1819 | "Master Playback Volume", "Master Capture Volume", |
1820 | "Wave Master Playback Volume", "Master Playback Volume", | 1820 | "Wave Master Playback Volume", "Master Playback Volume", |
1821 | "PC Speaker Playback Switch", "PC Speaker Capture Switch", | 1821 | "Beep Playback Switch", "Beep Capture Switch", |
1822 | "PC Speaker Playback Volume", "PC Speaker Capture Volume", | 1822 | "Beep Playback Volume", "Beep Capture Volume", |
1823 | "Phone Playback Switch", "Phone Capture Switch", | 1823 | "Phone Playback Switch", "Phone Capture Switch", |
1824 | "Phone Playback Volume", "Phone Capture Volume", | 1824 | "Phone Playback Volume", "Phone Capture Volume", |
1825 | "Mic Playback Switch", "Mic Capture Switch", | 1825 | "Mic Playback Switch", "Mic Capture Switch", |
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index 216f9748aff5..baa7cd508cd8 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c | |||
@@ -451,7 +451,7 @@ static void snd_emu_proc_io_reg_write(struct snd_info_entry *entry, | |||
451 | while (!snd_info_get_line(buffer, line, sizeof(line))) { | 451 | while (!snd_info_get_line(buffer, line, sizeof(line))) { |
452 | if (sscanf(line, "%x %x", ®, &val) != 2) | 452 | if (sscanf(line, "%x %x", ®, &val) != 2) |
453 | continue; | 453 | continue; |
454 | if ((reg < 0x40) && (reg >= 0) && (val <= 0xffffffff) ) { | 454 | if (reg < 0x40 && val <= 0xffffffff) { |
455 | spin_lock_irqsave(&emu->emu_lock, flags); | 455 | spin_lock_irqsave(&emu->emu_lock, flags); |
456 | outl(val, emu->port + (reg & 0xfffffffc)); | 456 | outl(val, emu->port + (reg & 0xfffffffc)); |
457 | spin_unlock_irqrestore(&emu->emu_lock, flags); | 457 | spin_unlock_irqrestore(&emu->emu_lock, flags); |
@@ -527,7 +527,7 @@ static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry, | |||
527 | while (!snd_info_get_line(buffer, line, sizeof(line))) { | 527 | while (!snd_info_get_line(buffer, line, sizeof(line))) { |
528 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) | 528 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) |
529 | continue; | 529 | continue; |
530 | if ((reg < 0xa0) && (reg >= 0) && (val <= 0xffffffff) && (channel_id >= 0) && (channel_id <= 3) ) | 530 | if (reg < 0xa0 && val <= 0xffffffff && channel_id <= 3) |
531 | snd_ptr_write(emu, iobase, reg, channel_id, val); | 531 | snd_ptr_write(emu, iobase, reg, channel_id, val); |
532 | } | 532 | } |
533 | } | 533 | } |
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index c1a5aa15af8f..5ef7080e14d0 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c | |||
@@ -256,7 +256,7 @@ int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value) | |||
256 | if (reg > 0x3f) | 256 | if (reg > 0x3f) |
257 | return 1; | 257 | return 1; |
258 | reg += 0x40; /* 0x40 upwards are registers. */ | 258 | reg += 0x40; /* 0x40 upwards are registers. */ |
259 | if (value < 0 || value > 0x3f) /* 0 to 0x3f are values */ | 259 | if (value > 0x3f) /* 0 to 0x3f are values */ |
260 | return 1; | 260 | return 1; |
261 | spin_lock_irqsave(&emu->emu_lock, flags); | 261 | spin_lock_irqsave(&emu->emu_lock, flags); |
262 | outl(reg, emu->port + A_IOCFG); | 262 | outl(reg, emu->port + A_IOCFG); |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 820318ee62c1..fb83e1ffa5cb 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -1387,7 +1387,7 @@ ES1938_DOUBLE_TLV("Aux Playback Volume", 0, 0x3a, 0x3a, 4, 0, 15, 0, | |||
1387 | db_scale_line), | 1387 | db_scale_line), |
1388 | ES1938_DOUBLE_TLV("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0, | 1388 | ES1938_DOUBLE_TLV("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0, |
1389 | db_scale_capture), | 1389 | db_scale_capture), |
1390 | ES1938_SINGLE("PC Speaker Volume", 0, 0x3c, 0, 7, 0), | 1390 | ES1938_SINGLE("Beep Volume", 0, 0x3c, 0, 7, 0), |
1391 | ES1938_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0), | 1391 | ES1938_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0), |
1392 | ES1938_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), | 1392 | ES1938_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), |
1393 | { | 1393 | { |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index 780e1a72114a..85c81feb10cf 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -197,8 +197,8 @@ static struct snd_kcontrol_new cmi9880_basic_mixer[] = { | |||
197 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0, HDA_INPUT), | 197 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0, HDA_INPUT), |
198 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0, HDA_INPUT), | 198 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0, HDA_INPUT), |
199 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0, HDA_INPUT), | 199 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0, HDA_INPUT), |
200 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x23, 0, HDA_OUTPUT), | 200 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x23, 0, HDA_OUTPUT), |
201 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x23, 0, HDA_OUTPUT), | 201 | HDA_CODEC_MUTE("Beep Playback Switch", 0x23, 0, HDA_OUTPUT), |
202 | { } /* end */ | 202 | { } /* end */ |
203 | }; | 203 | }; |
204 | 204 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ff20048504b6..6edb5ec78ecd 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -7336,8 +7336,8 @@ static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |||
7336 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | 7336 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
7337 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | 7337 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
7338 | /* FIXME: this looks suspicious... | 7338 | /* FIXME: this looks suspicious... |
7339 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), | 7339 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7340 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), | 7340 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
7341 | */ | 7341 | */ |
7342 | { } /* end */ | 7342 | { } /* end */ |
7343 | }; | 7343 | }; |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 8eb6508cd991..e18a439ba51f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -3224,7 +3224,7 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, | |||
3224 | /* check for mute support for the the amp */ | 3224 | /* check for mute support for the the amp */ |
3225 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { | 3225 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { |
3226 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, | 3226 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
3227 | "PC Beep Playback Switch", | 3227 | "Beep Playback Switch", |
3228 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); | 3228 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
3229 | if (err < 0) | 3229 | if (err < 0) |
3230 | return err; | 3230 | return err; |
@@ -3233,7 +3233,7 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, | |||
3233 | /* check to see if there is volume support for the amp */ | 3233 | /* check to see if there is volume support for the amp */ |
3234 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { | 3234 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
3235 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, | 3235 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, |
3236 | "PC Beep Playback Volume", | 3236 | "Beep Playback Volume", |
3237 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); | 3237 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
3238 | if (err < 0) | 3238 | if (err < 0) |
3239 | return err; | 3239 | return err; |
@@ -3274,7 +3274,7 @@ static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { | |||
3274 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) | 3274 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) |
3275 | { | 3275 | { |
3276 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, | 3276 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, |
3277 | 0, "PC Beep Playback Switch", 0); | 3277 | 0, "Beep Playback Switch", 0); |
3278 | } | 3278 | } |
3279 | #endif | 3279 | #endif |
3280 | 3280 | ||
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 2cc0eda4f20e..2e156467b814 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c | |||
@@ -479,7 +479,7 @@ static int snd_pmac_awacs_put_master_amp(struct snd_kcontrol *kcontrol, | |||
479 | 479 | ||
480 | static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] __devinitdata = { | 480 | static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] __devinitdata = { |
481 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 481 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
482 | .name = "PC Speaker Playback Volume", | 482 | .name = "Speaker Playback Volume", |
483 | .info = snd_pmac_awacs_info_volume_amp, | 483 | .info = snd_pmac_awacs_info_volume_amp, |
484 | .get = snd_pmac_awacs_get_volume_amp, | 484 | .get = snd_pmac_awacs_get_volume_amp, |
485 | .put = snd_pmac_awacs_put_volume_amp, | 485 | .put = snd_pmac_awacs_put_volume_amp, |
@@ -525,7 +525,7 @@ static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw __devinitdata = { | |||
525 | 525 | ||
526 | static struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw __devinitdata = { | 526 | static struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw __devinitdata = { |
527 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 527 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
528 | .name = "PC Speaker Playback Switch", | 528 | .name = "Speaker Playback Switch", |
529 | .info = snd_pmac_boolean_stereo_info, | 529 | .info = snd_pmac_boolean_stereo_info, |
530 | .get = snd_pmac_awacs_get_switch_amp, | 530 | .get = snd_pmac_awacs_get_switch_amp, |
531 | .put = snd_pmac_awacs_put_switch_amp, | 531 | .put = snd_pmac_awacs_put_switch_amp, |
@@ -696,17 +696,17 @@ static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_imac[] __devinitdata | |||
696 | }; | 696 | }; |
697 | 697 | ||
698 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __devinitdata = { | 698 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __devinitdata = { |
699 | AWACS_VOLUME("PC Speaker Playback Volume", 4, 6, 1), | 699 | AWACS_VOLUME("Speaker Playback Volume", 4, 6, 1), |
700 | }; | 700 | }; |
701 | 701 | ||
702 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __devinitdata = | 702 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __devinitdata = |
703 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); | 703 | AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); |
704 | 704 | ||
705 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __devinitdata = | 705 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __devinitdata = |
706 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); | 706 | AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); |
707 | 707 | ||
708 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __devinitdata = | 708 | static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __devinitdata = |
709 | AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); | 709 | AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); |
710 | 710 | ||
711 | 711 | ||
712 | /* | 712 | /* |
diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index 16ed240e423c..0accfe49735b 100644 --- a/sound/ppc/burgundy.c +++ b/sound/ppc/burgundy.c | |||
@@ -505,7 +505,7 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] __devinitdata = { | |||
505 | MASK_ADDR_BURGUNDY_GAINLINE, 1, 0), | 505 | MASK_ADDR_BURGUNDY_GAINLINE, 1, 0), |
506 | BURGUNDY_VOLUME_B("Mic Gain Capture Volume", 0, | 506 | BURGUNDY_VOLUME_B("Mic Gain Capture Volume", 0, |
507 | MASK_ADDR_BURGUNDY_GAINMIC, 1, 0), | 507 | MASK_ADDR_BURGUNDY_GAINMIC, 1, 0), |
508 | BURGUNDY_VOLUME_B("PC Speaker Playback Volume", 0, | 508 | BURGUNDY_VOLUME_B("Speaker Playback Volume", 0, |
509 | MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1, 1), | 509 | MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1, 1), |
510 | BURGUNDY_VOLUME_B("Line out Playback Volume", 0, | 510 | BURGUNDY_VOLUME_B("Line out Playback Volume", 0, |
511 | MASK_ADDR_BURGUNDY_ATTENLINEOUT, 1, 1), | 511 | MASK_ADDR_BURGUNDY_ATTENLINEOUT, 1, 1), |
@@ -527,7 +527,7 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] __devinitdata = { | |||
527 | MASK_ADDR_BURGUNDY_VOLMIC, 16), | 527 | MASK_ADDR_BURGUNDY_VOLMIC, 16), |
528 | BURGUNDY_VOLUME_B("Line in Gain Capture Volume", 0, | 528 | BURGUNDY_VOLUME_B("Line in Gain Capture Volume", 0, |
529 | MASK_ADDR_BURGUNDY_GAINMIC, 1, 0), | 529 | MASK_ADDR_BURGUNDY_GAINMIC, 1, 0), |
530 | BURGUNDY_VOLUME_B("PC Speaker Playback Volume", 0, | 530 | BURGUNDY_VOLUME_B("Speaker Playback Volume", 0, |
531 | MASK_ADDR_BURGUNDY_ATTENMONO, 0, 1), | 531 | MASK_ADDR_BURGUNDY_ATTENMONO, 0, 1), |
532 | BURGUNDY_VOLUME_B("Line out Playback Volume", 0, | 532 | BURGUNDY_VOLUME_B("Line out Playback Volume", 0, |
533 | MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1, 1), | 533 | MASK_ADDR_BURGUNDY_ATTENSPEAKER, 1, 1), |
@@ -549,11 +549,11 @@ BURGUNDY_SWITCH_B("Master Playback Switch", 0, | |||
549 | BURGUNDY_OUTPUT_INTERN | 549 | BURGUNDY_OUTPUT_INTERN |
550 | | BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); | 550 | | BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); |
551 | static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_imac __devinitdata = | 551 | static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_imac __devinitdata = |
552 | BURGUNDY_SWITCH_B("PC Speaker Playback Switch", 0, | 552 | BURGUNDY_SWITCH_B("Speaker Playback Switch", 0, |
553 | MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, | 553 | MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, |
554 | BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); | 554 | BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); |
555 | static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_pmac __devinitdata = | 555 | static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_pmac __devinitdata = |
556 | BURGUNDY_SWITCH_B("PC Speaker Playback Switch", 0, | 556 | BURGUNDY_SWITCH_B("Speaker Playback Switch", 0, |
557 | MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, | 557 | MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, |
558 | BURGUNDY_OUTPUT_INTERN, 0, 0); | 558 | BURGUNDY_OUTPUT_INTERN, 0, 0); |
559 | static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_imac __devinitdata = | 559 | static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_imac __devinitdata = |
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 08e584d1453a..789f44f4ac78 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -905,7 +905,7 @@ static struct snd_kcontrol_new tumbler_hp_sw __devinitdata = { | |||
905 | }; | 905 | }; |
906 | static struct snd_kcontrol_new tumbler_speaker_sw __devinitdata = { | 906 | static struct snd_kcontrol_new tumbler_speaker_sw __devinitdata = { |
907 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 907 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
908 | .name = "PC Speaker Playback Switch", | 908 | .name = "Speaker Playback Switch", |
909 | .info = snd_pmac_boolean_mono_info, | 909 | .info = snd_pmac_boolean_mono_info, |
910 | .get = tumbler_get_mute_switch, | 910 | .get = tumbler_get_mute_switch, |
911 | .put = tumbler_put_mute_switch, | 911 | .put = tumbler_put_mute_switch, |
diff --git a/sound/sh/Kconfig b/sound/sh/Kconfig index aed0f90c3919..61139f3c1614 100644 --- a/sound/sh/Kconfig +++ b/sound/sh/Kconfig | |||
@@ -19,5 +19,13 @@ config SND_AICA | |||
19 | help | 19 | help |
20 | ALSA Sound driver for the SEGA Dreamcast console. | 20 | ALSA Sound driver for the SEGA Dreamcast console. |
21 | 21 | ||
22 | config SND_SH_DAC_AUDIO | ||
23 | tristate "SuperH DAC audio support" | ||
24 | depends on SND | ||
25 | depends on CPU_SH3 && HIGH_RES_TIMERS | ||
26 | select SND_PCM | ||
27 | help | ||
28 | Say Y here to include support for the on-chip DAC. | ||
29 | |||
22 | endif # SND_SUPERH | 30 | endif # SND_SUPERH |
23 | 31 | ||
diff --git a/sound/sh/Makefile b/sound/sh/Makefile index 8fdcb6e26f00..7d09b5188cf7 100644 --- a/sound/sh/Makefile +++ b/sound/sh/Makefile | |||
@@ -3,6 +3,8 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | snd-aica-objs := aica.o | 5 | snd-aica-objs := aica.o |
6 | snd-sh_dac_audio-objs := sh_dac_audio.o | ||
6 | 7 | ||
7 | # Toplevel Module Dependency | 8 | # Toplevel Module Dependency |
8 | obj-$(CONFIG_SND_AICA) += snd-aica.o | 9 | obj-$(CONFIG_SND_AICA) += snd-aica.o |
10 | obj-$(CONFIG_SND_SH_DAC_AUDIO) += snd-sh_dac_audio.o | ||
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c new file mode 100644 index 000000000000..76d9ad27d91c --- /dev/null +++ b/sound/sh/sh_dac_audio.c | |||
@@ -0,0 +1,453 @@ | |||
1 | /* | ||
2 | * sh_dac_audio.c - SuperH DAC audio driver for ALSA | ||
3 | * | ||
4 | * Copyright (c) 2009 by Rafael Ignacio Zurita <rizurita@yahoo.com> | ||
5 | * | ||
6 | * | ||
7 | * Based on sh_dac_audio.c (Copyright (C) 2004, 2005 by Andriy Skulysh) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include <linux/hrtimer.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/io.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <sound/core.h> | ||
30 | #include <sound/initval.h> | ||
31 | #include <sound/pcm.h> | ||
32 | #include <sound/sh_dac_audio.h> | ||
33 | #include <asm/clock.h> | ||
34 | #include <asm/hd64461.h> | ||
35 | #include <mach/hp6xx.h> | ||
36 | #include <cpu/dac.h> | ||
37 | |||
38 | MODULE_AUTHOR("Rafael Ignacio Zurita <rizurita@yahoo.com>"); | ||
39 | MODULE_DESCRIPTION("SuperH DAC audio driver"); | ||
40 | MODULE_LICENSE("GPL"); | ||
41 | MODULE_SUPPORTED_DEVICE("{{SuperH DAC audio support}}"); | ||
42 | |||
43 | /* Module Parameters */ | ||
44 | static int index = SNDRV_DEFAULT_IDX1; | ||
45 | static char *id = SNDRV_DEFAULT_STR1; | ||
46 | module_param(index, int, 0444); | ||
47 | MODULE_PARM_DESC(index, "Index value for SuperH DAC audio."); | ||
48 | module_param(id, charp, 0444); | ||
49 | MODULE_PARM_DESC(id, "ID string for SuperH DAC audio."); | ||
50 | |||
51 | /* main struct */ | ||
52 | struct snd_sh_dac { | ||
53 | struct snd_card *card; | ||
54 | struct snd_pcm_substream *substream; | ||
55 | struct hrtimer hrtimer; | ||
56 | ktime_t wakeups_per_second; | ||
57 | |||
58 | int rate; | ||
59 | int empty; | ||
60 | char *data_buffer, *buffer_begin, *buffer_end; | ||
61 | int processed; /* bytes proccesed, to compare with period_size */ | ||
62 | int buffer_size; | ||
63 | struct dac_audio_pdata *pdata; | ||
64 | }; | ||
65 | |||
66 | |||
67 | static void dac_audio_start_timer(struct snd_sh_dac *chip) | ||
68 | { | ||
69 | hrtimer_start(&chip->hrtimer, chip->wakeups_per_second, | ||
70 | HRTIMER_MODE_REL); | ||
71 | } | ||
72 | |||
73 | static void dac_audio_stop_timer(struct snd_sh_dac *chip) | ||
74 | { | ||
75 | hrtimer_cancel(&chip->hrtimer); | ||
76 | } | ||
77 | |||
78 | static void dac_audio_reset(struct snd_sh_dac *chip) | ||
79 | { | ||
80 | dac_audio_stop_timer(chip); | ||
81 | chip->buffer_begin = chip->buffer_end = chip->data_buffer; | ||
82 | chip->processed = 0; | ||
83 | chip->empty = 1; | ||
84 | } | ||
85 | |||
86 | static void dac_audio_set_rate(struct snd_sh_dac *chip) | ||
87 | { | ||
88 | chip->wakeups_per_second = ktime_set(0, 1000000000 / chip->rate); | ||
89 | } | ||
90 | |||
91 | |||
92 | /* PCM INTERFACE */ | ||
93 | |||
94 | static struct snd_pcm_hardware snd_sh_dac_pcm_hw = { | ||
95 | .info = (SNDRV_PCM_INFO_MMAP | | ||
96 | SNDRV_PCM_INFO_MMAP_VALID | | ||
97 | SNDRV_PCM_INFO_INTERLEAVED | | ||
98 | SNDRV_PCM_INFO_HALF_DUPLEX), | ||
99 | .formats = SNDRV_PCM_FMTBIT_U8, | ||
100 | .rates = SNDRV_PCM_RATE_8000, | ||
101 | .rate_min = 8000, | ||
102 | .rate_max = 8000, | ||
103 | .channels_min = 1, | ||
104 | .channels_max = 1, | ||
105 | .buffer_bytes_max = (48*1024), | ||
106 | .period_bytes_min = 1, | ||
107 | .period_bytes_max = (48*1024), | ||
108 | .periods_min = 1, | ||
109 | .periods_max = 1024, | ||
110 | }; | ||
111 | |||
112 | static int snd_sh_dac_pcm_open(struct snd_pcm_substream *substream) | ||
113 | { | ||
114 | struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); | ||
115 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
116 | |||
117 | runtime->hw = snd_sh_dac_pcm_hw; | ||
118 | |||
119 | chip->substream = substream; | ||
120 | chip->buffer_begin = chip->buffer_end = chip->data_buffer; | ||
121 | chip->processed = 0; | ||
122 | chip->empty = 1; | ||
123 | |||
124 | chip->pdata->start(chip->pdata); | ||
125 | |||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static int snd_sh_dac_pcm_close(struct snd_pcm_substream *substream) | ||
130 | { | ||
131 | struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); | ||
132 | |||
133 | chip->substream = NULL; | ||
134 | |||
135 | dac_audio_stop_timer(chip); | ||
136 | chip->pdata->stop(chip->pdata); | ||
137 | |||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | static int snd_sh_dac_pcm_hw_params(struct snd_pcm_substream *substream, | ||
142 | struct snd_pcm_hw_params *hw_params) | ||
143 | { | ||
144 | return snd_pcm_lib_malloc_pages(substream, | ||
145 | params_buffer_bytes(hw_params)); | ||
146 | } | ||
147 | |||
148 | static int snd_sh_dac_pcm_hw_free(struct snd_pcm_substream *substream) | ||
149 | { | ||
150 | return snd_pcm_lib_free_pages(substream); | ||
151 | } | ||
152 | |||
153 | static int snd_sh_dac_pcm_prepare(struct snd_pcm_substream *substream) | ||
154 | { | ||
155 | struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); | ||
156 | struct snd_pcm_runtime *runtime = chip->substream->runtime; | ||
157 | |||
158 | chip->buffer_size = runtime->buffer_size; | ||
159 | memset(chip->data_buffer, 0, chip->pdata->buffer_size); | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static int snd_sh_dac_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | ||
165 | { | ||
166 | struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); | ||
167 | |||
168 | switch (cmd) { | ||
169 | case SNDRV_PCM_TRIGGER_START: | ||
170 | dac_audio_start_timer(chip); | ||
171 | break; | ||
172 | case SNDRV_PCM_TRIGGER_STOP: | ||
173 | chip->buffer_begin = chip->buffer_end = chip->data_buffer; | ||
174 | chip->processed = 0; | ||
175 | chip->empty = 1; | ||
176 | dac_audio_stop_timer(chip); | ||
177 | break; | ||
178 | default: | ||
179 | return -EINVAL; | ||
180 | } | ||
181 | |||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | static int snd_sh_dac_pcm_copy(struct snd_pcm_substream *substream, int channel, | ||
186 | snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count) | ||
187 | { | ||
188 | /* channel is not used (interleaved data) */ | ||
189 | struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); | ||
190 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
191 | ssize_t b_count = frames_to_bytes(runtime , count); | ||
192 | ssize_t b_pos = frames_to_bytes(runtime , pos); | ||
193 | |||
194 | if (count < 0) | ||
195 | return -EINVAL; | ||
196 | |||
197 | if (!count) | ||
198 | return 0; | ||
199 | |||
200 | memcpy_toio(chip->data_buffer + b_pos, src, b_count); | ||
201 | chip->buffer_end = chip->data_buffer + b_pos + b_count; | ||
202 | |||
203 | if (chip->empty) { | ||
204 | chip->empty = 0; | ||
205 | dac_audio_start_timer(chip); | ||
206 | } | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | static int snd_sh_dac_pcm_silence(struct snd_pcm_substream *substream, | ||
212 | int channel, snd_pcm_uframes_t pos, | ||
213 | snd_pcm_uframes_t count) | ||
214 | { | ||
215 | /* channel is not used (interleaved data) */ | ||
216 | struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); | ||
217 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
218 | ssize_t b_count = frames_to_bytes(runtime , count); | ||
219 | ssize_t b_pos = frames_to_bytes(runtime , pos); | ||
220 | |||
221 | if (count < 0) | ||
222 | return -EINVAL; | ||
223 | |||
224 | if (!count) | ||
225 | return 0; | ||
226 | |||
227 | memset_io(chip->data_buffer + b_pos, 0, b_count); | ||
228 | chip->buffer_end = chip->data_buffer + b_pos + b_count; | ||
229 | |||
230 | if (chip->empty) { | ||
231 | chip->empty = 0; | ||
232 | dac_audio_start_timer(chip); | ||
233 | } | ||
234 | |||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | static | ||
239 | snd_pcm_uframes_t snd_sh_dac_pcm_pointer(struct snd_pcm_substream *substream) | ||
240 | { | ||
241 | struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); | ||
242 | int pointer = chip->buffer_begin - chip->data_buffer; | ||
243 | |||
244 | return pointer; | ||
245 | } | ||
246 | |||
247 | /* pcm ops */ | ||
248 | static struct snd_pcm_ops snd_sh_dac_pcm_ops = { | ||
249 | .open = snd_sh_dac_pcm_open, | ||
250 | .close = snd_sh_dac_pcm_close, | ||
251 | .ioctl = snd_pcm_lib_ioctl, | ||
252 | .hw_params = snd_sh_dac_pcm_hw_params, | ||
253 | .hw_free = snd_sh_dac_pcm_hw_free, | ||
254 | .prepare = snd_sh_dac_pcm_prepare, | ||
255 | .trigger = snd_sh_dac_pcm_trigger, | ||
256 | .pointer = snd_sh_dac_pcm_pointer, | ||
257 | .copy = snd_sh_dac_pcm_copy, | ||
258 | .silence = snd_sh_dac_pcm_silence, | ||
259 | .mmap = snd_pcm_lib_mmap_iomem, | ||
260 | }; | ||
261 | |||
262 | static int __devinit snd_sh_dac_pcm(struct snd_sh_dac *chip, int device) | ||
263 | { | ||
264 | int err; | ||
265 | struct snd_pcm *pcm; | ||
266 | |||
267 | /* device should be always 0 for us */ | ||
268 | err = snd_pcm_new(chip->card, "SH_DAC PCM", device, 1, 0, &pcm); | ||
269 | if (err < 0) | ||
270 | return err; | ||
271 | |||
272 | pcm->private_data = chip; | ||
273 | strcpy(pcm->name, "SH_DAC PCM"); | ||
274 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops); | ||
275 | |||
276 | /* buffer size=48K */ | ||
277 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, | ||
278 | snd_dma_continuous_data(GFP_KERNEL), | ||
279 | 48 * 1024, | ||
280 | 48 * 1024); | ||
281 | |||
282 | return 0; | ||
283 | } | ||
284 | /* END OF PCM INTERFACE */ | ||
285 | |||
286 | |||
287 | /* driver .remove -- destructor */ | ||
288 | static int snd_sh_dac_remove(struct platform_device *devptr) | ||
289 | { | ||
290 | snd_card_free(platform_get_drvdata(devptr)); | ||
291 | platform_set_drvdata(devptr, NULL); | ||
292 | |||
293 | return 0; | ||
294 | } | ||
295 | |||
296 | /* free -- it has been defined by create */ | ||
297 | static int snd_sh_dac_free(struct snd_sh_dac *chip) | ||
298 | { | ||
299 | /* release the data */ | ||
300 | kfree(chip->data_buffer); | ||
301 | kfree(chip); | ||
302 | |||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | static int snd_sh_dac_dev_free(struct snd_device *device) | ||
307 | { | ||
308 | struct snd_sh_dac *chip = device->device_data; | ||
309 | |||
310 | return snd_sh_dac_free(chip); | ||
311 | } | ||
312 | |||
313 | static enum hrtimer_restart sh_dac_audio_timer(struct hrtimer *handle) | ||
314 | { | ||
315 | struct snd_sh_dac *chip = container_of(handle, struct snd_sh_dac, | ||
316 | hrtimer); | ||
317 | struct snd_pcm_runtime *runtime = chip->substream->runtime; | ||
318 | ssize_t b_ps = frames_to_bytes(runtime, runtime->period_size); | ||
319 | |||
320 | if (!chip->empty) { | ||
321 | sh_dac_output(*chip->buffer_begin, chip->pdata->channel); | ||
322 | chip->buffer_begin++; | ||
323 | |||
324 | chip->processed++; | ||
325 | if (chip->processed >= b_ps) { | ||
326 | chip->processed -= b_ps; | ||
327 | snd_pcm_period_elapsed(chip->substream); | ||
328 | } | ||
329 | |||
330 | if (chip->buffer_begin == (chip->data_buffer + | ||
331 | chip->buffer_size - 1)) | ||
332 | chip->buffer_begin = chip->data_buffer; | ||
333 | |||
334 | if (chip->buffer_begin == chip->buffer_end) | ||
335 | chip->empty = 1; | ||
336 | |||
337 | } | ||
338 | |||
339 | if (!chip->empty) | ||
340 | hrtimer_start(&chip->hrtimer, chip->wakeups_per_second, | ||
341 | HRTIMER_MODE_REL); | ||
342 | |||
343 | return HRTIMER_NORESTART; | ||
344 | } | ||
345 | |||
346 | /* create -- chip-specific constructor for the cards components */ | ||
347 | static int __devinit snd_sh_dac_create(struct snd_card *card, | ||
348 | struct platform_device *devptr, | ||
349 | struct snd_sh_dac **rchip) | ||
350 | { | ||
351 | struct snd_sh_dac *chip; | ||
352 | int err; | ||
353 | |||
354 | static struct snd_device_ops ops = { | ||
355 | .dev_free = snd_sh_dac_dev_free, | ||
356 | }; | ||
357 | |||
358 | *rchip = NULL; | ||
359 | |||
360 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | ||
361 | if (chip == NULL) | ||
362 | return -ENOMEM; | ||
363 | |||
364 | chip->card = card; | ||
365 | |||
366 | hrtimer_init(&chip->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
367 | chip->hrtimer.function = sh_dac_audio_timer; | ||
368 | |||
369 | dac_audio_reset(chip); | ||
370 | chip->rate = 8000; | ||
371 | dac_audio_set_rate(chip); | ||
372 | |||
373 | chip->pdata = devptr->dev.platform_data; | ||
374 | |||
375 | chip->data_buffer = kmalloc(chip->pdata->buffer_size, GFP_KERNEL); | ||
376 | if (chip->data_buffer == NULL) { | ||
377 | kfree(chip); | ||
378 | return -ENOMEM; | ||
379 | } | ||
380 | |||
381 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); | ||
382 | if (err < 0) { | ||
383 | snd_sh_dac_free(chip); | ||
384 | return err; | ||
385 | } | ||
386 | |||
387 | *rchip = chip; | ||
388 | |||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | /* driver .probe -- constructor */ | ||
393 | static int __devinit snd_sh_dac_probe(struct platform_device *devptr) | ||
394 | { | ||
395 | struct snd_sh_dac *chip; | ||
396 | struct snd_card *card; | ||
397 | int err; | ||
398 | |||
399 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); | ||
400 | if (err < 0) { | ||
401 | snd_printk(KERN_ERR "cannot allocate the card\n"); | ||
402 | return err; | ||
403 | } | ||
404 | |||
405 | err = snd_sh_dac_create(card, devptr, &chip); | ||
406 | if (err < 0) | ||
407 | goto probe_error; | ||
408 | |||
409 | err = snd_sh_dac_pcm(chip, 0); | ||
410 | if (err < 0) | ||
411 | goto probe_error; | ||
412 | |||
413 | strcpy(card->driver, "snd_sh_dac"); | ||
414 | strcpy(card->shortname, "SuperH DAC audio driver"); | ||
415 | printk(KERN_INFO "%s %s", card->longname, card->shortname); | ||
416 | |||
417 | err = snd_card_register(card); | ||
418 | if (err < 0) | ||
419 | goto probe_error; | ||
420 | |||
421 | snd_printk("ALSA driver for SuperH DAC audio"); | ||
422 | |||
423 | platform_set_drvdata(devptr, card); | ||
424 | return 0; | ||
425 | |||
426 | probe_error: | ||
427 | snd_card_free(card); | ||
428 | return err; | ||
429 | } | ||
430 | |||
431 | /* | ||
432 | * "driver" definition | ||
433 | */ | ||
434 | static struct platform_driver driver = { | ||
435 | .probe = snd_sh_dac_probe, | ||
436 | .remove = snd_sh_dac_remove, | ||
437 | .driver = { | ||
438 | .name = "dac_audio", | ||
439 | }, | ||
440 | }; | ||
441 | |||
442 | static int __init sh_dac_init(void) | ||
443 | { | ||
444 | return platform_driver_register(&driver); | ||
445 | } | ||
446 | |||
447 | static void __exit sh_dac_exit(void) | ||
448 | { | ||
449 | platform_driver_unregister(&driver); | ||
450 | } | ||
451 | |||
452 | module_init(sh_dac_init); | ||
453 | module_exit(sh_dac_exit); | ||
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 0b8dcb5cd729..35606ae60868 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -85,7 +85,7 @@ static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg, | |||
85 | * of data into val | 85 | * of data into val |
86 | */ | 86 | */ |
87 | 87 | ||
88 | if ((reg < 0 || reg > 9) && (reg != 15)) { | 88 | if (reg > 9 && reg != 15) { |
89 | printk(KERN_WARNING "%s Invalid register R%u\n", __func__, reg); | 89 | printk(KERN_WARNING "%s Invalid register R%u\n", __func__, reg); |
90 | return -1; | 90 | return -1; |
91 | } | 91 | } |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index abed37acf787..60e360b10468 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -165,9 +165,9 @@ SOC_SINGLE("Mono Playback Switch", AC97_MASTER_TONE, 7, 1, 1), | |||
165 | SOC_SINGLE("Mono Playback ZC Switch", AC97_MASTER_TONE, 6, 1, 0), | 165 | SOC_SINGLE("Mono Playback ZC Switch", AC97_MASTER_TONE, 6, 1, 0), |
166 | SOC_SINGLE("Mono Playback Volume", AC97_MASTER_TONE, 0, 31, 1), | 166 | SOC_SINGLE("Mono Playback Volume", AC97_MASTER_TONE, 0, 31, 1), |
167 | 167 | ||
168 | SOC_SINGLE("PC Beep Playback Headphone Volume", AC97_AUX, 12, 7, 1), | 168 | SOC_SINGLE("Beep Playback Headphone Volume", AC97_AUX, 12, 7, 1), |
169 | SOC_SINGLE("PC Beep Playback Speaker Volume", AC97_AUX, 8, 7, 1), | 169 | SOC_SINGLE("Beep Playback Speaker Volume", AC97_AUX, 8, 7, 1), |
170 | SOC_SINGLE("PC Beep Playback Mono Volume", AC97_AUX, 4, 7, 1), | 170 | SOC_SINGLE("Beep Playback Mono Volume", AC97_AUX, 4, 7, 1), |
171 | 171 | ||
172 | SOC_SINGLE("Voice Playback Headphone Volume", AC97_PCM, 12, 7, 1), | 172 | SOC_SINGLE("Voice Playback Headphone Volume", AC97_PCM, 12, 7, 1), |
173 | SOC_SINGLE("Voice Playback Master Volume", AC97_PCM, 8, 7, 1), | 173 | SOC_SINGLE("Voice Playback Master Volume", AC97_PCM, 8, 7, 1), |
@@ -266,7 +266,7 @@ static int mixer_event(struct snd_soc_dapm_widget *w, | |||
266 | 266 | ||
267 | /* Left Headphone Mixers */ | 267 | /* Left Headphone Mixers */ |
268 | static const struct snd_kcontrol_new wm9713_hpl_mixer_controls[] = { | 268 | static const struct snd_kcontrol_new wm9713_hpl_mixer_controls[] = { |
269 | SOC_DAPM_SINGLE("PC Beep Playback Switch", HPL_MIXER, 5, 1, 0), | 269 | SOC_DAPM_SINGLE("Beep Playback Switch", HPL_MIXER, 5, 1, 0), |
270 | SOC_DAPM_SINGLE("Voice Playback Switch", HPL_MIXER, 4, 1, 0), | 270 | SOC_DAPM_SINGLE("Voice Playback Switch", HPL_MIXER, 4, 1, 0), |
271 | SOC_DAPM_SINGLE("Aux Playback Switch", HPL_MIXER, 3, 1, 0), | 271 | SOC_DAPM_SINGLE("Aux Playback Switch", HPL_MIXER, 3, 1, 0), |
272 | SOC_DAPM_SINGLE("PCM Playback Switch", HPL_MIXER, 2, 1, 0), | 272 | SOC_DAPM_SINGLE("PCM Playback Switch", HPL_MIXER, 2, 1, 0), |
@@ -276,7 +276,7 @@ SOC_DAPM_SINGLE("Bypass Playback Switch", HPL_MIXER, 0, 1, 0), | |||
276 | 276 | ||
277 | /* Right Headphone Mixers */ | 277 | /* Right Headphone Mixers */ |
278 | static const struct snd_kcontrol_new wm9713_hpr_mixer_controls[] = { | 278 | static const struct snd_kcontrol_new wm9713_hpr_mixer_controls[] = { |
279 | SOC_DAPM_SINGLE("PC Beep Playback Switch", HPR_MIXER, 5, 1, 0), | 279 | SOC_DAPM_SINGLE("Beep Playback Switch", HPR_MIXER, 5, 1, 0), |
280 | SOC_DAPM_SINGLE("Voice Playback Switch", HPR_MIXER, 4, 1, 0), | 280 | SOC_DAPM_SINGLE("Voice Playback Switch", HPR_MIXER, 4, 1, 0), |
281 | SOC_DAPM_SINGLE("Aux Playback Switch", HPR_MIXER, 3, 1, 0), | 281 | SOC_DAPM_SINGLE("Aux Playback Switch", HPR_MIXER, 3, 1, 0), |
282 | SOC_DAPM_SINGLE("PCM Playback Switch", HPR_MIXER, 2, 1, 0), | 282 | SOC_DAPM_SINGLE("PCM Playback Switch", HPR_MIXER, 2, 1, 0), |
@@ -294,7 +294,7 @@ SOC_DAPM_ENUM("Route", wm9713_enum[0]); | |||
294 | 294 | ||
295 | /* Speaker Mixer */ | 295 | /* Speaker Mixer */ |
296 | static const struct snd_kcontrol_new wm9713_speaker_mixer_controls[] = { | 296 | static const struct snd_kcontrol_new wm9713_speaker_mixer_controls[] = { |
297 | SOC_DAPM_SINGLE("PC Beep Playback Switch", AC97_AUX, 11, 1, 1), | 297 | SOC_DAPM_SINGLE("Beep Playback Switch", AC97_AUX, 11, 1, 1), |
298 | SOC_DAPM_SINGLE("Voice Playback Switch", AC97_PCM, 11, 1, 1), | 298 | SOC_DAPM_SINGLE("Voice Playback Switch", AC97_PCM, 11, 1, 1), |
299 | SOC_DAPM_SINGLE("Aux Playback Switch", AC97_REC_SEL, 11, 1, 1), | 299 | SOC_DAPM_SINGLE("Aux Playback Switch", AC97_REC_SEL, 11, 1, 1), |
300 | SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PHONE, 14, 1, 1), | 300 | SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PHONE, 14, 1, 1), |
@@ -304,7 +304,7 @@ SOC_DAPM_SINGLE("Bypass Playback Switch", AC97_PC_BEEP, 14, 1, 1), | |||
304 | 304 | ||
305 | /* Mono Mixer */ | 305 | /* Mono Mixer */ |
306 | static const struct snd_kcontrol_new wm9713_mono_mixer_controls[] = { | 306 | static const struct snd_kcontrol_new wm9713_mono_mixer_controls[] = { |
307 | SOC_DAPM_SINGLE("PC Beep Playback Switch", AC97_AUX, 7, 1, 1), | 307 | SOC_DAPM_SINGLE("Beep Playback Switch", AC97_AUX, 7, 1, 1), |
308 | SOC_DAPM_SINGLE("Voice Playback Switch", AC97_PCM, 7, 1, 1), | 308 | SOC_DAPM_SINGLE("Voice Playback Switch", AC97_PCM, 7, 1, 1), |
309 | SOC_DAPM_SINGLE("Aux Playback Switch", AC97_REC_SEL, 7, 1, 1), | 309 | SOC_DAPM_SINGLE("Aux Playback Switch", AC97_REC_SEL, 7, 1, 1), |
310 | SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PHONE, 13, 1, 1), | 310 | SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PHONE, 13, 1, 1), |
@@ -463,7 +463,7 @@ SND_SOC_DAPM_VMID("VMID"), | |||
463 | 463 | ||
464 | static const struct snd_soc_dapm_route audio_map[] = { | 464 | static const struct snd_soc_dapm_route audio_map[] = { |
465 | /* left HP mixer */ | 465 | /* left HP mixer */ |
466 | {"Left HP Mixer", "PC Beep Playback Switch", "PCBEEP"}, | 466 | {"Left HP Mixer", "Beep Playback Switch", "PCBEEP"}, |
467 | {"Left HP Mixer", "Voice Playback Switch", "Voice DAC"}, | 467 | {"Left HP Mixer", "Voice Playback Switch", "Voice DAC"}, |
468 | {"Left HP Mixer", "Aux Playback Switch", "Aux DAC"}, | 468 | {"Left HP Mixer", "Aux Playback Switch", "Aux DAC"}, |
469 | {"Left HP Mixer", "Bypass Playback Switch", "Left Line In"}, | 469 | {"Left HP Mixer", "Bypass Playback Switch", "Left Line In"}, |
@@ -472,7 +472,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
472 | {"Left HP Mixer", NULL, "Capture Headphone Mux"}, | 472 | {"Left HP Mixer", NULL, "Capture Headphone Mux"}, |
473 | 473 | ||
474 | /* right HP mixer */ | 474 | /* right HP mixer */ |
475 | {"Right HP Mixer", "PC Beep Playback Switch", "PCBEEP"}, | 475 | {"Right HP Mixer", "Beep Playback Switch", "PCBEEP"}, |
476 | {"Right HP Mixer", "Voice Playback Switch", "Voice DAC"}, | 476 | {"Right HP Mixer", "Voice Playback Switch", "Voice DAC"}, |
477 | {"Right HP Mixer", "Aux Playback Switch", "Aux DAC"}, | 477 | {"Right HP Mixer", "Aux Playback Switch", "Aux DAC"}, |
478 | {"Right HP Mixer", "Bypass Playback Switch", "Right Line In"}, | 478 | {"Right HP Mixer", "Bypass Playback Switch", "Right Line In"}, |
@@ -491,7 +491,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
491 | {"Capture Mixer", NULL, "Right Capture Source"}, | 491 | {"Capture Mixer", NULL, "Right Capture Source"}, |
492 | 492 | ||
493 | /* speaker mixer */ | 493 | /* speaker mixer */ |
494 | {"Speaker Mixer", "PC Beep Playback Switch", "PCBEEP"}, | 494 | {"Speaker Mixer", "Beep Playback Switch", "PCBEEP"}, |
495 | {"Speaker Mixer", "Voice Playback Switch", "Voice DAC"}, | 495 | {"Speaker Mixer", "Voice Playback Switch", "Voice DAC"}, |
496 | {"Speaker Mixer", "Aux Playback Switch", "Aux DAC"}, | 496 | {"Speaker Mixer", "Aux Playback Switch", "Aux DAC"}, |
497 | {"Speaker Mixer", "Bypass Playback Switch", "Line Mixer"}, | 497 | {"Speaker Mixer", "Bypass Playback Switch", "Line Mixer"}, |
@@ -499,7 +499,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
499 | {"Speaker Mixer", "MonoIn Playback Switch", "Mono In"}, | 499 | {"Speaker Mixer", "MonoIn Playback Switch", "Mono In"}, |
500 | 500 | ||
501 | /* mono mixer */ | 501 | /* mono mixer */ |
502 | {"Mono Mixer", "PC Beep Playback Switch", "PCBEEP"}, | 502 | {"Mono Mixer", "Beep Playback Switch", "PCBEEP"}, |
503 | {"Mono Mixer", "Voice Playback Switch", "Voice DAC"}, | 503 | {"Mono Mixer", "Voice Playback Switch", "Voice DAC"}, |
504 | {"Mono Mixer", "Aux Playback Switch", "Aux DAC"}, | 504 | {"Mono Mixer", "Aux Playback Switch", "Aux DAC"}, |
505 | {"Mono Mixer", "Bypass Playback Switch", "Line Mixer"}, | 505 | {"Mono Mixer", "Bypass Playback Switch", "Line Mixer"}, |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 99f33766cd51..00cd54c236b4 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -66,6 +66,28 @@ static int us122l_create_usbmidi(struct snd_card *card) | |||
66 | iface, &quirk); | 66 | iface, &quirk); |
67 | } | 67 | } |
68 | 68 | ||
69 | static int us144_create_usbmidi(struct snd_card *card) | ||
70 | { | ||
71 | static struct snd_usb_midi_endpoint_info quirk_data = { | ||
72 | .out_ep = 4, | ||
73 | .in_ep = 3, | ||
74 | .out_cables = 0x001, | ||
75 | .in_cables = 0x001 | ||
76 | }; | ||
77 | static struct snd_usb_audio_quirk quirk = { | ||
78 | .vendor_name = "US144", | ||
79 | .product_name = NAME_ALLCAPS, | ||
80 | .ifnum = 0, | ||
81 | .type = QUIRK_MIDI_US122L, | ||
82 | .data = &quirk_data | ||
83 | }; | ||
84 | struct usb_device *dev = US122L(card)->chip.dev; | ||
85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); | ||
86 | |||
87 | return snd_usb_create_midi_interface(&US122L(card)->chip, | ||
88 | iface, &quirk); | ||
89 | } | ||
90 | |||
69 | /* | 91 | /* |
70 | * Wrapper for usb_control_msg(). | 92 | * Wrapper for usb_control_msg(). |
71 | * Allocates a temp buffer to prevent dmaing from/to the stack. | 93 | * Allocates a temp buffer to prevent dmaing from/to the stack. |
@@ -171,6 +193,11 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) | |||
171 | 193 | ||
172 | if (!us122l->first) | 194 | if (!us122l->first) |
173 | us122l->first = file; | 195 | us122l->first = file; |
196 | |||
197 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | ||
198 | iface = usb_ifnum_to_if(us122l->chip.dev, 0); | ||
199 | usb_autopm_get_interface(iface); | ||
200 | } | ||
174 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); | 201 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); |
175 | usb_autopm_get_interface(iface); | 202 | usb_autopm_get_interface(iface); |
176 | return 0; | 203 | return 0; |
@@ -179,8 +206,14 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) | |||
179 | static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) | 206 | static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) |
180 | { | 207 | { |
181 | struct us122l *us122l = hw->private_data; | 208 | struct us122l *us122l = hw->private_data; |
182 | struct usb_interface *iface = usb_ifnum_to_if(us122l->chip.dev, 1); | 209 | struct usb_interface *iface; |
183 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); | 210 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); |
211 | |||
212 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | ||
213 | iface = usb_ifnum_to_if(us122l->chip.dev, 0); | ||
214 | usb_autopm_put_interface(iface); | ||
215 | } | ||
216 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); | ||
184 | usb_autopm_put_interface(iface); | 217 | usb_autopm_put_interface(iface); |
185 | if (us122l->first == file) | 218 | if (us122l->first == file) |
186 | us122l->first = NULL; | 219 | us122l->first = NULL; |
@@ -443,6 +476,13 @@ static bool us122l_create_card(struct snd_card *card) | |||
443 | int err; | 476 | int err; |
444 | struct us122l *us122l = US122L(card); | 477 | struct us122l *us122l = US122L(card); |
445 | 478 | ||
479 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | ||
480 | err = usb_set_interface(us122l->chip.dev, 0, 1); | ||
481 | if (err) { | ||
482 | snd_printk(KERN_ERR "usb_set_interface error \n"); | ||
483 | return false; | ||
484 | } | ||
485 | } | ||
446 | err = usb_set_interface(us122l->chip.dev, 1, 1); | 486 | err = usb_set_interface(us122l->chip.dev, 1, 1); |
447 | if (err) { | 487 | if (err) { |
448 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 488 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
@@ -455,7 +495,10 @@ static bool us122l_create_card(struct snd_card *card) | |||
455 | if (!us122l_start(us122l, 44100, 256)) | 495 | if (!us122l_start(us122l, 44100, 256)) |
456 | return false; | 496 | return false; |
457 | 497 | ||
458 | err = us122l_create_usbmidi(card); | 498 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) |
499 | err = us144_create_usbmidi(card); | ||
500 | else | ||
501 | err = us122l_create_usbmidi(card); | ||
459 | if (err < 0) { | 502 | if (err < 0) { |
460 | snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err); | 503 | snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err); |
461 | us122l_stop(us122l); | 504 | us122l_stop(us122l); |
@@ -542,6 +585,7 @@ static int us122l_usb_probe(struct usb_interface *intf, | |||
542 | return err; | 585 | return err; |
543 | } | 586 | } |
544 | 587 | ||
588 | usb_get_intf(usb_ifnum_to_if(device, 0)); | ||
545 | usb_get_dev(device); | 589 | usb_get_dev(device); |
546 | *cardp = card; | 590 | *cardp = card; |
547 | return 0; | 591 | return 0; |
@@ -550,9 +594,16 @@ static int us122l_usb_probe(struct usb_interface *intf, | |||
550 | static int snd_us122l_probe(struct usb_interface *intf, | 594 | static int snd_us122l_probe(struct usb_interface *intf, |
551 | const struct usb_device_id *id) | 595 | const struct usb_device_id *id) |
552 | { | 596 | { |
597 | struct usb_device *device = interface_to_usbdev(intf); | ||
553 | struct snd_card *card; | 598 | struct snd_card *card; |
554 | int err; | 599 | int err; |
555 | 600 | ||
601 | if (device->descriptor.idProduct == USB_ID_US144 | ||
602 | && device->speed == USB_SPEED_HIGH) { | ||
603 | snd_printk(KERN_ERR "disable ehci-hcd to run US-144 \n"); | ||
604 | return -ENODEV; | ||
605 | } | ||
606 | |||
556 | snd_printdd(KERN_DEBUG"%p:%i\n", | 607 | snd_printdd(KERN_DEBUG"%p:%i\n", |
557 | intf, intf->cur_altsetting->desc.bInterfaceNumber); | 608 | intf, intf->cur_altsetting->desc.bInterfaceNumber); |
558 | if (intf->cur_altsetting->desc.bInterfaceNumber != 1) | 609 | if (intf->cur_altsetting->desc.bInterfaceNumber != 1) |
@@ -591,7 +642,8 @@ static void snd_us122l_disconnect(struct usb_interface *intf) | |||
591 | snd_usbmidi_disconnect(p); | 642 | snd_usbmidi_disconnect(p); |
592 | } | 643 | } |
593 | 644 | ||
594 | usb_put_intf(intf); | 645 | usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 0)); |
646 | usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 1)); | ||
595 | usb_put_dev(us122l->chip.dev); | 647 | usb_put_dev(us122l->chip.dev); |
596 | 648 | ||
597 | while (atomic_read(&us122l->mmap_count)) | 649 | while (atomic_read(&us122l->mmap_count)) |
@@ -642,6 +694,13 @@ static int snd_us122l_resume(struct usb_interface *intf) | |||
642 | 694 | ||
643 | mutex_lock(&us122l->mutex); | 695 | mutex_lock(&us122l->mutex); |
644 | /* needed, doesn't restart without: */ | 696 | /* needed, doesn't restart without: */ |
697 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | ||
698 | err = usb_set_interface(us122l->chip.dev, 0, 1); | ||
699 | if (err) { | ||
700 | snd_printk(KERN_ERR "usb_set_interface error \n"); | ||
701 | goto unlock; | ||
702 | } | ||
703 | } | ||
645 | err = usb_set_interface(us122l->chip.dev, 1, 1); | 704 | err = usb_set_interface(us122l->chip.dev, 1, 1); |
646 | if (err) { | 705 | if (err) { |
647 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 706 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
@@ -675,11 +734,11 @@ static struct usb_device_id snd_us122l_usb_id_table[] = { | |||
675 | .idVendor = 0x0644, | 734 | .idVendor = 0x0644, |
676 | .idProduct = USB_ID_US122L | 735 | .idProduct = USB_ID_US122L |
677 | }, | 736 | }, |
678 | /* { */ /* US-144 maybe works when @USB1.1. Untested. */ | 737 | { /* US-144 only works at USB1.1! Disable module ehci-hcd. */ |
679 | /* .match_flags = USB_DEVICE_ID_MATCH_DEVICE, */ | 738 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, |
680 | /* .idVendor = 0x0644, */ | 739 | .idVendor = 0x0644, |
681 | /* .idProduct = USB_ID_US144 */ | 740 | .idProduct = USB_ID_US144 |
682 | /* }, */ | 741 | }, |
683 | { /* terminator */ } | 742 | { /* terminator */ } |
684 | }; | 743 | }; |
685 | 744 | ||