aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/dummy.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 08:27:28 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:18:15 -0500
commit4a4d2cfd8cbca3076742547157ea135d0be77928 (patch)
tree44f859e10ebb6b6a03b18927ecf6dc1bbed9ec59 /sound/drivers/dummy.c
parent03da312ac080b4f5c9359c233b8812cc93a035fe (diff)
[ALSA] Remove xxx_t typedefs: Generic drivers
Modules: Generic drivers Remove xxx_t typedefs from the generic drivers (dummy, mtpav, serial-u16550 and virmidi). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/drivers/dummy.c')
-rw-r--r--sound/drivers/dummy.c124
1 files changed, 65 insertions, 59 deletions
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 8dfe5d49eafc..9c827b154458 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}");
42 42
43#if 0 /* emu10k1 emulation */ 43#if 0 /* emu10k1 emulation */
44#define MAX_BUFFER_SIZE (128 * 1024) 44#define MAX_BUFFER_SIZE (128 * 1024)
45static int emu10k1_playback_constraints(snd_pcm_runtime_t *runtime) 45static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime)
46{ 46{
47 int err; 47 int err;
48 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 48 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
@@ -149,15 +149,15 @@ MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-16) for dummy driver.");
149#define MIXER_ADDR_CD 4 149#define MIXER_ADDR_CD 4
150#define MIXER_ADDR_LAST 4 150#define MIXER_ADDR_LAST 4
151 151
152typedef struct snd_card_dummy { 152struct snd_dummy {
153 snd_card_t *card; 153 struct snd_card *card;
154 spinlock_t mixer_lock; 154 spinlock_t mixer_lock;
155 int mixer_volume[MIXER_ADDR_LAST+1][2]; 155 int mixer_volume[MIXER_ADDR_LAST+1][2];
156 int capture_source[MIXER_ADDR_LAST+1][2]; 156 int capture_source[MIXER_ADDR_LAST+1][2];
157} snd_card_dummy_t; 157};
158 158
159typedef struct snd_card_dummy_pcm { 159struct snd_dummy_pcm {
160 snd_card_dummy_t *dummy; 160 struct snd_dummy *dummy;
161 spinlock_t lock; 161 spinlock_t lock;
162 struct timer_list timer; 162 struct timer_list timer;
163 unsigned int pcm_size; 163 unsigned int pcm_size;
@@ -166,27 +166,27 @@ typedef struct snd_card_dummy_pcm {
166 unsigned int pcm_jiffie; /* bytes per one jiffie */ 166 unsigned int pcm_jiffie; /* bytes per one jiffie */
167 unsigned int pcm_irq_pos; /* IRQ position */ 167 unsigned int pcm_irq_pos; /* IRQ position */
168 unsigned int pcm_buf_pos; /* position in buffer */ 168 unsigned int pcm_buf_pos; /* position in buffer */
169 snd_pcm_substream_t *substream; 169 struct snd_pcm_substream *substream;
170} snd_card_dummy_pcm_t; 170};
171 171
172static snd_card_t *snd_dummy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 172static struct snd_card *snd_dummy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
173 173
174 174
175static inline void snd_card_dummy_pcm_timer_start(snd_card_dummy_pcm_t *dpcm) 175static inline void snd_card_dummy_pcm_timer_start(struct snd_dummy_pcm *dpcm)
176{ 176{
177 dpcm->timer.expires = 1 + jiffies; 177 dpcm->timer.expires = 1 + jiffies;
178 add_timer(&dpcm->timer); 178 add_timer(&dpcm->timer);
179} 179}
180 180
181static inline void snd_card_dummy_pcm_timer_stop(snd_card_dummy_pcm_t *dpcm) 181static inline void snd_card_dummy_pcm_timer_stop(struct snd_dummy_pcm *dpcm)
182{ 182{
183 del_timer(&dpcm->timer); 183 del_timer(&dpcm->timer);
184} 184}
185 185
186static int snd_card_dummy_pcm_trigger(snd_pcm_substream_t *substream, int cmd) 186static int snd_card_dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
187{ 187{
188 snd_pcm_runtime_t *runtime = substream->runtime; 188 struct snd_pcm_runtime *runtime = substream->runtime;
189 snd_dummy_card_pcm_t *dpcm = runtime->private_data; 189 struct snd_dummy_pcm *dpcm = runtime->private_data;
190 int err = 0; 190 int err = 0;
191 191
192 spin_lock(&dpcm->lock); 192 spin_lock(&dpcm->lock);
@@ -201,10 +201,10 @@ static int snd_card_dummy_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
201 return err; 201 return err;
202} 202}
203 203
204static int snd_card_dummy_pcm_prepare(snd_pcm_substream_t * substream) 204static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream)
205{ 205{
206 snd_pcm_runtime_t *runtime = substream->runtime; 206 struct snd_pcm_runtime *runtime = substream->runtime;
207 snd_card_dummy_pcm_t *dpcm = runtime->private_data; 207 struct snd_dummy_pcm *dpcm = runtime->private_data;
208 unsigned int bps; 208 unsigned int bps;
209 209
210 bps = runtime->rate * runtime->channels; 210 bps = runtime->rate * runtime->channels;
@@ -223,7 +223,7 @@ static int snd_card_dummy_pcm_prepare(snd_pcm_substream_t * substream)
223 223
224static void snd_card_dummy_pcm_timer_function(unsigned long data) 224static void snd_card_dummy_pcm_timer_function(unsigned long data)
225{ 225{
226 snd_card_dummy_pcm_t *dpcm = (snd_card_dummy_pcm_t *)data; 226 struct snd_dummy_pcm *dpcm = (struct snd_dummy_pcm *)data;
227 227
228 spin_lock(&dpcm->lock); 228 spin_lock(&dpcm->lock);
229 dpcm->timer.expires = 1 + jiffies; 229 dpcm->timer.expires = 1 + jiffies;
@@ -240,15 +240,15 @@ static void snd_card_dummy_pcm_timer_function(unsigned long data)
240 spin_unlock(&dpcm->lock); 240 spin_unlock(&dpcm->lock);
241} 241}
242 242
243static snd_pcm_uframes_t snd_card_dummy_pcm_pointer(snd_pcm_substream_t * substream) 243static snd_pcm_uframes_t snd_card_dummy_pcm_pointer(struct snd_pcm_substream *substream)
244{ 244{
245 snd_pcm_runtime_t *runtime = substream->runtime; 245 struct snd_pcm_runtime *runtime = substream->runtime;
246 snd_card_dummy_pcm_t *dpcm = runtime->private_data; 246 struct snd_dummy_pcm *dpcm = runtime->private_data;
247 247
248 return bytes_to_frames(runtime, dpcm->pcm_buf_pos); 248 return bytes_to_frames(runtime, dpcm->pcm_buf_pos);
249} 249}
250 250
251static snd_pcm_hardware_t snd_card_dummy_playback = 251static struct snd_pcm_hardware snd_card_dummy_playback =
252{ 252{
253 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 253 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
254 SNDRV_PCM_INFO_MMAP_VALID), 254 SNDRV_PCM_INFO_MMAP_VALID),
@@ -266,7 +266,7 @@ static snd_pcm_hardware_t snd_card_dummy_playback =
266 .fifo_size = 0, 266 .fifo_size = 0,
267}; 267};
268 268
269static snd_pcm_hardware_t snd_card_dummy_capture = 269static struct snd_pcm_hardware snd_card_dummy_capture =
270{ 270{
271 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 271 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
272 SNDRV_PCM_INFO_MMAP_VALID), 272 SNDRV_PCM_INFO_MMAP_VALID),
@@ -284,25 +284,25 @@ static snd_pcm_hardware_t snd_card_dummy_capture =
284 .fifo_size = 0, 284 .fifo_size = 0,
285}; 285};
286 286
287static void snd_card_dummy_runtime_free(snd_pcm_runtime_t *runtime) 287static void snd_card_dummy_runtime_free(struct snd_pcm_runtime *runtime)
288{ 288{
289 kfree(runtime->private_data); 289 kfree(runtime->private_data);
290} 290}
291 291
292static int snd_card_dummy_hw_params(snd_pcm_substream_t * substream, 292static int snd_card_dummy_hw_params(struct snd_pcm_substream *substream,
293 snd_pcm_hw_params_t * hw_params) 293 struct snd_pcm_hw_params *hw_params)
294{ 294{
295 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 295 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
296} 296}
297 297
298static int snd_card_dummy_hw_free(snd_pcm_substream_t * substream) 298static int snd_card_dummy_hw_free(struct snd_pcm_substream *substream)
299{ 299{
300 return snd_pcm_lib_free_pages(substream); 300 return snd_pcm_lib_free_pages(substream);
301} 301}
302 302
303static snd_card_dummy_pcm_t *new_pcm_stream(snd_pcm_substream_t *substream) 303static struct snd_dummy_pcm *new_pcm_stream(struct snd_pcm_substream *substream)
304{ 304{
305 snd_card_dummy_pcm_t *dpcm; 305 struct snd_dummy_pcm *dpcm;
306 306
307 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); 307 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
308 if (! dpcm) 308 if (! dpcm)
@@ -315,10 +315,10 @@ static snd_card_dummy_pcm_t *new_pcm_stream(snd_pcm_substream_t *substream)
315 return dpcm; 315 return dpcm;
316} 316}
317 317
318static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream) 318static int snd_card_dummy_playback_open(struct snd_pcm_substream *substream)
319{ 319{
320 snd_pcm_runtime_t *runtime = substream->runtime; 320 struct snd_pcm_runtime *runtime = substream->runtime;
321 snd_card_dummy_pcm_t *dpcm; 321 struct snd_dummy_pcm *dpcm;
322 int err; 322 int err;
323 323
324 if ((dpcm = new_pcm_stream(substream)) == NULL) 324 if ((dpcm = new_pcm_stream(substream)) == NULL)
@@ -340,10 +340,10 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream)
340 return 0; 340 return 0;
341} 341}
342 342
343static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream) 343static int snd_card_dummy_capture_open(struct snd_pcm_substream *substream)
344{ 344{
345 snd_pcm_runtime_t *runtime = substream->runtime; 345 struct snd_pcm_runtime *runtime = substream->runtime;
346 snd_card_dummy_pcm_t *dpcm; 346 struct snd_dummy_pcm *dpcm;
347 int err; 347 int err;
348 348
349 if ((dpcm = new_pcm_stream(substream)) == NULL) 349 if ((dpcm = new_pcm_stream(substream)) == NULL)
@@ -365,17 +365,17 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream)
365 return 0; 365 return 0;
366} 366}
367 367
368static int snd_card_dummy_playback_close(snd_pcm_substream_t * substream) 368static int snd_card_dummy_playback_close(struct snd_pcm_substream *substream)
369{ 369{
370 return 0; 370 return 0;
371} 371}
372 372
373static int snd_card_dummy_capture_close(snd_pcm_substream_t * substream) 373static int snd_card_dummy_capture_close(struct snd_pcm_substream *substream)
374{ 374{
375 return 0; 375 return 0;
376} 376}
377 377
378static snd_pcm_ops_t snd_card_dummy_playback_ops = { 378static struct snd_pcm_ops snd_card_dummy_playback_ops = {
379 .open = snd_card_dummy_playback_open, 379 .open = snd_card_dummy_playback_open,
380 .close = snd_card_dummy_playback_close, 380 .close = snd_card_dummy_playback_close,
381 .ioctl = snd_pcm_lib_ioctl, 381 .ioctl = snd_pcm_lib_ioctl,
@@ -386,7 +386,7 @@ static snd_pcm_ops_t snd_card_dummy_playback_ops = {
386 .pointer = snd_card_dummy_pcm_pointer, 386 .pointer = snd_card_dummy_pcm_pointer,
387}; 387};
388 388
389static snd_pcm_ops_t snd_card_dummy_capture_ops = { 389static struct snd_pcm_ops snd_card_dummy_capture_ops = {
390 .open = snd_card_dummy_capture_open, 390 .open = snd_card_dummy_capture_open,
391 .close = snd_card_dummy_capture_close, 391 .close = snd_card_dummy_capture_close,
392 .ioctl = snd_pcm_lib_ioctl, 392 .ioctl = snd_pcm_lib_ioctl,
@@ -397,12 +397,13 @@ static snd_pcm_ops_t snd_card_dummy_capture_ops = {
397 .pointer = snd_card_dummy_pcm_pointer, 397 .pointer = snd_card_dummy_pcm_pointer,
398}; 398};
399 399
400static int __init snd_card_dummy_pcm(snd_card_dummy_t *dummy, int device, int substreams) 400static int __init snd_card_dummy_pcm(struct snd_dummy *dummy, int device, int substreams)
401{ 401{
402 snd_pcm_t *pcm; 402 struct snd_pcm *pcm;
403 int err; 403 int err;
404 404
405 if ((err = snd_pcm_new(dummy->card, "Dummy PCM", device, substreams, substreams, &pcm)) < 0) 405 if ((err = snd_pcm_new(dummy->card, "Dummy PCM", device,
406 substreams, substreams, &pcm)) < 0)
406 return err; 407 return err;
407 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops); 408 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops);
408 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_dummy_capture_ops); 409 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_dummy_capture_ops);
@@ -421,7 +422,8 @@ static int __init snd_card_dummy_pcm(snd_card_dummy_t *dummy, int device, int su
421 .get = snd_dummy_volume_get, .put = snd_dummy_volume_put, \ 422 .get = snd_dummy_volume_get, .put = snd_dummy_volume_put, \
422 .private_value = addr } 423 .private_value = addr }
423 424
424static int snd_dummy_volume_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) 425static int snd_dummy_volume_info(struct snd_kcontrol *kcontrol,
426 struct snd_ctl_elem_info *uinfo)
425{ 427{
426 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 428 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
427 uinfo->count = 2; 429 uinfo->count = 2;
@@ -430,9 +432,10 @@ static int snd_dummy_volume_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t
430 return 0; 432 return 0;
431} 433}
432 434
433static int snd_dummy_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 435static int snd_dummy_volume_get(struct snd_kcontrol *kcontrol,
436 struct snd_ctl_elem_value *ucontrol)
434{ 437{
435 snd_card_dummy_t *dummy = snd_kcontrol_chip(kcontrol); 438 struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
436 int addr = kcontrol->private_value; 439 int addr = kcontrol->private_value;
437 440
438 spin_lock_irq(&dummy->mixer_lock); 441 spin_lock_irq(&dummy->mixer_lock);
@@ -442,9 +445,10 @@ static int snd_dummy_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
442 return 0; 445 return 0;
443} 446}
444 447
445static int snd_dummy_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 448static int snd_dummy_volume_put(struct snd_kcontrol *kcontrol,
449 struct snd_ctl_elem_value *ucontrol)
446{ 450{
447 snd_card_dummy_t *dummy = snd_kcontrol_chip(kcontrol); 451 struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
448 int change, addr = kcontrol->private_value; 452 int change, addr = kcontrol->private_value;
449 int left, right; 453 int left, right;
450 454
@@ -473,7 +477,8 @@ static int snd_dummy_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
473 .get = snd_dummy_capsrc_get, .put = snd_dummy_capsrc_put, \ 477 .get = snd_dummy_capsrc_get, .put = snd_dummy_capsrc_put, \
474 .private_value = addr } 478 .private_value = addr }
475 479
476static int snd_dummy_capsrc_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) 480static int snd_dummy_capsrc_info(struct snd_kcontrol *kcontrol,
481 struct snd_ctl_elem_info *uinfo)
477{ 482{
478 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 483 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
479 uinfo->count = 2; 484 uinfo->count = 2;
@@ -482,9 +487,10 @@ static int snd_dummy_capsrc_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t
482 return 0; 487 return 0;
483} 488}
484 489
485static int snd_dummy_capsrc_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 490static int snd_dummy_capsrc_get(struct snd_kcontrol *kcontrol,
491 struct snd_ctl_elem_value *ucontrol)
486{ 492{
487 snd_card_dummy_t *dummy = snd_kcontrol_chip(kcontrol); 493 struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
488 int addr = kcontrol->private_value; 494 int addr = kcontrol->private_value;
489 495
490 spin_lock_irq(&dummy->mixer_lock); 496 spin_lock_irq(&dummy->mixer_lock);
@@ -494,9 +500,9 @@ static int snd_dummy_capsrc_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
494 return 0; 500 return 0;
495} 501}
496 502
497static int snd_dummy_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 503static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
498{ 504{
499 snd_card_dummy_t *dummy = snd_kcontrol_chip(kcontrol); 505 struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
500 int change, addr = kcontrol->private_value; 506 int change, addr = kcontrol->private_value;
501 int left, right; 507 int left, right;
502 508
@@ -511,7 +517,7 @@ static int snd_dummy_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
511 return change; 517 return change;
512} 518}
513 519
514static snd_kcontrol_new_t snd_dummy_controls[] = { 520static struct snd_kcontrol_new snd_dummy_controls[] = {
515DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER), 521DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
516DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER), 522DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
517DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH), 523DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH),
@@ -524,9 +530,9 @@ DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
524DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_MASTER) 530DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_MASTER)
525}; 531};
526 532
527static int __init snd_card_dummy_new_mixer(snd_card_dummy_t * dummy) 533static int __init snd_card_dummy_new_mixer(struct snd_dummy *dummy)
528{ 534{
529 snd_card_t *card = dummy->card; 535 struct snd_card *card = dummy->card;
530 unsigned int idx; 536 unsigned int idx;
531 int err; 537 int err;
532 538
@@ -543,17 +549,17 @@ static int __init snd_card_dummy_new_mixer(snd_card_dummy_t * dummy)
543 549
544static int __init snd_card_dummy_probe(int dev) 550static int __init snd_card_dummy_probe(int dev)
545{ 551{
546 snd_card_t *card; 552 struct snd_card *card;
547 struct snd_card_dummy *dummy; 553 struct snd_dummy *dummy;
548 int idx, err; 554 int idx, err;
549 555
550 if (!enable[dev]) 556 if (!enable[dev])
551 return -ENODEV; 557 return -ENODEV;
552 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 558 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
553 sizeof(struct snd_card_dummy)); 559 sizeof(struct snd_dummy));
554 if (card == NULL) 560 if (card == NULL)
555 return -ENOMEM; 561 return -ENOMEM;
556 dummy = (struct snd_card_dummy *)card->private_data; 562 dummy = card->private_data;
557 dummy->card = card; 563 dummy->card = card;
558 for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) { 564 for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {
559 if (pcm_substreams[dev] < 1) 565 if (pcm_substreams[dev] < 1)