]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/input/misc/pcspkr.c
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / input / misc / pcspkr.c
index 31989dcd922c58a09bd07619e9f6dd7abe5702ae..43aaa5cebd1224f8a39dcac296546c49f73597f2 100644 (file)
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
-#include <asm/8253pit.h>
 #include <asm/io.h>
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
 MODULE_DESCRIPTION("PC Speaker beeper driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:pcspkr");
 
-static DEFINE_SPINLOCK(i8253_beep_lock);
+#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
+/* Use the global PIT lock ! */
+#include <asm/i8253.h>
+#else
+#include <asm/8253pit.h>
+static DEFINE_SPINLOCK(i8253_lock);
+#endif
 
 static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
 {
@@ -43,7 +49,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
        if (value > 20 && value < 32767)
                count = PIT_TICK_RATE / value;
 
-       spin_lock_irqsave(&i8253_beep_lock, flags);
+       spin_lock_irqsave(&i8253_lock, flags);
 
        if (count) {
                /* enable counter 2 */
@@ -58,7 +64,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
                outb(inb_p(0x61) & 0xFC, 0x61);
        }
 
-       spin_unlock_irqrestore(&i8253_beep_lock, flags);
+       spin_unlock_irqrestore(&i8253_lock, flags);
 
        return 0;
 }
@@ -80,8 +86,8 @@ static int __devinit pcspkr_probe(struct platform_device *dev)
        pcspkr_dev->id.version = 0x0100;
        pcspkr_dev->dev.parent = &dev->dev;
 
-       pcspkr_dev->evbit[0] = BIT(EV_SND);
-       pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
+       pcspkr_dev->evbit[0] = BIT_MASK(EV_SND);
+       pcspkr_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
        pcspkr_dev->event = pcspkr_event;
 
        err = input_register_device(pcspkr_dev);