Skip to contentSkip to conversation

Introduce ClockworkPi CWD686 DRM panel driver

PATCH Superseded Max Fierke 2 participants 6 messages Sep 3, 2022 – Sep 4, 2022

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Max Fierke

author
#0 lore raw

v2 cover Introduce ClockworkPi CWD686 DRM panel driver

The ClockworkPi DevTerm (all models) uses a 6.86" IPS display of unknown provenance, which uses the Chipone ICNL9707 IC driver[1].

The display panel I have has two model numbers: TXW686001 and WTL068601G, but cannot find any manufacturer associated with either, so opting for the ClockworkPi model number.

This driver is based on the GPL-licensed driver released by ClockworkPi[1], authored by Pinfan Zhu, with some additional cleanup, rotation support, and display sleep re-enabling done by me.

[1] https://github.com/clockworkpi/DevTerm/blob/main/Schematics/ICNL9707_Datasheet.pdf
[2] https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a06/patch/kernel-004-panel.patch

Thanks to Krzysztof Kozlowski, Rob Herring, and Sam Ravnborg for their prior reviews and apologies for the long delay between patch set versions.

Changes in v2:
- dt-bindings: remove redundant backlight example
- add missing regulators
- remove some unused properties from definition (e.g. enable_gpio, supply)
- reorder includes
- remove redundant ctx->backlight in favor of backlight through drm_panel_of_backlight
- remove now-unneeded ctx->enabled and enable/disable hooks
- replace ICNL9707_DCS macro with mipi_dsi_dcs_write_seq
- use dev_err_probe instead of checking EPROBE_DEFER
- fixed return type of cwd686_remove to be void following changes to mipi_dsi_driver
- add .get_orientation callback

Max Fierke (4):
dt-bindings: vendor-prefixes: Add prefix for ClockworkPi
dt-bindings: display: Add ClockworkPi CWD686 panel
drm: panel: Add driver for ClockworkPi cwd686 panel drm/panel: clockworkpi-cwd686: Implement .get_orientation callback

 .../display/panel/clockworkpi,cwd686.yaml     |  63 +++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 drivers/gpu/drm/panel/Kconfig                 |  12 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-clockworkpi-cwd686.c  | 456 ++++++++++++++++++
 5 files changed, 534 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c
Signature · 1 line
2.37.1
author
#1 lore raw

PATCH v2 1/4 dt-bindings: vendor-prefixes: Add prefix for ClockworkPi

Add a prefix for Clockwork Tech LLC, known as ClockworkPi. They produce a number of hobbyist devices, including the ClockworkPi DevTerm and GameShell.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 7a326168d1d2..b9cf4f02c362 100644
@@ -254,6 +254,8 @@ patternProperties:
     description: Cirrus Logic, Inc.
   "^cisco,.*":
     description: Cisco Systems, Inc.
+  "^clockworkpi,.*":
+    description: Clockwork Tech LLC
   "^cloudengines,.*":
     description: Cloud Engines, Inc.
   "^cnm,.*":
Signature · 1 line
2.37.1
author
#2 lore raw

PATCH v2 2/4 dt-bindings: display: Add ClockworkPi CWD686 panel

In reply to Max Fierke

The CWD686 is a 6.86" IPS LCD panel used as the primary display in the ClockworkPi DevTerm portable (all cores)

---
Changes in v2 (Krzysztof Kozlowski and Rob Herring's Suggestions)
- remove redundant backlight example
- add missing regulators

 .../display/panel/clockworkpi,cwd686.yaml     | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml
Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml new file +63 -0
new file mode 100644
index 000000000000..eaf55d629266
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/clockworkpi,cwd686.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ClockworkPi CWD686 6.86" IPS LCD panel
+
+maintainers:
+  - Max Fierke <[email protected]>
+
+description: |
+  The ClockworkPi CWD686 is a 6.86" ICNL9707-based IPS LCD panel used within the
+  ClockworkPi DevTerm series of portable devices. The panel has a 480x1280
+  resolution and uses 24 bit RGB per pixel.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    const: clockworkpi,cwd686
+
+  reg:
+    description: DSI virtual channel used by that screen
+    maxItems: 1
+  iovcc-supply:
+    description: regulator that supplies the iovcc voltage
+  vci-supply:
+    description: regulator that supplies the vci voltage
+
+  reset-gpios: true
+  rotation: true
+  backlight: true
+
+required:
+  - compatible
+  - reg
+  - backlight
+  - reset-gpios
+  - iovcc-supply
+  - vci-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "clockworkpi,cwd686";
+            reg = <0>;
+            backlight = <&backlight>;
+            reset-gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>;
+            rotation = <90>;
+            iovcc-supply = <&vcc_1v8>;
+            vci-supply = <&vcc3v3_sys>;
+        };
+    };
Signature · 1 line
2.37.1
#3 lore raw

Re: [PATCH v2 2/4] dt-bindings: display: Add ClockworkPi CWD686 panel

Quoted 36 lines · Max Fierke

The CWD686 is a 6.86" IPS LCD panel used as the primary display in the ClockworkPi DevTerm portable (all cores)

