diff options
36 files changed, 1463 insertions, 702 deletions
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index a87a477c87f2..b134553eb3b5 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -195,6 +195,24 @@ config RADIO_MAESTRO | |||
195 | To compile this driver as a module, choose M here: the | 195 | To compile this driver as a module, choose M here: the |
196 | module will be called radio-maestro. | 196 | module will be called radio-maestro. |
197 | 197 | ||
198 | config RADIO_MIROPCM20 | ||
199 | tristate "miroSOUND PCM20 radio" | ||
200 | depends on ISA && VIDEO_V4L2 | ||
201 | select SND_MIRO | ||
202 | ---help--- | ||
203 | Choose Y here if you have this FM radio card. You also need to enable | ||
204 | the ALSA sound system. This choice automatically selects the ALSA | ||
205 | sound card driver "Miro miroSOUND PCM1pro/PCM12/PCM20radio" as this | ||
206 | is required for the radio-miropcm20. | ||
207 | |||
208 | In order to control your radio card, you will need to use programs | ||
209 | that are compatible with the Video For Linux API. Information on | ||
210 | this API and pointers to "v4l" programs may be found at | ||
211 | <file:Documentation/video4linux/API.html>. | ||
212 | |||
213 | To compile this driver as a module, choose M here: the | ||
214 | module will be called radio-miropcm20. | ||
215 | |||
198 | config RADIO_SF16FMI | 216 | config RADIO_SF16FMI |
199 | tristate "SF16FMI Radio" | 217 | tristate "SF16FMI Radio" |
200 | depends on ISA && VIDEO_V4L2 | 218 | depends on ISA && VIDEO_V4L2 |
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile index 2a1be3bf4f7c..8a63d543ae41 100644 --- a/drivers/media/radio/Makefile +++ b/drivers/media/radio/Makefile | |||
@@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o | |||
18 | obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o | 18 | obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o |
19 | obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o | 19 | obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o |
20 | obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o | 20 | obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o |
21 | obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o | ||
21 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | 22 | obj-$(CONFIG_USB_DSBR) += dsbr100.o |
22 | obj-$(CONFIG_RADIO_SI470X) += si470x/ | 23 | obj-$(CONFIG_RADIO_SI470X) += si470x/ |
23 | obj-$(CONFIG_USB_MR800) += radio-mr800.o | 24 | obj-$(CONFIG_USB_MR800) += radio-mr800.o |
diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c new file mode 100644 index 000000000000..4ff885445fd4 --- /dev/null +++ b/drivers/media/radio/radio-miropcm20.c | |||
@@ -0,0 +1,270 @@ | |||
1 | /* Miro PCM20 radio driver for Linux radio support | ||
2 | * (c) 1998 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl> | ||
3 | * Thanks to Norberto Pellici for the ACI device interface specification | ||
4 | * The API part is based on the radiotrack driver by M. Kirkwood | ||
5 | * This driver relies on the aci mixer provided by the snd-miro | ||
6 | * ALSA driver. | ||
7 | * Look there for further info... | ||
8 | */ | ||
9 | |||
10 | /* What ever you think about the ACI, version 0x07 is not very well! | ||
11 | * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono | ||
12 | * conditions... Robert | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/videodev2.h> | ||
18 | #include <media/v4l2-device.h> | ||
19 | #include <media/v4l2-ioctl.h> | ||
20 | #include <sound/aci.h> | ||
21 | |||
22 | static int radio_nr = -1; | ||
23 | module_param(radio_nr, int, 0); | ||
24 | MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)"); | ||
25 | |||
26 | static int mono; | ||
27 | module_param(mono, bool, 0); | ||
28 | MODULE_PARM_DESC(mono, "Force tuner into mono mode."); | ||
29 | |||
30 | struct pcm20 { | ||
31 | struct v4l2_device v4l2_dev; | ||
32 | struct video_device vdev; | ||
33 | unsigned long freq; | ||
34 | int muted; | ||
35 | struct snd_miro_aci *aci; | ||
36 | }; | ||
37 | |||
38 | static struct pcm20 pcm20_card = { | ||
39 | .freq = 87*16000, | ||
40 | .muted = 1, | ||
41 | }; | ||
42 | |||
43 | static int pcm20_mute(struct pcm20 *dev, unsigned char mute) | ||
44 | { | ||
45 | dev->muted = mute; | ||
46 | return snd_aci_cmd(dev->aci, ACI_SET_TUNERMUTE, mute, -1); | ||
47 | } | ||
48 | |||
49 | static int pcm20_stereo(struct pcm20 *dev, unsigned char stereo) | ||
50 | { | ||
51 | return snd_aci_cmd(dev->aci, ACI_SET_TUNERMONO, !stereo, -1); | ||
52 | } | ||
53 | |||
54 | static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq) | ||
55 | { | ||
56 | unsigned char freql; | ||
57 | unsigned char freqh; | ||
58 | struct snd_miro_aci *aci = dev->aci; | ||
59 | |||
60 | dev->freq = freq; | ||
61 | |||
62 | freq /= 160; | ||
63 | if (!(aci->aci_version == 0x07 || aci->aci_version >= 0xb0)) | ||
64 | freq /= 10; /* I don't know exactly which version | ||
65 | * needs this hack */ | ||
66 | freql = freq & 0xff; | ||
67 | freqh = freq >> 8; | ||
68 | |||
69 | pcm20_stereo(dev, !mono); | ||
70 | return snd_aci_cmd(aci, ACI_WRITE_TUNE, freql, freqh); | ||
71 | } | ||
72 | |||
73 | static const struct v4l2_file_operations pcm20_fops = { | ||
74 | .owner = THIS_MODULE, | ||
75 | .ioctl = video_ioctl2, | ||
76 | }; | ||
77 | |||
78 | static int vidioc_querycap(struct file *file, void *priv, | ||
79 | struct v4l2_capability *v) | ||
80 | { | ||
81 | strlcpy(v->driver, "Miro PCM20", sizeof(v->driver)); | ||
82 | strlcpy(v->card, "Miro PCM20", sizeof(v->card)); | ||
83 | strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); | ||
84 | v->version = 0x1; | ||
85 | v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static int vidioc_g_tuner(struct file *file, void *priv, | ||
90 | struct v4l2_tuner *v) | ||
91 | { | ||
92 | if (v->index) /* Only 1 tuner */ | ||
93 | return -EINVAL; | ||
94 | strlcpy(v->name, "FM", sizeof(v->name)); | ||
95 | v->type = V4L2_TUNER_RADIO; | ||
96 | v->rangelow = 87*16000; | ||
97 | v->rangehigh = 108*16000; | ||
98 | v->signal = 0xffff; | ||
99 | v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | ||
100 | v->capability = V4L2_TUNER_CAP_LOW; | ||
101 | v->audmode = V4L2_TUNER_MODE_MONO; | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static int vidioc_s_tuner(struct file *file, void *priv, | ||
106 | struct v4l2_tuner *v) | ||
107 | { | ||
108 | return v->index ? -EINVAL : 0; | ||
109 | } | ||
110 | |||
111 | static int vidioc_g_frequency(struct file *file, void *priv, | ||
112 | struct v4l2_frequency *f) | ||
113 | { | ||
114 | struct pcm20 *dev = video_drvdata(file); | ||
115 | |||
116 | if (f->tuner != 0) | ||
117 | return -EINVAL; | ||
118 | |||
119 | f->type = V4L2_TUNER_RADIO; | ||
120 | f->frequency = dev->freq; | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | |||
125 | static int vidioc_s_frequency(struct file *file, void *priv, | ||
126 | struct v4l2_frequency *f) | ||
127 | { | ||
128 | struct pcm20 *dev = video_drvdata(file); | ||
129 | |||
130 | if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) | ||
131 | return -EINVAL; | ||
132 | |||
133 | dev->freq = f->frequency; | ||
134 | pcm20_setfreq(dev, f->frequency); | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static int vidioc_queryctrl(struct file *file, void *priv, | ||
139 | struct v4l2_queryctrl *qc) | ||
140 | { | ||
141 | switch (qc->id) { | ||
142 | case V4L2_CID_AUDIO_MUTE: | ||
143 | return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); | ||
144 | } | ||
145 | return -EINVAL; | ||
146 | } | ||
147 | |||
148 | static int vidioc_g_ctrl(struct file *file, void *priv, | ||
149 | struct v4l2_control *ctrl) | ||
150 | { | ||
151 | struct pcm20 *dev = video_drvdata(file); | ||
152 | |||
153 | switch (ctrl->id) { | ||
154 | case V4L2_CID_AUDIO_MUTE: | ||
155 | ctrl->value = dev->muted; | ||
156 | break; | ||
157 | default: | ||
158 | return -EINVAL; | ||
159 | } | ||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static int vidioc_s_ctrl(struct file *file, void *priv, | ||
164 | struct v4l2_control *ctrl) | ||
165 | { | ||
166 | struct pcm20 *dev = video_drvdata(file); | ||
167 | |||
168 | switch (ctrl->id) { | ||
169 | case V4L2_CID_AUDIO_MUTE: | ||
170 | pcm20_mute(dev, ctrl->value); | ||
171 | break; | ||
172 | default: | ||
173 | return -EINVAL; | ||
174 | } | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) | ||
179 | { | ||
180 | *i = 0; | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) | ||
185 | { | ||
186 | return i ? -EINVAL : 0; | ||
187 | } | ||
188 | |||
189 | static int vidioc_g_audio(struct file *file, void *priv, | ||
190 | struct v4l2_audio *a) | ||
191 | { | ||
192 | a->index = 0; | ||
193 | strlcpy(a->name, "Radio", sizeof(a->name)); | ||
194 | a->capability = V4L2_AUDCAP_STEREO; | ||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static int vidioc_s_audio(struct file *file, void *priv, | ||
199 | struct v4l2_audio *a) | ||
200 | { | ||
201 | return a->index ? -EINVAL : 0; | ||
202 | } | ||
203 | |||
204 | static const struct v4l2_ioctl_ops pcm20_ioctl_ops = { | ||
205 | .vidioc_querycap = vidioc_querycap, | ||
206 | .vidioc_g_tuner = vidioc_g_tuner, | ||
207 | .vidioc_s_tuner = vidioc_s_tuner, | ||
208 | .vidioc_g_frequency = vidioc_g_frequency, | ||
209 | .vidioc_s_frequency = vidioc_s_frequency, | ||
210 | .vidioc_queryctrl = vidioc_queryctrl, | ||
211 | .vidioc_g_ctrl = vidioc_g_ctrl, | ||
212 | .vidioc_s_ctrl = vidioc_s_ctrl, | ||
213 | .vidioc_g_audio = vidioc_g_audio, | ||
214 | .vidioc_s_audio = vidioc_s_audio, | ||
215 | .vidioc_g_input = vidioc_g_input, | ||
216 | .vidioc_s_input = vidioc_s_input, | ||
217 | }; | ||
218 | |||
219 | static int __init pcm20_init(void) | ||
220 | { | ||
221 | struct pcm20 *dev = &pcm20_card; | ||
222 | struct v4l2_device *v4l2_dev = &dev->v4l2_dev; | ||
223 | int res; | ||
224 | |||
225 | dev->aci = snd_aci_get_aci(); | ||
226 | if (dev->aci == NULL) { | ||
227 | v4l2_err(v4l2_dev, | ||
228 | "you must load the snd-miro driver first!\n"); | ||
229 | return -ENODEV; | ||
230 | } | ||
231 | strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name)); | ||
232 | |||
233 | |||
234 | res = v4l2_device_register(NULL, v4l2_dev); | ||
235 | if (res < 0) { | ||
236 | v4l2_err(v4l2_dev, "could not register v4l2_device\n"); | ||
237 | return -EINVAL; | ||
238 | } | ||
239 | |||
240 | strlcpy(dev->vdev.name, v4l2_dev->name, sizeof(dev->vdev.name)); | ||
241 | dev->vdev.v4l2_dev = v4l2_dev; | ||
242 | dev->vdev.fops = &pcm20_fops; | ||
243 | dev->vdev.ioctl_ops = &pcm20_ioctl_ops; | ||
244 | dev->vdev.release = video_device_release_empty; | ||
245 | video_set_drvdata(&dev->vdev, dev); | ||
246 | |||
247 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) | ||
248 | goto fail; | ||
249 | |||
250 | v4l2_info(v4l2_dev, "Mirosound PCM20 Radio tuner\n"); | ||
251 | return 0; | ||
252 | fail: | ||
253 | v4l2_device_unregister(v4l2_dev); | ||
254 | return -EINVAL; | ||
255 | } | ||
256 | |||
257 | MODULE_AUTHOR("Ruurd Reitsma, Krzysztof Helt"); | ||
258 | MODULE_DESCRIPTION("A driver for the Miro PCM20 radio card."); | ||
259 | MODULE_LICENSE("GPL"); | ||
260 | |||
261 | static void __exit pcm20_cleanup(void) | ||
262 | { | ||
263 | struct pcm20 *dev = &pcm20_card; | ||
264 | |||
265 | video_unregister_device(&dev->vdev); | ||
266 | v4l2_device_unregister(&dev->v4l2_dev); | ||
267 | } | ||
268 | |||
269 | module_init(pcm20_init); | ||
270 | module_exit(pcm20_cleanup); | ||
diff --git a/sound/isa/opti9xx/miro.h b/include/sound/aci.h index 6e1385b8e07e..ee639d355ef0 100644 --- a/sound/isa/opti9xx/miro.h +++ b/include/sound/aci.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _MIRO_H_ | 1 | #ifndef _ACI_H_ |
2 | #define _MIRO_H_ | 2 | #define _ACI_H_ |
3 | 3 | ||
4 | #define ACI_REG_COMMAND 0 /* write register offset */ | 4 | #define ACI_REG_COMMAND 0 /* write register offset */ |
5 | #define ACI_REG_STATUS 1 /* read register offset */ | 5 | #define ACI_REG_STATUS 1 /* read register offset */ |
@@ -70,4 +70,21 @@ | |||
70 | #define ACI_SET_EQ6 0x45 | 70 | #define ACI_SET_EQ6 0x45 |
71 | #define ACI_SET_EQ7 0x46 /* ... to Treble */ | 71 | #define ACI_SET_EQ7 0x46 /* ... to Treble */ |
72 | 72 | ||
73 | #endif /* _MIRO_H_ */ | 73 | struct snd_miro_aci { |
74 | unsigned long aci_port; | ||
75 | int aci_vendor; | ||
76 | int aci_product; | ||
77 | int aci_version; | ||
78 | int aci_amp; | ||
79 | int aci_preamp; | ||
80 | int aci_solomode; | ||
81 | |||
82 | struct mutex aci_mutex; | ||
83 | }; | ||
84 | |||
85 | int snd_aci_cmd(struct snd_miro_aci *aci, int write1, int write2, int write3); | ||
86 | |||
87 | struct snd_miro_aci *snd_aci_get_aci(void); | ||
88 | |||
89 | #endif /* _ACI_H_ */ | ||
90 | |||
diff --git a/include/sound/cs4231-regs.h b/include/sound/cs4231-regs.h index 92647532c454..66d28c2cb53d 100644 --- a/include/sound/cs4231-regs.h +++ b/include/sound/cs4231-regs.h | |||
@@ -70,7 +70,6 @@ | |||
70 | #define AD1845_PWR_DOWN 0x1b /* power down control */ | 70 | #define AD1845_PWR_DOWN 0x1b /* power down control */ |
71 | #define CS4235_LEFT_MASTER 0x1b /* left master output control */ | 71 | #define CS4235_LEFT_MASTER 0x1b /* left master output control */ |
72 | #define CS4231_REC_FORMAT 0x1c /* clock and data format - record - bits 7-0 MCE */ | 72 | #define CS4231_REC_FORMAT 0x1c /* clock and data format - record - bits 7-0 MCE */ |
73 | #define CS4231_PLY_VAR_FREQ 0x1d /* playback variable frequency */ | ||
74 | #define AD1845_CLOCK 0x1d /* crystal clock select and total power down */ | 73 | #define AD1845_CLOCK 0x1d /* crystal clock select and total power down */ |
75 | #define CS4235_RIGHT_MASTER 0x1d /* right master output control */ | 74 | #define CS4235_RIGHT_MASTER 0x1d /* right master output control */ |
76 | #define CS4231_REC_UPR_CNT 0x1e /* record upper count */ | 75 | #define CS4231_REC_UPR_CNT 0x1e /* record upper count */ |
diff --git a/include/sound/wss.h b/include/sound/wss.h index 6d65f322f1d5..fd01f22825cd 100644 --- a/include/sound/wss.h +++ b/include/sound/wss.h | |||
@@ -154,7 +154,6 @@ int snd_wss_create(struct snd_card *card, | |||
154 | unsigned short hardware, | 154 | unsigned short hardware, |
155 | unsigned short hwshare, | 155 | unsigned short hwshare, |
156 | struct snd_wss **rchip); | 156 | struct snd_wss **rchip); |
157 | int snd_wss_free(struct snd_wss *chip); | ||
158 | int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); | 157 | int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); |
159 | int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); | 158 | int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); |
160 | int snd_wss_mixer(struct snd_wss *chip); | 159 | int snd_wss_mixer(struct snd_wss *chip); |
diff --git a/sound/Kconfig b/sound/Kconfig index 439e15c8faa3..b3e53e616ec9 100644 --- a/sound/Kconfig +++ b/sound/Kconfig | |||
@@ -58,7 +58,7 @@ config SOUND_OSS_CORE_PRECLAIM | |||
58 | Please read Documentation/feature-removal-schedule.txt for | 58 | Please read Documentation/feature-removal-schedule.txt for |
59 | details. | 59 | details. |
60 | 60 | ||
61 | If unusre, say Y. | 61 | If unsure, say Y. |
62 | 62 | ||
63 | source "sound/oss/dmasound/Kconfig" | 63 | source "sound/oss/dmasound/Kconfig" |
64 | 64 | ||
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 1534f3d88bce..1497dce1b04a 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -18,10 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | #include <linux/amba/bus.h> | 20 | #include <linux/amba/bus.h> |
21 | 21 | #include <linux/io.h> | |
22 | #include <asm/io.h> | ||
23 | #include <asm/irq.h> | ||
24 | #include <asm/sizes.h> | ||
25 | 22 | ||
26 | #include <sound/core.h> | 23 | #include <sound/core.h> |
27 | #include <sound/initval.h> | 24 | #include <sound/initval.h> |
@@ -513,15 +510,9 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, | |||
513 | if (err < 0) | 510 | if (err < 0) |
514 | goto out; | 511 | goto out; |
515 | 512 | ||
516 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 513 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), |
517 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), | 514 | params_channels(params), |
518 | params_channels(params), | 515 | aacirun->pcm->r[0].slots); |
519 | aacirun->pcm->r[0].slots); | ||
520 | else | ||
521 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), | ||
522 | params_channels(params), | ||
523 | aacirun->pcm->r[0].slots); | ||
524 | |||
525 | if (err) | 516 | if (err) |
526 | goto out; | 517 | goto out; |
527 | 518 | ||
@@ -537,7 +528,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream) | |||
537 | struct aaci_runtime *aacirun = runtime->private_data; | 528 | struct aaci_runtime *aacirun = runtime->private_data; |
538 | 529 | ||
539 | aacirun->start = (void *)runtime->dma_area; | 530 | aacirun->start = (void *)runtime->dma_area; |
540 | aacirun->end = aacirun->start + runtime->dma_bytes; | 531 | aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream); |
541 | aacirun->ptr = aacirun->start; | 532 | aacirun->ptr = aacirun->start; |
542 | aacirun->period = | 533 | aacirun->period = |
543 | aacirun->bytes = frames_to_bytes(runtime, runtime->period_size); | 534 | aacirun->bytes = frames_to_bytes(runtime, runtime->period_size); |
diff --git a/sound/core/control.c b/sound/core/control.c index 73dc10ac33f6..268ab7471224 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -1119,7 +1119,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, | |||
1119 | goto __kctl_end; | 1119 | goto __kctl_end; |
1120 | } | 1120 | } |
1121 | if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { | 1121 | if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { |
1122 | if (file && vd->owner != NULL && vd->owner != file) { | 1122 | if (vd->owner != NULL && vd->owner != file) { |
1123 | err = -EPERM; | 1123 | err = -EPERM; |
1124 | goto __kctl_end; | 1124 | goto __kctl_end; |
1125 | } | 1125 | } |
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index 020a5d512472..04ae8704cdcd 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/bitrev.h> | ||
26 | #include <asm/unaligned.h> | 27 | #include <asm/unaligned.h> |
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include <sound/control.h> | 29 | #include <sound/control.h> |
@@ -55,18 +56,6 @@ struct cs8427 { | |||
55 | struct cs8427_stream capture; | 56 | struct cs8427_stream capture; |
56 | }; | 57 | }; |
57 | 58 | ||
58 | static unsigned char swapbits(unsigned char val) | ||
59 | { | ||
60 | int bit; | ||
61 | unsigned char res = 0; | ||
62 | for (bit = 0; bit < 8; bit++) { | ||
63 | res <<= 1; | ||
64 | res |= val & 1; | ||
65 | val >>= 1; | ||
66 | } | ||
67 | return res; | ||
68 | } | ||
69 | |||
70 | int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg, | 59 | int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg, |
71 | unsigned char val) | 60 | unsigned char val) |
72 | { | 61 | { |
@@ -149,7 +138,7 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device, | |||
149 | } | 138 | } |
150 | data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF; | 139 | data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF; |
151 | for (idx = 0; idx < count; idx++) | 140 | for (idx = 0; idx < count; idx++) |
152 | data[idx + 1] = swapbits(ndata[idx]); | 141 | data[idx + 1] = bitrev8(ndata[idx]); |
153 | if (snd_i2c_sendbytes(device, data, count + 1) != count + 1) | 142 | if (snd_i2c_sendbytes(device, data, count + 1) != count + 1) |
154 | return -EIO; | 143 | return -EIO; |
155 | return 1; | 144 | return 1; |
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index d31c373e076d..c4c6ef73f9bf 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -225,7 +225,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
225 | case V4L2_CID_AUDIO_MUTE: | 225 | case V4L2_CID_AUDIO_MUTE: |
226 | if (tea->ops->mute) { | 226 | if (tea->ops->mute) { |
227 | tea->ops->mute(tea, ctrl->value); | 227 | tea->ops->mute(tea, ctrl->value); |
228 | tea->mute = 1; | 228 | tea->mute = ctrl->value; |
229 | return 0; | 229 | return 0; |
230 | } | 230 | } |
231 | } | 231 | } |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index a076a6ce8071..93fa6720d197 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -394,21 +394,15 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) | |||
394 | return -EBUSY; | 394 | return -EBUSY; |
395 | } | 395 | } |
396 | 396 | ||
397 | err = snd_wss_create(card, port[dev], cport[dev], | 397 | err = snd_cs4236_create(card, port[dev], cport[dev], |
398 | irq[dev], | 398 | irq[dev], |
399 | dma1[dev], dma2[dev], | 399 | dma1[dev], dma2[dev], |
400 | WSS_HW_DETECT3, 0, &chip); | 400 | WSS_HW_DETECT3, 0, &chip); |
401 | if (err < 0) | 401 | if (err < 0) |
402 | return err; | 402 | return err; |
403 | |||
404 | acard->chip = chip; | ||
403 | if (chip->hardware & WSS_HW_CS4236B_MASK) { | 405 | if (chip->hardware & WSS_HW_CS4236B_MASK) { |
404 | snd_wss_free(chip); | ||
405 | err = snd_cs4236_create(card, | ||
406 | port[dev], cport[dev], | ||
407 | irq[dev], dma1[dev], dma2[dev], | ||
408 | WSS_HW_DETECT, 0, &chip); | ||
409 | if (err < 0) | ||
410 | return err; | ||
411 | acard->chip = chip; | ||
412 | 406 | ||
413 | err = snd_cs4236_pcm(chip, 0, &pcm); | 407 | err = snd_cs4236_pcm(chip, 0, &pcm); |
414 | if (err < 0) | 408 | if (err < 0) |
@@ -418,7 +412,6 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) | |||
418 | if (err < 0) | 412 | if (err < 0) |
419 | return err; | 413 | return err; |
420 | } else { | 414 | } else { |
421 | acard->chip = chip; | ||
422 | err = snd_wss_pcm(chip, 0, &pcm); | 415 | err = snd_wss_pcm(chip, 0, &pcm); |
423 | if (err < 0) | 416 | if (err < 0) |
424 | return err; | 417 | return err; |
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index 38835f31298b..c5adca300632 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c | |||
@@ -87,6 +87,8 @@ | |||
87 | #include <sound/core.h> | 87 | #include <sound/core.h> |
88 | #include <sound/wss.h> | 88 | #include <sound/wss.h> |
89 | #include <sound/asoundef.h> | 89 | #include <sound/asoundef.h> |
90 | #include <sound/initval.h> | ||
91 | #include <sound/tlv.h> | ||
90 | 92 | ||
91 | /* | 93 | /* |
92 | * | 94 | * |
@@ -264,7 +266,10 @@ static void snd_cs4236_resume(struct snd_wss *chip) | |||
264 | } | 266 | } |
265 | 267 | ||
266 | #endif /* CONFIG_PM */ | 268 | #endif /* CONFIG_PM */ |
267 | 269 | /* | |
270 | * This function does no fail if the chip is not CS4236B or compatible. | ||
271 | * It just an equivalent to the snd_wss_create() then. | ||
272 | */ | ||
268 | int snd_cs4236_create(struct snd_card *card, | 273 | int snd_cs4236_create(struct snd_card *card, |
269 | unsigned long port, | 274 | unsigned long port, |
270 | unsigned long cport, | 275 | unsigned long cport, |
@@ -281,21 +286,17 @@ int snd_cs4236_create(struct snd_card *card, | |||
281 | *rchip = NULL; | 286 | *rchip = NULL; |
282 | if (hardware == WSS_HW_DETECT) | 287 | if (hardware == WSS_HW_DETECT) |
283 | hardware = WSS_HW_DETECT3; | 288 | hardware = WSS_HW_DETECT3; |
284 | if (cport < 0x100) { | 289 | |
285 | snd_printk(KERN_ERR "please, specify control port " | ||
286 | "for CS4236+ chips\n"); | ||
287 | return -ENODEV; | ||
288 | } | ||
289 | err = snd_wss_create(card, port, cport, | 290 | err = snd_wss_create(card, port, cport, |
290 | irq, dma1, dma2, hardware, hwshare, &chip); | 291 | irq, dma1, dma2, hardware, hwshare, &chip); |
291 | if (err < 0) | 292 | if (err < 0) |
292 | return err; | 293 | return err; |
293 | 294 | ||
294 | if (!(chip->hardware & WSS_HW_CS4236B_MASK)) { | 295 | if ((chip->hardware & WSS_HW_CS4236B_MASK) == 0) { |
295 | snd_printk(KERN_ERR "CS4236+: MODE3 and extended registers " | 296 | snd_printd("chip is not CS4236+, hardware=0x%x\n", |
296 | "not available, hardware=0x%x\n", chip->hardware); | 297 | chip->hardware); |
297 | snd_device_free(card, chip); | 298 | *rchip = chip; |
298 | return -ENODEV; | 299 | return 0; |
299 | } | 300 | } |
300 | #if 0 | 301 | #if 0 |
301 | { | 302 | { |
@@ -308,9 +309,16 @@ int snd_cs4236_create(struct snd_card *card, | |||
308 | idx, snd_cs4236_ctrl_in(chip, idx)); | 309 | idx, snd_cs4236_ctrl_in(chip, idx)); |
309 | } | 310 | } |
310 | #endif | 311 | #endif |
312 | if (cport < 0x100 || cport == SNDRV_AUTO_PORT) { | ||
313 | snd_printk(KERN_ERR "please, specify control port " | ||
314 | "for CS4236+ chips\n"); | ||
315 | snd_device_free(card, chip); | ||
316 | return -ENODEV; | ||
317 | } | ||
311 | ver1 = snd_cs4236_ctrl_in(chip, 1); | 318 | ver1 = snd_cs4236_ctrl_in(chip, 1); |
312 | ver2 = snd_cs4236_ext_in(chip, CS4236_VERSION); | 319 | ver2 = snd_cs4236_ext_in(chip, CS4236_VERSION); |
313 | snd_printdd("CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n", cport, ver1, ver2); | 320 | snd_printdd("CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n", |
321 | cport, ver1, ver2); | ||
314 | if (ver1 != ver2) { | 322 | if (ver1 != ver2) { |
315 | snd_printk(KERN_ERR "CS4236+ chip detected, but " | 323 | snd_printk(KERN_ERR "CS4236+ chip detected, but " |
316 | "control port 0x%lx is not valid\n", cport); | 324 | "control port 0x%lx is not valid\n", cport); |
@@ -321,13 +329,17 @@ int snd_cs4236_create(struct snd_card *card, | |||
321 | snd_cs4236_ctrl_out(chip, 2, 0xff); | 329 | snd_cs4236_ctrl_out(chip, 2, 0xff); |
322 | snd_cs4236_ctrl_out(chip, 3, 0x00); | 330 | snd_cs4236_ctrl_out(chip, 3, 0x00); |
323 | snd_cs4236_ctrl_out(chip, 4, 0x80); | 331 | snd_cs4236_ctrl_out(chip, 4, 0x80); |
324 | snd_cs4236_ctrl_out(chip, 5, ((IEC958_AES1_CON_PCM_CODER & 3) << 6) | IEC958_AES0_CON_EMPHASIS_NONE); | 332 | reg = ((IEC958_AES1_CON_PCM_CODER & 3) << 6) | |
333 | IEC958_AES0_CON_EMPHASIS_NONE; | ||
334 | snd_cs4236_ctrl_out(chip, 5, reg); | ||
325 | snd_cs4236_ctrl_out(chip, 6, IEC958_AES1_CON_PCM_CODER >> 2); | 335 | snd_cs4236_ctrl_out(chip, 6, IEC958_AES1_CON_PCM_CODER >> 2); |
326 | snd_cs4236_ctrl_out(chip, 7, 0x00); | 336 | snd_cs4236_ctrl_out(chip, 7, 0x00); |
327 | /* 0x8c for C8 is valid for Turtle Beach Malibu - the IEC-958 output */ | 337 | /* |
328 | /* is working with this setup, other hardware should have */ | 338 | * 0x8c for C8 is valid for Turtle Beach Malibu - the IEC-958 |
329 | /* different signal paths and this value should be selectable */ | 339 | * output is working with this setup, other hardware should |
330 | /* in the future */ | 340 | * have different signal paths and this value should be |
341 | * selectable in the future | ||
342 | */ | ||
331 | snd_cs4236_ctrl_out(chip, 8, 0x8c); | 343 | snd_cs4236_ctrl_out(chip, 8, 0x8c); |
332 | chip->rate_constraint = snd_cs4236_xrate; | 344 | chip->rate_constraint = snd_cs4236_xrate; |
333 | chip->set_playback_format = snd_cs4236_playback_format; | 345 | chip->set_playback_format = snd_cs4236_playback_format; |
@@ -339,9 +351,10 @@ int snd_cs4236_create(struct snd_card *card, | |||
339 | 351 | ||
340 | /* initialize extended registers */ | 352 | /* initialize extended registers */ |
341 | for (reg = 0; reg < sizeof(snd_cs4236_ext_map); reg++) | 353 | for (reg = 0; reg < sizeof(snd_cs4236_ext_map); reg++) |
342 | snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), snd_cs4236_ext_map[reg]); | 354 | snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), |
355 | snd_cs4236_ext_map[reg]); | ||
343 | 356 | ||
344 | /* initialize compatible but more featured registers */ | 357 | /* initialize compatible but more featured registers */ |
345 | snd_wss_out(chip, CS4231_LEFT_INPUT, 0x40); | 358 | snd_wss_out(chip, CS4231_LEFT_INPUT, 0x40); |
346 | snd_wss_out(chip, CS4231_RIGHT_INPUT, 0x40); | 359 | snd_wss_out(chip, CS4231_RIGHT_INPUT, 0x40); |
347 | snd_wss_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff); | 360 | snd_wss_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff); |
@@ -387,6 +400,14 @@ int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm) | |||
387 | .get = snd_cs4236_get_single, .put = snd_cs4236_put_single, \ | 400 | .get = snd_cs4236_get_single, .put = snd_cs4236_put_single, \ |
388 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } | 401 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } |
389 | 402 | ||
403 | #define CS4236_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \ | ||
404 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | ||
405 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | ||
406 | .info = snd_cs4236_info_single, \ | ||
407 | .get = snd_cs4236_get_single, .put = snd_cs4236_put_single, \ | ||
408 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24), \ | ||
409 | .tlv = { .p = (xtlv) } } | ||
410 | |||
390 | static int snd_cs4236_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 411 | static int snd_cs4236_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
391 | { | 412 | { |
392 | int mask = (kcontrol->private_value >> 16) & 0xff; | 413 | int mask = (kcontrol->private_value >> 16) & 0xff; |
@@ -490,6 +511,16 @@ static int snd_cs4236_put_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
490 | .get = snd_cs4236_get_double, .put = snd_cs4236_put_double, \ | 511 | .get = snd_cs4236_get_double, .put = snd_cs4236_put_double, \ |
491 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } | 512 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } |
492 | 513 | ||
514 | #define CS4236_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, \ | ||
515 | shift_right, mask, invert, xtlv) \ | ||
516 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | ||
517 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | ||
518 | .info = snd_cs4236_info_double, \ | ||
519 | .get = snd_cs4236_get_double, .put = snd_cs4236_put_double, \ | ||
520 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \ | ||
521 | (shift_right << 19) | (mask << 24) | (invert << 22), \ | ||
522 | .tlv = { .p = (xtlv) } } | ||
523 | |||
493 | static int snd_cs4236_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 524 | static int snd_cs4236_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
494 | { | 525 | { |
495 | int mask = (kcontrol->private_value >> 24) & 0xff; | 526 | int mask = (kcontrol->private_value >> 24) & 0xff; |
@@ -560,12 +591,23 @@ static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
560 | return change; | 591 | return change; |
561 | } | 592 | } |
562 | 593 | ||
563 | #define CS4236_DOUBLE1(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ | 594 | #define CS4236_DOUBLE1(xname, xindex, left_reg, right_reg, shift_left, \ |
595 | shift_right, mask, invert) \ | ||
564 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 596 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
565 | .info = snd_cs4236_info_double, \ | 597 | .info = snd_cs4236_info_double, \ |
566 | .get = snd_cs4236_get_double1, .put = snd_cs4236_put_double1, \ | 598 | .get = snd_cs4236_get_double1, .put = snd_cs4236_put_double1, \ |
567 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } | 599 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } |
568 | 600 | ||
601 | #define CS4236_DOUBLE1_TLV(xname, xindex, left_reg, right_reg, shift_left, \ | ||
602 | shift_right, mask, invert, xtlv) \ | ||
603 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | ||
604 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | ||
605 | .info = snd_cs4236_info_double, \ | ||
606 | .get = snd_cs4236_get_double1, .put = snd_cs4236_put_double1, \ | ||
607 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \ | ||
608 | (shift_right << 19) | (mask << 24) | (invert << 22), \ | ||
609 | .tlv = { .p = (xtlv) } } | ||
610 | |||
569 | static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 611 | static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
570 | { | 612 | { |
571 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); | 613 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
@@ -619,16 +661,18 @@ static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
619 | return change; | 661 | return change; |
620 | } | 662 | } |
621 | 663 | ||
622 | #define CS4236_MASTER_DIGITAL(xname, xindex) \ | 664 | #define CS4236_MASTER_DIGITAL(xname, xindex, xtlv) \ |
623 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 665 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
666 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | ||
624 | .info = snd_cs4236_info_double, \ | 667 | .info = snd_cs4236_info_double, \ |
625 | .get = snd_cs4236_get_master_digital, .put = snd_cs4236_put_master_digital, \ | 668 | .get = snd_cs4236_get_master_digital, .put = snd_cs4236_put_master_digital, \ |
626 | .private_value = 71 << 24 } | 669 | .private_value = 71 << 24, \ |
670 | .tlv = { .p = (xtlv) } } | ||
627 | 671 | ||
628 | static inline int snd_cs4236_mixer_master_digital_invert_volume(int vol) | 672 | static inline int snd_cs4236_mixer_master_digital_invert_volume(int vol) |
629 | { | 673 | { |
630 | return (vol < 64) ? 63 - vol : 64 + (71 - vol); | 674 | return (vol < 64) ? 63 - vol : 64 + (71 - vol); |
631 | } | 675 | } |
632 | 676 | ||
633 | static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 677 | static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
634 | { | 678 | { |
@@ -661,11 +705,13 @@ static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct s | |||
661 | return change; | 705 | return change; |
662 | } | 706 | } |
663 | 707 | ||
664 | #define CS4235_OUTPUT_ACCU(xname, xindex) \ | 708 | #define CS4235_OUTPUT_ACCU(xname, xindex, xtlv) \ |
665 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 709 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
710 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | ||
666 | .info = snd_cs4236_info_double, \ | 711 | .info = snd_cs4236_info_double, \ |
667 | .get = snd_cs4235_get_output_accu, .put = snd_cs4235_put_output_accu, \ | 712 | .get = snd_cs4235_get_output_accu, .put = snd_cs4235_put_output_accu, \ |
668 | .private_value = 3 << 24 } | 713 | .private_value = 3 << 24, \ |
714 | .tlv = { .p = (xtlv) } } | ||
669 | 715 | ||
670 | static inline int snd_cs4235_mixer_output_accu_get_volume(int vol) | 716 | static inline int snd_cs4235_mixer_output_accu_get_volume(int vol) |
671 | { | 717 | { |
@@ -720,41 +766,56 @@ static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_ | |||
720 | return change; | 766 | return change; |
721 | } | 767 | } |
722 | 768 | ||
769 | static const DECLARE_TLV_DB_SCALE(db_scale_7bit, -9450, 150, 0); | ||
770 | static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); | ||
771 | static const DECLARE_TLV_DB_SCALE(db_scale_6bit_12db_max, -8250, 150, 0); | ||
772 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); | ||
773 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_22db_max, -2400, 150, 0); | ||
774 | static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); | ||
775 | static const DECLARE_TLV_DB_SCALE(db_scale_2bit, -1800, 600, 0); | ||
776 | static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); | ||
777 | |||
723 | static struct snd_kcontrol_new snd_cs4236_controls[] = { | 778 | static struct snd_kcontrol_new snd_cs4236_controls[] = { |
724 | 779 | ||
725 | CS4236_DOUBLE("Master Digital Playback Switch", 0, | 780 | CS4236_DOUBLE("Master Digital Playback Switch", 0, |
726 | CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), | 781 | CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), |
727 | CS4236_DOUBLE("Master Digital Capture Switch", 0, | 782 | CS4236_DOUBLE("Master Digital Capture Switch", 0, |
728 | CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), | 783 | CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), |
729 | CS4236_MASTER_DIGITAL("Master Digital Volume", 0), | 784 | CS4236_MASTER_DIGITAL("Master Digital Volume", 0, db_scale_7bit), |
730 | 785 | ||
731 | CS4236_DOUBLE("Capture Boost Volume", 0, | 786 | CS4236_DOUBLE_TLV("Capture Boost Volume", 0, |
732 | CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), | 787 | CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1, |
788 | db_scale_2bit), | ||
733 | 789 | ||
734 | WSS_DOUBLE("PCM Playback Switch", 0, | 790 | WSS_DOUBLE("PCM Playback Switch", 0, |
735 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 791 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
736 | WSS_DOUBLE("PCM Playback Volume", 0, | 792 | WSS_DOUBLE_TLV("PCM Playback Volume", 0, |
737 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | 793 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, |
794 | db_scale_6bit), | ||
738 | 795 | ||
739 | CS4236_DOUBLE("DSP Playback Switch", 0, | 796 | CS4236_DOUBLE("DSP Playback Switch", 0, |
740 | CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), | 797 | CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), |
741 | CS4236_DOUBLE("DSP Playback Volume", 0, | 798 | CS4236_DOUBLE_TLV("DSP Playback Volume", 0, |
742 | CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1), | 799 | CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1, |
800 | db_scale_6bit), | ||
743 | 801 | ||
744 | CS4236_DOUBLE("FM Playback Switch", 0, | 802 | CS4236_DOUBLE("FM Playback Switch", 0, |
745 | CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), | 803 | CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), |
746 | CS4236_DOUBLE("FM Playback Volume", 0, | 804 | CS4236_DOUBLE_TLV("FM Playback Volume", 0, |
747 | CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1), | 805 | CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1, |
806 | db_scale_6bit), | ||
748 | 807 | ||
749 | CS4236_DOUBLE("Wavetable Playback Switch", 0, | 808 | CS4236_DOUBLE("Wavetable Playback Switch", 0, |
750 | CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), | 809 | CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), |
751 | CS4236_DOUBLE("Wavetable Playback Volume", 0, | 810 | CS4236_DOUBLE_TLV("Wavetable Playback Volume", 0, |
752 | CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1), | 811 | CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1, |
812 | db_scale_6bit_12db_max), | ||
753 | 813 | ||
754 | WSS_DOUBLE("Synth Playback Switch", 0, | 814 | WSS_DOUBLE("Synth Playback Switch", 0, |
755 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 815 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
756 | WSS_DOUBLE("Synth Volume", 0, | 816 | WSS_DOUBLE_TLV("Synth Volume", 0, |
757 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | 817 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, |
818 | db_scale_5bit_12db_max), | ||
758 | WSS_DOUBLE("Synth Capture Switch", 0, | 819 | WSS_DOUBLE("Synth Capture Switch", 0, |
759 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), | 820 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), |
760 | WSS_DOUBLE("Synth Capture Bypass", 0, | 821 | WSS_DOUBLE("Synth Capture Bypass", 0, |
@@ -764,14 +825,16 @@ CS4236_DOUBLE("Mic Playback Switch", 0, | |||
764 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), | 825 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), |
765 | CS4236_DOUBLE("Mic Capture Switch", 0, | 826 | CS4236_DOUBLE("Mic Capture Switch", 0, |
766 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), | 827 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), |
767 | CS4236_DOUBLE("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 0, 0, 31, 1), | 828 | CS4236_DOUBLE_TLV("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, |
768 | CS4236_DOUBLE("Mic Playback Boost", 0, | 829 | 0, 0, 31, 1, db_scale_5bit_22db_max), |
830 | CS4236_DOUBLE("Mic Playback Boost (+20dB)", 0, | ||
769 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0), | 831 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0), |
770 | 832 | ||
771 | WSS_DOUBLE("Line Playback Switch", 0, | 833 | WSS_DOUBLE("Line Playback Switch", 0, |
772 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 834 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
773 | WSS_DOUBLE("Line Volume", 0, | 835 | WSS_DOUBLE_TLV("Line Volume", 0, |
774 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | 836 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, |
837 | db_scale_5bit_12db_max), | ||
775 | WSS_DOUBLE("Line Capture Switch", 0, | 838 | WSS_DOUBLE("Line Capture Switch", 0, |
776 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), | 839 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), |
777 | WSS_DOUBLE("Line Capture Bypass", 0, | 840 | WSS_DOUBLE("Line Capture Bypass", 0, |
@@ -779,57 +842,63 @@ WSS_DOUBLE("Line Capture Bypass", 0, | |||
779 | 842 | ||
780 | WSS_DOUBLE("CD Playback Switch", 0, | 843 | WSS_DOUBLE("CD Playback Switch", 0, |
781 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 844 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
782 | WSS_DOUBLE("CD Volume", 0, | 845 | WSS_DOUBLE_TLV("CD Volume", 0, |
783 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | 846 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, |
847 | db_scale_5bit_12db_max), | ||
784 | WSS_DOUBLE("CD Capture Switch", 0, | 848 | WSS_DOUBLE("CD Capture Switch", 0, |
785 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), | 849 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), |
786 | 850 | ||
787 | CS4236_DOUBLE1("Mono Output Playback Switch", 0, | 851 | CS4236_DOUBLE1("Mono Output Playback Switch", 0, |
788 | CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), | 852 | CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), |
789 | CS4236_DOUBLE1("Mono Playback Switch", 0, | 853 | CS4236_DOUBLE1("Beep Playback Switch", 0, |
790 | CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), | 854 | CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), |
791 | WSS_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | 855 | WSS_SINGLE_TLV("Beep Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1, |
792 | WSS_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), | 856 | db_scale_4bit), |
857 | WSS_SINGLE("Beep Bypass Playback Switch", 0, CS4231_MONO_CTRL, 5, 1, 0), | ||
793 | 858 | ||
794 | WSS_DOUBLE("Capture Volume", 0, | 859 | WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, |
795 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | 860 | 0, 0, 15, 0, db_scale_rec_gain), |
796 | WSS_DOUBLE("Analog Loopback Capture Switch", 0, | 861 | WSS_DOUBLE("Analog Loopback Capture Switch", 0, |
797 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), | 862 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), |
798 | 863 | ||
799 | WSS_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | 864 | WSS_SINGLE("Loopback Digital Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0), |
800 | CS4236_DOUBLE1("Digital Loopback Playback Volume", 0, | 865 | CS4236_DOUBLE1_TLV("Loopback Digital Playback Volume", 0, |
801 | CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1) | 866 | CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1, |
867 | db_scale_6bit), | ||
802 | }; | 868 | }; |
803 | 869 | ||
870 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_6db_max, -5600, 200, 0); | ||
871 | static const DECLARE_TLV_DB_SCALE(db_scale_2bit_16db_max, -2400, 800, 0); | ||
872 | |||
804 | static struct snd_kcontrol_new snd_cs4235_controls[] = { | 873 | static struct snd_kcontrol_new snd_cs4235_controls[] = { |
805 | 874 | ||
806 | WSS_DOUBLE("Master Switch", 0, | 875 | WSS_DOUBLE("Master Playback Switch", 0, |
807 | CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), | 876 | CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), |
808 | WSS_DOUBLE("Master Volume", 0, | 877 | WSS_DOUBLE_TLV("Master Playback Volume", 0, |
809 | CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1), | 878 | CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1, |
810 | 879 | db_scale_5bit_6db_max), | |
811 | CS4235_OUTPUT_ACCU("Playback Volume", 0), | ||
812 | 880 | ||
813 | CS4236_DOUBLE("Master Digital Playback Switch", 0, | 881 | CS4235_OUTPUT_ACCU("Playback Volume", 0, db_scale_2bit_16db_max), |
814 | CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), | ||
815 | CS4236_DOUBLE("Master Digital Capture Switch", 0, | ||
816 | CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), | ||
817 | CS4236_MASTER_DIGITAL("Master Digital Volume", 0), | ||
818 | 882 | ||
819 | WSS_DOUBLE("Master Digital Playback Switch", 1, | 883 | WSS_DOUBLE("Synth Playback Switch", 1, |
820 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 884 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
821 | WSS_DOUBLE("Master Digital Capture Switch", 1, | 885 | WSS_DOUBLE("Synth Capture Switch", 1, |
822 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), | 886 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), |
823 | WSS_DOUBLE("Master Digital Volume", 1, | 887 | WSS_DOUBLE_TLV("Synth Volume", 1, |
824 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | 888 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, |
889 | db_scale_5bit_12db_max), | ||
825 | 890 | ||
826 | CS4236_DOUBLE("Capture Volume", 0, | 891 | CS4236_DOUBLE_TLV("Capture Volume", 0, |
827 | CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), | 892 | CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1, |
893 | db_scale_2bit), | ||
828 | 894 | ||
829 | WSS_DOUBLE("PCM Switch", 0, | 895 | WSS_DOUBLE("PCM Playback Switch", 0, |
830 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 896 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
831 | WSS_DOUBLE("PCM Volume", 0, | 897 | WSS_DOUBLE("PCM Capture Switch", 0, |
832 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | 898 | CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), |
899 | WSS_DOUBLE_TLV("PCM Volume", 0, | ||
900 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, | ||
901 | db_scale_6bit), | ||
833 | 902 | ||
834 | CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), | 903 | CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), |
835 | 904 | ||
@@ -842,29 +911,29 @@ CS4236_DOUBLE("Mic Capture Switch", 0, | |||
842 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), | 911 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), |
843 | CS4236_DOUBLE("Mic Playback Switch", 0, | 912 | CS4236_DOUBLE("Mic Playback Switch", 0, |
844 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), | 913 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), |
845 | CS4236_SINGLE("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1), | 914 | CS4236_SINGLE_TLV("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1, |
846 | CS4236_SINGLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, 5, 1, 0), | 915 | db_scale_5bit_22db_max), |
916 | CS4236_SINGLE("Mic Boost (+20dB)", 0, CS4236_LEFT_MIC, 5, 1, 0), | ||
847 | 917 | ||
848 | WSS_DOUBLE("Aux Playback Switch", 0, | 918 | WSS_DOUBLE("Line Playback Switch", 0, |
849 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 919 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
850 | WSS_DOUBLE("Aux Capture Switch", 0, | 920 | WSS_DOUBLE("Line Capture Switch", 0, |
851 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), | 921 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), |
852 | WSS_DOUBLE("Aux Volume", 0, | 922 | WSS_DOUBLE_TLV("Line Volume", 0, |
853 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | 923 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, |
924 | db_scale_5bit_12db_max), | ||
854 | 925 | ||
855 | WSS_DOUBLE("Aux Playback Switch", 1, | 926 | WSS_DOUBLE("CD Playback Switch", 1, |
856 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 927 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
857 | WSS_DOUBLE("Aux Capture Switch", 1, | 928 | WSS_DOUBLE("CD Capture Switch", 1, |
858 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), | 929 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), |
859 | WSS_DOUBLE("Aux Volume", 1, | 930 | WSS_DOUBLE_TLV("CD Volume", 1, |
860 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | 931 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, |
861 | 932 | db_scale_5bit_12db_max), | |
862 | CS4236_DOUBLE1("Master Mono Switch", 0, | ||
863 | CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), | ||
864 | 933 | ||
865 | CS4236_DOUBLE1("Mono Switch", 0, | 934 | CS4236_DOUBLE1("Beep Playback Switch", 0, |
866 | CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), | 935 | CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), |
867 | WSS_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | 936 | WSS_SINGLE("Beep Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), |
868 | 937 | ||
869 | WSS_DOUBLE("Analog Loopback Switch", 0, | 938 | WSS_DOUBLE("Analog Loopback Switch", 0, |
870 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), | 939 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index e5bf3355d2ca..9a43baae7250 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -102,8 +102,6 @@ | |||
102 | 102 | ||
103 | struct snd_es18xx { | 103 | struct snd_es18xx { |
104 | unsigned long port; /* port of ESS chip */ | 104 | unsigned long port; /* port of ESS chip */ |
105 | unsigned long mpu_port; /* MPU-401 port of ESS chip */ | ||
106 | unsigned long fm_port; /* FM port */ | ||
107 | unsigned long ctrl_port; /* Control port of ESS chip */ | 105 | unsigned long ctrl_port; /* Control port of ESS chip */ |
108 | struct resource *res_port; | 106 | struct resource *res_port; |
109 | struct resource *res_mpu_port; | 107 | struct resource *res_mpu_port; |
@@ -116,8 +114,6 @@ struct snd_es18xx { | |||
116 | unsigned short audio2_vol; /* volume level of audio2 */ | 114 | unsigned short audio2_vol; /* volume level of audio2 */ |
117 | 115 | ||
118 | unsigned short active; /* active channel mask */ | 116 | unsigned short active; /* active channel mask */ |
119 | unsigned int dma1_size; | ||
120 | unsigned int dma2_size; | ||
121 | unsigned int dma1_shift; | 117 | unsigned int dma1_shift; |
122 | unsigned int dma2_shift; | 118 | unsigned int dma2_shift; |
123 | 119 | ||
@@ -135,7 +131,6 @@ struct snd_es18xx { | |||
135 | 131 | ||
136 | spinlock_t reg_lock; | 132 | spinlock_t reg_lock; |
137 | spinlock_t mixer_lock; | 133 | spinlock_t mixer_lock; |
138 | spinlock_t ctrl_lock; | ||
139 | #ifdef CONFIG_PM | 134 | #ifdef CONFIG_PM |
140 | unsigned char pm_reg; | 135 | unsigned char pm_reg; |
141 | #endif | 136 | #endif |
@@ -354,7 +349,7 @@ static inline int snd_es18xx_mixer_writable(struct snd_es18xx *chip, unsigned ch | |||
354 | } | 349 | } |
355 | 350 | ||
356 | 351 | ||
357 | static int snd_es18xx_reset(struct snd_es18xx *chip) | 352 | static int __devinit snd_es18xx_reset(struct snd_es18xx *chip) |
358 | { | 353 | { |
359 | int i; | 354 | int i; |
360 | outb(0x03, chip->port + 0x06); | 355 | outb(0x03, chip->port + 0x06); |
@@ -490,8 +485,6 @@ static int snd_es18xx_playback1_prepare(struct snd_es18xx *chip, | |||
490 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | 485 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); |
491 | unsigned int count = snd_pcm_lib_period_bytes(substream); | 486 | unsigned int count = snd_pcm_lib_period_bytes(substream); |
492 | 487 | ||
493 | chip->dma2_size = size; | ||
494 | |||
495 | snd_es18xx_rate_set(chip, substream, DAC2); | 488 | snd_es18xx_rate_set(chip, substream, DAC2); |
496 | 489 | ||
497 | /* Transfer Count Reload */ | 490 | /* Transfer Count Reload */ |
@@ -591,8 +584,6 @@ static int snd_es18xx_capture_prepare(struct snd_pcm_substream *substream) | |||
591 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | 584 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); |
592 | unsigned int count = snd_pcm_lib_period_bytes(substream); | 585 | unsigned int count = snd_pcm_lib_period_bytes(substream); |
593 | 586 | ||
594 | chip->dma1_size = size; | ||
595 | |||
596 | snd_es18xx_reset_fifo(chip); | 587 | snd_es18xx_reset_fifo(chip); |
597 | 588 | ||
598 | /* Set stereo/mono */ | 589 | /* Set stereo/mono */ |
@@ -659,8 +650,6 @@ static int snd_es18xx_playback2_prepare(struct snd_es18xx *chip, | |||
659 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | 650 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); |
660 | unsigned int count = snd_pcm_lib_period_bytes(substream); | 651 | unsigned int count = snd_pcm_lib_period_bytes(substream); |
661 | 652 | ||
662 | chip->dma1_size = size; | ||
663 | |||
664 | snd_es18xx_reset_fifo(chip); | 653 | snd_es18xx_reset_fifo(chip); |
665 | 654 | ||
666 | /* Set stereo/mono */ | 655 | /* Set stereo/mono */ |
@@ -821,17 +810,18 @@ static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) | |||
821 | static snd_pcm_uframes_t snd_es18xx_playback_pointer(struct snd_pcm_substream *substream) | 810 | static snd_pcm_uframes_t snd_es18xx_playback_pointer(struct snd_pcm_substream *substream) |
822 | { | 811 | { |
823 | struct snd_es18xx *chip = snd_pcm_substream_chip(substream); | 812 | struct snd_es18xx *chip = snd_pcm_substream_chip(substream); |
813 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | ||
824 | int pos; | 814 | int pos; |
825 | 815 | ||
826 | if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) { | 816 | if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) { |
827 | if (!(chip->active & DAC2)) | 817 | if (!(chip->active & DAC2)) |
828 | return 0; | 818 | return 0; |
829 | pos = snd_dma_pointer(chip->dma2, chip->dma2_size); | 819 | pos = snd_dma_pointer(chip->dma2, size); |
830 | return pos >> chip->dma2_shift; | 820 | return pos >> chip->dma2_shift; |
831 | } else { | 821 | } else { |
832 | if (!(chip->active & DAC1)) | 822 | if (!(chip->active & DAC1)) |
833 | return 0; | 823 | return 0; |
834 | pos = snd_dma_pointer(chip->dma1, chip->dma1_size); | 824 | pos = snd_dma_pointer(chip->dma1, size); |
835 | return pos >> chip->dma1_shift; | 825 | return pos >> chip->dma1_shift; |
836 | } | 826 | } |
837 | } | 827 | } |
@@ -839,11 +829,12 @@ static snd_pcm_uframes_t snd_es18xx_playback_pointer(struct snd_pcm_substream *s | |||
839 | static snd_pcm_uframes_t snd_es18xx_capture_pointer(struct snd_pcm_substream *substream) | 829 | static snd_pcm_uframes_t snd_es18xx_capture_pointer(struct snd_pcm_substream *substream) |
840 | { | 830 | { |
841 | struct snd_es18xx *chip = snd_pcm_substream_chip(substream); | 831 | struct snd_es18xx *chip = snd_pcm_substream_chip(substream); |
832 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | ||
842 | int pos; | 833 | int pos; |
843 | 834 | ||
844 | if (!(chip->active & ADC1)) | 835 | if (!(chip->active & ADC1)) |
845 | return 0; | 836 | return 0; |
846 | pos = snd_dma_pointer(chip->dma1, chip->dma1_size); | 837 | pos = snd_dma_pointer(chip->dma1, size); |
847 | return pos >> chip->dma1_shift; | 838 | return pos >> chip->dma1_shift; |
848 | } | 839 | } |
849 | 840 | ||
@@ -974,9 +965,6 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream) | |||
974 | 965 | ||
975 | static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 966 | static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
976 | { | 967 | { |
977 | static char *texts4Source[4] = { | ||
978 | "Mic", "CD", "Line", "Master" | ||
979 | }; | ||
980 | static char *texts5Source[5] = { | 968 | static char *texts5Source[5] = { |
981 | "Mic", "CD", "Line", "Master", "Mix" | 969 | "Mic", "CD", "Line", "Master", "Mix" |
982 | }; | 970 | }; |
@@ -994,7 +982,8 @@ static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
994 | uinfo->value.enumerated.items = 4; | 982 | uinfo->value.enumerated.items = 4; |
995 | if (uinfo->value.enumerated.item > 3) | 983 | if (uinfo->value.enumerated.item > 3) |
996 | uinfo->value.enumerated.item = 3; | 984 | uinfo->value.enumerated.item = 3; |
997 | strcpy(uinfo->value.enumerated.name, texts4Source[uinfo->value.enumerated.item]); | 985 | strcpy(uinfo->value.enumerated.name, |
986 | texts5Source[uinfo->value.enumerated.item]); | ||
998 | break; | 987 | break; |
999 | case 0x1887: | 988 | case 0x1887: |
1000 | case 0x1888: | 989 | case 0x1888: |
@@ -1378,11 +1367,9 @@ ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), | |||
1378 | static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) | 1367 | static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) |
1379 | { | 1368 | { |
1380 | int data; | 1369 | int data; |
1381 | unsigned long flags; | 1370 | |
1382 | spin_lock_irqsave(&chip->ctrl_lock, flags); | ||
1383 | outb(reg, chip->ctrl_port); | 1371 | outb(reg, chip->ctrl_port); |
1384 | data = inb(chip->ctrl_port + 1); | 1372 | data = inb(chip->ctrl_port + 1); |
1385 | spin_unlock_irqrestore(&chip->ctrl_lock, flags); | ||
1386 | return data; | 1373 | return data; |
1387 | } | 1374 | } |
1388 | 1375 | ||
@@ -1398,7 +1385,9 @@ static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip, | |||
1398 | #endif | 1385 | #endif |
1399 | } | 1386 | } |
1400 | 1387 | ||
1401 | static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) | 1388 | static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip, |
1389 | unsigned long mpu_port, | ||
1390 | unsigned long fm_port) | ||
1402 | { | 1391 | { |
1403 | int mask = 0; | 1392 | int mask = 0; |
1404 | 1393 | ||
@@ -1412,15 +1401,15 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) | |||
1412 | if (chip->caps & ES18XX_CONTROL) { | 1401 | if (chip->caps & ES18XX_CONTROL) { |
1413 | /* Hardware volume IRQ */ | 1402 | /* Hardware volume IRQ */ |
1414 | snd_es18xx_config_write(chip, 0x27, chip->irq); | 1403 | snd_es18xx_config_write(chip, 0x27, chip->irq); |
1415 | if (chip->fm_port > 0 && chip->fm_port != SNDRV_AUTO_PORT) { | 1404 | if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) { |
1416 | /* FM I/O */ | 1405 | /* FM I/O */ |
1417 | snd_es18xx_config_write(chip, 0x62, chip->fm_port >> 8); | 1406 | snd_es18xx_config_write(chip, 0x62, fm_port >> 8); |
1418 | snd_es18xx_config_write(chip, 0x63, chip->fm_port & 0xff); | 1407 | snd_es18xx_config_write(chip, 0x63, fm_port & 0xff); |
1419 | } | 1408 | } |
1420 | if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { | 1409 | if (mpu_port > 0 && mpu_port != SNDRV_AUTO_PORT) { |
1421 | /* MPU-401 I/O */ | 1410 | /* MPU-401 I/O */ |
1422 | snd_es18xx_config_write(chip, 0x64, chip->mpu_port >> 8); | 1411 | snd_es18xx_config_write(chip, 0x64, mpu_port >> 8); |
1423 | snd_es18xx_config_write(chip, 0x65, chip->mpu_port & 0xff); | 1412 | snd_es18xx_config_write(chip, 0x65, mpu_port & 0xff); |
1424 | /* MPU-401 IRQ */ | 1413 | /* MPU-401 IRQ */ |
1425 | snd_es18xx_config_write(chip, 0x28, chip->irq); | 1414 | snd_es18xx_config_write(chip, 0x28, chip->irq); |
1426 | } | 1415 | } |
@@ -1507,11 +1496,12 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) | |||
1507 | snd_es18xx_mixer_write(chip, 0x7A, 0x68); | 1496 | snd_es18xx_mixer_write(chip, 0x7A, 0x68); |
1508 | /* Enable and set hardware volume interrupt */ | 1497 | /* Enable and set hardware volume interrupt */ |
1509 | snd_es18xx_mixer_write(chip, 0x64, 0x06); | 1498 | snd_es18xx_mixer_write(chip, 0x64, 0x06); |
1510 | if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { | 1499 | if (mpu_port > 0 && mpu_port != SNDRV_AUTO_PORT) { |
1511 | /* MPU401 share irq with audio | 1500 | /* MPU401 share irq with audio |
1512 | Joystick enabled | 1501 | Joystick enabled |
1513 | FM enabled */ | 1502 | FM enabled */ |
1514 | snd_es18xx_mixer_write(chip, 0x40, 0x43 | (chip->mpu_port & 0xf0) >> 1); | 1503 | snd_es18xx_mixer_write(chip, 0x40, |
1504 | 0x43 | (mpu_port & 0xf0) >> 1); | ||
1515 | } | 1505 | } |
1516 | snd_es18xx_mixer_write(chip, 0x7f, ((irqmask + 1) << 1) | 0x01); | 1506 | snd_es18xx_mixer_write(chip, 0x7f, ((irqmask + 1) << 1) | 0x01); |
1517 | } | 1507 | } |
@@ -1629,7 +1619,9 @@ static int __devinit snd_es18xx_identify(struct snd_es18xx *chip) | |||
1629 | return 0; | 1619 | return 0; |
1630 | } | 1620 | } |
1631 | 1621 | ||
1632 | static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) | 1622 | static int __devinit snd_es18xx_probe(struct snd_es18xx *chip, |
1623 | unsigned long mpu_port, | ||
1624 | unsigned long fm_port) | ||
1633 | { | 1625 | { |
1634 | if (snd_es18xx_identify(chip) < 0) { | 1626 | if (snd_es18xx_identify(chip) < 0) { |
1635 | snd_printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port); | 1627 | snd_printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port); |
@@ -1650,8 +1642,6 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) | |||
1650 | chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; | 1642 | chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; |
1651 | break; | 1643 | break; |
1652 | case 0x1887: | 1644 | case 0x1887: |
1653 | chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; | ||
1654 | break; | ||
1655 | case 0x1888: | 1645 | case 0x1888: |
1656 | chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; | 1646 | chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; |
1657 | break; | 1647 | break; |
@@ -1666,7 +1656,7 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) | |||
1666 | if (chip->dma1 == chip->dma2) | 1656 | if (chip->dma1 == chip->dma2) |
1667 | chip->caps &= ~(ES18XX_PCM2 | ES18XX_DUPLEX_SAME); | 1657 | chip->caps &= ~(ES18XX_PCM2 | ES18XX_DUPLEX_SAME); |
1668 | 1658 | ||
1669 | return snd_es18xx_initialize(chip); | 1659 | return snd_es18xx_initialize(chip, mpu_port, fm_port); |
1670 | } | 1660 | } |
1671 | 1661 | ||
1672 | static struct snd_pcm_ops snd_es18xx_playback_ops = { | 1662 | static struct snd_pcm_ops snd_es18xx_playback_ops = { |
@@ -1802,10 +1792,7 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, | |||
1802 | 1792 | ||
1803 | spin_lock_init(&chip->reg_lock); | 1793 | spin_lock_init(&chip->reg_lock); |
1804 | spin_lock_init(&chip->mixer_lock); | 1794 | spin_lock_init(&chip->mixer_lock); |
1805 | spin_lock_init(&chip->ctrl_lock); | ||
1806 | chip->port = port; | 1795 | chip->port = port; |
1807 | chip->mpu_port = mpu_port; | ||
1808 | chip->fm_port = fm_port; | ||
1809 | chip->irq = -1; | 1796 | chip->irq = -1; |
1810 | chip->dma1 = -1; | 1797 | chip->dma1 = -1; |
1811 | chip->dma2 = -1; | 1798 | chip->dma2 = -1; |
@@ -1841,11 +1828,11 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, | |||
1841 | } | 1828 | } |
1842 | chip->dma2 = dma2; | 1829 | chip->dma2 = dma2; |
1843 | 1830 | ||
1844 | if (snd_es18xx_probe(chip) < 0) { | 1831 | if (snd_es18xx_probe(chip, mpu_port, fm_port) < 0) { |
1845 | snd_es18xx_free(card); | 1832 | snd_es18xx_free(card); |
1846 | return -ENODEV; | 1833 | return -ENODEV; |
1847 | } | 1834 | } |
1848 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, NULL, &ops); | 1835 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
1849 | if (err < 0) { | 1836 | if (err < 0) { |
1850 | snd_es18xx_free(card); | 1837 | snd_es18xx_free(card); |
1851 | return err; | 1838 | return err; |
@@ -1980,7 +1967,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | |||
1980 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 1967 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
1981 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ | 1968 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ |
1982 | #ifdef CONFIG_PNP | 1969 | #ifdef CONFIG_PNP |
1983 | static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; | 1970 | static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; |
1984 | #endif | 1971 | #endif |
1985 | static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ | 1972 | static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ |
1986 | #ifndef CONFIG_PNP | 1973 | #ifndef CONFIG_PNP |
@@ -2160,19 +2147,23 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) | |||
2160 | return err; | 2147 | return err; |
2161 | 2148 | ||
2162 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { | 2149 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { |
2163 | if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { | 2150 | if (snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2, |
2164 | snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port); | 2151 | OPL3_HW_OPL3, 0, &opl3) < 0) { |
2152 | snd_printk(KERN_WARNING PFX | ||
2153 | "opl3 not detected at 0x%lx\n", | ||
2154 | fm_port[dev]); | ||
2165 | } else { | 2155 | } else { |
2166 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) | 2156 | err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); |
2157 | if (err < 0) | ||
2167 | return err; | 2158 | return err; |
2168 | } | 2159 | } |
2169 | } | 2160 | } |
2170 | 2161 | ||
2171 | if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { | 2162 | if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { |
2172 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, | 2163 | err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, |
2173 | chip->mpu_port, 0, | 2164 | mpu_port[dev], 0, |
2174 | irq[dev], 0, | 2165 | irq[dev], 0, &chip->rmidi); |
2175 | &chip->rmidi)) < 0) | 2166 | if (err < 0) |
2176 | return err; | 2167 | return err; |
2177 | } | 2168 | } |
2178 | 2169 | ||
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 02e30d7c6a93..6123c7531110 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/isa.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/pnp.h> | ||
28 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
30 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
@@ -40,7 +41,7 @@ | |||
40 | #define SNDRV_LEGACY_FIND_FREE_IRQ | 41 | #define SNDRV_LEGACY_FIND_FREE_IRQ |
41 | #define SNDRV_LEGACY_FIND_FREE_DMA | 42 | #define SNDRV_LEGACY_FIND_FREE_DMA |
42 | #include <sound/initval.h> | 43 | #include <sound/initval.h> |
43 | #include "miro.h" | 44 | #include <sound/aci.h> |
44 | 45 | ||
45 | MODULE_AUTHOR("Martin Langer <martin-langer@gmx.de>"); | 46 | MODULE_AUTHOR("Martin Langer <martin-langer@gmx.de>"); |
46 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
@@ -60,6 +61,9 @@ static int dma1 = SNDRV_DEFAULT_DMA1; /* 0,1,3 */ | |||
60 | static int dma2 = SNDRV_DEFAULT_DMA1; /* 0,1,3 */ | 61 | static int dma2 = SNDRV_DEFAULT_DMA1; /* 0,1,3 */ |
61 | static int wss; | 62 | static int wss; |
62 | static int ide; | 63 | static int ide; |
64 | #ifdef CONFIG_PNP | ||
65 | static int isapnp = 1; /* Enable ISA PnP detection */ | ||
66 | #endif | ||
63 | 67 | ||
64 | module_param(index, int, 0444); | 68 | module_param(index, int, 0444); |
65 | MODULE_PARM_DESC(index, "Index value for miro soundcard."); | 69 | MODULE_PARM_DESC(index, "Index value for miro soundcard."); |
@@ -83,6 +87,10 @@ module_param(wss, int, 0444); | |||
83 | MODULE_PARM_DESC(wss, "wss mode"); | 87 | MODULE_PARM_DESC(wss, "wss mode"); |
84 | module_param(ide, int, 0444); | 88 | module_param(ide, int, 0444); |
85 | MODULE_PARM_DESC(ide, "enable ide port"); | 89 | MODULE_PARM_DESC(ide, "enable ide port"); |
90 | #ifdef CONFIG_PNP | ||
91 | module_param(isapnp, bool, 0444); | ||
92 | MODULE_PARM_DESC(isapnp, "Enable ISA PnP detection for specified soundcard."); | ||
93 | #endif | ||
86 | 94 | ||
87 | #define OPTi9XX_HW_DETECT 0 | 95 | #define OPTi9XX_HW_DETECT 0 |
88 | #define OPTi9XX_HW_82C928 1 | 96 | #define OPTi9XX_HW_82C928 1 |
@@ -96,7 +104,6 @@ MODULE_PARM_DESC(ide, "enable ide port"); | |||
96 | 104 | ||
97 | #define OPTi9XX_MC_REG(n) n | 105 | #define OPTi9XX_MC_REG(n) n |
98 | 106 | ||
99 | |||
100 | struct snd_miro { | 107 | struct snd_miro { |
101 | unsigned short hardware; | 108 | unsigned short hardware; |
102 | unsigned char password; | 109 | unsigned char password; |
@@ -110,7 +117,6 @@ struct snd_miro { | |||
110 | unsigned long pwd_reg; | 117 | unsigned long pwd_reg; |
111 | 118 | ||
112 | spinlock_t lock; | 119 | spinlock_t lock; |
113 | struct snd_card *card; | ||
114 | struct snd_pcm *pcm; | 120 | struct snd_pcm *pcm; |
115 | 121 | ||
116 | long wss_base; | 122 | long wss_base; |
@@ -118,23 +124,13 @@ struct snd_miro { | |||
118 | int dma1; | 124 | int dma1; |
119 | int dma2; | 125 | int dma2; |
120 | 126 | ||
121 | long fm_port; | ||
122 | |||
123 | long mpu_port; | 127 | long mpu_port; |
124 | int mpu_irq; | 128 | int mpu_irq; |
125 | 129 | ||
126 | unsigned long aci_port; | 130 | struct snd_miro_aci *aci; |
127 | int aci_vendor; | ||
128 | int aci_product; | ||
129 | int aci_version; | ||
130 | int aci_amp; | ||
131 | int aci_preamp; | ||
132 | int aci_solomode; | ||
133 | |||
134 | struct mutex aci_mutex; | ||
135 | }; | 131 | }; |
136 | 132 | ||
137 | static void snd_miro_proc_init(struct snd_miro * miro); | 133 | static struct snd_miro_aci aci_device; |
138 | 134 | ||
139 | static char * snd_opti9xx_names[] = { | 135 | static char * snd_opti9xx_names[] = { |
140 | "unkown", | 136 | "unkown", |
@@ -143,17 +139,33 @@ static char * snd_opti9xx_names[] = { | |||
143 | "82C930", "82C931", "82C933" | 139 | "82C930", "82C931", "82C933" |
144 | }; | 140 | }; |
145 | 141 | ||
142 | static int snd_miro_pnp_is_probed; | ||
143 | |||
144 | #ifdef CONFIG_PNP | ||
145 | |||
146 | static struct pnp_card_device_id snd_miro_pnpids[] = { | ||
147 | /* PCM20 and PCM12 in PnP mode */ | ||
148 | { .id = "MIR0924", | ||
149 | .devs = { { "MIR0000" }, { "MIR0002" }, { "MIR0005" } }, }, | ||
150 | { .id = "" } | ||
151 | }; | ||
152 | |||
153 | MODULE_DEVICE_TABLE(pnp_card, snd_miro_pnpids); | ||
154 | |||
155 | #endif /* CONFIG_PNP */ | ||
156 | |||
146 | /* | 157 | /* |
147 | * ACI control | 158 | * ACI control |
148 | */ | 159 | */ |
149 | 160 | ||
150 | static int aci_busy_wait(struct snd_miro * miro) | 161 | static int aci_busy_wait(struct snd_miro_aci *aci) |
151 | { | 162 | { |
152 | long timeout; | 163 | long timeout; |
153 | unsigned char byte; | 164 | unsigned char byte; |
154 | 165 | ||
155 | for (timeout = 1; timeout <= ACI_MINTIME+30; timeout++) { | 166 | for (timeout = 1; timeout <= ACI_MINTIME + 30; timeout++) { |
156 | if (((byte=inb(miro->aci_port + ACI_REG_BUSY)) & 1) == 0) { | 167 | byte = inb(aci->aci_port + ACI_REG_BUSY); |
168 | if ((byte & 1) == 0) { | ||
157 | if (timeout >= ACI_MINTIME) | 169 | if (timeout >= ACI_MINTIME) |
158 | snd_printd("aci ready in round %ld.\n", | 170 | snd_printd("aci ready in round %ld.\n", |
159 | timeout-ACI_MINTIME); | 171 | timeout-ACI_MINTIME); |
@@ -179,10 +191,10 @@ static int aci_busy_wait(struct snd_miro * miro) | |||
179 | return -EBUSY; | 191 | return -EBUSY; |
180 | } | 192 | } |
181 | 193 | ||
182 | static inline int aci_write(struct snd_miro * miro, unsigned char byte) | 194 | static inline int aci_write(struct snd_miro_aci *aci, unsigned char byte) |
183 | { | 195 | { |
184 | if (aci_busy_wait(miro) >= 0) { | 196 | if (aci_busy_wait(aci) >= 0) { |
185 | outb(byte, miro->aci_port + ACI_REG_COMMAND); | 197 | outb(byte, aci->aci_port + ACI_REG_COMMAND); |
186 | return 0; | 198 | return 0; |
187 | } else { | 199 | } else { |
188 | snd_printk(KERN_ERR "aci busy, aci_write(0x%x) stopped.\n", byte); | 200 | snd_printk(KERN_ERR "aci busy, aci_write(0x%x) stopped.\n", byte); |
@@ -190,12 +202,12 @@ static inline int aci_write(struct snd_miro * miro, unsigned char byte) | |||
190 | } | 202 | } |
191 | } | 203 | } |
192 | 204 | ||
193 | static inline int aci_read(struct snd_miro * miro) | 205 | static inline int aci_read(struct snd_miro_aci *aci) |
194 | { | 206 | { |
195 | unsigned char byte; | 207 | unsigned char byte; |
196 | 208 | ||
197 | if (aci_busy_wait(miro) >= 0) { | 209 | if (aci_busy_wait(aci) >= 0) { |
198 | byte=inb(miro->aci_port + ACI_REG_STATUS); | 210 | byte = inb(aci->aci_port + ACI_REG_STATUS); |
199 | return byte; | 211 | return byte; |
200 | } else { | 212 | } else { |
201 | snd_printk(KERN_ERR "aci busy, aci_read() stopped.\n"); | 213 | snd_printk(KERN_ERR "aci busy, aci_read() stopped.\n"); |
@@ -203,39 +215,49 @@ static inline int aci_read(struct snd_miro * miro) | |||
203 | } | 215 | } |
204 | } | 216 | } |
205 | 217 | ||
206 | static int aci_cmd(struct snd_miro * miro, int write1, int write2, int write3) | 218 | int snd_aci_cmd(struct snd_miro_aci *aci, int write1, int write2, int write3) |
207 | { | 219 | { |
208 | int write[] = {write1, write2, write3}; | 220 | int write[] = {write1, write2, write3}; |
209 | int value, i; | 221 | int value, i; |
210 | 222 | ||
211 | if (mutex_lock_interruptible(&miro->aci_mutex)) | 223 | if (mutex_lock_interruptible(&aci->aci_mutex)) |
212 | return -EINTR; | 224 | return -EINTR; |
213 | 225 | ||
214 | for (i=0; i<3; i++) { | 226 | for (i=0; i<3; i++) { |
215 | if (write[i]< 0 || write[i] > 255) | 227 | if (write[i]< 0 || write[i] > 255) |
216 | break; | 228 | break; |
217 | else { | 229 | else { |
218 | value = aci_write(miro, write[i]); | 230 | value = aci_write(aci, write[i]); |
219 | if (value < 0) | 231 | if (value < 0) |
220 | goto out; | 232 | goto out; |
221 | } | 233 | } |
222 | } | 234 | } |
223 | 235 | ||
224 | value = aci_read(miro); | 236 | value = aci_read(aci); |
225 | 237 | ||
226 | out: mutex_unlock(&miro->aci_mutex); | 238 | out: mutex_unlock(&aci->aci_mutex); |
227 | return value; | 239 | return value; |
228 | } | 240 | } |
241 | EXPORT_SYMBOL(snd_aci_cmd); | ||
242 | |||
243 | static int aci_getvalue(struct snd_miro_aci *aci, unsigned char index) | ||
244 | { | ||
245 | return snd_aci_cmd(aci, ACI_STATUS, index, -1); | ||
246 | } | ||
229 | 247 | ||
230 | static int aci_getvalue(struct snd_miro * miro, unsigned char index) | 248 | static int aci_setvalue(struct snd_miro_aci *aci, unsigned char index, |
249 | int value) | ||
231 | { | 250 | { |
232 | return aci_cmd(miro, ACI_STATUS, index, -1); | 251 | return snd_aci_cmd(aci, index, value, -1); |
233 | } | 252 | } |
234 | 253 | ||
235 | static int aci_setvalue(struct snd_miro * miro, unsigned char index, int value) | 254 | struct snd_miro_aci *snd_aci_get_aci(void) |
236 | { | 255 | { |
237 | return aci_cmd(miro, index, value, -1); | 256 | if (aci_device.aci_port == 0) |
257 | return NULL; | ||
258 | return &aci_device; | ||
238 | } | 259 | } |
260 | EXPORT_SYMBOL(snd_aci_get_aci); | ||
239 | 261 | ||
240 | /* | 262 | /* |
241 | * MIXER part | 263 | * MIXER part |
@@ -249,8 +271,10 @@ static int snd_miro_get_capture(struct snd_kcontrol *kcontrol, | |||
249 | struct snd_miro *miro = snd_kcontrol_chip(kcontrol); | 271 | struct snd_miro *miro = snd_kcontrol_chip(kcontrol); |
250 | int value; | 272 | int value; |
251 | 273 | ||
252 | if ((value = aci_getvalue(miro, ACI_S_GENERAL)) < 0) { | 274 | value = aci_getvalue(miro->aci, ACI_S_GENERAL); |
253 | snd_printk(KERN_ERR "snd_miro_get_capture() failed: %d\n", value); | 275 | if (value < 0) { |
276 | snd_printk(KERN_ERR "snd_miro_get_capture() failed: %d\n", | ||
277 | value); | ||
254 | return value; | 278 | return value; |
255 | } | 279 | } |
256 | 280 | ||
@@ -267,13 +291,15 @@ static int snd_miro_put_capture(struct snd_kcontrol *kcontrol, | |||
267 | 291 | ||
268 | value = !(ucontrol->value.integer.value[0]); | 292 | value = !(ucontrol->value.integer.value[0]); |
269 | 293 | ||
270 | if ((error = aci_setvalue(miro, ACI_SET_SOLOMODE, value)) < 0) { | 294 | error = aci_setvalue(miro->aci, ACI_SET_SOLOMODE, value); |
271 | snd_printk(KERN_ERR "snd_miro_put_capture() failed: %d\n", error); | 295 | if (error < 0) { |
296 | snd_printk(KERN_ERR "snd_miro_put_capture() failed: %d\n", | ||
297 | error); | ||
272 | return error; | 298 | return error; |
273 | } | 299 | } |
274 | 300 | ||
275 | change = (value != miro->aci_solomode); | 301 | change = (value != miro->aci->aci_solomode); |
276 | miro->aci_solomode = value; | 302 | miro->aci->aci_solomode = value; |
277 | 303 | ||
278 | return change; | 304 | return change; |
279 | } | 305 | } |
@@ -295,7 +321,7 @@ static int snd_miro_get_preamp(struct snd_kcontrol *kcontrol, | |||
295 | struct snd_miro *miro = snd_kcontrol_chip(kcontrol); | 321 | struct snd_miro *miro = snd_kcontrol_chip(kcontrol); |
296 | int value; | 322 | int value; |
297 | 323 | ||
298 | if (miro->aci_version <= 176) { | 324 | if (miro->aci->aci_version <= 176) { |
299 | 325 | ||
300 | /* | 326 | /* |
301 | OSS says it's not readable with versions < 176. | 327 | OSS says it's not readable with versions < 176. |
@@ -303,12 +329,14 @@ static int snd_miro_get_preamp(struct snd_kcontrol *kcontrol, | |||
303 | which is a PCM12 with aci_version = 176. | 329 | which is a PCM12 with aci_version = 176. |
304 | */ | 330 | */ |
305 | 331 | ||
306 | ucontrol->value.integer.value[0] = miro->aci_preamp; | 332 | ucontrol->value.integer.value[0] = miro->aci->aci_preamp; |
307 | return 0; | 333 | return 0; |
308 | } | 334 | } |
309 | 335 | ||
310 | if ((value = aci_getvalue(miro, ACI_GET_PREAMP)) < 0) { | 336 | value = aci_getvalue(miro->aci, ACI_GET_PREAMP); |
311 | snd_printk(KERN_ERR "snd_miro_get_preamp() failed: %d\n", value); | 337 | if (value < 0) { |
338 | snd_printk(KERN_ERR "snd_miro_get_preamp() failed: %d\n", | ||
339 | value); | ||
312 | return value; | 340 | return value; |
313 | } | 341 | } |
314 | 342 | ||
@@ -325,13 +353,15 @@ static int snd_miro_put_preamp(struct snd_kcontrol *kcontrol, | |||
325 | 353 | ||
326 | value = ucontrol->value.integer.value[0]; | 354 | value = ucontrol->value.integer.value[0]; |
327 | 355 | ||
328 | if ((error = aci_setvalue(miro, ACI_SET_PREAMP, value)) < 0) { | 356 | error = aci_setvalue(miro->aci, ACI_SET_PREAMP, value); |
329 | snd_printk(KERN_ERR "snd_miro_put_preamp() failed: %d\n", error); | 357 | if (error < 0) { |
358 | snd_printk(KERN_ERR "snd_miro_put_preamp() failed: %d\n", | ||
359 | error); | ||
330 | return error; | 360 | return error; |
331 | } | 361 | } |
332 | 362 | ||
333 | change = (value != miro->aci_preamp); | 363 | change = (value != miro->aci->aci_preamp); |
334 | miro->aci_preamp = value; | 364 | miro->aci->aci_preamp = value; |
335 | 365 | ||
336 | return change; | 366 | return change; |
337 | } | 367 | } |
@@ -342,7 +372,7 @@ static int snd_miro_get_amp(struct snd_kcontrol *kcontrol, | |||
342 | struct snd_ctl_elem_value *ucontrol) | 372 | struct snd_ctl_elem_value *ucontrol) |
343 | { | 373 | { |
344 | struct snd_miro *miro = snd_kcontrol_chip(kcontrol); | 374 | struct snd_miro *miro = snd_kcontrol_chip(kcontrol); |
345 | ucontrol->value.integer.value[0] = miro->aci_amp; | 375 | ucontrol->value.integer.value[0] = miro->aci->aci_amp; |
346 | 376 | ||
347 | return 0; | 377 | return 0; |
348 | } | 378 | } |
@@ -355,13 +385,14 @@ static int snd_miro_put_amp(struct snd_kcontrol *kcontrol, | |||
355 | 385 | ||
356 | value = ucontrol->value.integer.value[0]; | 386 | value = ucontrol->value.integer.value[0]; |
357 | 387 | ||
358 | if ((error = aci_setvalue(miro, ACI_SET_POWERAMP, value)) < 0) { | 388 | error = aci_setvalue(miro->aci, ACI_SET_POWERAMP, value); |
389 | if (error < 0) { | ||
359 | snd_printk(KERN_ERR "snd_miro_put_amp() to %d failed: %d\n", value, error); | 390 | snd_printk(KERN_ERR "snd_miro_put_amp() to %d failed: %d\n", value, error); |
360 | return error; | 391 | return error; |
361 | } | 392 | } |
362 | 393 | ||
363 | change = (value != miro->aci_amp); | 394 | change = (value != miro->aci->aci_amp); |
364 | miro->aci_amp = value; | 395 | miro->aci->aci_amp = value; |
365 | 396 | ||
366 | return change; | 397 | return change; |
367 | } | 398 | } |
@@ -410,12 +441,14 @@ static int snd_miro_get_double(struct snd_kcontrol *kcontrol, | |||
410 | int right_reg = kcontrol->private_value & 0xff; | 441 | int right_reg = kcontrol->private_value & 0xff; |
411 | int left_reg = right_reg + 1; | 442 | int left_reg = right_reg + 1; |
412 | 443 | ||
413 | if ((right_val = aci_getvalue(miro, right_reg)) < 0) { | 444 | right_val = aci_getvalue(miro->aci, right_reg); |
445 | if (right_val < 0) { | ||
414 | snd_printk(KERN_ERR "aci_getvalue(%d) failed: %d\n", right_reg, right_val); | 446 | snd_printk(KERN_ERR "aci_getvalue(%d) failed: %d\n", right_reg, right_val); |
415 | return right_val; | 447 | return right_val; |
416 | } | 448 | } |
417 | 449 | ||
418 | if ((left_val = aci_getvalue(miro, left_reg)) < 0) { | 450 | left_val = aci_getvalue(miro->aci, left_reg); |
451 | if (left_val < 0) { | ||
419 | snd_printk(KERN_ERR "aci_getvalue(%d) failed: %d\n", left_reg, left_val); | 452 | snd_printk(KERN_ERR "aci_getvalue(%d) failed: %d\n", left_reg, left_val); |
420 | return left_val; | 453 | return left_val; |
421 | } | 454 | } |
@@ -451,6 +484,7 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
451 | struct snd_ctl_elem_value *ucontrol) | 484 | struct snd_ctl_elem_value *ucontrol) |
452 | { | 485 | { |
453 | struct snd_miro *miro = snd_kcontrol_chip(kcontrol); | 486 | struct snd_miro *miro = snd_kcontrol_chip(kcontrol); |
487 | struct snd_miro_aci *aci = miro->aci; | ||
454 | int left, right, left_old, right_old; | 488 | int left, right, left_old, right_old; |
455 | int setreg_left, setreg_right, getreg_left, getreg_right; | 489 | int setreg_left, setreg_right, getreg_left, getreg_right; |
456 | int change, error; | 490 | int change, error; |
@@ -459,21 +493,21 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
459 | right = ucontrol->value.integer.value[1]; | 493 | right = ucontrol->value.integer.value[1]; |
460 | 494 | ||
461 | setreg_right = (kcontrol->private_value >> 8) & 0xff; | 495 | setreg_right = (kcontrol->private_value >> 8) & 0xff; |
462 | if (setreg_right == ACI_SET_MASTER) { | 496 | setreg_left = setreg_right + 8; |
463 | setreg_left = setreg_right + 1; | 497 | if (setreg_right == ACI_SET_MASTER) |
464 | } else { | 498 | setreg_left -= 7; |
465 | setreg_left = setreg_right + 8; | ||
466 | } | ||
467 | 499 | ||
468 | getreg_right = kcontrol->private_value & 0xff; | 500 | getreg_right = kcontrol->private_value & 0xff; |
469 | getreg_left = getreg_right + 1; | 501 | getreg_left = getreg_right + 1; |
470 | 502 | ||
471 | if ((left_old = aci_getvalue(miro, getreg_left)) < 0) { | 503 | left_old = aci_getvalue(aci, getreg_left); |
504 | if (left_old < 0) { | ||
472 | snd_printk(KERN_ERR "aci_getvalue(%d) failed: %d\n", getreg_left, left_old); | 505 | snd_printk(KERN_ERR "aci_getvalue(%d) failed: %d\n", getreg_left, left_old); |
473 | return left_old; | 506 | return left_old; |
474 | } | 507 | } |
475 | 508 | ||
476 | if ((right_old = aci_getvalue(miro, getreg_right)) < 0) { | 509 | right_old = aci_getvalue(aci, getreg_right); |
510 | if (right_old < 0) { | ||
477 | snd_printk(KERN_ERR "aci_getvalue(%d) failed: %d\n", getreg_right, right_old); | 511 | snd_printk(KERN_ERR "aci_getvalue(%d) failed: %d\n", getreg_right, right_old); |
478 | return right_old; | 512 | return right_old; |
479 | } | 513 | } |
@@ -492,13 +526,15 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
492 | right_old = 0x80 - right_old; | 526 | right_old = 0x80 - right_old; |
493 | 527 | ||
494 | if (left >= 0) { | 528 | if (left >= 0) { |
495 | if ((error = aci_setvalue(miro, setreg_left, left)) < 0) { | 529 | error = aci_setvalue(aci, setreg_left, left); |
530 | if (error < 0) { | ||
496 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", | 531 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", |
497 | left, error); | 532 | left, error); |
498 | return error; | 533 | return error; |
499 | } | 534 | } |
500 | } else { | 535 | } else { |
501 | if ((error = aci_setvalue(miro, setreg_left, 0x80 - left)) < 0) { | 536 | error = aci_setvalue(aci, setreg_left, 0x80 - left); |
537 | if (error < 0) { | ||
502 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", | 538 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", |
503 | 0x80 - left, error); | 539 | 0x80 - left, error); |
504 | return error; | 540 | return error; |
@@ -506,13 +542,15 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
506 | } | 542 | } |
507 | 543 | ||
508 | if (right >= 0) { | 544 | if (right >= 0) { |
509 | if ((error = aci_setvalue(miro, setreg_right, right)) < 0) { | 545 | error = aci_setvalue(aci, setreg_right, right); |
546 | if (error < 0) { | ||
510 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", | 547 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", |
511 | right, error); | 548 | right, error); |
512 | return error; | 549 | return error; |
513 | } | 550 | } |
514 | } else { | 551 | } else { |
515 | if ((error = aci_setvalue(miro, setreg_right, 0x80 - right)) < 0) { | 552 | error = aci_setvalue(aci, setreg_right, 0x80 - right); |
553 | if (error < 0) { | ||
516 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", | 554 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", |
517 | 0x80 - right, error); | 555 | 0x80 - right, error); |
518 | return error; | 556 | return error; |
@@ -530,12 +568,14 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
530 | left_old = 0x20 - left_old; | 568 | left_old = 0x20 - left_old; |
531 | right_old = 0x20 - right_old; | 569 | right_old = 0x20 - right_old; |
532 | 570 | ||
533 | if ((error = aci_setvalue(miro, setreg_left, 0x20 - left)) < 0) { | 571 | error = aci_setvalue(aci, setreg_left, 0x20 - left); |
572 | if (error < 0) { | ||
534 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", | 573 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", |
535 | 0x20 - left, error); | 574 | 0x20 - left, error); |
536 | return error; | 575 | return error; |
537 | } | 576 | } |
538 | if ((error = aci_setvalue(miro, setreg_right, 0x20 - right)) < 0) { | 577 | error = aci_setvalue(aci, setreg_right, 0x20 - right); |
578 | if (error < 0) { | ||
539 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", | 579 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", |
540 | 0x20 - right, error); | 580 | 0x20 - right, error); |
541 | return error; | 581 | return error; |
@@ -633,11 +673,13 @@ static unsigned char aci_init_values[][2] __devinitdata = { | |||
633 | static int __devinit snd_set_aci_init_values(struct snd_miro *miro) | 673 | static int __devinit snd_set_aci_init_values(struct snd_miro *miro) |
634 | { | 674 | { |
635 | int idx, error; | 675 | int idx, error; |
676 | struct snd_miro_aci *aci = miro->aci; | ||
636 | 677 | ||
637 | /* enable WSS on PCM1 */ | 678 | /* enable WSS on PCM1 */ |
638 | 679 | ||
639 | if ((miro->aci_product == 'A') && wss) { | 680 | if ((aci->aci_product == 'A') && wss) { |
640 | if ((error = aci_setvalue(miro, ACI_SET_WSS, wss)) < 0) { | 681 | error = aci_setvalue(aci, ACI_SET_WSS, wss); |
682 | if (error < 0) { | ||
641 | snd_printk(KERN_ERR "enabling WSS mode failed\n"); | 683 | snd_printk(KERN_ERR "enabling WSS mode failed\n"); |
642 | return error; | 684 | return error; |
643 | } | 685 | } |
@@ -646,7 +688,8 @@ static int __devinit snd_set_aci_init_values(struct snd_miro *miro) | |||
646 | /* enable IDE port */ | 688 | /* enable IDE port */ |
647 | 689 | ||
648 | if (ide) { | 690 | if (ide) { |
649 | if ((error = aci_setvalue(miro, ACI_SET_IDE, ide)) < 0) { | 691 | error = aci_setvalue(aci, ACI_SET_IDE, ide); |
692 | if (error < 0) { | ||
650 | snd_printk(KERN_ERR "enabling IDE port failed\n"); | 693 | snd_printk(KERN_ERR "enabling IDE port failed\n"); |
651 | return error; | 694 | return error; |
652 | } | 695 | } |
@@ -654,32 +697,31 @@ static int __devinit snd_set_aci_init_values(struct snd_miro *miro) | |||
654 | 697 | ||
655 | /* set common aci values */ | 698 | /* set common aci values */ |
656 | 699 | ||
657 | for (idx = 0; idx < ARRAY_SIZE(aci_init_values); idx++) | 700 | for (idx = 0; idx < ARRAY_SIZE(aci_init_values); idx++) { |
658 | if ((error = aci_setvalue(miro, aci_init_values[idx][0], | 701 | error = aci_setvalue(aci, aci_init_values[idx][0], |
659 | aci_init_values[idx][1])) < 0) { | 702 | aci_init_values[idx][1]); |
703 | if (error < 0) { | ||
660 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", | 704 | snd_printk(KERN_ERR "aci_setvalue(%d) failed: %d\n", |
661 | aci_init_values[idx][0], error); | 705 | aci_init_values[idx][0], error); |
662 | return error; | 706 | return error; |
663 | } | 707 | } |
664 | 708 | } | |
665 | miro->aci_amp = 0; | 709 | aci->aci_amp = 0; |
666 | miro->aci_preamp = 0; | 710 | aci->aci_preamp = 0; |
667 | miro->aci_solomode = 1; | 711 | aci->aci_solomode = 1; |
668 | 712 | ||
669 | return 0; | 713 | return 0; |
670 | } | 714 | } |
671 | 715 | ||
672 | static int __devinit snd_miro_mixer(struct snd_miro *miro) | 716 | static int __devinit snd_miro_mixer(struct snd_card *card, |
717 | struct snd_miro *miro) | ||
673 | { | 718 | { |
674 | struct snd_card *card; | ||
675 | unsigned int idx; | 719 | unsigned int idx; |
676 | int err; | 720 | int err; |
677 | 721 | ||
678 | if (snd_BUG_ON(!miro || !miro->card)) | 722 | if (snd_BUG_ON(!miro || !card)) |
679 | return -EINVAL; | 723 | return -EINVAL; |
680 | 724 | ||
681 | card = miro->card; | ||
682 | |||
683 | switch (miro->hardware) { | 725 | switch (miro->hardware) { |
684 | case OPTi9XX_HW_82C924: | 726 | case OPTi9XX_HW_82C924: |
685 | strcpy(card->mixername, "ACI & OPTi924"); | 727 | strcpy(card->mixername, "ACI & OPTi924"); |
@@ -697,7 +739,8 @@ static int __devinit snd_miro_mixer(struct snd_miro *miro) | |||
697 | return err; | 739 | return err; |
698 | } | 740 | } |
699 | 741 | ||
700 | if ((miro->aci_product == 'A') || (miro->aci_product == 'B')) { | 742 | if ((miro->aci->aci_product == 'A') || |
743 | (miro->aci->aci_product == 'B')) { | ||
701 | /* PCM1/PCM12 with power-amp and Line 2 */ | 744 | /* PCM1/PCM12 with power-amp and Line 2 */ |
702 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_miro_line_control[0], miro))) < 0) | 745 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_miro_line_control[0], miro))) < 0) |
703 | return err; | 746 | return err; |
@@ -705,16 +748,17 @@ static int __devinit snd_miro_mixer(struct snd_miro *miro) | |||
705 | return err; | 748 | return err; |
706 | } | 749 | } |
707 | 750 | ||
708 | if ((miro->aci_product == 'B') || (miro->aci_product == 'C')) { | 751 | if ((miro->aci->aci_product == 'B') || |
752 | (miro->aci->aci_product == 'C')) { | ||
709 | /* PCM12/PCM20 with mic-preamp */ | 753 | /* PCM12/PCM20 with mic-preamp */ |
710 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_miro_preamp_control[0], miro))) < 0) | 754 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_miro_preamp_control[0], miro))) < 0) |
711 | return err; | 755 | return err; |
712 | if (miro->aci_version >= 176) | 756 | if (miro->aci->aci_version >= 176) |
713 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_miro_capture_control[0], miro))) < 0) | 757 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_miro_capture_control[0], miro))) < 0) |
714 | return err; | 758 | return err; |
715 | } | 759 | } |
716 | 760 | ||
717 | if (miro->aci_product == 'C') { | 761 | if (miro->aci->aci_product == 'C') { |
718 | /* PCM20 with radio and 7 band equalizer */ | 762 | /* PCM20 with radio and 7 band equalizer */ |
719 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_miro_radio_control[0], miro))) < 0) | 763 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_miro_radio_control[0], miro))) < 0) |
720 | return err; | 764 | return err; |
@@ -757,21 +801,26 @@ static int __devinit snd_miro_init(struct snd_miro *chip, | |||
757 | chip->irq = -1; | 801 | chip->irq = -1; |
758 | chip->dma1 = -1; | 802 | chip->dma1 = -1; |
759 | chip->dma2 = -1; | 803 | chip->dma2 = -1; |
760 | chip->fm_port = -1; | ||
761 | chip->mpu_port = -1; | 804 | chip->mpu_port = -1; |
762 | chip->mpu_irq = -1; | 805 | chip->mpu_irq = -1; |
763 | 806 | ||
807 | chip->pwd_reg = 3; | ||
808 | |||
809 | #ifdef CONFIG_PNP | ||
810 | if (isapnp && chip->mc_base) | ||
811 | /* PnP resource gives the least 10 bits */ | ||
812 | chip->mc_base |= 0xc00; | ||
813 | else | ||
814 | #endif | ||
815 | chip->mc_base = 0xf8c; | ||
816 | |||
764 | switch (hardware) { | 817 | switch (hardware) { |
765 | case OPTi9XX_HW_82C929: | 818 | case OPTi9XX_HW_82C929: |
766 | chip->mc_base = 0xf8c; | ||
767 | chip->password = 0xe3; | 819 | chip->password = 0xe3; |
768 | chip->pwd_reg = 3; | ||
769 | break; | 820 | break; |
770 | 821 | ||
771 | case OPTi9XX_HW_82C924: | 822 | case OPTi9XX_HW_82C924: |
772 | chip->mc_base = 0xf8c; | ||
773 | chip->password = 0xe5; | 823 | chip->password = 0xe5; |
774 | chip->pwd_reg = 3; | ||
775 | break; | 824 | break; |
776 | 825 | ||
777 | default: | 826 | default: |
@@ -853,14 +902,15 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
853 | struct snd_info_buffer *buffer) | 902 | struct snd_info_buffer *buffer) |
854 | { | 903 | { |
855 | struct snd_miro *miro = (struct snd_miro *) entry->private_data; | 904 | struct snd_miro *miro = (struct snd_miro *) entry->private_data; |
905 | struct snd_miro_aci *aci = miro->aci; | ||
856 | char* model = "unknown"; | 906 | char* model = "unknown"; |
857 | 907 | ||
858 | /* miroSOUND PCM1 pro, early PCM12 */ | 908 | /* miroSOUND PCM1 pro, early PCM12 */ |
859 | 909 | ||
860 | if ((miro->hardware == OPTi9XX_HW_82C929) && | 910 | if ((miro->hardware == OPTi9XX_HW_82C929) && |
861 | (miro->aci_vendor == 'm') && | 911 | (aci->aci_vendor == 'm') && |
862 | (miro->aci_product == 'A')) { | 912 | (aci->aci_product == 'A')) { |
863 | switch(miro->aci_version) { | 913 | switch (aci->aci_version) { |
864 | case 3: | 914 | case 3: |
865 | model = "miroSOUND PCM1 pro"; | 915 | model = "miroSOUND PCM1 pro"; |
866 | break; | 916 | break; |
@@ -873,9 +923,9 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
873 | /* miroSOUND PCM12, PCM12 (Rev. E), PCM12 pnp */ | 923 | /* miroSOUND PCM12, PCM12 (Rev. E), PCM12 pnp */ |
874 | 924 | ||
875 | if ((miro->hardware == OPTi9XX_HW_82C924) && | 925 | if ((miro->hardware == OPTi9XX_HW_82C924) && |
876 | (miro->aci_vendor == 'm') && | 926 | (aci->aci_vendor == 'm') && |
877 | (miro->aci_product == 'B')) { | 927 | (aci->aci_product == 'B')) { |
878 | switch(miro->aci_version) { | 928 | switch (aci->aci_version) { |
879 | case 4: | 929 | case 4: |
880 | model = "miroSOUND PCM12"; | 930 | model = "miroSOUND PCM12"; |
881 | break; | 931 | break; |
@@ -891,9 +941,9 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
891 | /* miroSOUND PCM20 radio */ | 941 | /* miroSOUND PCM20 radio */ |
892 | 942 | ||
893 | if ((miro->hardware == OPTi9XX_HW_82C924) && | 943 | if ((miro->hardware == OPTi9XX_HW_82C924) && |
894 | (miro->aci_vendor == 'm') && | 944 | (aci->aci_vendor == 'm') && |
895 | (miro->aci_product == 'C')) { | 945 | (aci->aci_product == 'C')) { |
896 | switch(miro->aci_version) { | 946 | switch (aci->aci_version) { |
897 | case 7: | 947 | case 7: |
898 | model = "miroSOUND PCM20 radio (Rev. E)"; | 948 | model = "miroSOUND PCM20 radio (Rev. E)"; |
899 | break; | 949 | break; |
@@ -917,17 +967,17 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
917 | 967 | ||
918 | snd_iprintf(buffer, "ACI information:\n"); | 968 | snd_iprintf(buffer, "ACI information:\n"); |
919 | snd_iprintf(buffer, " vendor : "); | 969 | snd_iprintf(buffer, " vendor : "); |
920 | switch(miro->aci_vendor) { | 970 | switch (aci->aci_vendor) { |
921 | case 'm': | 971 | case 'm': |
922 | snd_iprintf(buffer, "Miro\n"); | 972 | snd_iprintf(buffer, "Miro\n"); |
923 | break; | 973 | break; |
924 | default: | 974 | default: |
925 | snd_iprintf(buffer, "unknown (0x%x)\n", miro->aci_vendor); | 975 | snd_iprintf(buffer, "unknown (0x%x)\n", aci->aci_vendor); |
926 | break; | 976 | break; |
927 | } | 977 | } |
928 | 978 | ||
929 | snd_iprintf(buffer, " product : "); | 979 | snd_iprintf(buffer, " product : "); |
930 | switch(miro->aci_product) { | 980 | switch (aci->aci_product) { |
931 | case 'A': | 981 | case 'A': |
932 | snd_iprintf(buffer, "miroSOUND PCM1 pro / (early) PCM12\n"); | 982 | snd_iprintf(buffer, "miroSOUND PCM1 pro / (early) PCM12\n"); |
933 | break; | 983 | break; |
@@ -938,26 +988,27 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
938 | snd_iprintf(buffer, "miroSOUND PCM20 radio\n"); | 988 | snd_iprintf(buffer, "miroSOUND PCM20 radio\n"); |
939 | break; | 989 | break; |
940 | default: | 990 | default: |
941 | snd_iprintf(buffer, "unknown (0x%x)\n", miro->aci_product); | 991 | snd_iprintf(buffer, "unknown (0x%x)\n", aci->aci_product); |
942 | break; | 992 | break; |
943 | } | 993 | } |
944 | 994 | ||
945 | snd_iprintf(buffer, " firmware: %d (0x%x)\n", | 995 | snd_iprintf(buffer, " firmware: %d (0x%x)\n", |
946 | miro->aci_version, miro->aci_version); | 996 | aci->aci_version, aci->aci_version); |
947 | snd_iprintf(buffer, " port : 0x%lx-0x%lx\n", | 997 | snd_iprintf(buffer, " port : 0x%lx-0x%lx\n", |
948 | miro->aci_port, miro->aci_port+2); | 998 | aci->aci_port, aci->aci_port+2); |
949 | snd_iprintf(buffer, " wss : 0x%x\n", wss); | 999 | snd_iprintf(buffer, " wss : 0x%x\n", wss); |
950 | snd_iprintf(buffer, " ide : 0x%x\n", ide); | 1000 | snd_iprintf(buffer, " ide : 0x%x\n", ide); |
951 | snd_iprintf(buffer, " solomode: 0x%x\n", miro->aci_solomode); | 1001 | snd_iprintf(buffer, " solomode: 0x%x\n", aci->aci_solomode); |
952 | snd_iprintf(buffer, " amp : 0x%x\n", miro->aci_amp); | 1002 | snd_iprintf(buffer, " amp : 0x%x\n", aci->aci_amp); |
953 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); | 1003 | snd_iprintf(buffer, " preamp : 0x%x\n", aci->aci_preamp); |
954 | } | 1004 | } |
955 | 1005 | ||
956 | static void __devinit snd_miro_proc_init(struct snd_miro * miro) | 1006 | static void __devinit snd_miro_proc_init(struct snd_card *card, |
1007 | struct snd_miro *miro) | ||
957 | { | 1008 | { |
958 | struct snd_info_entry *entry; | 1009 | struct snd_info_entry *entry; |
959 | 1010 | ||
960 | if (! snd_card_proc_new(miro->card, "miro", &entry)) | 1011 | if (!snd_card_proc_new(card, "miro", &entry)) |
961 | snd_info_set_text_ops(entry, miro, snd_miro_proc_read); | 1012 | snd_info_set_text_ops(entry, miro, snd_miro_proc_read); |
962 | } | 1013 | } |
963 | 1014 | ||
@@ -974,37 +1025,40 @@ static int __devinit snd_miro_configure(struct snd_miro *chip) | |||
974 | unsigned char mpu_irq_bits; | 1025 | unsigned char mpu_irq_bits; |
975 | unsigned long flags; | 1026 | unsigned long flags; |
976 | 1027 | ||
1028 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | ||
1029 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */ | ||
1030 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | ||
1031 | |||
977 | switch (chip->hardware) { | 1032 | switch (chip->hardware) { |
978 | case OPTi9XX_HW_82C924: | 1033 | case OPTi9XX_HW_82C924: |
979 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); | 1034 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); |
980 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | ||
981 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */ | ||
982 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); | 1035 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); |
983 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | ||
984 | break; | 1036 | break; |
985 | case OPTi9XX_HW_82C929: | 1037 | case OPTi9XX_HW_82C929: |
986 | /* untested init commands for OPTi929 */ | 1038 | /* untested init commands for OPTi929 */ |
987 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | ||
988 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */ | ||
989 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(4), 0x00, 0x0c); | 1039 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(4), 0x00, 0x0c); |
990 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | ||
991 | break; | 1040 | break; |
992 | default: | 1041 | default: |
993 | snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); | 1042 | snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); |
994 | return -EINVAL; | 1043 | return -EINVAL; |
995 | } | 1044 | } |
996 | 1045 | ||
997 | switch (chip->wss_base) { | 1046 | /* PnP resource says it decodes only 10 bits of address */ |
998 | case 0x530: | 1047 | switch (chip->wss_base & 0x3ff) { |
1048 | case 0x130: | ||
1049 | chip->wss_base = 0x530; | ||
999 | wss_base_bits = 0x00; | 1050 | wss_base_bits = 0x00; |
1000 | break; | 1051 | break; |
1001 | case 0x604: | 1052 | case 0x204: |
1053 | chip->wss_base = 0x604; | ||
1002 | wss_base_bits = 0x03; | 1054 | wss_base_bits = 0x03; |
1003 | break; | 1055 | break; |
1004 | case 0xe80: | 1056 | case 0x280: |
1057 | chip->wss_base = 0xe80; | ||
1005 | wss_base_bits = 0x01; | 1058 | wss_base_bits = 0x01; |
1006 | break; | 1059 | break; |
1007 | case 0xf40: | 1060 | case 0x340: |
1061 | chip->wss_base = 0xf40; | ||
1008 | wss_base_bits = 0x02; | 1062 | wss_base_bits = 0x02; |
1009 | break; | 1063 | break; |
1010 | default: | 1064 | default: |
@@ -1122,75 +1176,92 @@ __skip_mpu: | |||
1122 | return 0; | 1176 | return 0; |
1123 | } | 1177 | } |
1124 | 1178 | ||
1179 | static int __devinit snd_miro_opti_check(struct snd_miro *chip) | ||
1180 | { | ||
1181 | unsigned char value; | ||
1182 | |||
1183 | chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, | ||
1184 | "OPTi9xx MC"); | ||
1185 | if (chip->res_mc_base == NULL) | ||
1186 | return -ENOMEM; | ||
1187 | |||
1188 | value = snd_miro_read(chip, OPTi9XX_MC_REG(1)); | ||
1189 | if (value != 0xff && value != inb(chip->mc_base + OPTi9XX_MC_REG(1))) | ||
1190 | if (value == snd_miro_read(chip, OPTi9XX_MC_REG(1))) | ||
1191 | return 0; | ||
1192 | |||
1193 | release_and_free_resource(chip->res_mc_base); | ||
1194 | chip->res_mc_base = NULL; | ||
1195 | |||
1196 | return -ENODEV; | ||
1197 | } | ||
1198 | |||
1125 | static int __devinit snd_card_miro_detect(struct snd_card *card, | 1199 | static int __devinit snd_card_miro_detect(struct snd_card *card, |
1126 | struct snd_miro *chip) | 1200 | struct snd_miro *chip) |
1127 | { | 1201 | { |
1128 | int i, err; | 1202 | int i, err; |
1129 | unsigned char value; | ||
1130 | 1203 | ||
1131 | for (i = OPTi9XX_HW_82C929; i <= OPTi9XX_HW_82C924; i++) { | 1204 | for (i = OPTi9XX_HW_82C929; i <= OPTi9XX_HW_82C924; i++) { |
1132 | 1205 | ||
1133 | if ((err = snd_miro_init(chip, i)) < 0) | 1206 | if ((err = snd_miro_init(chip, i)) < 0) |
1134 | return err; | 1207 | return err; |
1135 | 1208 | ||
1136 | if ((chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL) | 1209 | err = snd_miro_opti_check(chip); |
1137 | continue; | 1210 | if (err == 0) |
1138 | 1211 | return 1; | |
1139 | value = snd_miro_read(chip, OPTi9XX_MC_REG(1)); | ||
1140 | if ((value != 0xff) && (value != inb(chip->mc_base + 1))) | ||
1141 | if (value == snd_miro_read(chip, OPTi9XX_MC_REG(1))) | ||
1142 | return 1; | ||
1143 | |||
1144 | release_and_free_resource(chip->res_mc_base); | ||
1145 | chip->res_mc_base = NULL; | ||
1146 | |||
1147 | } | 1212 | } |
1148 | 1213 | ||
1149 | return -ENODEV; | 1214 | return -ENODEV; |
1150 | } | 1215 | } |
1151 | 1216 | ||
1152 | static int __devinit snd_card_miro_aci_detect(struct snd_card *card, | 1217 | static int __devinit snd_card_miro_aci_detect(struct snd_card *card, |
1153 | struct snd_miro * miro) | 1218 | struct snd_miro *miro) |
1154 | { | 1219 | { |
1155 | unsigned char regval; | 1220 | unsigned char regval; |
1156 | int i; | 1221 | int i; |
1222 | struct snd_miro_aci *aci = &aci_device; | ||
1223 | |||
1224 | miro->aci = aci; | ||
1157 | 1225 | ||
1158 | mutex_init(&miro->aci_mutex); | 1226 | mutex_init(&aci->aci_mutex); |
1159 | 1227 | ||
1160 | /* get ACI port from OPTi9xx MC 4 */ | 1228 | /* get ACI port from OPTi9xx MC 4 */ |
1161 | 1229 | ||
1162 | miro->mc_base = 0xf8c; | ||
1163 | regval=inb(miro->mc_base + 4); | 1230 | regval=inb(miro->mc_base + 4); |
1164 | miro->aci_port = (regval & 0x10) ? 0x344: 0x354; | 1231 | aci->aci_port = (regval & 0x10) ? 0x344 : 0x354; |
1165 | 1232 | ||
1166 | if ((miro->res_aci_port = request_region(miro->aci_port, 3, "miro aci")) == NULL) { | 1233 | miro->res_aci_port = request_region(aci->aci_port, 3, "miro aci"); |
1234 | if (miro->res_aci_port == NULL) { | ||
1167 | snd_printk(KERN_ERR "aci i/o area 0x%lx-0x%lx already used.\n", | 1235 | snd_printk(KERN_ERR "aci i/o area 0x%lx-0x%lx already used.\n", |
1168 | miro->aci_port, miro->aci_port+2); | 1236 | aci->aci_port, aci->aci_port+2); |
1169 | return -ENOMEM; | 1237 | return -ENOMEM; |
1170 | } | 1238 | } |
1171 | 1239 | ||
1172 | /* force ACI into a known state */ | 1240 | /* force ACI into a known state */ |
1173 | for (i = 0; i < 3; i++) | 1241 | for (i = 0; i < 3; i++) |
1174 | if (aci_cmd(miro, ACI_ERROR_OP, -1, -1) < 0) { | 1242 | if (snd_aci_cmd(aci, ACI_ERROR_OP, -1, -1) < 0) { |
1175 | snd_printk(KERN_ERR "can't force aci into known state.\n"); | 1243 | snd_printk(KERN_ERR "can't force aci into known state.\n"); |
1176 | return -ENXIO; | 1244 | return -ENXIO; |
1177 | } | 1245 | } |
1178 | 1246 | ||
1179 | if ((miro->aci_vendor=aci_cmd(miro, ACI_READ_IDCODE, -1, -1)) < 0 || | 1247 | aci->aci_vendor = snd_aci_cmd(aci, ACI_READ_IDCODE, -1, -1); |
1180 | (miro->aci_product=aci_cmd(miro, ACI_READ_IDCODE, -1, -1)) < 0) { | 1248 | aci->aci_product = snd_aci_cmd(aci, ACI_READ_IDCODE, -1, -1); |
1181 | snd_printk(KERN_ERR "can't read aci id on 0x%lx.\n", miro->aci_port); | 1249 | if (aci->aci_vendor < 0 || aci->aci_product < 0) { |
1250 | snd_printk(KERN_ERR "can't read aci id on 0x%lx.\n", | ||
1251 | aci->aci_port); | ||
1182 | return -ENXIO; | 1252 | return -ENXIO; |
1183 | } | 1253 | } |
1184 | 1254 | ||
1185 | if ((miro->aci_version=aci_cmd(miro, ACI_READ_VERSION, -1, -1)) < 0) { | 1255 | aci->aci_version = snd_aci_cmd(aci, ACI_READ_VERSION, -1, -1); |
1256 | if (aci->aci_version < 0) { | ||
1186 | snd_printk(KERN_ERR "can't read aci version on 0x%lx.\n", | 1257 | snd_printk(KERN_ERR "can't read aci version on 0x%lx.\n", |
1187 | miro->aci_port); | 1258 | aci->aci_port); |
1188 | return -ENXIO; | 1259 | return -ENXIO; |
1189 | } | 1260 | } |
1190 | 1261 | ||
1191 | if (aci_cmd(miro, ACI_INIT, -1, -1) < 0 || | 1262 | if (snd_aci_cmd(aci, ACI_INIT, -1, -1) < 0 || |
1192 | aci_cmd(miro, ACI_ERROR_OP, ACI_ERROR_OP, ACI_ERROR_OP) < 0 || | 1263 | snd_aci_cmd(aci, ACI_ERROR_OP, ACI_ERROR_OP, ACI_ERROR_OP) < 0 || |
1193 | aci_cmd(miro, ACI_ERROR_OP, ACI_ERROR_OP, ACI_ERROR_OP) < 0) { | 1264 | snd_aci_cmd(aci, ACI_ERROR_OP, ACI_ERROR_OP, ACI_ERROR_OP) < 0) { |
1194 | snd_printk(KERN_ERR "can't initialize aci.\n"); | 1265 | snd_printk(KERN_ERR "can't initialize aci.\n"); |
1195 | return -ENXIO; | 1266 | return -ENXIO; |
1196 | } | 1267 | } |
@@ -1201,157 +1272,80 @@ static int __devinit snd_card_miro_aci_detect(struct snd_card *card, | |||
1201 | static void snd_card_miro_free(struct snd_card *card) | 1272 | static void snd_card_miro_free(struct snd_card *card) |
1202 | { | 1273 | { |
1203 | struct snd_miro *miro = card->private_data; | 1274 | struct snd_miro *miro = card->private_data; |
1204 | 1275 | ||
1205 | release_and_free_resource(miro->res_aci_port); | 1276 | release_and_free_resource(miro->res_aci_port); |
1277 | if (miro->aci) | ||
1278 | miro->aci->aci_port = 0; | ||
1206 | release_and_free_resource(miro->res_mc_base); | 1279 | release_and_free_resource(miro->res_mc_base); |
1207 | } | 1280 | } |
1208 | 1281 | ||
1209 | static int __devinit snd_miro_match(struct device *devptr, unsigned int n) | 1282 | static int __devinit snd_miro_probe(struct snd_card *card) |
1210 | { | ||
1211 | return 1; | ||
1212 | } | ||
1213 | |||
1214 | static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | ||
1215 | { | 1283 | { |
1216 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | ||
1217 | static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; | ||
1218 | static int possible_irqs[] = {11, 9, 10, 7, -1}; | ||
1219 | static int possible_mpu_irqs[] = {10, 5, 9, 7, -1}; | ||
1220 | static int possible_dma1s[] = {3, 1, 0, -1}; | ||
1221 | static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; | ||
1222 | |||
1223 | int error; | 1284 | int error; |
1224 | struct snd_miro *miro; | 1285 | struct snd_miro *miro = card->private_data; |
1225 | struct snd_wss *codec; | 1286 | struct snd_wss *codec; |
1226 | struct snd_timer *timer; | 1287 | struct snd_timer *timer; |
1227 | struct snd_card *card; | ||
1228 | struct snd_pcm *pcm; | 1288 | struct snd_pcm *pcm; |
1229 | struct snd_rawmidi *rmidi; | 1289 | struct snd_rawmidi *rmidi; |
1230 | 1290 | ||
1231 | error = snd_card_create(index, id, THIS_MODULE, | 1291 | if (!miro->res_mc_base) { |
1232 | sizeof(struct snd_miro), &card); | 1292 | miro->res_mc_base = request_region(miro->mc_base, |
1233 | if (error < 0) | 1293 | miro->mc_base_size, |
1234 | return error; | 1294 | "miro (OPTi9xx MC)"); |
1235 | 1295 | if (miro->res_mc_base == NULL) { | |
1236 | card->private_free = snd_card_miro_free; | 1296 | snd_printk(KERN_ERR "request for OPTI9xx MC failed\n"); |
1237 | miro = card->private_data; | 1297 | return -ENOMEM; |
1238 | miro->card = card; | 1298 | } |
1239 | |||
1240 | if ((error = snd_card_miro_aci_detect(card, miro)) < 0) { | ||
1241 | snd_card_free(card); | ||
1242 | snd_printk(KERN_ERR "unable to detect aci chip\n"); | ||
1243 | return -ENODEV; | ||
1244 | } | 1299 | } |
1245 | 1300 | ||
1246 | /* init proc interface */ | 1301 | error = snd_card_miro_aci_detect(card, miro); |
1247 | snd_miro_proc_init(miro); | 1302 | if (error < 0) { |
1248 | |||
1249 | if ((error = snd_card_miro_detect(card, miro)) < 0) { | ||
1250 | snd_card_free(card); | 1303 | snd_card_free(card); |
1251 | snd_printk(KERN_ERR "unable to detect OPTi9xx chip\n"); | 1304 | snd_printk(KERN_ERR "unable to detect aci chip\n"); |
1252 | return -ENODEV; | 1305 | return -ENODEV; |
1253 | } | 1306 | } |
1254 | 1307 | ||
1255 | if (! miro->res_mc_base && | ||
1256 | (miro->res_mc_base = request_region(miro->mc_base, miro->mc_base_size, | ||
1257 | "miro (OPTi9xx MC)")) == NULL) { | ||
1258 | snd_card_free(card); | ||
1259 | snd_printk(KERN_ERR "request for OPTI9xx MC failed\n"); | ||
1260 | return -ENOMEM; | ||
1261 | } | ||
1262 | |||
1263 | miro->wss_base = port; | 1308 | miro->wss_base = port; |
1264 | miro->fm_port = fm_port; | ||
1265 | miro->mpu_port = mpu_port; | 1309 | miro->mpu_port = mpu_port; |
1266 | miro->irq = irq; | 1310 | miro->irq = irq; |
1267 | miro->mpu_irq = mpu_irq; | 1311 | miro->mpu_irq = mpu_irq; |
1268 | miro->dma1 = dma1; | 1312 | miro->dma1 = dma1; |
1269 | miro->dma2 = dma2; | 1313 | miro->dma2 = dma2; |
1270 | 1314 | ||
1271 | if (miro->wss_base == SNDRV_AUTO_PORT) { | 1315 | /* init proc interface */ |
1272 | if ((miro->wss_base = snd_legacy_find_free_ioport(possible_ports, 4)) < 0) { | 1316 | snd_miro_proc_init(card, miro); |
1273 | snd_card_free(card); | ||
1274 | snd_printk(KERN_ERR "unable to find a free WSS port\n"); | ||
1275 | return -EBUSY; | ||
1276 | } | ||
1277 | } | ||
1278 | |||
1279 | if (miro->mpu_port == SNDRV_AUTO_PORT) { | ||
1280 | if ((miro->mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) < 0) { | ||
1281 | snd_card_free(card); | ||
1282 | snd_printk(KERN_ERR "unable to find a free MPU401 port\n"); | ||
1283 | return -EBUSY; | ||
1284 | } | ||
1285 | } | ||
1286 | if (miro->irq == SNDRV_AUTO_IRQ) { | ||
1287 | if ((miro->irq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | ||
1288 | snd_card_free(card); | ||
1289 | snd_printk(KERN_ERR "unable to find a free IRQ\n"); | ||
1290 | return -EBUSY; | ||
1291 | } | ||
1292 | } | ||
1293 | if (miro->mpu_irq == SNDRV_AUTO_IRQ) { | ||
1294 | if ((miro->mpu_irq = snd_legacy_find_free_irq(possible_mpu_irqs)) < 0) { | ||
1295 | snd_card_free(card); | ||
1296 | snd_printk(KERN_ERR "unable to find a free MPU401 IRQ\n"); | ||
1297 | return -EBUSY; | ||
1298 | } | ||
1299 | } | ||
1300 | if (miro->dma1 == SNDRV_AUTO_DMA) { | ||
1301 | if ((miro->dma1 = snd_legacy_find_free_dma(possible_dma1s)) < 0) { | ||
1302 | snd_card_free(card); | ||
1303 | snd_printk(KERN_ERR "unable to find a free DMA1\n"); | ||
1304 | return -EBUSY; | ||
1305 | } | ||
1306 | } | ||
1307 | if (miro->dma2 == SNDRV_AUTO_DMA) { | ||
1308 | if ((miro->dma2 = snd_legacy_find_free_dma(possible_dma2s[miro->dma1 % 4])) < 0) { | ||
1309 | snd_card_free(card); | ||
1310 | snd_printk(KERN_ERR "unable to find a free DMA2\n"); | ||
1311 | return -EBUSY; | ||
1312 | } | ||
1313 | } | ||
1314 | 1317 | ||
1315 | error = snd_miro_configure(miro); | 1318 | error = snd_miro_configure(miro); |
1316 | if (error) { | 1319 | if (error) |
1317 | snd_card_free(card); | ||
1318 | return error; | 1320 | return error; |
1319 | } | ||
1320 | 1321 | ||
1321 | error = snd_wss_create(card, miro->wss_base + 4, -1, | 1322 | error = snd_wss_create(card, miro->wss_base + 4, -1, |
1322 | miro->irq, miro->dma1, miro->dma2, | 1323 | miro->irq, miro->dma1, miro->dma2, |
1323 | WSS_HW_AD1845, 0, &codec); | 1324 | WSS_HW_DETECT, 0, &codec); |
1324 | if (error < 0) { | 1325 | if (error < 0) |
1325 | snd_card_free(card); | ||
1326 | return error; | 1326 | return error; |
1327 | } | ||
1328 | 1327 | ||
1329 | error = snd_wss_pcm(codec, 0, &pcm); | 1328 | error = snd_wss_pcm(codec, 0, &pcm); |
1330 | if (error < 0) { | 1329 | if (error < 0) |
1331 | snd_card_free(card); | ||
1332 | return error; | 1330 | return error; |
1333 | } | 1331 | |
1334 | error = snd_wss_mixer(codec); | 1332 | error = snd_wss_mixer(codec); |
1335 | if (error < 0) { | 1333 | if (error < 0) |
1336 | snd_card_free(card); | ||
1337 | return error; | 1334 | return error; |
1338 | } | 1335 | |
1339 | error = snd_wss_timer(codec, 0, &timer); | 1336 | error = snd_wss_timer(codec, 0, &timer); |
1340 | if (error < 0) { | 1337 | if (error < 0) |
1341 | snd_card_free(card); | ||
1342 | return error; | 1338 | return error; |
1343 | } | ||
1344 | 1339 | ||
1345 | miro->pcm = pcm; | 1340 | miro->pcm = pcm; |
1346 | 1341 | ||
1347 | if ((error = snd_miro_mixer(miro)) < 0) { | 1342 | error = snd_miro_mixer(card, miro); |
1348 | snd_card_free(card); | 1343 | if (error < 0) |
1349 | return error; | 1344 | return error; |
1350 | } | ||
1351 | 1345 | ||
1352 | if (miro->aci_vendor == 'm') { | 1346 | if (miro->aci->aci_vendor == 'm') { |
1353 | /* It looks like a miro sound card. */ | 1347 | /* It looks like a miro sound card. */ |
1354 | switch (miro->aci_product) { | 1348 | switch (miro->aci->aci_product) { |
1355 | case 'A': | 1349 | case 'A': |
1356 | sprintf(card->shortname, | 1350 | sprintf(card->shortname, |
1357 | "miroSOUND PCM1 pro / PCM12"); | 1351 | "miroSOUND PCM1 pro / PCM12"); |
@@ -1380,30 +1374,131 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | |||
1380 | card->shortname, miro->name, pcm->name, miro->wss_base + 4, | 1374 | card->shortname, miro->name, pcm->name, miro->wss_base + 4, |
1381 | miro->irq, miro->dma1, miro->dma2); | 1375 | miro->irq, miro->dma1, miro->dma2); |
1382 | 1376 | ||
1383 | if (miro->mpu_port <= 0 || miro->mpu_port == SNDRV_AUTO_PORT) | 1377 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) |
1384 | rmidi = NULL; | 1378 | rmidi = NULL; |
1385 | else | 1379 | else { |
1386 | if ((error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, | 1380 | error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, |
1387 | miro->mpu_port, 0, miro->mpu_irq, IRQF_DISABLED, | 1381 | mpu_port, 0, miro->mpu_irq, IRQF_DISABLED, |
1388 | &rmidi))) | 1382 | &rmidi); |
1389 | snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", miro->mpu_port); | 1383 | if (error < 0) |
1384 | snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", | ||
1385 | mpu_port); | ||
1386 | } | ||
1390 | 1387 | ||
1391 | if (miro->fm_port > 0 && miro->fm_port != SNDRV_AUTO_PORT) { | 1388 | if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) { |
1392 | struct snd_opl3 *opl3 = NULL; | 1389 | struct snd_opl3 *opl3 = NULL; |
1393 | struct snd_opl4 *opl4; | 1390 | struct snd_opl4 *opl4; |
1394 | if (snd_opl4_create(card, miro->fm_port, miro->fm_port - 8, | 1391 | |
1392 | if (snd_opl4_create(card, fm_port, fm_port - 8, | ||
1395 | 2, &opl3, &opl4) < 0) | 1393 | 2, &opl3, &opl4) < 0) |
1396 | snd_printk(KERN_WARNING "no OPL4 device at 0x%lx\n", miro->fm_port); | 1394 | snd_printk(KERN_WARNING "no OPL4 device at 0x%lx\n", |
1395 | fm_port); | ||
1397 | } | 1396 | } |
1398 | 1397 | ||
1399 | if ((error = snd_set_aci_init_values(miro)) < 0) { | 1398 | error = snd_set_aci_init_values(miro); |
1400 | snd_card_free(card); | 1399 | if (error < 0) |
1401 | return error; | 1400 | return error; |
1401 | |||
1402 | return snd_card_register(card); | ||
1403 | } | ||
1404 | |||
1405 | static int __devinit snd_miro_isa_match(struct device *devptr, unsigned int n) | ||
1406 | { | ||
1407 | #ifdef CONFIG_PNP | ||
1408 | if (snd_miro_pnp_is_probed) | ||
1409 | return 0; | ||
1410 | if (isapnp) | ||
1411 | return 0; | ||
1412 | #endif | ||
1413 | return 1; | ||
1414 | } | ||
1415 | |||
1416 | static int __devinit snd_miro_isa_probe(struct device *devptr, unsigned int n) | ||
1417 | { | ||
1418 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | ||
1419 | static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; | ||
1420 | static int possible_irqs[] = {11, 9, 10, 7, -1}; | ||
1421 | static int possible_mpu_irqs[] = {10, 5, 9, 7, -1}; | ||
1422 | static int possible_dma1s[] = {3, 1, 0, -1}; | ||
1423 | static int possible_dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, | ||
1424 | {0, -1} }; | ||
1425 | |||
1426 | int error; | ||
1427 | struct snd_miro *miro; | ||
1428 | struct snd_card *card; | ||
1429 | |||
1430 | error = snd_card_create(index, id, THIS_MODULE, | ||
1431 | sizeof(struct snd_miro), &card); | ||
1432 | if (error < 0) | ||
1433 | return error; | ||
1434 | |||
1435 | card->private_free = snd_card_miro_free; | ||
1436 | miro = card->private_data; | ||
1437 | |||
1438 | error = snd_card_miro_detect(card, miro); | ||
1439 | if (error < 0) { | ||
1440 | snd_card_free(card); | ||
1441 | snd_printk(KERN_ERR "unable to detect OPTi9xx chip\n"); | ||
1442 | return -ENODEV; | ||
1443 | } | ||
1444 | |||
1445 | if (port == SNDRV_AUTO_PORT) { | ||
1446 | port = snd_legacy_find_free_ioport(possible_ports, 4); | ||
1447 | if (port < 0) { | ||
1448 | snd_card_free(card); | ||
1449 | snd_printk(KERN_ERR "unable to find a free WSS port\n"); | ||
1450 | return -EBUSY; | ||
1451 | } | ||
1452 | } | ||
1453 | |||
1454 | if (mpu_port == SNDRV_AUTO_PORT) { | ||
1455 | mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2); | ||
1456 | if (mpu_port < 0) { | ||
1457 | snd_card_free(card); | ||
1458 | snd_printk(KERN_ERR | ||
1459 | "unable to find a free MPU401 port\n"); | ||
1460 | return -EBUSY; | ||
1461 | } | ||
1462 | } | ||
1463 | |||
1464 | if (irq == SNDRV_AUTO_IRQ) { | ||
1465 | irq = snd_legacy_find_free_irq(possible_irqs); | ||
1466 | if (irq < 0) { | ||
1467 | snd_card_free(card); | ||
1468 | snd_printk(KERN_ERR "unable to find a free IRQ\n"); | ||
1469 | return -EBUSY; | ||
1470 | } | ||
1471 | } | ||
1472 | if (mpu_irq == SNDRV_AUTO_IRQ) { | ||
1473 | mpu_irq = snd_legacy_find_free_irq(possible_mpu_irqs); | ||
1474 | if (mpu_irq < 0) { | ||
1475 | snd_card_free(card); | ||
1476 | snd_printk(KERN_ERR | ||
1477 | "unable to find a free MPU401 IRQ\n"); | ||
1478 | return -EBUSY; | ||
1479 | } | ||
1480 | } | ||
1481 | if (dma1 == SNDRV_AUTO_DMA) { | ||
1482 | dma1 = snd_legacy_find_free_dma(possible_dma1s); | ||
1483 | if (dma1 < 0) { | ||
1484 | snd_card_free(card); | ||
1485 | snd_printk(KERN_ERR "unable to find a free DMA1\n"); | ||
1486 | return -EBUSY; | ||
1487 | } | ||
1488 | } | ||
1489 | if (dma2 == SNDRV_AUTO_DMA) { | ||
1490 | dma2 = snd_legacy_find_free_dma(possible_dma2s[dma1 % 4]); | ||
1491 | if (dma2 < 0) { | ||
1492 | snd_card_free(card); | ||
1493 | snd_printk(KERN_ERR "unable to find a free DMA2\n"); | ||
1494 | return -EBUSY; | ||
1495 | } | ||
1402 | } | 1496 | } |
1403 | 1497 | ||
1404 | snd_card_set_dev(card, devptr); | 1498 | snd_card_set_dev(card, devptr); |
1405 | 1499 | ||
1406 | if ((error = snd_card_register(card))) { | 1500 | error = snd_miro_probe(card); |
1501 | if (error < 0) { | ||
1407 | snd_card_free(card); | 1502 | snd_card_free(card); |
1408 | return error; | 1503 | return error; |
1409 | } | 1504 | } |
@@ -1412,7 +1507,8 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | |||
1412 | return 0; | 1507 | return 0; |
1413 | } | 1508 | } |
1414 | 1509 | ||
1415 | static int __devexit snd_miro_remove(struct device *devptr, unsigned int dev) | 1510 | static int __devexit snd_miro_isa_remove(struct device *devptr, |
1511 | unsigned int dev) | ||
1416 | { | 1512 | { |
1417 | snd_card_free(dev_get_drvdata(devptr)); | 1513 | snd_card_free(dev_get_drvdata(devptr)); |
1418 | dev_set_drvdata(devptr, NULL); | 1514 | dev_set_drvdata(devptr, NULL); |
@@ -1422,23 +1518,164 @@ static int __devexit snd_miro_remove(struct device *devptr, unsigned int dev) | |||
1422 | #define DEV_NAME "miro" | 1518 | #define DEV_NAME "miro" |
1423 | 1519 | ||
1424 | static struct isa_driver snd_miro_driver = { | 1520 | static struct isa_driver snd_miro_driver = { |
1425 | .match = snd_miro_match, | 1521 | .match = snd_miro_isa_match, |
1426 | .probe = snd_miro_probe, | 1522 | .probe = snd_miro_isa_probe, |
1427 | .remove = __devexit_p(snd_miro_remove), | 1523 | .remove = __devexit_p(snd_miro_isa_remove), |
1428 | /* FIXME: suspend/resume */ | 1524 | /* FIXME: suspend/resume */ |
1429 | .driver = { | 1525 | .driver = { |
1430 | .name = DEV_NAME | 1526 | .name = DEV_NAME |
1431 | }, | 1527 | }, |
1432 | }; | 1528 | }; |
1433 | 1529 | ||
1530 | #ifdef CONFIG_PNP | ||
1531 | |||
1532 | static int __devinit snd_card_miro_pnp(struct snd_miro *chip, | ||
1533 | struct pnp_card_link *card, | ||
1534 | const struct pnp_card_device_id *pid) | ||
1535 | { | ||
1536 | struct pnp_dev *pdev; | ||
1537 | int err; | ||
1538 | struct pnp_dev *devmpu; | ||
1539 | struct pnp_dev *devmc; | ||
1540 | |||
1541 | pdev = pnp_request_card_device(card, pid->devs[0].id, NULL); | ||
1542 | if (pdev == NULL) | ||
1543 | return -EBUSY; | ||
1544 | |||
1545 | devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); | ||
1546 | if (devmpu == NULL) | ||
1547 | return -EBUSY; | ||
1548 | |||
1549 | devmc = pnp_request_card_device(card, pid->devs[2].id, NULL); | ||
1550 | if (devmc == NULL) | ||
1551 | return -EBUSY; | ||
1552 | |||
1553 | err = pnp_activate_dev(pdev); | ||
1554 | if (err < 0) { | ||
1555 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); | ||
1556 | return err; | ||
1557 | } | ||
1558 | |||
1559 | err = pnp_activate_dev(devmc); | ||
1560 | if (err < 0) { | ||
1561 | snd_printk(KERN_ERR "OPL syntg pnp configure failure: %d\n", | ||
1562 | err); | ||
1563 | return err; | ||
1564 | } | ||
1565 | |||
1566 | port = pnp_port_start(pdev, 1); | ||
1567 | fm_port = pnp_port_start(pdev, 2) + 8; | ||
1568 | |||
1569 | /* | ||
1570 | * The MC(0) is never accessed and the miroSOUND PCM20 card does not | ||
1571 | * include it in the PnP resource range. OPTI93x include it. | ||
1572 | */ | ||
1573 | chip->mc_base = pnp_port_start(devmc, 0) - 1; | ||
1574 | chip->mc_base_size = pnp_port_len(devmc, 0) + 1; | ||
1575 | |||
1576 | irq = pnp_irq(pdev, 0); | ||
1577 | dma1 = pnp_dma(pdev, 0); | ||
1578 | dma2 = pnp_dma(pdev, 1); | ||
1579 | |||
1580 | if (mpu_port > 0) { | ||
1581 | err = pnp_activate_dev(devmpu); | ||
1582 | if (err < 0) { | ||
1583 | snd_printk(KERN_ERR "MPU401 pnp configure failure\n"); | ||
1584 | mpu_port = -1; | ||
1585 | return err; | ||
1586 | } | ||
1587 | mpu_port = pnp_port_start(devmpu, 0); | ||
1588 | mpu_irq = pnp_irq(devmpu, 0); | ||
1589 | } | ||
1590 | return 0; | ||
1591 | } | ||
1592 | |||
1593 | static int __devinit snd_miro_pnp_probe(struct pnp_card_link *pcard, | ||
1594 | const struct pnp_card_device_id *pid) | ||
1595 | { | ||
1596 | struct snd_card *card; | ||
1597 | int err; | ||
1598 | struct snd_miro *miro; | ||
1599 | |||
1600 | if (snd_miro_pnp_is_probed) | ||
1601 | return -EBUSY; | ||
1602 | if (!isapnp) | ||
1603 | return -ENODEV; | ||
1604 | err = snd_card_create(index, id, THIS_MODULE, | ||
1605 | sizeof(struct snd_miro), &card); | ||
1606 | if (err < 0) | ||
1607 | return err; | ||
1608 | |||
1609 | card->private_free = snd_card_miro_free; | ||
1610 | miro = card->private_data; | ||
1611 | |||
1612 | err = snd_card_miro_pnp(miro, pcard, pid); | ||
1613 | if (err) { | ||
1614 | snd_card_free(card); | ||
1615 | return err; | ||
1616 | } | ||
1617 | |||
1618 | /* only miroSOUND PCM20 and PCM12 == OPTi924 */ | ||
1619 | err = snd_miro_init(miro, OPTi9XX_HW_82C924); | ||
1620 | if (err) { | ||
1621 | snd_card_free(card); | ||
1622 | return err; | ||
1623 | } | ||
1624 | |||
1625 | err = snd_miro_opti_check(miro); | ||
1626 | if (err) { | ||
1627 | snd_printk(KERN_ERR "OPTI chip not found\n"); | ||
1628 | snd_card_free(card); | ||
1629 | return err; | ||
1630 | } | ||
1631 | |||
1632 | snd_card_set_dev(card, &pcard->card->dev); | ||
1633 | err = snd_miro_probe(card); | ||
1634 | if (err < 0) { | ||
1635 | snd_card_free(card); | ||
1636 | return err; | ||
1637 | } | ||
1638 | pnp_set_card_drvdata(pcard, card); | ||
1639 | snd_miro_pnp_is_probed = 1; | ||
1640 | return 0; | ||
1641 | } | ||
1642 | |||
1643 | static void __devexit snd_miro_pnp_remove(struct pnp_card_link * pcard) | ||
1644 | { | ||
1645 | snd_card_free(pnp_get_card_drvdata(pcard)); | ||
1646 | pnp_set_card_drvdata(pcard, NULL); | ||
1647 | snd_miro_pnp_is_probed = 0; | ||
1648 | } | ||
1649 | |||
1650 | static struct pnp_card_driver miro_pnpc_driver = { | ||
1651 | .flags = PNP_DRIVER_RES_DISABLE, | ||
1652 | .name = "miro", | ||
1653 | .id_table = snd_miro_pnpids, | ||
1654 | .probe = snd_miro_pnp_probe, | ||
1655 | .remove = __devexit_p(snd_miro_pnp_remove), | ||
1656 | }; | ||
1657 | #endif | ||
1658 | |||
1434 | static int __init alsa_card_miro_init(void) | 1659 | static int __init alsa_card_miro_init(void) |
1435 | { | 1660 | { |
1661 | #ifdef CONFIG_PNP | ||
1662 | pnp_register_card_driver(&miro_pnpc_driver); | ||
1663 | if (snd_miro_pnp_is_probed) | ||
1664 | return 0; | ||
1665 | pnp_unregister_card_driver(&miro_pnpc_driver); | ||
1666 | #endif | ||
1436 | return isa_register_driver(&snd_miro_driver, 1); | 1667 | return isa_register_driver(&snd_miro_driver, 1); |
1437 | } | 1668 | } |
1438 | 1669 | ||
1439 | static void __exit alsa_card_miro_exit(void) | 1670 | static void __exit alsa_card_miro_exit(void) |
1440 | { | 1671 | { |
1441 | isa_unregister_driver(&snd_miro_driver); | 1672 | if (!snd_miro_pnp_is_probed) { |
1673 | isa_unregister_driver(&snd_miro_driver); | ||
1674 | return; | ||
1675 | } | ||
1676 | #ifdef CONFIG_PNP | ||
1677 | pnp_unregister_card_driver(&miro_pnpc_driver); | ||
1678 | #endif | ||
1442 | } | 1679 | } |
1443 | 1680 | ||
1444 | module_init(alsa_card_miro_init) | 1681 | module_init(alsa_card_miro_init) |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 5cd555325b9d..d08c38906449 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -141,15 +141,7 @@ struct snd_opti9xx { | |||
141 | 141 | ||
142 | spinlock_t lock; | 142 | spinlock_t lock; |
143 | 143 | ||
144 | long wss_base; | ||
145 | int irq; | 144 | int irq; |
146 | int dma1; | ||
147 | int dma2; | ||
148 | |||
149 | long fm_port; | ||
150 | |||
151 | long mpu_port; | ||
152 | int mpu_irq; | ||
153 | 145 | ||
154 | #ifdef CONFIG_PNP | 146 | #ifdef CONFIG_PNP |
155 | struct pnp_dev *dev; | 147 | struct pnp_dev *dev; |
@@ -216,13 +208,7 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, | |||
216 | 208 | ||
217 | spin_lock_init(&chip->lock); | 209 | spin_lock_init(&chip->lock); |
218 | 210 | ||
219 | chip->wss_base = -1; | ||
220 | chip->irq = -1; | 211 | chip->irq = -1; |
221 | chip->dma1 = -1; | ||
222 | chip->dma2 = -1; | ||
223 | chip->fm_port = -1; | ||
224 | chip->mpu_port = -1; | ||
225 | chip->mpu_irq = -1; | ||
226 | 212 | ||
227 | switch (hardware) { | 213 | switch (hardware) { |
228 | #ifndef OPTi93X | 214 | #ifndef OPTi93X |
@@ -348,7 +334,10 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | |||
348 | (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) | 334 | (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) |
349 | 335 | ||
350 | 336 | ||
351 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) | 337 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, |
338 | long wss_base, | ||
339 | int irq, int dma1, int dma2, | ||
340 | long mpu_port, int mpu_irq) | ||
352 | { | 341 | { |
353 | unsigned char wss_base_bits; | 342 | unsigned char wss_base_bits; |
354 | unsigned char irq_bits; | 343 | unsigned char irq_bits; |
@@ -416,7 +405,7 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) | |||
416 | return -EINVAL; | 405 | return -EINVAL; |
417 | } | 406 | } |
418 | 407 | ||
419 | switch (chip->wss_base) { | 408 | switch (wss_base) { |
420 | case 0x530: | 409 | case 0x530: |
421 | wss_base_bits = 0x00; | 410 | wss_base_bits = 0x00; |
422 | break; | 411 | break; |
@@ -430,14 +419,13 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) | |||
430 | wss_base_bits = 0x02; | 419 | wss_base_bits = 0x02; |
431 | break; | 420 | break; |
432 | default: | 421 | default: |
433 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", | 422 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base); |
434 | chip->wss_base); | ||
435 | goto __skip_base; | 423 | goto __skip_base; |
436 | } | 424 | } |
437 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); | 425 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); |
438 | 426 | ||
439 | __skip_base: | 427 | __skip_base: |
440 | switch (chip->irq) { | 428 | switch (irq) { |
441 | //#ifdef OPTi93X | 429 | //#ifdef OPTi93X |
442 | case 5: | 430 | case 5: |
443 | irq_bits = 0x05; | 431 | irq_bits = 0x05; |
@@ -456,11 +444,11 @@ __skip_base: | |||
456 | irq_bits = 0x04; | 444 | irq_bits = 0x04; |
457 | break; | 445 | break; |
458 | default: | 446 | default: |
459 | snd_printk(KERN_WARNING "WSS irq # %d not valid\n", chip->irq); | 447 | snd_printk(KERN_WARNING "WSS irq # %d not valid\n", irq); |
460 | goto __skip_resources; | 448 | goto __skip_resources; |
461 | } | 449 | } |
462 | 450 | ||
463 | switch (chip->dma1) { | 451 | switch (dma1) { |
464 | case 0: | 452 | case 0: |
465 | dma_bits = 0x01; | 453 | dma_bits = 0x01; |
466 | break; | 454 | break; |
@@ -471,38 +459,36 @@ __skip_base: | |||
471 | dma_bits = 0x03; | 459 | dma_bits = 0x03; |
472 | break; | 460 | break; |
473 | default: | 461 | default: |
474 | snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", | 462 | snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", dma1); |
475 | chip->dma1); | ||
476 | goto __skip_resources; | 463 | goto __skip_resources; |
477 | } | 464 | } |
478 | 465 | ||
479 | #if defined(CS4231) || defined(OPTi93X) | 466 | #if defined(CS4231) || defined(OPTi93X) |
480 | if (chip->dma1 == chip->dma2) { | 467 | if (dma1 == dma2) { |
481 | snd_printk(KERN_ERR "don't want to share dmas\n"); | 468 | snd_printk(KERN_ERR "don't want to share dmas\n"); |
482 | return -EBUSY; | 469 | return -EBUSY; |
483 | } | 470 | } |
484 | 471 | ||
485 | switch (chip->dma2) { | 472 | switch (dma2) { |
486 | case 0: | 473 | case 0: |
487 | case 1: | 474 | case 1: |
488 | break; | 475 | break; |
489 | default: | 476 | default: |
490 | snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", | 477 | snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", dma2); |
491 | chip->dma2); | ||
492 | goto __skip_resources; | 478 | goto __skip_resources; |
493 | } | 479 | } |
494 | dma_bits |= 0x04; | 480 | dma_bits |= 0x04; |
495 | #endif /* CS4231 || OPTi93X */ | 481 | #endif /* CS4231 || OPTi93X */ |
496 | 482 | ||
497 | #ifndef OPTi93X | 483 | #ifndef OPTi93X |
498 | outb(irq_bits << 3 | dma_bits, chip->wss_base); | 484 | outb(irq_bits << 3 | dma_bits, wss_base); |
499 | #else /* OPTi93X */ | 485 | #else /* OPTi93X */ |
500 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); | 486 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); |
501 | #endif /* OPTi93X */ | 487 | #endif /* OPTi93X */ |
502 | 488 | ||
503 | __skip_resources: | 489 | __skip_resources: |
504 | if (chip->hardware > OPTi9XX_HW_82C928) { | 490 | if (chip->hardware > OPTi9XX_HW_82C928) { |
505 | switch (chip->mpu_port) { | 491 | switch (mpu_port) { |
506 | case 0: | 492 | case 0: |
507 | case -1: | 493 | case -1: |
508 | break; | 494 | break; |
@@ -520,12 +506,11 @@ __skip_resources: | |||
520 | break; | 506 | break; |
521 | default: | 507 | default: |
522 | snd_printk(KERN_WARNING | 508 | snd_printk(KERN_WARNING |
523 | "MPU-401 port 0x%lx not valid\n", | 509 | "MPU-401 port 0x%lx not valid\n", mpu_port); |
524 | chip->mpu_port); | ||
525 | goto __skip_mpu; | 510 | goto __skip_mpu; |
526 | } | 511 | } |
527 | 512 | ||
528 | switch (chip->mpu_irq) { | 513 | switch (mpu_irq) { |
529 | case 5: | 514 | case 5: |
530 | mpu_irq_bits = 0x02; | 515 | mpu_irq_bits = 0x02; |
531 | break; | 516 | break; |
@@ -540,12 +525,12 @@ __skip_resources: | |||
540 | break; | 525 | break; |
541 | default: | 526 | default: |
542 | snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n", | 527 | snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n", |
543 | chip->mpu_irq); | 528 | mpu_irq); |
544 | goto __skip_mpu; | 529 | goto __skip_mpu; |
545 | } | 530 | } |
546 | 531 | ||
547 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), | 532 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), |
548 | (chip->mpu_port <= 0) ? 0x00 : | 533 | (mpu_port <= 0) ? 0x00 : |
549 | 0x80 | mpu_port_bits << 5 | mpu_irq_bits << 3, | 534 | 0x80 | mpu_port_bits << 5 | mpu_irq_bits << 3, |
550 | 0xf8); | 535 | 0xf8); |
551 | } | 536 | } |
@@ -701,6 +686,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
701 | { | 686 | { |
702 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | 687 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
703 | int error; | 688 | int error; |
689 | int xdma2; | ||
704 | struct snd_opti9xx *chip = card->private_data; | 690 | struct snd_opti9xx *chip = card->private_data; |
705 | struct snd_wss *codec; | 691 | struct snd_wss *codec; |
706 | #ifdef CS4231 | 692 | #ifdef CS4231 |
@@ -715,31 +701,25 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
715 | "OPTi9xx MC")) == NULL) | 701 | "OPTi9xx MC")) == NULL) |
716 | return -ENOMEM; | 702 | return -ENOMEM; |
717 | 703 | ||
718 | chip->wss_base = port; | ||
719 | chip->fm_port = fm_port; | ||
720 | chip->mpu_port = mpu_port; | ||
721 | chip->irq = irq; | ||
722 | chip->mpu_irq = mpu_irq; | ||
723 | chip->dma1 = dma1; | ||
724 | #if defined(CS4231) || defined(OPTi93X) | 704 | #if defined(CS4231) || defined(OPTi93X) |
725 | chip->dma2 = dma2; | 705 | xdma2 = dma2; |
726 | #else | 706 | #else |
727 | chip->dma2 = -1; | 707 | xdma2 = -1; |
728 | #endif | 708 | #endif |
729 | 709 | ||
730 | if (chip->wss_base == SNDRV_AUTO_PORT) { | 710 | if (port == SNDRV_AUTO_PORT) { |
731 | chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4); | 711 | port = snd_legacy_find_free_ioport(possible_ports, 4); |
732 | if (chip->wss_base < 0) { | 712 | if (port < 0) { |
733 | snd_printk(KERN_ERR "unable to find a free WSS port\n"); | 713 | snd_printk(KERN_ERR "unable to find a free WSS port\n"); |
734 | return -EBUSY; | 714 | return -EBUSY; |
735 | } | 715 | } |
736 | } | 716 | } |
737 | error = snd_opti9xx_configure(chip); | 717 | error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2, |
718 | mpu_port, mpu_irq); | ||
738 | if (error) | 719 | if (error) |
739 | return error; | 720 | return error; |
740 | 721 | ||
741 | error = snd_wss_create(card, chip->wss_base + 4, -1, | 722 | error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2, |
742 | chip->irq, chip->dma1, chip->dma2, | ||
743 | #ifdef OPTi93X | 723 | #ifdef OPTi93X |
744 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, | 724 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, |
745 | #else | 725 | #else |
@@ -763,35 +743,35 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
763 | return error; | 743 | return error; |
764 | #endif | 744 | #endif |
765 | #ifdef OPTi93X | 745 | #ifdef OPTi93X |
766 | error = request_irq(chip->irq, snd_opti93x_interrupt, | 746 | error = request_irq(irq, snd_opti93x_interrupt, |
767 | IRQF_DISABLED, DEV_NAME" - WSS", codec); | 747 | IRQF_DISABLED, DEV_NAME" - WSS", codec); |
768 | if (error < 0) { | 748 | if (error < 0) { |
769 | snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); | 749 | snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); |
770 | return error; | 750 | return error; |
771 | } | 751 | } |
772 | #endif | 752 | #endif |
753 | chip->irq = irq; | ||
773 | strcpy(card->driver, chip->name); | 754 | strcpy(card->driver, chip->name); |
774 | sprintf(card->shortname, "OPTi %s", card->driver); | 755 | sprintf(card->shortname, "OPTi %s", card->driver); |
775 | #if defined(CS4231) || defined(OPTi93X) | 756 | #if defined(CS4231) || defined(OPTi93X) |
776 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", | 757 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", |
777 | card->shortname, pcm->name, chip->wss_base + 4, | 758 | card->shortname, pcm->name, port + 4, irq, dma1, xdma2); |
778 | chip->irq, chip->dma1, chip->dma2); | ||
779 | #else | 759 | #else |
780 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", | 760 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", |
781 | card->shortname, pcm->name, chip->wss_base + 4, | 761 | card->shortname, pcm->name, port + 4, irq, dma1); |
782 | chip->irq, chip->dma1); | ||
783 | #endif /* CS4231 || OPTi93X */ | 762 | #endif /* CS4231 || OPTi93X */ |
784 | 763 | ||
785 | if (chip->mpu_port <= 0 || chip->mpu_port == SNDRV_AUTO_PORT) | 764 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) |
786 | rmidi = NULL; | 765 | rmidi = NULL; |
787 | else | 766 | else { |
788 | if ((error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, | 767 | error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, |
789 | chip->mpu_port, 0, chip->mpu_irq, IRQF_DISABLED, | 768 | mpu_port, 0, mpu_irq, IRQF_DISABLED, &rmidi); |
790 | &rmidi))) | 769 | if (error) |
791 | snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", | 770 | snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", |
792 | chip->mpu_port); | 771 | mpu_port); |
772 | } | ||
793 | 773 | ||
794 | if (chip->fm_port > 0 && chip->fm_port != SNDRV_AUTO_PORT) { | 774 | if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) { |
795 | struct snd_opl3 *opl3 = NULL; | 775 | struct snd_opl3 *opl3 = NULL; |
796 | #ifndef OPTi93X | 776 | #ifndef OPTi93X |
797 | if (chip->hardware == OPTi9XX_HW_82C928 || | 777 | if (chip->hardware == OPTi9XX_HW_82C928 || |
@@ -801,9 +781,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
801 | /* assume we have an OPL4 */ | 781 | /* assume we have an OPL4 */ |
802 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), | 782 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), |
803 | 0x20, 0x20); | 783 | 0x20, 0x20); |
804 | if (snd_opl4_create(card, | 784 | if (snd_opl4_create(card, fm_port, fm_port - 8, |
805 | chip->fm_port, | ||
806 | chip->fm_port - 8, | ||
807 | 2, &opl3, &opl4) < 0) { | 785 | 2, &opl3, &opl4) < 0) { |
808 | /* no luck, use OPL3 instead */ | 786 | /* no luck, use OPL3 instead */ |
809 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), | 787 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), |
@@ -811,12 +789,10 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
811 | } | 789 | } |
812 | } | 790 | } |
813 | #endif /* !OPTi93X */ | 791 | #endif /* !OPTi93X */ |
814 | if (!opl3 && snd_opl3_create(card, | 792 | if (!opl3 && snd_opl3_create(card, fm_port, fm_port + 2, |
815 | chip->fm_port, | ||
816 | chip->fm_port + 2, | ||
817 | OPL3_HW_AUTO, 0, &opl3) < 0) { | 793 | OPL3_HW_AUTO, 0, &opl3) < 0) { |
818 | snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n", | 794 | snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n", |
819 | chip->fm_port, chip->fm_port + 4 - 1); | 795 | fm_port, fm_port + 4 - 1); |
820 | } | 796 | } |
821 | if (opl3) { | 797 | if (opl3) { |
822 | error = snd_opl3_hwdep_new(opl3, 0, 1, &synth); | 798 | error = snd_opl3_hwdep_new(opl3, 0, 1, &synth); |
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 2ba18978b419..5b9d6c18bc45 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c | |||
@@ -1682,7 +1682,7 @@ static void snd_wss_resume(struct snd_wss *chip) | |||
1682 | } | 1682 | } |
1683 | #endif /* CONFIG_PM */ | 1683 | #endif /* CONFIG_PM */ |
1684 | 1684 | ||
1685 | int snd_wss_free(struct snd_wss *chip) | 1685 | static int snd_wss_free(struct snd_wss *chip) |
1686 | { | 1686 | { |
1687 | release_and_free_resource(chip->res_port); | 1687 | release_and_free_resource(chip->res_port); |
1688 | release_and_free_resource(chip->res_cport); | 1688 | release_and_free_resource(chip->res_cport); |
@@ -1705,7 +1705,6 @@ int snd_wss_free(struct snd_wss *chip) | |||
1705 | kfree(chip); | 1705 | kfree(chip); |
1706 | return 0; | 1706 | return 0; |
1707 | } | 1707 | } |
1708 | EXPORT_SYMBOL(snd_wss_free); | ||
1709 | 1708 | ||
1710 | static int snd_wss_dev_free(struct snd_device *device) | 1709 | static int snd_wss_dev_free(struct snd_device *device) |
1711 | { | 1710 | { |
@@ -2225,7 +2224,7 @@ WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, | |||
2225 | .get = snd_wss_get_mux, | 2224 | .get = snd_wss_get_mux, |
2226 | .put = snd_wss_put_mux, | 2225 | .put = snd_wss_put_mux, |
2227 | }, | 2226 | }, |
2228 | WSS_DOUBLE("Mic Boost", 0, | 2227 | WSS_DOUBLE("Mic Boost (+20dB)", 0, |
2229 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | 2228 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), |
2230 | WSS_SINGLE("Loopback Capture Switch", 0, | 2229 | WSS_SINGLE("Loopback Capture Switch", 0, |
2231 | CS4231_LOOPBACK, 0, 1, 0), | 2230 | CS4231_LOOPBACK, 0, 1, 0), |
@@ -2236,14 +2235,14 @@ WSS_DOUBLE("Line Playback Switch", 0, | |||
2236 | WSS_DOUBLE_TLV("Line Playback Volume", 0, | 2235 | WSS_DOUBLE_TLV("Line Playback Volume", 0, |
2237 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, | 2236 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, |
2238 | db_scale_5bit_12db_max), | 2237 | db_scale_5bit_12db_max), |
2239 | WSS_SINGLE("Mono Playback Switch", 0, | 2238 | WSS_SINGLE("Beep Playback Switch", 0, |
2240 | CS4231_MONO_CTRL, 7, 1, 1), | 2239 | CS4231_MONO_CTRL, 7, 1, 1), |
2241 | WSS_SINGLE_TLV("Mono Playback Volume", 0, | 2240 | WSS_SINGLE_TLV("Beep Playback Volume", 0, |
2242 | CS4231_MONO_CTRL, 0, 15, 1, | 2241 | CS4231_MONO_CTRL, 0, 15, 1, |
2243 | db_scale_4bit), | 2242 | db_scale_4bit), |
2244 | WSS_SINGLE("Mono Output Playback Switch", 0, | 2243 | WSS_SINGLE("Mono Output Playback Switch", 0, |
2245 | CS4231_MONO_CTRL, 6, 1, 1), | 2244 | CS4231_MONO_CTRL, 6, 1, 1), |
2246 | WSS_SINGLE("Mono Output Playback Bypass", 0, | 2245 | WSS_SINGLE("Beep Bypass Playback Switch", 0, |
2247 | CS4231_MONO_CTRL, 5, 1, 0), | 2246 | CS4231_MONO_CTRL, 5, 1, 0), |
2248 | }; | 2247 | }; |
2249 | 2248 | ||
diff --git a/sound/oss/audio.c b/sound/oss/audio.c index b69c05b7ea7b..7df48a25c4ee 100644 --- a/sound/oss/audio.c +++ b/sound/oss/audio.c | |||
@@ -838,7 +838,7 @@ static int dma_ioctl(int dev, unsigned int cmd, void __user *arg) | |||
838 | if ((err = audio_devs[dev]->d->prepare_for_input(dev, | 838 | if ((err = audio_devs[dev]->d->prepare_for_input(dev, |
839 | dmap_in->fragment_size, dmap_in->nbufs)) < 0) { | 839 | dmap_in->fragment_size, dmap_in->nbufs)) < 0) { |
840 | spin_unlock_irqrestore(&dmap_in->lock,flags); | 840 | spin_unlock_irqrestore(&dmap_in->lock,flags); |
841 | return -err; | 841 | return err; |
842 | } | 842 | } |
843 | dmap_in->dma_mode = DMODE_INPUT; | 843 | dmap_in->dma_mode = DMODE_INPUT; |
844 | audio_devs[dev]->enable_bits |= PCM_ENABLE_INPUT; | 844 | audio_devs[dev]->enable_bits |= PCM_ENABLE_INPUT; |
diff --git a/sound/oss/midi_synth.c b/sound/oss/midi_synth.c index 9e450988ed36..3bc7104c5379 100644 --- a/sound/oss/midi_synth.c +++ b/sound/oss/midi_synth.c | |||
@@ -426,7 +426,7 @@ midi_synth_open(int dev, int mode) | |||
426 | int err; | 426 | int err; |
427 | struct midi_input_info *inc; | 427 | struct midi_input_info *inc; |
428 | 428 | ||
429 | if (orig_dev < 0 || orig_dev > num_midis || midi_devs[orig_dev] == NULL) | 429 | if (orig_dev < 0 || orig_dev >= num_midis || midi_devs[orig_dev] == NULL) |
430 | return -ENXIO; | 430 | return -ENXIO; |
431 | 431 | ||
432 | midi2synth[orig_dev] = dev; | 432 | midi2synth[orig_dev] = dev; |
diff --git a/sound/oss/mpu401.c b/sound/oss/mpu401.c index 734b8f9e2f78..0af9d24feb8f 100644 --- a/sound/oss/mpu401.c +++ b/sound/oss/mpu401.c | |||
@@ -770,7 +770,7 @@ static int mpu_synth_ioctl(int dev, unsigned int cmd, void __user *arg) | |||
770 | 770 | ||
771 | midi_dev = synth_devs[dev]->midi_dev; | 771 | midi_dev = synth_devs[dev]->midi_dev; |
772 | 772 | ||
773 | if (midi_dev < 0 || midi_dev > num_midis || midi_devs[midi_dev] == NULL) | 773 | if (midi_dev < 0 || midi_dev >= num_midis || midi_devs[midi_dev] == NULL) |
774 | return -ENXIO; | 774 | return -ENXIO; |
775 | 775 | ||
776 | devc = &dev_conf[midi_dev]; | 776 | devc = &dev_conf[midi_dev]; |
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 75c602b5b132..351654cf7b09 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -570,6 +570,7 @@ config SND_ICE1712 | |||
570 | tristate "ICEnsemble ICE1712 (Envy24)" | 570 | tristate "ICEnsemble ICE1712 (Envy24)" |
571 | select SND_MPU401_UART | 571 | select SND_MPU401_UART |
572 | select SND_AC97_CODEC | 572 | select SND_AC97_CODEC |
573 | select BITREVERSE | ||
573 | help | 574 | help |
574 | Say Y here to include support for soundcards based on the | 575 | Say Y here to include support for soundcards based on the |
575 | ICE1712 (Envy24) chip. | 576 | ICE1712 (Envy24) chip. |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 60cdb9e0b68d..83508b3964fb 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -55,7 +55,7 @@ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card * | |||
55 | * 1 = MediaForte 256-PCS | 55 | * 1 = MediaForte 256-PCS |
56 | * 2 = MediaForte 256-PCPR | 56 | * 2 = MediaForte 256-PCPR |
57 | * 3 = MediaForte 64-PCR | 57 | * 3 = MediaForte 64-PCR |
58 | * 16 = setup tuner only (this is additional bit), i.e. SF-64-PCR FM card | 58 | * 16 = setup tuner only (this is additional bit), i.e. SF64-PCR FM card |
59 | * High 16-bits are video (radio) device number + 1 | 59 | * High 16-bits are video (radio) device number + 1 |
60 | */ | 60 | */ |
61 | static int tea575x_tuner[SNDRV_CARDS]; | 61 | static int tea575x_tuner[SNDRV_CARDS]; |
@@ -67,7 +67,10 @@ MODULE_PARM_DESC(id, "ID string for the FM801 soundcard."); | |||
67 | module_param_array(enable, bool, NULL, 0444); | 67 | module_param_array(enable, bool, NULL, 0444); |
68 | MODULE_PARM_DESC(enable, "Enable FM801 soundcard."); | 68 | MODULE_PARM_DESC(enable, "Enable FM801 soundcard."); |
69 | module_param_array(tea575x_tuner, int, NULL, 0444); | 69 | module_param_array(tea575x_tuner, int, NULL, 0444); |
70 | MODULE_PARM_DESC(tea575x_tuner, "Enable TEA575x tuner."); | 70 | MODULE_PARM_DESC(tea575x_tuner, "TEA575x tuner access method (1 = SF256-PCS, 2=SF256-PCPR, 3=SF64-PCR, +16=tuner-only)."); |
71 | |||
72 | #define TUNER_ONLY (1<<4) | ||
73 | #define TUNER_TYPE_MASK (~TUNER_ONLY & 0xFFFF) | ||
71 | 74 | ||
72 | /* | 75 | /* |
73 | * Direct registers | 76 | * Direct registers |
@@ -160,7 +163,7 @@ struct fm801 { | |||
160 | unsigned int multichannel: 1, /* multichannel support */ | 163 | unsigned int multichannel: 1, /* multichannel support */ |
161 | secondary: 1; /* secondary codec */ | 164 | secondary: 1; /* secondary codec */ |
162 | unsigned char secondary_addr; /* address of the secondary codec */ | 165 | unsigned char secondary_addr; /* address of the secondary codec */ |
163 | unsigned int tea575x_tuner; /* tuner flags */ | 166 | unsigned int tea575x_tuner; /* tuner access method & flags */ |
164 | 167 | ||
165 | unsigned short ply_ctrl; /* playback control */ | 168 | unsigned short ply_ctrl; /* playback control */ |
166 | unsigned short cap_ctrl; /* capture control */ | 169 | unsigned short cap_ctrl; /* capture control */ |
@@ -1287,7 +1290,7 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume) | |||
1287 | { | 1290 | { |
1288 | unsigned short cmdw; | 1291 | unsigned short cmdw; |
1289 | 1292 | ||
1290 | if (chip->tea575x_tuner & 0x0010) | 1293 | if (chip->tea575x_tuner & TUNER_ONLY) |
1291 | goto __ac97_ok; | 1294 | goto __ac97_ok; |
1292 | 1295 | ||
1293 | /* codec cold reset + AC'97 warm reset */ | 1296 | /* codec cold reset + AC'97 warm reset */ |
@@ -1296,11 +1299,13 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume) | |||
1296 | udelay(100); | 1299 | udelay(100); |
1297 | outw(0, FM801_REG(chip, CODEC_CTRL)); | 1300 | outw(0, FM801_REG(chip, CODEC_CTRL)); |
1298 | 1301 | ||
1299 | if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0) { | 1302 | if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0) |
1300 | snd_printk(KERN_ERR "Primary AC'97 codec not found\n"); | 1303 | if (!resume) { |
1301 | if (! resume) | 1304 | snd_printk(KERN_INFO "Primary AC'97 codec not found, " |
1302 | return -EIO; | 1305 | "assume SF64-PCR (tuner-only)\n"); |
1303 | } | 1306 | chip->tea575x_tuner = 3 | TUNER_ONLY; |
1307 | goto __ac97_ok; | ||
1308 | } | ||
1304 | 1309 | ||
1305 | if (chip->multichannel) { | 1310 | if (chip->multichannel) { |
1306 | if (chip->secondary_addr) { | 1311 | if (chip->secondary_addr) { |
@@ -1414,7 +1419,7 @@ static int __devinit snd_fm801_create(struct snd_card *card, | |||
1414 | return err; | 1419 | return err; |
1415 | } | 1420 | } |
1416 | chip->port = pci_resource_start(pci, 0); | 1421 | chip->port = pci_resource_start(pci, 0); |
1417 | if ((tea575x_tuner & 0x0010) == 0) { | 1422 | if ((tea575x_tuner & TUNER_ONLY) == 0) { |
1418 | if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED, | 1423 | if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED, |
1419 | "FM801", chip)) { | 1424 | "FM801", chip)) { |
1420 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); | 1425 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); |
@@ -1429,6 +1434,14 @@ static int __devinit snd_fm801_create(struct snd_card *card, | |||
1429 | chip->multichannel = 1; | 1434 | chip->multichannel = 1; |
1430 | 1435 | ||
1431 | snd_fm801_chip_init(chip, 0); | 1436 | snd_fm801_chip_init(chip, 0); |
1437 | /* init might set tuner access method */ | ||
1438 | tea575x_tuner = chip->tea575x_tuner; | ||
1439 | |||
1440 | if (chip->irq >= 0 && (tea575x_tuner & TUNER_ONLY)) { | ||
1441 | pci_clear_master(pci); | ||
1442 | free_irq(chip->irq, chip); | ||
1443 | chip->irq = -1; | ||
1444 | } | ||
1432 | 1445 | ||
1433 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 1446 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
1434 | snd_fm801_free(chip); | 1447 | snd_fm801_free(chip); |
@@ -1438,12 +1451,13 @@ static int __devinit snd_fm801_create(struct snd_card *card, | |||
1438 | snd_card_set_dev(card, &pci->dev); | 1451 | snd_card_set_dev(card, &pci->dev); |
1439 | 1452 | ||
1440 | #ifdef TEA575X_RADIO | 1453 | #ifdef TEA575X_RADIO |
1441 | if (tea575x_tuner > 0 && (tea575x_tuner & 0x000f) < 4) { | 1454 | if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 && |
1455 | (tea575x_tuner & TUNER_TYPE_MASK) < 4) { | ||
1442 | chip->tea.dev_nr = tea575x_tuner >> 16; | 1456 | chip->tea.dev_nr = tea575x_tuner >> 16; |
1443 | chip->tea.card = card; | 1457 | chip->tea.card = card; |
1444 | chip->tea.freq_fixup = 10700; | 1458 | chip->tea.freq_fixup = 10700; |
1445 | chip->tea.private_data = chip; | 1459 | chip->tea.private_data = chip; |
1446 | chip->tea.ops = &snd_fm801_tea_ops[(tea575x_tuner & 0x000f) - 1]; | 1460 | chip->tea.ops = &snd_fm801_tea_ops[(tea575x_tuner & TUNER_TYPE_MASK) - 1]; |
1447 | snd_tea575x_init(&chip->tea); | 1461 | snd_tea575x_init(&chip->tea); |
1448 | } | 1462 | } |
1449 | #endif | 1463 | #endif |
@@ -1483,7 +1497,7 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci, | |||
1483 | sprintf(card->longname, "%s at 0x%lx, irq %i", | 1497 | sprintf(card->longname, "%s at 0x%lx, irq %i", |
1484 | card->shortname, chip->port, chip->irq); | 1498 | card->shortname, chip->port, chip->irq); |
1485 | 1499 | ||
1486 | if (tea575x_tuner[dev] & 0x0010) | 1500 | if (chip->tea575x_tuner & TUNER_ONLY) |
1487 | goto __fm801_tuner_only; | 1501 | goto __fm801_tuner_only; |
1488 | 1502 | ||
1489 | if ((err = snd_fm801_pcm(chip, 0, NULL)) < 0) { | 1503 | if ((err = snd_fm801_pcm(chip, 0, NULL)) < 0) { |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index fd948bfd9aef..f5020ad99a10 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -504,6 +504,31 @@ static int __devinit juli_add_controls(struct snd_ice1712 *ice) | |||
504 | } | 504 | } |
505 | 505 | ||
506 | /* | 506 | /* |
507 | * suspend/resume | ||
508 | * */ | ||
509 | |||
510 | #ifdef CONFIG_PM | ||
511 | static int juli_resume(struct snd_ice1712 *ice) | ||
512 | { | ||
513 | struct snd_akm4xxx *ak = ice->akm; | ||
514 | struct juli_spec *spec = ice->spec; | ||
515 | /* akm4358 un-reset, un-mute */ | ||
516 | snd_akm4xxx_reset(ak, 0); | ||
517 | /* reinit ak4114 */ | ||
518 | snd_ak4114_reinit(spec->ak4114); | ||
519 | return 0; | ||
520 | } | ||
521 | |||
522 | static int juli_suspend(struct snd_ice1712 *ice) | ||
523 | { | ||
524 | struct snd_akm4xxx *ak = ice->akm; | ||
525 | /* akm4358 reset and soft-mute */ | ||
526 | snd_akm4xxx_reset(ak, 1); | ||
527 | return 0; | ||
528 | } | ||
529 | #endif | ||
530 | |||
531 | /* | ||
507 | * initialize the chip | 532 | * initialize the chip |
508 | */ | 533 | */ |
509 | 534 | ||
@@ -646,6 +671,13 @@ static int __devinit juli_init(struct snd_ice1712 *ice) | |||
646 | ice->set_spdif_clock = juli_set_spdif_clock; | 671 | ice->set_spdif_clock = juli_set_spdif_clock; |
647 | 672 | ||
648 | ice->spdif.ops.open = juli_spdif_in_open; | 673 | ice->spdif.ops.open = juli_spdif_in_open; |
674 | |||
675 | #ifdef CONFIG_PM | ||
676 | ice->pm_resume = juli_resume; | ||
677 | ice->pm_suspend = juli_suspend; | ||
678 | ice->pm_suspend_enabled = 1; | ||
679 | #endif | ||
680 | |||
649 | return 0; | 681 | return 0; |
650 | } | 682 | } |
651 | 683 | ||
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index aac20fb4aad2..b990143636f1 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -2063,6 +2063,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
2063 | .type = AC97_TUNE_HP_ONLY | 2063 | .type = AC97_TUNE_HP_ONLY |
2064 | }, | 2064 | }, |
2065 | { | 2065 | { |
2066 | .subvendor = 0x161f, | ||
2067 | .subdevice = 0x203a, | ||
2068 | .name = "Gateway 4525GZ", /* AD1981B */ | ||
2069 | .type = AC97_TUNE_INV_EAPD | ||
2070 | }, | ||
2071 | { | ||
2066 | .subvendor = 0x1734, | 2072 | .subvendor = 0x1734, |
2067 | .subdevice = 0x0088, | 2073 | .subdevice = 0x0088, |
2068 | .name = "Fujitsu-Siemens D1522", /* AD1981 */ | 2074 | .name = "Fujitsu-Siemens D1522", /* AD1981 */ |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 8db0374e10d5..b074a594c595 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2893,7 +2893,9 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) | |||
2893 | if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || | 2893 | if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || |
2894 | altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && | 2894 | altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && |
2895 | altsd->bInterfaceSubClass == USB_SUBCLASS_MIDI_STREAMING) { | 2895 | altsd->bInterfaceSubClass == USB_SUBCLASS_MIDI_STREAMING) { |
2896 | if (snd_usb_create_midi_interface(chip, iface, NULL) < 0) { | 2896 | int err = snd_usbmidi_create(chip->card, iface, |
2897 | &chip->midi_list, NULL); | ||
2898 | if (err < 0) { | ||
2897 | snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", dev->devnum, ctrlif, j); | 2899 | snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", dev->devnum, ctrlif, j); |
2898 | continue; | 2900 | continue; |
2899 | } | 2901 | } |
@@ -3038,12 +3040,11 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, | |||
3038 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | 3040 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
3039 | .data = &uaxx_ep | 3041 | .data = &uaxx_ep |
3040 | }; | 3042 | }; |
3041 | if (chip->usb_id == USB_ID(0x0582, 0x002b)) | 3043 | const struct snd_usb_audio_quirk *quirk = |
3042 | return snd_usb_create_midi_interface(chip, iface, | 3044 | chip->usb_id == USB_ID(0x0582, 0x002b) |
3043 | &ua700_quirk); | 3045 | ? &ua700_quirk : &uaxx_quirk; |
3044 | else | 3046 | return snd_usbmidi_create(chip->card, iface, |
3045 | return snd_usb_create_midi_interface(chip, iface, | 3047 | &chip->midi_list, quirk); |
3046 | &uaxx_quirk); | ||
3047 | } | 3048 | } |
3048 | 3049 | ||
3049 | if (altsd->bNumEndpoints != 1) | 3050 | if (altsd->bNumEndpoints != 1) |
@@ -3370,6 +3371,13 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, | |||
3370 | return 0; /* keep this altsetting */ | 3371 | return 0; /* keep this altsetting */ |
3371 | } | 3372 | } |
3372 | 3373 | ||
3374 | static int create_any_midi_quirk(struct snd_usb_audio *chip, | ||
3375 | struct usb_interface *intf, | ||
3376 | const struct snd_usb_audio_quirk *quirk) | ||
3377 | { | ||
3378 | return snd_usbmidi_create(chip->card, intf, &chip->midi_list, quirk); | ||
3379 | } | ||
3380 | |||
3373 | /* | 3381 | /* |
3374 | * audio-interface quirks | 3382 | * audio-interface quirks |
3375 | * | 3383 | * |
@@ -3387,14 +3395,14 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, | |||
3387 | static const quirk_func_t quirk_funcs[] = { | 3395 | static const quirk_func_t quirk_funcs[] = { |
3388 | [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, | 3396 | [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, |
3389 | [QUIRK_COMPOSITE] = create_composite_quirk, | 3397 | [QUIRK_COMPOSITE] = create_composite_quirk, |
3390 | [QUIRK_MIDI_STANDARD_INTERFACE] = snd_usb_create_midi_interface, | 3398 | [QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk, |
3391 | [QUIRK_MIDI_FIXED_ENDPOINT] = snd_usb_create_midi_interface, | 3399 | [QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk, |
3392 | [QUIRK_MIDI_YAMAHA] = snd_usb_create_midi_interface, | 3400 | [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, |
3393 | [QUIRK_MIDI_MIDIMAN] = snd_usb_create_midi_interface, | 3401 | [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, |
3394 | [QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface, | 3402 | [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, |
3395 | [QUIRK_MIDI_FASTLANE] = snd_usb_create_midi_interface, | 3403 | [QUIRK_MIDI_FASTLANE] = create_any_midi_quirk, |
3396 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, | 3404 | [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, |
3397 | [QUIRK_MIDI_CME] = snd_usb_create_midi_interface, | 3405 | [QUIRK_MIDI_CME] = create_any_midi_quirk, |
3398 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, | 3406 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3399 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, | 3407 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3400 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, | 3408 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index e9a3a9dca15c..40ba8115fb81 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -132,7 +132,6 @@ struct snd_usb_audio { | |||
132 | int pcm_devs; | 132 | int pcm_devs; |
133 | 133 | ||
134 | struct list_head midi_list; /* list of midi interfaces */ | 134 | struct list_head midi_list; /* list of midi interfaces */ |
135 | int next_midi_device; | ||
136 | 135 | ||
137 | struct list_head mixer_list; /* list of mixer interfaces */ | 136 | struct list_head mixer_list; /* list of mixer interfaces */ |
138 | }; | 137 | }; |
@@ -227,8 +226,10 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, | |||
227 | int ignore_error); | 226 | int ignore_error); |
228 | void snd_usb_mixer_disconnect(struct list_head *p); | 227 | void snd_usb_mixer_disconnect(struct list_head *p); |
229 | 228 | ||
230 | int snd_usb_create_midi_interface(struct snd_usb_audio *chip, struct usb_interface *iface, | 229 | int snd_usbmidi_create(struct snd_card *card, |
231 | const struct snd_usb_audio_quirk *quirk); | 230 | struct usb_interface *iface, |
231 | struct list_head *midi_list, | ||
232 | const struct snd_usb_audio_quirk *quirk); | ||
232 | void snd_usbmidi_input_stop(struct list_head* p); | 233 | void snd_usbmidi_input_stop(struct list_head* p); |
233 | void snd_usbmidi_input_start(struct list_head* p); | 234 | void snd_usbmidi_input_start(struct list_head* p); |
234 | void snd_usbmidi_disconnect(struct list_head *p); | 235 | void snd_usbmidi_disconnect(struct list_head *p); |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 0eff19ceb7e1..6e89b8368d9a 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * usbmidi.c - ALSA USB MIDI driver | 2 | * usbmidi.c - ALSA USB MIDI driver |
3 | * | 3 | * |
4 | * Copyright (c) 2002-2007 Clemens Ladisch | 4 | * Copyright (c) 2002-2009 Clemens Ladisch |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * Based on the OSS usb-midi driver by NAGANO Daisuke, | 7 | * Based on the OSS usb-midi driver by NAGANO Daisuke, |
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/usb.h> | 47 | #include <linux/usb.h> |
48 | #include <linux/wait.h> | 48 | #include <linux/wait.h> |
49 | #include <sound/core.h> | 49 | #include <sound/core.h> |
50 | #include <sound/control.h> | ||
50 | #include <sound/rawmidi.h> | 51 | #include <sound/rawmidi.h> |
51 | #include <sound/asequencer.h> | 52 | #include <sound/asequencer.h> |
52 | #include "usbaudio.h" | 53 | #include "usbaudio.h" |
@@ -101,7 +102,8 @@ struct usb_protocol_ops { | |||
101 | }; | 102 | }; |
102 | 103 | ||
103 | struct snd_usb_midi { | 104 | struct snd_usb_midi { |
104 | struct snd_usb_audio *chip; | 105 | struct usb_device *dev; |
106 | struct snd_card *card; | ||
105 | struct usb_interface *iface; | 107 | struct usb_interface *iface; |
106 | const struct snd_usb_audio_quirk *quirk; | 108 | const struct snd_usb_audio_quirk *quirk; |
107 | struct snd_rawmidi *rmidi; | 109 | struct snd_rawmidi *rmidi; |
@@ -109,13 +111,19 @@ struct snd_usb_midi { | |||
109 | struct list_head list; | 111 | struct list_head list; |
110 | struct timer_list error_timer; | 112 | struct timer_list error_timer; |
111 | spinlock_t disc_lock; | 113 | spinlock_t disc_lock; |
114 | struct mutex mutex; | ||
115 | u32 usb_id; | ||
116 | int next_midi_device; | ||
112 | 117 | ||
113 | struct snd_usb_midi_endpoint { | 118 | struct snd_usb_midi_endpoint { |
114 | struct snd_usb_midi_out_endpoint *out; | 119 | struct snd_usb_midi_out_endpoint *out; |
115 | struct snd_usb_midi_in_endpoint *in; | 120 | struct snd_usb_midi_in_endpoint *in; |
116 | } endpoints[MIDI_MAX_ENDPOINTS]; | 121 | } endpoints[MIDI_MAX_ENDPOINTS]; |
117 | unsigned long input_triggered; | 122 | unsigned long input_triggered; |
123 | unsigned int opened; | ||
118 | unsigned char disconnected; | 124 | unsigned char disconnected; |
125 | |||
126 | struct snd_kcontrol *roland_load_ctl; | ||
119 | }; | 127 | }; |
120 | 128 | ||
121 | struct snd_usb_midi_out_endpoint { | 129 | struct snd_usb_midi_out_endpoint { |
@@ -255,7 +263,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb) | |||
255 | } | 263 | } |
256 | } | 264 | } |
257 | 265 | ||
258 | urb->dev = ep->umidi->chip->dev; | 266 | urb->dev = ep->umidi->dev; |
259 | snd_usbmidi_submit_urb(urb, GFP_ATOMIC); | 267 | snd_usbmidi_submit_urb(urb, GFP_ATOMIC); |
260 | } | 268 | } |
261 | 269 | ||
@@ -296,7 +304,7 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep) | |||
296 | unsigned long flags; | 304 | unsigned long flags; |
297 | 305 | ||
298 | spin_lock_irqsave(&ep->buffer_lock, flags); | 306 | spin_lock_irqsave(&ep->buffer_lock, flags); |
299 | if (ep->umidi->chip->shutdown) { | 307 | if (ep->umidi->disconnected) { |
300 | spin_unlock_irqrestore(&ep->buffer_lock, flags); | 308 | spin_unlock_irqrestore(&ep->buffer_lock, flags); |
301 | return; | 309 | return; |
302 | } | 310 | } |
@@ -312,7 +320,7 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep) | |||
312 | 320 | ||
313 | dump_urb("sending", urb->transfer_buffer, | 321 | dump_urb("sending", urb->transfer_buffer, |
314 | urb->transfer_buffer_length); | 322 | urb->transfer_buffer_length); |
315 | urb->dev = ep->umidi->chip->dev; | 323 | urb->dev = ep->umidi->dev; |
316 | if (snd_usbmidi_submit_urb(urb, GFP_ATOMIC) < 0) | 324 | if (snd_usbmidi_submit_urb(urb, GFP_ATOMIC) < 0) |
317 | break; | 325 | break; |
318 | ep->active_urbs |= 1 << urb_index; | 326 | ep->active_urbs |= 1 << urb_index; |
@@ -349,7 +357,7 @@ static void snd_usbmidi_error_timer(unsigned long data) | |||
349 | if (in && in->error_resubmit) { | 357 | if (in && in->error_resubmit) { |
350 | in->error_resubmit = 0; | 358 | in->error_resubmit = 0; |
351 | for (j = 0; j < INPUT_URBS; ++j) { | 359 | for (j = 0; j < INPUT_URBS; ++j) { |
352 | in->urbs[j]->dev = umidi->chip->dev; | 360 | in->urbs[j]->dev = umidi->dev; |
353 | snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC); | 361 | snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC); |
354 | } | 362 | } |
355 | } | 363 | } |
@@ -369,7 +377,7 @@ static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep, | |||
369 | return -ENOMEM; | 377 | return -ENOMEM; |
370 | dump_urb("sending", buf, len); | 378 | dump_urb("sending", buf, len); |
371 | if (ep->urbs[0].urb) | 379 | if (ep->urbs[0].urb) |
372 | err = usb_bulk_msg(ep->umidi->chip->dev, ep->urbs[0].urb->pipe, | 380 | err = usb_bulk_msg(ep->umidi->dev, ep->urbs[0].urb->pipe, |
373 | buf, len, NULL, 250); | 381 | buf, len, NULL, 250); |
374 | kfree(buf); | 382 | kfree(buf); |
375 | return err; | 383 | return err; |
@@ -724,8 +732,7 @@ static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep, | |||
724 | 732 | ||
725 | if (!ep->ports[0].active) | 733 | if (!ep->ports[0].active) |
726 | return; | 734 | return; |
727 | count = snd_usb_get_speed(ep->umidi->chip->dev) == USB_SPEED_HIGH | 735 | count = snd_usb_get_speed(ep->umidi->dev) == USB_SPEED_HIGH ? 1 : 2; |
728 | ? 1 : 2; | ||
729 | count = snd_rawmidi_transmit(ep->ports[0].substream, | 736 | count = snd_rawmidi_transmit(ep->ports[0].substream, |
730 | urb->transfer_buffer, | 737 | urb->transfer_buffer, |
731 | count); | 738 | count); |
@@ -879,6 +886,50 @@ static struct usb_protocol_ops snd_usbmidi_emagic_ops = { | |||
879 | }; | 886 | }; |
880 | 887 | ||
881 | 888 | ||
889 | static void update_roland_altsetting(struct snd_usb_midi* umidi) | ||
890 | { | ||
891 | struct usb_interface *intf; | ||
892 | struct usb_host_interface *hostif; | ||
893 | struct usb_interface_descriptor *intfd; | ||
894 | int is_light_load; | ||
895 | |||
896 | intf = umidi->iface; | ||
897 | is_light_load = intf->cur_altsetting != intf->altsetting; | ||
898 | if (umidi->roland_load_ctl->private_value == is_light_load) | ||
899 | return; | ||
900 | hostif = &intf->altsetting[umidi->roland_load_ctl->private_value]; | ||
901 | intfd = get_iface_desc(hostif); | ||
902 | snd_usbmidi_input_stop(&umidi->list); | ||
903 | usb_set_interface(umidi->dev, intfd->bInterfaceNumber, | ||
904 | intfd->bAlternateSetting); | ||
905 | snd_usbmidi_input_start(&umidi->list); | ||
906 | } | ||
907 | |||
908 | static void substream_open(struct snd_rawmidi_substream *substream, int open) | ||
909 | { | ||
910 | struct snd_usb_midi* umidi = substream->rmidi->private_data; | ||
911 | struct snd_kcontrol *ctl; | ||
912 | |||
913 | mutex_lock(&umidi->mutex); | ||
914 | if (open) { | ||
915 | if (umidi->opened++ == 0 && umidi->roland_load_ctl) { | ||
916 | ctl = umidi->roland_load_ctl; | ||
917 | ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
918 | snd_ctl_notify(umidi->card, | ||
919 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | ||
920 | update_roland_altsetting(umidi); | ||
921 | } | ||
922 | } else { | ||
923 | if (--umidi->opened == 0 && umidi->roland_load_ctl) { | ||
924 | ctl = umidi->roland_load_ctl; | ||
925 | ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
926 | snd_ctl_notify(umidi->card, | ||
927 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | ||
928 | } | ||
929 | } | ||
930 | mutex_unlock(&umidi->mutex); | ||
931 | } | ||
932 | |||
882 | static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) | 933 | static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) |
883 | { | 934 | { |
884 | struct snd_usb_midi* umidi = substream->rmidi->private_data; | 935 | struct snd_usb_midi* umidi = substream->rmidi->private_data; |
@@ -898,11 +949,13 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) | |||
898 | } | 949 | } |
899 | substream->runtime->private_data = port; | 950 | substream->runtime->private_data = port; |
900 | port->state = STATE_UNKNOWN; | 951 | port->state = STATE_UNKNOWN; |
952 | substream_open(substream, 1); | ||
901 | return 0; | 953 | return 0; |
902 | } | 954 | } |
903 | 955 | ||
904 | static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) | 956 | static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) |
905 | { | 957 | { |
958 | substream_open(substream, 0); | ||
906 | return 0; | 959 | return 0; |
907 | } | 960 | } |
908 | 961 | ||
@@ -912,7 +965,7 @@ static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, | |||
912 | 965 | ||
913 | port->active = up; | 966 | port->active = up; |
914 | if (up) { | 967 | if (up) { |
915 | if (port->ep->umidi->chip->shutdown) { | 968 | if (port->ep->umidi->disconnected) { |
916 | /* gobble up remaining bytes to prevent wait in | 969 | /* gobble up remaining bytes to prevent wait in |
917 | * snd_rawmidi_drain_output */ | 970 | * snd_rawmidi_drain_output */ |
918 | while (!snd_rawmidi_transmit_empty(substream)) | 971 | while (!snd_rawmidi_transmit_empty(substream)) |
@@ -954,11 +1007,13 @@ static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream) | |||
954 | 1007 | ||
955 | static int snd_usbmidi_input_open(struct snd_rawmidi_substream *substream) | 1008 | static int snd_usbmidi_input_open(struct snd_rawmidi_substream *substream) |
956 | { | 1009 | { |
1010 | substream_open(substream, 1); | ||
957 | return 0; | 1011 | return 0; |
958 | } | 1012 | } |
959 | 1013 | ||
960 | static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream) | 1014 | static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream) |
961 | { | 1015 | { |
1016 | substream_open(substream, 0); | ||
962 | return 0; | 1017 | return 0; |
963 | } | 1018 | } |
964 | 1019 | ||
@@ -988,7 +1043,7 @@ static struct snd_rawmidi_ops snd_usbmidi_input_ops = { | |||
988 | static void free_urb_and_buffer(struct snd_usb_midi *umidi, struct urb *urb, | 1043 | static void free_urb_and_buffer(struct snd_usb_midi *umidi, struct urb *urb, |
989 | unsigned int buffer_length) | 1044 | unsigned int buffer_length) |
990 | { | 1045 | { |
991 | usb_buffer_free(umidi->chip->dev, buffer_length, | 1046 | usb_buffer_free(umidi->dev, buffer_length, |
992 | urb->transfer_buffer, urb->transfer_dma); | 1047 | urb->transfer_buffer, urb->transfer_dma); |
993 | usb_free_urb(urb); | 1048 | usb_free_urb(urb); |
994 | } | 1049 | } |
@@ -1035,24 +1090,24 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, | |||
1035 | } | 1090 | } |
1036 | } | 1091 | } |
1037 | if (ep_info->in_interval) | 1092 | if (ep_info->in_interval) |
1038 | pipe = usb_rcvintpipe(umidi->chip->dev, ep_info->in_ep); | 1093 | pipe = usb_rcvintpipe(umidi->dev, ep_info->in_ep); |
1039 | else | 1094 | else |
1040 | pipe = usb_rcvbulkpipe(umidi->chip->dev, ep_info->in_ep); | 1095 | pipe = usb_rcvbulkpipe(umidi->dev, ep_info->in_ep); |
1041 | length = usb_maxpacket(umidi->chip->dev, pipe, 0); | 1096 | length = usb_maxpacket(umidi->dev, pipe, 0); |
1042 | for (i = 0; i < INPUT_URBS; ++i) { | 1097 | for (i = 0; i < INPUT_URBS; ++i) { |
1043 | buffer = usb_buffer_alloc(umidi->chip->dev, length, GFP_KERNEL, | 1098 | buffer = usb_buffer_alloc(umidi->dev, length, GFP_KERNEL, |
1044 | &ep->urbs[i]->transfer_dma); | 1099 | &ep->urbs[i]->transfer_dma); |
1045 | if (!buffer) { | 1100 | if (!buffer) { |
1046 | snd_usbmidi_in_endpoint_delete(ep); | 1101 | snd_usbmidi_in_endpoint_delete(ep); |
1047 | return -ENOMEM; | 1102 | return -ENOMEM; |
1048 | } | 1103 | } |
1049 | if (ep_info->in_interval) | 1104 | if (ep_info->in_interval) |
1050 | usb_fill_int_urb(ep->urbs[i], umidi->chip->dev, | 1105 | usb_fill_int_urb(ep->urbs[i], umidi->dev, |
1051 | pipe, buffer, length, | 1106 | pipe, buffer, length, |
1052 | snd_usbmidi_in_urb_complete, | 1107 | snd_usbmidi_in_urb_complete, |
1053 | ep, ep_info->in_interval); | 1108 | ep, ep_info->in_interval); |
1054 | else | 1109 | else |
1055 | usb_fill_bulk_urb(ep->urbs[i], umidi->chip->dev, | 1110 | usb_fill_bulk_urb(ep->urbs[i], umidi->dev, |
1056 | pipe, buffer, length, | 1111 | pipe, buffer, length, |
1057 | snd_usbmidi_in_urb_complete, ep); | 1112 | snd_usbmidi_in_urb_complete, ep); |
1058 | ep->urbs[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 1113 | ep->urbs[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
@@ -1062,15 +1117,6 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, | |||
1062 | return 0; | 1117 | return 0; |
1063 | } | 1118 | } |
1064 | 1119 | ||
1065 | static unsigned int snd_usbmidi_count_bits(unsigned int x) | ||
1066 | { | ||
1067 | unsigned int bits; | ||
1068 | |||
1069 | for (bits = 0; x; ++bits) | ||
1070 | x &= x - 1; | ||
1071 | return bits; | ||
1072 | } | ||
1073 | |||
1074 | /* | 1120 | /* |
1075 | * Frees an output endpoint. | 1121 | * Frees an output endpoint. |
1076 | * May be called when ep hasn't been initialized completely. | 1122 | * May be called when ep hasn't been initialized completely. |
@@ -1113,15 +1159,15 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, | |||
1113 | ep->urbs[i].ep = ep; | 1159 | ep->urbs[i].ep = ep; |
1114 | } | 1160 | } |
1115 | if (ep_info->out_interval) | 1161 | if (ep_info->out_interval) |
1116 | pipe = usb_sndintpipe(umidi->chip->dev, ep_info->out_ep); | 1162 | pipe = usb_sndintpipe(umidi->dev, ep_info->out_ep); |
1117 | else | 1163 | else |
1118 | pipe = usb_sndbulkpipe(umidi->chip->dev, ep_info->out_ep); | 1164 | pipe = usb_sndbulkpipe(umidi->dev, ep_info->out_ep); |
1119 | if (umidi->chip->usb_id == USB_ID(0x0a92, 0x1020)) /* ESI M4U */ | 1165 | if (umidi->usb_id == USB_ID(0x0a92, 0x1020)) /* ESI M4U */ |
1120 | ep->max_transfer = 4; | 1166 | ep->max_transfer = 4; |
1121 | else | 1167 | else |
1122 | ep->max_transfer = usb_maxpacket(umidi->chip->dev, pipe, 1); | 1168 | ep->max_transfer = usb_maxpacket(umidi->dev, pipe, 1); |
1123 | for (i = 0; i < OUTPUT_URBS; ++i) { | 1169 | for (i = 0; i < OUTPUT_URBS; ++i) { |
1124 | buffer = usb_buffer_alloc(umidi->chip->dev, | 1170 | buffer = usb_buffer_alloc(umidi->dev, |
1125 | ep->max_transfer, GFP_KERNEL, | 1171 | ep->max_transfer, GFP_KERNEL, |
1126 | &ep->urbs[i].urb->transfer_dma); | 1172 | &ep->urbs[i].urb->transfer_dma); |
1127 | if (!buffer) { | 1173 | if (!buffer) { |
@@ -1129,12 +1175,12 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, | |||
1129 | return -ENOMEM; | 1175 | return -ENOMEM; |
1130 | } | 1176 | } |
1131 | if (ep_info->out_interval) | 1177 | if (ep_info->out_interval) |
1132 | usb_fill_int_urb(ep->urbs[i].urb, umidi->chip->dev, | 1178 | usb_fill_int_urb(ep->urbs[i].urb, umidi->dev, |
1133 | pipe, buffer, ep->max_transfer, | 1179 | pipe, buffer, ep->max_transfer, |
1134 | snd_usbmidi_out_urb_complete, | 1180 | snd_usbmidi_out_urb_complete, |
1135 | &ep->urbs[i], ep_info->out_interval); | 1181 | &ep->urbs[i], ep_info->out_interval); |
1136 | else | 1182 | else |
1137 | usb_fill_bulk_urb(ep->urbs[i].urb, umidi->chip->dev, | 1183 | usb_fill_bulk_urb(ep->urbs[i].urb, umidi->dev, |
1138 | pipe, buffer, ep->max_transfer, | 1184 | pipe, buffer, ep->max_transfer, |
1139 | snd_usbmidi_out_urb_complete, | 1185 | snd_usbmidi_out_urb_complete, |
1140 | &ep->urbs[i]); | 1186 | &ep->urbs[i]); |
@@ -1172,6 +1218,7 @@ static void snd_usbmidi_free(struct snd_usb_midi* umidi) | |||
1172 | if (ep->in) | 1218 | if (ep->in) |
1173 | snd_usbmidi_in_endpoint_delete(ep->in); | 1219 | snd_usbmidi_in_endpoint_delete(ep->in); |
1174 | } | 1220 | } |
1221 | mutex_destroy(&umidi->mutex); | ||
1175 | kfree(umidi); | 1222 | kfree(umidi); |
1176 | } | 1223 | } |
1177 | 1224 | ||
@@ -1367,7 +1414,7 @@ static struct port_info *find_port_info(struct snd_usb_midi* umidi, int number) | |||
1367 | int i; | 1414 | int i; |
1368 | 1415 | ||
1369 | for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_info); ++i) { | 1416 | for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_info); ++i) { |
1370 | if (snd_usbmidi_port_info[i].id == umidi->chip->usb_id && | 1417 | if (snd_usbmidi_port_info[i].id == umidi->usb_id && |
1371 | snd_usbmidi_port_info[i].port == number) | 1418 | snd_usbmidi_port_info[i].port == number) |
1372 | return &snd_usbmidi_port_info[i]; | 1419 | return &snd_usbmidi_port_info[i]; |
1373 | } | 1420 | } |
@@ -1405,7 +1452,7 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, | |||
1405 | port_info = find_port_info(umidi, number); | 1452 | port_info = find_port_info(umidi, number); |
1406 | name_format = port_info ? port_info->name : "%s MIDI %d"; | 1453 | name_format = port_info ? port_info->name : "%s MIDI %d"; |
1407 | snprintf(substream->name, sizeof(substream->name), | 1454 | snprintf(substream->name, sizeof(substream->name), |
1408 | name_format, umidi->chip->card->shortname, number + 1); | 1455 | name_format, umidi->card->shortname, number + 1); |
1409 | 1456 | ||
1410 | *rsubstream = substream; | 1457 | *rsubstream = substream; |
1411 | } | 1458 | } |
@@ -1503,7 +1550,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1503 | endpoints[epidx].out_ep = usb_endpoint_num(ep); | 1550 | endpoints[epidx].out_ep = usb_endpoint_num(ep); |
1504 | if (usb_endpoint_xfer_int(ep)) | 1551 | if (usb_endpoint_xfer_int(ep)) |
1505 | endpoints[epidx].out_interval = ep->bInterval; | 1552 | endpoints[epidx].out_interval = ep->bInterval; |
1506 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) | 1553 | else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) |
1507 | /* | 1554 | /* |
1508 | * Low speed bulk transfers don't exist, so | 1555 | * Low speed bulk transfers don't exist, so |
1509 | * force interrupt transfers for devices like | 1556 | * force interrupt transfers for devices like |
@@ -1523,7 +1570,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1523 | endpoints[epidx].in_ep = usb_endpoint_num(ep); | 1570 | endpoints[epidx].in_ep = usb_endpoint_num(ep); |
1524 | if (usb_endpoint_xfer_int(ep)) | 1571 | if (usb_endpoint_xfer_int(ep)) |
1525 | endpoints[epidx].in_interval = ep->bInterval; | 1572 | endpoints[epidx].in_interval = ep->bInterval; |
1526 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) | 1573 | else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) |
1527 | endpoints[epidx].in_interval = 1; | 1574 | endpoints[epidx].in_interval = 1; |
1528 | endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; | 1575 | endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; |
1529 | snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", | 1576 | snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", |
@@ -1533,6 +1580,52 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1533 | return 0; | 1580 | return 0; |
1534 | } | 1581 | } |
1535 | 1582 | ||
1583 | static int roland_load_info(struct snd_kcontrol *kcontrol, | ||
1584 | struct snd_ctl_elem_info *info) | ||
1585 | { | ||
1586 | static const char *const names[] = { "High Load", "Light Load" }; | ||
1587 | |||
1588 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
1589 | info->count = 1; | ||
1590 | info->value.enumerated.items = 2; | ||
1591 | if (info->value.enumerated.item > 1) | ||
1592 | info->value.enumerated.item = 1; | ||
1593 | strcpy(info->value.enumerated.name, names[info->value.enumerated.item]); | ||
1594 | return 0; | ||
1595 | } | ||
1596 | |||
1597 | static int roland_load_get(struct snd_kcontrol *kcontrol, | ||
1598 | struct snd_ctl_elem_value *value) | ||
1599 | { | ||
1600 | value->value.enumerated.item[0] = kcontrol->private_value; | ||
1601 | return 0; | ||
1602 | } | ||
1603 | |||
1604 | static int roland_load_put(struct snd_kcontrol *kcontrol, | ||
1605 | struct snd_ctl_elem_value *value) | ||
1606 | { | ||
1607 | struct snd_usb_midi* umidi = kcontrol->private_data; | ||
1608 | int changed; | ||
1609 | |||
1610 | if (value->value.enumerated.item[0] > 1) | ||
1611 | return -EINVAL; | ||
1612 | mutex_lock(&umidi->mutex); | ||
1613 | changed = value->value.enumerated.item[0] != kcontrol->private_value; | ||
1614 | if (changed) | ||
1615 | kcontrol->private_value = value->value.enumerated.item[0]; | ||
1616 | mutex_unlock(&umidi->mutex); | ||
1617 | return changed; | ||
1618 | } | ||
1619 | |||
1620 | static struct snd_kcontrol_new roland_load_ctl = { | ||
1621 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1622 | .name = "MIDI Input Mode", | ||
1623 | .info = roland_load_info, | ||
1624 | .get = roland_load_get, | ||
1625 | .put = roland_load_put, | ||
1626 | .private_value = 1, | ||
1627 | }; | ||
1628 | |||
1536 | /* | 1629 | /* |
1537 | * On Roland devices, use the second alternate setting to be able to use | 1630 | * On Roland devices, use the second alternate setting to be able to use |
1538 | * the interrupt input endpoint. | 1631 | * the interrupt input endpoint. |
@@ -1556,8 +1649,12 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi) | |||
1556 | 1649 | ||
1557 | snd_printdd(KERN_INFO "switching to altsetting %d with int ep\n", | 1650 | snd_printdd(KERN_INFO "switching to altsetting %d with int ep\n", |
1558 | intfd->bAlternateSetting); | 1651 | intfd->bAlternateSetting); |
1559 | usb_set_interface(umidi->chip->dev, intfd->bInterfaceNumber, | 1652 | usb_set_interface(umidi->dev, intfd->bInterfaceNumber, |
1560 | intfd->bAlternateSetting); | 1653 | intfd->bAlternateSetting); |
1654 | |||
1655 | umidi->roland_load_ctl = snd_ctl_new1(&roland_load_ctl, umidi); | ||
1656 | if (snd_ctl_add(umidi->card, umidi->roland_load_ctl) < 0) | ||
1657 | umidi->roland_load_ctl = NULL; | ||
1561 | } | 1658 | } |
1562 | 1659 | ||
1563 | /* | 1660 | /* |
@@ -1573,7 +1670,7 @@ static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi, | |||
1573 | struct usb_endpoint_descriptor* epd; | 1670 | struct usb_endpoint_descriptor* epd; |
1574 | int i, out_eps = 0, in_eps = 0; | 1671 | int i, out_eps = 0, in_eps = 0; |
1575 | 1672 | ||
1576 | if (USB_ID_VENDOR(umidi->chip->usb_id) == 0x0582) | 1673 | if (USB_ID_VENDOR(umidi->usb_id) == 0x0582) |
1577 | snd_usbmidi_switch_roland_altsetting(umidi); | 1674 | snd_usbmidi_switch_roland_altsetting(umidi); |
1578 | 1675 | ||
1579 | if (endpoint[0].out_ep || endpoint[0].in_ep) | 1676 | if (endpoint[0].out_ep || endpoint[0].in_ep) |
@@ -1760,12 +1857,12 @@ static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, | |||
1760 | struct snd_rawmidi *rmidi; | 1857 | struct snd_rawmidi *rmidi; |
1761 | int err; | 1858 | int err; |
1762 | 1859 | ||
1763 | err = snd_rawmidi_new(umidi->chip->card, "USB MIDI", | 1860 | err = snd_rawmidi_new(umidi->card, "USB MIDI", |
1764 | umidi->chip->next_midi_device++, | 1861 | umidi->next_midi_device++, |
1765 | out_ports, in_ports, &rmidi); | 1862 | out_ports, in_ports, &rmidi); |
1766 | if (err < 0) | 1863 | if (err < 0) |
1767 | return err; | 1864 | return err; |
1768 | strcpy(rmidi->name, umidi->chip->card->shortname); | 1865 | strcpy(rmidi->name, umidi->card->shortname); |
1769 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | | 1866 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | |
1770 | SNDRV_RAWMIDI_INFO_INPUT | | 1867 | SNDRV_RAWMIDI_INFO_INPUT | |
1771 | SNDRV_RAWMIDI_INFO_DUPLEX; | 1868 | SNDRV_RAWMIDI_INFO_DUPLEX; |
@@ -1804,7 +1901,7 @@ static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) | |||
1804 | return; | 1901 | return; |
1805 | for (i = 0; i < INPUT_URBS; ++i) { | 1902 | for (i = 0; i < INPUT_URBS; ++i) { |
1806 | struct urb* urb = ep->urbs[i]; | 1903 | struct urb* urb = ep->urbs[i]; |
1807 | urb->dev = ep->umidi->chip->dev; | 1904 | urb->dev = ep->umidi->dev; |
1808 | snd_usbmidi_submit_urb(urb, GFP_KERNEL); | 1905 | snd_usbmidi_submit_urb(urb, GFP_KERNEL); |
1809 | } | 1906 | } |
1810 | } | 1907 | } |
@@ -1825,9 +1922,10 @@ void snd_usbmidi_input_start(struct list_head* p) | |||
1825 | /* | 1922 | /* |
1826 | * Creates and registers everything needed for a MIDI streaming interface. | 1923 | * Creates and registers everything needed for a MIDI streaming interface. |
1827 | */ | 1924 | */ |
1828 | int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | 1925 | int snd_usbmidi_create(struct snd_card *card, |
1829 | struct usb_interface* iface, | 1926 | struct usb_interface* iface, |
1830 | const struct snd_usb_audio_quirk* quirk) | 1927 | struct list_head *midi_list, |
1928 | const struct snd_usb_audio_quirk* quirk) | ||
1831 | { | 1929 | { |
1832 | struct snd_usb_midi* umidi; | 1930 | struct snd_usb_midi* umidi; |
1833 | struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS]; | 1931 | struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS]; |
@@ -1837,12 +1935,16 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1837 | umidi = kzalloc(sizeof(*umidi), GFP_KERNEL); | 1935 | umidi = kzalloc(sizeof(*umidi), GFP_KERNEL); |
1838 | if (!umidi) | 1936 | if (!umidi) |
1839 | return -ENOMEM; | 1937 | return -ENOMEM; |
1840 | umidi->chip = chip; | 1938 | umidi->dev = interface_to_usbdev(iface); |
1939 | umidi->card = card; | ||
1841 | umidi->iface = iface; | 1940 | umidi->iface = iface; |
1842 | umidi->quirk = quirk; | 1941 | umidi->quirk = quirk; |
1843 | umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; | 1942 | umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; |
1844 | init_timer(&umidi->error_timer); | 1943 | init_timer(&umidi->error_timer); |
1845 | spin_lock_init(&umidi->disc_lock); | 1944 | spin_lock_init(&umidi->disc_lock); |
1945 | mutex_init(&umidi->mutex); | ||
1946 | umidi->usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor), | ||
1947 | le16_to_cpu(umidi->dev->descriptor.idProduct)); | ||
1846 | umidi->error_timer.function = snd_usbmidi_error_timer; | 1948 | umidi->error_timer.function = snd_usbmidi_error_timer; |
1847 | umidi->error_timer.data = (unsigned long)umidi; | 1949 | umidi->error_timer.data = (unsigned long)umidi; |
1848 | 1950 | ||
@@ -1851,7 +1953,7 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1851 | switch (quirk ? quirk->type : QUIRK_MIDI_STANDARD_INTERFACE) { | 1953 | switch (quirk ? quirk->type : QUIRK_MIDI_STANDARD_INTERFACE) { |
1852 | case QUIRK_MIDI_STANDARD_INTERFACE: | 1954 | case QUIRK_MIDI_STANDARD_INTERFACE: |
1853 | err = snd_usbmidi_get_ms_info(umidi, endpoints); | 1955 | err = snd_usbmidi_get_ms_info(umidi, endpoints); |
1854 | if (chip->usb_id == USB_ID(0x0763, 0x0150)) /* M-Audio Uno */ | 1956 | if (umidi->usb_id == USB_ID(0x0763, 0x0150)) /* M-Audio Uno */ |
1855 | umidi->usb_protocol_ops = | 1957 | umidi->usb_protocol_ops = |
1856 | &snd_usbmidi_maudio_broken_running_status_ops; | 1958 | &snd_usbmidi_maudio_broken_running_status_ops; |
1857 | break; | 1959 | break; |
@@ -1887,7 +1989,7 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1887 | * interface 0, so we have to make sure that the USB core looks | 1989 | * interface 0, so we have to make sure that the USB core looks |
1888 | * again at interface 0 by calling usb_set_interface() on it. | 1990 | * again at interface 0 by calling usb_set_interface() on it. |
1889 | */ | 1991 | */ |
1890 | usb_set_interface(umidi->chip->dev, 0, 0); | 1992 | usb_set_interface(umidi->dev, 0, 0); |
1891 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1993 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1892 | break; | 1994 | break; |
1893 | case QUIRK_MIDI_EMAGIC: | 1995 | case QUIRK_MIDI_EMAGIC: |
@@ -1914,8 +2016,8 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1914 | out_ports = 0; | 2016 | out_ports = 0; |
1915 | in_ports = 0; | 2017 | in_ports = 0; |
1916 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | 2018 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { |
1917 | out_ports += snd_usbmidi_count_bits(endpoints[i].out_cables); | 2019 | out_ports += hweight16(endpoints[i].out_cables); |
1918 | in_ports += snd_usbmidi_count_bits(endpoints[i].in_cables); | 2020 | in_ports += hweight16(endpoints[i].in_cables); |
1919 | } | 2021 | } |
1920 | err = snd_usbmidi_create_rawmidi(umidi, out_ports, in_ports); | 2022 | err = snd_usbmidi_create_rawmidi(umidi, out_ports, in_ports); |
1921 | if (err < 0) { | 2023 | if (err < 0) { |
@@ -1933,14 +2035,14 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1933 | return err; | 2035 | return err; |
1934 | } | 2036 | } |
1935 | 2037 | ||
1936 | list_add(&umidi->list, &umidi->chip->midi_list); | 2038 | list_add_tail(&umidi->list, midi_list); |
1937 | 2039 | ||
1938 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) | 2040 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) |
1939 | snd_usbmidi_input_start_ep(umidi->endpoints[i].in); | 2041 | snd_usbmidi_input_start_ep(umidi->endpoints[i].in); |
1940 | return 0; | 2042 | return 0; |
1941 | } | 2043 | } |
1942 | 2044 | ||
1943 | EXPORT_SYMBOL(snd_usb_create_midi_interface); | 2045 | EXPORT_SYMBOL(snd_usbmidi_create); |
1944 | EXPORT_SYMBOL(snd_usbmidi_input_stop); | 2046 | EXPORT_SYMBOL(snd_usbmidi_input_stop); |
1945 | EXPORT_SYMBOL(snd_usbmidi_input_start); | 2047 | EXPORT_SYMBOL(snd_usbmidi_input_start); |
1946 | EXPORT_SYMBOL(snd_usbmidi_disconnect); | 2048 | EXPORT_SYMBOL(snd_usbmidi_disconnect); |
diff --git a/sound/usb/usbmixer_maps.c b/sound/usb/usbmixer_maps.c index 3e5d66cf1f5a..77c35885e21c 100644 --- a/sound/usb/usbmixer_maps.c +++ b/sound/usb/usbmixer_maps.c | |||
@@ -277,6 +277,22 @@ static struct usbmix_name_map scratch_live_map[] = { | |||
277 | { 0 } /* terminator */ | 277 | { 0 } /* terminator */ |
278 | }; | 278 | }; |
279 | 279 | ||
280 | /* "Gamesurround Muse Pocket LT" looks same like "Sound Blaster MP3+" | ||
281 | * most importand difference is SU[8], it should be set to "Capture Source" | ||
282 | * to make alsamixer and PA working properly. | ||
283 | * FIXME: or mp3plus_map should use "Capture Source" too, | ||
284 | * so this maps can be merget | ||
285 | */ | ||
286 | static struct usbmix_name_map hercules_usb51_map[] = { | ||
287 | { 8, "Capture Source" }, /* SU, default "PCM Capture Source" */ | ||
288 | { 9, "Master Playback" }, /* FU, default "Speaker Playback" */ | ||
289 | { 10, "Mic Boost", 7 }, /* FU, default "Auto Gain Input" */ | ||
290 | { 11, "Line Capture" }, /* FU, default "PCM Capture" */ | ||
291 | { 13, "Mic Bypass Playback" }, /* FU, default "Mic Playback" */ | ||
292 | { 14, "Line Bypass Playback" }, /* FU, default "Line Playback" */ | ||
293 | { 0 } /* terminator */ | ||
294 | }; | ||
295 | |||
280 | /* | 296 | /* |
281 | * Control map entries | 297 | * Control map entries |
282 | */ | 298 | */ |
@@ -316,6 +332,13 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { | |||
316 | .ignore_ctl_error = 1, | 332 | .ignore_ctl_error = 1, |
317 | }, | 333 | }, |
318 | { | 334 | { |
335 | /* Hercules Gamesurround Muse Pocket LT | ||
336 | * (USB 5.1 Channel Audio Adapter) | ||
337 | */ | ||
338 | .id = USB_ID(0x06f8, 0xc000), | ||
339 | .map = hercules_usb51_map, | ||
340 | }, | ||
341 | { | ||
319 | .id = USB_ID(0x08bb, 0x2702), | 342 | .id = USB_ID(0x08bb, 0x2702), |
320 | .map = linex_map, | 343 | .map = linex_map, |
321 | .ignore_ctl_error = 1, | 344 | .ignore_ctl_error = 1, |
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index f6f201eb24ce..a892bda03df9 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -1563,6 +1563,29 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1563 | } | 1563 | } |
1564 | } | 1564 | } |
1565 | }, | 1565 | }, |
1566 | { | ||
1567 | /* has ID 0x00ea when not in Advanced Driver mode */ | ||
1568 | USB_DEVICE_VENDOR_SPEC(0x0582, 0x00e9), | ||
1569 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1570 | /* .vendor_name = "Roland", */ | ||
1571 | /* .product_name = "UA-1G", */ | ||
1572 | .ifnum = QUIRK_ANY_INTERFACE, | ||
1573 | .type = QUIRK_COMPOSITE, | ||
1574 | .data = (const struct snd_usb_audio_quirk[]) { | ||
1575 | { | ||
1576 | .ifnum = 0, | ||
1577 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
1578 | }, | ||
1579 | { | ||
1580 | .ifnum = 1, | ||
1581 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
1582 | }, | ||
1583 | { | ||
1584 | .ifnum = -1 | ||
1585 | } | ||
1586 | } | ||
1587 | } | ||
1588 | }, | ||
1566 | 1589 | ||
1567 | /* Guillemot devices */ | 1590 | /* Guillemot devices */ |
1568 | { | 1591 | { |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 00cd54c236b4..f71cd28eca6b 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -59,11 +59,11 @@ static int us122l_create_usbmidi(struct snd_card *card) | |||
59 | .type = QUIRK_MIDI_US122L, | 59 | .type = QUIRK_MIDI_US122L, |
60 | .data = &quirk_data | 60 | .data = &quirk_data |
61 | }; | 61 | }; |
62 | struct usb_device *dev = US122L(card)->chip.dev; | 62 | struct usb_device *dev = US122L(card)->dev; |
63 | struct usb_interface *iface = usb_ifnum_to_if(dev, 1); | 63 | struct usb_interface *iface = usb_ifnum_to_if(dev, 1); |
64 | 64 | ||
65 | return snd_usb_create_midi_interface(&US122L(card)->chip, | 65 | return snd_usbmidi_create(card, iface, |
66 | iface, &quirk); | 66 | &US122L(card)->midi_list, &quirk); |
67 | } | 67 | } |
68 | 68 | ||
69 | static int us144_create_usbmidi(struct snd_card *card) | 69 | static int us144_create_usbmidi(struct snd_card *card) |
@@ -81,11 +81,11 @@ static int us144_create_usbmidi(struct snd_card *card) | |||
81 | .type = QUIRK_MIDI_US122L, | 81 | .type = QUIRK_MIDI_US122L, |
82 | .data = &quirk_data | 82 | .data = &quirk_data |
83 | }; | 83 | }; |
84 | struct usb_device *dev = US122L(card)->chip.dev; | 84 | struct usb_device *dev = US122L(card)->dev; |
85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); | 85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); |
86 | 86 | ||
87 | return snd_usb_create_midi_interface(&US122L(card)->chip, | 87 | return snd_usbmidi_create(card, iface, |
88 | iface, &quirk); | 88 | &US122L(card)->midi_list, &quirk); |
89 | } | 89 | } |
90 | 90 | ||
91 | /* | 91 | /* |
@@ -194,11 +194,11 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) | |||
194 | if (!us122l->first) | 194 | if (!us122l->first) |
195 | us122l->first = file; | 195 | us122l->first = file; |
196 | 196 | ||
197 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 197 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
198 | iface = usb_ifnum_to_if(us122l->chip.dev, 0); | 198 | iface = usb_ifnum_to_if(us122l->dev, 0); |
199 | usb_autopm_get_interface(iface); | 199 | usb_autopm_get_interface(iface); |
200 | } | 200 | } |
201 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); | 201 | iface = usb_ifnum_to_if(us122l->dev, 1); |
202 | usb_autopm_get_interface(iface); | 202 | usb_autopm_get_interface(iface); |
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
@@ -209,11 +209,11 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) | |||
209 | struct usb_interface *iface; | 209 | struct usb_interface *iface; |
210 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); | 210 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); |
211 | 211 | ||
212 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 212 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
213 | iface = usb_ifnum_to_if(us122l->chip.dev, 0); | 213 | iface = usb_ifnum_to_if(us122l->dev, 0); |
214 | usb_autopm_put_interface(iface); | 214 | usb_autopm_put_interface(iface); |
215 | } | 215 | } |
216 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); | 216 | iface = usb_ifnum_to_if(us122l->dev, 1); |
217 | usb_autopm_put_interface(iface); | 217 | usb_autopm_put_interface(iface); |
218 | if (us122l->first == file) | 218 | if (us122l->first == file) |
219 | us122l->first = NULL; | 219 | us122l->first = NULL; |
@@ -297,7 +297,7 @@ static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw, | |||
297 | static void us122l_stop(struct us122l *us122l) | 297 | static void us122l_stop(struct us122l *us122l) |
298 | { | 298 | { |
299 | struct list_head *p; | 299 | struct list_head *p; |
300 | list_for_each(p, &us122l->chip.midi_list) | 300 | list_for_each(p, &us122l->midi_list) |
301 | snd_usbmidi_input_stop(p); | 301 | snd_usbmidi_input_stop(p); |
302 | 302 | ||
303 | usb_stream_stop(&us122l->sk); | 303 | usb_stream_stop(&us122l->sk); |
@@ -330,7 +330,7 @@ static bool us122l_start(struct us122l *us122l, | |||
330 | unsigned use_packsize = 0; | 330 | unsigned use_packsize = 0; |
331 | bool success = false; | 331 | bool success = false; |
332 | 332 | ||
333 | if (us122l->chip.dev->speed == USB_SPEED_HIGH) { | 333 | if (us122l->dev->speed == USB_SPEED_HIGH) { |
334 | /* The us-122l's descriptor defaults to iso max_packsize 78, | 334 | /* The us-122l's descriptor defaults to iso max_packsize 78, |
335 | which isn't needed for samplerates <= 48000. | 335 | which isn't needed for samplerates <= 48000. |
336 | Lets save some memory: | 336 | Lets save some memory: |
@@ -347,11 +347,11 @@ static bool us122l_start(struct us122l *us122l, | |||
347 | break; | 347 | break; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | if (!usb_stream_new(&us122l->sk, us122l->chip.dev, 1, 2, | 350 | if (!usb_stream_new(&us122l->sk, us122l->dev, 1, 2, |
351 | rate, use_packsize, period_frames, 6)) | 351 | rate, use_packsize, period_frames, 6)) |
352 | goto out; | 352 | goto out; |
353 | 353 | ||
354 | err = us122l_set_sample_rate(us122l->chip.dev, rate); | 354 | err = us122l_set_sample_rate(us122l->dev, rate); |
355 | if (err < 0) { | 355 | if (err < 0) { |
356 | us122l_stop(us122l); | 356 | us122l_stop(us122l); |
357 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); | 357 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); |
@@ -363,7 +363,7 @@ static bool us122l_start(struct us122l *us122l, | |||
363 | snd_printk(KERN_ERR "us122l_start error %i \n", err); | 363 | snd_printk(KERN_ERR "us122l_start error %i \n", err); |
364 | goto out; | 364 | goto out; |
365 | } | 365 | } |
366 | list_for_each(p, &us122l->chip.midi_list) | 366 | list_for_each(p, &us122l->midi_list) |
367 | snd_usbmidi_input_start(p); | 367 | snd_usbmidi_input_start(p); |
368 | success = true; | 368 | success = true; |
369 | out: | 369 | out: |
@@ -390,7 +390,7 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, | |||
390 | err = -ENXIO; | 390 | err = -ENXIO; |
391 | goto free; | 391 | goto free; |
392 | } | 392 | } |
393 | high_speed = us122l->chip.dev->speed == USB_SPEED_HIGH; | 393 | high_speed = us122l->dev->speed == USB_SPEED_HIGH; |
394 | if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 && | 394 | if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 && |
395 | (!high_speed || | 395 | (!high_speed || |
396 | (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) || | 396 | (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) || |
@@ -450,7 +450,7 @@ static int usb_stream_hwdep_new(struct snd_card *card) | |||
450 | { | 450 | { |
451 | int err; | 451 | int err; |
452 | struct snd_hwdep *hw; | 452 | struct snd_hwdep *hw; |
453 | struct usb_device *dev = US122L(card)->chip.dev; | 453 | struct usb_device *dev = US122L(card)->dev; |
454 | 454 | ||
455 | err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); | 455 | err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); |
456 | if (err < 0) | 456 | if (err < 0) |
@@ -476,26 +476,26 @@ static bool us122l_create_card(struct snd_card *card) | |||
476 | int err; | 476 | int err; |
477 | struct us122l *us122l = US122L(card); | 477 | struct us122l *us122l = US122L(card); |
478 | 478 | ||
479 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 479 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
480 | err = usb_set_interface(us122l->chip.dev, 0, 1); | 480 | err = usb_set_interface(us122l->dev, 0, 1); |
481 | if (err) { | 481 | if (err) { |
482 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 482 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
483 | return false; | 483 | return false; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | err = usb_set_interface(us122l->chip.dev, 1, 1); | 486 | err = usb_set_interface(us122l->dev, 1, 1); |
487 | if (err) { | 487 | if (err) { |
488 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 488 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
489 | return false; | 489 | return false; |
490 | } | 490 | } |
491 | 491 | ||
492 | pt_info_set(us122l->chip.dev, 0x11); | 492 | pt_info_set(us122l->dev, 0x11); |
493 | pt_info_set(us122l->chip.dev, 0x10); | 493 | pt_info_set(us122l->dev, 0x10); |
494 | 494 | ||
495 | if (!us122l_start(us122l, 44100, 256)) | 495 | if (!us122l_start(us122l, 44100, 256)) |
496 | return false; | 496 | return false; |
497 | 497 | ||
498 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) | 498 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) |
499 | err = us144_create_usbmidi(card); | 499 | err = us144_create_usbmidi(card); |
500 | else | 500 | else |
501 | err = us122l_create_usbmidi(card); | 501 | err = us122l_create_usbmidi(card); |
@@ -508,7 +508,7 @@ static bool us122l_create_card(struct snd_card *card) | |||
508 | if (err < 0) { | 508 | if (err < 0) { |
509 | /* release the midi resources */ | 509 | /* release the midi resources */ |
510 | struct list_head *p; | 510 | struct list_head *p; |
511 | list_for_each(p, &us122l->chip.midi_list) | 511 | list_for_each(p, &us122l->midi_list) |
512 | snd_usbmidi_disconnect(p); | 512 | snd_usbmidi_disconnect(p); |
513 | 513 | ||
514 | us122l_stop(us122l); | 514 | us122l_stop(us122l); |
@@ -520,7 +520,7 @@ static bool us122l_create_card(struct snd_card *card) | |||
520 | static void snd_us122l_free(struct snd_card *card) | 520 | static void snd_us122l_free(struct snd_card *card) |
521 | { | 521 | { |
522 | struct us122l *us122l = US122L(card); | 522 | struct us122l *us122l = US122L(card); |
523 | int index = us122l->chip.index; | 523 | int index = us122l->card_index; |
524 | if (index >= 0 && index < SNDRV_CARDS) | 524 | if (index >= 0 && index < SNDRV_CARDS) |
525 | snd_us122l_card_used[index] = 0; | 525 | snd_us122l_card_used[index] = 0; |
526 | } | 526 | } |
@@ -540,13 +540,12 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
540 | sizeof(struct us122l), &card); | 540 | sizeof(struct us122l), &card); |
541 | if (err < 0) | 541 | if (err < 0) |
542 | return err; | 542 | return err; |
543 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; | 543 | snd_us122l_card_used[US122L(card)->card_index = dev] = 1; |
544 | card->private_free = snd_us122l_free; | 544 | card->private_free = snd_us122l_free; |
545 | US122L(card)->chip.dev = device; | 545 | US122L(card)->dev = device; |
546 | US122L(card)->chip.card = card; | ||
547 | mutex_init(&US122L(card)->mutex); | 546 | mutex_init(&US122L(card)->mutex); |
548 | init_waitqueue_head(&US122L(card)->sk.sleep); | 547 | init_waitqueue_head(&US122L(card)->sk.sleep); |
549 | INIT_LIST_HEAD(&US122L(card)->chip.midi_list); | 548 | INIT_LIST_HEAD(&US122L(card)->midi_list); |
550 | strcpy(card->driver, "USB "NAME_ALLCAPS""); | 549 | strcpy(card->driver, "USB "NAME_ALLCAPS""); |
551 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); | 550 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); |
552 | sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", | 551 | sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", |
@@ -554,8 +553,8 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
554 | le16_to_cpu(device->descriptor.idVendor), | 553 | le16_to_cpu(device->descriptor.idVendor), |
555 | le16_to_cpu(device->descriptor.idProduct), | 554 | le16_to_cpu(device->descriptor.idProduct), |
556 | 0, | 555 | 0, |
557 | US122L(card)->chip.dev->bus->busnum, | 556 | US122L(card)->dev->bus->busnum, |
558 | US122L(card)->chip.dev->devnum | 557 | US122L(card)->dev->devnum |
559 | ); | 558 | ); |
560 | *cardp = card; | 559 | *cardp = card; |
561 | return 0; | 560 | return 0; |
@@ -635,16 +634,15 @@ static void snd_us122l_disconnect(struct usb_interface *intf) | |||
635 | mutex_lock(&us122l->mutex); | 634 | mutex_lock(&us122l->mutex); |
636 | us122l_stop(us122l); | 635 | us122l_stop(us122l); |
637 | mutex_unlock(&us122l->mutex); | 636 | mutex_unlock(&us122l->mutex); |
638 | us122l->chip.shutdown = 1; | ||
639 | 637 | ||
640 | /* release the midi resources */ | 638 | /* release the midi resources */ |
641 | list_for_each(p, &us122l->chip.midi_list) { | 639 | list_for_each(p, &us122l->midi_list) { |
642 | snd_usbmidi_disconnect(p); | 640 | snd_usbmidi_disconnect(p); |
643 | } | 641 | } |
644 | 642 | ||
645 | usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 0)); | 643 | usb_put_intf(usb_ifnum_to_if(us122l->dev, 0)); |
646 | usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 1)); | 644 | usb_put_intf(usb_ifnum_to_if(us122l->dev, 1)); |
647 | usb_put_dev(us122l->chip.dev); | 645 | usb_put_dev(us122l->dev); |
648 | 646 | ||
649 | while (atomic_read(&us122l->mmap_count)) | 647 | while (atomic_read(&us122l->mmap_count)) |
650 | msleep(500); | 648 | msleep(500); |
@@ -667,7 +665,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message) | |||
667 | if (!us122l) | 665 | if (!us122l) |
668 | return 0; | 666 | return 0; |
669 | 667 | ||
670 | list_for_each(p, &us122l->chip.midi_list) | 668 | list_for_each(p, &us122l->midi_list) |
671 | snd_usbmidi_input_stop(p); | 669 | snd_usbmidi_input_stop(p); |
672 | 670 | ||
673 | mutex_lock(&us122l->mutex); | 671 | mutex_lock(&us122l->mutex); |
@@ -694,23 +692,23 @@ static int snd_us122l_resume(struct usb_interface *intf) | |||
694 | 692 | ||
695 | mutex_lock(&us122l->mutex); | 693 | mutex_lock(&us122l->mutex); |
696 | /* needed, doesn't restart without: */ | 694 | /* needed, doesn't restart without: */ |
697 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 695 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
698 | err = usb_set_interface(us122l->chip.dev, 0, 1); | 696 | err = usb_set_interface(us122l->dev, 0, 1); |
699 | if (err) { | 697 | if (err) { |
700 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 698 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
701 | goto unlock; | 699 | goto unlock; |
702 | } | 700 | } |
703 | } | 701 | } |
704 | err = usb_set_interface(us122l->chip.dev, 1, 1); | 702 | err = usb_set_interface(us122l->dev, 1, 1); |
705 | if (err) { | 703 | if (err) { |
706 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 704 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
707 | goto unlock; | 705 | goto unlock; |
708 | } | 706 | } |
709 | 707 | ||
710 | pt_info_set(us122l->chip.dev, 0x11); | 708 | pt_info_set(us122l->dev, 0x11); |
711 | pt_info_set(us122l->chip.dev, 0x10); | 709 | pt_info_set(us122l->dev, 0x10); |
712 | 710 | ||
713 | err = us122l_set_sample_rate(us122l->chip.dev, | 711 | err = us122l_set_sample_rate(us122l->dev, |
714 | us122l->sk.s->cfg.sample_rate); | 712 | us122l->sk.s->cfg.sample_rate); |
715 | if (err < 0) { | 713 | if (err < 0) { |
716 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); | 714 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); |
@@ -720,7 +718,7 @@ static int snd_us122l_resume(struct usb_interface *intf) | |||
720 | if (err) | 718 | if (err) |
721 | goto unlock; | 719 | goto unlock; |
722 | 720 | ||
723 | list_for_each(p, &us122l->chip.midi_list) | 721 | list_for_each(p, &us122l->midi_list) |
724 | snd_usbmidi_input_start(p); | 722 | snd_usbmidi_input_start(p); |
725 | unlock: | 723 | unlock: |
726 | mutex_unlock(&us122l->mutex); | 724 | mutex_unlock(&us122l->mutex); |
diff --git a/sound/usb/usx2y/us122l.h b/sound/usb/usx2y/us122l.h index 3d10c4b2a0f5..4daf1982e821 100644 --- a/sound/usb/usx2y/us122l.h +++ b/sound/usb/usx2y/us122l.h | |||
@@ -3,7 +3,8 @@ | |||
3 | 3 | ||
4 | 4 | ||
5 | struct us122l { | 5 | struct us122l { |
6 | struct snd_usb_audio chip; | 6 | struct usb_device *dev; |
7 | int card_index; | ||
7 | int stride; | 8 | int stride; |
8 | struct usb_stream_kernel sk; | 9 | struct usb_stream_kernel sk; |
9 | 10 | ||
@@ -12,6 +13,7 @@ struct us122l { | |||
12 | unsigned second_periods_polled; | 13 | unsigned second_periods_polled; |
13 | struct file *master; | 14 | struct file *master; |
14 | struct file *slave; | 15 | struct file *slave; |
16 | struct list_head midi_list; | ||
15 | 17 | ||
16 | atomic_t mmap_count; | 18 | atomic_t mmap_count; |
17 | }; | 19 | }; |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 52e04b2f35d3..1879b72c40f8 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -114,7 +114,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, | |||
114 | struct usX2Ydev *us428 = hw->private_data; | 114 | struct usX2Ydev *us428 = hw->private_data; |
115 | int id = -1; | 115 | int id = -1; |
116 | 116 | ||
117 | switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) { | 117 | switch (le16_to_cpu(us428->dev->descriptor.idProduct)) { |
118 | case USB_ID_US122: | 118 | case USB_ID_US122: |
119 | id = USX2Y_TYPE_122; | 119 | id = USX2Y_TYPE_122; |
120 | break; | 120 | break; |
@@ -164,14 +164,14 @@ static int usX2Y_create_usbmidi(struct snd_card *card) | |||
164 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | 164 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
165 | .data = &quirk_data_2 | 165 | .data = &quirk_data_2 |
166 | }; | 166 | }; |
167 | struct usb_device *dev = usX2Y(card)->chip.dev; | 167 | struct usb_device *dev = usX2Y(card)->dev; |
168 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); | 168 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); |
169 | struct snd_usb_audio_quirk *quirk = | 169 | struct snd_usb_audio_quirk *quirk = |
170 | le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? | 170 | le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? |
171 | &quirk_2 : &quirk_1; | 171 | &quirk_2 : &quirk_1; |
172 | 172 | ||
173 | snd_printdd("usX2Y_create_usbmidi \n"); | 173 | snd_printdd("usX2Y_create_usbmidi \n"); |
174 | return snd_usb_create_midi_interface(&usX2Y(card)->chip, iface, quirk); | 174 | return snd_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk); |
175 | } | 175 | } |
176 | 176 | ||
177 | static int usX2Y_create_alsa_devices(struct snd_card *card) | 177 | static int usX2Y_create_alsa_devices(struct snd_card *card) |
@@ -202,7 +202,7 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, | |||
202 | snd_printdd( "dsp_load %s\n", dsp->name); | 202 | snd_printdd( "dsp_load %s\n", dsp->name); |
203 | 203 | ||
204 | if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { | 204 | if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { |
205 | struct usb_device* dev = priv->chip.dev; | 205 | struct usb_device* dev = priv->dev; |
206 | char *buf; | 206 | char *buf; |
207 | 207 | ||
208 | buf = memdup_user(dsp->image, dsp->length); | 208 | buf = memdup_user(dsp->image, dsp->length); |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index cb4bb8373ca2..c42350eed2eb 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -239,8 +239,8 @@ static void i_usX2Y_In04Int(struct urb *urb) | |||
239 | for (j = 0; j < URBS_AsyncSeq && !err; ++j) | 239 | for (j = 0; j < URBS_AsyncSeq && !err; ++j) |
240 | if (0 == usX2Y->AS04.urb[j]->status) { | 240 | if (0 == usX2Y->AS04.urb[j]->status) { |
241 | struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. | 241 | struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. |
242 | usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, | 242 | usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->dev, |
243 | usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, | 243 | usb_sndbulkpipe(usX2Y->dev, 0x04), &p4out->val.vol, |
244 | p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, | 244 | p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, |
245 | i_usX2Y_Out04Int, usX2Y); | 245 | i_usX2Y_Out04Int, usX2Y); |
246 | err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); | 246 | err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); |
@@ -253,7 +253,7 @@ static void i_usX2Y_In04Int(struct urb *urb) | |||
253 | if (err) | 253 | if (err) |
254 | snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err); | 254 | snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err); |
255 | 255 | ||
256 | urb->dev = usX2Y->chip.dev; | 256 | urb->dev = usX2Y->dev; |
257 | usb_submit_urb(urb, GFP_ATOMIC); | 257 | usb_submit_urb(urb, GFP_ATOMIC); |
258 | } | 258 | } |
259 | 259 | ||
@@ -273,8 +273,8 @@ int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y) | |||
273 | err = -ENOMEM; | 273 | err = -ENOMEM; |
274 | break; | 274 | break; |
275 | } | 275 | } |
276 | usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->chip.dev, | 276 | usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->dev, |
277 | usb_sndbulkpipe(usX2Y->chip.dev, 0x04), | 277 | usb_sndbulkpipe(usX2Y->dev, 0x04), |
278 | usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0, | 278 | usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0, |
279 | i_usX2Y_Out04Int, usX2Y | 279 | i_usX2Y_Out04Int, usX2Y |
280 | ); | 280 | ); |
@@ -293,7 +293,7 @@ int usX2Y_In04_init(struct usX2Ydev *usX2Y) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | init_waitqueue_head(&usX2Y->In04WaitQueue); | 295 | init_waitqueue_head(&usX2Y->In04WaitQueue); |
296 | usb_fill_int_urb(usX2Y->In04urb, usX2Y->chip.dev, usb_rcvintpipe(usX2Y->chip.dev, 0x4), | 296 | usb_fill_int_urb(usX2Y->In04urb, usX2Y->dev, usb_rcvintpipe(usX2Y->dev, 0x4), |
297 | usX2Y->In04Buf, 21, | 297 | usX2Y->In04Buf, 21, |
298 | i_usX2Y_In04Int, usX2Y, | 298 | i_usX2Y_In04Int, usX2Y, |
299 | 10); | 299 | 10); |
@@ -348,13 +348,12 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
348 | sizeof(struct usX2Ydev), &card); | 348 | sizeof(struct usX2Ydev), &card); |
349 | if (err < 0) | 349 | if (err < 0) |
350 | return err; | 350 | return err; |
351 | snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; | 351 | snd_usX2Y_card_used[usX2Y(card)->card_index = dev] = 1; |
352 | card->private_free = snd_usX2Y_card_private_free; | 352 | card->private_free = snd_usX2Y_card_private_free; |
353 | usX2Y(card)->chip.dev = device; | 353 | usX2Y(card)->dev = device; |
354 | usX2Y(card)->chip.card = card; | ||
355 | init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); | 354 | init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); |
356 | mutex_init(&usX2Y(card)->prepare_mutex); | 355 | mutex_init(&usX2Y(card)->prepare_mutex); |
357 | INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list); | 356 | INIT_LIST_HEAD(&usX2Y(card)->midi_list); |
358 | strcpy(card->driver, "USB "NAME_ALLCAPS""); | 357 | strcpy(card->driver, "USB "NAME_ALLCAPS""); |
359 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); | 358 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); |
360 | sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", | 359 | sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", |
@@ -362,7 +361,7 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
362 | le16_to_cpu(device->descriptor.idVendor), | 361 | le16_to_cpu(device->descriptor.idVendor), |
363 | le16_to_cpu(device->descriptor.idProduct), | 362 | le16_to_cpu(device->descriptor.idProduct), |
364 | 0,//us428(card)->usbmidi.ifnum, | 363 | 0,//us428(card)->usbmidi.ifnum, |
365 | usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum | 364 | usX2Y(card)->dev->bus->busnum, usX2Y(card)->dev->devnum |
366 | ); | 365 | ); |
367 | *cardp = card; | 366 | *cardp = card; |
368 | return 0; | 367 | return 0; |
@@ -432,8 +431,8 @@ static void snd_usX2Y_card_private_free(struct snd_card *card) | |||
432 | usb_free_urb(usX2Y(card)->In04urb); | 431 | usb_free_urb(usX2Y(card)->In04urb); |
433 | if (usX2Y(card)->us428ctls_sharedmem) | 432 | if (usX2Y(card)->us428ctls_sharedmem) |
434 | snd_free_pages(usX2Y(card)->us428ctls_sharedmem, sizeof(*usX2Y(card)->us428ctls_sharedmem)); | 433 | snd_free_pages(usX2Y(card)->us428ctls_sharedmem, sizeof(*usX2Y(card)->us428ctls_sharedmem)); |
435 | if (usX2Y(card)->chip.index >= 0 && usX2Y(card)->chip.index < SNDRV_CARDS) | 434 | if (usX2Y(card)->card_index >= 0 && usX2Y(card)->card_index < SNDRV_CARDS) |
436 | snd_usX2Y_card_used[usX2Y(card)->chip.index] = 0; | 435 | snd_usX2Y_card_used[usX2Y(card)->card_index] = 0; |
437 | } | 436 | } |
438 | 437 | ||
439 | /* | 438 | /* |
@@ -445,13 +444,12 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr) | |||
445 | struct snd_card *card = ptr; | 444 | struct snd_card *card = ptr; |
446 | struct usX2Ydev *usX2Y = usX2Y(card); | 445 | struct usX2Ydev *usX2Y = usX2Y(card); |
447 | struct list_head *p; | 446 | struct list_head *p; |
448 | usX2Y->chip.shutdown = 1; | ||
449 | usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; | 447 | usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; |
450 | usX2Y_unlinkSeq(&usX2Y->AS04); | 448 | usX2Y_unlinkSeq(&usX2Y->AS04); |
451 | usb_kill_urb(usX2Y->In04urb); | 449 | usb_kill_urb(usX2Y->In04urb); |
452 | snd_card_disconnect(card); | 450 | snd_card_disconnect(card); |
453 | /* release the midi resources */ | 451 | /* release the midi resources */ |
454 | list_for_each(p, &usX2Y->chip.midi_list) { | 452 | list_for_each(p, &usX2Y->midi_list) { |
455 | snd_usbmidi_disconnect(p); | 453 | snd_usbmidi_disconnect(p); |
456 | } | 454 | } |
457 | if (usX2Y->us428ctls_sharedmem) | 455 | if (usX2Y->us428ctls_sharedmem) |
diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h index 456b5fdbc339..1d174cea352b 100644 --- a/sound/usb/usx2y/usbusx2y.h +++ b/sound/usb/usx2y/usbusx2y.h | |||
@@ -22,7 +22,8 @@ struct snd_usX2Y_urbSeq { | |||
22 | #include "usx2yhwdeppcm.h" | 22 | #include "usx2yhwdeppcm.h" |
23 | 23 | ||
24 | struct usX2Ydev { | 24 | struct usX2Ydev { |
25 | struct snd_usb_audio chip; | 25 | struct usb_device *dev; |
26 | int card_index; | ||
26 | int stride; | 27 | int stride; |
27 | struct urb *In04urb; | 28 | struct urb *In04urb; |
28 | void *In04Buf; | 29 | void *In04Buf; |
@@ -42,6 +43,9 @@ struct usX2Ydev { | |||
42 | struct snd_usX2Y_substream *subs[4]; | 43 | struct snd_usX2Y_substream *subs[4]; |
43 | struct snd_usX2Y_substream * volatile prepare_subs; | 44 | struct snd_usX2Y_substream * volatile prepare_subs; |
44 | wait_queue_head_t prepare_wait_queue; | 45 | wait_queue_head_t prepare_wait_queue; |
46 | struct list_head midi_list; | ||
47 | struct list_head pcm_list; | ||
48 | int pcm_devs; | ||
45 | }; | 49 | }; |
46 | 50 | ||
47 | 51 | ||
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 9efd27f6b52f..74a67a85aa81 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -199,7 +199,7 @@ static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, i | |||
199 | return -ENODEV; | 199 | return -ENODEV; |
200 | urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks | 200 | urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks |
201 | urb->hcpriv = NULL; | 201 | urb->hcpriv = NULL; |
202 | urb->dev = subs->usX2Y->chip.dev; /* we need to set this at each time */ | 202 | urb->dev = subs->usX2Y->dev; /* we need to set this at each time */ |
203 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { | 203 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { |
204 | snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); | 204 | snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); |
205 | return err; | 205 | return err; |
@@ -300,7 +300,7 @@ static void usX2Y_error_sequence(struct usX2Ydev *usX2Y, | |||
300 | "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" | 300 | "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" |
301 | "Most propably some urb of usb-frame %i is still missing.\n" | 301 | "Most propably some urb of usb-frame %i is still missing.\n" |
302 | "Cause could be too long delays in usb-hcd interrupt handling.\n", | 302 | "Cause could be too long delays in usb-hcd interrupt handling.\n", |
303 | usb_get_current_frame_number(usX2Y->chip.dev), | 303 | usb_get_current_frame_number(usX2Y->dev), |
304 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", | 304 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", |
305 | usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); | 305 | usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); |
306 | usX2Y_clients_stop(usX2Y); | 306 | usX2Y_clients_stop(usX2Y); |
@@ -313,7 +313,7 @@ static void i_usX2Y_urb_complete(struct urb *urb) | |||
313 | 313 | ||
314 | if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { | 314 | if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { |
315 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", | 315 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", |
316 | usb_get_current_frame_number(usX2Y->chip.dev), | 316 | usb_get_current_frame_number(usX2Y->dev), |
317 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", | 317 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", |
318 | urb->status, urb->start_frame); | 318 | urb->status, urb->start_frame); |
319 | return; | 319 | return; |
@@ -424,7 +424,7 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) | |||
424 | int i; | 424 | int i; |
425 | unsigned int pipe; | 425 | unsigned int pipe; |
426 | int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; | 426 | int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
427 | struct usb_device *dev = subs->usX2Y->chip.dev; | 427 | struct usb_device *dev = subs->usX2Y->dev; |
428 | 428 | ||
429 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : | 429 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : |
430 | usb_rcvisocpipe(dev, subs->endpoint); | 430 | usb_rcvisocpipe(dev, subs->endpoint); |
@@ -500,7 +500,7 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) | |||
500 | unsigned long pack; | 500 | unsigned long pack; |
501 | if (0 == i) | 501 | if (0 == i) |
502 | atomic_set(&subs->state, state_STARTING3); | 502 | atomic_set(&subs->state, state_STARTING3); |
503 | urb->dev = usX2Y->chip.dev; | 503 | urb->dev = usX2Y->dev; |
504 | urb->transfer_flags = URB_ISO_ASAP; | 504 | urb->transfer_flags = URB_ISO_ASAP; |
505 | for (pack = 0; pack < nr_of_packs(); pack++) { | 505 | for (pack = 0; pack < nr_of_packs(); pack++) { |
506 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; | 506 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; |
@@ -692,7 +692,7 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) | |||
692 | } | 692 | } |
693 | ((char*)(usbdata + i))[0] = ra[i].c1; | 693 | ((char*)(usbdata + i))[0] = ra[i].c1; |
694 | ((char*)(usbdata + i))[1] = ra[i].c2; | 694 | ((char*)(usbdata + i))[1] = ra[i].c2; |
695 | usb_fill_bulk_urb(us->urb[i], usX2Y->chip.dev, usb_sndbulkpipe(usX2Y->chip.dev, 4), | 695 | usb_fill_bulk_urb(us->urb[i], usX2Y->dev, usb_sndbulkpipe(usX2Y->dev, 4), |
696 | usbdata + i, 2, i_usX2Y_04Int, usX2Y); | 696 | usbdata + i, 2, i_usX2Y_04Int, usX2Y); |
697 | #ifdef OLD_USB | 697 | #ifdef OLD_USB |
698 | us->urb[i]->transfer_flags = USB_QUEUE_BULK; | 698 | us->urb[i]->transfer_flags = USB_QUEUE_BULK; |
@@ -740,17 +740,17 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format) | |||
740 | alternate = 1; | 740 | alternate = 1; |
741 | usX2Y->stride = 4; | 741 | usX2Y->stride = 4; |
742 | } | 742 | } |
743 | list_for_each(p, &usX2Y->chip.midi_list) { | 743 | list_for_each(p, &usX2Y->midi_list) { |
744 | snd_usbmidi_input_stop(p); | 744 | snd_usbmidi_input_stop(p); |
745 | } | 745 | } |
746 | usb_kill_urb(usX2Y->In04urb); | 746 | usb_kill_urb(usX2Y->In04urb); |
747 | if ((err = usb_set_interface(usX2Y->chip.dev, 0, alternate))) { | 747 | if ((err = usb_set_interface(usX2Y->dev, 0, alternate))) { |
748 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 748 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
749 | return err; | 749 | return err; |
750 | } | 750 | } |
751 | usX2Y->In04urb->dev = usX2Y->chip.dev; | 751 | usX2Y->In04urb->dev = usX2Y->dev; |
752 | err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); | 752 | err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); |
753 | list_for_each(p, &usX2Y->chip.midi_list) { | 753 | list_for_each(p, &usX2Y->midi_list) { |
754 | snd_usbmidi_input_start(p); | 754 | snd_usbmidi_input_start(p); |
755 | } | 755 | } |
756 | usX2Y->format = format; | 756 | usX2Y->format = format; |
@@ -955,7 +955,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
955 | struct snd_pcm *pcm; | 955 | struct snd_pcm *pcm; |
956 | int err, i; | 956 | int err, i; |
957 | struct snd_usX2Y_substream **usX2Y_substream = | 957 | struct snd_usX2Y_substream **usX2Y_substream = |
958 | usX2Y(card)->subs + 2 * usX2Y(card)->chip.pcm_devs; | 958 | usX2Y(card)->subs + 2 * usX2Y(card)->pcm_devs; |
959 | 959 | ||
960 | for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; | 960 | for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; |
961 | i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { | 961 | i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { |
@@ -971,7 +971,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
971 | usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; | 971 | usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; |
972 | usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; | 972 | usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; |
973 | 973 | ||
974 | err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->chip.pcm_devs, | 974 | err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->pcm_devs, |
975 | playback_endpoint ? 1 : 0, 1, | 975 | playback_endpoint ? 1 : 0, 1, |
976 | &pcm); | 976 | &pcm); |
977 | if (err < 0) { | 977 | if (err < 0) { |
@@ -987,7 +987,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
987 | pcm->private_free = snd_usX2Y_pcm_private_free; | 987 | pcm->private_free = snd_usX2Y_pcm_private_free; |
988 | pcm->info_flags = 0; | 988 | pcm->info_flags = 0; |
989 | 989 | ||
990 | sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->chip.pcm_devs); | 990 | sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs); |
991 | 991 | ||
992 | if ((playback_endpoint && | 992 | if ((playback_endpoint && |
993 | 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, | 993 | 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, |
@@ -1001,7 +1001,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
1001 | snd_usX2Y_pcm_private_free(pcm); | 1001 | snd_usX2Y_pcm_private_free(pcm); |
1002 | return err; | 1002 | return err; |
1003 | } | 1003 | } |
1004 | usX2Y(card)->chip.pcm_devs++; | 1004 | usX2Y(card)->pcm_devs++; |
1005 | 1005 | ||
1006 | return 0; | 1006 | return 0; |
1007 | } | 1007 | } |
@@ -1013,14 +1013,14 @@ int usX2Y_audio_create(struct snd_card *card) | |||
1013 | { | 1013 | { |
1014 | int err = 0; | 1014 | int err = 0; |
1015 | 1015 | ||
1016 | INIT_LIST_HEAD(&usX2Y(card)->chip.pcm_list); | 1016 | INIT_LIST_HEAD(&usX2Y(card)->pcm_list); |
1017 | 1017 | ||
1018 | if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8))) | 1018 | if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8))) |
1019 | return err; | 1019 | return err; |
1020 | if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) == USB_ID_US428) | 1020 | if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) == USB_ID_US428) |
1021 | if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA))) | 1021 | if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA))) |
1022 | return err; | 1022 | return err; |
1023 | if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) != USB_ID_US122) | 1023 | if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) != USB_ID_US122) |
1024 | err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. | 1024 | err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. |
1025 | return err; | 1025 | return err; |
1026 | } | 1026 | } |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 4b2304c2e02d..9ed6c3956ca7 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -234,7 +234,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb) | |||
234 | 234 | ||
235 | if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { | 235 | if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { |
236 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", | 236 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", |
237 | usb_get_current_frame_number(usX2Y->chip.dev), | 237 | usb_get_current_frame_number(usX2Y->dev), |
238 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", | 238 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", |
239 | urb->status, urb->start_frame); | 239 | urb->status, urb->start_frame); |
240 | return; | 240 | return; |
@@ -318,7 +318,7 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) | |||
318 | int i; | 318 | int i; |
319 | unsigned int pipe; | 319 | unsigned int pipe; |
320 | int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; | 320 | int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
321 | struct usb_device *dev = subs->usX2Y->chip.dev; | 321 | struct usb_device *dev = subs->usX2Y->dev; |
322 | 322 | ||
323 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : | 323 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : |
324 | usb_rcvisocpipe(dev, subs->endpoint); | 324 | usb_rcvisocpipe(dev, subs->endpoint); |
@@ -441,7 +441,7 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) | |||
441 | unsigned long pack; | 441 | unsigned long pack; |
442 | if (0 == u) | 442 | if (0 == u) |
443 | atomic_set(&subs->state, state_STARTING3); | 443 | atomic_set(&subs->state, state_STARTING3); |
444 | urb->dev = usX2Y->chip.dev; | 444 | urb->dev = usX2Y->dev; |
445 | urb->transfer_flags = URB_ISO_ASAP; | 445 | urb->transfer_flags = URB_ISO_ASAP; |
446 | for (pack = 0; pack < nr_of_packs(); pack++) { | 446 | for (pack = 0; pack < nr_of_packs(); pack++) { |
447 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs()); | 447 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs()); |
@@ -741,7 +741,7 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) | |||
741 | int err; | 741 | int err; |
742 | struct snd_hwdep *hw; | 742 | struct snd_hwdep *hw; |
743 | struct snd_pcm *pcm; | 743 | struct snd_pcm *pcm; |
744 | struct usb_device *dev = usX2Y(card)->chip.dev; | 744 | struct usb_device *dev = usX2Y(card)->dev; |
745 | if (1 != nr_of_packs()) | 745 | if (1 != nr_of_packs()) |
746 | return 0; | 746 | return 0; |
747 | 747 | ||