Skip to contentSkip to conversation

drm/panel: Add support for the FocusLCDs E35GH-I-MW800CB

PATCH Superseded Igor Reznichenko 2 participants 7 messages May 29 – Jun 3

Subsystems (5)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Igor Reznichenko

author maintainer
#0 lore raw

v5 cover drm/panel: Add support for the FocusLCDs E35GH-I-MW800CB

Add support for E35GH-I-MW800CB 320x480 MIPI DSI panel by FocusLCDs. The panel uses Ilitek ILI9488 driver IC in DSI mode specifically. ILI9488 also appears in DBI/SPI panels, but those require different bus drivers.

This is a resend of v3. Since v3, this panel driver has been tested on STM32MP157D-DK1 in addition to TI AM62P EVK. The panel works in video mode on both platforms. Additional panels using ILI9488 DSI can be added later with their own timings.

v5: Switched to devm_drm_panel_add() and devm_mipi_dsi_attach()
Dropped not required anymore .remove callback Added display_info.bpc=6 initialization
Changed 0x21 DCS command to send 0 arguments as per spec

v4: Rebased
Tested 7.1-rc5 on STM32MP157D-DK1
Adjusted E35GH-I-MW800CB mode timing to a 14.4 MHz pixel clock with slightly increased blanking to make it more synthesizable across DSI hosts

v3: Fixed missing Reviewed-by tag

    https://lore.kernel.org/all/[email protected]/

v2: Added comment explaining the "focuslcds" vendor prefix

    https://lore.kernel.org/all/[email protected]/

v1:

    https://lore.kernel.org/all/[email protected]/

Igor Reznichenko (2):
dt-bindings: display: panel: Add Ilitek ILI9488 panel controller drm/panel: Add Ilitek ILI9488 controller driver

 .../display/panel/ilitek,ili9488.yaml         |  63 ++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   6 +
 drivers/gpu/drm/panel/Kconfig                 |   9 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9488.c  | 289 ++++++++++++++++++
 6 files changed, 370 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9488.c
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v5 1/2 dt-bindings: display: panel: Add Ilitek ILI9488 panel controller

Add binding for the Ilitek ILI9488 panel controller which is found on the FocusLCDs E35GH-I-MW800-CB MIPI DSI panel. Add "focuslcds" to vendor-prefixes.yaml as it's a brandname and a website
(https://focuslcds.com/) for Focus Display Solutions, Inc.

---
 .../display/panel/ilitek,ili9488.yaml         | 63 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 2 files changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml
Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml new file +63 -0
new file mode 100644
index 000000000000..ea7449273022
@@ -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/ilitek,ili9488.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ilitek ILI9488 based MIPI-DSI panels
+
+maintainers:
+  - Igor Reznichenko <[email protected]>
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - focuslcds,e35gh-i-mw800cb
+      - const: ilitek,ili9488
+
+  reg:
+    maxItems: 1
+
+  vci-supply: true
+  iovcc-supply: true
+
+required:
+  - compatible
+  - reg
+  - vci-supply
+  - iovcc-supply
+  - reset-gpios
+  - backlight
+  - port
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "focuslcds,e35gh-i-mw800cb", "ilitek,ili9488";
+            reg = <0>;
+            vci-supply = <&reg_vci_panel>;
+            iovcc-supply = <&reg_iovcc_panel>;
+            reset-gpios = <&gpio3 6 GPIO_ACTIVE_LOW>;
+            backlight = <&pwm_bl>;
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&dsi_out>;
+                };
+            };
+        };
+    };
+
+...
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 11c55b5df0e4..ce195c72db6b 100644
@@ -602,6 +602,8 @@ patternProperties:
     description: Flipkart Inc.
   "^focaltech,.*":
     description: FocalTech Systems Co.,Ltd
+  "^focuslcds,.*":
+    description: Focus Display Solutions, Inc.
   "^forlinx,.*":
     description: Baoding Forlinx Embedded Technology Co., Ltd.
   "^foursemi,.*":
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v5 1/2] dt-bindings: display: panel: Add Ilitek ILI9488 panel controller

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Mismatch between the hardware model name in the commit message and the defined compatible string.…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Mismatch between the hardware model name in the commit message and the defined compatible string. The commit message specifies the panel model as 'E35GH-I-MW800-CB'. However, the compatible string is defined as 'focuslcds,e35gh-i-mw800cb', omitting the hyphen before 'cb'. --

commit 77323add8dc7854fc38182a5936a43c1c36a096a
Author: Igor Reznichenko <[email protected]>

dt-bindings: display: panel: Add Ilitek ILI9488 panel controller

This commit adds device tree bindings for the Ilitek ILI9488 panel controller used in the FocusLCDs E35GH-I-MW800-CB MIPI DSI panel. It also adds the focuslcds vendor prefix.

