Introduce ClockworkPi CWD686 DRM panel driver
Subsystems (4)
v3 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 v3:
- dt-bindings: add missing lines for spacing
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 | 65 +++ .../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, 536 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.2
PATCH v3 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
@@ -258,6 +258,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.2
Re: [PATCH v3 1/4] dt-bindings: vendor-prefixes: Add prefix for ClockworkPi
Hi Max,
Quoted 15 lines · Max Fierke
Add a prefix for Clockwork Tech LLC, known as ClockworkPi. They produce a number of hobbyist devices, including the ClockworkPi DevTerm and GameShell.
Signed-off-by Max Fierke <[email protected]>--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/vendor-prefixes.yaml +0
-0
Documentation/devicetree/bindings/vendor-prefixes.yaml patternProperties: · line 262
Quoted 5 lines
Documentation/devicetree/bindings/vendor-prefixes.yaml +2
-0@@ -258,6 +258,8 @@ patternProperties: description: Cirrus Logic, Inc. "^cisco,.*": description: Cisco Systems, Inc. + "^clockworkpi,.*": + description: Clockwork Tech LLC
The vendor uses "clockwork" as the prefix in their downstream devicetrees[1][2][3], so I would suggest using the same here. I think there is a distinction between "Clockwork" the company and "ClockworkPi" the product. This is what I did for the board devicetree I sent[4].
Regards,
Samuel
[1]:
https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a04/userpatches/kernel/sunxi-current/kernel_001_dts.patch#L31
[2]:
https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a04/userpatches/kernel/sunxi-current/kernel_001_dts.patch#L127
[3]:
https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a06/patch/kernel-001-a06-dts.patch#L37
[4]:
https://lore.kernel.org/lkml/[email protected]/
Quoted 3 lines
Documentation/devicetree/bindings/vendor-prefixes.yaml +0
-0"^cloudengines,.*": description: Cloud Engines, Inc. "^cnm,.*":
Re: [PATCH v3 1/4] dt-bindings: vendor-prefixes: Add prefix for ClockworkPi
Quoted 10 lines · Samuel Holland
Hi Max,
The vendor uses "clockwork" as the prefix in their downstream devicetrees[1][2][3], so I would suggest using the same here. I think there is a distinction between "Clockwork" the company and "ClockworkPi" the product. This is what I did for the board devicetree I sent[4].
Regards,
Samuel
Hi Samuel,
Ah yes, I struggled a bit with the distinction because the company itself seems to be a bit inconsistent here.
I will follow your lead and post a v4 follow-up with that vendor prefix changed.
Glad to see someone else working on support for this hardware!
Thanks,
Max
PATCH v3 2/4 dt-bindings: display: Add ClockworkPi CWD686 panel
In reply to Max FierkeThe CWD686 is a 6.86" IPS LCD panel used as the primary display in the ClockworkPi DevTerm portable (all cores)
---
Changes in v3 (Krzysztof Kozlowski's Suggestions)
- add missing lines for spacing
Changes in v2 (Krzysztof Kozlowski and Rob Herring's Suggestions)
- remove redundant backlight example
- add missing regulators
.../display/panel/clockworkpi,cwd686.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml
Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml new file +65 -0
@@ -0,0 +1,65 @@ +# 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.2
PATCH v3 3/4 drm: panel: Add driver for ClockworkPi cwd686 panel
In reply to Max FierkeThe 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 v3:
- no changes
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
@@ -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
@@ -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.2
PATCH v3 4/4 drm/panel: clockworkpi-cwd686: Implement .get_orientation callback
In reply to Max FierkeReturns the panel's configured orientation
---
Changes in v3:
- no changes
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
@@ -340,7 +340,10 @@ static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *connedrm_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 *connereturn 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.2