Skip to contentSkip to conversation

Add Himax hx83112b touchscreen driver

PATCH Superseded Job Noorman 2 participants 6 messages Oct 24, 2022 – Oct 29, 2022

Subsystems (6)
lore
Share & tools
lore

Job Noorman

author maintainer
#0 lore raw

v6 cover Add Himax hx83112b touchscreen driver

Hi all,

This series adds support for the Himax hx83112b. The hx83112b supports 10 point multitouch with hardware tracking of touch points. It is the touchschreen used by the Fairphone 3.

Note that a datasheet was unavailable for this device, so it was built based on the Android driver that was tagged as GPLv2. This series is a complete rewrite, though, and the code bears no resemblence to the original implementation.

It is expected that this driver can be made to work on other hx83xxx devices, especially the hx83112a used in the Fairphone 4. However, since we have been unable to verify this, this driver only declares compatibility with the hx83112b and uses very specific file names.

Changes since v5 (based on Jeff LaBundy's 3rd round of comments):
- Consistently reuse local variable dev in himax_probe()

Changes since v4 (based on Jeff LaBundy's 2nd round of comments):
- Kconfig: depend on I2C and select REGMAP_I2C
- Don't suppress dev_err() on EPROBE_DEFER
- Some minor coding style updates

Changes since v3 (based on Dmitry Torokhov's comments):
- Use gpiod_set_value_cansleep (instead of gpiod_set_value) during probe
- Inline some small helper functions
- Use DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
- Use PTR_ERR_OR_ZERO instead of IS_ERR+PTR_ERR
- Some minor coding style updates (e.g., use C-style comments)

Changes since v2 (based on Jeff LaBundy's comments):
- Kconfig: depend on REGMAP_I2C instead of I2C
- Don't use dev_err_probe()
- Return IRQ_NONE on failed register reads to prevent possible interrupt storm
- Add small delay after de-asserting reset pin
- Some minor coding style updates
- dt-bindings: make touchscreen-size-{x,y} required

Changes since v1:
- Fix sparse warnings. Reported-by: kernel test robot <[email protected]>.
- Fix dt_binding_check.

Best regards,
Job

Previous versions:
- v5: https://lore.kernel.org/lkml/[email protected]/
- v4: https://lore.kernel.org/lkml/[email protected]/
- v3: https://lore.kernel.org/lkml/[email protected]/
- v2: https://lore.kernel.org/lkml/[email protected]/
- v1: https://lore.kernel.org/lkml/[email protected]/

Job Noorman (3):
dt-bindings: touchscreen: add Himax hx83112b bindings
Input: add driver for Himax hx83112b touchscreen devices
arm64: dts: qcom: sdm632: fairphone-fp3: add touchscreen

 .../input/touchscreen/himax,hx83112b.yaml     |  63 +++
 MAINTAINERS                                   |   7 +
 .../boot/dts/qcom/sdm632-fairphone-fp3.dts    |  14 +
 drivers/input/touchscreen/Kconfig             |  12 +
 drivers/input/touchscreen/Makefile            |   1 +
 drivers/input/touchscreen/himax_hx83112b.c    | 361 ++++++++++++++++++
 6 files changed, 458 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml
 create mode 100644 drivers/input/touchscreen/himax_hx83112b.c

base-commit: 8b96465c93a8c0f85ead5b3f8d4305beac97899e

Signature · 1 line
2.38.1
author maintainer
#1 lore raw

PATCH v6 1/3 dt-bindings: touchscreen: add Himax hx83112b bindings

This patch adds device tree bindings for Himax 83112b touchscreen devices.

---
 .../input/touchscreen/himax,hx83112b.yaml     | 63 +++++++++++++++++++
 MAINTAINERS                                   |  6 ++
 2 files changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml
Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml new file +63 -0
new file mode 100644
index 000000000000..be2ba185c086
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/himax,hx83112b.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Himax hx83112b touchscreen controller bindings
+
+maintainers:
+  - Job Noorman <[email protected]>
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    enum:
+      - himax,hx83112b
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  touchscreen-inverted-x: true
+  touchscreen-inverted-y: true
+  touchscreen-size-x: true
+  touchscreen-size-y: true
+  touchscreen-swapped-x-y: true
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - reset-gpios
+  - touchscreen-size-x
+  - touchscreen-size-y
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      touchscreen@48 {
+        compatible = "himax,hx83112b";
+        reg = <0x48>;
+        interrupt-parent = <&tlmm>;
+        interrupts = <65 IRQ_TYPE_LEVEL_LOW>;
+        touchscreen-size-x = <1080>;
+        touchscreen-size-y = <2160>;
+        reset-gpios = <&tlmm 64 GPIO_ACTIVE_LOW>;
+      };
+    };
+
+...
MAINTAINERS +6 -0
index cf0f18502372..469ab6382906 100644
@@ -9162,6 +9162,12 @@ W:	http://www.highpoint-tech.com
 F:	Documentation/scsi/hptiop.rst
 F:	drivers/scsi/hptiop.c
 
+HIMAX HX83112B TOUCHSCREEN SUPPORT
+M:	Job Noorman <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml
+
 HIPPI
 M:	Jes Sorensen <[email protected]>
 L:	[email protected]
Signature · 1 line
2.38.1
author maintainer
#2 lore raw

PATCH v6 2/3 Input: add driver for Himax hx83112b touchscreen devices

In reply to Job Noorman

This patch adds support for Himax hx83112b touchscreen devices. As there are no publicly available data sheets for these devices, the implementation is based on the driver of the downstream Android kernel used in the Fairphone 3. This patch is a complete rewrite, though, and the code bears no resemblence to the original implementation.

The driver has been tested on the aforementioned phone.

---
 MAINTAINERS                                |   1 +
 drivers/input/touchscreen/Kconfig          |  12 +
 drivers/input/touchscreen/Makefile         |   1 +
 drivers/input/touchscreen/himax_hx83112b.c | 361 +++++++++++++++++++++
 4 files changed, 375 insertions(+)
 create mode 100644 drivers/input/touchscreen/himax_hx83112b.c
MAINTAINERS +1 -0
index 469ab6382906..8d9fe0ac632c 100644
@@ -9167,6 +9167,7 @@ M:	Job Noorman <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml
+F:	drivers/input/touchscreen/himax_hx83112b.c
 
 HIPPI
 M:	Jes Sorensen <[email protected]>
drivers/input/touchscreen/Kconfig +12 -0
index dc90a3ea51ee..8cdb16a811e6 100644
@@ -1379,4 +1379,16 @@ config TOUCHSCREEN_ZINITIX
 	  To compile this driver as a module, choose M here: the
 	  module will be called zinitix.
 
+config TOUCHSCREEN_HIMAX_HX83112B
+	tristate "Himax hx83112b touchscreen driver"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  Say Y here to enable support for Himax hx83112b touchscreens.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called himax_hx83112b.
+
 endif
drivers/input/touchscreen/Makefile +1 -0
index 557f84fd2075..0f8bf79e01fe 100644
@@ -116,3 +116,4 @@ obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023)	+= rohm_bu21023.o
 obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW)	+= raspberrypi-ts.o
 obj-$(CONFIG_TOUCHSCREEN_IQS5XX)	+= iqs5xx.o
 obj-$(CONFIG_TOUCHSCREEN_ZINITIX)	+= zinitix.o
+obj-$(CONFIG_TOUCHSCREEN_HIMAX_HX83112B)	+= himax_hx83112b.o
drivers/input/touchscreen/himax_hx83112b.c new file +361 -0

361 lines not on this page · raw message

Signature · 1 line
2.38.1
author maintainer
#3 lore raw

PATCH v6 3/3 arm64: dts: qcom: sdm632: fairphone-fp3: add touchscreen

In reply to Job Noorman

Add Himax hx83112b touchscreen to the FP3 DT.

---
 arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts +14 -0
index 891e314bc782..2920504461d3 100644
@@ -49,6 +49,20 @@ &hsusb_phy {
 	vdda-phy-dpdm-supply = <&pm8953_l13>;
 };
 
+&i2c_3 {
+	status = "okay";
+
+	touchscreen@48 {
+		compatible = "himax,hx83112b";
+		reg = <0x48>;
+		interrupt-parent = <&tlmm>;
+		interrupts = <65 IRQ_TYPE_LEVEL_LOW>;
+		touchscreen-size-x = <1080>;
+		touchscreen-size-y = <2160>;
+		reset-gpios = <&tlmm 64 GPIO_ACTIVE_LOW>;
+	};
+};
+
 &pm8953_resin {
 	status = "okay";
 	linux,code = <KEY_VOLUMEDOWN>;
Signature · 1 line
2.38.1
maintainer
#4 lore raw

Re: [PATCH v6 3/3] arm64: dts: qcom: sdm632: fairphone-fp3: add touchscreen

Quoted 4 lines · Job Noorman

Add Himax hx83112b touchscreen to the FP3 DT.

Please include at least all the mailing lists as Cc on all your patches in the series - I'm not subscribed to linux-input, so I don't have patch 1 or patch 2 in my inbox.

Thanks,
Bjorn

Quoted 32 lines
---
 arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts +14 -0
index 891e314bc782..2920504461d3 100644
@@ -49,6 +49,20 @@ &hsusb_phy {
 	vdda-phy-dpdm-supply = <&pm8953_l13>;
 };
 
+&i2c_3 {
+	status = "okay";
+
+	touchscreen@48 {
+		compatible = "himax,hx83112b";
+		reg = <0x48>;
+		interrupt-parent = <&tlmm>;
+		interrupts = <65 IRQ_TYPE_LEVEL_LOW>;
+		touchscreen-size-x = <1080>;
+		touchscreen-size-y = <2160>;
+		reset-gpios = <&tlmm 64 GPIO_ACTIVE_LOW>;
+	};
+};
+
 &pm8953_resin {
 	status = "okay";
 	linux,code = <KEY_VOLUMEDOWN>;
Signature · 1 line
2.38.1
author maintainer
#5 lore raw

Re: [PATCH v6 3/3] arm64: dts: qcom: sdm632: fairphone-fp3: add touchscreen

Hi Bjorn,

Quoted 3 lines · Bjorn Andersson

Please include at least all the mailing lists as Cc on all your patches in the series - I'm not subscribed to linux-input, so I don't have patch 1 or patch 2 in my inbox.

No problem, I will resend with all mailing lists in Cc for all patches!

Since this is the first patch series I submit to the kernel, I wonder if you could elaborate a bit on what the correct process is to select recipients?

My current git send-email workflow is as follows:
- --to-cmd="get_maintainer.pl ... --nol"
- --cc-cmd="get_maintainer.pl ... --nom"
- Cover letter: the same commands but run on all patches in the series

If I understand you correctly, your advice would be to change only the second part of this workflow to also run the command on _all_ patches in the series. Is this correct?

Best regards,
Job