Quoted 3 lines
Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml new file +0 -0

[ ... ]

Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml line 19

Quoted 5 lines
Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml new file +5 -0
+properties:
+  compatible:
+    items:
+      - enum:
+          - focuslcds,e35gh-i-mw800cb

[Severity: Low]
This isn't a bug, but should this compatible string include a hyphen before the cb?

The commit message specifies the panel model as E35GH-I-MW800-CB, but the compatible string is defined as focuslcds,e35gh-i-mw800cb without the final hyphen.

Quoted 4 lines
Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml new file +4 -0
+      - const: ilitek,ili9488
+
+  reg:
+    maxItems: 1
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author maintainer
#3 lore raw

Re: [PATCH v5 1/2] dt-bindings: display: panel: Add Ilitek ILI9488 panel controller

Quoted 6 lines

Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml line 19

Quoted 5 lines
Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml new file +5 -0
+properties:
+  compatible:
+    items:
+      - enum:
+          - focuslcds,e35gh-i-mw800cb
Quoted 7 lines

[Severity: Low]
This isn't a bug, but should this compatible string include a hyphen before the cb?

The commit message specifies the panel model as E35GH-I-MW800-CB, but the compatible string is defined as focuslcds,e35gh-i-mw800cb without the final hyphen.

This is just punctuation in an identifier, not a desriptor issue.

DT compatibles need to be stable and unambiguous; they do not need to mirror vendor SKU formatting exactly. 'focuslcds,e35gh-i-mw800cb' uniquely identifies the supported panel, and the full vendor part number remains in the binding text and commit message.

author maintainer
#4 lore raw

PATCH v5 2/2 drm/panel: Add Ilitek ILI9488 controller driver

In reply to Igor Reznichenko

Add support for Ilitek ILI9488 DSI controller which is used in FocusLCDs E35GH-I-MW800-CB 320x480 MIPI DSI panel. The mode timing was adjusted after STM32MP157 testing. The previous 14.256 MHz mode worked on AM62P, but was awkward for STM32 DSI/LTDC clock synthesis.

---
 MAINTAINERS                                  |   6 +
 drivers/gpu/drm/panel/Kconfig                |   9 +
 drivers/gpu/drm/panel/Makefile               |   1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9488.c | 289 +++++++++++++++++++
 4 files changed, 305 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9488.c
MAINTAINERS +6 -0
index ac87c217ab1f..987635948cde 100644
@@ -8040,6 +8040,12 @@ T:	git https://gitlab.freedesktop.org/drm/misc/kernel.git
 F:	Documentation/devicetree/bindings/display/ilitek,ili9486.yaml
 F:	drivers/gpu/drm/tiny/ili9486.c
 
+DRM DRIVER FOR ILITEK ILI9488 PANELS
+M:	Igor Reznichenko <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/display/panel/ilitek,ili9488.yaml
+F:	drivers/gpu/drm/panel/panel-ilitek-ili9488.c
+
 DRM DRIVER FOR ILITEK ILI9805 PANELS
 M:	Michael Trimarchi <[email protected]>
 S:	Maintained
drivers/gpu/drm/panel/Kconfig +9 -0
index 7450b27622a2..37987e47f3f7 100644
@@ -284,6 +284,15 @@ config DRM_PANEL_ILITEK_ILI9341
 	  QVGA (240x320) RGB panels. support serial & parallel rgb
 	  interface.
 
+config DRM_PANEL_ILITEK_ILI9488
+	tristate "Ilitek ILI9488-based panels"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y if you want to enable support for panels based on the
+	  Ilitek ILI9488 controller.
+
 config DRM_PANEL_ILITEK_ILI9805
 	tristate "Ilitek ILI9805-based panels"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index c2c5cf817116..a1344a0a3fd0 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_DRM_PANEL_HIMAX_HX8394) += panel-himax-hx8394.o
 obj-$(CONFIG_DRM_PANEL_HYDIS_HV101HD1) += panel-hydis-hv101hd1.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o
+obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9488) += panel-ilitek-ili9488.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9805) += panel-ilitek-ili9805.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9806E_CORE) += panel-ilitek-ili9806e-core.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9806E_DSI) += panel-ilitek-ili9806e-dsi.o
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +289 -0

289 lines not on this page · raw message

Signature · 1 line
2.43.0
#5 lore raw

Re: [PATCH v5 2/2] drm/panel: Add Ilitek ILI9488 controller driver

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Missing NULL pointer check for the return value of device_get_match_data() leads to a kernel…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing NULL pointer check for the return value of device_get_match_data() leads to a kernel panic.
- [Low] The driver calls devm_drm_panel_add(), which is a non-existent function in the DRM subsystem, causing a compilation failure. --

