* [PATCH] Input: elantech - Disable elan-i2c for P52 and P72
From: Benjamin Tissoires @ 2018-12-12 15:42 UTC (permalink / raw)
To: Dmitry Torokhov, kt.liao, Aaron Ma, Kai Heng Feng
Cc: linux-input, linux-kernel, Benjamin Tissoires, stable
The current implementation of elan_i2c is known to not support those
2 laptops.
A proper fix is to tweak both elantech and elan_i2c to transmit the
correct information from PS/2, which would make a bad candidate for
stable.
So to give us some time for fixing the root of the problem, disable
elan_i2c for the devices we know are not behaving properly.
Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1803600
Link: https://bugs.archlinux.org/task/59714
Fixes: df077237cf55 Input: elantech - detect new ICs and setup Host Notify for them
Cc: stable@vger.kernel.org # v4.18+
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/input/mouse/elantech.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 2d95e8d93cc7..830ae9f07045 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1767,6 +1767,18 @@ static int elantech_smbus = IS_ENABLED(CONFIG_MOUSE_ELAN_I2C_SMBUS) ?
module_param_named(elantech_smbus, elantech_smbus, int, 0644);
MODULE_PARM_DESC(elantech_smbus, "Use a secondary bus for the Elantech device.");
+static const char * const i2c_blacklist_pnp_ids[] = {
+ /*
+ * these are known to not be working properly as bits are missing
+ * in elan_i2c
+ */
+ "LEN2131", /* ThinkPad P52 w/ NFC */
+ "LEN2132", /* ThinkPad P52 */
+ "LEN2133", /* ThinkPad P72 w/ NFC */
+ "LEN2134", /* ThinkPad P72 */
+ NULL
+};
+
static int elantech_create_smbus(struct psmouse *psmouse,
struct elantech_device_info *info,
bool leave_breadcrumbs)
@@ -1802,10 +1814,12 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
if (elantech_smbus == ELANTECH_SMBUS_NOT_SET) {
/*
- * New ICs are enabled by default.
+ * New ICs are enabled by default, unless mentioned in
+ * i2c_blacklist_pnp_ids.
* Old ICs are up to the user to decide.
*/
- if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
+ if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) ||
+ psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids))
return -ENXIO;
}
--
2.19.2
^ permalink raw reply related
* Re: Elantech SMBus support regression
From: Benjamin Tissoires @ 2018-12-12 14:25 UTC (permalink / raw)
To: Kai Heng Feng, Dmitry Torokhov; +Cc: open list:HID CORE LAYER, lkml
In-Reply-To: <6E2F161C-046B-4D5F-B831-B1308A554C40@canonical.com>
Hi,
sorry for the late reply. I was always meaning to fix this the proper
way but couldn't dedicate a full day of work to go to the bottom of
elan_i2c.
Meanwhile, I am thinking at simply having a blacklist of devices that
we know are not working well (P52, L480, L580 and P72).
Could you get the value of /sys/bus/serio/devices/serio1/firmware_id
from all of these laptops?
I know the P52 is LEN2131, but I don't seem to find the other PNPIds.
Cheers,
Benjamin
On Thu, Nov 22, 2018 at 5:22 AM Kai Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> Hi Benjamin,
>
> It appears the Elantech SMBus support breaks some users’ touchpad.
>
> Please have a look at [1] [2], thanks!
>
> [1] https://bugs.launchpad.net/bugs/1803600
> [2] https://bugs.archlinux.org/task/59714
>
> Kai-Heng
^ permalink raw reply
* [PATCH v4 6/8] iio: adc: add STMPE ADC devicetree bindings
From: Philippe Schenker @ 2018-12-12 13:06 UTC (permalink / raw)
To: jic23, marcel.ziswiler, stefan
Cc: thierry.reding, Max Krummenacher, Philippe Schenker, devicetree,
linux-iio, Hartmut Knaack, Alexandre Torgue, linux-input,
linux-kernel, Rob Herring, Dmitry Torokhov, Lee Jones,
Maxime Coquelin, Mark Rutland, Peter Meerwald-Stadler,
linux-stm32, linux-arm-kernel, Lars-Peter Clausen
In-Reply-To: <20181212130649.15146-1-dev@pschenker.ch>
From: Stefan Agner <stefan@agner.ch>
This adds the devicetree bindings for the STMPE ADC. And corrects a
typo in st,sample-time it is rather "6 -> 124 clocks" according
to the datasheet and not 144.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
---
Changes in v4:
- Put reformatting in a separate precursor patch.
Changes in v3:
- Reformatted documentation for touchscreen to use tabs and have a better
overview of the settings.
- Added note which adc-settings will take precedence.
- changed typo in sample-time setting from 144 clocks to 124 clocks, as stated
in the datasheet.
Changes in v2:
- Moved the bindings for ADC to the overlying mfd.
- Reformatted for better readability
.../devicetree/bindings/iio/adc/stmpe-adc.txt | 21 ++++++++++++
.../bindings/input/touchscreen/stmpe.txt | 32 +++++++++----------
.../devicetree/bindings/mfd/stmpe.txt | 14 ++++++++
3 files changed, 51 insertions(+), 16 deletions(-)
create mode 100644 Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
diff --git a/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt b/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
new file mode 100644
index 000000000000..480e66422625
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/stmpe-adc.txt
@@ -0,0 +1,21 @@
+STMPE ADC driver
+----------------
+
+Required properties:
+ - compatible: "st,stmpe-adc"
+
+Optional properties:
+Note that the ADC is shared with the STMPE touchscreen. ADC related settings
+have to be done in the mfd.
+- st,norequest-mask: bitmask specifying which ADC channels should _not_ be
+ requestable due to different usage (e.g. touch)
+
+Node name must be stmpe_adc and should be child node of stmpe node to
+which it belongs.
+
+Example:
+
+ stmpe_adc {
+ compatible = "st,stmpe-adc";
+ st,norequest-mask = <0x0F>; /* dont use ADC CH3-0 */
+ };
diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
index 1d3f84308142..8e2b240882fa 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
@@ -5,18 +5,6 @@ Required properties:
- compatible: "st,stmpe-ts"
Optional properties:
-- st,sample-time : ADC conversion time in number of clock.
- 0 -> 36 clocks 4 -> 80 clocks (recommended)
- 1 -> 44 clocks 5 -> 96 clocks
- 2 -> 56 clocks 6 -> 144 clocks
- 3 -> 64 clocks
-- st,mod-12b : ADC Bit mode
- 0 -> 10bit ADC 1 -> 12bit ADC
-- st,ref-sel : ADC reference source
- 0 -> internal 1 -> external
-- st,adc-freq : ADC Clock speed
- 0 -> 1.625 MHz 2 || 3 -> 6.5 MHz
- 1 -> 3.25 MHz
- st,ave-ctrl : Sample average control
0 -> 1 sample
1 -> 2 samples
@@ -40,17 +28,29 @@ Optional properties:
0 -> 20 mA (typical 35mA max)
1 -> 50 mA (typical 80 mA max)
+Optional properties common with MFD (deprecated):
+ - st,sample-time : ADC conversion time in number of clock.
+ 0 -> 36 clocks 4 -> 80 clocks (recommended)
+ 1 -> 44 clocks 5 -> 96 clocks
+ 2 -> 56 clocks 6 -> 124 clocks
+ 3 -> 64 clocks
+ - st,mod-12b : ADC Bit mode
+ 0 -> 10bit ADC 1 -> 12bit ADC
+ - st,ref-sel : ADC reference source
+ 0 -> internal 1 -> external
+ - st,adc-freq : ADC Clock speed
+ 0 -> 1.625 MHz 2 || 3 -> 6.5 MHz
+ 1 -> 3.25 MHz
+
Node name must be stmpe_touchscreen and should be child node of stmpe node to
which it belongs.
+Note that common ADC settings of stmpe_touchscreen will take precedence.
+
Example:
stmpe_touchscreen {
compatible = "st,stmpe-ts";
- st,sample-time = <4>;
- st,mod-12b = <1>;
- st,ref-sel = <0>;
- st,adc-freq = <1>;
st,ave-ctrl = <1>;
st,touch-det-delay = <2>;
st,settling = <2>;
diff --git a/Documentation/devicetree/bindings/mfd/stmpe.txt b/Documentation/devicetree/bindings/mfd/stmpe.txt
index a46e7177195d..d4408a417193 100644
--- a/Documentation/devicetree/bindings/mfd/stmpe.txt
+++ b/Documentation/devicetree/bindings/mfd/stmpe.txt
@@ -14,6 +14,20 @@ Optional properties:
- st,autosleep-timeout : Valid entries (ms); 4, 16, 32, 64, 128, 256, 512 and 1024
- irq-gpio : If present, which GPIO to use for event IRQ
+Optional properties for devices with touch and ADC (STMPE811|STMPE610):
+ - st,sample-time : ADC conversion time in number of clock.
+ 0 -> 36 clocks 4 -> 80 clocks (recommended)
+ 1 -> 44 clocks 5 -> 96 clocks
+ 2 -> 56 clocks 6 -> 124 clocks
+ 3 -> 64 clocks
+ - st,mod-12b : ADC Bit mode
+ 0 -> 10bit ADC 1 -> 12bit ADC
+ - st,ref-sel : ADC reference source
+ 0 -> internal 1 -> external
+ - st,adc-freq : ADC Clock speed
+ 0 -> 1.625 MHz 2 || 3 -> 6.5 MHz
+ 1 -> 3.25 MHz
+
Example:
stmpe1601: stmpe1601@40 {
--
2.19.2
^ permalink raw reply related
* [PATCH v4 4/8] Input: stmpe-ts: preparations for STMPE ADC driver
From: Philippe Schenker @ 2018-12-12 13:06 UTC (permalink / raw)
To: jic23, marcel.ziswiler, stefan
Cc: thierry.reding, Philippe Schenker, Philippe Schenker,
Alexandre Torgue, linux-input, linux-kernel, Dmitry Torokhov,
Lee Jones, Maxime Coquelin, linux-stm32, linux-arm-kernel
In-Reply-To: <20181212130649.15146-1-dev@pschenker.ch>
This patch removes common ADC settings in favor to use
stmpe811_adc_common_init that is present in MFD. This is necessary in
preparation for the stmpe-adc driver, because those two drivers have
common settings for the ADC.
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
---
Changes in v4:
- New patch: Split changes in stmpe-ts.c to a separate commit
- Remove common adc settings from init and call the
stmpe811_adc_common_init function
Changes in v3:
- Undo ADC-settings related code-deletions in stmpe-ts.c that the code
is backwards-compatible to older devicetrees.
Changes in v2: None
drivers/input/touchscreen/stmpe-ts.c | 42 +++++-----------------------
1 file changed, 7 insertions(+), 35 deletions(-)
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index c5d9006588a2..cf9c9aa39f6e 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -30,8 +30,6 @@
* with touchscreen controller
*/
#define STMPE_REG_INT_STA 0x0B
-#define STMPE_REG_ADC_CTRL1 0x20
-#define STMPE_REG_ADC_CTRL2 0x21
#define STMPE_REG_TSC_CTRL 0x40
#define STMPE_REG_TSC_CFG 0x41
#define STMPE_REG_FIFO_TH 0x4A
@@ -58,15 +56,6 @@
* @idev: registered input device
* @work: a work item used to scan the device
* @dev: a pointer back to the MFD cell struct device*
- * @sample_time: ADC converstion time in number of clock.
- * (0 -> 36 clocks, 1 -> 44 clocks, 2 -> 56 clocks, 3 -> 64 clocks,
- * 4 -> 80 clocks, 5 -> 96 clocks, 6 -> 144 clocks),
- * recommended is 4.
- * @mod_12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC)
- * @ref_sel: ADC reference source
- * (0 -> internal reference, 1 -> external reference)
- * @adc_freq: ADC Clock speed
- * (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 MHz)
* @ave_ctrl: Sample average control
* (0 -> 1 sample, 1 -> 2 samples, 2 -> 4 samples, 3 -> 8 samples)
* @touch_det_delay: Touch detect interrupt delay
@@ -88,10 +77,6 @@ struct stmpe_touch {
struct input_dev *idev;
struct delayed_work work;
struct device *dev;
- u8 sample_time;
- u8 mod_12b;
- u8 ref_sel;
- u8 adc_freq;
u8 ave_ctrl;
u8 touch_det_delay;
u8 settling;
@@ -192,7 +177,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data)
static int stmpe_init_hw(struct stmpe_touch *ts)
{
int ret;
- u8 adc_ctrl1, adc_ctrl1_mask, tsc_cfg, tsc_cfg_mask;
+ u8 tsc_cfg, tsc_cfg_mask;
struct stmpe *stmpe = ts->stmpe;
struct device *dev = ts->dev;
@@ -202,22 +187,9 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
return ret;
}
- adc_ctrl1 = STMPE_SAMPLE_TIME(ts->sample_time) |
- STMPE_MOD_12B(ts->mod_12b) | STMPE_REF_SEL(ts->ref_sel);
- adc_ctrl1_mask = STMPE_SAMPLE_TIME(0xff) | STMPE_MOD_12B(0xff) |
- STMPE_REF_SEL(0xff);
-
- ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL1,
- adc_ctrl1_mask, adc_ctrl1);
- if (ret) {
- dev_err(dev, "Could not setup ADC\n");
- return ret;
- }
-
- ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2,
- STMPE_ADC_FREQ(0xff), STMPE_ADC_FREQ(ts->adc_freq));
+ ret = stmpe811_adc_common_init(stmpe);
if (ret) {
- dev_err(dev, "Could not setup ADC\n");
+ stmpe_disable(stmpe, STMPE_BLOCK_TOUCHSCREEN | STMPE_BLOCK_ADC);
return ret;
}
@@ -295,13 +267,13 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev,
if (np) {
if (!of_property_read_u32(np, "st,sample-time", &val))
- ts->sample_time = val;
+ ts->stmpe->sample_time = val;
if (!of_property_read_u32(np, "st,mod-12b", &val))
- ts->mod_12b = val;
+ ts->stmpe->mod_12b = val;
if (!of_property_read_u32(np, "st,ref-sel", &val))
- ts->ref_sel = val;
+ ts->stmpe->ref_sel = val;
if (!of_property_read_u32(np, "st,adc-freq", &val))
- ts->adc_freq = val;
+ ts->stmpe->adc_freq = val;
if (!of_property_read_u32(np, "st,ave-ctrl", &val))
ts->ave_ctrl = val;
if (!of_property_read_u32(np, "st,touch-det-delay", &val))
--
2.19.2
^ permalink raw reply related
* [PATCH v4 2/8] mfd: stmpe: Move ADC related defines to header of mfd
From: Philippe Schenker @ 2018-12-12 13:06 UTC (permalink / raw)
To: jic23, marcel.ziswiler, stefan
Cc: thierry.reding, Philippe Schenker, Philippe Schenker,
Alexandre Torgue, Lee Jones, linux-kernel, Dmitry Torokhov,
linux-input, Maxime Coquelin, linux-stm32, linux-arm-kernel
In-Reply-To: <20181212130649.15146-1-dev@pschenker.ch>
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>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
Changes in v4: None
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 +++++++++
2 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index 2a78e27b4495..c5d9006588a2 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -49,17 +49,6 @@
#define STMPE_IRQ_TOUCH_DET 0
-#define SAMPLE_TIME(x) ((x & 0xf) << 4)
-#define MOD_12B(x) ((x & 0x1) << 3)
-#define REF_SEL(x) ((x & 0x1) << 1)
-#define ADC_FREQ(x) (x & 0x3)
-#define AVE_CTRL(x) ((x & 0x3) << 6)
-#define DET_DELAY(x) ((x & 0x7) << 3)
-#define SETTLING(x) (x & 0x7)
-#define FRACTION_Z(x) (x & 0x7)
-#define I_DRIVE(x) (x & 0x1)
-#define OP_MODE(x) ((x & 0x7) << 1)
-
#define STMPE_TS_NAME "stmpe-ts"
#define XY_MASK 0xfff
@@ -213,9 +202,10 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
return ret;
}
- adc_ctrl1 = SAMPLE_TIME(ts->sample_time) | MOD_12B(ts->mod_12b) |
- REF_SEL(ts->ref_sel);
- adc_ctrl1_mask = SAMPLE_TIME(0xff) | MOD_12B(0xff) | REF_SEL(0xff);
+ adc_ctrl1 = STMPE_SAMPLE_TIME(ts->sample_time) |
+ STMPE_MOD_12B(ts->mod_12b) | STMPE_REF_SEL(ts->ref_sel);
+ adc_ctrl1_mask = STMPE_SAMPLE_TIME(0xff) | STMPE_MOD_12B(0xff) |
+ STMPE_REF_SEL(0xff);
ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL1,
adc_ctrl1_mask, adc_ctrl1);
@@ -225,15 +215,17 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2,
- ADC_FREQ(0xff), ADC_FREQ(ts->adc_freq));
+ STMPE_ADC_FREQ(0xff), STMPE_ADC_FREQ(ts->adc_freq));
if (ret) {
dev_err(dev, "Could not setup ADC\n");
return ret;
}
- tsc_cfg = AVE_CTRL(ts->ave_ctrl) | DET_DELAY(ts->touch_det_delay) |
- SETTLING(ts->settling);
- tsc_cfg_mask = AVE_CTRL(0xff) | DET_DELAY(0xff) | SETTLING(0xff);
+ tsc_cfg = STMPE_AVE_CTRL(ts->ave_ctrl) |
+ STMPE_DET_DELAY(ts->touch_det_delay) |
+ STMPE_SETTLING(ts->settling);
+ tsc_cfg_mask = STMPE_AVE_CTRL(0xff) | STMPE_DET_DELAY(0xff) |
+ STMPE_SETTLING(0xff);
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CFG, tsc_cfg_mask, tsc_cfg);
if (ret) {
@@ -242,14 +234,14 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_FRACTION_Z,
- FRACTION_Z(0xff), FRACTION_Z(ts->fraction_z));
+ STMPE_FRACTION_Z(0xff), STMPE_FRACTION_Z(ts->fraction_z));
if (ret) {
dev_err(dev, "Could not config touch\n");
return ret;
}
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_I_DRIVE,
- I_DRIVE(0xff), I_DRIVE(ts->i_drive));
+ STMPE_I_DRIVE(0xff), STMPE_I_DRIVE(ts->i_drive));
if (ret) {
dev_err(dev, "Could not config touch\n");
return ret;
@@ -263,7 +255,7 @@ static int stmpe_init_hw(struct stmpe_touch *ts)
}
ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CTRL,
- OP_MODE(0xff), OP_MODE(OP_MOD_XYZ));
+ STMPE_OP_MODE(0xff), STMPE_OP_MODE(OP_MOD_XYZ));
if (ret) {
dev_err(dev, "Could not set mode\n");
return ret;
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 4a827af17e59..c0353f6431f9 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -10,6 +10,17 @@
#include <linux/mutex.h>
+#define STMPE_SAMPLE_TIME(x) ((x & 0xf) << 4)
+#define STMPE_MOD_12B(x) ((x & 0x1) << 3)
+#define STMPE_REF_SEL(x) ((x & 0x1) << 1)
+#define STMPE_ADC_FREQ(x) (x & 0x3)
+#define STMPE_AVE_CTRL(x) ((x & 0x3) << 6)
+#define STMPE_DET_DELAY(x) ((x & 0x7) << 3)
+#define STMPE_SETTLING(x) (x & 0x7)
+#define STMPE_FRACTION_Z(x) (x & 0x7)
+#define STMPE_I_DRIVE(x) (x & 0x1)
+#define STMPE_OP_MODE(x) ((x & 0x7) << 1)
+
struct device;
struct regulator;
--
2.19.2
^ permalink raw reply related
* [PATCH v4 1/8] dt-bindings: stmpe: reformatting parameter list and use tabs only
From: Philippe Schenker @ 2018-12-12 13:06 UTC (permalink / raw)
To: jic23, marcel.ziswiler, stefan
Cc: Mark Rutland, devicetree, Alexandre Torgue, Dmitry Torokhov,
linux-kernel, Rob Herring, linux-stm32, Philippe Schenker,
thierry.reding, linux-arm-kernel, Max Krummenacher, linux-input,
Lee Jones, Philippe Schenker, Maxime Coquelin
This patch reformats the parameter list for stmpe device in a
table-style so it is more clear to read.
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
---
Changes in v4:
- New separate precursor patch for holding reformatting
Changes in v3: None
Changes in v2: None
.../bindings/input/touchscreen/stmpe.txt | 52 ++++++++++++-------
.../devicetree/bindings/mfd/stmpe.txt | 14 ++---
2 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
index 127baa31a77a..1d3f84308142 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt
@@ -5,24 +5,40 @@ Required properties:
- compatible: "st,stmpe-ts"
Optional properties:
-- st,sample-time: ADC converstion time in number of clock. (0 -> 36 clocks, 1 ->
- 44 clocks, 2 -> 56 clocks, 3 -> 64 clocks, 4 -> 80 clocks, 5 -> 96 clocks, 6
- -> 144 clocks), recommended is 4.
-- st,mod-12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC)
-- st,ref-sel: ADC reference source (0 -> internal reference, 1 -> external
- reference)
-- st,adc-freq: ADC Clock speed (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 MHz)
-- st,ave-ctrl: Sample average control (0 -> 1 sample, 1 -> 2 samples, 2 -> 4
- samples, 3 -> 8 samples)
-- st,touch-det-delay: Touch detect interrupt delay (0 -> 10 us, 1 -> 50 us, 2 ->
- 100 us, 3 -> 500 us, 4-> 1 ms, 5 -> 5 ms, 6 -> 10 ms, 7 -> 50 ms) recommended
- is 3
-- st,settling: Panel driver settling time (0 -> 10 us, 1 -> 100 us, 2 -> 500 us, 3
- -> 1 ms, 4 -> 5 ms, 5 -> 10 ms, 6 for 50 ms, 7 -> 100 ms) recommended is 2
-- st,fraction-z: Length of the fractional part in z (fraction-z ([0..7]) = Count of
- the fractional part) recommended is 7
-- st,i-drive: current limit value of the touchscreen drivers (0 -> 20 mA typical 35
- mA max, 1 -> 50 mA typical 80 mA max)
+- st,sample-time : ADC conversion time in number of clock.
+ 0 -> 36 clocks 4 -> 80 clocks (recommended)
+ 1 -> 44 clocks 5 -> 96 clocks
+ 2 -> 56 clocks 6 -> 144 clocks
+ 3 -> 64 clocks
+- st,mod-12b : ADC Bit mode
+ 0 -> 10bit ADC 1 -> 12bit ADC
+- st,ref-sel : ADC reference source
+ 0 -> internal 1 -> external
+- st,adc-freq : ADC Clock speed
+ 0 -> 1.625 MHz 2 || 3 -> 6.5 MHz
+ 1 -> 3.25 MHz
+- st,ave-ctrl : Sample average control
+ 0 -> 1 sample
+ 1 -> 2 samples
+ 2 -> 4 samples
+ 3 -> 8 samples
+- st,touch-det-delay : Touch detect interrupt delay (recommended is 3)
+ 0 -> 10 us 5 -> 5 ms
+ 1 -> 50 us 6 -> 10 ms
+ 2 -> 100 us 7 -> 50 ms
+ 3 -> 500 us
+ 4 -> 1 ms
+- st,settling : Panel driver settling time (recommended is 2)
+ 0 -> 10 us 5 -> 10 ms
+ 1 -> 100 us 6 for 50 ms
+ 2 -> 500 us 7 -> 100 ms
+ 3 -> 1 ms
+ 4 -> 5 ms
+- st,fraction-z : Length of the fractional part in z (recommended is 7)
+ (fraction-z ([0..7]) = Count of the fractional part)
+- st,i-drive : current limit value of the touchscreen drivers
+ 0 -> 20 mA (typical 35mA max)
+ 1 -> 50 mA (typical 80 mA max)
Node name must be stmpe_touchscreen and should be child node of stmpe node to
which it belongs.
diff --git a/Documentation/devicetree/bindings/mfd/stmpe.txt b/Documentation/devicetree/bindings/mfd/stmpe.txt
index c797c05cd3c2..a46e7177195d 100644
--- a/Documentation/devicetree/bindings/mfd/stmpe.txt
+++ b/Documentation/devicetree/bindings/mfd/stmpe.txt
@@ -4,15 +4,15 @@ STMPE is an MFD device which may expose the following inbuilt devices: gpio,
keypad, touchscreen, adc, pwm, rotator.
Required properties:
- - compatible : "st,stmpe[610|801|811|1600|1601|2401|2403]"
- - reg : I2C/SPI address of the device
+ - compatible : "st,stmpe[610|801|811|1600|1601|2401|2403]"
+ - reg : I2C/SPI address of the device
Optional properties:
- - interrupts : The interrupt outputs from the controller
- - interrupt-controller : Marks the device node as an interrupt controller
- - wakeup-source : Marks the input device as wakable
- - st,autosleep-timeout : Valid entries (ms); 4, 16, 32, 64, 128, 256, 512 and 1024
- - irq-gpio : If present, which GPIO to use for event IRQ
+ - interrupts : The interrupt outputs from the controller
+ - interrupt-controller : Marks the device node as an interrupt controller
+ - wakeup-source : Marks the input device as wakable
+ - st,autosleep-timeout : Valid entries (ms); 4, 16, 32, 64, 128, 256, 512 and 1024
+ - irq-gpio : If present, which GPIO to use for event IRQ
Example:
--
2.19.2
^ permalink raw reply related
* Re: [PATCH v2] MAINTAINERS: add maintainers for ChromeOS EC sub-drivers
From: Chanwoo Choi @ 2018-12-12 0:55 UTC (permalink / raw)
To: Enric Balletbo i Serra, linux-kernel
Cc: Alessandro Zummo, linux-pwm, linux-iio, Alexandre Belloni,
linux-i2c, groeck, kernel, linux-rtc, Benson Leung,
Sebastian Reichel, linux-input, Dmitry Torokhov, Jonathan Cameron,
Peter Meerwald-Stadler, devicetree, Thierry Reding, linux-pm,
MyungJoo Ham, Lee Jones, Hartmut Knaack, Rob Herring,
Lars-Peter Clausen, Mark
In-Reply-To: <20181211190953.13626-1-enric.balletbo@collabora.com>
Hi Enric,
On 2018년 12월 12일 04:09, Enric Balletbo i Serra wrote:
> There are multiple ChromeOS EC sub-drivers spread in different
> subsystems, as all of them are related to the Chrome stuff add
> Benson and myself as a maintainers for all these sub-drivers.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
>
> Changes in v2:
> - Fix typo in Benson email address.
>
> MAINTAINERS | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a24129b0b043..bbe7180e2851 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3625,6 +3625,30 @@ S: Maintained
> T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git
> F: drivers/platform/chrome/
>
> +CHROMEOS EC SUBDRIVERS
> +M: Benson Leung <bleung@chromium.org>
> +M: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> +S: Maintained
> +F: Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
> +F: Documentation/devicetree/bindings/input/cros-ec-keyb.txt
> +F: Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
> +F: Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt
> +F: Documentation/devicetree/bindings/mfd/cros-ec.txt
> +F: Documentation/ABI/testing/sysfs-bus-iio-cros-ec
> +F: drivers/extcon/extcon-usbc-cros-ec.c
> +F: drivers/i2c/busses/i2c-cros-ec-tunnel.c
> +F: drivers/iio/accel/cros_ec*
> +F: drivers/iio/common/cros_ec_sensors/
> +F: drivers/iio/light/cros_ec*
> +F: drivers/iio/pressure/cros_ec*
> +F: drivers/input/keyboard/cros_ec*
> +F: drivers/mfd/cros_ec*
> +F: drivers/power/supply/cros_usbpd-charger.c
> +F: drivers/pwm/pwm-cros-ec.c
> +F: drivers/rtc/rtc-cros-ec.c
> +F: include/linux/iio/common/cros_ec_sensors_core.h
> +F: include/linux/mfd/cros_ec*
> +
> CIRRUS LOGIC AUDIO CODEC DRIVERS
> M: Brian Austin <brian.austin@cirrus.com>
> M: Paul Handrigan <Paul.Handrigan@cirrus.com>
>
For extcon part,
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
--
Best Regards,
Chanwoo Choi
Samsung Electronics
^ permalink raw reply
* Re: [PATCH v2] MAINTAINERS: add maintainers for ChromeOS EC sub-drivers
From: Sebastian Reichel @ 2018-12-11 23:09 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: linux-kernel, Alessandro Zummo, linux-pwm, linux-iio,
Alexandre Belloni, linux-i2c, groeck, kernel, linux-rtc,
Chanwoo Choi, Benson Leung, linux-input, Dmitry Torokhov,
Jonathan Cameron, Peter Meerwald-Stadler, devicetree,
Thierry Reding, linux-pm, MyungJoo Ham, Lee Jones, Hartmut Knaack,
Rob Herring, Lars-Peter
In-Reply-To: <20181211190953.13626-1-enric.balletbo@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 2110 bytes --]
Hi,
On Tue, Dec 11, 2018 at 08:09:52PM +0100, Enric Balletbo i Serra wrote:
> There are multiple ChromeOS EC sub-drivers spread in different
> subsystems, as all of them are related to the Chrome stuff add
> Benson and myself as a maintainers for all these sub-drivers.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
>
> Changes in v2:
> - Fix typo in Benson email address.
>
> MAINTAINERS | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a24129b0b043..bbe7180e2851 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3625,6 +3625,30 @@ S: Maintained
> T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git
> F: drivers/platform/chrome/
>
> +CHROMEOS EC SUBDRIVERS
> +M: Benson Leung <bleung@chromium.org>
> +M: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> +S: Maintained
> +F: Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
> +F: Documentation/devicetree/bindings/input/cros-ec-keyb.txt
> +F: Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
> +F: Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt
> +F: Documentation/devicetree/bindings/mfd/cros-ec.txt
> +F: Documentation/ABI/testing/sysfs-bus-iio-cros-ec
> +F: drivers/extcon/extcon-usbc-cros-ec.c
> +F: drivers/i2c/busses/i2c-cros-ec-tunnel.c
> +F: drivers/iio/accel/cros_ec*
> +F: drivers/iio/common/cros_ec_sensors/
> +F: drivers/iio/light/cros_ec*
> +F: drivers/iio/pressure/cros_ec*
> +F: drivers/input/keyboard/cros_ec*
> +F: drivers/mfd/cros_ec*
> +F: drivers/power/supply/cros_usbpd-charger.c
> +F: drivers/pwm/pwm-cros-ec.c
> +F: drivers/rtc/rtc-cros-ec.c
> +F: include/linux/iio/common/cros_ec_sensors_core.h
> +F: include/linux/mfd/cros_ec*
Maybe just use the following (+ extra F entry for cros_usbpd, which
does not have the ec part)?
N: cros[-_]ec
-- Sebastian
> CIRRUS LOGIC AUDIO CODEC DRIVERS
> M: Brian Austin <brian.austin@cirrus.com>
> M: Paul Handrigan <Paul.Handrigan@cirrus.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH v2] MAINTAINERS: add maintainers for ChromeOS EC sub-drivers
From: Wolfram Sang @ 2018-12-11 19:13 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: linux-kernel, Alessandro Zummo, linux-pwm, linux-iio,
Alexandre Belloni, linux-i2c, groeck, kernel, linux-rtc,
Chanwoo Choi, Benson Leung, Sebastian Reichel, linux-input,
Dmitry Torokhov, Jonathan Cameron, Peter Meerwald-Stadler,
devicetree, Thierry Reding, linux-pm, MyungJoo Ham, Lee Jones,
Hartmut Knaack, Rob
In-Reply-To: <20181211190953.13626-1-enric.balletbo@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
On Tue, Dec 11, 2018 at 08:09:52PM +0100, Enric Balletbo i Serra wrote:
> There are multiple ChromeOS EC sub-drivers spread in different
> subsystems, as all of them are related to the Chrome stuff add
> Benson and myself as a maintainers for all these sub-drivers.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Great, thanks!
Acked-by: Wolfram Sang <wsa@the-dreams.de>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* [PATCH v2] MAINTAINERS: add maintainers for ChromeOS EC sub-drivers
From: Enric Balletbo i Serra @ 2018-12-11 19:09 UTC (permalink / raw)
To: linux-kernel
Cc: Alessandro Zummo, linux-pwm, linux-iio, Alexandre Belloni,
linux-i2c, groeck, kernel, linux-rtc, Chanwoo Choi, Benson Leung,
Sebastian Reichel, linux-input, Dmitry Torokhov, Jonathan Cameron,
Peter Meerwald-Stadler, devicetree, Thierry Reding, linux-pm,
MyungJoo Ham, Lee Jones, Hartmut Knaack, Rob Herring, Lars
There are multiple ChromeOS EC sub-drivers spread in different
subsystems, as all of them are related to the Chrome stuff add
Benson and myself as a maintainers for all these sub-drivers.
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes in v2:
- Fix typo in Benson email address.
MAINTAINERS | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index a24129b0b043..bbe7180e2851 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3625,6 +3625,30 @@ S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git
F: drivers/platform/chrome/
+CHROMEOS EC SUBDRIVERS
+M: Benson Leung <bleung@chromium.org>
+M: Enric Balletbo i Serra <enric.balletbo@collabora.com>
+S: Maintained
+F: Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
+F: Documentation/devicetree/bindings/input/cros-ec-keyb.txt
+F: Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
+F: Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt
+F: Documentation/devicetree/bindings/mfd/cros-ec.txt
+F: Documentation/ABI/testing/sysfs-bus-iio-cros-ec
+F: drivers/extcon/extcon-usbc-cros-ec.c
+F: drivers/i2c/busses/i2c-cros-ec-tunnel.c
+F: drivers/iio/accel/cros_ec*
+F: drivers/iio/common/cros_ec_sensors/
+F: drivers/iio/light/cros_ec*
+F: drivers/iio/pressure/cros_ec*
+F: drivers/input/keyboard/cros_ec*
+F: drivers/mfd/cros_ec*
+F: drivers/power/supply/cros_usbpd-charger.c
+F: drivers/pwm/pwm-cros-ec.c
+F: drivers/rtc/rtc-cros-ec.c
+F: include/linux/iio/common/cros_ec_sensors_core.h
+F: include/linux/mfd/cros_ec*
+
CIRRUS LOGIC AUDIO CODEC DRIVERS
M: Brian Austin <brian.austin@cirrus.com>
M: Paul Handrigan <Paul.Handrigan@cirrus.com>
--
2.19.2
^ permalink raw reply related
* Re: [PATCH] MAINTAINERS: add maintainers for ChromeOS EC sub-drivers
From: Enric Balletbo i Serra @ 2018-12-11 19:05 UTC (permalink / raw)
To: linux-kernel
Cc: Alessandro Zummo, linux-pwm, linux-iio, Alexandre Belloni,
linux-i2c, groeck, kernel, linux-rtc, Chanwoo Choi,
Sebastian Reichel, linux-input, Dmitry Torokhov, Jonathan Cameron,
Peter Meerwald-Stadler, devicetree, Thierry Reding, linux-pm,
MyungJoo Ham, Lee Jones, Hartmut Knaack, Rob Herring,
Lars-Peter Clausen, Ma
In-Reply-To: <20181211190053.9997-1-enric.balletbo@collabora.com>
On 11/12/18 20:00, Enric Balletbo i Serra wrote:
> There are multiple ChromeOS EC sub-drivers spread in different
> subsystems, as all of them are related to the Chrome stuff add
> Benson and myself as a maintainers for all these sub-drivers.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
>
> MAINTAINERS | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
Sorry, I'll send a second version right now, there is a typo in Benson address.
Sorry for the noise.
Thanks,
Enric
^ permalink raw reply
* [PATCH] MAINTAINERS: add maintainers for ChromeOS EC sub-drivers
From: Enric Balletbo i Serra @ 2018-12-11 19:00 UTC (permalink / raw)
To: linux-kernel
Cc: Alessandro Zummo, linux-pwm, linux-iio, Alexandre Belloni,
linux-i2c, groeck, kernel, linux-rtc, Chanwoo Choi,
Sebastian Reichel, linux-input, Dmitry Torokhov, Jonathan Cameron,
Peter Meerwald-Stadler, devicetree, Thierry Reding, linux-pm,
Benson Leung, MyungJoo Ham, Lee Jones, Hartmut Knaack,
Rob Herring, Lar
There are multiple ChromeOS EC sub-drivers spread in different
subsystems, as all of them are related to the Chrome stuff add
Benson and myself as a maintainers for all these sub-drivers.
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
MAINTAINERS | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index a24129b0b043..2f24f5c977ca 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3625,6 +3625,30 @@ S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git
F: drivers/platform/chrome/
+CHROMEOS EC SUBDRIVERS
+M: Benson Leung <bleung@chromiumg.org>
+M: Enric Balletbo i Serra <enric.balletbo@collabora.com>
+S: Maintained
+F: Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
+F: Documentation/devicetree/bindings/input/cros-ec-keyb.txt
+F: Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
+F: Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt
+F: Documentation/devicetree/bindings/mfd/cros-ec.txt
+F: Documentation/ABI/testing/sysfs-bus-iio-cros-ec
+F: drivers/extcon/extcon-usbc-cros-ec.c
+F: drivers/i2c/busses/i2c-cros-ec-tunnel.c
+F: drivers/iio/accel/cros_ec*
+F: drivers/iio/common/cros_ec_sensors/
+F: drivers/iio/light/cros_ec*
+F: drivers/iio/pressure/cros_ec*
+F: drivers/input/keyboard/cros_ec*
+F: drivers/mfd/cros_ec*
+F: drivers/power/supply/cros_usbpd-charger.c
+F: drivers/pwm/pwm-cros-ec.c
+F: drivers/rtc/rtc-cros-ec.c
+F: include/linux/iio/common/cros_ec_sensors_core.h
+F: include/linux/mfd/cros_ec*
+
CIRRUS LOGIC AUDIO CODEC DRIVERS
M: Brian Austin <brian.austin@cirrus.com>
M: Paul Handrigan <Paul.Handrigan@cirrus.com>
--
2.19.2
^ permalink raw reply related
* [PATCH v3] Input: touchscreen: Fix coding style issue
From: Hardik Singh Rathore @ 2018-12-11 13:03 UTC (permalink / raw)
To: dmitry.torokhov
Cc: michael.hennerich, linux-input, linux-kernel, joe,
Hardik Singh Rathore
In-Reply-To: <20181211111740.25643-1-hardiksingh.k@gmail.com>
This patch fixes the coding style problem reported
by checkpatch.pl as below:
ERROR: foo* bar should be "foo *bar"
Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com>
---
v3:
- v2 was depends on v1 so it didn't solve the issue.
drivers/input/touchscreen/ad7879.c | 2 +-
drivers/input/touchscreen/ektf2127.c | 2 +-
drivers/input/touchscreen/gunze.c | 4 ++--
drivers/input/touchscreen/inexio.c | 4 ++--
drivers/input/touchscreen/mtouch.c | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
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);
diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c
index 0ed34ff787ce..28fa1b36f7a5 100644
--- a/drivers/input/touchscreen/ektf2127.c
+++ b/drivers/input/touchscreen/ektf2127.c
@@ -51,7 +51,7 @@ struct ektf2127_ts {
struct touchscreen_properties prop;
};
-static void ektf2127_parse_coordinates(const u8* buf, unsigned int touch_count,
+static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count,
struct input_mt_pos *touches)
{
int index = 0;
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index 054c2537b392..56cf1a1ea3ea 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -53,7 +53,7 @@ struct gunze {
char phys[32];
};
-static void gunze_process_packet(struct gunze* gunze)
+static void gunze_process_packet(struct gunze *gunze)
{
struct input_dev *dev = gunze->dev;
@@ -72,7 +72,7 @@ static void gunze_process_packet(struct gunze* gunze)
static irqreturn_t gunze_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct gunze* gunze = serio_get_drvdata(serio);
+ struct gunze *gunze = serio_get_drvdata(serio);
if (data == '\r') {
gunze_process_packet(gunze);
diff --git a/drivers/input/touchscreen/inexio.c b/drivers/input/touchscreen/inexio.c
index b9bc56233ccc..13bd0bf580a7 100644
--- a/drivers/input/touchscreen/inexio.c
+++ b/drivers/input/touchscreen/inexio.c
@@ -79,7 +79,7 @@ static void inexio_process_data(struct inexio *pinexio)
static irqreturn_t inexio_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct inexio* pinexio = serio_get_drvdata(serio);
+ struct inexio *pinexio = serio_get_drvdata(serio);
pinexio->data[pinexio->idx] = data;
@@ -97,7 +97,7 @@ static irqreturn_t inexio_interrupt(struct serio *serio,
static void inexio_disconnect(struct serio *serio)
{
- struct inexio* pinexio = serio_get_drvdata(serio);
+ struct inexio *pinexio = serio_get_drvdata(serio);
input_get_device(pinexio->dev);
input_unregister_device(pinexio->dev);
diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c
index a3707fad4d1c..8278a9058640 100644
--- a/drivers/input/touchscreen/mtouch.c
+++ b/drivers/input/touchscreen/mtouch.c
@@ -90,7 +90,7 @@ static void mtouch_process_response(struct mtouch *mtouch)
static irqreturn_t mtouch_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct mtouch* mtouch = serio_get_drvdata(serio);
+ struct mtouch *mtouch = serio_get_drvdata(serio);
mtouch->data[mtouch->idx] = data;
@@ -110,7 +110,7 @@ static irqreturn_t mtouch_interrupt(struct serio *serio,
static void mtouch_disconnect(struct serio *serio)
{
- struct mtouch* mtouch = serio_get_drvdata(serio);
+ struct mtouch *mtouch = serio_get_drvdata(serio);
input_get_device(mtouch->dev);
input_unregister_device(mtouch->dev);
--
2.17.1
^ permalink raw reply related
* Re: [PATCH] Input: touchscreen: ad7879: Fix ERROR: foo* bar should be "foo *bar"
From: Hardiksingh Rathore @ 2018-12-11 11:49 UTC (permalink / raw)
To: joe; +Cc: Dmitry Torokhov, michael.hennerich, linux-input, linux-kernel
In-Reply-To: <44f0a055e4085824629285e78ac4928e15c494e3.camel@perches.com>
Hi Joe,
On Tue, 11 Dec 2018 at 01:07, Joe Perches <joe@perches.com> wrote:
>
> On Mon, 2018-12-10 at 21:14 +0530, Hardik Singh Rathore wrote:
> > Fix the coding style problem reported by checkpatch.pl.
>
> While whitespace only checkpatch cleanups are generally not
> well accepted, why do one pointer location cleanup when you
> could them all:
>
As suggested, I have sent the v2 patch for pointer location cleanups
in all other
drivers/input/touchscreen/* files.
> $ ./scripts/checkpatch.pl -f --types=pointer_location --fix-inplace drivers/input/touchscreen/*.[ch]
> $ git diff --stat -p drivers/input/touchscreen/
>
> produces:
> ---
> drivers/input/touchscreen/ad7879.c | 2 +-
> drivers/input/touchscreen/ektf2127.c | 2 +-
> drivers/input/touchscreen/gunze.c | 4 ++--
> drivers/input/touchscreen/inexio.c | 4 ++--
> drivers/input/touchscreen/mtouch.c | 4 ++--
> 5 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
> index 2aae880c8aa6..6fa714c587b4 100644
> --- a/drivers/input/touchscreen/ad7879.c
> +++ b/drivers/input/touchscreen/ad7879.c
> @@ -289,7 +289,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);
>
> diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c
> index 0ed34ff787ce..28fa1b36f7a5 100644
> --- a/drivers/input/touchscreen/ektf2127.c
> +++ b/drivers/input/touchscreen/ektf2127.c
> @@ -51,7 +51,7 @@ struct ektf2127_ts {
> struct touchscreen_properties prop;
> };
>
> -static void ektf2127_parse_coordinates(const u8* buf, unsigned int touch_count,
> +static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count,
> struct input_mt_pos *touches)
> {
> int index = 0;
> diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
> index 054c2537b392..56cf1a1ea3ea 100644
> --- a/drivers/input/touchscreen/gunze.c
> +++ b/drivers/input/touchscreen/gunze.c
> @@ -53,7 +53,7 @@ struct gunze {
> char phys[32];
> };
>
> -static void gunze_process_packet(struct gunze* gunze)
> +static void gunze_process_packet(struct gunze *gunze)
> {
> struct input_dev *dev = gunze->dev;
>
> @@ -72,7 +72,7 @@ static void gunze_process_packet(struct gunze* gunze)
> static irqreturn_t gunze_interrupt(struct serio *serio,
> unsigned char data, unsigned int flags)
> {
> - struct gunze* gunze = serio_get_drvdata(serio);
> + struct gunze *gunze = serio_get_drvdata(serio);
>
> if (data == '\r') {
> gunze_process_packet(gunze);
> diff --git a/drivers/input/touchscreen/inexio.c b/drivers/input/touchscreen/inexio.c
> index b9bc56233ccc..13bd0bf580a7 100644
> --- a/drivers/input/touchscreen/inexio.c
> +++ b/drivers/input/touchscreen/inexio.c
> @@ -79,7 +79,7 @@ static void inexio_process_data(struct inexio *pinexio)
> static irqreturn_t inexio_interrupt(struct serio *serio,
> unsigned char data, unsigned int flags)
> {
> - struct inexio* pinexio = serio_get_drvdata(serio);
> + struct inexio *pinexio = serio_get_drvdata(serio);
>
> pinexio->data[pinexio->idx] = data;
>
> @@ -97,7 +97,7 @@ static irqreturn_t inexio_interrupt(struct serio *serio,
>
> static void inexio_disconnect(struct serio *serio)
> {
> - struct inexio* pinexio = serio_get_drvdata(serio);
> + struct inexio *pinexio = serio_get_drvdata(serio);
>
> input_get_device(pinexio->dev);
> input_unregister_device(pinexio->dev);
> diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c
> index a3707fad4d1c..8278a9058640 100644
> --- a/drivers/input/touchscreen/mtouch.c
> +++ b/drivers/input/touchscreen/mtouch.c
> @@ -90,7 +90,7 @@ static void mtouch_process_response(struct mtouch *mtouch)
> static irqreturn_t mtouch_interrupt(struct serio *serio,
> unsigned char data, unsigned int flags)
> {
> - struct mtouch* mtouch = serio_get_drvdata(serio);
> + struct mtouch *mtouch = serio_get_drvdata(serio);
>
> mtouch->data[mtouch->idx] = data;
>
> @@ -110,7 +110,7 @@ static irqreturn_t mtouch_interrupt(struct serio *serio,
>
> static void mtouch_disconnect(struct serio *serio)
> {
> - struct mtouch* mtouch = serio_get_drvdata(serio);
> + struct mtouch *mtouch = serio_get_drvdata(serio);
>
> input_get_device(mtouch->dev);
> input_unregister_device(mtouch->dev);
>
>
--
Thanks,
Hardik
^ permalink raw reply
* [PATCH v2 2/2] input: add official Raspberry Pi's touchscreen driver
From: Nicolas Saenz Julienne @ 2018-12-11 11:23 UTC (permalink / raw)
To: Henrik Rydberg
Cc: linux-rpi-kernel, stefan.wahren, eric, agraf, afaerber,
Nicolas Saenz Julienne, Dmitry Torokhov, Corentin Labbe,
Mark Jonas, Masanari Iida, Heiko Schocher, Hans de Goede,
Eugen Hristev, Zhu Yi, Jonathan Cameron, linux-kernel,
linux-input
In-Reply-To: <20181211112408.9524-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 | 227 +++++++++++++++++++++
3 files changed, 240 insertions(+)
create mode 100644 drivers/input/touchscreen/raspberrypi-ts.c
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 2a80675cfd94..af6027cc7bbf 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_FW
+ tristate "Raspberry Pi's firmware base touch screen support"
+ depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST
+ help
+ Say Y here if you have the official Raspberry Pi 7 inch screen 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..fcc7605fba8d 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_FW) += 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..7f8873eb2379
--- /dev/null
+++ b/drivers/input/touchscreen/raspberrypi-ts.c
@@ -0,0 +1,227 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Raspberry Pi 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/of.h>
+#include <linux/slab.h>
+#include <linux/device.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 */
+
+#define RPI_TS_NPOINTS_REG_INVALIDATE 99
+
+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];
+};
+
+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(®s, ts->fw_regs_va, sizeof(regs));
+ /*
+ * 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)
+ */
+ iowrite8(RPI_TS_NPOINTS_REG_INVALIDATE,
+ ts->fw_regs_va + offsetof(struct rpi_ts_regs, num_points));
+
+ if (regs.num_points == RPI_TS_NPOINTS_REG_INVALIDATE ||
+ (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;
+
+ 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 error;
+
+ 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)
+ return -ENOMEM;
+ ts->pdev = pdev;
+
+ 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;
+ }
+
+ error = devm_add_action_or_reset(dev, rpi_ts_dma_cleanup, ts);
+ if (error) {
+ dev_err(dev, "failed to devm_add_action_or_reset, %d\n", error);
+ return error;
+ }
+
+
+ touchbuf = (u32)ts->fw_regs_phys;
+ error = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF,
+ &touchbuf, sizeof(touchbuf));
+
+ if (error || touchbuf != 0) {
+ dev_warn(dev, "Failed to set touchbuf, %d\n", error);
+ return error;
+ }
+
+ 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;
+
+ 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);
+
+ error = input_mt_init_slots(input, RPI_TS_MAX_SUPPORTED_POINTS,
+ INPUT_MT_DIRECT);
+ if (error) {
+ dev_err(dev, "could not init mt slots, %d\n", error);
+ return error;
+ }
+
+ error = input_register_polled_device(poll_dev);
+ if (error) {
+ dev_err(dev, "could not register input device, %d\n", error);
+ return error;
+ }
+
+ 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 firmware based touchscreen driver");
+MODULE_LICENSE("GPL v2");
--
2.19.2
^ permalink raw reply related
* [PATCH v2 1/2] dt-bindings: input: Add Raspberry Pi Touchscreen
From: Nicolas Saenz Julienne @ 2018-12-11 11:23 UTC (permalink / raw)
To: linux-kernel
Cc: linux-rpi-kernel, stefan.wahren, eric, agraf, afaerber,
Nicolas Saenz Julienne, Dmitry Torokhov, Rob Herring,
Mark Rutland, linux-input, devicetree
In-Reply-To: <20181211112408.9524-1-nsaenzjulienne@suse.de>
Adds device tree documentation for Raspberry Pi's official 7"
touchscreen.
This binding is meant to be used as an overlay.
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..2a1af240ccc3
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/raspberrypi,firmware-ts.txt
@@ -0,0 +1,26 @@
+Raspberry Pi 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 v2 0/2] input: driver for RPi's official 7" touchscreen
From: Nicolas Saenz Julienne @ 2018-12-11 11:23 UTC (permalink / raw)
To: linux-kernel
Cc: linux-rpi-kernel, stefan.wahren, eric, agraf, afaerber,
Nicolas Saenz Julienne, Dmitry Torokhov, Masanari Iida,
Rob Herring, Hans de Goede, Zhu Yi, Eugen Hristev, Corentin Labbe,
Hans-Christian Noren Egtvedt, Mark Jonas, Heiko Schocher,
linux-input, devicetree
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
v1 -> v2:
- Remove all references to RPi3
- Spelling errors
- Rename config string
- Reorder devm_add_action_or_reset()
- Remove __set_bit(EV* functions
- Remove INPUT_MT_POINTER flag
- Add missing header files
- Create define to invalidate npointers
- Fix commit ordering and titles
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):
dt-bindings: input: Add Raspberry Pi Touchscreen
input: add official Raspberry Pi's touchscreen driver
.../touchscreen/raspberrypi,firmware-ts.txt | 26 ++
drivers/input/touchscreen/Kconfig | 12 +
drivers/input/touchscreen/Makefile | 1 +
drivers/input/touchscreen/raspberrypi-ts.c | 227 ++++++++++++++++++
4 files changed, 266 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 v2] Input: touchscreen: Fix ERROR: foo* bar should be "foo *bar"
From: Hardik Singh Rathore @ 2018-12-11 11:17 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, linux-kernel, joe, Hardik Singh Rathore
In-Reply-To: <20181210154433.28319-1-hardiksingh.k@gmail.com>
This patch fixes the coding style problem reported by checkpatch.pl.
Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com>
---
v2:
- fix the pointer location style problem in drivers/input/touchscreen/*
files leftover in previous patch.
drivers/input/touchscreen/ektf2127.c | 2 +-
drivers/input/touchscreen/gunze.c | 4 ++--
drivers/input/touchscreen/inexio.c | 4 ++--
drivers/input/touchscreen/mtouch.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c
index 0ed34ff787ce..28fa1b36f7a5 100644
--- a/drivers/input/touchscreen/ektf2127.c
+++ b/drivers/input/touchscreen/ektf2127.c
@@ -51,7 +51,7 @@ struct ektf2127_ts {
struct touchscreen_properties prop;
};
-static void ektf2127_parse_coordinates(const u8* buf, unsigned int touch_count,
+static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count,
struct input_mt_pos *touches)
{
int index = 0;
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index 054c2537b392..56cf1a1ea3ea 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -53,7 +53,7 @@ struct gunze {
char phys[32];
};
-static void gunze_process_packet(struct gunze* gunze)
+static void gunze_process_packet(struct gunze *gunze)
{
struct input_dev *dev = gunze->dev;
@@ -72,7 +72,7 @@ static void gunze_process_packet(struct gunze* gunze)
static irqreturn_t gunze_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct gunze* gunze = serio_get_drvdata(serio);
+ struct gunze *gunze = serio_get_drvdata(serio);
if (data == '\r') {
gunze_process_packet(gunze);
diff --git a/drivers/input/touchscreen/inexio.c b/drivers/input/touchscreen/inexio.c
index b9bc56233ccc..13bd0bf580a7 100644
--- a/drivers/input/touchscreen/inexio.c
+++ b/drivers/input/touchscreen/inexio.c
@@ -79,7 +79,7 @@ static void inexio_process_data(struct inexio *pinexio)
static irqreturn_t inexio_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct inexio* pinexio = serio_get_drvdata(serio);
+ struct inexio *pinexio = serio_get_drvdata(serio);
pinexio->data[pinexio->idx] = data;
@@ -97,7 +97,7 @@ static irqreturn_t inexio_interrupt(struct serio *serio,
static void inexio_disconnect(struct serio *serio)
{
- struct inexio* pinexio = serio_get_drvdata(serio);
+ struct inexio *pinexio = serio_get_drvdata(serio);
input_get_device(pinexio->dev);
input_unregister_device(pinexio->dev);
diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c
index a3707fad4d1c..8278a9058640 100644
--- a/drivers/input/touchscreen/mtouch.c
+++ b/drivers/input/touchscreen/mtouch.c
@@ -90,7 +90,7 @@ static void mtouch_process_response(struct mtouch *mtouch)
static irqreturn_t mtouch_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct mtouch* mtouch = serio_get_drvdata(serio);
+ struct mtouch *mtouch = serio_get_drvdata(serio);
mtouch->data[mtouch->idx] = data;
@@ -110,7 +110,7 @@ static irqreturn_t mtouch_interrupt(struct serio *serio,
static void mtouch_disconnect(struct serio *serio)
{
- struct mtouch* mtouch = serio_get_drvdata(serio);
+ struct mtouch *mtouch = serio_get_drvdata(serio);
input_get_device(mtouch->dev);
input_unregister_device(mtouch->dev);
--
2.17.1
^ permalink raw reply related
* [PATCH v2 -next] input: keyboard: remove duplicated include from mtk-pmic-keys.c
From: YueHaibing @ 2018-12-11 9:32 UTC (permalink / raw)
To: dmitry.torokhov, matthias.bgg, lee.jones, chen.zhong
Cc: linux-kernel, linux-mediatek, linux-arm-kernel, linux-input,
YueHaibing
alphabetise the header files and remove duplicated include
file linux/kernel.h
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: alphabetise the header files
---
drivers/input/keyboard/mtk-pmic-keys.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 02c67a1..8e6ebab 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -14,18 +14,17 @@
*
*/
-#include <linux/module.h>
-#include <linux/kernel.h>
#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>
#include <linux/mfd/mt6323/registers.h>
-#include <linux/mfd/mt6397/registers.h>
#include <linux/mfd/mt6397/core.h>
+#include <linux/mfd/mt6397/registers.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
#define MTK_PMIC_PWRKEY_RST_EN_MASK 0x1
#define MTK_PMIC_PWRKEY_RST_EN_SHIFT 6
--
2.7.4
^ permalink raw reply related
* Re: [PATCH 2/2] Input: raspberrypi-ts - add devicetree binding documentation
From: Stefan Wahren @ 2018-12-10 19:57 UTC (permalink / raw)
To: Nicolas Saenz Julienne, linux-kernel
Cc: linux-rpi-kernel, eric, agraf, Dmitry Torokhov, Rob Herring,
Mark Rutland, linux-input, devicetree
In-Reply-To: <20181210163036.24813-3-nsaenzjulienne@suse.de>
Hi Nicolas,
please change your subject to something like this:
dt-bindings: input: Add Raspberry Pi Touchscreen
and also change the order of your patches. The binding always comes first.
> Nicolas Saenz Julienne <nsaenzjulienne@suse.de> hat am 10. Dezember 2018 um 17:30 geschrieben:
>
>
> Adds device tree documentation for Raspberry Pi's official 7"
> touchscreen.
Maybe you should mention that we need this binding for an overlay.
>
> 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
Please drop the 3 here
> +=====================================
> +
> +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
* Re: [PATCH 1/2] input: add official Raspberry Pi's touchscreen driver
From: Stefan Wahren @ 2018-12-10 19:45 UTC (permalink / raw)
To: Nicolas Saenz Julienne, Henrik Rydberg
Cc: linux-rpi-kernel, eric, agraf, 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-2-nsaenzjulienne@suse.de>
Hi Nicolas,
> Nicolas Saenz Julienne <nsaenzjulienne@suse.de> hat am 10. Dezember 2018 um 17:30 geschrieben:
>
>
> 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
I assume TS stands for TOUCHSCREEN, so we can use just TOUCHSCREEN_RASPBERRYPI or TOUCHSCREEN_RASPBERRYPI_FW
> + 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
s/offitial/official/
s/7'/7 inch/
s/scren/screen/
> + 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
AFAIK this driver isn't specific to a Raspberry Pi version, so we can drop the 3
> + *
> + * 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>
I'm missing linux/of.h and linux/device.h here.
> +#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)
> + */
I suggest to move this comment below to the memcpy_fromio.
> +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(®s, ts->fw_regs_va, sizeof(regs));
> + iowrite8(99, ts->fw_regs_va + offsetof(struct rpi_ts_regs, num_points));
I don't have a good name suggestion, but i think the magic 99 should be a define.
> +
> + 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");
AFAIK devm_kzalloc already prints an error
> + 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 is an integer so %d
> + 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");
Please also drop the 3 here
> +MODULE_LICENSE("GPL v2");
> --
> 2.19.2
>
^ permalink raw reply
* Re: [PATCH] Input: touchscreen: ad7879: Fix ERROR: foo* bar should be "foo *bar"
From: Joe Perches @ 2018-12-10 19:37 UTC (permalink / raw)
To: Hardik Singh Rathore, dmitry.torokhov
Cc: michael.hennerich, linux-input, linux-kernel
In-Reply-To: <20181210154433.28319-1-hardiksingh.k@gmail.com>
On Mon, 2018-12-10 at 21:14 +0530, Hardik Singh Rathore wrote:
> Fix the coding style problem reported by checkpatch.pl.
While whitespace only checkpatch cleanups are generally not
well accepted, why do one pointer location cleanup when you
could them all:
$ ./scripts/checkpatch.pl -f --types=pointer_location --fix-inplace drivers/input/touchscreen/*.[ch]
$ git diff --stat -p drivers/input/touchscreen/
produces:
---
drivers/input/touchscreen/ad7879.c | 2 +-
drivers/input/touchscreen/ektf2127.c | 2 +-
drivers/input/touchscreen/gunze.c | 4 ++--
drivers/input/touchscreen/inexio.c | 4 ++--
drivers/input/touchscreen/mtouch.c | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 2aae880c8aa6..6fa714c587b4 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -289,7 +289,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);
diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c
index 0ed34ff787ce..28fa1b36f7a5 100644
--- a/drivers/input/touchscreen/ektf2127.c
+++ b/drivers/input/touchscreen/ektf2127.c
@@ -51,7 +51,7 @@ struct ektf2127_ts {
struct touchscreen_properties prop;
};
-static void ektf2127_parse_coordinates(const u8* buf, unsigned int touch_count,
+static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count,
struct input_mt_pos *touches)
{
int index = 0;
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index 054c2537b392..56cf1a1ea3ea 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -53,7 +53,7 @@ struct gunze {
char phys[32];
};
-static void gunze_process_packet(struct gunze* gunze)
+static void gunze_process_packet(struct gunze *gunze)
{
struct input_dev *dev = gunze->dev;
@@ -72,7 +72,7 @@ static void gunze_process_packet(struct gunze* gunze)
static irqreturn_t gunze_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct gunze* gunze = serio_get_drvdata(serio);
+ struct gunze *gunze = serio_get_drvdata(serio);
if (data == '\r') {
gunze_process_packet(gunze);
diff --git a/drivers/input/touchscreen/inexio.c b/drivers/input/touchscreen/inexio.c
index b9bc56233ccc..13bd0bf580a7 100644
--- a/drivers/input/touchscreen/inexio.c
+++ b/drivers/input/touchscreen/inexio.c
@@ -79,7 +79,7 @@ static void inexio_process_data(struct inexio *pinexio)
static irqreturn_t inexio_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct inexio* pinexio = serio_get_drvdata(serio);
+ struct inexio *pinexio = serio_get_drvdata(serio);
pinexio->data[pinexio->idx] = data;
@@ -97,7 +97,7 @@ static irqreturn_t inexio_interrupt(struct serio *serio,
static void inexio_disconnect(struct serio *serio)
{
- struct inexio* pinexio = serio_get_drvdata(serio);
+ struct inexio *pinexio = serio_get_drvdata(serio);
input_get_device(pinexio->dev);
input_unregister_device(pinexio->dev);
diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c
index a3707fad4d1c..8278a9058640 100644
--- a/drivers/input/touchscreen/mtouch.c
+++ b/drivers/input/touchscreen/mtouch.c
@@ -90,7 +90,7 @@ static void mtouch_process_response(struct mtouch *mtouch)
static irqreturn_t mtouch_interrupt(struct serio *serio,
unsigned char data, unsigned int flags)
{
- struct mtouch* mtouch = serio_get_drvdata(serio);
+ struct mtouch *mtouch = serio_get_drvdata(serio);
mtouch->data[mtouch->idx] = data;
@@ -110,7 +110,7 @@ static irqreturn_t mtouch_interrupt(struct serio *serio,
static void mtouch_disconnect(struct serio *serio)
{
- struct mtouch* mtouch = serio_get_drvdata(serio);
+ struct mtouch *mtouch = serio_get_drvdata(serio);
input_get_device(mtouch->dev);
input_unregister_device(mtouch->dev);
^ permalink raw reply related
* Re: [PATCH 1/2] input: add official Raspberry Pi's touchscreen driver
From: Dmitry Torokhov @ 2018-12-10 19:02 UTC (permalink / raw)
To: Nicolas Saenz Julienne
Cc: Henrik Rydberg, linux-rpi-kernel, stefan.wahren, eric, agraf,
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-2-nsaenzjulienne@suse.de>
Hi Nicolas,
On Mon, Dec 10, 2018 at 05:30:20PM +0100, Nicolas Saenz Julienne wrote:
> 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.
I believe we are almost there, just a couple of nits.
>
> 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(®s, 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)
Drop the condition.
> + 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;
This call needs to be after dma_zalloc_coherent(). Also (my personal
preference) can we please call this variable "error"? Then we can write
"if (error) ...".
> +
> + 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);
No need to set these, EV_SYN is set by the input core, and KEY/ABS are
by input_set_abs_params() and input_mt_init_slots().
> +
> + 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);
Error handling here please. Also, for touchscreens you do not need to
set INPUT_MT_POINTER, just INPUT_MT_DIRECT.
> +
> + 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
>
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v3] Input: i8042 add i8042_is_mr_coffee() helper to avoid refconut leak
From: kbuild test robot @ 2018-12-10 17:02 UTC (permalink / raw)
Cc: kbuild-all, dmitry.torokhov, linux-input, linux-kernel,
Yangtao Li
In-Reply-To: <20181209061428.19205-1-tiny.windzz@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2057 bytes --]
Hi Yangtao,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on input/next]
[also build test ERROR on v4.20-rc6 next-20181207]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Yangtao-Li/Input-i8042-add-i8042_is_mr_coffee-helper-to-avoid-refconut-leak/20181209-175146
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: sparc-defconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=sparc
All error/warnings (new ones prefixed by >>):
In file included from drivers/input/serio/i8042.h:26,
from drivers/input/serio/i8042.c:132:
drivers/input/serio/i8042-sparcio.h: In function 'i8042_is_mr_coffee':
>> drivers/input/serio/i8042-sparcio.h:118:9: error: 'is_mr_coffee' undeclared (first use in this function); did you mean 'is_mr_coffree'?
return is_mr_coffee;
^~~~~~~~~~~~
is_mr_coffree
drivers/input/serio/i8042-sparcio.h:118:9: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/input/serio/i8042-sparcio.h:119:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vim +118 drivers/input/serio/i8042-sparcio.h
108
109 static inline bool i8042_is_mr_coffee(void)
110 {
111 struct device_node *root;
112 bool is_mr_coffree;
113
114 root = of_find_node_by_path("/");
115 is_mr_coffree = !strcmp(root->name, "SUNW,JavaStation-1");
116 of_node_put(root);
117
> 118 return is_mr_coffee;
> 119 }
120
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 11537 bytes --]
^ permalink raw reply
* [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
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