15 #include <linux/kernel.h>
16 #include <linux/module.h>
19 #include <linux/input.h>
21 #include <linux/timex.h>
29 static int pcspkr_event(
struct input_dev *
dev,
unsigned int type,
unsigned int code,
int value)
31 unsigned int count = 0;
38 case SND_BELL:
if (value) value = 1000;
43 if (value > 20 && value < 32767)
52 outb_p(count & 0xff, 0x42);
53 outb((count >> 8) & 0xff, 0x42);
68 struct input_dev *pcspkr_dev;
71 pcspkr_dev = input_allocate_device();
75 pcspkr_dev->name =
"PC Speaker";
76 pcspkr_dev->phys =
"isa0061/input0";
77 pcspkr_dev->id.bustype =
BUS_ISA;
78 pcspkr_dev->id.vendor = 0x001f;
79 pcspkr_dev->id.product = 0x0001;
80 pcspkr_dev->id.version = 0x0100;
81 pcspkr_dev->dev.parent = &dev->
dev;
85 pcspkr_dev->event = pcspkr_event;
87 err = input_register_device(pcspkr_dev);
89 input_free_device(pcspkr_dev);
93 platform_set_drvdata(dev, pcspkr_dev);
100 struct input_dev *pcspkr_dev = platform_get_drvdata(dev);
102 input_unregister_device(pcspkr_dev);
103 platform_set_drvdata(dev,
NULL);
110 static int pcspkr_suspend(
struct device *dev)
123 static const struct dev_pm_ops pcspkr_pm_ops = {
124 .suspend = pcspkr_suspend,
131 .pm = &pcspkr_pm_ops,
133 .probe = pcspkr_probe,
135 .shutdown = pcspkr_shutdown,