commit 279cca9ce157e0fd7f3b036067b2491d2e280fa4
Author: Igor Reznichenko <[email protected]>

drm/panel: Add Ilitek ILI9488 controller driver

This commit adds support for the Ilitek ILI9488 DSI controller used in the FocusLCDs E35GH-I-MW800-CB 320x480 MIPI DSI panel.

Quoted 5 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +0 -0
new file mode 100644
index 0000000000000..7302766034fc9

[ ... ]

Quoted 5 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +5 -0
+static int ili9488_dsi_probe(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	struct ili9488 *ili;
+	int i, ret;

drivers/gpu/drm/panel/panel-ilitek-ili9488.c line 223

Quoted 10 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +10 -0
+
+	ili = devm_drm_panel_alloc(dev, struct ili9488, panel, &ili9488_funcs,
+				   DRM_MODE_CONNECTOR_DSI);
+	if (IS_ERR(ili))
+		return PTR_ERR(ili);
+
+	ili->desc = device_get_match_data(dev);
+	ili->dsi = dsi;
+
+	dsi->mode_flags = ili->desc->mode_flags;

[Severity: High]
Is it possible for device_get_match_data() to return NULL here?

If the device is instantiated without matching device tree data (for example, via a manual sysfs driver bind to a DSI device created without an OF node), device_get_match_data() will return NULL because the driver lacks an id_table and only provides an of_match_table.

Dereferencing ili->desc immediately after might lead to a NULL pointer dereference in these cases.

[ ... ]

drivers/gpu/drm/panel/panel-ilitek-ili9488.c line 250

Quoted 7 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +7 -0
+	ret = drm_panel_of_backlight(&ili->panel);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to get backlight\n");
+
+	ili->panel.prepare_prev_first = true;
+
+	ret = devm_drm_panel_add(dev, &ili->panel);

[Severity: Low]
Does devm_drm_panel_add() exist in the DRM subsystem?

Looking at the DRM panel API, while there is devm_drm_panel_alloc() and drm_panel_add(), there does not appear to be a devm-managed version of drm_panel_add(). Will this cause a build failure when compiling the driver?

Quoted 9 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +9 -0
+	if (ret)
+		return ret;
+
+	ret = devm_mipi_dsi_attach(dev, dsi);
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "failed to attach to DSI host\n");
+
+	return 0;
+}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
author maintainer
#6 lore raw

Re: [PATCH v5 2/2] drm/panel: Add Ilitek ILI9488 controller driver

Quoted 19 lines
Quoted 5 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +5 -0
+static int ili9488_dsi_probe(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	struct ili9488 *ili;
+	int i, ret;

drivers/gpu/drm/panel/panel-ilitek-ili9488.c line 223

Quoted 10 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +10 -0
+
+	ili = devm_drm_panel_alloc(dev, struct ili9488, panel, &ili9488_funcs,
+				   DRM_MODE_CONNECTOR_DSI);
+	if (IS_ERR(ili))
+		return PTR_ERR(ili);
+
+	ili->desc = device_get_match_data(dev);
+	ili->dsi = dsi;
+
+	dsi->mode_flags = ili->desc->mode_flags;

[Severity: High]
Is it possible for device_get_match_data() to return NULL here?

Quoted 7 lines

If the device is instantiated without matching device tree data (for example, via a manual sysfs driver bind to a DSI device created without an OF node), device_get_match_data() will return NULL because the driver lacks an id_table and only provides an of_match_table.

Dereferencing ili->desc immediately after might lead to a NULL pointer dereference in these cases.

This driver is DT-only in normal use and gets here through the OF compatible match. sysfs bind still goes through the DSI bus match path,
so this is not an arbitrary bind-to-any-device case.
The only NULL path I see is a non-DT DSI device whose DSI device name matches this driver, which is not a supported instantiation path for this panel.

That said, I can add a small check and return -ENODEV if reviewers prefer it, but I do not think this is a kernel-panic issue for the supported DT path.

Quoted 11 lines

drivers/gpu/drm/panel/panel-ilitek-ili9488.c line 250

Quoted 7 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +7 -0
+	ret = drm_panel_of_backlight(&ili->panel);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to get backlight\n");
+
+	ili->panel.prepare_prev_first = true;
+
+	ret = devm_drm_panel_add(dev, &ili->panel);

[Severity: Low]
Does devm_drm_panel_add() exist in the DRM subsystem?

Quoted 3 lines

Looking at the DRM panel API, while there is devm_drm_panel_alloc() and drm_panel_add(), there does not appear to be a devm-managed version of drm_panel_add(). Will this cause a build failure when compiling the driver?

This looks like a false positive for this series. v5 is based on drm-misc-next, where e43a8e3ad8fa3 ("drm/panel: add devm_drm_panel_add() helper") adds and exports that helper.