aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/mpu401.h26
-rw-r--r--sound/drivers/mpu401/mpu401.c10
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c72
3 files changed, 53 insertions, 55 deletions
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index ae39e38bf996..8e97ace78f16 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -58,10 +58,8 @@
58#define MPU401_MODE_INPUT_TIMER (1<<0) 58#define MPU401_MODE_INPUT_TIMER (1<<0)
59#define MPU401_MODE_OUTPUT_TIMER (1<<1) 59#define MPU401_MODE_OUTPUT_TIMER (1<<1)
60 60
61typedef struct _snd_mpu401 mpu401_t; 61struct snd_mpu401 {
62 62 struct snd_rawmidi *rmidi;
63struct _snd_mpu401 {
64 snd_rawmidi_t *rmidi;
65 63
66 unsigned short hardware; /* MPU401_HW_XXXX */ 64 unsigned short hardware; /* MPU401_HW_XXXX */
67 unsigned long port; /* base port of MPU-401 chip */ 65 unsigned long port; /* base port of MPU-401 chip */
@@ -73,14 +71,14 @@ struct _snd_mpu401 {
73 unsigned long mode; /* MPU401_MODE_XXXX */ 71 unsigned long mode; /* MPU401_MODE_XXXX */
74 int timer_invoked; 72 int timer_invoked;
75 73
76 int (*open_input) (mpu401_t * mpu); 74 int (*open_input) (struct snd_mpu401 * mpu);
77 void (*close_input) (mpu401_t * mpu); 75 void (*close_input) (struct snd_mpu401 * mpu);
78 int (*open_output) (mpu401_t * mpu); 76 int (*open_output) (struct snd_mpu401 * mpu);
79 void (*close_output) (mpu401_t * mpu); 77 void (*close_output) (struct snd_mpu401 * mpu);
80 void *private_data; 78 void *private_data;
81 79
82 snd_rawmidi_substream_t *substream_input; 80 struct snd_rawmidi_substream *substream_input;
83 snd_rawmidi_substream_t *substream_output; 81 struct snd_rawmidi_substream *substream_output;
84 82
85 spinlock_t input_lock; 83 spinlock_t input_lock;
86 spinlock_t output_lock; 84 spinlock_t output_lock;
@@ -88,8 +86,8 @@ struct _snd_mpu401 {
88 86
89 struct timer_list timer; 87 struct timer_list timer;
90 88
91 void (*write) (mpu401_t * mpu, unsigned char data, unsigned long addr); 89 void (*write) (struct snd_mpu401 * mpu, unsigned char data, unsigned long addr);
92 unsigned char (*read) (mpu401_t * mpu, unsigned long addr); 90 unsigned char (*read) (struct snd_mpu401 *mpu, unsigned long addr);
93}; 91};
94 92
95/* I/O ports */ 93/* I/O ports */
@@ -103,13 +101,13 @@ struct _snd_mpu401 {
103 101
104irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs); 102irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs);
105 103
106int snd_mpu401_uart_new(snd_card_t * card, 104int snd_mpu401_uart_new(struct snd_card *card,
107 int device, 105 int device,
108 unsigned short hardware, 106 unsigned short hardware,
109 unsigned long port, 107 unsigned long port,
110 int integrated, 108 int integrated,
111 int irq, 109 int irq,
112 int irq_flags, 110 int irq_flags,
113 snd_rawmidi_t ** rrawmidi); 111 struct snd_rawmidi ** rrawmidi);
114 112
115#endif /* __SOUND_MPU401_H */ 113#endif /* __SOUND_MPU401_H */
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index 54e2ff9b5ca1..b1242ee937d9 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -56,12 +56,12 @@ MODULE_PARM_DESC(port, "Port # for MPU-401 device.");
56module_param_array(irq, int, NULL, 0444); 56module_param_array(irq, int, NULL, 0444);
57MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device."); 57MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device.");
58 58
59static snd_card_t *snd_mpu401_legacy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 59static struct snd_card *snd_mpu401_legacy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
60static int pnp_registered = 0; 60static int pnp_registered = 0;
61 61
62static int snd_mpu401_create(int dev, snd_card_t **rcard) 62static int snd_mpu401_create(int dev, struct snd_card **rcard)
63{ 63{
64 snd_card_t *card; 64 struct snd_card *card;
65 int err; 65 int err;
66 66
67 *rcard = NULL; 67 *rcard = NULL;
@@ -152,7 +152,7 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
152 const struct pnp_device_id *id) 152 const struct pnp_device_id *id)
153{ 153{
154 static int dev; 154 static int dev;
155 snd_card_t *card; 155 struct snd_card *card;
156 int err; 156 int err;
157 157
158 for ( ; dev < SNDRV_CARDS; ++dev) { 158 for ( ; dev < SNDRV_CARDS; ++dev) {
@@ -174,7 +174,7 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
174 174
175static void __devexit snd_mpu401_pnp_remove(struct pnp_dev *dev) 175static void __devexit snd_mpu401_pnp_remove(struct pnp_dev *dev)
176{ 176{
177 snd_card_t *card = (snd_card_t *) pnp_get_drvdata(dev); 177 struct snd_card *card = (struct snd_card *) pnp_get_drvdata(dev);
178 178
179 snd_card_disconnect(card); 179 snd_card_disconnect(card);
180 snd_card_free_in_thread(card); 180 snd_card_free_in_thread(card);
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index bdeb2c00dac5..16e87f31788c 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -43,8 +43,8 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
43MODULE_DESCRIPTION("Routines for control of MPU-401 in UART mode"); 43MODULE_DESCRIPTION("Routines for control of MPU-401 in UART mode");
44MODULE_LICENSE("GPL"); 44MODULE_LICENSE("GPL");
45 45
46static void snd_mpu401_uart_input_read(mpu401_t * mpu); 46static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu);
47static void snd_mpu401_uart_output_write(mpu401_t * mpu); 47static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu);
48 48
49/* 49/*
50 50
@@ -58,28 +58,28 @@ static void snd_mpu401_uart_output_write(mpu401_t * mpu);
58#define MPU401_ACK 0xfe 58#define MPU401_ACK 0xfe
59 59
60/* Build in lowlevel io */ 60/* Build in lowlevel io */
61static void mpu401_write_port(mpu401_t *mpu, unsigned char data, unsigned long addr) 61static void mpu401_write_port(struct snd_mpu401 *mpu, unsigned char data, unsigned long addr)
62{ 62{
63 outb(data, addr); 63 outb(data, addr);
64} 64}
65 65
66static unsigned char mpu401_read_port(mpu401_t *mpu, unsigned long addr) 66static unsigned char mpu401_read_port(struct snd_mpu401 *mpu, unsigned long addr)
67{ 67{
68 return inb(addr); 68 return inb(addr);
69} 69}
70 70
71static void mpu401_write_mmio(mpu401_t *mpu, unsigned char data, unsigned long addr) 71static void mpu401_write_mmio(struct snd_mpu401 *mpu, unsigned char data, unsigned long addr)
72{ 72{
73 writeb(data, (void __iomem *)addr); 73 writeb(data, (void __iomem *)addr);
74} 74}
75 75
76static unsigned char mpu401_read_mmio(mpu401_t *mpu, unsigned long addr) 76static unsigned char mpu401_read_mmio(struct snd_mpu401 *mpu, unsigned long addr)
77{ 77{
78 return readb((void __iomem *)addr); 78 return readb((void __iomem *)addr);
79} 79}
80/* */ 80/* */
81 81
82static void snd_mpu401_uart_clear_rx(mpu401_t *mpu) 82static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu)
83{ 83{
84 int timeout = 100000; 84 int timeout = 100000;
85 for (; timeout > 0 && snd_mpu401_input_avail(mpu); timeout--) 85 for (; timeout > 0 && snd_mpu401_input_avail(mpu); timeout--)
@@ -90,7 +90,7 @@ static void snd_mpu401_uart_clear_rx(mpu401_t *mpu)
90#endif 90#endif
91} 91}
92 92
93static void _snd_mpu401_uart_interrupt(mpu401_t *mpu) 93static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu)
94{ 94{
95 spin_lock(&mpu->input_lock); 95 spin_lock(&mpu->input_lock);
96 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) { 96 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) {
@@ -118,7 +118,7 @@ static void _snd_mpu401_uart_interrupt(mpu401_t *mpu)
118 */ 118 */
119irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs) 119irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
120{ 120{
121 mpu401_t *mpu = dev_id; 121 struct snd_mpu401 *mpu = dev_id;
122 122
123 if (mpu == NULL) 123 if (mpu == NULL)
124 return IRQ_NONE; 124 return IRQ_NONE;
@@ -132,7 +132,7 @@ irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *reg
132 */ 132 */
133static void snd_mpu401_uart_timer(unsigned long data) 133static void snd_mpu401_uart_timer(unsigned long data)
134{ 134{
135 mpu401_t *mpu = (mpu401_t *)data; 135 struct snd_mpu401 *mpu = (struct snd_mpu401 *)data;
136 136
137 spin_lock(&mpu->timer_lock); 137 spin_lock(&mpu->timer_lock);
138 /*mpu->mode |= MPU401_MODE_TIMER;*/ 138 /*mpu->mode |= MPU401_MODE_TIMER;*/
@@ -146,7 +146,7 @@ static void snd_mpu401_uart_timer(unsigned long data)
146/* 146/*
147 * initialize the timer callback if not programmed yet 147 * initialize the timer callback if not programmed yet
148 */ 148 */
149static void snd_mpu401_uart_add_timer (mpu401_t *mpu, int input) 149static void snd_mpu401_uart_add_timer (struct snd_mpu401 *mpu, int input)
150{ 150{
151 unsigned long flags; 151 unsigned long flags;
152 152
@@ -165,7 +165,7 @@ static void snd_mpu401_uart_add_timer (mpu401_t *mpu, int input)
165/* 165/*
166 * remove the timer callback if still active 166 * remove the timer callback if still active
167 */ 167 */
168static void snd_mpu401_uart_remove_timer (mpu401_t *mpu, int input) 168static void snd_mpu401_uart_remove_timer (struct snd_mpu401 *mpu, int input)
169{ 169{
170 unsigned long flags; 170 unsigned long flags;
171 171
@@ -182,7 +182,7 @@ static void snd_mpu401_uart_remove_timer (mpu401_t *mpu, int input)
182 182
183 */ 183 */
184 184
185static void snd_mpu401_uart_cmd(mpu401_t * mpu, unsigned char cmd, int ack) 185static void snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, int ack)
186{ 186{
187 unsigned long flags; 187 unsigned long flags;
188 int timeout, ok; 188 int timeout, ok;
@@ -225,9 +225,9 @@ static void snd_mpu401_uart_cmd(mpu401_t * mpu, unsigned char cmd, int ack)
225/* 225/*
226 * input/output open/close - protected by open_mutex in rawmidi.c 226 * input/output open/close - protected by open_mutex in rawmidi.c
227 */ 227 */
228static int snd_mpu401_uart_input_open(snd_rawmidi_substream_t * substream) 228static int snd_mpu401_uart_input_open(struct snd_rawmidi_substream *substream)
229{ 229{
230 mpu401_t *mpu; 230 struct snd_mpu401 *mpu;
231 int err; 231 int err;
232 232
233 mpu = substream->rmidi->private_data; 233 mpu = substream->rmidi->private_data;
@@ -242,9 +242,9 @@ static int snd_mpu401_uart_input_open(snd_rawmidi_substream_t * substream)
242 return 0; 242 return 0;
243} 243}
244 244
245static int snd_mpu401_uart_output_open(snd_rawmidi_substream_t * substream) 245static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream)
246{ 246{
247 mpu401_t *mpu; 247 struct snd_mpu401 *mpu;
248 int err; 248 int err;
249 249
250 mpu = substream->rmidi->private_data; 250 mpu = substream->rmidi->private_data;
@@ -259,9 +259,9 @@ static int snd_mpu401_uart_output_open(snd_rawmidi_substream_t * substream)
259 return 0; 259 return 0;
260} 260}
261 261
262static int snd_mpu401_uart_input_close(snd_rawmidi_substream_t * substream) 262static int snd_mpu401_uart_input_close(struct snd_rawmidi_substream *substream)
263{ 263{
264 mpu401_t *mpu; 264 struct snd_mpu401 *mpu;
265 265
266 mpu = substream->rmidi->private_data; 266 mpu = substream->rmidi->private_data;
267 clear_bit(MPU401_MODE_BIT_INPUT, &mpu->mode); 267 clear_bit(MPU401_MODE_BIT_INPUT, &mpu->mode);
@@ -273,9 +273,9 @@ static int snd_mpu401_uart_input_close(snd_rawmidi_substream_t * substream)
273 return 0; 273 return 0;
274} 274}
275 275
276static int snd_mpu401_uart_output_close(snd_rawmidi_substream_t * substream) 276static int snd_mpu401_uart_output_close(struct snd_rawmidi_substream *substream)
277{ 277{
278 mpu401_t *mpu; 278 struct snd_mpu401 *mpu;
279 279
280 mpu = substream->rmidi->private_data; 280 mpu = substream->rmidi->private_data;
281 clear_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode); 281 clear_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode);
@@ -290,10 +290,10 @@ static int snd_mpu401_uart_output_close(snd_rawmidi_substream_t * substream)
290/* 290/*
291 * trigger input callback 291 * trigger input callback
292 */ 292 */
293static void snd_mpu401_uart_input_trigger(snd_rawmidi_substream_t * substream, int up) 293static void snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substream, int up)
294{ 294{
295 unsigned long flags; 295 unsigned long flags;
296 mpu401_t *mpu; 296 struct snd_mpu401 *mpu;
297 int max = 64; 297 int max = 64;
298 298
299 mpu = substream->rmidi->private_data; 299 mpu = substream->rmidi->private_data;
@@ -321,7 +321,7 @@ static void snd_mpu401_uart_input_trigger(snd_rawmidi_substream_t * substream, i
321 * transfer input pending data 321 * transfer input pending data
322 * call with input_lock spinlock held 322 * call with input_lock spinlock held
323 */ 323 */
324static void snd_mpu401_uart_input_read(mpu401_t * mpu) 324static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu)
325{ 325{
326 int max = 128; 326 int max = 128;
327 unsigned char byte; 327 unsigned char byte;
@@ -349,7 +349,7 @@ static void snd_mpu401_uart_input_read(mpu401_t * mpu)
349 * write output pending bytes 349 * write output pending bytes
350 * call with output_lock spinlock held 350 * call with output_lock spinlock held
351 */ 351 */
352static void snd_mpu401_uart_output_write(mpu401_t * mpu) 352static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu)
353{ 353{
354 unsigned char byte; 354 unsigned char byte;
355 int max = 256, timeout; 355 int max = 256, timeout;
@@ -375,10 +375,10 @@ static void snd_mpu401_uart_output_write(mpu401_t * mpu)
375/* 375/*
376 * output trigger callback 376 * output trigger callback
377 */ 377 */
378static void snd_mpu401_uart_output_trigger(snd_rawmidi_substream_t * substream, int up) 378static void snd_mpu401_uart_output_trigger(struct snd_rawmidi_substream *substream, int up)
379{ 379{
380 unsigned long flags; 380 unsigned long flags;
381 mpu401_t *mpu; 381 struct snd_mpu401 *mpu;
382 382
383 mpu = substream->rmidi->private_data; 383 mpu = substream->rmidi->private_data;
384 if (up) { 384 if (up) {
@@ -404,23 +404,23 @@ static void snd_mpu401_uart_output_trigger(snd_rawmidi_substream_t * substream,
404 404
405 */ 405 */
406 406
407static snd_rawmidi_ops_t snd_mpu401_uart_output = 407static struct snd_rawmidi_ops snd_mpu401_uart_output =
408{ 408{
409 .open = snd_mpu401_uart_output_open, 409 .open = snd_mpu401_uart_output_open,
410 .close = snd_mpu401_uart_output_close, 410 .close = snd_mpu401_uart_output_close,
411 .trigger = snd_mpu401_uart_output_trigger, 411 .trigger = snd_mpu401_uart_output_trigger,
412}; 412};
413 413
414static snd_rawmidi_ops_t snd_mpu401_uart_input = 414static struct snd_rawmidi_ops snd_mpu401_uart_input =
415{ 415{
416 .open = snd_mpu401_uart_input_open, 416 .open = snd_mpu401_uart_input_open,
417 .close = snd_mpu401_uart_input_close, 417 .close = snd_mpu401_uart_input_close,
418 .trigger = snd_mpu401_uart_input_trigger, 418 .trigger = snd_mpu401_uart_input_trigger,
419}; 419};
420 420
421static void snd_mpu401_uart_free(snd_rawmidi_t *rmidi) 421static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi)
422{ 422{
423 mpu401_t *mpu = rmidi->private_data; 423 struct snd_mpu401 *mpu = rmidi->private_data;
424 if (mpu->irq_flags && mpu->irq >= 0) 424 if (mpu->irq_flags && mpu->irq >= 0)
425 free_irq(mpu->irq, (void *) mpu); 425 free_irq(mpu->irq, (void *) mpu);
426 release_and_free_resource(mpu->res); 426 release_and_free_resource(mpu->res);
@@ -442,18 +442,18 @@ static void snd_mpu401_uart_free(snd_rawmidi_t *rmidi)
442 * 442 *
443 * Note that the rawmidi instance is returned on the rrawmidi argument, 443 * Note that the rawmidi instance is returned on the rrawmidi argument,
444 * not the mpu401 instance itself. To access to the mpu401 instance, 444 * not the mpu401 instance itself. To access to the mpu401 instance,
445 * cast from rawmidi->private_data (with mpu401_t magic-cast). 445 * cast from rawmidi->private_data (with struct snd_mpu401 magic-cast).
446 * 446 *
447 * Returns zero if successful, or a negative error code. 447 * Returns zero if successful, or a negative error code.
448 */ 448 */
449int snd_mpu401_uart_new(snd_card_t * card, int device, 449int snd_mpu401_uart_new(struct snd_card *card, int device,
450 unsigned short hardware, 450 unsigned short hardware,
451 unsigned long port, int integrated, 451 unsigned long port, int integrated,
452 int irq, int irq_flags, 452 int irq, int irq_flags,
453 snd_rawmidi_t ** rrawmidi) 453 struct snd_rawmidi ** rrawmidi)
454{ 454{
455 mpu401_t *mpu; 455 struct snd_mpu401 *mpu;
456 snd_rawmidi_t *rmidi; 456 struct snd_rawmidi *rmidi;
457 int err; 457 int err;
458 458
459 if (rrawmidi) 459 if (rrawmidi)