18 #include <linux/module.h>
19 #include <linux/input.h>
23 #include <mach/hardware.h>
32 static void ixp4xx_spkr_control(
unsigned int pin,
unsigned int count)
50 spin_unlock_irqrestore(&beep_lock, flags);
53 static int ixp4xx_spkr_event(
struct input_dev *
dev,
unsigned int type,
unsigned int code,
int value)
55 unsigned int pin = (
unsigned int) input_get_drvdata(dev);
56 unsigned int count = 0;
71 if (value > 20 && value < 32767)
74 ixp4xx_spkr_control(pin, count);
92 struct input_dev *input_dev;
95 input_dev = input_allocate_device();
99 input_set_drvdata(input_dev, (
void *) dev->
id);
101 input_dev->name =
"ixp4xx beeper",
102 input_dev->phys =
"ixp4xx/gpio";
104 input_dev->id.vendor = 0x001f;
105 input_dev->id.product = 0x0001;
106 input_dev->id.version = 0x0100;
107 input_dev->dev.parent = &dev->
dev;
111 input_dev->event = ixp4xx_spkr_event;
117 goto err_free_device;
119 err = input_register_device(input_dev);
123 platform_set_drvdata(dev, input_dev);
130 input_free_device(input_dev);
137 struct input_dev *input_dev = platform_get_drvdata(dev);
138 unsigned int pin = (
unsigned int) input_get_drvdata(input_dev);
140 input_unregister_device(input_dev);
141 platform_set_drvdata(dev,
NULL);
145 ixp4xx_spkr_control(pin, 0);
154 struct input_dev *input_dev = platform_get_drvdata(dev);
155 unsigned int pin = (
unsigned int) input_get_drvdata(input_dev);
159 ixp4xx_spkr_control(pin, 0);
164 .name =
"ixp4xx-beeper",
167 .probe = ixp4xx_spkr_probe,
169 .shutdown = ixp4xx_spkr_shutdown,