* [PATCH 2/2] Input: wacom: Add support for three new ISDv4 sensors
From: Jason Gerecke @ 2014-05-10 1:30 UTC (permalink / raw)
To: linux-input, dmitry.torokhov, pingc; +Cc: Jason Gerecke
In-Reply-To: <1399685417-2063-1-git-send-email-killertofu@gmail.com>
This patch adds support for the 0x4004, 0x5000, and 0x5002 sensors found
on what should be the Motion R12, Fujitsu Q704, and Fujitsu T904. These
tablets use a new report ID (3) for their touch packets and a slightly
different HID descriptor format, but are otherwise largely identical in
protocol to the "MTTPC" tablets.
Note:
* The R12 uses its 0x4004 sensor for touch input only. A pen interface
is not present in its HID descriptor, though its possible a 0x4004
may be used for pen input by other tablet PCs in the future.
* The 0x5002 sensor appears to use a new report ID (8) for its pen
packets. The other sensors continue to use the traditional report
ID (2).
Signed-off-by: Jason Gerecke <killertofu@gmail.com>
---
drivers/input/tablet/wacom_sys.c | 19 +++++++++++++++++++
drivers/input/tablet/wacom_wac.c | 20 +++++++++++++++++++-
drivers/input/tablet/wacom_wac.h | 3 +++
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index b16ebef..0056a6d 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -364,6 +364,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
break;
case MTTPC:
+ case MTTPC_B:
features->pktlen = WACOM_PKGLEN_MTTPC;
break;
@@ -395,6 +396,16 @@ static int wacom_parse_hid(struct usb_interface *intf,
i += 12;
break;
+ case MTTPC_B:
+ features->x_max =
+ get_unaligned_le16(&report[i + 3]);
+ features->x_phy =
+ get_unaligned_le16(&report[i + 6]);
+ features->unit = report[i - 5];
+ features->unitExpo = report[i - 3];
+ i += 9;
+ break;
+
default:
features->x_max =
get_unaligned_le16(&report[i + 3]);
@@ -447,6 +458,14 @@ static int wacom_parse_hid(struct usb_interface *intf,
i += 12;
break;
+ case MTTPC_B:
+ features->y_max =
+ get_unaligned_le16(&report[i + 3]);
+ features->y_phy =
+ get_unaligned_le16(&report[i + 6]);
+ i += 9;
+ break;
+
default:
features->y_max =
features->x_max;
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index e4566c3..12da87e 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1022,7 +1022,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
int x_offset = 0;
/* MTTPC does not support Height and Width */
- if (wacom->features.type == MTTPC)
+ if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
x_offset = -4;
/*
@@ -1179,6 +1179,9 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
case WACOM_PKGLEN_TPC2FG:
return wacom_tpc_mt_touch(wacom);
+ case WACOM_PKGLEN_PENABLED:
+ return wacom_tpc_pen(wacom);
+
default:
switch (data[0]) {
case WACOM_REPORT_TPC1FG:
@@ -1188,6 +1191,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
return wacom_tpc_single_touch(wacom, len);
case WACOM_REPORT_TPCMT:
+ case WACOM_REPORT_TPCMT2:
return wacom_mt_touch(wacom);
case WACOM_REPORT_PENABLED:
@@ -1530,6 +1534,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
case TABLETPC2FG:
case MTSCREEN:
case MTTPC:
+ case MTTPC_B:
sync = wacom_tpc_irq(wacom_wac, len);
break;
@@ -1871,6 +1876,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case MTSCREEN:
case MTTPC:
+ case MTTPC_B:
case TABLETPC2FG:
if (features->device_type == BTN_TOOL_FINGER) {
unsigned int flags = INPUT_MT_DIRECT;
@@ -2308,6 +2314,15 @@ static const struct wacom_features wacom_features_0x116 =
static const struct wacom_features wacom_features_0x4001 =
{ "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x4004 =
+ { "Wacom ISDv4 4004", WACOM_PKGLEN_MTTPC, 11060, 6220, 255,
+ 0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5000 =
+ { "Wacom ISDv4 5000", WACOM_PKGLEN_MTTPC, 27848, 15752, 1023,
+ 0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5002 =
+ { "Wacom ISDv4 5002", WACOM_PKGLEN_MTTPC, 29576, 16724, 1023,
+ 0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0x47 =
{ "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2530,6 +2545,9 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },
{ USB_DEVICE_DETAILED(0x317, USB_CLASS_HID, 0, 0) },
{ USB_DEVICE_WACOM(0x4001) },
+ { USB_DEVICE_WACOM(0x4004) },
+ { USB_DEVICE_WACOM(0x5000) },
+ { USB_DEVICE_WACOM(0x5002) },
{ USB_DEVICE_WACOM(0x47) },
{ USB_DEVICE_WACOM(0xF4) },
{ USB_DEVICE_WACOM(0xF8) },
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index adf73cb..84013a7 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -31,6 +31,7 @@
#define WACOM_PKGLEN_MTOUCH 62
#define WACOM_PKGLEN_MTTPC 40
#define WACOM_PKGLEN_DTUS 68
+#define WACOM_PKGLEN_PENABLED 8
/* wacom data size per MT contact */
#define WACOM_BYTES_PER_MT_PACKET 11
@@ -53,6 +54,7 @@
#define WACOM_REPORT_TPC1FG 6
#define WACOM_REPORT_TPC2FG 13
#define WACOM_REPORT_TPCMT 13
+#define WACOM_REPORT_TPCMT2 3
#define WACOM_REPORT_TPCHID 15
#define WACOM_REPORT_TPCST 16
#define WACOM_REPORT_DTUS 17
@@ -106,6 +108,7 @@ enum {
TABLETPC2FG,
MTSCREEN,
MTTPC,
+ MTTPC_B,
MAX_TYPE
};
--
1.9.2
^ permalink raw reply related
* [PATCH resend 0/2] input: Add new sun4i-ts driver for Allwinner sunxi SoCs
From: Hans de Goede @ 2014-05-10 10:47 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Hi Dmitry,
I already send this patch a while ago, and it got only positive feedback,
despite this it has not been applied, hence this resend.
Note the second patch which adds hwmon functionality has been reviewed by
the hwon subsystem maintainer, and the sun?i*.dts changes to enable this
have already been upstreamed.
Thanks & Regards,
Hans
^ permalink raw reply
* [PATCH v3 1/2] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller
From: Hans de Goede @ 2014-05-10 10:47 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
In-Reply-To: <1399718826-16215-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Note the sun4i-ts controller is capable of detecting a second touch, but when
a second touch is present then the accuracy becomes so bad the reported touch
location is not useable.
The original android driver contains some complicated heuristics using the
aprox. distance between the 2 touches to see if the user is making a pinch
open / close movement, and then reports emulated multi-touch events around
the last touch coordinate (as the dual-touch coordinates are worthless).
These kinds of heuristics are just asking for trouble (and don't belong
in the kernel). So this driver offers straight forward, reliable single
touch functionality only.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
.../bindings/input/touchscreen/sun4i.txt | 15 ++
drivers/input/touchscreen/Kconfig | 10 +
drivers/input/touchscreen/Makefile | 1 +
drivers/input/touchscreen/sun4i-ts.c | 262 +++++++++++++++++++++
4 files changed, 288 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
create mode 100644 drivers/input/touchscreen/sun4i-ts.c
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
new file mode 100644
index 0000000..e45927e
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -0,0 +1,15 @@
+sun4i resistive touchscreen controller
+--------------------------------------
+
+Required properties:
+ - compatible: "allwinner,sun4i-ts"
+ - reg: mmio address range of the chip
+ - interrupts: interrupt to which the chip is connected
+
+Example:
+
+ rtp: rtp@01c25000 {
+ compatible = "allwinner,sun4i-ts";
+ reg = <0x01c25000 0x100>;
+ interrupts = <29>;
+ };
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 68edc9d..b8366cb 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -897,6 +897,16 @@ config TOUCHSCREEN_STMPE
To compile this driver as a module, choose M here: the
module will be called stmpe-ts.
+config TOUCHSCREEN_SUN4I
+ tristate "Allwinner sun4i resistive touchscreen controller support"
+ depends on ARCH_SUNXI
+ help
+ This selects support for the resistive touchscreen controller
+ found on Allwinner sunxi SoCs.
+
+ To compile this driver as a module, choose M here: the
+ module will be called sun4i-ts.
+
config TOUCHSCREEN_SUR40
tristate "Samsung SUR40 (Surface 2.0/PixelSense) touchscreen"
depends on USB
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 4bc954b..71a9755 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o
obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o
obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o
+obj-$(CONFIG_TOUCHSCREEN_SUN4I) += sun4i-ts.o
obj-$(CONFIG_TOUCHSCREEN_SUR40) += sur40.o
obj-$(CONFIG_TOUCHSCREEN_TI_AM335X_TSC) += ti_am335x_tsc.o
obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
new file mode 100644
index 0000000..5945219
--- /dev/null
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -0,0 +1,262 @@
+/*
+ * Allwinner sunxi resistive touchscreen controller driver
+ *
+ * Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * The sun4i-ts controller is capable of detecting a second touch, but when a
+ * second touch is present then the accuracy becomes so bad the reported touch
+ * location is not useable.
+ *
+ * The original android driver contains some complicated heuristics using the
+ * aprox. distance between the 2 touches to see if the user is making a pinch
+ * open / close movement, and then reports emulated multi-touch events around
+ * the last touch coordinate (as the dual-touch coordinates are worthless).
+ *
+ * These kinds of heuristics are just asking for trouble (and don't belong
+ * in the kernel). So this driver offers straight forward, reliable single
+ * touch functionality only.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#define TP_CTRL0 0x00
+#define TP_CTRL1 0x04
+#define TP_CTRL2 0x08
+#define TP_CTRL3 0x0c
+#define TP_INT_FIFOC 0x10
+#define TP_INT_FIFOS 0x14
+#define TP_TPR 0x18
+#define TP_CDAT 0x1c
+#define TEMP_DATA 0x20
+#define TP_DATA 0x24
+
+/* TP_CTRL0 bits */
+#define ADC_FIRST_DLY(x) ((x) << 24) /* 8 bits */
+#define ADC_FIRST_DLY_MODE(x) ((x) << 23)
+#define ADC_CLK_SEL(x) ((x) << 22)
+#define ADC_CLK_DIV(x) ((x) << 20) /* 3 bits */
+#define FS_DIV(x) ((x) << 16) /* 4 bits */
+#define T_ACQ(x) ((x) << 0) /* 16 bits */
+
+/* TP_CTRL1 bits */
+#define STYLUS_UP_DEBOUN(x) ((x) << 12) /* 8 bits */
+#define STYLUS_UP_DEBOUN_EN(x) ((x) << 9)
+#define TOUCH_PAN_CALI_EN(x) ((x) << 6)
+#define TP_DUAL_EN(x) ((x) << 5)
+#define TP_MODE_EN(x) ((x) << 4)
+#define TP_ADC_SELECT(x) ((x) << 3)
+#define ADC_CHAN_SELECT(x) ((x) << 0) /* 3 bits */
+
+/* TP_CTRL2 bits */
+#define TP_SENSITIVE_ADJUST(x) ((x) << 28) /* 4 bits */
+#define TP_MODE_SELECT(x) ((x) << 26) /* 2 bits */
+#define PRE_MEA_EN(x) ((x) << 24)
+#define PRE_MEA_THRE_CNT(x) ((x) << 0) /* 24 bits */
+
+/* TP_CTRL3 bits */
+#define FILTER_EN(x) ((x) << 2)
+#define FILTER_TYPE(x) ((x) << 0) /* 2 bits */
+
+/* TP_INT_FIFOC irq and fifo mask / control bits */
+#define TEMP_IRQ_EN(x) ((x) << 18)
+#define OVERRUN_IRQ_EN(x) ((x) << 17)
+#define DATA_IRQ_EN(x) ((x) << 16)
+#define TP_DATA_XY_CHANGE(x) ((x) << 13)
+#define FIFO_TRIG(x) ((x) << 8) /* 5 bits */
+#define DATA_DRQ_EN(x) ((x) << 7)
+#define FIFO_FLUSH(x) ((x) << 4)
+#define TP_UP_IRQ_EN(x) ((x) << 1)
+#define TP_DOWN_IRQ_EN(x) ((x) << 0)
+
+/* TP_INT_FIFOS irq and fifo status bits */
+#define TEMP_DATA_PENDING BIT(18)
+#define FIFO_OVERRUN_PENDING BIT(17)
+#define FIFO_DATA_PENDING BIT(16)
+#define TP_IDLE_FLG BIT(2)
+#define TP_UP_PENDING BIT(1)
+#define TP_DOWN_PENDING BIT(0)
+
+/* TP_TPR bits */
+#define TEMP_ENABLE(x) ((x) << 16)
+#define TEMP_PERIOD(x) ((x) << 0) /* t = x * 256 * 16 / clkin */
+
+struct sun4i_ts_data {
+ struct device *dev;
+ struct input_dev *input;
+ void __iomem *base;
+ unsigned int irq;
+ bool ignore_fifo_data;
+};
+
+static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
+{
+ struct sun4i_ts_data *ts = dev_id;
+ u32 reg_val, x, y;
+
+ reg_val = readl(ts->base + TP_INT_FIFOS);
+
+ if (reg_val & FIFO_DATA_PENDING) {
+ x = readl(ts->base + TP_DATA);
+ y = readl(ts->base + TP_DATA);
+ /* The 1st location reported after an up event is unreliable */
+ if (!ts->ignore_fifo_data) {
+ input_report_abs(ts->input, ABS_X, x);
+ input_report_abs(ts->input, ABS_Y, y);
+ /*
+ * The hardware has a separate down status bit, but
+ * that gets set before we get the first location,
+ * resulting in reporting a click on the old location.
+ */
+ input_report_key(ts->input, BTN_TOUCH, 1);
+ input_sync(ts->input);
+ } else {
+ ts->ignore_fifo_data = false;
+ }
+ }
+
+ if (reg_val & TP_UP_PENDING) {
+ ts->ignore_fifo_data = true;
+ input_report_key(ts->input, BTN_TOUCH, 0);
+ input_sync(ts->input);
+ }
+
+ writel(reg_val, ts->base + TP_INT_FIFOS);
+
+ return IRQ_HANDLED;
+}
+
+static int sun4i_ts_open(struct input_dev *dev)
+{
+ struct sun4i_ts_data *ts = input_get_drvdata(dev);
+
+ /* Flush, set trig level to 1, enable data and up irqs */
+ writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | TP_UP_IRQ_EN(1),
+ ts->base + TP_INT_FIFOC);
+
+ return 0;
+}
+
+static void sun4i_ts_close(struct input_dev *dev)
+{
+ struct sun4i_ts_data *ts = input_get_drvdata(dev);
+
+ /* Deactivate all IRQs */
+ writel(0, ts->base + TP_INT_FIFOC);
+}
+
+static int sun4i_ts_probe(struct platform_device *pdev)
+{
+ struct sun4i_ts_data *ts;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
+ if (!ts)
+ return -ENOMEM;
+
+ ts->dev = dev;
+ ts->ignore_fifo_data = true;
+
+ ts->input = devm_input_allocate_device(dev);
+ if (!ts->input)
+ return -ENOMEM;
+
+ ts->input->name = pdev->name;
+ ts->input->phys = "sun4i_ts/input0";
+ ts->input->open = sun4i_ts_open;
+ ts->input->close = sun4i_ts_close;
+ ts->input->id.bustype = BUS_HOST;
+ ts->input->id.vendor = 0x0001;
+ ts->input->id.product = 0x0001;
+ ts->input->id.version = 0x0100;
+ ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS);
+ set_bit(BTN_TOUCH, ts->input->keybit);
+ input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0);
+ input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0);
+ input_set_drvdata(ts->input, ts);
+
+ ts->base = devm_ioremap_resource(dev,
+ platform_get_resource(pdev, IORESOURCE_MEM, 0));
+ if (IS_ERR(ts->base))
+ return PTR_ERR(ts->base);
+
+ ts->irq = platform_get_irq(pdev, 0);
+ ret = devm_request_irq(dev, ts->irq, sun4i_ts_irq, 0, "sun4i-ts", ts);
+ if (ret)
+ return ret;
+
+ /*
+ * Select HOSC clk, clkin = clk / 6, adc samplefreq = clkin / 8192,
+ * t_acq = clkin / (16 * 64)
+ */
+ writel(ADC_CLK_SEL(0) | ADC_CLK_DIV(2) | FS_DIV(7) | T_ACQ(63),
+ ts->base + TP_CTRL0);
+
+ /*
+ * sensitive_adjust = 15 : max, which is not all that sensitive,
+ * tp_mode = 0 : only x and y coordinates, as we don't use dual touch
+ */
+ writel(TP_SENSITIVE_ADJUST(15) | TP_MODE_SELECT(0),
+ ts->base + TP_CTRL2);
+
+ /* Enable median filter, type 1 : 5/3 */
+ writel(FILTER_EN(1) | FILTER_TYPE(1), ts->base + TP_CTRL3);
+
+ /* Enable temperature measurement, period 1953 (2 seconds) */
+ writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR);
+
+ /*
+ * Set stylus up debounce to aprox 10 ms, enable debounce, and
+ * finally enable tp mode.
+ */
+ writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1),
+ ts->base + TP_CTRL1);
+
+ ret = input_register_device(ts->input);
+ if (ret)
+ return ret;
+
+ platform_set_drvdata(pdev, ts);
+ return 0;
+}
+
+static const struct of_device_id sun4i_ts_of_match[] = {
+ { .compatible = "allwinner,sun4i-ts", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sun4i_ts_of_match);
+
+static struct platform_driver sun4i_ts_driver = {
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "sun4i-ts",
+ .of_match_table = of_match_ptr(sun4i_ts_of_match),
+ },
+ .probe = sun4i_ts_probe,
+};
+
+module_platform_driver(sun4i_ts_driver);
+
+MODULE_DESCRIPTION("Allwinner sun4i resistive touchscreen controller driver");
+MODULE_AUTHOR("Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>");
+MODULE_LICENSE("GPL");
--
1.9.0
^ permalink raw reply related
* [PATCH v3 2/2] input: sun4i-ts: Add support for temperature sensor
From: Hans de Goede @ 2014-05-10 10:47 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
In-Reply-To: <1399718826-16215-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
The sun4i resisitive touchscreen controller also comes with a built-in
temperature sensor. This commit adds support for it.
This commit also introduces a new "ts-attached" device-tree property,
when this is not set, the input part of the driver won't register. This way
the internal temperature sensor can be used to measure the SoC temperature
independent of there actually being a touchscreen attached to the controller.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
---
.../bindings/input/touchscreen/sun4i.txt | 5 +
drivers/input/touchscreen/sun4i-ts.c | 140 ++++++++++++++++-----
2 files changed, 114 insertions(+), 31 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
index e45927e..6bac67b 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -6,10 +6,15 @@ Required properties:
- reg: mmio address range of the chip
- interrupts: interrupt to which the chip is connected
+Optional properties:
+ - allwinner,ts-attached: boolean indicating that an actual touchscreen is
+ attached to the controller
+
Example:
rtp: rtp@01c25000 {
compatible = "allwinner,sun4i-ts";
reg = <0x01c25000 0x100>;
interrupts = <29>;
+ allwinner,ts-attached;
};
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index 5945219..16cbb01 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -3,6 +3,9 @@
*
* Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
*
+ * The hwmon parts are based on work by Corentin LABBE which is:
+ * Copyright (C) 2013 Corentin LABBE <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
+ *
* 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
@@ -30,6 +33,7 @@
*/
#include <linux/err.h>
+#include <linux/hwmon.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
@@ -106,14 +110,12 @@ struct sun4i_ts_data {
void __iomem *base;
unsigned int irq;
bool ignore_fifo_data;
+ int temp_data;
};
-static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
+static void sun4i_ts_irq_handle_input(struct sun4i_ts_data *ts, u32 reg_val)
{
- struct sun4i_ts_data *ts = dev_id;
- u32 reg_val, x, y;
-
- reg_val = readl(ts->base + TP_INT_FIFOS);
+ u32 x, y;
if (reg_val & FIFO_DATA_PENDING) {
x = readl(ts->base + TP_DATA);
@@ -139,6 +141,20 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
input_report_key(ts->input, BTN_TOUCH, 0);
input_sync(ts->input);
}
+}
+
+static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
+{
+ struct sun4i_ts_data *ts = dev_id;
+ u32 reg_val;
+
+ reg_val = readl(ts->base + TP_INT_FIFOS);
+
+ if (reg_val & TEMP_DATA_PENDING)
+ ts->temp_data = readl(ts->base + TEMP_DATA);
+
+ if (ts->input)
+ sun4i_ts_irq_handle_input(ts, reg_val);
writel(reg_val, ts->base + TP_INT_FIFOS);
@@ -149,9 +165,9 @@ static int sun4i_ts_open(struct input_dev *dev)
{
struct sun4i_ts_data *ts = input_get_drvdata(dev);
- /* Flush, set trig level to 1, enable data and up irqs */
- writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | TP_UP_IRQ_EN(1),
- ts->base + TP_INT_FIFOC);
+ /* Flush, set trig level to 1, enable temp, data and up irqs */
+ writel(TEMP_IRQ_EN(1) | DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) |
+ TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
return 0;
}
@@ -160,15 +176,48 @@ static void sun4i_ts_close(struct input_dev *dev)
{
struct sun4i_ts_data *ts = input_get_drvdata(dev);
- /* Deactivate all IRQs */
- writel(0, ts->base + TP_INT_FIFOC);
+ /* Deactivate all input IRQs */
+ writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
+}
+
+static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
+ char *buf)
+{
+ struct sun4i_ts_data *ts = dev_get_drvdata(dev);
+
+ /* No temp_data until the first irq */
+ if (ts->temp_data == -1)
+ return -EAGAIN;
+
+ return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100);
+}
+
+static ssize_t show_temp_label(struct device *dev,
+ struct device_attribute *devattr, char *buf)
+{
+ return sprintf(buf, "SoC temperature\n");
}
+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
+static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL);
+
+static struct attribute *sun4i_ts_attrs[] = {
+ &dev_attr_temp1_input.attr,
+ &dev_attr_temp1_label.attr,
+ NULL
+};
+ATTRIBUTE_GROUPS(sun4i_ts);
+
static int sun4i_ts_probe(struct platform_device *pdev)
{
struct sun4i_ts_data *ts;
struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
+ struct device *hwmon;
int ret;
+ bool ts_attached;
+
+ ts_attached = of_property_read_bool(np, "allwinner,ts-attached");
ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
if (!ts)
@@ -176,24 +225,27 @@ static int sun4i_ts_probe(struct platform_device *pdev)
ts->dev = dev;
ts->ignore_fifo_data = true;
-
- ts->input = devm_input_allocate_device(dev);
- if (!ts->input)
- return -ENOMEM;
-
- ts->input->name = pdev->name;
- ts->input->phys = "sun4i_ts/input0";
- ts->input->open = sun4i_ts_open;
- ts->input->close = sun4i_ts_close;
- ts->input->id.bustype = BUS_HOST;
- ts->input->id.vendor = 0x0001;
- ts->input->id.product = 0x0001;
- ts->input->id.version = 0x0100;
- ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS);
- set_bit(BTN_TOUCH, ts->input->keybit);
- input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0);
- input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0);
- input_set_drvdata(ts->input, ts);
+ ts->temp_data = -1;
+
+ if (ts_attached) {
+ ts->input = devm_input_allocate_device(dev);
+ if (!ts->input)
+ return -ENOMEM;
+
+ ts->input->name = pdev->name;
+ ts->input->phys = "sun4i_ts/input0";
+ ts->input->open = sun4i_ts_open;
+ ts->input->close = sun4i_ts_close;
+ ts->input->id.bustype = BUS_HOST;
+ ts->input->id.vendor = 0x0001;
+ ts->input->id.product = 0x0001;
+ ts->input->id.version = 0x0100;
+ ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS);
+ set_bit(BTN_TOUCH, ts->input->keybit);
+ input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0);
+ input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0);
+ input_set_drvdata(ts->input, ts);
+ }
ts->base = devm_ioremap_resource(dev,
platform_get_resource(pdev, IORESOURCE_MEM, 0));
@@ -232,14 +284,39 @@ static int sun4i_ts_probe(struct platform_device *pdev)
writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1),
ts->base + TP_CTRL1);
- ret = input_register_device(ts->input);
- if (ret)
- return ret;
+ hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts",
+ ts, sun4i_ts_groups);
+ if (IS_ERR(hwmon))
+ return PTR_ERR(hwmon);
+
+ writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
+
+ if (ts_attached) {
+ ret = input_register_device(ts->input);
+ if (ret) {
+ writel(0, ts->base + TP_INT_FIFOC);
+ return ret;
+ }
+ }
platform_set_drvdata(pdev, ts);
return 0;
}
+static int sun4i_ts_remove(struct platform_device *pdev)
+{
+ struct sun4i_ts_data *ts = platform_get_drvdata(pdev);
+
+ /* Explicit unregister to avoid open/close changing the imask later */
+ if (ts->input)
+ input_unregister_device(ts->input);
+
+ /* Deactivate all IRQs */
+ writel(0, ts->base + TP_INT_FIFOC);
+
+ return 0;
+}
+
static const struct of_device_id sun4i_ts_of_match[] = {
{ .compatible = "allwinner,sun4i-ts", },
{ /* sentinel */ }
@@ -253,6 +330,7 @@ static struct platform_driver sun4i_ts_driver = {
.of_match_table = of_match_ptr(sun4i_ts_of_match),
},
.probe = sun4i_ts_probe,
+ .remove = sun4i_ts_remove,
};
module_platform_driver(sun4i_ts_driver);
--
1.9.0
^ permalink raw reply related
* Re: [PATCH v3 1/2] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller
From: Maxime Ripard @ 2014-05-10 12:24 UTC (permalink / raw)
To: Hans de Goede
Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <1399718826-16215-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]
Hi Hans,
Thanks a lot for reposting this.
On Sat, May 10, 2014 at 12:47:05PM +0200, Hans de Goede wrote:
> Note the sun4i-ts controller is capable of detecting a second touch, but when
> a second touch is present then the accuracy becomes so bad the reported touch
> location is not useable.
>
> The original android driver contains some complicated heuristics using the
> aprox. distance between the 2 touches to see if the user is making a pinch
> open / close movement, and then reports emulated multi-touch events around
> the last touch coordinate (as the dual-touch coordinates are worthless).
>
> These kinds of heuristics are just asking for trouble (and don't belong
> in the kernel). So this driver offers straight forward, reliable single
> touch functionality only.
>
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> .../bindings/input/touchscreen/sun4i.txt | 15 ++
> drivers/input/touchscreen/Kconfig | 10 +
> drivers/input/touchscreen/Makefile | 1 +
> drivers/input/touchscreen/sun4i-ts.c | 262 +++++++++++++++++++++
> 4 files changed, 288 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> create mode 100644 drivers/input/touchscreen/sun4i-ts.c
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> new file mode 100644
> index 0000000..e45927e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> @@ -0,0 +1,15 @@
> +sun4i resistive touchscreen controller
> +--------------------------------------
> +
> +Required properties:
> + - compatible: "allwinner,sun4i-ts"
In between, I changed the compatible of this driver to sun4i-a10-ts to
match the pattern used everywhere else. You should probably update it
in your driver as well :)
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH] Input: Introduce the use of managed version of kzalloc
From: Himangi Saraogi @ 2014-05-10 18:15 UTC (permalink / raw)
To: Support Opensource, Dmitry Torokhov, linux-input, linux-kernel
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. This data is the third argument to da9052_request_irq in the
two cases below.
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Opensource [Anthony Olech] <anthony.olech.opensource@diasemi.com>
---
The following Coccinelle semantic patch was used for making the change:
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
.probe = probefn,
.remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
<+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
...
?-kfree(e);
...+>
}
@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
<...
- kfree(e);
...>
}
drivers/input/misc/da9052_onkey.c | 4 +---
drivers/input/touchscreen/da9052_tsi.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c
index 184c8f2..6fc8243 100644
--- a/drivers/input/misc/da9052_onkey.c
+++ b/drivers/input/misc/da9052_onkey.c
@@ -84,7 +84,7 @@ static int da9052_onkey_probe(struct platform_device *pdev)
return -EINVAL;
}
- onkey = kzalloc(sizeof(*onkey), GFP_KERNEL);
+ onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL);
input_dev = input_allocate_device();
if (!onkey || !input_dev) {
dev_err(&pdev->dev, "Failed to allocate memory\n");
@@ -126,7 +126,6 @@ err_free_irq:
cancel_delayed_work_sync(&onkey->work);
err_free_mem:
input_free_device(input_dev);
- kfree(onkey);
return error;
}
@@ -139,7 +138,6 @@ static int da9052_onkey_remove(struct platform_device *pdev)
cancel_delayed_work_sync(&onkey->work);
input_unregister_device(onkey->input);
- kfree(onkey);
return 0;
}
diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c
index ab64d58..dff6a2e 100644
--- a/drivers/input/touchscreen/da9052_tsi.c
+++ b/drivers/input/touchscreen/da9052_tsi.c
@@ -238,7 +238,7 @@ static int da9052_ts_probe(struct platform_device *pdev)
if (!da9052)
return -EINVAL;
- tsi = kzalloc(sizeof(struct da9052_tsi), GFP_KERNEL);
+ tsi = devm_kzalloc(&pdev->dev, sizeof(struct da9052_tsi), GFP_KERNEL);
input_dev = input_allocate_device();
if (!tsi || !input_dev) {
error = -ENOMEM;
@@ -311,7 +311,6 @@ err_free_datardy_irq:
err_free_pendwn_irq:
da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);
err_free_mem:
- kfree(tsi);
input_free_device(input_dev);
return error;
@@ -327,7 +326,6 @@ static int da9052_ts_remove(struct platform_device *pdev)
da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);
input_unregister_device(tsi->dev);
- kfree(tsi);
return 0;
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2] Input: Introduce the use of managed version of kzalloc
From: Himangi Saraogi @ 2014-05-10 18:16 UTC (permalink / raw)
To: Support Opensource, Dmitry Torokhov, linux-input, linux-kernel
Cc: julia.lawall
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. This data is the third argument to da9052_request_irq in the
two cases below.
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Opensource [Anthony Olech] <anthony.olech.opensource@diasemi.com>
---
v2: shift semantic patch from description to below ---
The following Coccinelle semantic patch was used for making the change:
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
.probe = probefn,
.remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
<+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
...
?-kfree(e);
...+>
}
@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
<...
- kfree(e);
...>
}
drivers/input/misc/da9052_onkey.c | 4 +---
drivers/input/touchscreen/da9052_tsi.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c
index 184c8f2..6fc8243 100644
--- a/drivers/input/misc/da9052_onkey.c
+++ b/drivers/input/misc/da9052_onkey.c
@@ -84,7 +84,7 @@ static int da9052_onkey_probe(struct platform_device *pdev)
return -EINVAL;
}
- onkey = kzalloc(sizeof(*onkey), GFP_KERNEL);
+ onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL);
input_dev = input_allocate_device();
if (!onkey || !input_dev) {
dev_err(&pdev->dev, "Failed to allocate memory\n");
@@ -126,7 +126,6 @@ err_free_irq:
cancel_delayed_work_sync(&onkey->work);
err_free_mem:
input_free_device(input_dev);
- kfree(onkey);
return error;
}
@@ -139,7 +138,6 @@ static int da9052_onkey_remove(struct platform_device *pdev)
cancel_delayed_work_sync(&onkey->work);
input_unregister_device(onkey->input);
- kfree(onkey);
return 0;
}
diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c
index ab64d58..dff6a2e 100644
--- a/drivers/input/touchscreen/da9052_tsi.c
+++ b/drivers/input/touchscreen/da9052_tsi.c
@@ -238,7 +238,7 @@ static int da9052_ts_probe(struct platform_device *pdev)
if (!da9052)
return -EINVAL;
- tsi = kzalloc(sizeof(struct da9052_tsi), GFP_KERNEL);
+ tsi = devm_kzalloc(&pdev->dev, sizeof(struct da9052_tsi), GFP_KERNEL);
input_dev = input_allocate_device();
if (!tsi || !input_dev) {
error = -ENOMEM;
@@ -311,7 +311,6 @@ err_free_datardy_irq:
err_free_pendwn_irq:
da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);
err_free_mem:
- kfree(tsi);
input_free_device(input_dev);
return error;
@@ -327,7 +326,6 @@ static int da9052_ts_remove(struct platform_device *pdev)
da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);
input_unregister_device(tsi->dev);
- kfree(tsi);
return 0;
}
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] HID: i2c-hid: Support batch read of input events from fifo
From: Srinivas Pandruvada @ 2014-05-10 18:48 UTC (permalink / raw)
To: Benjamin Tissoires, Archana Patni
Cc: Jiri Kosina, jic23, linux-input, Mika Westerberg,
Pandruvada, Srinivas, Archana Patni, Subramony Sesha
In-Reply-To: <CAN+gG=HQwkqcyvDfK_unSuKRVOt4dyoPDK5Rz0GswrTKL1OMEg@mail.gmail.com>
Hi Benjamin,
On 05/08/2014 07:28 AM, Benjamin Tissoires wrote:
> On Thu, May 8, 2014 at 9:32 AM, Archana Patni
> <archana.patni@linux.intel.com> wrote:
>> Some i2c_hid devices like a sensor hub have built-in fifos which
>> can accumulate input events in their buffers and trigger an interrupt
>> at end of a user defined event like fifo full or a timeout. The current
>> implementation reads one event at a time in the IRQ handler leading to
>> several hundred interrupts being necessary to flush the fifo.
>>
>> This patch changes the threaded IRQ handler to keep input events until
>> there are no input events left to read. In the normal case, this will
>> invoke one additional call to fetch an input event to check for no pending
>> events and terminate the loop.
> I must say, I don't like this patch.
> It seems to me that it will solve your problem but will break other
> devices. Nothing in the spec says what happens if the host tries to
> read while the interrupt line is *not* asserted. I can easily imagine
> several scenarios where the device would hang until the next available
> data, or will just fail.
>
> So the proper way according to the spec is to check the status of the
> interrupt line. This line is the responsibility of the device to be
> asserted and we should rely on it to know if we can read again.
>
> However, a quick check on the interrupt API did not provide me the
> function I would like, so I guess this is something to be work on.
>
> I can not ack this one until we can be sure not breaking other stuff.
>
> So: NACK.
I understand your reason, there may be some HID device which will have
issue with this change.
I am interested in throwing some idea, as I am trying to keep the
devices in deepest idle states as
long as possible. Sensors are one of the offenders.
- This driver can register i2c_driver, command callback. We can define
one of the command to set the set the max size dynamically or fire this
logic to empty buffers. This way, we can only enable such logic, when a
sensor hub has capability and notifies this capability dynamically
without affecting any other hid devices.
Thanks,
Srinivas
> Cheers,
> Benjamin
>
>> Signed-off-by: Archana Patni <archana.patni@intel.com>
>> Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
>> Reviewed-by: Mika Westerberg <mika.westerberg@intel.com>
>> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
>> ---
>> drivers/hid/i2c-hid/i2c-hid.c | 20 +++++++++++++-------
>> 1 file changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
>> index 21aafc8..3f09a50 100644
>> --- a/drivers/hid/i2c-hid/i2c-hid.c
>> +++ b/drivers/hid/i2c-hid/i2c-hid.c
>> @@ -52,6 +52,7 @@
>> static bool debug;
>> module_param(debug, bool, 0444);
>> MODULE_PARM_DESC(debug, "print a lot of debug information");
>> +#define MAX_INPUT_EVENT_READ 100
>>
>> #define i2c_hid_dbg(ihid, fmt, arg...) \
>> do { \
>> @@ -366,7 +367,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
>> return 0;
>> }
>>
>> -static void i2c_hid_get_input(struct i2c_hid *ihid)
>> +static int i2c_hid_get_input(struct i2c_hid *ihid)
>> {
>> int ret, ret_size;
>> int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
>> @@ -374,11 +375,11 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>> ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
>> if (ret != size) {
>> if (ret < 0)
>> - return;
>> + return ret;
>>
>> dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n",
>> __func__, ret, size);
>> - return;
>> + return -EIO;
>> }
>>
>> ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8;
>> @@ -387,13 +388,13 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>> /* host or device initiated RESET completed */
>> if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags))
>> wake_up(&ihid->wait);
>> - return;
>> + return 0;
>> }
>>
>> if (ret_size > size) {
>> dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
>> __func__, size, ret_size);
>> - return;
>> + return -EIO;
>> }
>>
>> i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
>> @@ -402,17 +403,22 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>> hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2,
>> ret_size - 2, 1);
>>
>> - return;
>> + return 1;
>> }
>>
>> static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
>> {
>> struct i2c_hid *ihid = dev_id;
>> + int ret;
>> + int count = 0;
>>
>> if (test_bit(I2C_HID_READ_PENDING, &ihid->flags))
>> return IRQ_HANDLED;
>> + do {
>> + count++;
>> + ret = i2c_hid_get_input(ihid);
>>
>> - i2c_hid_get_input(ihid);
>> + } while (count < MAX_INPUT_EVENT_READ && ret > 0);
>>
>> return IRQ_HANDLED;
>> }
>> --
>> 1.7.9.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-input" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* [PATCH v4 0/2] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller
From: Hans de Goede @ 2014-05-11 8:06 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Hi All,
Since Maxime rightfully pointed out an error in my resend of v3, here is v4
with that fixed.
Note the second patch which adds hwmon functionality has been reviewed by
the hwon subsystem maintainer, and the sun?i*.dts changes to enable this
have already been upstreamed.
Changes since v1:
-Use devm_kzalloc and devm_hwmon_device_register_with_groups as suggested
by Guenter Roeck
-Various small cleanups suggested by Thomas Petazzoni
-Add open/close methods and enable/disable the input related interrupts from
there as suggested by Dmitry
Changes since v2:
-Addressed review comments from Dmitry
-Addressed review comments from Guenter
-Addressed review comments from Maxime
-Initialize ignore_fifo_data to true, the very first coordinate can be
wrong too
Changes since v3:
-Rename compatible from sun4i-ts to sun4i-a10-ts to match the dts entries
which are already upstream
Thanks & Regards,
Hans
^ permalink raw reply
* [PATCH v4 1/2] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller
From: Hans de Goede @ 2014-05-11 8:06 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
In-Reply-To: <1399795586-18919-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Note the sun4i-ts controller is capable of detecting a second touch, but when
a second touch is present then the accuracy becomes so bad the reported touch
location is not useable.
The original android driver contains some complicated heuristics using the
aprox. distance between the 2 touches to see if the user is making a pinch
open / close movement, and then reports emulated multi-touch events around
the last touch coordinate (as the dual-touch coordinates are worthless).
These kinds of heuristics are just asking for trouble (and don't belong
in the kernel). So this driver offers straight forward, reliable single
touch functionality only.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
.../bindings/input/touchscreen/sun4i.txt | 15 ++
drivers/input/touchscreen/Kconfig | 10 +
drivers/input/touchscreen/Makefile | 1 +
drivers/input/touchscreen/sun4i-ts.c | 262 +++++++++++++++++++++
4 files changed, 288 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
create mode 100644 drivers/input/touchscreen/sun4i-ts.c
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
new file mode 100644
index 0000000..881aea7
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -0,0 +1,15 @@
+sun4i resistive touchscreen controller
+--------------------------------------
+
+Required properties:
+ - compatible: "allwinner,sun4i-a10-ts"
+ - reg: mmio address range of the chip
+ - interrupts: interrupt to which the chip is connected
+
+Example:
+
+ rtp: rtp@01c25000 {
+ compatible = "allwinner,sun4i-a10-ts";
+ reg = <0x01c25000 0x100>;
+ interrupts = <29>;
+ };
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 68edc9d..b8366cb 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -897,6 +897,16 @@ config TOUCHSCREEN_STMPE
To compile this driver as a module, choose M here: the
module will be called stmpe-ts.
+config TOUCHSCREEN_SUN4I
+ tristate "Allwinner sun4i resistive touchscreen controller support"
+ depends on ARCH_SUNXI
+ help
+ This selects support for the resistive touchscreen controller
+ found on Allwinner sunxi SoCs.
+
+ To compile this driver as a module, choose M here: the
+ module will be called sun4i-ts.
+
config TOUCHSCREEN_SUR40
tristate "Samsung SUR40 (Surface 2.0/PixelSense) touchscreen"
depends on USB
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 4bc954b..71a9755 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o
obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o
obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o
+obj-$(CONFIG_TOUCHSCREEN_SUN4I) += sun4i-ts.o
obj-$(CONFIG_TOUCHSCREEN_SUR40) += sur40.o
obj-$(CONFIG_TOUCHSCREEN_TI_AM335X_TSC) += ti_am335x_tsc.o
obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
new file mode 100644
index 0000000..c5acdfb
--- /dev/null
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -0,0 +1,262 @@
+/*
+ * Allwinner sunxi resistive touchscreen controller driver
+ *
+ * Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * The sun4i-ts controller is capable of detecting a second touch, but when a
+ * second touch is present then the accuracy becomes so bad the reported touch
+ * location is not useable.
+ *
+ * The original android driver contains some complicated heuristics using the
+ * aprox. distance between the 2 touches to see if the user is making a pinch
+ * open / close movement, and then reports emulated multi-touch events around
+ * the last touch coordinate (as the dual-touch coordinates are worthless).
+ *
+ * These kinds of heuristics are just asking for trouble (and don't belong
+ * in the kernel). So this driver offers straight forward, reliable single
+ * touch functionality only.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#define TP_CTRL0 0x00
+#define TP_CTRL1 0x04
+#define TP_CTRL2 0x08
+#define TP_CTRL3 0x0c
+#define TP_INT_FIFOC 0x10
+#define TP_INT_FIFOS 0x14
+#define TP_TPR 0x18
+#define TP_CDAT 0x1c
+#define TEMP_DATA 0x20
+#define TP_DATA 0x24
+
+/* TP_CTRL0 bits */
+#define ADC_FIRST_DLY(x) ((x) << 24) /* 8 bits */
+#define ADC_FIRST_DLY_MODE(x) ((x) << 23)
+#define ADC_CLK_SEL(x) ((x) << 22)
+#define ADC_CLK_DIV(x) ((x) << 20) /* 3 bits */
+#define FS_DIV(x) ((x) << 16) /* 4 bits */
+#define T_ACQ(x) ((x) << 0) /* 16 bits */
+
+/* TP_CTRL1 bits */
+#define STYLUS_UP_DEBOUN(x) ((x) << 12) /* 8 bits */
+#define STYLUS_UP_DEBOUN_EN(x) ((x) << 9)
+#define TOUCH_PAN_CALI_EN(x) ((x) << 6)
+#define TP_DUAL_EN(x) ((x) << 5)
+#define TP_MODE_EN(x) ((x) << 4)
+#define TP_ADC_SELECT(x) ((x) << 3)
+#define ADC_CHAN_SELECT(x) ((x) << 0) /* 3 bits */
+
+/* TP_CTRL2 bits */
+#define TP_SENSITIVE_ADJUST(x) ((x) << 28) /* 4 bits */
+#define TP_MODE_SELECT(x) ((x) << 26) /* 2 bits */
+#define PRE_MEA_EN(x) ((x) << 24)
+#define PRE_MEA_THRE_CNT(x) ((x) << 0) /* 24 bits */
+
+/* TP_CTRL3 bits */
+#define FILTER_EN(x) ((x) << 2)
+#define FILTER_TYPE(x) ((x) << 0) /* 2 bits */
+
+/* TP_INT_FIFOC irq and fifo mask / control bits */
+#define TEMP_IRQ_EN(x) ((x) << 18)
+#define OVERRUN_IRQ_EN(x) ((x) << 17)
+#define DATA_IRQ_EN(x) ((x) << 16)
+#define TP_DATA_XY_CHANGE(x) ((x) << 13)
+#define FIFO_TRIG(x) ((x) << 8) /* 5 bits */
+#define DATA_DRQ_EN(x) ((x) << 7)
+#define FIFO_FLUSH(x) ((x) << 4)
+#define TP_UP_IRQ_EN(x) ((x) << 1)
+#define TP_DOWN_IRQ_EN(x) ((x) << 0)
+
+/* TP_INT_FIFOS irq and fifo status bits */
+#define TEMP_DATA_PENDING BIT(18)
+#define FIFO_OVERRUN_PENDING BIT(17)
+#define FIFO_DATA_PENDING BIT(16)
+#define TP_IDLE_FLG BIT(2)
+#define TP_UP_PENDING BIT(1)
+#define TP_DOWN_PENDING BIT(0)
+
+/* TP_TPR bits */
+#define TEMP_ENABLE(x) ((x) << 16)
+#define TEMP_PERIOD(x) ((x) << 0) /* t = x * 256 * 16 / clkin */
+
+struct sun4i_ts_data {
+ struct device *dev;
+ struct input_dev *input;
+ void __iomem *base;
+ unsigned int irq;
+ bool ignore_fifo_data;
+};
+
+static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
+{
+ struct sun4i_ts_data *ts = dev_id;
+ u32 reg_val, x, y;
+
+ reg_val = readl(ts->base + TP_INT_FIFOS);
+
+ if (reg_val & FIFO_DATA_PENDING) {
+ x = readl(ts->base + TP_DATA);
+ y = readl(ts->base + TP_DATA);
+ /* The 1st location reported after an up event is unreliable */
+ if (!ts->ignore_fifo_data) {
+ input_report_abs(ts->input, ABS_X, x);
+ input_report_abs(ts->input, ABS_Y, y);
+ /*
+ * The hardware has a separate down status bit, but
+ * that gets set before we get the first location,
+ * resulting in reporting a click on the old location.
+ */
+ input_report_key(ts->input, BTN_TOUCH, 1);
+ input_sync(ts->input);
+ } else {
+ ts->ignore_fifo_data = false;
+ }
+ }
+
+ if (reg_val & TP_UP_PENDING) {
+ ts->ignore_fifo_data = true;
+ input_report_key(ts->input, BTN_TOUCH, 0);
+ input_sync(ts->input);
+ }
+
+ writel(reg_val, ts->base + TP_INT_FIFOS);
+
+ return IRQ_HANDLED;
+}
+
+static int sun4i_ts_open(struct input_dev *dev)
+{
+ struct sun4i_ts_data *ts = input_get_drvdata(dev);
+
+ /* Flush, set trig level to 1, enable data and up irqs */
+ writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | TP_UP_IRQ_EN(1),
+ ts->base + TP_INT_FIFOC);
+
+ return 0;
+}
+
+static void sun4i_ts_close(struct input_dev *dev)
+{
+ struct sun4i_ts_data *ts = input_get_drvdata(dev);
+
+ /* Deactivate all IRQs */
+ writel(0, ts->base + TP_INT_FIFOC);
+}
+
+static int sun4i_ts_probe(struct platform_device *pdev)
+{
+ struct sun4i_ts_data *ts;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
+ if (!ts)
+ return -ENOMEM;
+
+ ts->dev = dev;
+ ts->ignore_fifo_data = true;
+
+ ts->input = devm_input_allocate_device(dev);
+ if (!ts->input)
+ return -ENOMEM;
+
+ ts->input->name = pdev->name;
+ ts->input->phys = "sun4i_ts/input0";
+ ts->input->open = sun4i_ts_open;
+ ts->input->close = sun4i_ts_close;
+ ts->input->id.bustype = BUS_HOST;
+ ts->input->id.vendor = 0x0001;
+ ts->input->id.product = 0x0001;
+ ts->input->id.version = 0x0100;
+ ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS);
+ set_bit(BTN_TOUCH, ts->input->keybit);
+ input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0);
+ input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0);
+ input_set_drvdata(ts->input, ts);
+
+ ts->base = devm_ioremap_resource(dev,
+ platform_get_resource(pdev, IORESOURCE_MEM, 0));
+ if (IS_ERR(ts->base))
+ return PTR_ERR(ts->base);
+
+ ts->irq = platform_get_irq(pdev, 0);
+ ret = devm_request_irq(dev, ts->irq, sun4i_ts_irq, 0, "sun4i-ts", ts);
+ if (ret)
+ return ret;
+
+ /*
+ * Select HOSC clk, clkin = clk / 6, adc samplefreq = clkin / 8192,
+ * t_acq = clkin / (16 * 64)
+ */
+ writel(ADC_CLK_SEL(0) | ADC_CLK_DIV(2) | FS_DIV(7) | T_ACQ(63),
+ ts->base + TP_CTRL0);
+
+ /*
+ * sensitive_adjust = 15 : max, which is not all that sensitive,
+ * tp_mode = 0 : only x and y coordinates, as we don't use dual touch
+ */
+ writel(TP_SENSITIVE_ADJUST(15) | TP_MODE_SELECT(0),
+ ts->base + TP_CTRL2);
+
+ /* Enable median filter, type 1 : 5/3 */
+ writel(FILTER_EN(1) | FILTER_TYPE(1), ts->base + TP_CTRL3);
+
+ /* Enable temperature measurement, period 1953 (2 seconds) */
+ writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR);
+
+ /*
+ * Set stylus up debounce to aprox 10 ms, enable debounce, and
+ * finally enable tp mode.
+ */
+ writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1),
+ ts->base + TP_CTRL1);
+
+ ret = input_register_device(ts->input);
+ if (ret)
+ return ret;
+
+ platform_set_drvdata(pdev, ts);
+ return 0;
+}
+
+static const struct of_device_id sun4i_ts_of_match[] = {
+ { .compatible = "allwinner,sun4i-a10-ts", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sun4i_ts_of_match);
+
+static struct platform_driver sun4i_ts_driver = {
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "sun4i-ts",
+ .of_match_table = of_match_ptr(sun4i_ts_of_match),
+ },
+ .probe = sun4i_ts_probe,
+};
+
+module_platform_driver(sun4i_ts_driver);
+
+MODULE_DESCRIPTION("Allwinner sun4i resistive touchscreen controller driver");
+MODULE_AUTHOR("Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>");
+MODULE_LICENSE("GPL");
--
1.9.0
^ permalink raw reply related
* [PATCH v4 2/2] input: sun4i-ts: Add support for temperature sensor
From: Hans de Goede @ 2014-05-11 8:06 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
In-Reply-To: <1399795586-18919-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
The sun4i resisitive touchscreen controller also comes with a built-in
temperature sensor. This commit adds support for it.
This commit also introduces a new "ts-attached" device-tree property,
when this is not set, the input part of the driver won't register. This way
the internal temperature sensor can be used to measure the SoC temperature
independent of there actually being a touchscreen attached to the controller.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
---
.../bindings/input/touchscreen/sun4i.txt | 5 +
drivers/input/touchscreen/sun4i-ts.c | 140 ++++++++++++++++-----
2 files changed, 114 insertions(+), 31 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
index 881aea7..aef5779 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -6,10 +6,15 @@ Required properties:
- reg: mmio address range of the chip
- interrupts: interrupt to which the chip is connected
+Optional properties:
+ - allwinner,ts-attached: boolean indicating that an actual touchscreen is
+ attached to the controller
+
Example:
rtp: rtp@01c25000 {
compatible = "allwinner,sun4i-a10-ts";
reg = <0x01c25000 0x100>;
interrupts = <29>;
+ allwinner,ts-attached;
};
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index c5acdfb..f366221 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -3,6 +3,9 @@
*
* Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
*
+ * The hwmon parts are based on work by Corentin LABBE which is:
+ * Copyright (C) 2013 Corentin LABBE <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
+ *
* 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
@@ -30,6 +33,7 @@
*/
#include <linux/err.h>
+#include <linux/hwmon.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
@@ -106,14 +110,12 @@ struct sun4i_ts_data {
void __iomem *base;
unsigned int irq;
bool ignore_fifo_data;
+ int temp_data;
};
-static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
+static void sun4i_ts_irq_handle_input(struct sun4i_ts_data *ts, u32 reg_val)
{
- struct sun4i_ts_data *ts = dev_id;
- u32 reg_val, x, y;
-
- reg_val = readl(ts->base + TP_INT_FIFOS);
+ u32 x, y;
if (reg_val & FIFO_DATA_PENDING) {
x = readl(ts->base + TP_DATA);
@@ -139,6 +141,20 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
input_report_key(ts->input, BTN_TOUCH, 0);
input_sync(ts->input);
}
+}
+
+static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
+{
+ struct sun4i_ts_data *ts = dev_id;
+ u32 reg_val;
+
+ reg_val = readl(ts->base + TP_INT_FIFOS);
+
+ if (reg_val & TEMP_DATA_PENDING)
+ ts->temp_data = readl(ts->base + TEMP_DATA);
+
+ if (ts->input)
+ sun4i_ts_irq_handle_input(ts, reg_val);
writel(reg_val, ts->base + TP_INT_FIFOS);
@@ -149,9 +165,9 @@ static int sun4i_ts_open(struct input_dev *dev)
{
struct sun4i_ts_data *ts = input_get_drvdata(dev);
- /* Flush, set trig level to 1, enable data and up irqs */
- writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | TP_UP_IRQ_EN(1),
- ts->base + TP_INT_FIFOC);
+ /* Flush, set trig level to 1, enable temp, data and up irqs */
+ writel(TEMP_IRQ_EN(1) | DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) |
+ TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
return 0;
}
@@ -160,15 +176,48 @@ static void sun4i_ts_close(struct input_dev *dev)
{
struct sun4i_ts_data *ts = input_get_drvdata(dev);
- /* Deactivate all IRQs */
- writel(0, ts->base + TP_INT_FIFOC);
+ /* Deactivate all input IRQs */
+ writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
+}
+
+static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
+ char *buf)
+{
+ struct sun4i_ts_data *ts = dev_get_drvdata(dev);
+
+ /* No temp_data until the first irq */
+ if (ts->temp_data == -1)
+ return -EAGAIN;
+
+ return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100);
+}
+
+static ssize_t show_temp_label(struct device *dev,
+ struct device_attribute *devattr, char *buf)
+{
+ return sprintf(buf, "SoC temperature\n");
}
+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
+static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL);
+
+static struct attribute *sun4i_ts_attrs[] = {
+ &dev_attr_temp1_input.attr,
+ &dev_attr_temp1_label.attr,
+ NULL
+};
+ATTRIBUTE_GROUPS(sun4i_ts);
+
static int sun4i_ts_probe(struct platform_device *pdev)
{
struct sun4i_ts_data *ts;
struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
+ struct device *hwmon;
int ret;
+ bool ts_attached;
+
+ ts_attached = of_property_read_bool(np, "allwinner,ts-attached");
ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
if (!ts)
@@ -176,24 +225,27 @@ static int sun4i_ts_probe(struct platform_device *pdev)
ts->dev = dev;
ts->ignore_fifo_data = true;
-
- ts->input = devm_input_allocate_device(dev);
- if (!ts->input)
- return -ENOMEM;
-
- ts->input->name = pdev->name;
- ts->input->phys = "sun4i_ts/input0";
- ts->input->open = sun4i_ts_open;
- ts->input->close = sun4i_ts_close;
- ts->input->id.bustype = BUS_HOST;
- ts->input->id.vendor = 0x0001;
- ts->input->id.product = 0x0001;
- ts->input->id.version = 0x0100;
- ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS);
- set_bit(BTN_TOUCH, ts->input->keybit);
- input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0);
- input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0);
- input_set_drvdata(ts->input, ts);
+ ts->temp_data = -1;
+
+ if (ts_attached) {
+ ts->input = devm_input_allocate_device(dev);
+ if (!ts->input)
+ return -ENOMEM;
+
+ ts->input->name = pdev->name;
+ ts->input->phys = "sun4i_ts/input0";
+ ts->input->open = sun4i_ts_open;
+ ts->input->close = sun4i_ts_close;
+ ts->input->id.bustype = BUS_HOST;
+ ts->input->id.vendor = 0x0001;
+ ts->input->id.product = 0x0001;
+ ts->input->id.version = 0x0100;
+ ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS);
+ set_bit(BTN_TOUCH, ts->input->keybit);
+ input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0);
+ input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0);
+ input_set_drvdata(ts->input, ts);
+ }
ts->base = devm_ioremap_resource(dev,
platform_get_resource(pdev, IORESOURCE_MEM, 0));
@@ -232,14 +284,39 @@ static int sun4i_ts_probe(struct platform_device *pdev)
writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1),
ts->base + TP_CTRL1);
- ret = input_register_device(ts->input);
- if (ret)
- return ret;
+ hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts",
+ ts, sun4i_ts_groups);
+ if (IS_ERR(hwmon))
+ return PTR_ERR(hwmon);
+
+ writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
+
+ if (ts_attached) {
+ ret = input_register_device(ts->input);
+ if (ret) {
+ writel(0, ts->base + TP_INT_FIFOC);
+ return ret;
+ }
+ }
platform_set_drvdata(pdev, ts);
return 0;
}
+static int sun4i_ts_remove(struct platform_device *pdev)
+{
+ struct sun4i_ts_data *ts = platform_get_drvdata(pdev);
+
+ /* Explicit unregister to avoid open/close changing the imask later */
+ if (ts->input)
+ input_unregister_device(ts->input);
+
+ /* Deactivate all IRQs */
+ writel(0, ts->base + TP_INT_FIFOC);
+
+ return 0;
+}
+
static const struct of_device_id sun4i_ts_of_match[] = {
{ .compatible = "allwinner,sun4i-a10-ts", },
{ /* sentinel */ }
@@ -253,6 +330,7 @@ static struct platform_driver sun4i_ts_driver = {
.of_match_table = of_match_ptr(sun4i_ts_of_match),
},
.probe = sun4i_ts_probe,
+ .remove = sun4i_ts_remove,
};
module_platform_driver(sun4i_ts_driver);
--
1.9.0
^ permalink raw reply related
* Re: [PATCH v4 0/2] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller
From: Maxime Ripard @ 2014-05-11 21:04 UTC (permalink / raw)
To: Hans de Goede
Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <1399795586-18919-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 624 bytes --]
Hi Hans,
On Sun, May 11, 2014 at 10:06:24AM +0200, Hans de Goede wrote:
> Hi All,
>
> Since Maxime rightfully pointed out an error in my resend of v3, here is v4
> with that fixed.
>
> Note the second patch which adds hwmon functionality has been reviewed by
> the hwon subsystem maintainer, and the sun?i*.dts changes to enable this
> have already been upstreamed.
For both patches,
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH RESEND 1/2] input: gpio_keys_polled: Convert to devm-* API
From: Alexander Shiyan @ 2014-05-12 7:15 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
In-Reply-To: <20140506041818.GA32144@core.coreip.homeip.net>
Mon, 5 May 2014 21:18:18 -0700 от Dmitry Torokhov <dmitry.torokhov@gmail.com>:
> On Tue, Apr 29, 2014 at 08:40:59PM +0400, Alexander Shiyan wrote:
> > Tue, 29 Apr 2014 09:36:49 -0700 от Dmitry Torokhov <dmitry.torokhov@gmail.com>:
> > > On Tue, Apr 29, 2014 at 08:24:19PM +0400, Alexander Shiyan wrote:
> > ...
> > > > > > > > > On Sat, Apr 26, 2014 at 09:53:13AM +0400, Alexander Shiyan wrote:
> > > > > > > > > > Replace existing resource handling in the driver with managed
> > > > > > > > > > device resource, this ensures more consistent error values and
> > > > > > > > > > simplifies error paths.
> > > > > > > > > > kzalloc -> devm_kzalloc
> > > > > > > > > > gpio_request_one -> devm_gpio_request_one
> > > > > > ...
> > > > > > > > > @@ -162,8 +160,7 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
> > > > > > > > > if (of_property_read_u32(pp, "linux,code", &button->code)) {
> > > > > > > > > dev_err(dev, "Button without keycode: 0x%x\n",
> > > > > > > > > button->gpio);
> > > > > > > > > - error = -EINVAL;
> > > > > > > > > - goto err_free_pdata;
> > > > > > > > > + return ERR_PTR(-EINVAL);
> > > > > > > > > }
> > > > > > > >
> > > > > > > > We can even use return value from of_property_read_u32() on error.
> > > > > > > >
> > > > > > > > All other looks OK.
> > > > > > >
> > > > > > > Do you have hardware that uses gpio_keys_polled?
> > > > > >
> > > > > > Yes.
> > > > >
> > > > > So did you have a chance to actually try my version(s)? I would feel
> > > > > much better if you had ;)
> > > >
> > > > Unfortunately, due to the large following weekends, I cannot do it earlier
> > > > than 2 weeks.
> > >
> > > That is fine, there is no rush.
> >
> > OK. In this case it would be nice to have a separate branch with poll-series
> > and this patch. Can you make it?
>
> I just pushed new input-polldev branch containing input polldev changes
> and your patches to gpio-keys and gpio-keys-polled. It is based on 3.14.
This works for me as expected, so:
Tested-by: Alexander Shiyan <shc_work@mail.ru>
---
^ permalink raw reply
* Re: [PATCH v4 2/2] input: sun4i-ts: Add support for temperature sensor
From: Chen-Yu Tsai @ 2014-05-12 8:44 UTC (permalink / raw)
To: linux-sunxi
Cc: Dmitry Torokhov, Maxime Ripard,
linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, linux-arm-kernel,
devicetree, Hans de Goede
In-Reply-To: <1399795586-18919-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Hi,
On Sun, May 11, 2014 at 4:06 PM, Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> The sun4i resisitive touchscreen controller also comes with a built-in
> temperature sensor. This commit adds support for it.
>
> This commit also introduces a new "ts-attached" device-tree property,
> when this is not set, the input part of the driver won't register. This way
> the internal temperature sensor can be used to measure the SoC temperature
> independent of there actually being a touchscreen attached to the controller.
>
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
> ---
> .../bindings/input/touchscreen/sun4i.txt | 5 +
> drivers/input/touchscreen/sun4i-ts.c | 140 ++++++++++++++++-----
> 2 files changed, 114 insertions(+), 31 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> index 881aea7..aef5779 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> @@ -6,10 +6,15 @@ Required properties:
> - reg: mmio address range of the chip
> - interrupts: interrupt to which the chip is connected
>
> +Optional properties:
> + - allwinner,ts-attached: boolean indicating that an actual touchscreen is
> + attached to the controller
> +
> Example:
>
> rtp: rtp@01c25000 {
> compatible = "allwinner,sun4i-a10-ts";
> reg = <0x01c25000 0x100>;
> interrupts = <29>;
> + allwinner,ts-attached;
> };
> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
> index c5acdfb..f366221 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -3,6 +3,9 @@
> *
> * Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> *
> + * The hwmon parts are based on work by Corentin LABBE which is:
> + * Copyright (C) 2013 Corentin LABBE <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> + *
> * 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
> @@ -30,6 +33,7 @@
> */
>
> #include <linux/err.h>
> +#include <linux/hwmon.h>
> #include <linux/init.h>
> #include <linux/input.h>
> #include <linux/interrupt.h>
> @@ -106,14 +110,12 @@ struct sun4i_ts_data {
> void __iomem *base;
> unsigned int irq;
> bool ignore_fifo_data;
> + int temp_data;
> };
>
> -static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
> +static void sun4i_ts_irq_handle_input(struct sun4i_ts_data *ts, u32 reg_val)
> {
> - struct sun4i_ts_data *ts = dev_id;
> - u32 reg_val, x, y;
> -
> - reg_val = readl(ts->base + TP_INT_FIFOS);
> + u32 x, y;
>
> if (reg_val & FIFO_DATA_PENDING) {
> x = readl(ts->base + TP_DATA);
> @@ -139,6 +141,20 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
> input_report_key(ts->input, BTN_TOUCH, 0);
> input_sync(ts->input);
> }
> +}
> +
> +static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
> +{
> + struct sun4i_ts_data *ts = dev_id;
> + u32 reg_val;
> +
> + reg_val = readl(ts->base + TP_INT_FIFOS);
> +
> + if (reg_val & TEMP_DATA_PENDING)
> + ts->temp_data = readl(ts->base + TEMP_DATA);
> +
> + if (ts->input)
> + sun4i_ts_irq_handle_input(ts, reg_val);
>
> writel(reg_val, ts->base + TP_INT_FIFOS);
>
> @@ -149,9 +165,9 @@ static int sun4i_ts_open(struct input_dev *dev)
> {
> struct sun4i_ts_data *ts = input_get_drvdata(dev);
>
> - /* Flush, set trig level to 1, enable data and up irqs */
> - writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | TP_UP_IRQ_EN(1),
> - ts->base + TP_INT_FIFOC);
> + /* Flush, set trig level to 1, enable temp, data and up irqs */
> + writel(TEMP_IRQ_EN(1) | DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) |
> + TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
>
> return 0;
> }
> @@ -160,15 +176,48 @@ static void sun4i_ts_close(struct input_dev *dev)
> {
> struct sun4i_ts_data *ts = input_get_drvdata(dev);
>
> - /* Deactivate all IRQs */
> - writel(0, ts->base + TP_INT_FIFOC);
> + /* Deactivate all input IRQs */
> + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
> +}
> +
> +static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
> + char *buf)
> +{
> + struct sun4i_ts_data *ts = dev_get_drvdata(dev);
> +
> + /* No temp_data until the first irq */
> + if (ts->temp_data == -1)
> + return -EAGAIN;
> +
> + return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100);
> +}
> +
> +static ssize_t show_temp_label(struct device *dev,
> + struct device_attribute *devattr, char *buf)
> +{
> + return sprintf(buf, "SoC temperature\n");
> }
>
> +static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
> +static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL);
> +
> +static struct attribute *sun4i_ts_attrs[] = {
> + &dev_attr_temp1_input.attr,
> + &dev_attr_temp1_label.attr,
> + NULL
> +};
> +ATTRIBUTE_GROUPS(sun4i_ts);
> +
> static int sun4i_ts_probe(struct platform_device *pdev)
> {
> struct sun4i_ts_data *ts;
> struct device *dev = &pdev->dev;
> + struct device_node *np = dev->of_node;
> + struct device *hwmon;
> int ret;
> + bool ts_attached;
> +
> + ts_attached = of_property_read_bool(np, "allwinner,ts-attached");
>
> ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
> if (!ts)
> @@ -176,24 +225,27 @@ static int sun4i_ts_probe(struct platform_device *pdev)
>
> ts->dev = dev;
> ts->ignore_fifo_data = true;
> -
> - ts->input = devm_input_allocate_device(dev);
> - if (!ts->input)
> - return -ENOMEM;
> -
> - ts->input->name = pdev->name;
> - ts->input->phys = "sun4i_ts/input0";
> - ts->input->open = sun4i_ts_open;
> - ts->input->close = sun4i_ts_close;
> - ts->input->id.bustype = BUS_HOST;
> - ts->input->id.vendor = 0x0001;
> - ts->input->id.product = 0x0001;
> - ts->input->id.version = 0x0100;
> - ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS);
> - set_bit(BTN_TOUCH, ts->input->keybit);
> - input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0);
> - input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0);
> - input_set_drvdata(ts->input, ts);
> + ts->temp_data = -1;
> +
> + if (ts_attached) {
> + ts->input = devm_input_allocate_device(dev);
> + if (!ts->input)
> + return -ENOMEM;
> +
> + ts->input->name = pdev->name;
> + ts->input->phys = "sun4i_ts/input0";
> + ts->input->open = sun4i_ts_open;
> + ts->input->close = sun4i_ts_close;
> + ts->input->id.bustype = BUS_HOST;
> + ts->input->id.vendor = 0x0001;
> + ts->input->id.product = 0x0001;
> + ts->input->id.version = 0x0100;
> + ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS);
> + set_bit(BTN_TOUCH, ts->input->keybit);
> + input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0);
> + input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0);
> + input_set_drvdata(ts->input, ts);
> + }
>
> ts->base = devm_ioremap_resource(dev,
> platform_get_resource(pdev, IORESOURCE_MEM, 0));
> @@ -232,14 +284,39 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1),
> ts->base + TP_CTRL1);
>
> - ret = input_register_device(ts->input);
> - if (ret)
> - return ret;
> + hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts",
> + ts, sun4i_ts_groups);
This fails to compile when HWMON is not selected:
drivers/built-in.o: In function `sun4i_ts_probe':
/home/wens/cubieboard/linux/drivers/input/touchscreen/sun4i-ts.c:287:
undefined reference to `devm_hwmon_device_register_with_groups'
Best do a wrapper around the hwmon related code.
drivers/input/touchscreen/ads7846.c has something similar, albeit for voltage.
ChenYu
> + if (IS_ERR(hwmon))
> + return PTR_ERR(hwmon);
> +
> + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
> +
> + if (ts_attached) {
> + ret = input_register_device(ts->input);
> + if (ret) {
> + writel(0, ts->base + TP_INT_FIFOC);
> + return ret;
> + }
> + }
>
> platform_set_drvdata(pdev, ts);
> return 0;
> }
>
> +static int sun4i_ts_remove(struct platform_device *pdev)
> +{
> + struct sun4i_ts_data *ts = platform_get_drvdata(pdev);
> +
> + /* Explicit unregister to avoid open/close changing the imask later */
> + if (ts->input)
> + input_unregister_device(ts->input);
> +
> + /* Deactivate all IRQs */
> + writel(0, ts->base + TP_INT_FIFOC);
> +
> + return 0;
> +}
> +
> static const struct of_device_id sun4i_ts_of_match[] = {
> { .compatible = "allwinner,sun4i-a10-ts", },
> { /* sentinel */ }
> @@ -253,6 +330,7 @@ static struct platform_driver sun4i_ts_driver = {
> .of_match_table = of_match_ptr(sun4i_ts_of_match),
> },
> .probe = sun4i_ts_probe,
> + .remove = sun4i_ts_remove,
> };
>
> module_platform_driver(sun4i_ts_driver);
> --
> 1.9.0
^ permalink raw reply
* Re: [PATCH] HID: i2c-hid: hid report descriptor retrieval changes
From: Jiri Kosina @ 2014-05-12 8:57 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Archana Patni, jic23, linux-input, Mika Westerberg,
Pandruvada, Srinivas, Archana Patni, Subramony Sesha
In-Reply-To: <CAN+gG=E7sU6rf0XR1_FkSqEejcSwNYqkLkpQBwSj7Xm53iTtRg@mail.gmail.com>
On Thu, 8 May 2014, Benjamin Tissoires wrote:
> > Reading the partial HID Descriptor is causing a firmware lockup in some
> > sensor hubs. Instead of a partial read, this patch implements the
> > i2c hid fetch using a fixed descriptor size (30 bytes) followed by a
> > verification of the BCDVersion (V01.00), and value stored in
> > wHIDDescLength (30 Bytes) for V1.00 descriptors.
> >
> > As per i2c hid spec, this is the preferred model.
> >
> > From hid-over-i2c-protocol-spec-v1-0:
> >
> > There are a variety of ways a HOST may choose to retrieve
> > the HID Descriptor from the DEVICE. The following is a preferred
> > implementation but should not be considered the only implementation.
> > A HOST may read the entire HID Descriptor in a single read by
> > issuing a read for 30 Bytes to get the entire HID Descriptor
> > from the DEVICE.However, the HOST is responsible for validating that
> >
> > 1. The BCDVersion is V01.00 (later revisions may have different
> > descriptor lengths), and
> >
> > 2. The value stored in wHIDDescLength is 30 (Bytes) for V1.00
> > descriptors.
> >
> > Reported-by: Joe Tijerina <joe.tijerina@st.com>
> > Signed-off-by: Archana Patni <archana.patni@intel.com>
> > Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
> > Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
>
> This one is Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Do we have any indication about how frequently are the lockups actually
happening in the wild? Is this a regression? (I don't think so).
The reason I am asking is whether I should rush this in for 3.15 still,
but as the patch doesn't have stable annotation anyway, my understanding
is that 3.16 is enough?
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH v4 00/24] input: Introduce ff-memless-next as an improved replacement for ff-memless
From: Jiri Kosina @ 2014-05-12 9:14 UTC (permalink / raw)
To: Michal Malý
Cc: linux-input, linux-kernel, dmitry.torokhov, elias.vds,
anssi.hannula, simon
In-Reply-To: <1398524543-15012-1-git-send-email-madcatxster@devoid-pointer.net>
On Sat, 26 Apr 2014, Michal Malý wrote:
> ff-memless-next (MLNX) is a largely improved version of the current ff-memless
> (FFML) driver. MLNX supports all force feedback effects currently available in
> the Linux force feedback userspace API. All effects are handled in accordance
> with Microsoft's DirectInput/XInput. Most notable changes include support for
> conditional effects, proper handling of all periodic waveforms and improved
> emulation of rumble effects through periodic effects. MLNX also uses its own
> kernel API to pass processed effects to hardware-specific drivers instead of
> abusing "ff_effect" struct. The API is documented in the respective header
> file.
>
> MLNX has been expanded to be a direct replacement for FFML.
>
> Support for FF_PERIODIC and FF_RAMP has been added to all devices that
> support FF_CONSTANT as a part of the port to the new API.
>
> This patch series:
> 1) Adds "ff-memless-next" module [1]
> 2) Ports all hardware-specific drivers to MLNX's API [2-23]
> 3) Removes FFML and replaces it with MLNX [24]
Dmitry,
what are your plans with this, please?
I personally don't really completely like having two implementations of FF
in the kernel; can't it be really done as an extension to ff-memless?
Thanks,
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v4 00/24] input: Introduce ff-memless-next as an improved replacement for ff-memless
From: Michal Malý @ 2014-05-12 9:26 UTC (permalink / raw)
To: Jiri Kosina
Cc: linux-input, linux-kernel, dmitry.torokhov, elias.vds,
anssi.hannula, simon
In-Reply-To: <alpine.LNX.2.00.1405121112520.5813@pobox.suse.cz>
On Monday 12 of May 2014 11:14:42 Jiri Kosina wrote:
> On Sat, 26 Apr 2014, Michal Malý wrote:
> > ff-memless-next (MLNX) is a largely improved version of the current
> > ff-memless (FFML) driver. MLNX supports all force feedback effects
> > currently available in the Linux force feedback userspace API. All
> > effects are handled in accordance with Microsoft's DirectInput/XInput.
> > Most notable changes include support for conditional effects, proper
> > handling of all periodic waveforms and improved emulation of rumble
> > effects through periodic effects. MLNX also uses its own kernel API to
> > pass processed effects to hardware-specific drivers instead of abusing
> > "ff_effect" struct. The API is documented in the respective header file.
> >
> > MLNX has been expanded to be a direct replacement for FFML.
> >
> > Support for FF_PERIODIC and FF_RAMP has been added to all devices that
> > support FF_CONSTANT as a part of the port to the new API.
> >
> > This patch series:
> > 1) Adds "ff-memless-next" module [1]
> > 2) Ports all hardware-specific drivers to MLNX's API [2-23]
> > 3) Removes FFML and replaces it with MLNX [24]
>
> Dmitry,
>
> what are your plans with this, please?
>
> I personally don't really completely like having two implementations of FF
> in the kernel; can't it be really done as an extension to ff-memless?
There will be no duplication. This patchset fully replaces "ff-memless" with
"ff-memless-next". Even though "ff-memless-next" is basically an extended
version of "ff-memless", the extent of the changes makes it look very much like
a rewrite.
If you are concerned about any confusion due to the "ff-memless" -> "ff-memless-
next" name change I can modify the code to make it look like "ff-memless" if
you think that'd be more appropriate. However, given the scope of the changes
I considered it a better idea to implement this as a new driver to make it
clear that ff-memless-next behaves differently from the HW-specific drivers'
perspective.
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [PATCH] HID: i2c-hid: hid report descriptor retrieval changes
From: Patni, Archana @ 2014-05-12 9:39 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: Archana Patni, jic23@kernel.org, linux-input, Westerberg, Mika,
Pandruvada, Srinivas, Sesha, Subramony
In-Reply-To: <alpine.LNX.2.00.1405121056000.5813@pobox.suse.cz>
> -----Original Message-----
> From: Jiri Kosina [mailto:jkosina@suse.cz]
> Sent: Monday, May 12, 2014 2:27 PM
> To: Benjamin Tissoires
> Cc: Archana Patni; jic23@kernel.org; linux-input; Westerberg, Mika;
> Pandruvada, Srinivas; Patni, Archana; Sesha, Subramony
> Subject: Re: [PATCH] HID: i2c-hid: hid report descriptor retrieval changes
>
> On Thu, 8 May 2014, Benjamin Tissoires wrote:
>
> > > Reading the partial HID Descriptor is causing a firmware lockup in
> > > some sensor hubs. Instead of a partial read, this patch implements
> > > the i2c hid fetch using a fixed descriptor size (30 bytes) followed
> > > by a verification of the BCDVersion (V01.00), and value stored in
> > > wHIDDescLength (30 Bytes) for V1.00 descriptors.
> > >
> > > As per i2c hid spec, this is the preferred model.
> > >
> > > From hid-over-i2c-protocol-spec-v1-0:
> > >
> > > There are a variety of ways a HOST may choose to retrieve
> > > the HID Descriptor from the DEVICE. The following is a preferred
> > > implementation but should not be considered the only implementation.
> > > A HOST may read the entire HID Descriptor in a single read by
> > > issuing a read for 30 Bytes to get the entire HID Descriptor
> > > from the DEVICE.However, the HOST is responsible for validating
> > > that
> > >
> > > 1. The BCDVersion is V01.00 (later revisions may have different
> > > descriptor lengths), and
> > >
> > > 2. The value stored in wHIDDescLength is 30 (Bytes) for V1.00
> > > descriptors.
> > >
> > > Reported-by: Joe Tijerina <joe.tijerina@st.com>
> > > Signed-off-by: Archana Patni <archana.patni@intel.com>
> > > Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
> > > Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > > ---
> >
> > This one is Reviewed-by: Benjamin Tissoires
> > <benjamin.tissoires@redhat.com>
>
> Do we have any indication about how frequently are the lockups actually
> happening in the wild? Is this a regression? (I don't think so).
For a few devices, this behavior always occurs. This is not a regression.
>
> The reason I am asking is whether I should rush this in for 3.15 still, but as the
> patch doesn't have stable annotation anyway, my understanding is that 3.16
> is enough?
3.16 is fine.
Thanks
Archana
>
> Thanks,
>
> --
> Jiri Kosina
> SUSE Labs
^ permalink raw reply
* Re: [PATCH 2/2] input: atmel-wm97xx: only build for AVR32
From: Nicolas Ferre @ 2014-05-12 13:16 UTC (permalink / raw)
To: Arnd Bergmann, linux-arm-kernel, Dmitry Torokhov, linux-input,
Liam Girdwood
Cc: linux-kernel, Mark Brown
In-Reply-To: <1399560990-1402858-16-git-send-email-arnd@arndb.de>
On 08/05/2014 16:56, Arnd Bergmann :
> Building this driver on ARM/at91 always gives us this error message:
>
> drivers/input/touchscreen/atmel-wm97xx.c:63:2: error: #error Unknown CPU, this driver only supports AT32AP700X CPUs.
>
> Clearly this configuration is not meant to work, so let's just prevent
> it in Kconfig. If we ever want to use it on another platform, we should
> also pass proper resources for GPIO, IRQ and memory, which are hardcoded
> to AT32AP700X at the moment.
Yes it seems so:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Liam Girdwood <lrg@slimlogic.co.uk>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> ---
> drivers/input/touchscreen/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index e2f0264..fe4c264 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -640,7 +640,7 @@ config TOUCHSCREEN_WM9713
>
> config TOUCHSCREEN_WM97XX_ATMEL
> tristate "WM97xx Atmel accelerated touch"
> - depends on TOUCHSCREEN_WM97XX && (AVR32 || ARCH_AT91)
> + depends on TOUCHSCREEN_WM97XX && AVR32
> help
> Say Y here for support for streaming mode with WM97xx touchscreens
> on Atmel AT91 or AVR32 systems with an AC97C module.
>
--
Nicolas Ferre
^ permalink raw reply
* [PATCH] input: gpio-keys: Move the gpio-keys bindings documentation
From: Ezequiel Garcia @ 2014-05-12 14:33 UTC (permalink / raw)
To: devicetree, linux-gpio, linux-input
Cc: Dmitry Torokhov, Linus Walleij, Ezequiel Garcia
This is an input driver and belongs to input not gpio.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
.../devicetree/bindings/gpio/gpio_keys.txt | 36 ----------------------
.../devicetree/bindings/input/gpio-keys.txt | 36 ++++++++++++++++++++++
2 files changed, 36 insertions(+), 36 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_keys.txt
create mode 100644 Documentation/devicetree/bindings/input/gpio-keys.txt
diff --git a/Documentation/devicetree/bindings/gpio/gpio_keys.txt b/Documentation/devicetree/bindings/gpio/gpio_keys.txt
deleted file mode 100644
index 5c2c021..0000000
--- a/Documentation/devicetree/bindings/gpio/gpio_keys.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Device-Tree bindings for input/gpio_keys.c keyboard driver
-
-Required properties:
- - compatible = "gpio-keys";
-
-Optional properties:
- - autorepeat: Boolean, Enable auto repeat feature of Linux input
- subsystem.
-
-Each button (key) is represented as a sub-node of "gpio-keys":
-Subnode properties:
-
- - gpios: OF device-tree gpio specification.
- - label: Descriptive name of the key.
- - linux,code: Keycode to emit.
-
-Optional subnode-properties:
- - linux,input-type: Specify event type this button/key generates.
- If not specified defaults to <1> == EV_KEY.
- - debounce-interval: Debouncing interval time in milliseconds.
- If not specified defaults to 5.
- - gpio-key,wakeup: Boolean, button can wake-up the system.
-
-Example nodes:
-
- gpio_keys {
- compatible = "gpio-keys";
- #address-cells = <1>;
- #size-cells = <0>;
- autorepeat;
- button@21 {
- label = "GPIO Key UP";
- linux,code = <103>;
- gpios = <&gpio1 0 1>;
- };
- ...
diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt b/Documentation/devicetree/bindings/input/gpio-keys.txt
new file mode 100644
index 0000000..5c2c021
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/gpio-keys.txt
@@ -0,0 +1,36 @@
+Device-Tree bindings for input/gpio_keys.c keyboard driver
+
+Required properties:
+ - compatible = "gpio-keys";
+
+Optional properties:
+ - autorepeat: Boolean, Enable auto repeat feature of Linux input
+ subsystem.
+
+Each button (key) is represented as a sub-node of "gpio-keys":
+Subnode properties:
+
+ - gpios: OF device-tree gpio specification.
+ - label: Descriptive name of the key.
+ - linux,code: Keycode to emit.
+
+Optional subnode-properties:
+ - linux,input-type: Specify event type this button/key generates.
+ If not specified defaults to <1> == EV_KEY.
+ - debounce-interval: Debouncing interval time in milliseconds.
+ If not specified defaults to 5.
+ - gpio-key,wakeup: Boolean, button can wake-up the system.
+
+Example nodes:
+
+ gpio_keys {
+ compatible = "gpio-keys";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ autorepeat;
+ button@21 {
+ label = "GPIO Key UP";
+ linux,code = <103>;
+ gpios = <&gpio1 0 1>;
+ };
+ ...
--
1.9.1
^ permalink raw reply related
* Felicitări
From: United Nations @ 2014-05-12 15:22 UTC (permalink / raw)
Felicitări
Sunteți unul dintre beneficiarii de pe ordinea de zi a Națiunilor Unite 2014/2015 Grant Award. Informațiile dvs. au fost verificate și suma de șase milioane de euro (6.000.000,00) a fost acordat pentru a vă în programul de granturi al Națiunilor Unite ca Date tale au fost listate pe lista câștigătoare.
Această sumă urmează a fi utilizate de dumneavoastră pentru orice scop, de care vor beneficia foloseste comunitatea ta.
Informațiile de care avem nevoie pentru verificare sunt:
Numele complet:
adresa:
Următor de Kin:
Va oferi, de asemenea, un cont bancar care premiile de finanțare ar trebui să fie depus în. Veți avea nevoie, de asemenea, să plătească doar o taxă administrativă de 721 de euro (șapte sute douăzeci și unu de euro).
Ajunge înapoi la noi cât mai curând posibil, astfel încât să puteți trimite certificatul câștigătoare.
Biroul Organizației Națiunilor Unite.
2014/2015
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] HID: i2c-hid: Support batch read of input events from fifo
From: Benjamin Tissoires @ 2014-05-12 16:03 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: Archana Patni, Jiri Kosina, Jonathan Cameron, linux-input,
Mika Westerberg, Pandruvada, Srinivas, Archana Patni,
Subramony Sesha
In-Reply-To: <536E7473.4080502@linux.intel.com>
Hi Srinivas,
On Sat, May 10, 2014 at 2:48 PM, Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> Hi Benjamin,
>
> On 05/08/2014 07:28 AM, Benjamin Tissoires wrote:
>>
>> On Thu, May 8, 2014 at 9:32 AM, Archana Patni
>> <archana.patni@linux.intel.com> wrote:
>>>
>>> Some i2c_hid devices like a sensor hub have built-in fifos which
>>> can accumulate input events in their buffers and trigger an interrupt
>>> at end of a user defined event like fifo full or a timeout. The current
>>> implementation reads one event at a time in the IRQ handler leading to
>>> several hundred interrupts being necessary to flush the fifo.
>>>
>>> This patch changes the threaded IRQ handler to keep input events until
>>> there are no input events left to read. In the normal case, this will
>>> invoke one additional call to fetch an input event to check for no
>>> pending
>>> events and terminate the loop.
>>
>> I must say, I don't like this patch.
>> It seems to me that it will solve your problem but will break other
>> devices. Nothing in the spec says what happens if the host tries to
>> read while the interrupt line is *not* asserted. I can easily imagine
>> several scenarios where the device would hang until the next available
>> data, or will just fail.
>>
>> So the proper way according to the spec is to check the status of the
>> interrupt line. This line is the responsibility of the device to be
>> asserted and we should rely on it to know if we can read again.
>>
>> However, a quick check on the interrupt API did not provide me the
>> function I would like, so I guess this is something to be work on.
>>
>> I can not ack this one until we can be sure not breaking other stuff.
>>
>> So: NACK.
>
> I understand your reason, there may be some HID device which will have issue
> with this change.
> I am interested in throwing some idea, as I am trying to keep the devices in
> deepest idle states as
> long as possible. Sensors are one of the offenders.
> - This driver can register i2c_driver, command callback. We can define one
> of the command to set the set the max size dynamically or fire this logic to
> empty buffers. This way, we can only enable such logic, when a sensor hub
> has capability and notifies this capability dynamically without affecting
> any other hid devices.
I am OK with the logic as long as the i2c calls are independent of the
HID layer. Remember that if the advertised bus is BUS_I2C, it might as
well be an uhid device which will not handle the i2c calls.
Another solution could be to add a HID quirk which triggers the "empty
while input are here" and set this quirk in hid-sensor-hub. This way,
you will be in control of it and other devices might use it as well if
they support it.
I am not a big fan of quirks, so I would still prefer your solution if
you can control it without disturbing the HID subsystem. This will all
depend where you can enable the functionality on the device.
Cheers,
Benjamin
>
> Thanks,
> Srinivas
>
>
>> Cheers,
>> Benjamin
>>
>>> Signed-off-by: Archana Patni <archana.patni@intel.com>
>>> Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
>>> Reviewed-by: Mika Westerberg <mika.westerberg@intel.com>
>>> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
>>> ---
>>> drivers/hid/i2c-hid/i2c-hid.c | 20 +++++++++++++-------
>>> 1 file changed, 13 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/hid/i2c-hid/i2c-hid.c
>>> b/drivers/hid/i2c-hid/i2c-hid.c
>>> index 21aafc8..3f09a50 100644
>>> --- a/drivers/hid/i2c-hid/i2c-hid.c
>>> +++ b/drivers/hid/i2c-hid/i2c-hid.c
>>> @@ -52,6 +52,7 @@
>>> static bool debug;
>>> module_param(debug, bool, 0444);
>>> MODULE_PARM_DESC(debug, "print a lot of debug information");
>>> +#define MAX_INPUT_EVENT_READ 100
>>>
>>> #define i2c_hid_dbg(ihid, fmt, arg...)
>>> \
>>> do {
>>> \
>>> @@ -366,7 +367,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
>>> return 0;
>>> }
>>>
>>> -static void i2c_hid_get_input(struct i2c_hid *ihid)
>>> +static int i2c_hid_get_input(struct i2c_hid *ihid)
>>> {
>>> int ret, ret_size;
>>> int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
>>> @@ -374,11 +375,11 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>>> ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
>>> if (ret != size) {
>>> if (ret < 0)
>>> - return;
>>> + return ret;
>>>
>>> dev_err(&ihid->client->dev, "%s: got %d data instead of
>>> %d\n",
>>> __func__, ret, size);
>>> - return;
>>> + return -EIO;
>>> }
>>>
>>> ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8;
>>> @@ -387,13 +388,13 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>>> /* host or device initiated RESET completed */
>>> if (test_and_clear_bit(I2C_HID_RESET_PENDING,
>>> &ihid->flags))
>>> wake_up(&ihid->wait);
>>> - return;
>>> + return 0;
>>> }
>>>
>>> if (ret_size > size) {
>>> dev_err(&ihid->client->dev, "%s: incomplete report
>>> (%d/%d)\n",
>>> __func__, size, ret_size);
>>> - return;
>>> + return -EIO;
>>> }
>>>
>>> i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
>>> @@ -402,17 +403,22 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>>> hid_input_report(ihid->hid, HID_INPUT_REPORT,
>>> ihid->inbuf + 2,
>>> ret_size - 2, 1);
>>>
>>> - return;
>>> + return 1;
>>> }
>>>
>>> static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
>>> {
>>> struct i2c_hid *ihid = dev_id;
>>> + int ret;
>>> + int count = 0;
>>>
>>> if (test_bit(I2C_HID_READ_PENDING, &ihid->flags))
>>> return IRQ_HANDLED;
>>> + do {
>>> + count++;
>>> + ret = i2c_hid_get_input(ihid);
>>>
>>> - i2c_hid_get_input(ihid);
>>> + } while (count < MAX_INPUT_EVENT_READ && ret > 0);
>>>
>>> return IRQ_HANDLED;
>>> }
>>> --
>>> 1.7.9.5
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-input" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-input" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
^ permalink raw reply
* [PATCH] Input: trivial: fix typo in Kconfig help
From: Daniele Forsi @ 2014-05-12 16:24 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Jiri Kosina, linux-input, Daniele Forsi
s/Logictech/Logitech/
CC: Jiri Kosina <trivial@kernel.org>
Signed-off-by: Daniele Forsi <dforsi@gmail.com>
---
drivers/input/mouse/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index effa9c5..ff9b65d 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -53,7 +53,7 @@ config MOUSE_PS2_LOGIPS2PP
default y
depends on MOUSE_PS2
help
- Say Y here if you have a Logictech PS/2++ mouse connected to
+ Say Y here if you have a Logitech PS/2++ mouse connected to
your system.
If unsure, say Y.
--
2.0.0.rc0
^ permalink raw reply related
* Re: [PATCH] input: gpio-keys: Move the gpio-keys bindings documentation
From: Dmitry Torokhov @ 2014-05-12 17:58 UTC (permalink / raw)
To: Ezequiel Garcia; +Cc: devicetree, linux-gpio, linux-input, Linus Walleij
In-Reply-To: <1399905224-1273-1-git-send-email-ezequiel.garcia@free-electrons.com>
On Mon, May 12, 2014 at 11:33:44AM -0300, Ezequiel Garcia wrote:
> This is an input driver and belongs to input not gpio.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Fine by me, will DT guys pick the patch or shoudl I do it?
Thanks!
> ---
> .../devicetree/bindings/gpio/gpio_keys.txt | 36 ----------------------
> .../devicetree/bindings/input/gpio-keys.txt | 36 ++++++++++++++++++++++
> 2 files changed, 36 insertions(+), 36 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_keys.txt
> create mode 100644 Documentation/devicetree/bindings/input/gpio-keys.txt
>
> diff --git a/Documentation/devicetree/bindings/gpio/gpio_keys.txt b/Documentation/devicetree/bindings/gpio/gpio_keys.txt
> deleted file mode 100644
> index 5c2c021..0000000
> --- a/Documentation/devicetree/bindings/gpio/gpio_keys.txt
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -Device-Tree bindings for input/gpio_keys.c keyboard driver
> -
> -Required properties:
> - - compatible = "gpio-keys";
> -
> -Optional properties:
> - - autorepeat: Boolean, Enable auto repeat feature of Linux input
> - subsystem.
> -
> -Each button (key) is represented as a sub-node of "gpio-keys":
> -Subnode properties:
> -
> - - gpios: OF device-tree gpio specification.
> - - label: Descriptive name of the key.
> - - linux,code: Keycode to emit.
> -
> -Optional subnode-properties:
> - - linux,input-type: Specify event type this button/key generates.
> - If not specified defaults to <1> == EV_KEY.
> - - debounce-interval: Debouncing interval time in milliseconds.
> - If not specified defaults to 5.
> - - gpio-key,wakeup: Boolean, button can wake-up the system.
> -
> -Example nodes:
> -
> - gpio_keys {
> - compatible = "gpio-keys";
> - #address-cells = <1>;
> - #size-cells = <0>;
> - autorepeat;
> - button@21 {
> - label = "GPIO Key UP";
> - linux,code = <103>;
> - gpios = <&gpio1 0 1>;
> - };
> - ...
> diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt b/Documentation/devicetree/bindings/input/gpio-keys.txt
> new file mode 100644
> index 0000000..5c2c021
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/gpio-keys.txt
> @@ -0,0 +1,36 @@
> +Device-Tree bindings for input/gpio_keys.c keyboard driver
> +
> +Required properties:
> + - compatible = "gpio-keys";
> +
> +Optional properties:
> + - autorepeat: Boolean, Enable auto repeat feature of Linux input
> + subsystem.
> +
> +Each button (key) is represented as a sub-node of "gpio-keys":
> +Subnode properties:
> +
> + - gpios: OF device-tree gpio specification.
> + - label: Descriptive name of the key.
> + - linux,code: Keycode to emit.
> +
> +Optional subnode-properties:
> + - linux,input-type: Specify event type this button/key generates.
> + If not specified defaults to <1> == EV_KEY.
> + - debounce-interval: Debouncing interval time in milliseconds.
> + If not specified defaults to 5.
> + - gpio-key,wakeup: Boolean, button can wake-up the system.
> +
> +Example nodes:
> +
> + gpio_keys {
> + compatible = "gpio-keys";
> + #address-cells = <1>;
> + #size-cells = <0>;
> + autorepeat;
> + button@21 {
> + label = "GPIO Key UP";
> + linux,code = <103>;
> + gpios = <&gpio1 0 1>;
> + };
> + ...
> --
> 1.9.1
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH] Input: trivial: fix typo in Kconfig help
From: Dmitry Torokhov @ 2014-05-12 17:59 UTC (permalink / raw)
To: Daniele Forsi; +Cc: Jiri Kosina, linux-input
In-Reply-To: <1399911842-28081-1-git-send-email-dforsi@gmail.com>
On Mon, May 12, 2014 at 06:24:02PM +0200, Daniele Forsi wrote:
> s/Logictech/Logitech/
>
> CC: Jiri Kosina <trivial@kernel.org>
> Signed-off-by: Daniele Forsi <dforsi@gmail.com>
Applied, thank you.
> ---
> drivers/input/mouse/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
> index effa9c5..ff9b65d 100644
> --- a/drivers/input/mouse/Kconfig
> +++ b/drivers/input/mouse/Kconfig
> @@ -53,7 +53,7 @@ config MOUSE_PS2_LOGIPS2PP
> default y
> depends on MOUSE_PS2
> help
> - Say Y here if you have a Logictech PS/2++ mouse connected to
> + Say Y here if you have a Logitech PS/2++ mouse connected to
> your system.
>
> If unsure, say Y.
> --
> 2.0.0.rc0
>
--
Dmitry
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox