diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/arm/aaci.c | 1 | ||||
-rw-r--r-- | sound/arm/pxa2xx-ac97.c | 8 | ||||
-rw-r--r-- | sound/core/init.c | 14 | ||||
-rw-r--r-- | sound/core/sound.c | 2 | ||||
-rw-r--r-- | sound/oss/soundcard.c | 4 | ||||
-rw-r--r-- | sound/parisc/harmony.c | 116 | ||||
-rw-r--r-- | sound/parisc/harmony.h | 17 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_bus.c | 6 | ||||
-rw-r--r-- | sound/ppc/beep.c | 66 | ||||
-rw-r--r-- | sound/sound_core.c | 2 |
10 files changed, 162 insertions, 74 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index b2d5db20ec8c..559ead6367da 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <asm/io.h> | 21 | #include <asm/io.h> |
22 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
23 | #include <asm/sizes.h> | ||
23 | #include <asm/hardware/amba.h> | 24 | #include <asm/hardware/amba.h> |
24 | 25 | ||
25 | #include <sound/driver.h> | 26 | #include <sound/driver.h> |
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 38b20efc9c0b..877bb00d3295 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -275,23 +275,23 @@ static int pxa2xx_ac97_do_resume(snd_card_t *card) | |||
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |
277 | 277 | ||
278 | static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state, u32 level) | 278 | static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state) |
279 | { | 279 | { |
280 | snd_card_t *card = dev_get_drvdata(_dev); | 280 | snd_card_t *card = dev_get_drvdata(_dev); |
281 | int ret = 0; | 281 | int ret = 0; |
282 | 282 | ||
283 | if (card && level == SUSPEND_DISABLE) | 283 | if (card) |
284 | ret = pxa2xx_ac97_do_suspend(card, PMSG_SUSPEND); | 284 | ret = pxa2xx_ac97_do_suspend(card, PMSG_SUSPEND); |
285 | 285 | ||
286 | return ret; | 286 | return ret; |
287 | } | 287 | } |
288 | 288 | ||
289 | static int pxa2xx_ac97_resume(struct device *_dev, u32 level) | 289 | static int pxa2xx_ac97_resume(struct device *_dev) |
290 | { | 290 | { |
291 | snd_card_t *card = dev_get_drvdata(_dev); | 291 | snd_card_t *card = dev_get_drvdata(_dev); |
292 | int ret = 0; | 292 | int ret = 0; |
293 | 293 | ||
294 | if (card && level == RESUME_ENABLE) | 294 | if (card) |
295 | ret = pxa2xx_ac97_do_resume(card); | 295 | ret = pxa2xx_ac97_do_resume(card); |
296 | 296 | ||
297 | return ret; | 297 | return ret; |
diff --git a/sound/core/init.c b/sound/core/init.c index c72a79115cca..59202de1d2ce 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -676,8 +676,8 @@ struct snd_generic_device { | |||
676 | #define SND_GENERIC_NAME "snd_generic" | 676 | #define SND_GENERIC_NAME "snd_generic" |
677 | 677 | ||
678 | #ifdef CONFIG_PM | 678 | #ifdef CONFIG_PM |
679 | static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level); | 679 | static int snd_generic_suspend(struct device *dev, pm_message_t state); |
680 | static int snd_generic_resume(struct device *dev, u32 level); | 680 | static int snd_generic_resume(struct device *dev); |
681 | #endif | 681 | #endif |
682 | 682 | ||
683 | /* initialized in sound.c */ | 683 | /* initialized in sound.c */ |
@@ -818,13 +818,10 @@ int snd_card_set_pm_callback(snd_card_t *card, | |||
818 | 818 | ||
819 | #ifdef CONFIG_SND_GENERIC_DRIVER | 819 | #ifdef CONFIG_SND_GENERIC_DRIVER |
820 | /* suspend/resume callbacks for snd_generic platform device */ | 820 | /* suspend/resume callbacks for snd_generic platform device */ |
821 | static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level) | 821 | static int snd_generic_suspend(struct device *dev, pm_message_t state) |
822 | { | 822 | { |
823 | snd_card_t *card; | 823 | snd_card_t *card; |
824 | 824 | ||
825 | if (level != SUSPEND_DISABLE) | ||
826 | return 0; | ||
827 | |||
828 | card = get_snd_generic_card(dev); | 825 | card = get_snd_generic_card(dev); |
829 | if (card->power_state == SNDRV_CTL_POWER_D3hot) | 826 | if (card->power_state == SNDRV_CTL_POWER_D3hot) |
830 | return 0; | 827 | return 0; |
@@ -834,13 +831,10 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level | |||
834 | return 0; | 831 | return 0; |
835 | } | 832 | } |
836 | 833 | ||
837 | static int snd_generic_resume(struct device *dev, u32 level) | 834 | static int snd_generic_resume(struct device *dev) |
838 | { | 835 | { |
839 | snd_card_t *card; | 836 | snd_card_t *card; |
840 | 837 | ||
841 | if (level != RESUME_ENABLE) | ||
842 | return 0; | ||
843 | |||
844 | card = get_snd_generic_card(dev); | 838 | card = get_snd_generic_card(dev); |
845 | if (card->power_state == SNDRV_CTL_POWER_D0) | 839 | if (card->power_state == SNDRV_CTL_POWER_D0) |
846 | return 0; | 840 | return 0; |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 9e76bddb2c0b..b57519a3e3d9 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -231,7 +231,7 @@ int snd_register_device(int type, snd_card_t * card, int dev, snd_minor_t * reg, | |||
231 | devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name); | 231 | devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name); |
232 | if (card) | 232 | if (card) |
233 | device = card->dev; | 233 | device = card->dev; |
234 | class_device_create(sound_class, MKDEV(major, minor), device, "%s", name); | 234 | class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name); |
235 | 235 | ||
236 | up(&sound_mutex); | 236 | up(&sound_mutex); |
237 | return 0; | 237 | return 0; |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 95fa81e26de2..d33bb464f70e 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -567,7 +567,7 @@ static int __init oss_init(void) | |||
567 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor), | 567 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor), |
568 | S_IFCHR | dev_list[i].mode, | 568 | S_IFCHR | dev_list[i].mode, |
569 | "sound/%s", dev_list[i].name); | 569 | "sound/%s", dev_list[i].name); |
570 | class_device_create(sound_class, | 570 | class_device_create(sound_class, NULL, |
571 | MKDEV(SOUND_MAJOR, dev_list[i].minor), | 571 | MKDEV(SOUND_MAJOR, dev_list[i].minor), |
572 | NULL, "%s", dev_list[i].name); | 572 | NULL, "%s", dev_list[i].name); |
573 | 573 | ||
@@ -579,7 +579,7 @@ static int __init oss_init(void) | |||
579 | dev_list[i].minor + (j*0x10)), | 579 | dev_list[i].minor + (j*0x10)), |
580 | S_IFCHR | dev_list[i].mode, | 580 | S_IFCHR | dev_list[i].mode, |
581 | "sound/%s%d", dev_list[i].name, j); | 581 | "sound/%s%d", dev_list[i].name, j); |
582 | class_device_create(sound_class, | 582 | class_device_create(sound_class, NULL, |
583 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), | 583 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), |
584 | NULL, "%s%d", dev_list[i].name, j); | 584 | NULL, "%s%d", dev_list[i].name, j); |
585 | } | 585 | } |
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index f560dd8cdb90..d833349ed518 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c | |||
@@ -197,7 +197,7 @@ snd_harmony_interrupt(int irq, void *dev, struct pt_regs *regs) | |||
197 | spin_unlock(&h->lock); | 197 | spin_unlock(&h->lock); |
198 | 198 | ||
199 | if (dstatus & HARMONY_DSTATUS_PN) { | 199 | if (dstatus & HARMONY_DSTATUS_PN) { |
200 | if (h->psubs) { | 200 | if (h->psubs && h->st.playing) { |
201 | spin_lock(&h->lock); | 201 | spin_lock(&h->lock); |
202 | h->pbuf.buf += h->pbuf.count; /* PAGE_SIZE */ | 202 | h->pbuf.buf += h->pbuf.count; /* PAGE_SIZE */ |
203 | h->pbuf.buf %= h->pbuf.size; /* MAX_BUFS*PAGE_SIZE */ | 203 | h->pbuf.buf %= h->pbuf.size; /* MAX_BUFS*PAGE_SIZE */ |
@@ -216,7 +216,7 @@ snd_harmony_interrupt(int irq, void *dev, struct pt_regs *regs) | |||
216 | } | 216 | } |
217 | 217 | ||
218 | if (dstatus & HARMONY_DSTATUS_RN) { | 218 | if (dstatus & HARMONY_DSTATUS_RN) { |
219 | if (h->csubs) { | 219 | if (h->csubs && h->st.capturing) { |
220 | spin_lock(&h->lock); | 220 | spin_lock(&h->lock); |
221 | h->cbuf.buf += h->cbuf.count; | 221 | h->cbuf.buf += h->cbuf.count; |
222 | h->cbuf.buf %= h->cbuf.size; | 222 | h->cbuf.buf %= h->cbuf.size; |
@@ -316,6 +316,7 @@ snd_harmony_playback_trigger(snd_pcm_substream_t *ss, int cmd) | |||
316 | case SNDRV_PCM_TRIGGER_STOP: | 316 | case SNDRV_PCM_TRIGGER_STOP: |
317 | h->st.playing = 0; | 317 | h->st.playing = 0; |
318 | harmony_mute(h); | 318 | harmony_mute(h); |
319 | harmony_write(h, HARMONY_PNXTADD, h->sdma.addr); | ||
319 | harmony_disable_interrupts(h); | 320 | harmony_disable_interrupts(h); |
320 | break; | 321 | break; |
321 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 322 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
@@ -351,8 +352,9 @@ snd_harmony_capture_trigger(snd_pcm_substream_t *ss, int cmd) | |||
351 | break; | 352 | break; |
352 | case SNDRV_PCM_TRIGGER_STOP: | 353 | case SNDRV_PCM_TRIGGER_STOP: |
353 | h->st.capturing = 0; | 354 | h->st.capturing = 0; |
354 | harmony_mute(h); | 355 | harmony_mute(h); |
355 | harmony_disable_interrupts(h); | 356 | harmony_write(h, HARMONY_RNXTADD, h->gdma.addr); |
357 | harmony_disable_interrupts(h); | ||
356 | break; | 358 | break; |
357 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 359 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
358 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 360 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
@@ -408,7 +410,8 @@ snd_harmony_playback_prepare(snd_pcm_substream_t *ss) | |||
408 | 410 | ||
409 | h->pbuf.size = snd_pcm_lib_buffer_bytes(ss); | 411 | h->pbuf.size = snd_pcm_lib_buffer_bytes(ss); |
410 | h->pbuf.count = snd_pcm_lib_period_bytes(ss); | 412 | h->pbuf.count = snd_pcm_lib_period_bytes(ss); |
411 | h->pbuf.buf = 0; | 413 | if (h->pbuf.buf >= h->pbuf.size) |
414 | h->pbuf.buf = 0; | ||
412 | h->st.playing = 0; | 415 | h->st.playing = 0; |
413 | 416 | ||
414 | h->st.rate = snd_harmony_rate_bits(rt->rate); | 417 | h->st.rate = snd_harmony_rate_bits(rt->rate); |
@@ -437,7 +440,8 @@ snd_harmony_capture_prepare(snd_pcm_substream_t *ss) | |||
437 | 440 | ||
438 | h->cbuf.size = snd_pcm_lib_buffer_bytes(ss); | 441 | h->cbuf.size = snd_pcm_lib_buffer_bytes(ss); |
439 | h->cbuf.count = snd_pcm_lib_period_bytes(ss); | 442 | h->cbuf.count = snd_pcm_lib_period_bytes(ss); |
440 | h->cbuf.buf = 0; | 443 | if (h->cbuf.buf >= h->cbuf.size) |
444 | h->cbuf.buf = 0; | ||
441 | h->st.capturing = 0; | 445 | h->st.capturing = 0; |
442 | 446 | ||
443 | h->st.rate = snd_harmony_rate_bits(rt->rate); | 447 | h->st.rate = snd_harmony_rate_bits(rt->rate); |
@@ -712,13 +716,14 @@ snd_harmony_volume_get(snd_kcontrol_t *kc, | |||
712 | 716 | ||
713 | left = (h->st.gain >> shift_left) & mask; | 717 | left = (h->st.gain >> shift_left) & mask; |
714 | right = (h->st.gain >> shift_right) & mask; | 718 | right = (h->st.gain >> shift_right) & mask; |
715 | |||
716 | if (invert) { | 719 | if (invert) { |
717 | left = mask - left; | 720 | left = mask - left; |
718 | right = mask - right; | 721 | right = mask - right; |
719 | } | 722 | } |
723 | |||
720 | ucontrol->value.integer.value[0] = left; | 724 | ucontrol->value.integer.value[0] = left; |
721 | ucontrol->value.integer.value[1] = right; | 725 | if (shift_left != shift_right) |
726 | ucontrol->value.integer.value[1] = right; | ||
722 | 727 | ||
723 | spin_unlock_irqrestore(&h->mixer_lock, flags); | 728 | spin_unlock_irqrestore(&h->mixer_lock, flags); |
724 | 729 | ||
@@ -738,22 +743,82 @@ snd_harmony_volume_put(snd_kcontrol_t *kc, | |||
738 | int old_gain = h->st.gain; | 743 | int old_gain = h->st.gain; |
739 | unsigned long flags; | 744 | unsigned long flags; |
740 | 745 | ||
746 | spin_lock_irqsave(&h->mixer_lock, flags); | ||
747 | |||
741 | left = ucontrol->value.integer.value[0] & mask; | 748 | left = ucontrol->value.integer.value[0] & mask; |
742 | right = ucontrol->value.integer.value[1] & mask; | 749 | if (invert) |
743 | if (invert) { | ||
744 | left = mask - left; | 750 | left = mask - left; |
745 | right = mask - right; | 751 | h->st.gain &= ~( (mask << shift_left ) ); |
752 | h->st.gain |= (left << shift_left); | ||
753 | |||
754 | if (shift_left != shift_right) { | ||
755 | right = ucontrol->value.integer.value[1] & mask; | ||
756 | if (invert) | ||
757 | right = mask - right; | ||
758 | h->st.gain &= ~( (mask << shift_right) ); | ||
759 | h->st.gain |= (right << shift_right); | ||
746 | } | 760 | } |
761 | |||
762 | snd_harmony_set_new_gain(h); | ||
763 | |||
764 | spin_unlock_irqrestore(&h->mixer_lock, flags); | ||
765 | |||
766 | return h->st.gain != old_gain; | ||
767 | } | ||
768 | |||
769 | static int | ||
770 | snd_harmony_captureroute_info(snd_kcontrol_t *kc, | ||
771 | snd_ctl_elem_info_t *uinfo) | ||
772 | { | ||
773 | static char *texts[2] = { "Line", "Mic" }; | ||
774 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
775 | uinfo->count = 1; | ||
776 | uinfo->value.enumerated.items = 2; | ||
777 | if (uinfo->value.enumerated.item > 1) | ||
778 | uinfo->value.enumerated.item = 1; | ||
779 | strcpy(uinfo->value.enumerated.name, | ||
780 | texts[uinfo->value.enumerated.item]); | ||
781 | return 0; | ||
782 | } | ||
783 | |||
784 | static int | ||
785 | snd_harmony_captureroute_get(snd_kcontrol_t *kc, | ||
786 | snd_ctl_elem_value_t *ucontrol) | ||
787 | { | ||
788 | harmony_t *h = snd_kcontrol_chip(kc); | ||
789 | int value; | ||
790 | unsigned long flags; | ||
791 | |||
792 | spin_lock_irqsave(&h->mixer_lock, flags); | ||
793 | |||
794 | value = (h->st.gain >> HARMONY_GAIN_IS_SHIFT) & 1; | ||
795 | ucontrol->value.enumerated.item[0] = value; | ||
796 | |||
797 | spin_unlock_irqrestore(&h->mixer_lock, flags); | ||
798 | |||
799 | return 0; | ||
800 | } | ||
801 | |||
802 | static int | ||
803 | snd_harmony_captureroute_put(snd_kcontrol_t *kc, | ||
804 | snd_ctl_elem_value_t *ucontrol) | ||
805 | { | ||
806 | harmony_t *h = snd_kcontrol_chip(kc); | ||
807 | int value; | ||
808 | int old_gain = h->st.gain; | ||
809 | unsigned long flags; | ||
747 | 810 | ||
748 | spin_lock_irqsave(&h->mixer_lock, flags); | 811 | spin_lock_irqsave(&h->mixer_lock, flags); |
749 | 812 | ||
750 | h->st.gain &= ~( (mask << shift_right) | (mask << shift_left) ); | 813 | value = ucontrol->value.enumerated.item[0] & 1; |
751 | h->st.gain |= ( (left << shift_left) | (right << shift_right) ); | 814 | h->st.gain &= ~HARMONY_GAIN_IS_MASK; |
815 | h->st.gain |= value << HARMONY_GAIN_IS_SHIFT; | ||
816 | |||
752 | snd_harmony_set_new_gain(h); | 817 | snd_harmony_set_new_gain(h); |
753 | 818 | ||
754 | spin_unlock_irqrestore(&h->mixer_lock, flags); | 819 | spin_unlock_irqrestore(&h->mixer_lock, flags); |
755 | 820 | ||
756 | return (old_gain - h->st.gain); | 821 | return h->st.gain != old_gain; |
757 | } | 822 | } |
758 | 823 | ||
759 | #define HARMONY_CONTROLS (sizeof(snd_harmony_controls)/ \ | 824 | #define HARMONY_CONTROLS (sizeof(snd_harmony_controls)/ \ |
@@ -767,10 +832,25 @@ snd_harmony_volume_put(snd_kcontrol_t *kc, | |||
767 | ((mask) << 16) | ((invert) << 24)) } | 832 | ((mask) << 16) | ((invert) << 24)) } |
768 | 833 | ||
769 | static snd_kcontrol_new_t snd_harmony_controls[] = { | 834 | static snd_kcontrol_new_t snd_harmony_controls[] = { |
770 | HARMONY_VOLUME("Playback Volume", HARMONY_GAIN_LO_SHIFT, | 835 | HARMONY_VOLUME("Master Playback Volume", HARMONY_GAIN_LO_SHIFT, |
771 | HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1), | 836 | HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1), |
772 | HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT, | 837 | HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT, |
773 | HARMONY_GAIN_RI_SHIFT, HARMONY_GAIN_IN, 0), | 838 | HARMONY_GAIN_RI_SHIFT, HARMONY_GAIN_IN, 0), |
839 | HARMONY_VOLUME("Monitor Volume", HARMONY_GAIN_MA_SHIFT, | ||
840 | HARMONY_GAIN_MA_SHIFT, HARMONY_GAIN_MA, 1), | ||
841 | { | ||
842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
843 | .name = "Input Route", | ||
844 | .info = snd_harmony_captureroute_info, | ||
845 | .get = snd_harmony_captureroute_get, | ||
846 | .put = snd_harmony_captureroute_put | ||
847 | }, | ||
848 | HARMONY_VOLUME("Internal Speaker Switch", HARMONY_GAIN_SE_SHIFT, | ||
849 | HARMONY_GAIN_SE_SHIFT, 1, 0), | ||
850 | HARMONY_VOLUME("Line-Out Switch", HARMONY_GAIN_LE_SHIFT, | ||
851 | HARMONY_GAIN_LE_SHIFT, 1, 0), | ||
852 | HARMONY_VOLUME("Headphones Switch", HARMONY_GAIN_HE_SHIFT, | ||
853 | HARMONY_GAIN_HE_SHIFT, 1, 0), | ||
774 | }; | 854 | }; |
775 | 855 | ||
776 | static void __init | 856 | static void __init |
@@ -852,14 +932,14 @@ snd_harmony_create(snd_card_t *card, | |||
852 | memset(&h->pbuf, 0, sizeof(h->pbuf)); | 932 | memset(&h->pbuf, 0, sizeof(h->pbuf)); |
853 | memset(&h->cbuf, 0, sizeof(h->cbuf)); | 933 | memset(&h->cbuf, 0, sizeof(h->cbuf)); |
854 | 934 | ||
855 | h->hpa = padev->hpa; | 935 | h->hpa = padev->hpa.start; |
856 | h->card = card; | 936 | h->card = card; |
857 | h->dev = padev; | 937 | h->dev = padev; |
858 | h->irq = padev->irq; | 938 | h->irq = padev->irq; |
859 | h->iobase = ioremap_nocache(padev->hpa, HARMONY_SIZE); | 939 | h->iobase = ioremap_nocache(padev->hpa.start, HARMONY_SIZE); |
860 | if (h->iobase == NULL) { | 940 | if (h->iobase == NULL) { |
861 | printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n", | 941 | printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n", |
862 | padev->hpa); | 942 | padev->hpa.start); |
863 | err = -EBUSY; | 943 | err = -EBUSY; |
864 | goto free_and_ret; | 944 | goto free_and_ret; |
865 | } | 945 | } |
diff --git a/sound/parisc/harmony.h b/sound/parisc/harmony.h index ef77f9a577d5..526c52389de2 100644 --- a/sound/parisc/harmony.h +++ b/sound/parisc/harmony.h | |||
@@ -61,7 +61,7 @@ typedef struct snd_card_harmony { | |||
61 | #define HARMONY_SIZE 64 | 61 | #define HARMONY_SIZE 64 |
62 | 62 | ||
63 | #define BUF_SIZE PAGE_SIZE | 63 | #define BUF_SIZE PAGE_SIZE |
64 | #define MAX_BUFS 10 | 64 | #define MAX_BUFS 16 |
65 | #define MAX_BUF_SIZE (MAX_BUFS * BUF_SIZE) | 65 | #define MAX_BUF_SIZE (MAX_BUFS * BUF_SIZE) |
66 | 66 | ||
67 | #define PLAYBACK_BUFS MAX_BUFS | 67 | #define PLAYBACK_BUFS MAX_BUFS |
@@ -101,28 +101,31 @@ typedef struct snd_card_harmony { | |||
101 | #define HARMONY_SS_MONO 0x00000000 | 101 | #define HARMONY_SS_MONO 0x00000000 |
102 | #define HARMONY_SS_STEREO 0x00000001 | 102 | #define HARMONY_SS_STEREO 0x00000001 |
103 | 103 | ||
104 | #define HARMONY_GAIN_SILENCE 0x00F00FFF | 104 | #define HARMONY_GAIN_SILENCE 0x01F00FFF |
105 | #define HARMONY_GAIN_DEFAULT 0x0FF00000 | 105 | #define HARMONY_GAIN_DEFAULT 0x01F00FFF |
106 | 106 | ||
107 | #define HARMONY_GAIN_HE_SHIFT 27 | 107 | #define HARMONY_GAIN_HE_SHIFT 27 /* headphones enabled */ |
108 | #define HARMONY_GAIN_HE_MASK (1 << HARMONY_GAIN_HE_SHIFT) | 108 | #define HARMONY_GAIN_HE_MASK (1 << HARMONY_GAIN_HE_SHIFT) |
109 | #define HARMONY_GAIN_LE_SHIFT 26 | 109 | #define HARMONY_GAIN_LE_SHIFT 26 /* line-out enabled */ |
110 | #define HARMONY_GAIN_LE_MASK (1 << HARMONY_GAIN_LE_SHIFT) | 110 | #define HARMONY_GAIN_LE_MASK (1 << HARMONY_GAIN_LE_SHIFT) |
111 | #define HARMONY_GAIN_SE_SHIFT 25 | 111 | #define HARMONY_GAIN_SE_SHIFT 25 /* internal-speaker enabled */ |
112 | #define HARMONY_GAIN_SE_MASK (1 << HARMONY_GAIN_SE_SHIFT) | 112 | #define HARMONY_GAIN_SE_MASK (1 << HARMONY_GAIN_SE_SHIFT) |
113 | #define HARMONY_GAIN_IS_SHIFT 24 | 113 | #define HARMONY_GAIN_IS_SHIFT 24 /* input select - 0 for line, 1 for mic */ |
114 | #define HARMONY_GAIN_IS_MASK (1 << HARMONY_GAIN_IS_SHIFT) | 114 | #define HARMONY_GAIN_IS_MASK (1 << HARMONY_GAIN_IS_SHIFT) |
115 | 115 | ||
116 | /* monitor attenuation */ | ||
116 | #define HARMONY_GAIN_MA 0x0f | 117 | #define HARMONY_GAIN_MA 0x0f |
117 | #define HARMONY_GAIN_MA_SHIFT 20 | 118 | #define HARMONY_GAIN_MA_SHIFT 20 |
118 | #define HARMONY_GAIN_MA_MASK (HARMONY_GAIN_MA << HARMONY_GAIN_MA_SHIFT) | 119 | #define HARMONY_GAIN_MA_MASK (HARMONY_GAIN_MA << HARMONY_GAIN_MA_SHIFT) |
119 | 120 | ||
121 | /* input gain */ | ||
120 | #define HARMONY_GAIN_IN 0x0f | 122 | #define HARMONY_GAIN_IN 0x0f |
121 | #define HARMONY_GAIN_LI_SHIFT 16 | 123 | #define HARMONY_GAIN_LI_SHIFT 16 |
122 | #define HARMONY_GAIN_LI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_LI_SHIFT) | 124 | #define HARMONY_GAIN_LI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_LI_SHIFT) |
123 | #define HARMONY_GAIN_RI_SHIFT 12 | 125 | #define HARMONY_GAIN_RI_SHIFT 12 |
124 | #define HARMONY_GAIN_RI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_RI_SHIFT) | 126 | #define HARMONY_GAIN_RI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_RI_SHIFT) |
125 | 127 | ||
128 | /* output gain (master volume) */ | ||
126 | #define HARMONY_GAIN_OUT 0x3f | 129 | #define HARMONY_GAIN_OUT 0x3f |
127 | #define HARMONY_GAIN_LO_SHIFT 6 | 130 | #define HARMONY_GAIN_LO_SHIFT 6 |
128 | #define HARMONY_GAIN_LO_MASK (HARMONY_GAIN_OUT << HARMONY_GAIN_LO_SHIFT) | 131 | #define HARMONY_GAIN_LO_MASK (HARMONY_GAIN_OUT << HARMONY_GAIN_LO_SHIFT) |
diff --git a/sound/pci/ac97/ac97_bus.c b/sound/pci/ac97/ac97_bus.c index becbc420ba41..ec70fadde7d9 100644 --- a/sound/pci/ac97/ac97_bus.c +++ b/sound/pci/ac97/ac97_bus.c | |||
@@ -31,7 +31,8 @@ static int ac97_bus_suspend(struct device *dev, pm_message_t state) | |||
31 | int ret = 0; | 31 | int ret = 0; |
32 | 32 | ||
33 | if (dev->driver && dev->driver->suspend) | 33 | if (dev->driver && dev->driver->suspend) |
34 | ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN); | 34 | ret = dev->driver->suspend(dev, state); |
35 | |||
35 | return ret; | 36 | return ret; |
36 | } | 37 | } |
37 | 38 | ||
@@ -40,7 +41,8 @@ static int ac97_bus_resume(struct device *dev) | |||
40 | int ret = 0; | 41 | int ret = 0; |
41 | 42 | ||
42 | if (dev->driver && dev->driver->resume) | 43 | if (dev->driver && dev->driver->resume) |
43 | ret = dev->driver->resume(dev, RESUME_POWER_ON); | 44 | ret = dev->driver->resume(dev); |
45 | |||
44 | return ret; | 46 | return ret; |
45 | } | 47 | } |
46 | 48 | ||
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index 31ea7a4c069f..1681ee13efbb 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c | |||
@@ -31,14 +31,14 @@ | |||
31 | #include "pmac.h" | 31 | #include "pmac.h" |
32 | 32 | ||
33 | struct snd_pmac_beep { | 33 | struct snd_pmac_beep { |
34 | int running; /* boolean */ | 34 | int running; /* boolean */ |
35 | int volume; /* mixer volume: 0-100 */ | 35 | int volume; /* mixer volume: 0-100 */ |
36 | int volume_play; /* currently playing volume */ | 36 | int volume_play; /* currently playing volume */ |
37 | int hz; | 37 | int hz; |
38 | int nsamples; | 38 | int nsamples; |
39 | short *buf; /* allocated wave buffer */ | 39 | short *buf; /* allocated wave buffer */ |
40 | dma_addr_t addr; /* physical address of buffer */ | 40 | dma_addr_t addr; /* physical address of buffer */ |
41 | struct input_dev dev; | 41 | struct input_dev *dev; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /* | 44 | /* |
@@ -212,47 +212,55 @@ static snd_kcontrol_new_t snd_pmac_beep_mixer = { | |||
212 | int __init snd_pmac_attach_beep(pmac_t *chip) | 212 | int __init snd_pmac_attach_beep(pmac_t *chip) |
213 | { | 213 | { |
214 | pmac_beep_t *beep; | 214 | pmac_beep_t *beep; |
215 | int err; | 215 | struct input_dev *input_dev; |
216 | void *dmabuf; | ||
217 | int err = -ENOMEM; | ||
216 | 218 | ||
217 | beep = kmalloc(sizeof(*beep), GFP_KERNEL); | 219 | beep = kzalloc(sizeof(*beep), GFP_KERNEL); |
218 | if (! beep) | 220 | dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, |
219 | return -ENOMEM; | 221 | &beep->addr, GFP_KERNEL); |
220 | 222 | input_dev = input_allocate_device(); | |
221 | memset(beep, 0, sizeof(*beep)); | 223 | if (!beep || !dmabuf || !input_dev) |
222 | beep->buf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, | 224 | goto fail; |
223 | &beep->addr, GFP_KERNEL); | ||
224 | |||
225 | beep->dev.evbit[0] = BIT(EV_SND); | ||
226 | beep->dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | ||
227 | beep->dev.event = snd_pmac_beep_event; | ||
228 | beep->dev.private = chip; | ||
229 | 225 | ||
230 | /* FIXME: set more better values */ | 226 | /* FIXME: set more better values */ |
231 | beep->dev.name = "PowerMac Beep"; | 227 | input_dev->name = "PowerMac Beep"; |
232 | beep->dev.phys = "powermac/beep"; | 228 | input_dev->phys = "powermac/beep"; |
233 | beep->dev.id.bustype = BUS_ADB; | 229 | input_dev->id.bustype = BUS_ADB; |
234 | beep->dev.id.vendor = 0x001f; | 230 | input_dev->id.vendor = 0x001f; |
235 | beep->dev.id.product = 0x0001; | 231 | input_dev->id.product = 0x0001; |
236 | beep->dev.id.version = 0x0100; | 232 | input_dev->id.version = 0x0100; |
233 | |||
234 | input_dev->evbit[0] = BIT(EV_SND); | ||
235 | input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | ||
236 | input_dev->event = snd_pmac_beep_event; | ||
237 | input_dev->private = chip; | ||
238 | input_dev->cdev.dev = &chip->pdev->dev; | ||
237 | 239 | ||
240 | beep->dev = input_dev; | ||
241 | beep->buf = dmabuf; | ||
238 | beep->volume = BEEP_VOLUME; | 242 | beep->volume = BEEP_VOLUME; |
239 | beep->running = 0; | 243 | beep->running = 0; |
240 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip))) < 0) { | 244 | |
241 | kfree(beep->buf); | 245 | err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip)); |
242 | kfree(beep); | 246 | if (err < 0) |
243 | return err; | 247 | goto fail; |
244 | } | ||
245 | 248 | ||
246 | chip->beep = beep; | 249 | chip->beep = beep; |
247 | input_register_device(&beep->dev); | 250 | input_register_device(beep->dev); |
248 | 251 | ||
249 | return 0; | 252 | return 0; |
253 | |||
254 | fail: input_free_device(input_dev); | ||
255 | kfree(dmabuf); | ||
256 | kfree(beep); | ||
257 | return err; | ||
250 | } | 258 | } |
251 | 259 | ||
252 | void snd_pmac_detach_beep(pmac_t *chip) | 260 | void snd_pmac_detach_beep(pmac_t *chip) |
253 | { | 261 | { |
254 | if (chip->beep) { | 262 | if (chip->beep) { |
255 | input_unregister_device(&chip->beep->dev); | 263 | input_unregister_device(chip->beep->dev); |
256 | dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, | 264 | dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, |
257 | chip->beep->buf, chip->beep->addr); | 265 | chip->beep->buf, chip->beep->addr); |
258 | kfree(chip->beep); | 266 | kfree(chip->beep); |
diff --git a/sound/sound_core.c b/sound/sound_core.c index 954f994592ab..394b53e20cb8 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -174,7 +174,7 @@ static int sound_insert_unit(struct sound_unit **list, struct file_operations *f | |||
174 | 174 | ||
175 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), | 175 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), |
176 | S_IFCHR | mode, s->name); | 176 | S_IFCHR | mode, s->name); |
177 | class_device_create(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor), | 177 | class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor), |
178 | dev, s->name+6); | 178 | dev, s->name+6); |
179 | return r; | 179 | return r; |
180 | 180 | ||