1 | The ClockworkPi DevTerm (all models) uses a 6.86" IPS display | 1 | The ClockworkPi DevTerm (all models) uses a 6.86" IPS display |
---|---|---|---|
2 | of unknown provenance, which uses the Chipone ICNL9707 IC driver[1]. | 2 | of unknown provenance, which uses the Chipone ICNL9707 IC driver[1]. |
3 | 3 | ||
4 | The display panel I have has two model numbers: TXW686001 and WTL068601G, | 4 | The display panel Max Fierke has has two model numbers: TXW686001 and |
5 | but cannot find any manufacturer associated with either, so opting for the | 5 | WTL068601G, but couldn’t find any manufacturer associated with either, so |
6 | ClockworkPi model number. | 6 | he opted for the ClockworkPi model number. |
7 | 7 | ||
8 | This driver is based on the GPL-licensed driver released by ClockworkPi[1], | 8 | This driver is based on the GPL-licensed driver released by ClockworkPi[1], |
9 | authored by Pinfan Zhu, with some additional cleanup, rotation support, | 9 | authored by Pinfan Zhu, with some additional cleanup, rotation support, |
10 | and display sleep re-enabling done by me. | 10 | and display sleep re-enabling done by Max Fierke. |
11 | 11 | ||
12 | [1] https://github.com/clockworkpi/DevTerm/blob/main/Schematics/ICNL9707_Datasheet.pdf | 12 | [1] https://github.com/clockworkpi/DevTerm/blob/main/Schematics/ICNL9707_Datasheet.pdf |
13 | [2] https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a06/patch/kernel-004-panel.patch | 13 | [2] https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a06/patch/kernel-004-panel.patch |
14 | 14 | ||
15 | Signed-off-by: Max Fierke <max@maxfierke.com> | 15 | Thanks to Krzysztof Kozlowski, Rob Herring, and Sam Ravnborg for their |
16 | prior reviews. | ||
16 | 17 | ||
17 | Max Fierke (3): | 18 | I hope this is the correct way of reviving old patches. |
18 | dt-bindings: vendor-prefixes: Add prefix for ClockworkPi | ||
19 | dt-bindings: display: Add bindings for ClockworkPi CWD686 | ||
20 | drm: panel: Add driver for ClockworkPi cwd686 panel | ||
21 | 19 | ||
22 | .../display/panel/clockworkpi,cwd686.yaml | 60 +++ | 20 | Changes in v4: |
23 | .../devicetree/bindings/vendor-prefixes.yaml | 2 + | 21 | - Use existing clockwork vendor ID |
24 | drivers/gpu/drm/panel/Kconfig | 12 + | 22 | - Update the panel initalization code for DRM changes |
25 | drivers/gpu/drm/panel/Makefile | 1 + | ||
26 | .../gpu/drm/panel/panel-clockworkpi-cwd686.c | 458 ++++++++++++++++++ | ||
27 | 5 files changed, 533 insertions(+) | ||
28 | create mode 100644 Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml | ||
29 | create mode 100644 drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c | ||
30 | 23 | ||
31 | -- | 24 | Changes in v3: |
32 | 2.36.1 | 25 | - dt-bindings: add missing lines for spacing |
26 | |||
27 | Changes in v2: | ||
28 | - dt-bindings: remove redundant backlight example | ||
29 | - add missing regulators | ||
30 | - remove some unused properties from definition (e.g. enable_gpio, supply) | ||
31 | - reorder includes | ||
32 | - remove redundant ctx->backlight in favor of backlight through drm_panel_of_backlight | ||
33 | - remove now-unneeded ctx->enabled and enable/disable hooks | ||
34 | - replace ICNL9707_DCS macro with mipi_dsi_dcs_write_seq | ||
35 | - use dev_err_probe instead of checking EPROBE_DEFER | ||
36 | - fixed return type of cwd686_remove to be void following changes to mipi_dsi_driver | ||
37 | - add .get_orientation callback | ||
38 | |||
39 | diff view generated by jsdifflib |
1 | From: Max Fierke <max@maxfierke.com> | ||
---|---|---|---|
2 | |||
1 | The ClockworkPi DevTerm (all models) uses a 6.86" IPS display | 3 | The ClockworkPi DevTerm (all models) uses a 6.86" IPS display |
2 | of unknown provenance, which uses the Chipone ICNL9707 IC driver. | 4 | of unknown provenance, which uses the Chipone ICNL9707 IC driver. |
3 | 5 | ||
4 | The display panel I have has two model numbers: TXW686001 and WTL068601G, | 6 | The display panel I have has two model numbers: TXW686001 and WTL068601G, |
5 | but cannot find any manufacturer associated with either, so opting for the | 7 | but cannot find any manufacturer associated with either, so opting for the |
... | ... | ||
10 | and display sleep re-enabling done by me. | 12 | and display sleep re-enabling done by me. |
11 | 13 | ||
12 | Original driver here for reference: https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a06/patch/kernel-004-panel.patch | 14 | Original driver here for reference: https://github.com/clockworkpi/DevTerm/blob/main/Code/patch/armbian_build_a06/patch/kernel-004-panel.patch |
13 | Display IC datasheet provided here: https://github.com/clockworkpi/DevTerm/blob/main/Schematics/ICNL9707_Datasheet.pdf | 15 | Display IC datasheet provided here: https://github.com/clockworkpi/DevTerm/blob/main/Schematics/ICNL9707_Datasheet.pdf |
14 | 16 | ||
17 | Co-authored-by: Charlotte Deleńkec <lotte@chir.rs> | ||
18 | Signed-off-by: Charlotte Deleńkec <lotte@chir.rs> | ||
15 | Signed-off-by: Max Fierke <max@maxfierke.com> | 19 | Signed-off-by: Max Fierke <max@maxfierke.com> |
16 | --- | 20 | --- |
17 | drivers/gpu/drm/panel/Kconfig | 12 + | 21 | drivers/gpu/drm/panel/Kconfig | 12 + |
18 | drivers/gpu/drm/panel/Makefile | 1 + | 22 | drivers/gpu/drm/panel/Makefile | 1 + |
19 | .../gpu/drm/panel/panel-clockworkpi-cwd686.c | 458 ++++++++++++++++++ | 23 | .../gpu/drm/panel/panel-clockwork-cwd686.c | 447 ++++++++++++++++++ |
20 | 3 files changed, 471 insertions(+) | 24 | 3 files changed, 460 insertions(+) |
21 | create mode 100644 drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c | 25 | create mode 100644 drivers/gpu/drm/panel/panel-clockwork-cwd686.c |
22 | 26 | ||
23 | diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig | 27 | diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig |
24 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/drivers/gpu/drm/panel/Kconfig | 29 | --- a/drivers/gpu/drm/panel/Kconfig |
26 | +++ b/drivers/gpu/drm/panel/Kconfig | 30 | +++ b/drivers/gpu/drm/panel/Kconfig |
27 | @@ -XXX,XX +XXX,XX @@ config DRM_PANEL_BOE_TV101WUM_NL6 | 31 | @@ -XXX,XX +XXX,XX @@ config DRM_PANEL_BOE_TV101WUM_LL2 |
28 | Say Y here if you want to support for BOE TV101WUM and AUO KD101N80 | 32 | Say Y here if you want to support for BOE TV101WUM-LL2 |
29 | 45NA WUXGA PANEL DSI Video Mode panel | 33 | WUXGA PANEL DSI Video Mode panel |
30 | 34 | ||
31 | +config DRM_PANEL_CLOCKWORKPI_CWD686 | 35 | +config DRM_PANEL_CLOCKWORK_CWD686 |
32 | + tristate "ClockworkPi CWD686 panel" | 36 | + tristate "Clockwork CWD686 panel" |
33 | + depends on OF | 37 | + depends on OF |
34 | + depends on DRM_MIPI_DSI | 38 | + depends on DRM_MIPI_DSI |
35 | + depends on BACKLIGHT_CLASS_DEVICE | 39 | + depends on BACKLIGHT_CLASS_DEVICE |
36 | + help | 40 | + help |
37 | + Say Y here if you want to enable support for the ClockworkPi CWD686 | 41 | + Say Y here if you want to enable support for the Clockwork CWD686 |
38 | + ICNL9707-based panel, e.g. as used within the ClockworkPi DevTerm. | 42 | + ICNL9707-based panel, e.g. as used within the Clockwork DevTerm. |
39 | + The panel has a 480x1280 resolution and uses 24 bit RGB per pixel. | 43 | + The panel has a 480x1280 resolution and uses 24 bit RGB per pixel. |
40 | + | 44 | + |
41 | + To compile this driver as a module, choose M here. | 45 | + To compile this driver as a module, choose M here. |
42 | + | 46 | + |
43 | config DRM_PANEL_DSI_CM | 47 | config DRM_PANEL_EBBG_FT8719 |
44 | tristate "Generic DSI command mode panels" | 48 | tristate "EBBG FT8719 panel driver" |
45 | depends on OF | 49 | depends on OF |
46 | diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile | 50 | diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile |
47 | index XXXXXXX..XXXXXXX 100644 | 51 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/drivers/gpu/drm/panel/Makefile | 52 | --- a/drivers/gpu/drm/panel/Makefile |
49 | +++ b/drivers/gpu/drm/panel/Makefile | 53 | +++ b/drivers/gpu/drm/panel/Makefile |
50 | @@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += panel-asus-z00t-tm5p5-n35596. | 54 | @@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o |
51 | obj-$(CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0) += panel-boe-bf060y8m-aj0.o | 55 | obj-$(CONFIG_DRM_PANEL_BOE_TH101MB31UIG002_28A) += panel-boe-th101mb31ig002-28a.o |
52 | obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o | 56 | obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_LL2) += panel-boe-tv101wum-ll2.o |
53 | obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o | 57 | obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o |
54 | +obj-$(CONFIG_DRM_PANEL_CLOCKWORKPI_CWD686) += panel-clockworkpi-cwd686.o | 58 | +obj-$(CONFIG_DRM_PANEL_CLOCKWORK_CWD686) += panel-clockwork-cwd686.o |
55 | obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o | 59 | obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o |
56 | obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o | 60 | obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o |
57 | obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o | 61 | obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o |
58 | diff --git a/drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c b/drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c | 62 | diff --git a/drivers/gpu/drm/panel/panel-clockwork-cwd686.c b/drivers/gpu/drm/panel/panel-clockwork-cwd686.c |
59 | new file mode 100644 | 63 | new file mode 100644 |
60 | index XXXXXXX..XXXXXXX | 64 | index XXXXXXX..XXXXXXX |
61 | --- /dev/null | 65 | --- /dev/null |
62 | +++ b/drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c | 66 | +++ b/drivers/gpu/drm/panel/panel-clockwork-cwd686.c |
63 | @@ -XXX,XX +XXX,XX @@ | 67 | @@ -XXX,XX +XXX,XX @@ |
64 | +// SPDX-License-Identifier: GPL-2.0+ | 68 | +// SPDX-License-Identifier: GPL-2.0+ |
65 | +/* | 69 | +/* |
66 | + * Copyright (c) 2021 Clockwork Tech LLC | 70 | + * Copyright (c) 2021 Clockwork Tech LLC |
67 | + * Copyright (c) 2021-2022 Max Fierke <max@maxfierke.com> | 71 | + * Copyright (c) 2021-2022 Max Fierke <max@maxfierke.com> |
68 | + * | 72 | + * |
69 | + * Based on Pinfan Zhu's work on panel-cwd686.c for ClockworkPi's 5.10 BSP | 73 | + * Based on Pinfan Zhu's work on panel-cwd686.c for Clockwork's 5.10 BSP |
70 | + */ | 74 | + */ |
71 | + | 75 | + |
72 | +#include <drm/drm_modes.h> | ||
73 | +#include <drm/drm_mipi_dsi.h> | ||
74 | +#include <drm/drm_panel.h> | ||
75 | +#include <linux/backlight.h> | ||
76 | +#include <linux/gpio/consumer.h> | 76 | +#include <linux/gpio/consumer.h> |
77 | +#include <linux/regulator/consumer.h> | 77 | +#include <linux/regulator/consumer.h> |
78 | +#include <linux/delay.h> | 78 | +#include <linux/delay.h> |
79 | +#include <linux/of_device.h> | 79 | +#include <linux/of_device.h> |
80 | +#include <linux/module.h> | 80 | +#include <linux/module.h> |
81 | + | ||
81 | +#include <video/mipi_display.h> | 82 | +#include <video/mipi_display.h> |
83 | + | ||
84 | +#include <drm/drm_modes.h> | ||
85 | +#include <drm/drm_mipi_dsi.h> | ||
86 | +#include <drm/drm_panel.h> | ||
82 | + | 87 | + |
83 | +struct cwd686 { | 88 | +struct cwd686 { |
84 | + struct device *dev; | 89 | + struct device *dev; |
85 | + struct drm_panel panel; | 90 | + struct drm_panel panel; |
86 | + struct regulator *supply; | 91 | + struct regulator *vci; |
87 | + struct gpio_desc *enable_gpio; | 92 | + struct regulator *iovcc; |
88 | + struct gpio_desc *reset_gpio; | 93 | + struct gpio_desc *reset_gpio; |
89 | + struct backlight_device *backlight; | ||
90 | + enum drm_panel_orientation orientation; | 94 | + enum drm_panel_orientation orientation; |
91 | + bool prepared; | 95 | + bool prepared; |
92 | + bool enabled; | ||
93 | +}; | 96 | +}; |
94 | + | 97 | + |
95 | +static const struct drm_display_mode default_mode = { | 98 | +static const struct drm_display_mode default_mode = { |
96 | + .clock = 54465, | 99 | + .clock = 54465, |
97 | + .hdisplay = 480, | 100 | + .hdisplay = 480, |
... | ... | ||
106 | + | 109 | + |
107 | +static inline struct cwd686 *panel_to_cwd686(struct drm_panel *panel) | 110 | +static inline struct cwd686 *panel_to_cwd686(struct drm_panel *panel) |
108 | +{ | 111 | +{ |
109 | + return container_of(panel, struct cwd686, panel); | 112 | + return container_of(panel, struct cwd686, panel); |
110 | +} | 113 | +} |
111 | + | ||
112 | +#define ICNL9707_DCS(seq...) \ | ||
113 | +({ \ | ||
114 | + static const u8 d[] = { seq }; \ | ||
115 | + mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ | ||
116 | +}) | ||
117 | + | 114 | + |
118 | +#define ICNL9707_CMD_CGOUTL 0xB3 | 115 | +#define ICNL9707_CMD_CGOUTL 0xB3 |
119 | +#define ICNL9707_CMD_CGOUTR 0xB4 | 116 | +#define ICNL9707_CMD_CGOUTR 0xB4 |
120 | +#define ICNL9707_P_CGOUT_VGL 0x00 | 117 | +#define ICNL9707_P_CGOUT_VGL 0x00 |
121 | +#define ICNL9707_P_CGOUT_VGH 0x01 | 118 | +#define ICNL9707_P_CGOUT_VGH 0x01 |
... | ... | ||
191 | +{ | 188 | +{ |
192 | + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); | 189 | + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); |
193 | + int err; | 190 | + int err; |
194 | + | 191 | + |
195 | + /* Enable access to Level 2 registers */ | 192 | + /* Enable access to Level 2 registers */ |
196 | + ICNL9707_DCS(ICNL9707_CMD_PASSWORD1, | 193 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PASSWORD1, |
197 | + ICNL9707_P_PASSWORD1_ENABLE_LVL2, | 194 | + ICNL9707_P_PASSWORD1_ENABLE_LVL2, |
198 | + ICNL9707_P_PASSWORD1_ENABLE_LVL2); | 195 | + ICNL9707_P_PASSWORD1_ENABLE_LVL2); |
199 | + ICNL9707_DCS(ICNL9707_CMD_PASSWORD2, | 196 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PASSWORD2, |
200 | + ICNL9707_P_PASSWORD2_ENABLE_LVL2, | 197 | + ICNL9707_P_PASSWORD2_ENABLE_LVL2, |
201 | + ICNL9707_P_PASSWORD2_ENABLE_LVL2); | 198 | + ICNL9707_P_PASSWORD2_ENABLE_LVL2); |
202 | + | 199 | + |
203 | + /* Set PWRCON_VCOM (-0.495V, -0.495V) */ | 200 | + /* Set PWRCON_VCOM (-0.495V, -0.495V) */ |
204 | + ICNL9707_DCS(ICNL9707_CMD_PWRCON_VCOM, | 201 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PWRCON_VCOM, |
205 | + ICNL9707_P_PWRCON_VCOM_0495V, | 202 | + ICNL9707_P_PWRCON_VCOM_0495V, |
206 | + ICNL9707_P_PWRCON_VCOM_0495V); | 203 | + ICNL9707_P_PWRCON_VCOM_0495V); |
207 | + | 204 | + |
208 | + /* Map ASG output signals */ | 205 | + /* Map ASG output signals */ |
209 | + ICNL9707_DCS(ICNL9707_CMD_CGOUTR, | 206 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_CGOUTR, |
210 | + ICNL9707_P_CGOUT_GSP7, ICNL9707_P_CGOUT_GSP5, | 207 | + ICNL9707_P_CGOUT_GSP7, ICNL9707_P_CGOUT_GSP5, |
211 | + ICNL9707_P_CGOUT_GCK7, ICNL9707_P_CGOUT_GCK5, | 208 | + ICNL9707_P_CGOUT_GCK7, ICNL9707_P_CGOUT_GCK5, |
212 | + ICNL9707_P_CGOUT_GCK3, ICNL9707_P_CGOUT_GCK1, | 209 | + ICNL9707_P_CGOUT_GCK3, ICNL9707_P_CGOUT_GCK1, |
213 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_VGL, | 210 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_VGL, |
214 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_GND, | 211 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_GND, |
215 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_GND, | 212 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_GND, |
216 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, | 213 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, |
217 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, | 214 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, |
218 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, | 215 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, |
219 | + ICNL9707_P_CGOUT_GSP1, ICNL9707_P_CGOUT_GSP3); | 216 | + ICNL9707_P_CGOUT_GSP1, ICNL9707_P_CGOUT_GSP3); |
220 | + ICNL9707_DCS(ICNL9707_CMD_CGOUTL, | 217 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_CGOUTL, |
221 | + ICNL9707_P_CGOUT_GSP8, ICNL9707_P_CGOUT_GSP6, | 218 | + ICNL9707_P_CGOUT_GSP8, ICNL9707_P_CGOUT_GSP6, |
222 | + ICNL9707_P_CGOUT_GCK8, ICNL9707_P_CGOUT_GCK6, | 219 | + ICNL9707_P_CGOUT_GCK8, ICNL9707_P_CGOUT_GCK6, |
223 | + ICNL9707_P_CGOUT_GCK4, ICNL9707_P_CGOUT_GCK2, | 220 | + ICNL9707_P_CGOUT_GCK4, ICNL9707_P_CGOUT_GCK2, |
224 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_VGL, | 221 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_VGL, |
225 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_GND, | 222 | + ICNL9707_P_CGOUT_VGL, ICNL9707_P_CGOUT_GND, |
... | ... | ||
228 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, | 225 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, |
229 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, | 226 | + ICNL9707_P_CGOUT_GND, ICNL9707_P_CGOUT_GND, |
230 | + ICNL9707_P_CGOUT_GSP2, ICNL9707_P_CGOUT_GSP4); | 227 | + ICNL9707_P_CGOUT_GSP2, ICNL9707_P_CGOUT_GSP4); |
231 | + | 228 | + |
232 | + /* Undocumented commands provided by the vendor */ | 229 | + /* Undocumented commands provided by the vendor */ |
233 | + ICNL9707_DCS(0xB0, 0x54, 0x32, 0x23, 0x45, 0x44, 0x44, 0x44, 0x44, 0x90, 0x01, 0x90, 0x01); | 230 | + mipi_dsi_dcs_write_seq(dsi, 0xB0, 0x54, 0x32, 0x23, 0x45, 0x44, 0x44, 0x44, 0x44, 0x90, 0x01, 0x90, 0x01); |
234 | + ICNL9707_DCS(0xB1, 0x32, 0x84, 0x02, 0x83, 0x30, 0x01, 0x6B, 0x01); | 231 | + mipi_dsi_dcs_write_seq(dsi, 0xB1, 0x32, 0x84, 0x02, 0x83, 0x30, 0x01, 0x6B, 0x01); |
235 | + ICNL9707_DCS(0xB2, 0x73); | 232 | + mipi_dsi_dcs_write_seq(dsi, 0xB2, 0x73); |
236 | + | 233 | + |
237 | + ICNL9707_DCS(ICNL9707_CMD_PWRCON_REG, | 234 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PWRCON_REG, |
238 | + 0x4E, 0x0E, 0x50, 0x50, 0x26, | 235 | + 0x4E, 0x0E, 0x50, 0x50, 0x26, |
239 | + 0x1D, 0x00, 0x14, 0x42, 0x03); | 236 | + 0x1D, 0x00, 0x14, 0x42, 0x03); |
240 | + ICNL9707_DCS(ICNL9707_CMD_PWRCON_SEQ, | 237 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PWRCON_SEQ, |
241 | + 0x01, 0x01, 0x09, 0x11, 0x0D, 0x55, | 238 | + 0x01, 0x01, 0x09, 0x11, 0x0D, 0x55, |
242 | + 0x19, 0x19, 0x21, 0x1D, 0x00, 0x00, | 239 | + 0x19, 0x19, 0x21, 0x1D, 0x00, 0x00, |
243 | + 0x00, 0x00, 0x02, 0xFF, 0x3C); | 240 | + 0x00, 0x00, 0x02, 0xFF, 0x3C); |
244 | + ICNL9707_DCS(ICNL9707_CMD_PWRCON_CLK, 0x23, 0x01, 0x30, 0x34, 0x63); | 241 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PWRCON_CLK, 0x23, 0x01, 0x30, 0x34, 0x63); |
245 | + | 242 | + |
246 | + /* Disable abnormal power-off flag */ | 243 | + /* Disable abnormal power-off flag */ |
247 | + ICNL9707_DCS(ICNL9707_CMD_PWRCON_BTA, 0xA0, 0x22, 0x00, 0x44); | 244 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PWRCON_BTA, 0xA0, 0x22, 0x00, 0x44); |
248 | + | 245 | + |
249 | + ICNL9707_DCS(ICNL9707_CMD_PWRCON_MODE, 0x12, 0x63); | 246 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PWRCON_MODE, 0x12, 0x63); |
250 | + | 247 | + |
251 | + /* Set VBP, VFP, VSW, HBP, HFP, HSW */ | 248 | + /* Set VBP, VFP, VSW, HBP, HFP, HSW */ |
252 | + ICNL9707_DCS(ICNL9707_CMD_TCON, 0x0C, 0x16, 0x04, 0x0C, 0x10, 0x04); | 249 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_TCON, 0x0C, 0x16, 0x04, 0x0C, 0x10, 0x04); |
253 | + | 250 | + |
254 | + /* Set resolution */ | 251 | + /* Set resolution */ |
255 | + ICNL9707_DCS(ICNL9707_CMD_TCON2, 0x11, 0x41); | 252 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_TCON2, 0x11, 0x41); |
256 | + | 253 | + |
257 | + /* Set frame blanking */ | 254 | + /* Set frame blanking */ |
258 | + ICNL9707_DCS(ICNL9707_CMD_TCON3, 0x22, 0x31, 0x04); | 255 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_TCON3, 0x22, 0x31, 0x04); |
259 | + | 256 | + |
260 | + ICNL9707_DCS(ICNL9707_CMD_SRCCON, 0x05, 0x23, 0x6B, 0x49, 0x00); | 257 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_SRCCON, 0x05, 0x23, 0x6B, 0x49, 0x00); |
261 | + | 258 | + |
262 | + /* Another undocumented command */ | 259 | + /* Another undocumented command */ |
263 | + ICNL9707_DCS(0xC5, 0x00); | 260 | + mipi_dsi_dcs_write_seq(dsi, 0xC5, 0x00); |
264 | + | 261 | + |
265 | + ICNL9707_DCS(ICNL9707_CMD_ETC, 0x37, 0xFF, 0xFF); | 262 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_ETC, 0x37, 0xFF, 0xFF); |
266 | + | 263 | + |
267 | + /* Another set of undocumented commands */ | 264 | + /* Another set of undocumented commands */ |
268 | + ICNL9707_DCS(0xD2, 0x63, 0x0B, 0x08, 0x88); | 265 | + mipi_dsi_dcs_write_seq(dsi, 0xD2, 0x63, 0x0B, 0x08, 0x88); |
269 | + ICNL9707_DCS(0xD3, 0x01, 0x00, 0x00, 0x01, 0x01, 0x37, 0x25, 0x38, 0x31, 0x06, 0x07); | 266 | + mipi_dsi_dcs_write_seq(dsi, 0xD3, 0x01, 0x00, 0x00, 0x01, 0x01, 0x37, 0x25, 0x38, 0x31, 0x06, 0x07); |
270 | + | 267 | + |
271 | + /* Set Gamma to 2.2 */ | 268 | + /* Set Gamma to 2.2 */ |
272 | + ICNL9707_DCS(ICNL9707_CMD_SET_GAMMA, | 269 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_SET_GAMMA, |
273 | + 0x7C, 0x6A, 0x5D, 0x53, 0x53, 0x45, 0x4B, | 270 | + 0x7C, 0x6A, 0x5D, 0x53, 0x53, 0x45, 0x4B, |
274 | + 0x35, 0x4D, 0x4A, 0x49, 0x66, 0x53, 0x57, | 271 | + 0x35, 0x4D, 0x4A, 0x49, 0x66, 0x53, 0x57, |
275 | + 0x4A, 0x48, 0x3B, 0x2A, 0x06, 0x7C, 0x6A, | 272 | + 0x4A, 0x48, 0x3B, 0x2A, 0x06, 0x7C, 0x6A, |
276 | + 0x5D, 0x53, 0x53, 0x45, 0x4B, 0x35, 0x4D, | 273 | + 0x5D, 0x53, 0x53, 0x45, 0x4B, 0x35, 0x4D, |
277 | + 0x4A, 0x49, 0x66, 0x53, 0x57, 0x4A, 0x48, | 274 | + 0x4A, 0x49, 0x66, 0x53, 0x57, 0x4A, 0x48, |
278 | + 0x3B, 0x2A, 0x06); | 275 | + 0x3B, 0x2A, 0x06); |
279 | + | 276 | + |
280 | + ICNL9707_DCS(ICNL9707_CMD_SRC_TIM, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00); | 277 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_SRC_TIM, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00); |
281 | + | 278 | + |
282 | + /* Another undocumented command */ | 279 | + /* Another undocumented command */ |
283 | + ICNL9707_DCS(0xF4, 0x08, 0x77); | 280 | + mipi_dsi_dcs_write_seq(dsi, 0xF4, 0x08, 0x77); |
284 | + | 281 | + |
285 | + ICNL9707_DCS(MIPI_DCS_SET_ADDRESS_MODE, | 282 | + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, |
286 | + ICNL9707_MADCTL_RGB | ICNL9707_MADCTL_ML | ICNL9707_MADCTL_MH); | 283 | + ICNL9707_MADCTL_RGB | ICNL9707_MADCTL_ML | ICNL9707_MADCTL_MH); |
287 | + | 284 | + |
288 | + /* Enable tearing mode at VBLANK */ | 285 | + /* Enable tearing mode at VBLANK */ |
289 | + err = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); | 286 | + err = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); |
290 | + if (err) { | 287 | + if (err) { |
291 | + dev_err(ctx->dev, "failed to enable vblank TE (%d)\n", err); | 288 | + dev_err(ctx->dev, "failed to enable vblank TE (%d)\n", err); |
292 | + return err; | 289 | + return err; |
293 | + } | 290 | + } |
294 | + | 291 | + |
295 | + /* Disable access to Level 2 registers */ | 292 | + /* Disable access to Level 2 registers */ |
296 | + ICNL9707_DCS(ICNL9707_CMD_PASSWORD2, | 293 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PASSWORD2, |
297 | + ICNL9707_P_PASSWORD2_DEFAULT, | 294 | + ICNL9707_P_PASSWORD2_DEFAULT, |
298 | + ICNL9707_P_PASSWORD2_DEFAULT); | 295 | + ICNL9707_P_PASSWORD2_DEFAULT); |
299 | + ICNL9707_DCS(ICNL9707_CMD_PASSWORD1, | 296 | + mipi_dsi_dcs_write_seq(dsi, ICNL9707_CMD_PASSWORD1, |
300 | + ICNL9707_P_PASSWORD1_DEFAULT, | 297 | + ICNL9707_P_PASSWORD1_DEFAULT, |
301 | + ICNL9707_P_PASSWORD1_DEFAULT); | 298 | + ICNL9707_P_PASSWORD1_DEFAULT); |
302 | + | ||
303 | + return 0; | ||
304 | +} | ||
305 | + | ||
306 | +static int cwd686_disable(struct drm_panel *panel) | ||
307 | +{ | ||
308 | + struct cwd686 *ctx = panel_to_cwd686(panel); | ||
309 | + | ||
310 | + if (!ctx->enabled) | ||
311 | + return 0; | ||
312 | + | ||
313 | + backlight_disable(ctx->backlight); | ||
314 | + | ||
315 | + ctx->enabled = false; | ||
316 | + | 299 | + |
317 | + return 0; | 300 | + return 0; |
318 | +} | 301 | +} |
319 | + | 302 | + |
320 | +static int cwd686_unprepare(struct drm_panel *panel) | 303 | +static int cwd686_unprepare(struct drm_panel *panel) |
... | ... | ||
340 | + | 323 | + |
341 | + msleep(120); | 324 | + msleep(120); |
342 | + | 325 | + |
343 | + gpiod_set_value_cansleep(ctx->reset_gpio, 0); | 326 | + gpiod_set_value_cansleep(ctx->reset_gpio, 0); |
344 | + | 327 | + |
328 | + regulator_disable(ctx->iovcc); | ||
329 | + regulator_disable(ctx->vci); | ||
330 | + | ||
345 | + ctx->prepared = false; | 331 | + ctx->prepared = false; |
346 | + | 332 | + |
347 | + return 0; | 333 | + return 0; |
348 | +} | 334 | +} |
349 | + | 335 | + |
... | ... | ||
354 | + int err; | 340 | + int err; |
355 | + | 341 | + |
356 | + if (ctx->prepared) | 342 | + if (ctx->prepared) |
357 | + return 0; | 343 | + return 0; |
358 | + | 344 | + |
345 | + err = regulator_enable(ctx->vci); | ||
346 | + if (err < 0) { | ||
347 | + dev_err(ctx->dev, "failed to enable vci supply: %d\n", err); | ||
348 | + return err; | ||
349 | + } | ||
350 | + err = regulator_enable(ctx->iovcc); | ||
351 | + if (err < 0) { | ||
352 | + dev_err(ctx->dev, "failed to enable iovcc supply: %d\n", err); | ||
353 | + goto disable_vci; | ||
354 | + } | ||
355 | + | ||
359 | + gpiod_set_value_cansleep(ctx->reset_gpio, 0); | 356 | + gpiod_set_value_cansleep(ctx->reset_gpio, 0); |
360 | + /* T2 */ | 357 | + /* T2 */ |
361 | + msleep(10); | 358 | + msleep(10); |
362 | + | 359 | + |
363 | + gpiod_set_value_cansleep(ctx->reset_gpio, 1); | 360 | + gpiod_set_value_cansleep(ctx->reset_gpio, 1); |
... | ... | ||
367 | + /* Exit sleep mode and power on */ | 364 | + /* Exit sleep mode and power on */ |
368 | + | 365 | + |
369 | + err = cwd686_init_sequence(ctx); | 366 | + err = cwd686_init_sequence(ctx); |
370 | + if (err) { | 367 | + if (err) { |
371 | + dev_err(ctx->dev, "failed to initialize display (%d)\n", err); | 368 | + dev_err(ctx->dev, "failed to initialize display (%d)\n", err); |
372 | + return err; | 369 | + goto disable_iovcc; |
373 | + } | 370 | + } |
374 | + | 371 | + |
375 | + err = mipi_dsi_dcs_exit_sleep_mode(dsi); | 372 | + err = mipi_dsi_dcs_exit_sleep_mode(dsi); |
376 | + if (err) { | 373 | + if (err) { |
377 | + dev_err(ctx->dev, "failed to exit sleep mode (%d)\n", err); | 374 | + dev_err(ctx->dev, "failed to exit sleep mode (%d)\n", err); |
378 | + return err; | 375 | + goto disable_iovcc; |
379 | + } | 376 | + } |
380 | + /* T6 */ | 377 | + /* T6 */ |
381 | + msleep(120); | 378 | + msleep(120); |
382 | + | 379 | + |
383 | + err = mipi_dsi_dcs_set_display_on(dsi); | 380 | + err = mipi_dsi_dcs_set_display_on(dsi); |
384 | + if (err) { | 381 | + if (err) { |
385 | + dev_err(ctx->dev, "failed to turn display on (%d)\n", err); | 382 | + dev_err(ctx->dev, "failed to turn display on (%d)\n", err); |
386 | + return err; | 383 | + goto disable_iovcc; |
387 | + } | 384 | + } |
388 | + msleep(20); | 385 | + msleep(20); |
389 | + | 386 | + |
390 | + ctx->prepared = true; | 387 | + ctx->prepared = true; |
391 | + | 388 | + |
392 | + return 0; | 389 | + return 0; |
393 | +} | 390 | +disable_iovcc: |
394 | + | 391 | + regulator_disable(ctx->iovcc); |
395 | +static int cwd686_enable(struct drm_panel *panel) | 392 | +disable_vci: |
396 | +{ | 393 | + regulator_disable(ctx->vci); |
397 | + struct cwd686 *ctx = panel_to_cwd686(panel); | 394 | + return err; |
398 | + | ||
399 | + if (ctx->enabled) | ||
400 | + return 0; | ||
401 | + | ||
402 | + backlight_enable(ctx->backlight); | ||
403 | + | ||
404 | + ctx->enabled = true; | ||
405 | + | ||
406 | + return 0; | ||
407 | +} | 395 | +} |
408 | + | 396 | + |
409 | +static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *connector) | 397 | +static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *connector) |
410 | +{ | 398 | +{ |
411 | + struct cwd686 *ctx = panel_to_cwd686(panel); | 399 | + struct cwd686 *ctx = panel_to_cwd686(panel); |
... | ... | ||
417 | + return -EINVAL; | 405 | + return -EINVAL; |
418 | + } | 406 | + } |
419 | + drm_mode_set_name(mode); | 407 | + drm_mode_set_name(mode); |
420 | + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; | 408 | + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; |
421 | + | 409 | + |
422 | + connector->display_info.width_mm = mode->width_mm; | 410 | + /* Set up connector's "panel orientation" property */ |
423 | + connector->display_info.height_mm = mode->height_mm; | ||
424 | + | ||
425 | + /* set up connector's "panel orientation" property */ | ||
426 | + drm_connector_set_panel_orientation(connector, ctx->orientation); | 411 | + drm_connector_set_panel_orientation(connector, ctx->orientation); |
427 | + | 412 | + |
428 | + drm_mode_probed_add(connector, mode); | 413 | + drm_mode_probed_add(connector, mode); |
429 | + | 414 | + |
430 | + return 1; /* Number of modes */ | 415 | + return 1; /* Number of modes */ |
431 | +} | 416 | +} |
432 | + | 417 | + |
433 | +static const struct drm_panel_funcs cwd686_drm_funcs = { | 418 | +static const struct drm_panel_funcs cwd686_drm_funcs = { |
434 | + .disable = cwd686_disable, | ||
435 | + .unprepare = cwd686_unprepare, | 419 | + .unprepare = cwd686_unprepare, |
436 | + .prepare = cwd686_prepare, | 420 | + .prepare = cwd686_prepare, |
437 | + .enable = cwd686_enable, | ||
438 | + .get_modes = cwd686_get_modes, | 421 | + .get_modes = cwd686_get_modes, |
439 | +}; | 422 | +}; |
440 | + | 423 | + |
441 | +static int cwd686_probe(struct mipi_dsi_device *dsi) | 424 | +static int cwd686_probe(struct mipi_dsi_device *dsi) |
442 | +{ | 425 | +{ |
... | ... | ||
458 | + MIPI_DSI_MODE_VIDEO_SYNC_PULSE; | 441 | + MIPI_DSI_MODE_VIDEO_SYNC_PULSE; |
459 | + | 442 | + |
460 | + ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); | 443 | + ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); |
461 | + if (IS_ERR(ctx->reset_gpio)) { | 444 | + if (IS_ERR(ctx->reset_gpio)) { |
462 | + err = PTR_ERR(ctx->reset_gpio); | 445 | + err = PTR_ERR(ctx->reset_gpio); |
463 | + if (err != -EPROBE_DEFER) | 446 | + return dev_err_probe(dev, err, "Failed to request GPIO (%d)\n", err); |
464 | + dev_err(dev, "failed to request GPIO (%d)\n", err); | 447 | + } |
465 | + return err; | 448 | + |
466 | + } | 449 | + ctx->vci = devm_regulator_get(dev, "vci"); |
467 | + | 450 | + if (IS_ERR(ctx->vci)) { |
468 | + ctx->backlight = devm_of_find_backlight(dev); | 451 | + err = PTR_ERR(ctx->vci); |
469 | + if (IS_ERR(ctx->backlight)) | 452 | + return dev_err_probe(dev, err, "Failed to request vci regulator: %d\n", err); |
470 | + return PTR_ERR(ctx->backlight); | 453 | + } |
454 | + | ||
455 | + ctx->iovcc = devm_regulator_get(dev, "iovcc"); | ||
456 | + if (IS_ERR(ctx->iovcc)) { | ||
457 | + err = PTR_ERR(ctx->iovcc); | ||
458 | + return dev_err_probe(dev, err, "Failed to request iovcc regulator: %d\n", err); | ||
459 | + } | ||
471 | + | 460 | + |
472 | + err = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); | 461 | + err = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); |
473 | + if (err) { | 462 | + if (err) { |
474 | + dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err); | 463 | + dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err); |
475 | + return err; | 464 | + return err; |
476 | + } | 465 | + } |
477 | + | 466 | + |
478 | + drm_panel_init(&ctx->panel, dev, &cwd686_drm_funcs, DRM_MODE_CONNECTOR_DSI); | 467 | + drm_panel_init(&ctx->panel, dev, &cwd686_drm_funcs, DRM_MODE_CONNECTOR_DSI); |
479 | + | 468 | + |
469 | + err = drm_panel_of_backlight(&ctx->panel); | ||
470 | + if (err) | ||
471 | + return dev_err_probe(dev, err, "Failed to get backlight\n"); | ||
472 | + | ||
473 | + ctx->panel.prepare_prev_first = true; | ||
480 | + drm_panel_add(&ctx->panel); | 474 | + drm_panel_add(&ctx->panel); |
481 | + | 475 | + |
482 | + err = mipi_dsi_attach(dsi); | 476 | + err = mipi_dsi_attach(dsi); |
483 | + if (err < 0) { | 477 | + if (err < 0) { |
484 | + dev_err(dev, "mipi_dsi_attach() failed: %d\n", err); | 478 | + dev_err(dev, "mipi_dsi_attach() failed: %d\n", err); |
... | ... | ||
487 | + } | 481 | + } |
488 | + | 482 | + |
489 | + return 0; | 483 | + return 0; |
490 | +} | 484 | +} |
491 | + | 485 | + |
492 | +static int cwd686_remove(struct mipi_dsi_device *dsi) | 486 | +static void cwd686_remove(struct mipi_dsi_device *dsi) |
493 | +{ | 487 | +{ |
494 | + struct cwd686 *ctx = mipi_dsi_get_drvdata(dsi); | 488 | + struct cwd686 *ctx = mipi_dsi_get_drvdata(dsi); |
495 | + | 489 | + |
496 | + mipi_dsi_detach(dsi); | 490 | + mipi_dsi_detach(dsi); |
497 | + drm_panel_remove(&ctx->panel); | 491 | + drm_panel_remove(&ctx->panel); |
498 | + | ||
499 | + return 0; | ||
500 | +} | 492 | +} |
501 | + | 493 | + |
502 | +static const struct of_device_id cwd686_of_match[] = { | 494 | +static const struct of_device_id cwd686_of_match[] = { |
503 | + { .compatible = "clockworkpi,cwd686" }, | 495 | + { .compatible = "clockwork,cwd686" }, |
504 | + { /* sentinel */ } | 496 | + { /* sentinel */ } |
505 | +}; | 497 | +}; |
506 | +MODULE_DEVICE_TABLE(of, cwd686_of_match); | 498 | +MODULE_DEVICE_TABLE(of, cwd686_of_match); |
507 | + | 499 | + |
508 | +static struct mipi_dsi_driver cwd686_driver = { | 500 | +static struct mipi_dsi_driver cwd686_driver = { |
509 | + .probe = cwd686_probe, | 501 | + .probe = cwd686_probe, |
510 | + .remove = cwd686_remove, | 502 | + .remove = cwd686_remove, |
511 | + .driver = { | 503 | + .driver = { |
512 | + .name = "panel-clockworkpi-cwd686", | 504 | + .name = "panel-clockwork-cwd686", |
513 | + .of_match_table = cwd686_of_match, | 505 | + .of_match_table = cwd686_of_match, |
514 | + }, | 506 | + }, |
515 | +}; | 507 | +}; |
516 | +module_mipi_dsi_driver(cwd686_driver); | 508 | +module_mipi_dsi_driver(cwd686_driver); |
517 | + | 509 | + |
518 | +MODULE_AUTHOR("Pinfan Zhu <zhu@clockworkpi.com>"); | 510 | +MODULE_AUTHOR("Pinfan Zhu <zhu@clockworkpi.com>"); |
519 | +MODULE_AUTHOR("Max Fierke <max@maxfierke.com>"); | 511 | +MODULE_AUTHOR("Max Fierke <max@maxfierke.com>"); |
520 | +MODULE_DESCRIPTION("ClockworkPi CWD686 panel driver"); | 512 | +MODULE_AUTHOR("Charlotte Deleńkec <lotte@chir.rs>"); |
513 | +MODULE_DESCRIPTION("Clockwork CWD686 panel driver"); | ||
521 | +MODULE_LICENSE("GPL"); | 514 | +MODULE_LICENSE("GPL"); |
522 | -- | 515 | -- |
523 | 2.36.1 | 516 | 2.48.1 |
517 | diff view generated by jsdifflib |
1 | From: Max Fierke <max@maxfierke.com> | ||
---|---|---|---|
2 | |||
1 | The CWD686 is a 6.86" IPS LCD panel used as the primary | 3 | The CWD686 is a 6.86" IPS LCD panel used as the primary |
2 | display in the ClockworkPi DevTerm portable (all cores) | 4 | display in the ClockworkPi DevTerm portable (all cores) |
3 | 5 | ||
6 | Co-authored-by: Charlotte Deleńkec <lotte@chir.rs> | ||
7 | Signed-off-by: Charlotte Deleńkec <lotte@chir.rs> | ||
4 | Signed-off-by: Max Fierke <max@maxfierke.com> | 8 | Signed-off-by: Max Fierke <max@maxfierke.com> |
9 | Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | ||
5 | --- | 10 | --- |
6 | .../display/panel/clockworkpi,cwd686.yaml | 60 +++++++++++++++++++ | 11 | .../display/panel/clockwork,cwd686.yaml | 65 +++++++++++++++++++ |
7 | 1 file changed, 60 insertions(+) | 12 | 1 file changed, 65 insertions(+) |
8 | create mode 100644 Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml | 13 | create mode 100644 Documentation/devicetree/bindings/display/panel/clockwork,cwd686.yaml |
9 | 14 | ||
10 | diff --git a/Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml b/Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml | 15 | diff --git a/Documentation/devicetree/bindings/display/panel/clockwork,cwd686.yaml b/Documentation/devicetree/bindings/display/panel/clockwork,cwd686.yaml |
11 | new file mode 100644 | 16 | new file mode 100644 |
12 | index XXXXXXX..XXXXXXX | 17 | index XXXXXXX..XXXXXXX |
13 | --- /dev/null | 18 | --- /dev/null |
14 | +++ b/Documentation/devicetree/bindings/display/panel/clockworkpi,cwd686.yaml | 19 | +++ b/Documentation/devicetree/bindings/display/panel/clockwork,cwd686.yaml |
15 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ |
16 | +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | 21 | +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) |
17 | +%YAML 1.2 | 22 | +%YAML 1.2 |
18 | +--- | 23 | +--- |
19 | +$id: http://devicetree.org/schemas/display/panel/clockworkpi,cwd686.yaml# | 24 | +$id: http://devicetree.org/schemas/display/panel/clockwork,cwd686.yaml# |
20 | +$schema: http://devicetree.org/meta-schemas/core.yaml# | 25 | +$schema: http://devicetree.org/meta-schemas/core.yaml# |
21 | + | 26 | + |
22 | +title: ClockworkPi CWD686 6.86" IPS LCD panel | 27 | +title: Clockwork CWD686 6.86" IPS LCD panel |
23 | + | 28 | + |
24 | +maintainers: | 29 | +maintainers: |
25 | + - Max Fierke <max@maxfierke.com> | 30 | + - Max Fierke <max@maxfierke.com> |
26 | + | 31 | + |
27 | +description: | | 32 | +description: | |
28 | + The ClockworkPi CWD686 is a 6.86" ICNL9707-based IPS LCD panel used within the | 33 | + The Clockwork CWD686 is a 6.86" ICNL9707-based IPS LCD panel used within the |
29 | + ClockworkPi DevTerm series of portable devices. The panel has a 480x1280 | 34 | + Clockwork DevTerm series of portable devices. The panel has a 480x1280 |
30 | + resolution and uses 24 bit RGB per pixel. | 35 | + resolution and uses 24 bit RGB per pixel. |
31 | + | 36 | + |
32 | +allOf: | 37 | +allOf: |
33 | + - $ref: panel-common.yaml# | 38 | + - $ref: panel-common.yaml# |
34 | + | 39 | + |
35 | +properties: | 40 | +properties: |
36 | + compatible: | 41 | + compatible: |
37 | + const: clockworkpi,cwd686 | 42 | + const: clockwork,cwd686 |
38 | + | 43 | + |
39 | + reg: | 44 | + reg: |
40 | + description: DSI virtual channel used by that screen | 45 | + description: DSI virtual channel used by that screen |
41 | + maxItems: 1 | 46 | + maxItems: 1 |
47 | + | ||
48 | + iovcc-supply: | ||
49 | + description: regulator that supplies the iovcc voltage | ||
50 | + | ||
51 | + vci-supply: | ||
52 | + description: regulator that supplies the vci voltage | ||
42 | + | 53 | + |
43 | + reset-gpios: true | 54 | + reset-gpios: true |
44 | + rotation: true | 55 | + rotation: true |
45 | + backlight: true | 56 | + backlight: true |
46 | + | 57 | + |
47 | +required: | 58 | +required: |
48 | + - compatible | 59 | + - compatible |
49 | + - reg | 60 | + - reg |
50 | + - backlight | 61 | + - backlight |
51 | + - reset-gpios | 62 | + - reset-gpios |
63 | + - iovcc-supply | ||
64 | + - vci-supply | ||
52 | + | 65 | + |
53 | +additionalProperties: false | 66 | +additionalProperties: false |
54 | + | 67 | + |
55 | +examples: | 68 | +examples: |
56 | + - | | 69 | + - | |
57 | + #include <dt-bindings/gpio/gpio.h> | 70 | + #include <dt-bindings/gpio/gpio.h> |
58 | + | 71 | + |
59 | + backlight: backlight { | ||
60 | + compatible = "gpio-backlight"; | ||
61 | + gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; | ||
62 | + }; | ||
63 | + | ||
64 | + dsi { | 72 | + dsi { |
65 | + #address-cells = <1>; | 73 | + #address-cells = <1>; |
66 | + #size-cells = <0>; | 74 | + #size-cells = <0>; |
67 | + | 75 | + |
68 | + panel@0 { | 76 | + panel@0 { |
69 | + compatible = "clockworkpi,cwd686"; | 77 | + compatible = "clockwork,cwd686"; |
70 | + reg = <0>; | 78 | + reg = <0>; |
71 | + backlight = <&backlight>; | 79 | + backlight = <&backlight>; |
72 | + reset-gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>; | 80 | + reset-gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>; |
73 | + rotation = <90>; | 81 | + rotation = <90>; |
82 | + iovcc-supply = <&vcc_1v8>; | ||
83 | + vci-supply = <&vcc3v3_sys>; | ||
74 | + }; | 84 | + }; |
75 | + }; | 85 | + }; |
76 | -- | 86 | -- |
77 | 2.36.1 | 87 | 2.48.1 |
88 | diff view generated by jsdifflib |
1 | Add a prefix for Clockwork Tech LLC, known as ClockworkPi. They | 1 | From: Max Fierke <max@maxfierke.com> |
---|---|---|---|
2 | produce a number of hobbyist devices, including the ClockworkPi | 2 | |
3 | DevTerm and GameShell. | 3 | Returns the panel's configured orientation |
4 | 4 | ||
5 | Signed-off-by: Max Fierke <max@maxfierke.com> | 5 | Signed-off-by: Max Fierke <max@maxfierke.com> |
6 | --- | 6 | --- |
7 | Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ | 7 | drivers/gpu/drm/panel/panel-clockwork-cwd686.c | 14 +++++++++++++- |
8 | 1 file changed, 2 insertions(+) | 8 | 1 file changed, 13 insertions(+), 1 deletion(-) |
9 | 9 | ||
10 | diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml | 10 | diff --git a/drivers/gpu/drm/panel/panel-clockwork-cwd686.c b/drivers/gpu/drm/panel/panel-clockwork-cwd686.c |
11 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml | 12 | --- a/drivers/gpu/drm/panel/panel-clockwork-cwd686.c |
13 | +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml | 13 | +++ b/drivers/gpu/drm/panel/panel-clockwork-cwd686.c |
14 | @@ -XXX,XX +XXX,XX @@ patternProperties: | 14 | @@ -XXX,XX +XXX,XX @@ static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *conne |
15 | description: Cirrus Logic, Inc. | 15 | drm_mode_set_name(mode); |
16 | "^cisco,.*": | 16 | mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; |
17 | description: Cisco Systems, Inc. | 17 | |
18 | + "^clockworkpi,.*": | 18 | - /* Set up connector's "panel orientation" property */ |
19 | + description: Clockwork Tech LLC | 19 | + /* |
20 | "^cloudengines,.*": | 20 | + * TODO: Remove once all drm drivers call |
21 | description: Cloud Engines, Inc. | 21 | + * drm_connector_set_orientation_from_panel() |
22 | "^cnm,.*": | 22 | + */ |
23 | drm_connector_set_panel_orientation(connector, ctx->orientation); | ||
24 | |||
25 | drm_mode_probed_add(connector, mode); | ||
26 | @@ -XXX,XX +XXX,XX @@ static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *conne | ||
27 | return 1; /* Number of modes */ | ||
28 | } | ||
29 | |||
30 | + | ||
31 | +static enum drm_panel_orientation cwd686_get_orientation(struct drm_panel *panel) | ||
32 | +{ | ||
33 | + struct cwd686 *ctx = panel_to_cwd686(panel); | ||
34 | + | ||
35 | + return ctx->orientation; | ||
36 | +} | ||
37 | + | ||
38 | static const struct drm_panel_funcs cwd686_drm_funcs = { | ||
39 | .unprepare = cwd686_unprepare, | ||
40 | .prepare = cwd686_prepare, | ||
41 | .get_modes = cwd686_get_modes, | ||
42 | + .get_orientation = cwd686_get_orientation, | ||
43 | }; | ||
44 | |||
45 | static int cwd686_probe(struct mipi_dsi_device *dsi) | ||
23 | -- | 46 | -- |
24 | 2.36.1 | 47 | 2.48.1 | diff view generated by jsdifflib |