summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/aaci.c1
-rw-r--r--sound/arm/pxa2xx-ac97.c8
-rw-r--r--sound/core/init.c14
-rw-r--r--sound/core/memalloc.c4
-rw-r--r--sound/core/pcm_native.c9
-rw-r--r--sound/core/seq/instr/ainstr_gf1.c5
-rw-r--r--sound/core/seq/instr/ainstr_iw.c4
-rw-r--r--sound/core/seq/instr/ainstr_simple.c3
-rw-r--r--sound/core/sound.c2
-rw-r--r--sound/oss/ac97_codec.c1
-rw-r--r--sound/oss/au1550_ac97.c1
-rw-r--r--sound/oss/awe_wave.c2
-rw-r--r--sound/oss/cs4232.c6
-rw-r--r--sound/oss/dmasound/dmasound.h2
-rw-r--r--sound/oss/dmasound/dmasound_atari.c4
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c4
-rw-r--r--sound/oss/dmasound/dmasound_paula.c4
-rw-r--r--sound/oss/dmasound/dmasound_q40.c4
-rw-r--r--sound/oss/soundcard.c4
-rw-r--r--sound/oss/wavfront.c38
-rw-r--r--sound/oss/ymfpci.c17
-rw-r--r--sound/parisc/harmony.c116
-rw-r--r--sound/parisc/harmony.h17
-rw-r--r--sound/pci/ac97/ac97_bus.c6
-rw-r--r--sound/pci/bt87x.c11
-rw-r--r--sound/ppc/beep.c66
-rw-r--r--sound/sound_core.c2
-rw-r--r--sound/usb/usbmidi.c2
28 files changed, 233 insertions, 124 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index b2d5db2..559ead6 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -20,6 +20,7 @@
#include <asm/io.h>
#include <asm/irq.h>
+#include <asm/sizes.h>
#include <asm/hardware/amba.h>
#include <sound/driver.h>
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 38b20ef..877bb00 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)
return 0;
}
-static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state, u32 level)
+static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state)
{
snd_card_t *card = dev_get_drvdata(_dev);
int ret = 0;
- if (card && level == SUSPEND_DISABLE)
+ if (card)
ret = pxa2xx_ac97_do_suspend(card, PMSG_SUSPEND);
return ret;
}
-static int pxa2xx_ac97_resume(struct device *_dev, u32 level)
+static int pxa2xx_ac97_resume(struct device *_dev)
{
snd_card_t *card = dev_get_drvdata(_dev);
int ret = 0;
- if (card && level == RESUME_ENABLE)
+ if (card)
ret = pxa2xx_ac97_do_resume(card);
return ret;
diff --git a/sound/core/init.c b/sound/core/init.c
index c72a791..59202de 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -676,8 +676,8 @@ struct snd_generic_device {
#define SND_GENERIC_NAME "snd_generic"
#ifdef CONFIG_PM
-static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
-static int snd_generic_resume(struct device *dev, u32 level);
+static int snd_generic_suspend(struct device *dev, pm_message_t state);
+static int snd_generic_resume(struct device *dev);
#endif
/* initialized in sound.c */
@@ -818,13 +818,10 @@ int snd_card_set_pm_callback(snd_card_t *card,
#ifdef CONFIG_SND_GENERIC_DRIVER
/* suspend/resume callbacks for snd_generic platform device */
-static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level)
+static int snd_generic_suspend(struct device *dev, pm_message_t state)
{
snd_card_t *card;
- if (level != SUSPEND_DISABLE)
- return 0;
-
card = get_snd_generic_card(dev);
if (card->power_state == SNDRV_CTL_POWER_D3hot)
return 0;
@@ -834,13 +831,10 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level
return 0;
}
-static int snd_generic_resume(struct device *dev, u32 level)
+static int snd_generic_resume(struct device *dev)
{
snd_card_t *card;
- if (level != RESUME_ENABLE)
- return 0;
-
card = get_snd_generic_card(dev);
if (card->power_state == SNDRV_CTL_POWER_D0)
return 0;
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index e72cec7..129abab 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -190,7 +190,7 @@ static void unmark_pages(struct page *page, int order)
*
* Returns the pointer of the buffer, or NULL if no enoguh memory.
*/
-void *snd_malloc_pages(size_t size, unsigned int gfp_flags)
+void *snd_malloc_pages(size_t size, gfp_t gfp_flags)
{
int pg;
void *res;
@@ -235,7 +235,7 @@ static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *d
{
int pg;
void *res;
- unsigned int gfp_flags;
+ gfp_t gfp_flags;
snd_assert(size > 0, return NULL);
snd_assert(dma != NULL, return NULL);
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 67abeba..e97b2d1 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2949,8 +2949,7 @@ static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area, uns
return NOPAGE_OOM;
runtime = substream->runtime;
page = virt_to_page(runtime->status);
- if (!PageReserved(page))
- get_page(page);
+ get_page(page);
if (type)
*type = VM_FAULT_MINOR;
return page;
@@ -2992,8 +2991,7 @@ static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area, un
return NOPAGE_OOM;
runtime = substream->runtime;
page = virt_to_page(runtime->control);
- if (!PageReserved(page))
- get_page(page);
+ get_page(page);
if (type)
*type = VM_FAULT_MINOR;
return page;
@@ -3066,8 +3064,7 @@ static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area, unsign
vaddr = runtime->dma_area + offset;
page = virt_to_page(vaddr);
}
- if (!PageReserved(page))
- get_page(page);
+ get_page(page);
if (type)
*type = VM_FAULT_MINOR;
return page;
diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c
index 207c2c5..0e4df88 100644
--- a/sound/core/seq/instr/ainstr_gf1.c
+++ b/sound/core/seq/instr/ainstr_gf1.c
@@ -51,7 +51,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
gf1_wave_t *wp, *prev;
gf1_xwave_t xp;
int err;
- unsigned int gfp_mask;
+ gfp_t gfp_mask;
unsigned int real_size;
gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
@@ -144,7 +144,8 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr,
snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data;
gf1_instrument_t *ip;
gf1_xinstrument_t ix;
- int err, gfp_mask;
+ int err;
+ gfp_t gfp_mask;
if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)
return -EINVAL;
diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c
index 67c24c8..7c19fbb 100644
--- a/sound/core/seq/instr/ainstr_iw.c
+++ b/sound/core/seq/instr/ainstr_iw.c
@@ -129,7 +129,7 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops,
iwffff_wave_t *wp, *prev;
iwffff_xwave_t xp;
int err;
- unsigned int gfp_mask;
+ gfp_t gfp_mask;
unsigned int real_size;
gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
@@ -236,7 +236,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
iwffff_layer_t *lp, *prev_lp;
iwffff_xlayer_t lx;
int err;
- unsigned int gfp_mask;
+ gfp_t gfp_mask;
if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)
return -EINVAL;
diff --git a/sound/core/seq/instr/ainstr_simple.c b/sound/core/seq/instr/ainstr_simple.c
index 6183d21..17ab94e 100644
--- a/sound/core/seq/instr/ainstr_simple.c
+++ b/sound/core/seq/instr/ainstr_simple.c
@@ -57,7 +57,8 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr,
snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data;
simple_instrument_t *ip;
simple_xinstrument_t ix;
- int err, gfp_mask;
+ int err;
+ gfp_t gfp_mask;
unsigned int real_size;
if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 9e76bdd..b57519a 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,
devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name);
if (card)
device = card->dev;
- class_device_create(sound_class, MKDEV(major, minor), device, "%s", name);
+ class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name);
up(&sound_mutex);
return 0;
diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c
index 3ecef46..fd25aca 100644
--- a/sound/oss/ac97_codec.c
+++ b/sound/oss/ac97_codec.c
@@ -55,6 +55,7 @@
#include <linux/pci.h>
#include <linux/ac97_codec.h>
#include <asm/uaccess.h>
+#include <asm/semaphore.h>
#define CODEC_ID_BUFSZ 14
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
index a78e48d..6b46a8a 100644
--- a/sound/oss/au1550_ac97.c
+++ b/sound/oss/au1550_ac97.c
@@ -35,7 +35,6 @@
#undef DEBUG
-#include <linux/version.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/ioport.h>
diff --git a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c
index d2b9bed..b3ea719 100644
--- a/sound/oss/awe_wave.c
+++ b/sound/oss/awe_wave.c
@@ -6062,7 +6062,7 @@ static int awe_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id
io1 = pnp_port_start(dev,0);
io2 = pnp_port_start(dev,1);
io3 = pnp_port_start(dev,2);
- printk(KERN_INFO "AWE32: A PnP Wave Table was detected at IO's %#x,%#x,%#x\n.",
+ printk(KERN_INFO "AWE32: A PnP Wave Table was detected at IO's %#x,%#x,%#x.\n",
io1, io2, io3);
setup_ports(io1, io2, io3);
diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c
index 6ec308f..7c59e2d 100644
--- a/sound/oss/cs4232.c
+++ b/sound/oss/cs4232.c
@@ -195,10 +195,12 @@ static int __init probe_cs4232(struct address_info *hw_config, int isapnp_config
CS_OUT2(0x15, 0x00); /* Select logical device 0 (WSS/SB/FM) */
CS_OUT3(0x47, (base >> 8) & 0xff, base & 0xff); /* WSS base */
- if (check_region(0x388, 4)) /* Not free */
+ if (!request_region(0x388, 4, "FM")) /* Not free */
CS_OUT3(0x48, 0x00, 0x00) /* FM base off */
- else
+ else {
+ release_region(0x388, 4);
CS_OUT3(0x48, 0x03, 0x88); /* FM base 0x388 */
+ }
CS_OUT3(0x42, 0x00, 0x00); /* SB base off */
CS_OUT2(0x22, irq); /* SB+WSS IRQ */
diff --git a/sound/oss/dmasound/dmasound.h b/sound/oss/dmasound/dmasound.h
index 9a2f50f..222014caf 100644
--- a/sound/oss/dmasound/dmasound.h
+++ b/sound/oss/dmasound/dmasound.h
@@ -116,7 +116,7 @@ typedef struct {
const char *name;
const char *name2;
struct module *owner;
- void *(*dma_alloc)(unsigned int, int);
+ void *(*dma_alloc)(unsigned int, gfp_t);
void (*dma_free)(void *, unsigned int);
int (*irqinit)(void);
#ifdef MODULE
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c
index 8daaf87..59eb53f 100644
--- a/sound/oss/dmasound/dmasound_atari.c
+++ b/sound/oss/dmasound/dmasound_atari.c
@@ -114,7 +114,7 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
/*** Low level stuff *********************************************************/
-static void *AtaAlloc(unsigned int size, int flags);
+static void *AtaAlloc(unsigned int size, gfp_t flags);
static void AtaFree(void *, unsigned int size);
static int AtaIrqInit(void);
#ifdef MODULE
@@ -810,7 +810,7 @@ static TRANS transFalconExpanding = {
* Atari (TT/Falcon)
*/
-static void *AtaAlloc(unsigned int size, int flags)
+static void *AtaAlloc(unsigned int size, gfp_t flags)
{
return atari_stram_alloc(size, "dmasound");
}
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index 2ceb46f..b2bf8ba 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -271,7 +271,7 @@ int expand_read_bal; /* Balance factor for expanding reads (not volume!) */
/*** Low level stuff *********************************************************/
-static void *PMacAlloc(unsigned int size, int flags);
+static void *PMacAlloc(unsigned int size, gfp_t flags);
static void PMacFree(void *ptr, unsigned int size);
static int PMacIrqInit(void);
#ifdef MODULE
@@ -614,7 +614,7 @@ tas_init_frame_rates(unsigned int *prop, unsigned int l)
/*
* PCI PowerMac, with AWACS, Screamer, Burgundy, DACA or Tumbler and DBDMA.
*/
-static void *PMacAlloc(unsigned int size, int flags)
+static void *PMacAlloc(unsigned int size, gfp_t flags)
{
return kmalloc(size, flags);
}
diff --git a/sound/oss/dmasound/dmasound_paula.c b/sound/oss/dmasound/dmasound_paula.c
index 558db53..d59f60b 100644
--- a/sound/oss/dmasound/dmasound_paula.c
+++ b/sound/oss/dmasound/dmasound_paula.c
@@ -69,7 +69,7 @@ static int write_sq_block_size_half, write_sq_block_size_quarter;
/*** Low level stuff *********************************************************/
-static void *AmiAlloc(unsigned int size, int flags);
+static void *AmiAlloc(unsigned int size, gfp_t flags);
static void AmiFree(void *obj, unsigned int size);
static int AmiIrqInit(void);
#ifdef MODULE
@@ -317,7 +317,7 @@ static inline void StopDMA(void)
enable_heartbeat();
}
-static void *AmiAlloc(unsigned int size, int flags)
+static void *AmiAlloc(unsigned int size, gfp_t flags)
{
return amiga_chip_alloc((long)size, "dmasound [Paula]");
}
diff --git a/sound/oss/dmasound/dmasound_q40.c b/sound/oss/dmasound/dmasound_q40.c
index 92c25a0..1ddaa62 100644
--- a/sound/oss/dmasound/dmasound_q40.c
+++ b/sound/oss/dmasound/dmasound_q40.c
@@ -36,7 +36,7 @@ static int expand_data; /* Data for expanding */
/*** Low level stuff *********************************************************/
-static void *Q40Alloc(unsigned int size, int flags);
+static void *Q40Alloc(unsigned int size, gfp_t flags);
static void Q40Free(void *, unsigned int);
static int Q40IrqInit(void);
#ifdef MODULE
@@ -358,7 +358,7 @@ static TRANS transQ40Compressing = {
/*** Low level stuff *********************************************************/
-static void *Q40Alloc(unsigned int size, int flags)
+static void *Q40Alloc(unsigned int size, gfp_t flags)
{
return kmalloc(size, flags); /* change to vmalloc */
}
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index 95fa81e..d33bb46 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -567,7 +567,7 @@ static int __init oss_init(void)
devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor),
S_IFCHR | dev_list[i].mode,
"sound/%s", dev_list[i].name);
- class_device_create(sound_class,
+ class_device_create(sound_class, NULL,
MKDEV(SOUND_MAJOR, dev_list[i].minor),
NULL, "%s", dev_list[i].name);
@@ -579,7 +579,7 @@ static int __init oss_init(void)
dev_list[i].minor + (j*0x10)),
S_IFCHR | dev_list[i].mode,
"sound/%s%d", dev_list[i].name, j);
- class_device_create(sound_class,
+ class_device_create(sound_class, NULL,
MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
NULL, "%s%d", dev_list[i].name, j);
}
diff --git a/sound/oss/wavfront.c b/sound/oss/wavfront.c
index b92ba89..b1a4eeb 100644
--- a/sound/oss/wavfront.c
+++ b/sound/oss/wavfront.c
@@ -2434,7 +2434,7 @@ static int __init detect_wavefront (int irq, int io_base)
consumes 16.
*/
- if (check_region (io_base, 16)) {
+ if (!request_region (io_base, 16, "wavfront")) {
printk (KERN_ERR LOGNAME "IO address range 0x%x - 0x%x "
"already in use - ignored\n", dev.base,
dev.base+15);
@@ -2466,10 +2466,13 @@ static int __init detect_wavefront (int irq, int io_base)
} else {
printk (KERN_WARNING LOGNAME "not raw, but no "
"hardware version!\n");
+ release_region (io_base, 16);
return 0;
}
if (!wf_raw) {
+ /* will re-acquire region in install_wavefront() */
+ release_region (io_base, 16);
return 1;
} else {
printk (KERN_INFO LOGNAME
@@ -2489,6 +2492,7 @@ static int __init detect_wavefront (int irq, int io_base)
if (wavefront_hw_reset ()) {
printk (KERN_WARNING LOGNAME "hardware reset failed\n");
+ release_region (io_base, 16);
return 0;
}
@@ -2496,6 +2500,8 @@ static int __init detect_wavefront (int irq, int io_base)
dev.has_fx = (detect_wffx () == 0);
+ /* will re-acquire region in install_wavefront() */
+ release_region (io_base, 16);
return 1;
}
@@ -2804,17 +2810,27 @@ static int __init wavefront_init (int atboot)
}
static int __init install_wavefront (void)
-
{
+ if (!request_region (dev.base+2, 6, "wavefront synth"))
+ return -1;
+
+ if (dev.has_fx) {
+ if (!request_region (dev.base+8, 8, "wavefront fx")) {
+ release_region (dev.base+2, 6);
+ return -1;
+ }
+ }
+
if ((dev.synth_dev = register_sound_synth (&wavefront_fops, -1)) < 0) {
printk (KERN_ERR LOGNAME "cannot register raw synth\n");
- return -1;
+ goto err_out;
}
#if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ
if ((dev.oss_dev = sound_alloc_synthdev()) == -1) {
printk (KERN_ERR LOGNAME "Too many sequencers\n");
- return -1;
+ /* FIXME: leak: should unregister sound synth */
+ goto err_out;
} else {
synth_devs[dev.oss_dev] = &wavefront_operations;
}
@@ -2827,20 +2843,20 @@ static int __init install_wavefront (void)
sound_unload_synthdev (dev.oss_dev);
#endif /* OSS_SUPPORT_SEQ */
- return -1;
+ goto err_out;
}
- request_region (dev.base+2, 6, "wavefront synth");
-
- if (dev.has_fx) {
- request_region (dev.base+8, 8, "wavefront fx");
- }
-
if (wavefront_config_midi ()) {
printk (KERN_WARNING LOGNAME "could not initialize MIDI.\n");
}
return dev.oss_dev;
+
+err_out:
+ release_region (dev.base+2, 6);
+ if (dev.has_fx)
+ release_region (dev.base+8, 8);
+ return -1;
}
static void __exit uninstall_wavefront (void)
diff --git a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c
index 05203ad..8dae59b 100644
--- a/sound/oss/ymfpci.c
+++ b/sound/oss/ymfpci.c
@@ -107,14 +107,15 @@ static LIST_HEAD(ymf_devs);
*/
static struct pci_device_id ymf_id_tbl[] = {
-#define DEV(v, d, data) \
- { PCI_VENDOR_ID_##v, PCI_DEVICE_ID_##v##_##d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)data }
- DEV (YAMAHA, 724, "YMF724"),
- DEV (YAMAHA, 724F, "YMF724F"),
- DEV (YAMAHA, 740, "YMF740"),
- DEV (YAMAHA, 740C, "YMF740C"),
- DEV (YAMAHA, 744, "YMF744"),
- DEV (YAMAHA, 754, "YMF754"),
+#define DEV(dev, data) \
+ { PCI_VENDOR_ID_YAMAHA, dev, PCI_ANY_ID, PCI_ANY_ID, 0, 0, \
+ (unsigned long)data }
+ DEV (PCI_DEVICE_ID_YAMAHA_724, "YMF724"),
+ DEV (PCI_DEVICE_ID_YAMAHA_724F, "YMF724F"),
+ DEV (PCI_DEVICE_ID_YAMAHA_740, "YMF740"),
+ DEV (PCI_DEVICE_ID_YAMAHA_740C, "YMF740C"),
+ DEV (PCI_DEVICE_ID_YAMAHA_744, "YMF744"),
+ DEV (PCI_DEVICE_ID_YAMAHA_754, "YMF754"),
#undef DEV
{ }
};
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index f560dd8..d833349 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)
spin_unlock(&h->lock);
if (dstatus & HARMONY_DSTATUS_PN) {
- if (h->psubs) {
+ if (h->psubs && h->st.playing) {
spin_lock(&h->lock);
h->pbuf.buf += h->pbuf.count; /* PAGE_SIZE */
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)
}
if (dstatus & HARMONY_DSTATUS_RN) {
- if (h->csubs) {
+ if (h->csubs && h->st.capturing) {
spin_lock(&h->lock);
h->cbuf.buf += h->cbuf.count;
h->cbuf.buf %= h->cbuf.size;
@@ -316,6 +316,7 @@ snd_harmony_playback_trigger(snd_pcm_substream_t *ss, int cmd)
case SNDRV_PCM_TRIGGER_STOP:
h->st.playing = 0;
harmony_mute(h);
+ harmony_write(h, HARMONY_PNXTADD, h->sdma.addr);
harmony_disable_interrupts(h);
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
@@ -351,8 +352,9 @@ snd_harmony_capture_trigger(snd_pcm_substream_t *ss, int cmd)
break;
case SNDRV_PCM_TRIGGER_STOP:
h->st.capturing = 0;
- harmony_mute(h);
- harmony_disable_interrupts(h);
+ harmony_mute(h);
+ harmony_write(h, HARMONY_RNXTADD, h->gdma.addr);
+ harmony_disable_interrupts(h);
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
@@ -408,7 +410,8 @@ snd_harmony_playback_prepare(snd_pcm_substream_t *ss)
h->pbuf.size = snd_pcm_lib_buffer_bytes(ss);
h->pbuf.count = snd_pcm_lib_period_bytes(ss);
- h->pbuf.buf = 0;
+ if (h->pbuf.buf >= h->pbuf.size)
+ h->pbuf.buf = 0;
h->st.playing = 0;
h->st.rate = snd_harmony_rate_bits(rt->rate);
@@ -437,7 +440,8 @@ snd_harmony_capture_prepare(snd_pcm_substream_t *ss)
h->cbuf.size = snd_pcm_lib_buffer_bytes(ss);
h->cbuf.count = snd_pcm_lib_period_bytes(ss);
- h->cbuf.buf = 0;
+ if (h->cbuf.buf >= h->cbuf.size)
+ h->cbuf.buf = 0;
h->st.capturing = 0;
h->st.rate = snd_harmony_rate_bits(rt->rate);
@@ -712,13 +716,14 @@ snd_harmony_volume_get(snd_kcontrol_t *kc,
left = (h->st.gain >> shift_left) & mask;
right = (h->st.gain >> shift_right) & mask;
-
if (invert) {
left = mask - left;
right = mask - right;
}
+
ucontrol->value.integer.value[0] = left;
- ucontrol->value.integer.value[1] = right;
+ if (shift_left != shift_right)
+ ucontrol->value.integer.value[1] = right;
spin_unlock_irqrestore(&h->mixer_lock, flags);
@@ -738,22 +743,82 @@ snd_harmony_volume_put(snd_kcontrol_t *kc,
int old_gain = h->st.gain;
unsigned long flags;
+ spin_lock_irqsave(&h->mixer_lock, flags);
+
left = ucontrol->value.integer.value[0] & mask;
- right = ucontrol->value.integer.value[1] & mask;
- if (invert) {
+ if (invert)
left = mask - left;
- right = mask - right;
+ h->st.gain &= ~( (mask << shift_left ) );
+ h->st.gain |= (left << shift_left);
+
+ if (shift_left != shift_right) {
+ right = ucontrol->value.integer.value[1] & mask;
+ if (invert)
+ right = mask - right;
+ h->st.gain &= ~( (mask << shift_right) );
+ h->st.gain |= (right << shift_right);
}
+
+ snd_harmony_set_new_gain(h);
+
+ spin_unlock_irqrestore(&h->mixer_lock, flags);
+
+ return h->st.gain != old_gain;
+}
+
+static int
+snd_harmony_captureroute_info(snd_kcontrol_t *kc,
+ snd_ctl_elem_info_t *uinfo)
+{
+ static char *texts[2] = { "Line", "Mic" };
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+ uinfo->count = 1;
+ uinfo->value.enumerated.items = 2;
+ if (uinfo->value.enumerated.item > 1)
+ uinfo->value.enumerated.item = 1;
+ strcpy(uinfo->value.enumerated.name,
+ texts[uinfo->value.enumerated.item]);
+ return 0;
+}
+
+static int
+snd_harmony_captureroute_get(snd_kcontrol_t *kc,
+ snd_ctl_elem_value_t *ucontrol)
+{
+ harmony_t *h = snd_kcontrol_chip(kc);
+ int value;
+ unsigned long flags;
+
+ spin_lock_irqsave(&h->mixer_lock, flags);
+
+ value = (h->st.gain >> HARMONY_GAIN_IS_SHIFT) & 1;
+ ucontrol->value.enumerated.item[0] = value;
+
+ spin_unlock_irqrestore(&h->mixer_lock, flags);
+
+ return 0;
+}
+
+static int
+snd_harmony_captureroute_put(snd_kcontrol_t *kc,
+ snd_ctl_elem_value_t *ucontrol)
+{
+ harmony_t *h = snd_kcontrol_chip(kc);
+ int value;
+ int old_gain = h->st.gain;
+ unsigned long flags;
spin_lock_irqsave(&h->mixer_lock, flags);
- h->st.gain &= ~( (mask << shift_right) | (mask << shift_left) );
- h->st.gain |= ( (left << shift_left) | (right << shift_right) );
+ value = ucontrol->value.enumerated.item[0] & 1;
+ h->st.gain &= ~HARMONY_GAIN_IS_MASK;
+ h->st.gain |= value << HARMONY_GAIN_IS_SHIFT;
+
snd_harmony_set_new_gain(h);
spin_unlock_irqrestore(&h->mixer_lock, flags);
- return (old_gain - h->st.gain);
+ return h->st.gain != old_gain;
}
#define HARMONY_CONTROLS (sizeof(snd_harmony_controls)/ \
@@ -767,10 +832,25 @@ snd_harmony_volume_put(snd_kcontrol_t *kc,
((mask) << 16) | ((invert) << 24)) }
static snd_kcontrol_new_t snd_harmony_controls[] = {
- HARMONY_VOLUME("Playback Volume", HARMONY_GAIN_LO_SHIFT,
+ HARMONY_VOLUME("Master Playback Volume", HARMONY_GAIN_LO_SHIFT,
HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1),
HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT,
HARMONY_GAIN_RI_SHIFT, HARMONY_GAIN_IN, 0),
+ HARMONY_VOLUME("Monitor Volume", HARMONY_GAIN_MA_SHIFT,
+ HARMONY_GAIN_MA_SHIFT, HARMONY_GAIN_MA, 1),
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Input Route",
+ .info = snd_harmony_captureroute_info,
+ .get = snd_harmony_captureroute_get,
+ .put = snd_harmony_captureroute_put
+ },
+ HARMONY_VOLUME("Internal Speaker Switch", HARMONY_GAIN_SE_SHIFT,
+ HARMONY_GAIN_SE_SHIFT, 1, 0),
+ HARMONY_VOLUME("Line-Out Switch", HARMONY_GAIN_LE_SHIFT,
+ HARMONY_GAIN_LE_SHIFT, 1, 0),
+ HARMONY_VOLUME("Headphones Switch", HARMONY_GAIN_HE_SHIFT,
+ HARMONY_GAIN_HE_SHIFT, 1, 0),
};
static void __init
@@ -852,14 +932,14 @@ snd_harmony_create(snd_card_t *card,
memset(&h->pbuf, 0, sizeof(h->pbuf));
memset(&h->cbuf, 0, sizeof(h->cbuf));
- h->hpa = padev->hpa;
+ h->hpa = padev->hpa.start;
h->card = card;
h->dev = padev;
h->irq = padev->irq;
- h->iobase = ioremap_nocache(padev->hpa, HARMONY_SIZE);
+ h->iobase = ioremap_nocache(padev->hpa.start, HARMONY_SIZE);
if (h->iobase == NULL) {
printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n",
- padev->hpa);
+ padev->hpa.start);
err = -EBUSY;
goto free_and_ret;
}
diff --git a/sound/parisc/harmony.h b/sound/parisc/harmony.h
index ef77f9a..526c523 100644
--- a/sound/parisc/harmony.h
+++ b/sound/parisc/harmony.h
@@ -61,7 +61,7 @@ typedef struct snd_card_harmony {
#define HARMONY_SIZE 64
#define BUF_SIZE PAGE_SIZE
-#define MAX_BUFS 10
+#define MAX_BUFS 16
#define MAX_BUF_SIZE (MAX_BUFS * BUF_SIZE)
#define PLAYBACK_BUFS MAX_BUFS
@@ -101,28 +101,31 @@ typedef struct snd_card_harmony {
#define HARMONY_SS_MONO 0x00000000
#define HARMONY_SS_STEREO 0x00000001
-#define HARMONY_GAIN_SILENCE 0x00F00FFF
-#define HARMONY_GAIN_DEFAULT 0x0FF00000
+#define HARMONY_GAIN_SILENCE 0x01F00FFF
+#define HARMONY_GAIN_DEFAULT 0x01F00FFF
-#define HARMONY_GAIN_HE_SHIFT 27
+#define HARMONY_GAIN_HE_SHIFT 27 /* headphones enabled */
#define HARMONY_GAIN_HE_MASK (1 << HARMONY_GAIN_HE_SHIFT)
-#define HARMONY_GAIN_LE_SHIFT 26
+#define HARMONY_GAIN_LE_SHIFT 26 /* line-out enabled */
#define HARMONY_GAIN_LE_MASK (1 << HARMONY_GAIN_LE_SHIFT)
-#define HARMONY_GAIN_SE_SHIFT 25
+#define HARMONY_GAIN_SE_SHIFT 25 /* internal-speaker enabled */
#define HARMONY_GAIN_SE_MASK (1 << HARMONY_GAIN_SE_SHIFT)
-#define HARMONY_GAIN_IS_SHIFT 24
+#define HARMONY_GAIN_IS_SHIFT 24 /* input select - 0 for line, 1 for mic */
#define HARMONY_GAIN_IS_MASK (1 << HARMONY_GAIN_IS_SHIFT)
+/* monitor attenuation */
#define HARMONY_GAIN_MA 0x0f
#define HARMONY_GAIN_MA_SHIFT 20
#define HARMONY_GAIN_MA_MASK (HARMONY_GAIN_MA << HARMONY_GAIN_MA_SHIFT)
+/* input gain */
#define HARMONY_GAIN_IN 0x0f
#define HARMONY_GAIN_LI_SHIFT 16
#define HARMONY_GAIN_LI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_LI_SHIFT)
#define HARMONY_GAIN_RI_SHIFT 12
#define HARMONY_GAIN_RI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_RI_SHIFT)
+/* output gain (master volume) */
#define HARMONY_GAIN_OUT 0x3f
#define HARMONY_GAIN_LO_SHIFT 6
#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 becbc42..ec70fad 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)
int ret = 0;
if (dev->driver && dev->driver->suspend)
- ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN);
+ ret = dev->driver->suspend(dev, state);
+
return ret;
}
@@ -40,7 +41,8 @@ static int ac97_bus_resume(struct device *dev)
int ret = 0;
if (dev->driver && dev->driver->resume)
- ret = dev->driver->resume(dev, RESUME_POWER_ON);
+ ret = dev->driver->resume(dev);
+
return ret;
}
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 2236c95..01d98ee 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -761,15 +761,18 @@ static int __devinit snd_bt87x_create(snd_card_t *card,
#define BT_DEVICE(chip, subvend, subdev, rate) \
{ .vendor = PCI_VENDOR_ID_BROOKTREE, \
- .device = PCI_DEVICE_ID_BROOKTREE_##chip, \
+ .device = chip, \
.subvendor = subvend, .subdevice = subdev, \
.driver_data = rate }
/* driver_data is the default digital_rate value for that device */
static struct pci_device_id snd_bt87x_ids[] = {
- BT_DEVICE(878, 0x0070, 0x13eb, 32000), /* Hauppauge WinTV series */
- BT_DEVICE(879, 0x0070, 0x13eb, 32000), /* Hauppauge WinTV series */
- BT_DEVICE(878, 0x0070, 0xff01, 44100), /* Viewcast Osprey 200 */
+ /* Hauppauge WinTV series */
+ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0x13eb, 32000),
+ /* Hauppauge WinTV series */
+ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, 0x0070, 0x13eb, 32000),
+ /* Viewcast Osprey 200 */
+ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0xff01, 44100),
{ }
};
MODULE_DEVICE_TABLE(pci, snd_bt87x_ids);
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index 31ea7a4..1681ee1 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -31,14 +31,14 @@
#include "pmac.h"
struct snd_pmac_beep {
- int running; /* boolean */
- int volume; /* mixer volume: 0-100 */
+ int running; /* boolean */
+ int volume; /* mixer volume: 0-100 */
int volume_play; /* currently playing volume */
int hz;
int nsamples;
short *buf; /* allocated wave buffer */
dma_addr_t addr; /* physical address of buffer */
- struct input_dev dev;
+ struct input_dev *dev;
};
/*
@@ -212,47 +212,55 @@ static snd_kcontrol_new_t snd_pmac_beep_mixer = {
int __init snd_pmac_attach_beep(pmac_t *chip)
{
pmac_beep_t *beep;
- int err;
+ struct input_dev *input_dev;
+ void *dmabuf;
+ int err = -ENOMEM;
- beep = kmalloc(sizeof(*beep), GFP_KERNEL);
- if (! beep)
- return -ENOMEM;
-
- memset(beep, 0, sizeof(*beep));
- beep->buf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
- &beep->addr, GFP_KERNEL);
-
- beep->dev.evbit[0] = BIT(EV_SND);
- beep->dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
- beep->dev.event = snd_pmac_beep_event;
- beep->dev.private = chip;
+ beep = kzalloc(sizeof(*beep), GFP_KERNEL);
+ dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
+ &beep->addr, GFP_KERNEL);
+ input_dev = input_allocate_device();
+ if (!beep || !dmabuf || !input_dev)
+ goto fail;
/* FIXME: set more better values */
- beep->dev.name = "PowerMac Beep";
- beep->dev.phys = "powermac/beep";
- beep->dev.id.bustype = BUS_ADB;
- beep->dev.id.vendor = 0x001f;
- beep->dev.id.product = 0x0001;
- beep->dev.id.version = 0x0100;
+ input_dev->name = "PowerMac Beep";
+ input_dev->phys = "powermac/beep";
+ input_dev->id.bustype = BUS_ADB;
+ input_dev->id.vendor = 0x001f;
+ input_dev->id.product = 0x0001;
+ input_dev->id.version = 0x0100;
+
+ input_dev->evbit[0] = BIT(EV_SND);
+ input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
+ input_dev->event = snd_pmac_beep_event;
+ input_dev->private = chip;
+ input_dev->cdev.dev = &chip->pdev->dev;
+ beep->dev = input_dev;
+ beep->buf = dmabuf;
beep->volume = BEEP_VOLUME;
beep->running = 0;
- if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip))) < 0) {
- kfree(beep->buf);
- kfree(beep);
- return err;
- }
+
+ err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip));
+ if (err < 0)
+ goto fail;
chip->beep = beep;
- input_register_device(&beep->dev);
+ input_register_device(beep->dev);
return 0;
+
+ fail: input_free_device(input_dev);
+ kfree(dmabuf);
+ kfree(beep);
+ return err;
}
void snd_pmac_detach_beep(pmac_t *chip)
{
if (chip->beep) {
- input_unregister_device(&chip->beep->dev);
+ input_unregister_device(chip->beep->dev);
dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
chip->beep->buf, chip->beep->addr);
kfree(chip->beep);
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 954f994..394b53e 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
devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor),
S_IFCHR | mode, s->name);
- class_device_create(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor),
+ class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor),
dev, s->name+6);
return r;
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index e0d0365..f1a2e2c 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -163,7 +163,7 @@ static const uint8_t snd_usbmidi_cin_length[] = {
/*
* Submits the URB, with error handling.
*/
-static int snd_usbmidi_submit_urb(struct urb* urb, int flags)
+static int snd_usbmidi_submit_urb(struct urb* urb, gfp_t flags)
{
int err = usb_submit_urb(urb, flags);
if (err < 0 && err != -ENODEV)
OpenPOWER on IntegriCloud