---
Changes in v2 (Krzysztof Kozlowski and Rob Herring's Suggestions)
- remove redundant backlight example
- add missing regulators

 .../display/panel/clockworkpi,cwd686.yaml     | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml
Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml new file +16 -0
new file mode 100644
index 000000000000..eaf55d629266
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/clockworkpi,cwd686.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ClockworkPi CWD686 6.86" IPS LCD panel
+
+maintainers:
+  - Max Fierke <[email protected]>
+
+description: |
+  The ClockworkPi CWD686 is a 6.86" ICNL9707-based IPS LCD panel used within the
+  ClockworkPi DevTerm series of portable devices. The panel has a 480x1280
+  resolution and uses 24 bit RGB per pixel.
+

Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml new file +10 -0
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    const: clockworkpi,cwd686
+
+  reg:
+    description: DSI virtual channel used by that screen
+    maxItems: 1

You still need blank line here.

Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml line 28

Quoted 2 lines
Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml new file +2 -0
+  iovcc-supply:
+    description: regulator that supplies the iovcc voltage

And here...

Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml line 31

Quoted 3 lines
Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml new file +3 -0
+  vci-supply:
+    description: regulator that supplies the vci voltage
+

Best regards,
Krzysztof

author
#4 lore raw

PATCH v2 3/4 drm: panel: Add driver for ClockworkPi cwd686 panel

In reply to Max Fierke

The ClockworkPi DevTerm (all models) uses a 6.86" IPS display of unknown provenance, which uses the Chipone ICNL9707 IC driver.

The display panel I have has two model numbers: TXW686001 and WTL068601G, but cannot find any manufacturer associated with either, so opting for the ClockworkPi model number.

This driver is based on the GPL-licensed driver released by ClockworkPi, authored by Pinfan Zhu, with some additional cleanup, rotation support, and display sleep re-enabling done by me.

Original driver here for reference: https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a06/patch/kernel-004-panel.patch
Display IC datasheet provided here: https://github.com/clockworkpi/DevTerm/blob/main/Schematics/ICNL9707_Datasheet.pdf

---
Changes in v2: (Sam Ravnborg's suggestions)
- remove some unused properties from definition (e.g. enable_gpio, supply)
- add missing regulators
- reorder includes
- remove redundant ctx->backlight in favor of backlight through drm_panel_of_backlight
- remove now-unneeded ctx->enabled and enable/disable hooks
- replace ICNL9707_DCS macro with mipi_dsi_dcs_write_seq
- use dev_err_probe instead of checking EPROBE_DEFER
- fixed return type of cwd686_remove to be void following changes to mipi_dsi_driver

 drivers/gpu/drm/panel/Kconfig                 |  12 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-clockworkpi-cwd686.c  | 445 ++++++++++++++++++
 3 files changed, 458 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c
drivers/gpu/drm/panel/Kconfig +12 -0
index 584a69f99af6..a93c697867f9 100644
@@ -68,6 +68,18 @@ config DRM_PANEL_BOE_TV101WUM_NL6
 	  Say Y here if you want to support for BOE TV101WUM and AUO KD101N80
 	  45NA WUXGA PANEL DSI Video Mode panel
 
+config DRM_PANEL_CLOCKWORKPI_CWD686
+	tristate "ClockworkPi CWD686 panel"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y here if you want to enable support for the ClockworkPi CWD686
+	  ICNL9707-based panel, e.g. as used within the ClockworkPi DevTerm.
+	  The panel has a 480x1280 resolution and uses 24 bit RGB per pixel.
+
+	  To compile this driver as a module, choose M here.
+
 config DRM_PANEL_DSI_CM
 	tristate "Generic DSI command mode panels"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 34e717382dbb..6c3ed2acaa6b 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += panel-asus-z00t-tm5p5-n35596.
 obj-$(CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0) += panel-boe-bf060y8m-aj0.o
 obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
 obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
+obj-$(CONFIG_DRM_PANEL_CLOCKWORKPI_CWD686) += panel-clockworkpi-cwd686.o
 obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c new file +445 -0

445 lines not on this page · raw message

Signature · 1 line
2.37.1
author
#5 lore raw

PATCH v2 4/4 drm/panel: clockworkpi-cwd686: Implement .get_orientation callback

In reply to Max Fierke

Returns the panel's configured orientation

---
Changes in v2:
- this was added as .get_orientation is now available in drm-misc-next since v1

 drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c +12 -1
index 87d20d784596..2c433a458c8b 100644
@@ -340,7 +340,10 @@ static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *conne
 	drm_mode_set_name(mode);
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 
-	/* Set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	drm_mode_probed_add(connector, mode);
@@ -348,10 +351,18 @@ static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *conne
 	return 1; /* Number of modes */
 }
 
+static enum drm_panel_orientation cwd686_get_orientation(struct drm_panel *panel)
+{
+	struct cwd686 *ctx = panel_to_cwd686(panel);
+
+	return ctx->orientation;
+}
+
 static const struct drm_panel_funcs cwd686_drm_funcs = {
 	.unprepare = cwd686_unprepare,
 	.prepare = cwd686_prepare,
 	.get_modes = cwd686_get_modes,
+	.get_orientation = cwd686_get_orientation,
 };
 
 static int cwd686_probe(struct mipi_dsi_device *dsi)
Signature · 1 line
2.37.1