Release 4.11 drivers/input/misc/pcspkr.c
/*
* PC Speaker beeper driver for Linux
*
* Copyright (c) 2002 Vojtech Pavlik
* Copyright (c) 1992 Orest Zborowski
*
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i8253.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/timex.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 int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{
unsigned int count = 0;
unsigned long flags;
if (type != EV_SND)
return -1;
switch (code) {
case SND_BELL: if (value) value = 1000;
case SND_TONE: break;
default: return -1;
}
if (value > 20 && value < 32767)
count = PIT_TICK_RATE / value;
raw_spin_lock_irqsave(&i8253_lock, flags);
if (count) {
/* set command for counter 2, 2 byte write */
outb_p(0xB6, 0x43);
/* select desired HZ */
outb_p(count & 0xff, 0x42);
outb((count >> 8) & 0xff, 0x42);
/* enable counter 2 */
outb_p(inb_p(0x61) | 3, 0x61);
} else {
/* disable counter 2 */
outb(inb_p(0x61) & 0xFC, 0x61);
}
raw_spin_unlock_irqrestore(&i8253_lock, flags);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vojtech Pavlik | 151 | 89.35% | 1 | 20.00% |
Zoltan Devai | 13 | 7.69% | 1 | 20.00% |
Thomas Gleixner | 4 | 2.37% | 2 | 40.00% |
Andrew Morton | 1 | 0.59% | 1 | 20.00% |
Total | 169 | 100.00% | 5 | 100.00% |
static int pcspkr_probe(struct platform_device *dev)
{
struct input_dev *pcspkr_dev;
int err;
pcspkr_dev = input_allocate_device();
if (!pcspkr_dev)
return -ENOMEM;
pcspkr_dev->name = "PC Speaker";
pcspkr_dev->phys = "isa0061/input0";
pcspkr_dev->id.bustype = BUS_ISA;
pcspkr_dev->id.vendor = 0x001f;
pcspkr_dev->id.product = 0x0001;
pcspkr_dev->id.version = 0x0100;
pcspkr_dev->dev.parent = &dev->dev;
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);
if (err) {
input_free_device(pcspkr_dev);
return err;
}
platform_set_drvdata(dev, pcspkr_dev);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Dmitry Torokhov | 96 | 62.34% | 4 | 66.67% |
Vojtech Pavlik | 55 | 35.71% | 1 | 16.67% |
Jiri Slaby | 3 | 1.95% | 1 | 16.67% |
Total | 154 | 100.00% | 6 | 100.00% |
static int pcspkr_remove(struct platform_device *dev)
{
struct input_dev *pcspkr_dev = platform_get_drvdata(dev);
input_unregister_device(pcspkr_dev);
/* turn off the speaker */
pcspkr_event(NULL, EV_SND, SND_BELL, 0);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Dmitry Torokhov | 33 | 80.49% | 1 | 50.00% |
Vojtech Pavlik | 8 | 19.51% | 1 | 50.00% |
Total | 41 | 100.00% | 2 | 100.00% |
static int pcspkr_suspend(struct device *dev)
{
pcspkr_event(NULL, EV_SND, SND_BELL, 0);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Dmitry Torokhov | 24 | 96.00% | 1 | 50.00% |
Frans Pop | 1 | 4.00% | 1 | 50.00% |
Total | 25 | 100.00% | 2 | 100.00% |
static void pcspkr_shutdown(struct platform_device *dev)
{
/* turn off the speaker */
pcspkr_event(NULL, EV_SND, SND_BELL, 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthieu Castet | 12 | 52.17% | 1 | 33.33% |
Dmitry Torokhov | 10 | 43.48% | 1 | 33.33% |
Vojtech Pavlik | 1 | 4.35% | 1 | 33.33% |
Total | 23 | 100.00% | 3 | 100.00% |
static const struct dev_pm_ops pcspkr_pm_ops = {
.suspend = pcspkr_suspend,
};
static struct platform_driver pcspkr_platform_driver = {
.driver = {
.name = "pcspkr",
.pm = &pcspkr_pm_ops,
},
.probe = pcspkr_probe,
.remove = pcspkr_remove,
.shutdown = pcspkr_shutdown,
};
module_platform_driver(pcspkr_platform_driver);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vojtech Pavlik | 247 | 48.34% | 1 | 5.88% |
Dmitry Torokhov | 200 | 39.14% | 4 | 23.53% |
Frans Pop | 17 | 3.33% | 1 | 5.88% |
Zoltan Devai | 13 | 2.54% | 1 | 5.88% |
Matthieu Castet | 12 | 2.35% | 1 | 5.88% |
Kay Sievers | 5 | 0.98% | 1 | 5.88% |
Thomas Gleixner | 4 | 0.78% | 2 | 11.76% |
Arnd Bergmann | 3 | 0.59% | 1 | 5.88% |
Ralf Bächle | 3 | 0.59% | 1 | 5.88% |
Jiri Slaby | 3 | 0.59% | 1 | 5.88% |
JJ Ding | 2 | 0.39% | 1 | 5.88% |
Andrew Morton | 1 | 0.20% | 1 | 5.88% |
Alexey Dobriyan | 1 | 0.20% | 1 | 5.88% |
Total | 511 | 100.00% | 17 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.