diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-01-03 03:56:59 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-01-03 03:56:59 +0100 |
commit | 645ff1e8e704c4f33ab1fcd3c87f95cb9b6d7144 (patch) | |
tree | 4e4e8940747da96d56ac1e56db1c55fd22a29677 /drivers/input/serio | |
parent | Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost (diff) | |
parent | Merge branch 'next' into for-linus (diff) | |
download | linux-645ff1e8e704c4f33ab1fcd3c87f95cb9b6d7144.tar.xz linux-645ff1e8e704c4f33ab1fcd3c87f95cb9b6d7144.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:
"A tiny pull request this merge window unfortunately, should get more
material in for the next release:
- new driver for Raspberry Pi's touchscreen (firmware interface)
- miscellaneous input driver fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: elan_i2c - add ACPI ID for touchpad in ASUS Aspire F5-573G
Input: atmel_mxt_ts - don't try to free unallocated kernel memory
Input: drv2667 - fix indentation issues
Input: touchscreen - fix coding style issue
Input: add official Raspberry Pi's touchscreen driver
Input: nomadik-ske-keypad - fix a loop timeout test
Input: rotary-encoder - don't log EPROBE_DEFER to kernel log
Input: olpc_apsp - remove set but not used variable 'np'
Input: olpc_apsp - enable the SP clock
Input: olpc_apsp - check FIFO status on open(), not probe()
Input: olpc_apsp - drop CONFIG_OLPC dependency
clk: mmp2: add SP clock
dt-bindings: marvell,mmp2: Add clock id for the SP clock
Input: ad7879 - drop platform data support
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/Kconfig | 1 | ||||
-rw-r--r-- | drivers/input/serio/olpc_apsp.c | 28 |
2 files changed, 20 insertions, 9 deletions
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index d90d9f1098ff..c9c7224d5ae0 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig @@ -254,7 +254,6 @@ config SERIO_APBPS2 config SERIO_OLPC_APSP tristate "OLPC AP-SP input support" - depends on OLPC || COMPILE_TEST help Say Y here if you want support for the keyboard and touchpad included in the OLPC XO-1.75 and XO-4 laptops. diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c index 8e9a4209fcad..b36084710f69 100644 --- a/drivers/input/serio/olpc_apsp.c +++ b/drivers/input/serio/olpc_apsp.c @@ -23,6 +23,7 @@ #include <linux/of.h> #include <linux/slab.h> #include <linux/delay.h> +#include <linux/clk.h> /* * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. @@ -74,6 +75,7 @@ struct olpc_apsp { struct serio *kbio; struct serio *padio; void __iomem *base; + struct clk *clk; int open_count; int irq; }; @@ -145,8 +147,21 @@ static int olpc_apsp_open(struct serio *port) { struct olpc_apsp *priv = port->port_data; unsigned int tmp; + unsigned long l; + int error; if (priv->open_count++ == 0) { + error = clk_prepare_enable(priv->clk); + if (error) + return error; + + l = readl(priv->base + COMMAND_FIFO_STATUS); + if (!(l & CMD_STS_MASK)) { + dev_err(priv->dev, "SP cannot accept commands.\n"); + clk_disable_unprepare(priv->clk); + return -EIO; + } + /* Enable interrupt 0 by clearing its bit */ tmp = readl(priv->base + PJ_INTERRUPT_MASK); writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK); @@ -164,6 +179,8 @@ static void olpc_apsp_close(struct serio *port) /* Disable interrupt 0 */ tmp = readl(priv->base + PJ_INTERRUPT_MASK); writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); + + clk_disable_unprepare(priv->clk); } } @@ -172,15 +189,12 @@ static int olpc_apsp_probe(struct platform_device *pdev) struct serio *kb_serio, *pad_serio; struct olpc_apsp *priv; struct resource *res; - struct device_node *np; - unsigned long l; int error; priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL); if (!priv) return -ENOMEM; - np = pdev->dev.of_node; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(priv->base)) { @@ -192,11 +206,9 @@ static int olpc_apsp_probe(struct platform_device *pdev) if (priv->irq < 0) return priv->irq; - l = readl(priv->base + COMMAND_FIFO_STATUS); - if (!(l & CMD_STS_MASK)) { - dev_err(&pdev->dev, "SP cannot accept commands.\n"); - return -EIO; - } + priv->clk = devm_clk_get(&pdev->dev, "sp"); + if (IS_ERR(priv->clk)) + return PTR_ERR(priv->clk); /* KEYBOARD */ kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |