drm/panel: Add support for the FocusLCDs E35GH-I-MW800CB
Subsystems (5)
Igor Reznichenko
maintainerv4 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.
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 | 299 ++++++++++++++++++ 6 files changed, 380 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
Igor Reznichenko
maintainerPATCH v4 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
@@ -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 = <®_vci_panel>; + iovcc-supply = <®_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
@@ -600,6 +600,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
Igor Reznichenko
maintainerPATCH v4 2/2 drm/panel: Add Ilitek ILI9488 controller driver
In reply to Igor ReznichenkoAdd 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 | 299 +++++++++++++++++++ 4 files changed, 315 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9488.c
MAINTAINERS +6 -0
@@ -8038,6 +8038,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
@@ -260,6 +260,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
@@ -26,6 +26,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 +299 -0
299 lines not on this page · raw message
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v4 2/2] drm/panel: Add Ilitek ILI9488 controller driver
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Missing NULL check for the return value of `device_get_match_data()`, leading to a potential NULL…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Missing NULL check for the return value of device_get_match_data(), leading to a potential NULL pointer dereference.
- [Medium] Missing color depth (bpc) assignment in connector display_info.
- [Low] The MIPI DCS command MIPI_DCS_ENTER_INVERT_MODE (0x21) is incorrectly sent with a superfluous parameter. --
commit 8971cceb8f9149b896a3175bdf0f536b85a67eda
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 panel. It includes the initialization sequence and mode timings adjusted after STM32MP157 testing.
Quoted 5 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +0
-0
[ ... ]
Quoted 2 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +2
-0+static void e35gh_i_mw800cb_init (struct mipi_dsi_multi_context *ctx) +{
[ ... ]
drivers/gpu/drm/panel/panel-ilitek-ili9488.c line 64
Quoted 3 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +3
-0+mipi_dsi_dcs_write_seq_multi (ctx,0xE9 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (ctx,0xF7 ,0xA9 ,0x51 ,0x2C ,0x82 ); +mipi_dsi_dcs_write_seq_multi (ctx,0x21 ,0x00 );
[Severity: Low]
Is the extra parameter intended here? The 0x21 command corresponds to the standard MIPI DCS enter invert mode command, which typically takes 0 parameters. Providing 0x00 creates a DCS short write with 1 parameter, which might be rejected by strictly compliant hardware.
Quoted 1 line
+}
[ ... ]
drivers/gpu/drm/panel/panel-ilitek-ili9488.c line 188
Quoted 5 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +5
-0+static int ili9488_get_modes (struct drm_panel *panel,struct drm_connector *connector) +{ +struct ili9488 *ili =panel_to_ili9488 (panel); +const struct drm_display_mode *mode = ili->desc->display_mode; +
[Severity: Medium]
Should this function also set connector->display_info.bpc? The panel is configured for the 18-bit RGB666 pixel format (MIPI_DSI_FMT_RGB666_PACKED), but the bpc isn't explicitly assigned to 6. Without this, the DRM core might assume a default 8 bpc color depth and cause upstream controllers to output the wrong format.
Quoted 2 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +2
-0+return drm_connector_helper_get_modes_fixed (connector, mode); +}
[ ... ]
Quoted 6 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +6
-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 221
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); +mipi_dsi_set_drvdata (dsi, ili); + ili->dsi = dsi; + + dsi->mode_flags = ili->desc->mode_flags;
[Severity: High]
Can device_get_match_data() return a null pointer here if the driver is bound manually via sysfs? If it does, dereferencing ili->desc for dsi->mode_flags will cause a null pointer dereference. Is a check needed before accessing ili->desc?
Quoted 2 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +2
-0+ dsi->format = ili->desc->format; + dsi->lanes = ili->desc->lanes;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Neil Armstrong
maintainerRe: [PATCH v4 2/2] drm/panel: Add Ilitek ILI9488 controller driver
In reply to Igor ReznichenkoHi,
Quoted 13 lines · 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.
Signed-off-by Igor Reznichenko <[email protected]>--- MAINTAINERS | 6 + drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-ilitek-ili9488.c | 299 +++++++++++++++++++ 4 files changed, 315 insertions(+)create mode 100644
drivers/gpu/drm/panel/panel-ilitek-ili9488.c
<snip>
Quoted 40 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +40
-0+ +static int ili9488_dsi_probe (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +struct ili9488 *ili; +int i, ret; + + 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); +mipi_dsi_set_drvdata (dsi, ili); + ili->dsi = dsi; + + dsi->mode_flags = ili->desc->mode_flags; + dsi->format = ili->desc->format; + dsi->lanes = ili->desc->lanes; + + ili->reset =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_LOW ); +if (IS_ERR (ili->reset)) +return dev_err_probe (dev,PTR_ERR (ili->reset), +"failed to get reset-gpios\n" ); + +for (i =0 ; i <ARRAY_SIZE (ili->supplies); i++) + ili->supplies[i].supply = regulator_names[i]; + + ret =devm_regulator_bulk_get (dev,ARRAY_SIZE (ili->supplies), + ili->supplies); +if (ret <0 ) +return dev_err_probe (dev, ret,"failed to get regulators\n" ); + + ret =of_drm_get_panel_orientation (dev->of_node, &ili->orientation); +if (ret) +return dev_err_probe (dev, ret,"failed to get orientation\n" ); + + ret =drm_panel_of_backlight (&ili->panel); +if (ret) +return dev_err_probe (dev, ret,"failed to get backlight\n" );
drivers/gpu/drm/panel/panel-ilitek-ili9488.c line 254
Quoted 10 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +10
-0+ + ili->panel.prepare_prev_first = true; +drm_panel_add (&ili->panel); + + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +dev_err_probe (dev, ret,"failed to attach to DSI host\n" ); +drm_panel_remove (&ili->panel); +return ret; + }
Please switch to devm_drm_panel_add() and devm_mipi_dsi_attach() and drop the remove callback.
Quoted 35 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +35
-0+ +return 0 ; +} + +static void ili9488_dsi_remove (struct mipi_dsi_device *dsi) +{ +struct ili9488 *ili =mipi_dsi_get_drvdata (dsi); +int ret; + + ret =mipi_dsi_detach (dsi); +if (ret <0 ) +dev_err (&dsi->dev,"failed to detach from DSI host: %d\n" , ret); + +drm_panel_remove (&ili->panel); +} + +static const struct ili9488_desc e35gh_i_mw800cb_desc = { + .init_sequence = e35gh_i_mw800cb_init, + .display_mode = &e35gh_i_mw800cb_display_mode, + .mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_VIDEO_SYNC_PULSE | +MIPI_DSI_MODE_LPM |MIPI_DSI_CLOCK_NON_CONTINUOUS , + .format =MIPI_DSI_FMT_RGB666_PACKED , + .lanes =1 , +}; + +static const struct of_device_id ili9488_of_match[] = { + { .compatible ="focuslcds,e35gh-i-mw800cb" , .data = &e35gh_i_mw800cb_desc }, + { } +}; + +MODULE_DEVICE_TABLE (of, ili9488_of_match); + +static struct mipi_dsi_driver ili9488_dsi_driver = { + .probe = ili9488_dsi_probe, + .remove = ili9488_dsi_remove,
drivers/gpu/drm/panel/panel-ilitek-ili9488.c line 299
Quoted 10 lines
drivers/gpu/drm/panel/panel-ilitek-ili9488.c new file +10
-0+ .driver = { + .name = "ili9488-dsi", + .of_match_table = ili9488_of_match, + }, +}; +module_mipi_dsi_driver (ili9488_dsi_driver); + +MODULE_AUTHOR ("Igor Reznichenko <[email protected]>" ); +MODULE_DESCRIPTION ("Ilitek ILI9488 Controller Driver" ); +MODULE_LICENSE ("GPL" );
Thanks,
Neil