dummy.c (d9bc125caf592b7d081021f32ce5b717efdf70c8) dummy.c (788c6043335590e0a483fdc18f85b1405a157bf9)
1/*
2 * Dummy soundcard
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 409 unchanged lines hidden (view full) ---

418 .ioctl = snd_pcm_lib_ioctl,
419 .hw_params = snd_card_dummy_hw_params,
420 .hw_free = snd_card_dummy_hw_free,
421 .prepare = snd_card_dummy_pcm_prepare,
422 .trigger = snd_card_dummy_pcm_trigger,
423 .pointer = snd_card_dummy_pcm_pointer,
424};
425
1/*
2 * Dummy soundcard
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 409 unchanged lines hidden (view full) ---

418 .ioctl = snd_pcm_lib_ioctl,
419 .hw_params = snd_card_dummy_hw_params,
420 .hw_free = snd_card_dummy_hw_free,
421 .prepare = snd_card_dummy_pcm_prepare,
422 .trigger = snd_card_dummy_pcm_trigger,
423 .pointer = snd_card_dummy_pcm_pointer,
424};
425
426static int __init snd_card_dummy_pcm(struct snd_dummy *dummy, int device, int substreams)
426static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device,
427 int substreams)
427{
428 struct snd_pcm *pcm;
429 int err;
430
431 if ((err = snd_pcm_new(dummy->card, "Dummy PCM", device,
432 substreams, substreams, &pcm)) < 0)
433 return err;
434 dummy->pcm = pcm;

--- 122 unchanged lines hidden (view full) ---

557DUMMY_VOLUME("Line Volume", 0, MIXER_ADDR_LINE),
558DUMMY_CAPSRC("Line Capture Switch", 0, MIXER_ADDR_LINE),
559DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC),
560DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC),
561DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
562DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD)
563};
564
428{
429 struct snd_pcm *pcm;
430 int err;
431
432 if ((err = snd_pcm_new(dummy->card, "Dummy PCM", device,
433 substreams, substreams, &pcm)) < 0)
434 return err;
435 dummy->pcm = pcm;

--- 122 unchanged lines hidden (view full) ---

558DUMMY_VOLUME("Line Volume", 0, MIXER_ADDR_LINE),
559DUMMY_CAPSRC("Line Capture Switch", 0, MIXER_ADDR_LINE),
560DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC),
561DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC),
562DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
563DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD)
564};
565
565static int __init snd_card_dummy_new_mixer(struct snd_dummy *dummy)
566static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy)
566{
567 struct snd_card *card = dummy->card;
568 unsigned int idx;
569 int err;
570
571 snd_assert(dummy != NULL, return -EINVAL);
572 spin_lock_init(&dummy->mixer_lock);
573 strcpy(card->mixername, "Dummy Mixer");
574
575 for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) {
576 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy))) < 0)
577 return err;
578 }
579 return 0;
580}
581
567{
568 struct snd_card *card = dummy->card;
569 unsigned int idx;
570 int err;
571
572 snd_assert(dummy != NULL, return -EINVAL);
573 spin_lock_init(&dummy->mixer_lock);
574 strcpy(card->mixername, "Dummy Mixer");
575
576 for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) {
577 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy))) < 0)
578 return err;
579 }
580 return 0;
581}
582
582static int __init snd_dummy_probe(struct platform_device *devptr)
583static int __devinit snd_dummy_probe(struct platform_device *devptr)
583{
584 struct snd_card *card;
585 struct snd_dummy *dummy;
586 int idx, err;
587 int dev = devptr->id;
588
589 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
590 sizeof(struct snd_dummy));

--- 21 unchanged lines hidden (view full) ---

612 platform_set_drvdata(devptr, card);
613 return 0;
614 }
615 __nodev:
616 snd_card_free(card);
617 return err;
618}
619
584{
585 struct snd_card *card;
586 struct snd_dummy *dummy;
587 int idx, err;
588 int dev = devptr->id;
589
590 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
591 sizeof(struct snd_dummy));

--- 21 unchanged lines hidden (view full) ---

613 platform_set_drvdata(devptr, card);
614 return 0;
615 }
616 __nodev:
617 snd_card_free(card);
618 return err;
619}
620
620static int snd_dummy_remove(struct platform_device *devptr)
621static int __devexit snd_dummy_remove(struct platform_device *devptr)
621{
622 snd_card_free(platform_get_drvdata(devptr));
623 platform_set_drvdata(devptr, NULL);
624 return 0;
625}
626
627#ifdef CONFIG_PM
628static int snd_dummy_suspend(struct platform_device *pdev, pm_message_t state)

--- 14 unchanged lines hidden (view full) ---

643 return 0;
644}
645#endif
646
647#define SND_DUMMY_DRIVER "snd_dummy"
648
649static struct platform_driver snd_dummy_driver = {
650 .probe = snd_dummy_probe,
622{
623 snd_card_free(platform_get_drvdata(devptr));
624 platform_set_drvdata(devptr, NULL);
625 return 0;
626}
627
628#ifdef CONFIG_PM
629static int snd_dummy_suspend(struct platform_device *pdev, pm_message_t state)

--- 14 unchanged lines hidden (view full) ---

644 return 0;
645}
646#endif
647
648#define SND_DUMMY_DRIVER "snd_dummy"
649
650static struct platform_driver snd_dummy_driver = {
651 .probe = snd_dummy_probe,
651 .remove = snd_dummy_remove,
652 .remove = __devexit_p(snd_dummy_remove),
652#ifdef CONFIG_PM
653 .suspend = snd_dummy_suspend,
654 .resume = snd_dummy_resume,
655#endif
656 .driver = {
657 .name = SND_DUMMY_DRIVER
658 },
659};

--- 50 unchanged lines hidden ---
653#ifdef CONFIG_PM
654 .suspend = snd_dummy_suspend,
655 .resume = snd_dummy_resume,
656#endif
657 .driver = {
658 .name = SND_DUMMY_DRIVER
659 },
660};

--- 50 unchanged lines hidden ---