On Tue, Nov 11, 2025 at 04:13:09PM +0530, Sudarshan Shetty wrote:
> This patch adds a DRM panel driver for Waveshare MIPI-DSI panels
> of various sizes (5.0", 5.5", 7.0", 8.0", and 10.1") with integrated
> touch functionality.
> 
> The driver provides:
>  - Initialization and reset sequencing
>  - MIPI-DSI command transfer for panel setup
>  - Backlight integration through the backlight class device
>  - Support for multiple panel variants via compatible strings
> 
> These panels are commonly used with Waveshare development kits
> and require proper power sequencing and regulator support.
> 

In order to facilitate any form of discussion about the DeviceTree
binding and how this relates to the Waveshare MCU/regulator module,
the patches for these separate parts should be sent together as one
series.


That said, I was able to puzzle the pieces together and get the
Waveshare 12.3 DSI panel working, with touchscreen, on my Particle
Tachyon.

> Signed-off-by: Sudarshan Shetty <[email protected]>
> ---
[..]
> diff --git a/drivers/gpu/drm/panel/panel-waveshare-dsi-v2.c 
> b/drivers/gpu/drm/panel/panel-waveshare-dsi-v2.c
[..]
> +static int ws_panel_dsi_probe(struct mipi_dsi_device *dsi)
> +{
> +     struct ws_panel *ctx;
> +     int ret;
> +
> +     dev_info(&dsi->dev, "dsi panel: %s\n",
> +              (char *)of_get_property(
> +                      dsi->dev.of_node, "compatible", NULL));
> +
> +     ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL);
> +     if (!ctx)
> +             return -ENOMEM;
> +     mipi_dsi_set_drvdata(dsi, ctx);
> +     ctx->dsi = dsi;
> +     ctx->desc = of_device_get_match_data(&dsi->dev);
> +
> +     ctx->panel.prepare_prev_first = true;
> +     drm_panel_init(&ctx->panel, &dsi->dev, &ws_panel_funcs,
> +                    DRM_MODE_CONNECTOR_DSI);
> +
> +     ctx->reset = devm_gpiod_get_optional(
> +                     &dsi->dev, "reset", GPIOD_OUT_LOW);

Your reset signal is active-low, but you describe it in DeviceTree as
GPIO_ACTIVE_HIGH and then you invert the logic here (i.e. the think you
call "reset" is "not_reset").

Invert the high/low to mean high == reset, low == not-reset, here in the
driver and then say GPIO_ACTIVE_LOW in the DeviceTree.

> +     if (IS_ERR(ctx->reset))
> +             return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
> +                                  "Couldn't get our reset GPIO\n");
> +
> +     ctx->iovcc = devm_gpiod_get_optional(
> +                     &dsi->dev, "iovcc", GPIOD_OUT_LOW);

This really sounds like a regulator, not a GPIO.

> +     if (IS_ERR(ctx->iovcc))
> +             return dev_err_probe(&dsi->dev, PTR_ERR(ctx->iovcc),
> +                                     "Couldn't get our iovcc GPIO\n");
> +
> +     ctx->avdd = devm_gpiod_get_optional(&dsi->dev, "avdd", GPIOD_OUT_LOW);

This too sounds like a regulator, not a GPIO.

> +     if (IS_ERR(ctx->avdd))
> +             return dev_err_probe(&dsi->dev, PTR_ERR(ctx->avdd),
> +                                     "Couldn't get our avdd GPIO\n");
> +
> +     ret = of_drm_get_panel_orientation(
> +                     dsi->dev.of_node, &ctx->orientation);

Do you know why this doesn't work? (Not sure it relates to your code...)

> +     if (ret) {
> +             dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n",
> +                     dsi->dev.of_node, ret);
> +             return ret;
> +     }
> +
> +     ret = drm_panel_of_backlight(&ctx->panel);
> +     if (ret)
> +             return ret;
> +
> +     drm_panel_add(&ctx->panel);
> +
> +     dsi->mode_flags = ctx->desc->mode_flags;
> +     dsi->format = ctx->desc->format;
> +     dsi->lanes = ctx->desc->lanes;
> +     dev_info(&dsi->dev, "lanes: %d\n", dsi->lanes);
> +
> +     ret = mipi_dsi_attach(dsi);
> +     if (ret)
> +             drm_panel_remove(&ctx->panel);
> +
> +     return ret;
> +}

Regards,
Bjorn

Reply via email to