aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-10-28 16:09:47 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-28 16:09:47 -0400
commit84860bf0644d7c45afe7ddbd30731c3e3c371fae (patch)
treed6c4b98a9c3fd9981e7fcc5d7729c9e01e327767 /sound
parent8caf89157d64f1eedba37113afb4b303b2b3e301 (diff)
parent6fbfddcb52d8d9fa2cd209f5ac2a1c87497d55b5 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/pxa2xx-ac97.c8
-rw-r--r--sound/core/init.c14
-rw-r--r--sound/core/sound.c2
-rw-r--r--sound/oss/soundcard.c4
-rw-r--r--sound/pci/ac97/ac97_bus.c6
-rw-r--r--sound/ppc/beep.c66
-rw-r--r--sound/sound_core.c2
7 files changed, 53 insertions, 49 deletions
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
278static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state, u32 level) 278static 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
289static int pxa2xx_ac97_resume(struct device *_dev, u32 level) 289static 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
679static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level); 679static int snd_generic_suspend(struct device *dev, pm_message_t state);
680static int snd_generic_resume(struct device *dev, u32 level); 680static 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 */
821static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level) 821static 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
837static int snd_generic_resume(struct device *dev, u32 level) 834static 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/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
33struct snd_pmac_beep { 33struct 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 = {
212int __init snd_pmac_attach_beep(pmac_t *chip) 212int __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
252void snd_pmac_detach_beep(pmac_t *chip) 260void 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