Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH 2/2] Input: raspberrypi-ts - add devicetree binding documentation
From: Nicolas Saenz Julienne @ 2018-12-10 16:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-rpi-kernel, stefan.wahren, eric, agraf,
	Nicolas Saenz Julienne, Dmitry Torokhov, Rob Herring,
	Mark Rutland, linux-input, devicetree
In-Reply-To: <20181210163036.24813-1-nsaenzjulienne@suse.de>

Adds device tree documentation for Raspberry Pi's official 7"
touchscreen.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 .../touchscreen/raspberrypi,firmware-ts.txt   | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/raspberrypi,firmware-ts.txt

diff --git a/Documentation/devicetree/bindings/input/touchscreen/raspberrypi,firmware-ts.txt b/Documentation/devicetree/bindings/input/touchscreen/raspberrypi,firmware-ts.txt
new file mode 100644
index 000000000000..38e22eb222e9
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/raspberrypi,firmware-ts.txt
@@ -0,0 +1,26 @@
+Raspberry Pi 3 firmware based 7" touchscreen
+=====================================
+
+Required properties:
+ - compatible: "raspberrypi,firmware-ts"
+
+Optional properties:
+ - firmware: Reference to RPi's firmware device node
+ - touchscreen-size-x: See touchscreen.txt
+ - touchscreen-size-y: See touchscreen.txt
+ - touchscreen-inverted-x: See touchscreen.txt
+ - touchscreen-inverted-y: See touchscreen.txt
+ - touchscreen-swapped-x-y: See touchscreen.txt
+
+Example:
+
+firmware: firmware-rpi {
+	compatible = "raspberrypi,bcm2835-firmware";
+	mboxes = <&mailbox>;
+
+	ts: touchscreen {
+		compatible = "raspberrypi,firmware-ts";
+		touchscreen-size-x = <800>;
+		touchscreen-size-y = <480>;
+	};
+};
-- 
2.19.2

^ permalink raw reply related

* [PATCH 1/2] input: add official Raspberry Pi's touchscreen driver
From: Nicolas Saenz Julienne @ 2018-12-10 16:30 UTC (permalink / raw)
  To: Henrik Rydberg
  Cc: linux-rpi-kernel, stefan.wahren, eric, agraf,
	Nicolas Saenz Julienne, Dmitry Torokhov, Eugen Hristev,
	Rob Herring, Mark Jonas, Zhu Yi, Hans de Goede, Masanari Iida,
	Corentin Labbe, Hans-Christian Noren Egtvedt, linux-kernel,
	linux-input
In-Reply-To: <20181210163036.24813-1-nsaenzjulienne@suse.de>

Add's support to Raspberry Pi's 7" Touch device. Instead of using a
conventional bus all information is copied into a memory mapped area by
RPi's firmware.

Based on the driver found in RPi's kernel repository.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 drivers/input/touchscreen/Kconfig          |  12 ++
 drivers/input/touchscreen/Makefile         |   1 +
 drivers/input/touchscreen/raspberrypi-ts.c | 223 +++++++++++++++++++++
 3 files changed, 236 insertions(+)
 create mode 100644 drivers/input/touchscreen/raspberrypi-ts.c

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 2a80675cfd94..a9be434de738 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -696,6 +696,18 @@ config TOUCHSCREEN_EDT_FT5X06
 	  To compile this driver as a module, choose M here: the
 	  module will be called edt-ft5x06.
 
+config TOUCHSCREEN_RASPBERRYPI_TS
+	tristate "Raspberry Pi's firmware base touch screen support"
+	depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST
+	help
+	  Say Y here if you have the offitial Raspberry Pi 7' scren on your
+	  system.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called raspberrypi-ts.
+
 config TOUCHSCREEN_MIGOR
 	tristate "Renesas MIGO-R touchscreen"
 	depends on (SH_MIGOR || COMPILE_TEST) && I2C
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 5911a4190cd2..3eccb1925e89 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -109,3 +109,4 @@ obj-$(CONFIG_TOUCHSCREEN_ZET6223)	+= zet6223.o
 obj-$(CONFIG_TOUCHSCREEN_ZFORCE)	+= zforce_ts.o
 obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50)	+= colibri-vf50-ts.o
 obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023)	+= rohm_bu21023.o
+obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_TS)	+= raspberrypi-ts.o
diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c
new file mode 100644
index 000000000000..edc92018687e
--- /dev/null
+++ b/drivers/input/touchscreen/raspberrypi-ts.c
@@ -0,0 +1,223 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Raspberry Pi 3 firmware based touchscreen driver
+ *
+ * Copyright (C) 2015, 2017 Raspberry Pi
+ * Copyright (C) 2018 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
+ */
+
+#include <linux/io.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/bitops.h>
+#include <linux/dma-mapping.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/input/mt.h>
+#include <linux/input-polldev.h>
+#include <linux/input/touchscreen.h>
+#include <soc/bcm2835/raspberrypi-firmware.h>
+
+#define RPI_TS_DEFAULT_WIDTH	800
+#define RPI_TS_DEFAULT_HEIGHT	480
+
+#define RPI_TS_MAX_SUPPORTED_POINTS	10
+
+#define RPI_TS_FTS_TOUCH_DOWN		0
+#define RPI_TS_FTS_TOUCH_CONTACT	2
+
+#define RPI_TS_POLL_INTERVAL		17	/* 60fps */
+
+struct rpi_ts {
+	struct platform_device *pdev;
+	struct input_polled_dev *poll_dev;
+	struct touchscreen_properties prop;
+
+	void __iomem *fw_regs_va;
+	dma_addr_t fw_regs_phys;
+
+	int known_ids;
+};
+
+struct rpi_ts_regs {
+	u8 device_mode;
+	u8 gesture_id;
+	u8 num_points;
+	struct rpi_ts_touch {
+		u8 xh;
+		u8 xl;
+		u8 yh;
+		u8 yl;
+		u8 pressure; /* Not supported */
+		u8 area;     /* Not supported */
+	} point[RPI_TS_MAX_SUPPORTED_POINTS];
+};
+
+/*
+ * We poll the memory based register copy of the touchscreen chip using the
+ * number of points register to know whether the copy has been updated (we
+ * write 99 to the memory copy, the GPU will write between 0 - 10 points)
+ */
+static void rpi_ts_poll(struct input_polled_dev *dev)
+{
+	struct input_dev *input = dev->input;
+	struct rpi_ts *ts = dev->private;
+	struct rpi_ts_regs regs;
+	int modified_ids = 0;
+	long released_ids;
+	int event_type;
+	int touchid;
+	int x, y;
+	int i;
+
+	memcpy_fromio(&regs, ts->fw_regs_va, sizeof(regs));
+	iowrite8(99, ts->fw_regs_va + offsetof(struct rpi_ts_regs, num_points));
+
+	if (regs.num_points == 99 ||
+	    (regs.num_points == 0 && ts->known_ids == 0))
+	    return;
+
+	for (i = 0; i < regs.num_points; i++) {
+		x = (((int)regs.point[i].xh & 0xf) << 8) + regs.point[i].xl;
+		y = (((int)regs.point[i].yh & 0xf) << 8) + regs.point[i].yl;
+		touchid = (regs.point[i].yh >> 4) & 0xf;
+		event_type = (regs.point[i].xh >> 6) & 0x03;
+
+		modified_ids |= BIT(touchid);
+
+		if (event_type == RPI_TS_FTS_TOUCH_DOWN ||
+		    event_type == RPI_TS_FTS_TOUCH_CONTACT) {
+			input_mt_slot(input, touchid);
+			input_mt_report_slot_state(input, MT_TOOL_FINGER, 1);
+			touchscreen_report_pos(input, &ts->prop, x, y, true);
+		}
+	}
+
+	released_ids = ts->known_ids & ~modified_ids;
+	for_each_set_bit(i, &released_ids, RPI_TS_MAX_SUPPORTED_POINTS) {
+		input_mt_slot(input, i);
+		input_mt_report_slot_state(input, MT_TOOL_FINGER, 0);
+		modified_ids &= ~(BIT(i));
+	}
+	ts->known_ids = modified_ids;
+
+	input_mt_sync_frame(input);
+	input_sync(input);
+}
+
+static void rpi_ts_dma_cleanup(void *data)
+{
+	struct rpi_ts *ts = data;
+	struct device *dev = &ts->pdev->dev;
+
+	if(ts->fw_regs_va)
+		dma_free_coherent(dev, PAGE_SIZE, ts->fw_regs_va,
+				  ts->fw_regs_phys);
+}
+
+static int rpi_ts_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	struct input_polled_dev *poll_dev;
+	struct device_node *fw_node;
+	struct rpi_firmware *fw;
+	struct input_dev *input;
+	struct rpi_ts *ts;
+	u32 touchbuf;
+	int ret;
+
+	fw_node = of_get_parent(np);
+	if (!fw_node) {
+		dev_err(dev, "Missing firmware node\n");
+		return -ENOENT;
+	}
+
+	fw = rpi_firmware_get(fw_node);
+	of_node_put(fw_node);
+	if (!fw)
+		return -EPROBE_DEFER;
+
+	ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
+	if (!ts) {
+		dev_err(dev, "Failed to allocate memory\n");
+		return -ENOMEM;
+	}
+	ts->pdev = pdev;
+
+	ret = devm_add_action_or_reset(dev, rpi_ts_dma_cleanup, ts);
+	if (ret)
+		return ret;
+
+	ts->fw_regs_va = dma_zalloc_coherent(dev, PAGE_SIZE, &ts->fw_regs_phys,
+					     GFP_KERNEL);
+	if (!ts->fw_regs_va) {
+		dev_err(dev, "failed to dma_alloc_coherent\n");
+		return -ENOMEM;
+	}
+
+	touchbuf = (u32)ts->fw_regs_phys;
+	ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF,
+				    &touchbuf, sizeof(touchbuf));
+
+	if (ret || touchbuf != 0) {
+		dev_warn(dev, "Failed to set touchbuf, trying to get err:%x\n",
+			 ret);
+		return ret;
+	}
+
+	poll_dev = devm_input_allocate_polled_device(dev);
+	if (!poll_dev) {
+		dev_err(dev, "Failed to allocate input device\n");
+		return -ENOMEM;
+	}
+	ts->poll_dev = poll_dev;
+	input = poll_dev->input;
+
+	input->name = "raspberrypi-ts";
+	input->id.bustype = BUS_HOST;
+	poll_dev->poll_interval = RPI_TS_POLL_INTERVAL;
+	poll_dev->poll = rpi_ts_poll;
+	poll_dev->private = ts;
+
+	__set_bit(EV_SYN, input->evbit);
+	__set_bit(EV_KEY, input->evbit);
+	__set_bit(EV_ABS, input->evbit);
+
+	input_set_abs_params(input, ABS_MT_POSITION_X, 0,
+			     RPI_TS_DEFAULT_WIDTH, 0, 0);
+	input_set_abs_params(input, ABS_MT_POSITION_Y, 0,
+			     RPI_TS_DEFAULT_HEIGHT, 0, 0);
+	touchscreen_parse_properties(input, true, &ts->prop);
+
+	input_mt_init_slots(input, RPI_TS_MAX_SUPPORTED_POINTS,
+			    INPUT_MT_DIRECT | INPUT_MT_POINTER);
+
+	ret = input_register_polled_device(poll_dev);
+	if (ret) {
+		dev_err(dev, "could not register input device, %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static const struct of_device_id rpi_ts_match[] = {
+	{ .compatible = "raspberrypi,firmware-ts", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rpi_ts_match);
+
+static struct platform_driver rpi_ts_driver = {
+	.driver = {
+		.name   = "raspberrypi-ts",
+		.of_match_table = rpi_ts_match,
+	},
+	.probe          = rpi_ts_probe,
+};
+module_platform_driver(rpi_ts_driver);
+
+MODULE_AUTHOR("Gordon Hollingworth");
+MODULE_AUTHOR("Nicolas Saenz Julienne <nsaenzjulienne@suse.de>");
+MODULE_DESCRIPTION("Raspberry Pi 3 firmware based touchscreen driver");
+MODULE_LICENSE("GPL v2");
-- 
2.19.2

^ permalink raw reply related

* [PATCH 0/2] input: driver for RPi's official 7" touchscreen
From: Nicolas Saenz Julienne @ 2018-12-10 16:30 UTC (permalink / raw)
  To: linux-input
  Cc: linux-rpi-kernel, stefan.wahren, eric, agraf,
	Nicolas Saenz Julienne, Dmitry Torokhov, Rob Herring, Mark Jonas,
	Hans-Christian Noren Egtvedt, Zhu Yi, Masanari Iida,
	Corentin Labbe, Eugen Hristev, Hans de Goede, devicetree,
	linux-kernel

This small series adds support for Raspberry pi's 7" touchscreen. Which
alongside with the backlight driver are the last devices needed to have
a functional touchscreen upstream.

With this setup the board's VC4 firmware takes care of communicating
with the touch chip and provides data though a shared memory area
provided by the driver. The driver takes care of polling the firmware
whenever at around 60Hz since there is no interrupt line available.

The 1.0 revision of the touchscreen is based on the ft5426 chip.
Technically, with some changes in edt-ft54x4.c we should be able to
access the data directly through I2C. Yet this bus is meant to be owned
by RPi's firmware and might access it anytime. For example, to
configure RPi's camera device. As sharing the bus master interface is
not possible a series of alternatives have been tested unsuccessfully
[1]. It seems that we'll be unable to access the chip directly in a
"clean" way which leaves us with this firmware based solution.

The driver was rewritten based on the one available on the downstream
Raspberry Pi kernel tree: https://github.com/raspberrypi/linux/.

This series is based on v4.20-rc6 and was tested on a RPi 3 B+.

Changelog

RFC -> PATCH:
  - Better dependencies check in Kconfig
  - Add SPDX tag
  - Use polled input device API
  - Use input_mt_sync_frame()
  - Drop reference from dt node in probe
  - Use devm where possible
  - Small cosmetic changes

[1] https://lists.infradead.org/pipermail/linux-rpi-kernel/2018-December/008444.html
===

Nicolas Saenz Julienne (2):
  input: add official Raspberry Pi's touchscreen driver
  Input: raspberrypi-ts - add devicetree binding documentation

 .../touchscreen/raspberrypi,firmware-ts.txt   |  26 ++
 drivers/input/touchscreen/Kconfig             |  12 +
 drivers/input/touchscreen/Makefile            |   1 +
 drivers/input/touchscreen/raspberrypi-ts.c    | 223 ++++++++++++++++++
 4 files changed, 262 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/raspberrypi,firmware-ts.txt
 create mode 100644 drivers/input/touchscreen/raspberrypi-ts.c

-- 
2.19.2

^ permalink raw reply

* [PATCH] Input: touchscreen: ad7879: Fix ERROR: foo* bar should be "foo *bar"
From: Hardik Singh Rathore @ 2018-12-10 15:44 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: michael.hennerich, linux-input, linux-kernel,
	Hardik Singh Rathore

Fix the coding style problem reported by checkpatch.pl.

Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com>
---
 drivers/input/touchscreen/ad7879.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 6bad23ee47a1..b68902c17f2e 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -290,7 +290,7 @@ static int ad7879_open(struct input_dev *input)
 	return 0;
 }
 
-static void ad7879_close(struct input_dev* input)
+static void ad7879_close(struct input_dev *input)
 {
 	struct ad7879 *ts = input_get_drvdata(input);
 
-- 
2.17.1

^ permalink raw reply related

* Re: [PATCH 1/2] Input: omap-keypad: Fix keyboard debounce configuration
From: Tony Lindgren @ 2018-12-10 14:32 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Dmitry Torokhov, linux-input, linux-kernel, linux-omap,
	Axel Haslam, Felipe Balbi, Illia Smyrnov, Marcel Partap,
	Merlijn Wajer, Michael Scott, NeKit, Sebastian Reichel
In-Reply-To: <20181209115648.GA23309@amd>

* Pavel Machek <pavel@ucw.cz> [181209 11:56]:
> So, if I press key "." quickly on console in
> 4.18.0-rc4-88970-gf075a2c-dirty it starts repeating. I could reproduce
> it 3 times from tree tries. Then I decided to test your patch, and so
> I booted 4.20-rc5+ using kexec. Turns out, I can't reproduce that
> repeat there... I tried more than 10 times. But that's before your
> patch.
> 
> So -- bad news for you -- seems like someone -- maybe you -- already
> fixed this. (But that does not mean the patch is bad idea).

Hmm OK thanks for testing. For me it recently started happening before
this fix, often when logging in as root on the console using the keypad
where I'd start seeing roooooooot instead of root.

Regards,

Tony

^ permalink raw reply

* Re: [PATCH] Input: restore EV_ABS ABS_RESERVED
From: Jiri Kosina @ 2018-12-10 10:24 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Dmitry Torokhov, Peter Hutterer, Martin Kepplinger, linux-input,
	linux-kernel
In-Reply-To: <CAN+gG=ErkuyRNprp0b7i93pqPH2J4Tz1KTyVJTLTmBWJV2NeVg@mail.gmail.com>

On Fri, 7 Dec 2018, Benjamin Tissoires wrote:

> OK, thanks Dmitry.
> 
> Jiri, I have pushed this in for-4.20/upstream-fixes.
> 
> I think the branch has enough now to justify a PR towards Linus.

Agreed. I will be sending it today. Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH -next] input: keyboard: remove duplicated include from mtk-pmic-keys.c
From: Lee Jones @ 2018-12-10 10:07 UTC (permalink / raw)
  To: YueHaibing
  Cc: dmitry.torokhov, matthias.bgg, chen.zhong, linux-kernel,
	linux-mediatek, linux-arm-kernel, linux-input
In-Reply-To: <4f1a67e5-b735-f8bd-88b8-3a1ca590eba2@huawei.com>

On Mon, 10 Dec 2018, YueHaibing wrote:

> On 2018/12/10 14:15, Lee Jones wrote:
> > On Sun, 09 Dec 2018, YueHaibing wrote:
> > 
> >> Remove duplicated include.
> >>
> >> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> >> ---
> >>  drivers/input/keyboard/mtk-pmic-keys.c | 1 -
> >>  1 file changed, 1 deletion(-)
> >>
> >> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> >> index 02c67a1..5027ebb 100644
> >> --- a/drivers/input/keyboard/mtk-pmic-keys.c
> >> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> >> @@ -19,7 +19,6 @@
> >>  #include <linux/input.h>
> >>  #include <linux/interrupt.h>
> >>  #include <linux/platform_device.h>
> >> -#include <linux/kernel.h>
> >>  #include <linux/of.h>
> >>  #include <linux/of_device.h>
> >>  #include <linux/regmap.h>
> > 
> > You are removing the wrong one.
> 
> No, linux/kernel.h is a duplicated include indeed.

Actually both are not correct, but the first instance (at the top) is
even more incorrect.

> > Please convert this patch's main intent to alphabetise the header
> > files.  Then you can remove any obvious duplicates.
> 
> I can alphabetize it in v2 if need be.

Yes please.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* Re: [PATCH -next] input: keyboard: remove duplicated include from mtk-pmic-keys.c
From: YueHaibing @ 2018-12-10  7:16 UTC (permalink / raw)
  To: Lee Jones
  Cc: dmitry.torokhov, matthias.bgg, chen.zhong, linux-kernel,
	linux-mediatek, linux-arm-kernel, linux-input
In-Reply-To: <20181210061557.GL26661@dell>

On 2018/12/10 14:15, Lee Jones wrote:
> On Sun, 09 Dec 2018, YueHaibing wrote:
> 
>> Remove duplicated include.
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  drivers/input/keyboard/mtk-pmic-keys.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
>> index 02c67a1..5027ebb 100644
>> --- a/drivers/input/keyboard/mtk-pmic-keys.c
>> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
>> @@ -19,7 +19,6 @@
>>  #include <linux/input.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/platform_device.h>
>> -#include <linux/kernel.h>
>>  #include <linux/of.h>
>>  #include <linux/of_device.h>
>>  #include <linux/regmap.h>
> 
> You are removing the wrong one.

No, linux/kernel.h is a duplicated include indeed.

> 
> Please convert this patch's main intent to alphabetise the header
> files.  Then you can remove any obvious duplicates.

I can alphabetize it in v2 if need be.

> 

^ permalink raw reply

* Re: [PATCH v3 1/4] mfd: stmpe: Move ADC related defines to header of mfd
From: Lee Jones @ 2018-12-10  6:16 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Philippe Schenker, jic23, marcel.ziswiler, stefan,
	Philippe Schenker, Max Krummenacher, Alexandre Torgue,
	linux-kernel, linux-input, Maxime Coquelin, linux-stm32,
	linux-arm-kernel
In-Reply-To: <20181209045241.GF211094@dtor-ws>

On Sat, 08 Dec 2018, Dmitry Torokhov wrote:

> On Wed, Nov 28, 2018 at 09:15:32AM +0000, Lee Jones wrote:
> > On Fri, 23 Nov 2018, Philippe Schenker wrote:
> > 
> > > Move defines that are ADC related to the header of the overlying mfd,
> > > so they can be used from multiple sub-devices.
> > > 
> > > Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
> > > ---
> > > 
> > > Changes in v3:
> > >  - None
> > > 
> > > Changes in v2:
> > >  - This is a new added commit. Separate commit for moving the defines out of
> > >    drivers/input/touchscreen/stmpe-ts.c to overlying mfd-device drivers/mfd/stmpe.c
> > >  - Pre-fix defines with STMPE_
> > > 
> > >  drivers/input/touchscreen/stmpe-ts.c | 34 +++++++++++-----------------
> > >  include/linux/mfd/stmpe.h            | 11 +++++++++
> > 
> > Acked-by: Lee Jones <lee.jones@linaro.org>
> 
> The series seem to be heading towards MFD or IIO, so I assume this patch
> will be merged through one of these trees.
> 
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

I'd be happy to take it.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* Re: [PATCH -next] input: keyboard: remove duplicated include from mtk-pmic-keys.c
From: Lee Jones @ 2018-12-10  6:15 UTC (permalink / raw)
  To: YueHaibing
  Cc: dmitry.torokhov, matthias.bgg, chen.zhong, linux-kernel,
	linux-mediatek, linux-arm-kernel, linux-input
In-Reply-To: <20181209063440.27820-1-yuehaibing@huawei.com>

On Sun, 09 Dec 2018, YueHaibing wrote:

> Remove duplicated include.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/input/keyboard/mtk-pmic-keys.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> index 02c67a1..5027ebb 100644
> --- a/drivers/input/keyboard/mtk-pmic-keys.c
> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> @@ -19,7 +19,6 @@
>  #include <linux/input.h>
>  #include <linux/interrupt.h>
>  #include <linux/platform_device.h>
> -#include <linux/kernel.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
>  #include <linux/regmap.h>

You are removing the wrong one.

Please convert this patch's main intent to alphabetise the header
files.  Then you can remove any obvious duplicates.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* Re: [PATCH] HID: intel-ish-hid: fixes incorrect error handling
From: Srinivas Pandruvada @ 2018-12-10  3:20 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires
  Cc: bianpan2016, open list:HID CORE LAYER, lkml
In-Reply-To: <nycvar.YFH.7.76.1812092144440.17216@cbobk.fhfr.pm>

On Sun, 2018-12-09 at 21:45 +0100, Jiri Kosina wrote:
> On Fri, 7 Dec 2018, Benjamin Tissoires wrote:
> 
> > > The memory chunk allocated by hid_allocate_device() should be
> > > released
> > > by hid_destroy_device(), not kfree().
> > > 
> > > Fixes: 0b28cb4bcb1("HID: intel-ish-hid: ISH HID client driver")
> > > Signed-off-by: Pan Bian <bianpan2016@163.com>
> > > ---
> > >  drivers/hid/intel-ish-hid/ishtp-hid.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/hid/intel-ish-hid/ishtp-hid.c
> > > b/drivers/hid/intel-ish-hid/ishtp-hid.c
> > > index cd23903..e918d78 100644
> > > --- a/drivers/hid/intel-ish-hid/ishtp-hid.c
> > > +++ b/drivers/hid/intel-ish-hid/ishtp-hid.c
> > > @@ -222,7 +222,7 @@ int ishtp_hid_probe(unsigned int cur_hid_dev,
> > >  err_hid_device:
> > >         kfree(hid_data);
> > >  err_hid_data:
> > > -       kfree(hid);
> > > +       hid_destroy_device(hid);
> > 
> > Looks good to me. Srinivas, any comments?
> > FWIW:
> > Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> > 
> > Jiri, do you think we should send this one as 4.20/fixes material
> > or
> > wait for 4.21?
> 
> Given that this has been around since 4.9, I wouldn't be devastated
> if it 
> lands only in next merge window. So I'd just put it to 4.20/fixes and
> wait 
> for other more serious trigger for sending that to Linus eventually.
> 
Agree.

Thanks,
Srinivas

> Thanks,
> 

^ permalink raw reply

* Re: [PATCH] HID: intel-ish-hid: fixes incorrect error handling
From: Jiri Kosina @ 2018-12-09 20:45 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: bianpan2016, Srinivas Pandruvada, open list:HID CORE LAYER, lkml
In-Reply-To: <CAO-hwJJDhtNqy6gc9OJ+rHnJimrQeAoxxkay5XnfXjxMtvEufQ@mail.gmail.com>

On Fri, 7 Dec 2018, Benjamin Tissoires wrote:

> > The memory chunk allocated by hid_allocate_device() should be released
> > by hid_destroy_device(), not kfree().
> >
> > Fixes: 0b28cb4bcb1("HID: intel-ish-hid: ISH HID client driver")
> > Signed-off-by: Pan Bian <bianpan2016@163.com>
> > ---
> >  drivers/hid/intel-ish-hid/ishtp-hid.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/hid/intel-ish-hid/ishtp-hid.c b/drivers/hid/intel-ish-hid/ishtp-hid.c
> > index cd23903..e918d78 100644
> > --- a/drivers/hid/intel-ish-hid/ishtp-hid.c
> > +++ b/drivers/hid/intel-ish-hid/ishtp-hid.c
> > @@ -222,7 +222,7 @@ int ishtp_hid_probe(unsigned int cur_hid_dev,
> >  err_hid_device:
> >         kfree(hid_data);
> >  err_hid_data:
> > -       kfree(hid);
> > +       hid_destroy_device(hid);
> 
> Looks good to me. Srinivas, any comments?
> FWIW:
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> 
> Jiri, do you think we should send this one as 4.20/fixes material or
> wait for 4.21?

Given that this has been around since 4.9, I wouldn't be devastated if it 
lands only in next merge window. So I'd just put it to 4.20/fixes and wait 
for other more serious trigger for sending that to Linus eventually.

Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH 1/2] Input: omap-keypad: Fix keyboard debounce configuration
From: Pavel Machek @ 2018-12-09 11:56 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Dmitry Torokhov, linux-input, linux-kernel, linux-omap,
	Axel Haslam, Felipe Balbi, Illia Smyrnov, Marcel Partap,
	Merlijn Wajer, Michael Scott, NeKit, Sebastian Reichel
In-Reply-To: <20181203012933.6647-1-tony@atomide.com>

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

On Sun 2018-12-02 17:29:32, Tony Lindgren wrote:
> I noticed that the Android v3.0.8 kernel on droid4 is using different
> keypad values from the mainline kernel and does not have issues with
> keys occasionally being stuck until pressed again. Turns out there was
> an earlier patch posted to fix this as "Input: omap-keypad: errata i689:
> Correct debounce time", but it was never reposted to fix use macros
> for timing calculations.
> 
> This updated version is using macros, and also fixes the use of the
> input clock rate to use 32768KiHz instead of 32000KiHz. And we want to
> use the known good Android kernel values of 3 and 6 instead of 2 and 6
> in the earlier patch.
> 
> Cc: Axel Haslam <axelhaslam@ti.com>
> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: Illia Smyrnov <illia.smyrnov@ti.com>
> Cc: Marcel Partap <mpartap@gmx.net>
> Cc: Merlijn Wajer <merlijn@wizzup.org>
> Cc: Michael Scott <hashcode0f@gmail.com>
> Cc: NeKit <nekit1000@gmail.com>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Sebastian Reichel <sre@kernel.org>
> Reported-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

So, if I press key "." quickly on console in
4.18.0-rc4-88970-gf075a2c-dirty it starts repeating. I could reproduce
it 3 times from tree tries. Then I decided to test your patch, and so
I booted 4.20-rc5+ using kexec. Turns out, I can't reproduce that
repeat there... I tried more than 10 times. But that's before your
patch.

So -- bad news for you -- seems like someone -- maybe you -- already
fixed this. (But that does not mean the patch is bad idea).

Thanks,
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply

* [PATCH -next] input: keyboard: remove duplicated include from mtk-pmic-keys.c
From: YueHaibing @ 2018-12-09  6:34 UTC (permalink / raw)
  To: dmitry.torokhov, matthias.bgg, lee.jones, chen.zhong
  Cc: linux-kernel, linux-mediatek, linux-arm-kernel, linux-input,
	YueHaibing

Remove duplicated include.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/input/keyboard/mtk-pmic-keys.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 02c67a1..5027ebb 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -19,7 +19,6 @@
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/regmap.h>
-- 
2.7.0

^ permalink raw reply related

* Re: [PATCH v2] Input: i8042 fix refcount leak
From: Frank Lee @ 2018-12-09  6:15 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
In-Reply-To: <20181209054014.GA237502@dtor-ws>

On Sun, Dec 9, 2018 at 1:40 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> On Sun, Dec 09, 2018 at 12:19:00AM -0500, Yangtao Li wrote:
> > use of_node_put() to release the refcount.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> >  drivers/input/serio/i8042-sparcio.h | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
> > index 796289846204..cc6777b4c4ea 100644
> > --- a/drivers/input/serio/i8042-sparcio.h
> > +++ b/drivers/input/serio/i8042-sparcio.h
> > @@ -111,13 +111,17 @@ static int __init i8042_platform_init(void)
> >       struct device_node *root = of_find_node_by_path("/");
> >
> >       if (!strcmp(root->name, "SUNW,JavaStation-1")) {
> > +             of_node_put(root);
> >               /* Hardcoded values for MrCoffee.  */
> >               i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
> >               kbd_iobase = ioremap(0x71300060, 8);
> >               if (!kbd_iobase)
> >                       return -ENODEV;
> >       } else {
> > -             int err = platform_driver_register(&sparc_i8042_driver);
> > +             int err;
> > +
> > +             of_node_put(root);
> > +             err = platform_driver_register(&sparc_i8042_driver);
> >               if (err)
> >                       return err;
>
> This is not really what I asked for, as in this version you left out
> leaky reference in i8042_platform_exit(). Please make the "detect Mr
> Coffee" function and use it in both i8042_platform_init() and
> i8042_platform_exit().
How about the newer?

Yours,
Yangtao
>
> Thanks.
>
> --
> Dmitry

^ permalink raw reply

* [PATCH v3] Input: i8042 add i8042_is_mr_coffee() helper to avoid refconut leak
From: Yangtao Li @ 2018-12-09  6:14 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Yangtao Li

of_find_node_by_path() acquires a reference to the node returned by
it and that reference needs to be dropped by its caller. Add
i8042_is_mr_coffee() helper to avoid refconut leak.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
changes in v3:
-add i8042_is_mr_coffee
---
 drivers/input/serio/i8042-sparcio.h | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index 796289846204..c8dc5b4b5e4f 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -106,11 +106,23 @@ static struct platform_driver sparc_i8042_driver = {
 	.remove		= sparc_i8042_remove,
 };
 
+static inline bool i8042_is_mr_coffee(void)
+{
+	struct device_node *root;
+	bool is_mr_coffree;
+
+	root = of_find_node_by_path("/");
+	is_mr_coffree = !strcmp(root->name, "SUNW,JavaStation-1");
+	of_node_put(root);
+
+	return is_mr_coffee;
+}
+
 static int __init i8042_platform_init(void)
 {
-	struct device_node *root = of_find_node_by_path("/");
+	bool match = i8042_is_mr_coffee();
 
-	if (!strcmp(root->name, "SUNW,JavaStation-1")) {
+	if (match) {
 		/* Hardcoded values for MrCoffee.  */
 		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
 		kbd_iobase = ioremap(0x71300060, 8);
@@ -138,9 +150,9 @@ static int __init i8042_platform_init(void)
 
 static inline void i8042_platform_exit(void)
 {
-	struct device_node *root = of_find_node_by_path("/");
+	bool match = i8042_is_mr_coffee();
 
-	if (strcmp(root->name, "SUNW,JavaStation-1"))
+	if (!match)
 		platform_driver_unregister(&sparc_i8042_driver);
 }
 
-- 
2.17.0

^ permalink raw reply related

* Re: [PATCH v2] Input: i8042 fix refcount leak
From: Dmitry Torokhov @ 2018-12-09  5:40 UTC (permalink / raw)
  To: Yangtao Li; +Cc: linux-input, linux-kernel
In-Reply-To: <20181209051900.19035-1-tiny.windzz@gmail.com>

On Sun, Dec 09, 2018 at 12:19:00AM -0500, Yangtao Li wrote:
> use of_node_put() to release the refcount.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/input/serio/i8042-sparcio.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
> index 796289846204..cc6777b4c4ea 100644
> --- a/drivers/input/serio/i8042-sparcio.h
> +++ b/drivers/input/serio/i8042-sparcio.h
> @@ -111,13 +111,17 @@ static int __init i8042_platform_init(void)
>  	struct device_node *root = of_find_node_by_path("/");
>  
>  	if (!strcmp(root->name, "SUNW,JavaStation-1")) {
> +		of_node_put(root);
>  		/* Hardcoded values for MrCoffee.  */
>  		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
>  		kbd_iobase = ioremap(0x71300060, 8);
>  		if (!kbd_iobase)
>  			return -ENODEV;
>  	} else {
> -		int err = platform_driver_register(&sparc_i8042_driver);
> +		int err;
> +
> +		of_node_put(root);
> +		err = platform_driver_register(&sparc_i8042_driver);
>  		if (err)
>  			return err;

This is not really what I asked for, as in this version you left out
leaky reference in i8042_platform_exit(). Please make the "detect Mr
Coffee" function and use it in both i8042_platform_init() and
i8042_platform_exit().

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: sparcspkr add of_node_put()
From: Frank Lee @ 2018-12-09  5:23 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
In-Reply-To: <20181121132806.22521-1-tiny.windzz@gmail.com>

ping....

^ permalink raw reply

* Re: [PATCH] Input: i8042 add of_node_put()
From: Frank Lee @ 2018-12-09  5:22 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
In-Reply-To: <20181129183657.GD54791@dtor-ws>

On Fri, Nov 30, 2018 at 2:37 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> Hi Yangtao,
>
> On Wed, Nov 21, 2018 at 09:35:13AM -0500, Yangtao Li wrote:
> > use of_node_put() to release the refcount.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> >  drivers/input/serio/i8042-sparcio.h | 24 +++++++++++++++++-------
> >  1 file changed, 17 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
> > index 796289846204..5495bc035518 100644
> > --- a/drivers/input/serio/i8042-sparcio.h
> > +++ b/drivers/input/serio/i8042-sparcio.h
> > @@ -108,18 +108,21 @@ static struct platform_driver sparc_i8042_driver = {
> >
> >  static int __init i8042_platform_init(void)
> >  {
> > +     int rc;
> >       struct device_node *root = of_find_node_by_path("/");
> >
> >       if (!strcmp(root->name, "SUNW,JavaStation-1")) {
> >               /* Hardcoded values for MrCoffee.  */
> >               i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
> >               kbd_iobase = ioremap(0x71300060, 8);
> > -             if (!kbd_iobase)
> > -                     return -ENODEV;
> > +             if (!kbd_iobase){
> > +                     rc = -ENODEV;
> > +                     goto out;
> > +             }
> >       } else {
> > -             int err = platform_driver_register(&sparc_i8042_driver);
> > -             if (err)
> > -                     return err;
> > +             rc = platform_driver_register(&sparc_i8042_driver);
> > +             if (rc)
> > +                     goto out;
> >
> >               if (i8042_kbd_irq == -1 ||
> >                   i8042_aux_irq == -1) {
> > @@ -127,13 +130,18 @@ static int __init i8042_platform_init(void)
> >                               of_iounmap(kbd_res, kbd_iobase, 8);
> >                               kbd_iobase = (void __iomem *) NULL;
> >                       }
> > -                     return -ENODEV;
> > +                     rc = -ENODEV;
> > +                     goto out;
> >               }
> >       }
> >
> >       i8042_reset = I8042_RESET_ALWAYS;
> >
> > -     return 0;
> > +     rc = 0;
> > +out:
> > +     of_node_put(root);
> > +
> > +     return rc;
>
> Instead of rearranging code like this, can we instead have:
>
> static inline bool i8042_is_mr_coffee(void)
> {
>         struct device_node *root;
>         bool is_mr_coffree;
>
>         root = of_find_node_by_path("/");
>         is_mr_coffree = !strcmp(root->name, "SUNW,JavaStation-1");
>         of_node_put(root);
>
>         return is_mr_coffee;
> }
>
> ?
Yes, we should do this. The modified patch has been sent.
Also, I am very sorry to reply so late.

MBR,
Yangtao
>
> Thanks.
>
> --
> Dmitry

^ permalink raw reply

* [PATCH v2] Input: i8042 fix refcount leak
From: Yangtao Li @ 2018-12-09  5:19 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Yangtao Li

use of_node_put() to release the refcount.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/input/serio/i8042-sparcio.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index 796289846204..cc6777b4c4ea 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -111,13 +111,17 @@ static int __init i8042_platform_init(void)
 	struct device_node *root = of_find_node_by_path("/");
 
 	if (!strcmp(root->name, "SUNW,JavaStation-1")) {
+		of_node_put(root);
 		/* Hardcoded values for MrCoffee.  */
 		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
 		kbd_iobase = ioremap(0x71300060, 8);
 		if (!kbd_iobase)
 			return -ENODEV;
 	} else {
-		int err = platform_driver_register(&sparc_i8042_driver);
+		int err;
+
+		of_node_put(root);
+		err = platform_driver_register(&sparc_i8042_driver);
 		if (err)
 			return err;
 
-- 
2.17.0

^ permalink raw reply related

* Re: [PATCH 6/8] Input: dt-bindings: tm2-touchkey: Document new keycodes property
From: Dmitry Torokhov @ 2018-12-09  4:57 UTC (permalink / raw)
  To: Paweł Chmiel
  Cc: robh+dt, mark.rutland, devicetree, linux-input, linux-kernel,
	xc-racer2, simon
In-Reply-To: <20181207105811.1831-7-pawel.mikolaj.chmiel@gmail.com>

On Fri, Dec 07, 2018 at 11:58:09AM +0100, Paweł Chmiel wrote:
> From: Jonathan Bakker <xc-racer2@live.ca>
> 
> Document new optional property for setting custom keycodes.
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> ---
>  .../devicetree/bindings/input/cypress,tm2-touchkey.txt        | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt
> index dfb3b9f0ee40..3b54d997b8de 100644
> --- a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt
> +++ b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt
> @@ -10,6 +10,9 @@ Required properties:
>  - vcc-supply : internal regulator output. 1.8V
>  - vdd-supply : power supply for IC 3.3V
>  
> +Optional properties:
> +- keycodes: array of keycodes (max 4), default KEY_PHONE and KEY_BACK
> +
>  [0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
>  
>  Example:
> @@ -23,5 +26,6 @@ Example:
>  			interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
>  			vcc-supply=<&ldo32_reg>;
>  			vdd-supply=<&ldo33_reg>;
> +			keycodes = /bits/ 8 <KEY_PHONE KEY_BACK>;

We definitely have key codes bigger than 255. Just keep them normal
ints please.

>  		};
>  	};
> -- 
> 2.17.1
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v3 1/4] mfd: stmpe: Move ADC related defines to header of mfd
From: Dmitry Torokhov @ 2018-12-09  4:52 UTC (permalink / raw)
  To: Lee Jones
  Cc: Philippe Schenker, jic23, marcel.ziswiler, stefan,
	Philippe Schenker, Max Krummenacher, Alexandre Torgue,
	linux-kernel, linux-input, Maxime Coquelin, linux-stm32,
	linux-arm-kernel
In-Reply-To: <20181128091532.GU4272@dell>

On Wed, Nov 28, 2018 at 09:15:32AM +0000, Lee Jones wrote:
> On Fri, 23 Nov 2018, Philippe Schenker wrote:
> 
> > Move defines that are ADC related to the header of the overlying mfd,
> > so they can be used from multiple sub-devices.
> > 
> > Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
> > ---
> > 
> > Changes in v3:
> >  - None
> > 
> > Changes in v2:
> >  - This is a new added commit. Separate commit for moving the defines out of
> >    drivers/input/touchscreen/stmpe-ts.c to overlying mfd-device drivers/mfd/stmpe.c
> >  - Pre-fix defines with STMPE_
> > 
> >  drivers/input/touchscreen/stmpe-ts.c | 34 +++++++++++-----------------
> >  include/linux/mfd/stmpe.h            | 11 +++++++++
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>

The series seem to be heading towards MFD or IIO, so I assume this patch
will be merged through one of these trees.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH RFC 1/2] input: add official Raspberry Pi's 7" touchscreen driver
From: Dmitry Torokhov @ 2018-12-09  4:43 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: Henrik Rydberg, linux-rpi-kernel, stefan.wahren, eric, agraf,
	Corentin Labbe, Rob Herring, Hans de Goede, Masanari Iida, Zhu Yi,
	Eugen Hristev, Jonathan Cameron, Hans-Christian Noren Egtvedt,
	Heiko Schocher, linux-kernel, linux-input
In-Reply-To: <20181205220902.27682-2-nsaenzjulienne@suse.de>

Hi Nicolas,

On Wed, Dec 05, 2018 at 11:09:03PM +0100, Nicolas Saenz Julienne wrote:
> Adds support to Raspberry Pi's 7" touchscreen device. Instead of using
> a conventional bus all information is copied into a memory mapped area
> by RPi's VC4 firmware.
> 
> Based on the driver found in RPi's downstream kernel repository.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> ---
>  drivers/input/touchscreen/Kconfig          |  12 +
>  drivers/input/touchscreen/Makefile         |   1 +
>  drivers/input/touchscreen/raspberrypi-ts.c | 252 +++++++++++++++++++++
>  3 files changed, 265 insertions(+)
>  create mode 100644 drivers/input/touchscreen/raspberrypi-ts.c
> 
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index 2a80675cfd94..8d0fcb3dc8a8 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -696,6 +696,18 @@ config TOUCHSCREEN_EDT_FT5X06
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called edt-ft5x06.
>  
> +config TOUCHSCREEN_RASPBERRYPI_TS
> +	tristate "Raspberry Pi's firmware base touch screen support"
> +	depends on OF

I think "depends on ASPBERRYPI_FIRMWARE || COMPILE_TEST" is more
precise dependency.

> +	help
> +	  Say Y here if you have the official Raspberry Pi 7' touchscren
> +	  connected on your system.
> +
> +	  If unsure, say N.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called raspberrypi-ts.
> +
>  config TOUCHSCREEN_MIGOR
>  	tristate "Renesas MIGO-R touchscreen"
>  	depends on (SH_MIGOR || COMPILE_TEST) && I2C
> diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
> index 5911a4190cd2..3eccb1925e89 100644
> --- a/drivers/input/touchscreen/Makefile
> +++ b/drivers/input/touchscreen/Makefile
> @@ -109,3 +109,4 @@ obj-$(CONFIG_TOUCHSCREEN_ZET6223)	+= zet6223.o
>  obj-$(CONFIG_TOUCHSCREEN_ZFORCE)	+= zforce_ts.o
>  obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50)	+= colibri-vf50-ts.o
>  obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023)	+= rohm_bu21023.o
> +obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_TS)	+= raspberrypi-ts.o
> diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c
> new file mode 100644
> index 000000000000..9d29411a5674
> --- /dev/null
> +++ b/drivers/input/touchscreen/raspberrypi-ts.c
> @@ -0,0 +1,252 @@
> +/*
> + * Raspberry Pi 3 firmware based touchscreen driver
> + *
> + * Copyright (C) 2015, 2017 Raspberry Pi
> + * Copyright (C) 2018 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.

Please use SPDX tag for the license.

> + */
> +
> +#include <linux/io.h>
> +#include <linux/slab.h>
> +#include <linux/module.h>
> +#include <linux/bitops.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/platform_device.h>
> +#include <linux/input.h>
> +#include <linux/input/mt.h>
> +#include <linux/input/touchscreen.h>
> +#include <soc/bcm2835/raspberrypi-firmware.h>
> +
> +#define RPI_TS_DEFAULT_WIDTH	800
> +#define RPI_TS_DEFAULT_HEIGHT	480
> +
> +#define RPI_TS_MAX_SUPPORTED_POINTS	10
> +
> +#define RPI_TS_FTS_TOUCH_DOWN		0
> +#define RPI_TS_FTS_TOUCH_CONTACT	2
> +
> +struct rpi_ts {
> +	struct input_dev *input;

Since the only way is to poll, please use polled input device instead of
standard one. It will take care of scheduling polling, stopping it when
needed, etc.

> +	struct touchscreen_properties prop;
> +
> +	void __iomem *ts_base;
> +	dma_addr_t bus_addr;
> +
> +	struct delayed_work work;
> +	int known_ids;
> +};
> +
> +struct rpi_ts_regs {
> +	uint8_t device_mode;
> +	uint8_t gesture_id;
> +	uint8_t num_points;

Simply u8 in kernel.

> +	struct rpi_ts_touch {
> +		uint8_t xh;
> +		uint8_t xl;
> +		uint8_t yh;
> +		uint8_t yl;
> +		uint8_t pressure; /* Not supported */
> +		uint8_t area;     /* Not supported */
> +	} point[RPI_TS_MAX_SUPPORTED_POINTS];
> +};
> +
> +/*
> + * This process polls the memory based register copy of the touch screen chip
> + * registers using the number of points register to know whether the copy has
> + * been updated (we write 99 to the memory copy, the GPU will write between 0 -
> + * 10 points)
> + */
> +static void rpi_ts_work(struct work_struct *work)
> +{
> +	struct rpi_ts *ts = container_of(work, struct rpi_ts, work.work);
> +	struct input_dev *input = ts->input;
> +	struct rpi_ts_regs regs;
> +	int modified_ids = 0;
> +	int released_ids;
> +	int event_type;
> +	int touchid;
> +	int x, y;
> +	int i;
> +
> +	memcpy_fromio(&regs, ts->ts_base, sizeof(struct rpi_ts_regs));
> +	iowrite8(99, ts->ts_base + offsetof(struct rpi_ts_regs, num_points));
> +
> +	if (regs.num_points == 99 ||
> +	    (regs.num_points == 0 && ts->known_ids == 0))
> +	    goto out;
> +
> +	for (i = 0; i < regs.num_points; i++) {
> +		x = (((int)regs.point[i].xh & 0xf) << 8) + regs.point[i].xl;
> +		y = (((int)regs.point[i].yh & 0xf) << 8) + regs.point[i].yl;
> +		touchid = (regs.point[i].yh >> 4) & 0xf;
> +		event_type = (regs.point[i].xh >> 6) & 0x03;
> +
> +		modified_ids |= BIT(touchid);
> +
> +		if (event_type == RPI_TS_FTS_TOUCH_DOWN ||
> +		    event_type == RPI_TS_FTS_TOUCH_CONTACT) {
> +			input_mt_slot(input, touchid);
> +			input_mt_report_slot_state(input, MT_TOOL_FINGER, 1);
> +			touchscreen_report_pos(input, &ts->prop, x, y, true);
> +		}
> +	}
> +
> +	released_ids = ts->known_ids & ~modified_ids;
> +	for (i = 0; released_ids && i < RPI_TS_MAX_SUPPORTED_POINTS; i++) {

If you make released_ids long instead of int you can use
for_each_set_bit() here.

> +		if (released_ids & BIT(i)) {
> +			input_mt_slot(input, i);
> +			input_mt_report_slot_state(input, MT_TOOL_FINGER, 0);
> +			modified_ids &= ~(BIT(i));
> +		}
> +	}
> +	ts->known_ids = modified_ids;
> +
> +	input_mt_report_pointer_emulation(ts->input, true);

input_mt_sync_frame() and then you would not need to call
input_mt_report_pointer_emulation() if you passed right flags to
input_mt_init_slots().

> +	input_sync(ts->input);
> +
> +out:
> +	schedule_delayed_work(&ts->work, msecs_to_jiffies(17)); /* 60 fps */
> +}
> +
> +static int rpi_ts_open(struct input_dev *dev)
> +{
> +	struct rpi_ts *ts = input_get_drvdata(dev);
> +
> +	schedule_delayed_work(&ts->work, 0);
> +
> +	return 0;
> +}
> +
> +static void rpi_ts_close(struct input_dev *dev)
> +{
> +	struct rpi_ts *ts = input_get_drvdata(dev);
> +
> +	cancel_delayed_work_sync(&ts->work);
> +}

Not needed if using polled input device.

> +
> +static int rpi_ts_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct device_node *np = dev->of_node;
> +	struct device_node *fw_node;
> +	struct input_dev *input;
> +	struct rpi_firmware *fw;
> +	struct rpi_ts *ts;
> +	u32 touchbuf;
> +	int err = 0;
> +
> +	fw_node = of_get_parent(np);
> +	if (!fw_node) {
> +		dev_err(dev, "Missing firmware node\n");
> +		return -ENOENT;
> +	}
> +
> +	fw = rpi_firmware_get(fw_node);

You are leaking node here I believe. Stick of_node_put() after
rpi_firmware_get() and before "if".

> +	if (!fw)
> +		return -EPROBE_DEFER;
> +
> +	ts = devm_kzalloc(dev, sizeof(struct rpi_ts), GFP_KERNEL);

sizeof(*ts)

> +	if (!ts) {
> +		dev_err(dev, "Failed to allocate memory\n");
> +		return -ENOMEM;
> +	}
> +
> +	input = input_allocate_device();

devm.

> +	if (!input) {
> +		dev_err(dev, "Failed to allocate input device\n");
> +		return -ENOMEM;
> +	}
> +	ts->input = input;
> +
> +	ts->ts_base = dma_zalloc_coherent(dev, PAGE_SIZE, &ts->bus_addr,
> +					  GFP_KERNEL);
> +	if (!ts->ts_base) {
> +		dev_err(dev, "failed to dma_alloc_coherent\n");
> +		err = -ENOMEM;
> +		goto undegister_input_device;
> +	}
> +
> +	touchbuf = (u32)ts->bus_addr;
> +	err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF,
> +				    &touchbuf, sizeof(touchbuf));
> +
> +	if (err || touchbuf != 0) {
> +		dev_warn(dev, "Failed to set touchbuf, trying to get err:%x\n",
> +			 err);
> +		goto clean_dma_buf;
> +	}
> +
> +	INIT_DELAYED_WORK(&ts->work, rpi_ts_work);
> +	platform_set_drvdata(pdev, ts);
> +
> +	input->name = "raspberrypi-ts";
> +	input->id.bustype = BUS_HOST;
> +	input->open = rpi_ts_open;
> +	input->close = rpi_ts_close;
> +	input->dev.parent = &pdev->dev;
> +
> +	__set_bit(EV_KEY, input->evbit);
> +	__set_bit(EV_SYN, input->evbit);
> +	__set_bit(EV_ABS, input->evbit);
> +
> +	input_set_abs_params(input, ABS_MT_POSITION_X, 0,
> +			     RPI_TS_DEFAULT_WIDTH, 0, 0);
> +	input_set_abs_params(input, ABS_MT_POSITION_Y, 0,
> +			     RPI_TS_DEFAULT_HEIGHT, 0, 0);
> +	touchscreen_parse_properties(input, true, &ts->prop);
> +
> +	input_mt_init_slots(input, RPI_TS_MAX_SUPPORTED_POINTS,
> +			    INPUT_MT_DIRECT);
> +
> +	input_set_drvdata(input, ts);
> +
> +	err = input_register_device(input);
> +	if (err) {
> +		dev_err(dev, "could not register input device, %d\n",
> +			err);
> +		goto clean_dma_buf;
> +	}
> +	return 0;
> +
> +clean_dma_buf:
> +	dma_free_coherent(dev, PAGE_SIZE, ts->ts_base, ts->bus_addr);

I wild make freeing this area a devm custom action
(devm_add_action_or_reset). Then you can get rid of rpi_ts_remove().

> +undegister_input_device:
> +	input_unregister_device(ts->input);
> +
> +	return err;
> +}
> +
> +static int rpi_ts_remove(struct platform_device *pdev)
> +{
> +	struct rpi_ts *ts = (struct rpi_ts *)platform_get_drvdata(pdev);
> +
> +	input_unregister_device(ts->input);
> +	dma_free_coherent(&pdev->dev, PAGE_SIZE, ts->ts_base, ts->bus_addr);
> +	return 0;
> +}
> +
> +static const struct of_device_id rpi_ts_match[] = {
> +	{ .compatible = "raspberrypi,firmware-ts", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, rpi_ts_match);
> +
> +static struct platform_driver rpi_ts_driver = {
> +	.driver = {
> +		.name   = "raspberrypi-ts",
> +		.owner  = THIS_MODULE,

I am pretty sure we no longer need to set owner explicitly.

> +		.of_match_table = rpi_ts_match,
> +	},
> +	.probe          = rpi_ts_probe,
> +	.remove         = rpi_ts_remove,
> +};
> +
> +module_platform_driver(rpi_ts_driver);
> +
> +MODULE_AUTHOR("Gordon Hollingworth");
> +MODULE_AUTHOR("Nicolas Saenz Julienne <nsaenzjulienne@suse.de>");
> +MODULE_DESCRIPTION("Raspberry Pi 3 firmware based touchscreen driver");
> +MODULE_LICENSE("GPL");

This should be "GPL v2" to math the license notice at the top of the
file.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v4 1/3] Input: atmel_mxt_ts: Add support for  optional regulators
From: Dmitry Torokhov @ 2018-12-09  4:26 UTC (permalink / raw)
  To: Paweł Chmiel
  Cc: nick, robh+dt, mark.rutland, nicolas.ferre, alexandre.belloni,
	linux-input, devicetree, linux-arm-kernel, linux-kernel
In-Reply-To: <20181207142857.15818-2-pawel.mikolaj.chmiel@gmail.com>

On Fri, Dec 07, 2018 at 03:28:55PM +0100, Paweł Chmiel wrote:
> This patch adds optional regulators, which can be used to power
> up touchscreen. After enabling regulators, we need to wait 150msec.
> This value is taken from official driver.
> 
> It was tested on Samsung Galaxy i9000 (based on Samsung S5PV210 SOC).
> 
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> ---
> Changes from v3:
>   - Fix checkpatch issues
>   - Drop sentence punctuation from subject of one of patches
> 
> Changes from v2:
>   - Move code enabling regulators into separate method,
>     to make code more readable.
> 
> Changes from v1:
>   - Enable regulators only if reset_gpio is present.
>   - Switch from devm_regulator_get_optional to devm_regulator_get
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 65 +++++++++++++++++++++---
>  1 file changed, 59 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index d3aacd534e9c..1dc8ad0da5af 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -27,6 +27,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/of.h>
>  #include <linux/property.h>
> +#include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
>  #include <linux/gpio/consumer.h>
>  #include <asm/unaligned.h>
> @@ -194,10 +195,10 @@ enum t100_type {
>  
>  /* Delay times */
>  #define MXT_BACKUP_TIME		50	/* msec */
> -#define MXT_RESET_GPIO_TIME	20	/* msec */
>  #define MXT_RESET_INVALID_CHG	100	/* msec */
>  #define MXT_RESET_TIME		200	/* msec */
>  #define MXT_RESET_TIMEOUT	3000	/* msec */
> +#define MXT_REGULATOR_DELAY	150	/* msec */
>  #define MXT_CRC_TIMEOUT		1000	/* msec */
>  #define MXT_FW_RESET_TIME	3000	/* msec */
>  #define MXT_FW_CHG_TIMEOUT	300	/* msec */
> @@ -323,6 +324,8 @@ struct mxt_data {
>  	struct t7_config t7_cfg;
>  	struct mxt_dbg dbg;
>  	struct gpio_desc *reset_gpio;
> +	struct regulator *vdd_reg;
> +	struct regulator *avdd_reg;
>  
>  	/* Cached parameters from object table */
>  	u16 T5_address;
> @@ -3038,6 +3041,38 @@ static const struct dmi_system_id chromebook_T9_suspend_dmi[] = {
>  	{ }
>  };
>  
> +static int mxt_regulator_enable(struct mxt_data *data)
> +{
> +	int error;
> +
> +	if (data->reset_gpio) {
> +		error = regulator_enable(data->vdd_reg);
> +		if (error) {
> +			dev_err(&data->client->dev,
> +				"Failed to enable vdd regulator: %d\n", error);
> +			return error;
> +		}
> +
> +		error = regulator_enable(data->avdd_reg);
> +		if (error) {
> +			dev_err(&data->client->dev,
> +				"Failed to enable avdd regulator: %d\n", error);

This leaves vdd regulator enabled.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 3/8] Input: tm2-touchkey: Use predefined device name
From: Dmitry Torokhov @ 2018-12-09  4:23 UTC (permalink / raw)
  To: Paweł Chmiel
  Cc: robh+dt, mark.rutland, devicetree, linux-input, linux-kernel,
	xc-racer2, simon
In-Reply-To: <20181207105811.1831-4-pawel.mikolaj.chmiel@gmail.com>

On Fri, Dec 07, 2018 at 11:58:06AM +0100, Paweł Chmiel wrote:
> From: Jonathan Bakker <xc-racer2@live.ca>
> 
> Purely a cosmetic fix, using the names defined earlier

If we decide to keep different names please fold into first patch.

> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> ---
>  drivers/input/keyboard/tm2-touchkey.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
> index 37a5ced24009..cc713b901bf2 100644
> --- a/drivers/input/keyboard/tm2-touchkey.c
> +++ b/drivers/input/keyboard/tm2-touchkey.c
> @@ -57,13 +57,13 @@ struct tm2_touchkey_data {
>  };
>  
>  static struct touchkey_variant tm2_touchkey_variant = {
> -	.name = "tm2-touchkey",
> +	.name = TM2_TOUCHKEY_DEV_NAME,
>  	.keycode_reg = 0x03,
>  	.base_reg = 0x00,
>  };
>  
>  static struct touchkey_variant midas_touchkey_variant = {
> -	.name = "midas-touchkey",
> +	.name = MIDAS_TOUCHKEY_DEV_NAME,
>  	.keycode_reg = 0x00,
>  	.base_reg = 0x00,
>  };
> -- 
> 2.17.1
> 

-- 
Dmitry

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox