Release 4.7 drivers/input/serio/ambakmi.c
/*
* linux/drivers/input/serio/ambakmi.c
*
* Copyright (C) 2000-2003 Deep Blue Solutions Ltd.
* Copyright (C) 2002 Russell King.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/module.h>
#include <linux/serio.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/amba/bus.h>
#include <linux/amba/kmi.h>
#include <linux/clk.h>
#include <asm/io.h>
#include <asm/irq.h>
#define KMI_BASE (kmi->base)
struct amba_kmi_port {
struct serio *io;
struct clk *clk;
void __iomem *base;
unsigned int irq;
unsigned int divisor;
unsigned int open;
};
static irqreturn_t amba_kmi_int(int irq, void *dev_id)
{
struct amba_kmi_port *kmi = dev_id;
unsigned int status = readb(KMIIR);
int handled = IRQ_NONE;
while (status & KMIIR_RXINTR) {
serio_interrupt(kmi->io, readb(KMIDATA), 0);
status = readb(KMIIR);
handled = IRQ_HANDLED;
}
return handled;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
vojtech pavlik | vojtech pavlik | 54 | 77.14% | 1 | 33.33% |
russell king | russell king | 16 | 22.86% | 2 | 66.67% |
| Total | 70 | 100.00% | 3 | 100.00% |
static int amba_kmi_write(struct serio *io, unsigned char val)
{
struct amba_kmi_port *kmi = io->port_data;
unsigned int timeleft = 10000; /* timeout in 100ms */
while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && --timeleft)
udelay(10);
if (timeleft)
writeb(val, KMIDATA);
return timeleft ? 0 : SERIO_TIMEOUT;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
vojtech pavlik | vojtech pavlik | 66 | 94.29% | 1 | 25.00% |
russell king | russell king | 2 | 2.86% | 1 | 25.00% |
roel kluin | roel kluin | 1 | 1.43% | 1 | 25.00% |
dmitry torokhov | dmitry torokhov | 1 | 1.43% | 1 | 25.00% |
| Total | 70 | 100.00% | 4 | 100.00% |
static int amba_kmi_open(struct serio *io)
{
struct amba_kmi_port *kmi = io->port_data;
unsigned int divisor;
int ret;
ret = clk_prepare_enable(kmi->clk);
if (ret)
goto out;
divisor = clk_get_rate(kmi->clk) / 8000000 - 1;
writeb(divisor, KMICLKDIV);
writeb(KMICR_EN, KMICR);
ret = request_irq(kmi->irq, amba_kmi_int, IRQF_SHARED, "kmi-pl050",
kmi);
if (ret) {
printk(KERN_ERR "kmi: failed to claim IRQ%d\n", kmi->irq);
writeb(0, KMICR);
goto clk_disable;
}
writeb(KMICR_EN | KMICR_RXINTREN, KMICR);
return 0;
clk_disable:
clk_disable_unprepare(kmi->clk);
out:
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
vojtech pavlik | vojtech pavlik | 84 | 60.43% | 1 | 12.50% |
russell king | russell king | 51 | 36.69% | 4 | 50.00% |
pawel moll | pawel moll | 2 | 1.44% | 1 | 12.50% |
liviu dudau | liviu dudau | 1 | 0.72% | 1 | 12.50% |
dmitry torokhov | dmitry torokhov | 1 | 0.72% | 1 | 12.50% |
| Total | 139 | 100.00% | 8 | 100.00% |
static void amba_kmi_close(struct serio *io)
{
struct amba_kmi_port *kmi = io->port_data;
writeb(0, KMICR);
free_irq(kmi->irq, kmi);
clk_disable_unprepare(kmi->clk);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
vojtech pavlik | vojtech pavlik | 28 | 65.12% | 1 | 20.00% |
russell king | russell king | 13 | 30.23% | 2 | 40.00% |
pawel moll | pawel moll | 1 | 2.33% | 1 | 20.00% |
dmitry torokhov | dmitry torokhov | 1 | 2.33% | 1 | 20.00% |
| Total | 43 | 100.00% | 5 | 100.00% |
static int amba_kmi_probe(struct amba_device *dev,
const struct amba_id *id)
{
struct amba_kmi_port *kmi;
struct serio *io;
int ret;
ret = amba_request_regions(dev, NULL);
if (ret)
return ret;
kmi = kzalloc(sizeof(struct amba_kmi_port), GFP_KERNEL);
io = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!kmi || !io) {
ret = -ENOMEM;
goto out;
}
io->id.type = SERIO_8042;
io->write = amba_kmi_write;
io->open = amba_kmi_open;
io->close = amba_kmi_close;
strlcpy(io->name, dev_name(&dev->dev), sizeof(io->name));
strlcpy(io->phys, dev_name(&dev->dev), sizeof(io->phys));
io->port_data = kmi;
io->dev.parent = &dev->dev;
kmi->io = io;
kmi->base = ioremap(dev->res.start, resource_size(&dev->res));
if (!kmi->base) {
ret = -ENOMEM;
goto out;
}
kmi->clk = clk_get(&dev->dev, "KMIREFCLK");
if (IS_ERR(kmi->clk)) {
ret = PTR_ERR(kmi->clk);
goto unmap;
}
kmi->irq = dev->irq[0];
amba_set_drvdata(dev, kmi);
serio_register_port(kmi->io);
return 0;
unmap:
iounmap(kmi->base);
out:
kfree(kmi);
kfree(io);
amba_release_regions(dev);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
russell king | russell king | 148 | 46.98% | 5 | 35.71% |
dmitry torokhov | dmitry torokhov | 75 | 23.81% | 4 | 28.57% |
vojtech pavlik | vojtech pavlik | 73 | 23.17% | 1 | 7.14% |
kay sievers | kay sievers | 8 | 2.54% | 1 | 7.14% |
linus walleij | linus walleij | 7 | 2.22% | 1 | 7.14% |
yoann padioleau | yoann padioleau | 2 | 0.63% | 1 | 7.14% |
alessandro rubini | alessandro rubini | 2 | 0.63% | 1 | 7.14% |
| Total | 315 | 100.00% | 14 | 100.00% |
static int amba_kmi_remove(struct amba_device *dev)
{
struct amba_kmi_port *kmi = amba_get_drvdata(dev);
serio_unregister_port(kmi->io);
clk_put(kmi->clk);
iounmap(kmi->base);
kfree(kmi);
amba_release_regions(dev);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
russell king | russell king | 35 | 63.64% | 4 | 80.00% |
vojtech pavlik | vojtech pavlik | 20 | 36.36% | 1 | 20.00% |
| Total | 55 | 100.00% | 5 | 100.00% |
static int __maybe_unused amba_kmi_resume(struct device *dev)
{
struct amba_kmi_port *kmi = dev_get_drvdata(dev);
/* kick the serio layer to rescan this port */
serio_reconnect(kmi->io);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
russell king | russell king | 27 | 81.82% | 1 | 25.00% |
ulf hansson | ulf hansson | 3 | 9.09% | 1 | 25.00% |
vojtech pavlik | vojtech pavlik | 2 | 6.06% | 1 | 25.00% |
dmitry torokhov | dmitry torokhov | 1 | 3.03% | 1 | 25.00% |
| Total | 33 | 100.00% | 4 | 100.00% |
static SIMPLE_DEV_PM_OPS(amba_kmi_dev_pm_ops, NULL, amba_kmi_resume);
static struct amba_id amba_kmi_idtable[] = {
{
.id = 0x00041050,
.mask = 0x000fffff,
},
{ 0, 0 }
};
MODULE_DEVICE_TABLE(amba, amba_kmi_idtable);
static struct amba_driver ambakmi_driver = {
.drv = {
.name = "kmi-pl050",
.owner = THIS_MODULE,
.pm = &amba_kmi_dev_pm_ops,
},
.id_table = amba_kmi_idtable,
.probe = amba_kmi_probe,
.remove = amba_kmi_remove,
};
module_amba_driver(ambakmi_driver);
MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
MODULE_DESCRIPTION("AMBA KMI controller driver");
MODULE_LICENSE("GPL");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
vojtech pavlik | vojtech pavlik | 402 | 44.18% | 1 | 3.70% |
russell king | russell king | 371 | 40.77% | 11 | 40.74% |
dmitry torokhov | dmitry torokhov | 85 | 9.34% | 5 | 18.52% |
ulf hansson | ulf hansson | 19 | 2.09% | 1 | 3.70% |
kay sievers | kay sievers | 8 | 0.88% | 1 | 3.70% |
dave martin | dave martin | 7 | 0.77% | 1 | 3.70% |
linus walleij | linus walleij | 7 | 0.77% | 1 | 3.70% |
pawel moll | pawel moll | 3 | 0.33% | 1 | 3.70% |
yoann padioleau | yoann padioleau | 2 | 0.22% | 1 | 3.70% |
alessandro rubini | alessandro rubini | 2 | 0.22% | 1 | 3.70% |
viresh kumar | viresh kumar | 2 | 0.22% | 1 | 3.70% |
roel kluin | roel kluin | 1 | 0.11% | 1 | 3.70% |
liviu dudau | liviu dudau | 1 | 0.11% | 1 | 3.70% |
| Total | 910 | 100.00% | 27 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.