* [PATCH v2 0/3] drm/panel: visionox-rm69299: Add backlight support and small fixes
@ 2025-09-06 15:17 Guido Günther
2025-09-06 15:17 ` [PATCH v2 1/3] drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq Guido Günther
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Guido Günther @ 2025-09-06 15:17 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, linux-kernel, phone-devel, Guido Günther
This adds optional backlight support via DSI commands. If
a max_brightness is set in the panel description the backlight
is created.
While at that we fold in the already sent out clock fix and
a fix that prevents us from clearing all mode flags when we
only want HS mode.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
Changes in v2:
- Add Fixes: to the first two commits to make backports simpler
- Collect Reviewed-by:, thanks Neil!
- Link to v1: https://lore.kernel.org/r/20250901-shift6mq-panel-v1-0-444b4abbfaea@sigxcpu.org
---
Guido Günther (3):
drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq
drm/panel: visionox-rm69299: Don't clear all mode flags
drm/panel: visionox-rm69299: Add backlight support
drivers/gpu/drm/panel/panel-visionox-rm69299.c | 71 +++++++++++++++++++++++++-
1 file changed, 69 insertions(+), 2 deletions(-)
---
base-commit: b320789d6883cc00ac78ce83bccbfe7ed58afcf0
change-id: 20250901-shift6mq-panel-959b3087ecd2
Best regards,
--
Guido Günther <agx@sigxcpu.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq
2025-09-06 15:17 [PATCH v2 0/3] drm/panel: visionox-rm69299: Add backlight support and small fixes Guido Günther
@ 2025-09-06 15:17 ` Guido Günther
2025-09-06 19:08 ` Dmitry Baryshkov
2025-09-06 15:17 ` [PATCH v2 2/3] drm/panel: visionox-rm69299: Don't clear all mode flags Guido Günther
2025-09-06 15:17 ` [PATCH v2 3/3] drm/panel: visionox-rm69299: Add backlight support Guido Günther
2 siblings, 1 reply; 6+ messages in thread
From: Guido Günther @ 2025-09-06 15:17 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, linux-kernel, phone-devel, Guido Günther
Make the clock frequency match what the sdm845 downstream kernel
uses. Otherwise the panel stays black.
Fixes: 783334f366b18 ("drm/panel: visionox-rm69299: support the variant found in the SHIFT6mq")
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
---
drivers/gpu/drm/panel/panel-visionox-rm69299.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
index 909c280eab1fb408a713d84051a1afbb252c45e8..e65697ce6f51c7d64b786da18cf44b16de5d6919 100644
--- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c
+++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
@@ -247,7 +247,7 @@ static const struct drm_display_mode visionox_rm69299_1080x2248_60hz = {
};
static const struct drm_display_mode visionox_rm69299_1080x2160_60hz = {
- .clock = 158695,
+ .clock = 149360,
.hdisplay = 1080,
.hsync_start = 1080 + 26,
.hsync_end = 1080 + 26 + 2,
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] drm/panel: visionox-rm69299: Don't clear all mode flags
2025-09-06 15:17 [PATCH v2 0/3] drm/panel: visionox-rm69299: Add backlight support and small fixes Guido Günther
2025-09-06 15:17 ` [PATCH v2 1/3] drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq Guido Günther
@ 2025-09-06 15:17 ` Guido Günther
2025-09-06 15:17 ` [PATCH v2 3/3] drm/panel: visionox-rm69299: Add backlight support Guido Günther
2 siblings, 0 replies; 6+ messages in thread
From: Guido Günther @ 2025-09-06 15:17 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, linux-kernel, phone-devel, Guido Günther
Don't clear all mode flags. We only want to maek sure we use HS mode
during unprepare.
Fixes: c7f66d32dd431 ("drm/panel: add support for rm69299 visionox panel")
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
drivers/gpu/drm/panel/panel-visionox-rm69299.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
index e65697ce6f51c7d64b786da18cf44b16de5d6919..2216d38366ea37368d15480f9d8a8ccbfe77ba3b 100644
--- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c
+++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
@@ -192,7 +192,7 @@ static int visionox_rm69299_unprepare(struct drm_panel *panel)
struct visionox_rm69299 *ctx = panel_to_ctx(panel);
struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
- ctx->dsi->mode_flags = 0;
+ ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] drm/panel: visionox-rm69299: Add backlight support
2025-09-06 15:17 [PATCH v2 0/3] drm/panel: visionox-rm69299: Add backlight support and small fixes Guido Günther
2025-09-06 15:17 ` [PATCH v2 1/3] drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq Guido Günther
2025-09-06 15:17 ` [PATCH v2 2/3] drm/panel: visionox-rm69299: Don't clear all mode flags Guido Günther
@ 2025-09-06 15:17 ` Guido Günther
2 siblings, 0 replies; 6+ messages in thread
From: Guido Günther @ 2025-09-06 15:17 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, linux-kernel, phone-devel, Guido Günther
The shift6mq's variant supports controlling the backlight via DSI
commands. Use that if a max_brightness is set in the device specific
data.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
drivers/gpu/drm/panel/panel-visionox-rm69299.c | 67 ++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
index 2216d38366ea37368d15480f9d8a8ccbfe77ba3b..5e5ff6056c80e67a5bf8fe4911cdbc588db5d03b 100644
--- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c
+++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
@@ -3,6 +3,7 @@
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*/
+#include <linux/backlight.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/property.h>
@@ -20,6 +21,8 @@ struct visionox_rm69299_panel_desc {
const struct drm_display_mode *mode;
const u8 *init_seq;
unsigned int init_seq_len;
+ int max_brightness;
+ int initial_brightness;
};
struct visionox_rm69299 {
@@ -285,6 +288,63 @@ static const struct drm_panel_funcs visionox_rm69299_drm_funcs = {
.get_modes = visionox_rm69299_get_modes,
};
+static int visionox_rm69299_bl_get_brightness(struct backlight_device *bl)
+{
+ struct mipi_dsi_device *dsi = bl_get_data(bl);
+ u16 brightness;
+ int ret;
+
+ dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
+
+ ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness);
+ if (ret < 0)
+ return ret;
+
+ dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+
+ return brightness;
+}
+
+static int visionox_rm69299_bl_update_status(struct backlight_device *bl)
+{
+ struct mipi_dsi_device *dsi = bl_get_data(bl);
+ u16 brightness = backlight_get_brightness(bl);
+ int ret;
+
+ dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
+
+ ret = mipi_dsi_dcs_set_display_brightness(dsi, brightness);
+ if (ret < 0)
+ return ret;
+
+ dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+
+ return 0;
+}
+
+static const struct backlight_ops visionox_rm69299_bl_ops = {
+ .update_status = visionox_rm69299_bl_update_status,
+ .get_brightness = visionox_rm69299_bl_get_brightness,
+};
+
+static struct backlight_device *
+visionox_rm69299_create_backlight(struct visionox_rm69299 *ctx)
+{
+ struct device *dev = &ctx->dsi->dev;
+ const struct backlight_properties props = {
+ .type = BACKLIGHT_RAW,
+ .brightness = ctx->desc->initial_brightness,
+ .max_brightness = ctx->desc->max_brightness,
+ };
+
+ if (!ctx->desc->max_brightness)
+ return 0;
+
+ return devm_backlight_device_register(dev, dev_name(dev), dev, ctx->dsi,
+ &visionox_rm69299_bl_ops,
+ &props);
+}
+
static int visionox_rm69299_probe(struct mipi_dsi_device *dsi)
{
struct device *dev = &dsi->dev;
@@ -316,6 +376,11 @@ static int visionox_rm69299_probe(struct mipi_dsi_device *dsi)
return PTR_ERR(ctx->reset_gpio);
}
+ ctx->panel.backlight = visionox_rm69299_create_backlight(ctx);
+ if (IS_ERR(ctx->panel.backlight))
+ return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight),
+ "Failed to create backlight\n");
+
drm_panel_add(&ctx->panel);
dsi->lanes = 4;
@@ -353,6 +418,8 @@ const struct visionox_rm69299_panel_desc visionox_rm69299_shift_desc = {
.mode = &visionox_rm69299_1080x2160_60hz,
.init_seq = (const u8 *)visionox_rm69299_1080x2160_60hz_init_seq,
.init_seq_len = ARRAY_SIZE(visionox_rm69299_1080x2160_60hz_init_seq),
+ .max_brightness = 255,
+ .initial_brightness = 50,
};
static const struct of_device_id visionox_rm69299_of_match[] = {
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq
2025-09-06 15:17 ` [PATCH v2 1/3] drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq Guido Günther
@ 2025-09-06 19:08 ` Dmitry Baryshkov
2025-09-07 11:23 ` Guido Günther
0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Baryshkov @ 2025-09-06 19:08 UTC (permalink / raw)
To: Guido Günther
Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel, phone-devel
On Sat, Sep 06, 2025 at 05:17:25PM +0200, Guido Günther wrote:
> Make the clock frequency match what the sdm845 downstream kernel
> uses. Otherwise the panel stays black.
>
> Fixes: 783334f366b18 ("drm/panel: visionox-rm69299: support the variant found in the SHIFT6mq")
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
> drivers/gpu/drm/panel/panel-visionox-rm69299.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
> index 909c280eab1fb408a713d84051a1afbb252c45e8..e65697ce6f51c7d64b786da18cf44b16de5d6919 100644
> --- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c
> +++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
> @@ -247,7 +247,7 @@ static const struct drm_display_mode visionox_rm69299_1080x2248_60hz = {
> };
>
> static const struct drm_display_mode visionox_rm69299_1080x2160_60hz = {
> - .clock = 158695,
> + .clock = 149360,
clock = (2160 + 8 + 4 + 4) * (1080 + 26 + 2 + 36) * 60 / 1000 ?
> .hdisplay = 1080,
> .hsync_start = 1080 + 26,
> .hsync_end = 1080 + 26 + 2,
>
> --
> 2.51.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq
2025-09-06 19:08 ` Dmitry Baryshkov
@ 2025-09-07 11:23 ` Guido Günther
0 siblings, 0 replies; 6+ messages in thread
From: Guido Günther @ 2025-09-07 11:23 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel, phone-devel
Hi Dmitry,
On Sat, Sep 06, 2025 at 10:08:35PM +0300, Dmitry Baryshkov wrote:
> On Sat, Sep 06, 2025 at 05:17:25PM +0200, Guido Günther wrote:
> > Make the clock frequency match what the sdm845 downstream kernel
> > uses. Otherwise the panel stays black.
> >
> > Fixes: 783334f366b18 ("drm/panel: visionox-rm69299: support the variant found in the SHIFT6mq")
> > Signed-off-by: Guido Günther <agx@sigxcpu.org>
> > Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
> > ---
> > drivers/gpu/drm/panel/panel-visionox-rm69299.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
> > index 909c280eab1fb408a713d84051a1afbb252c45e8..e65697ce6f51c7d64b786da18cf44b16de5d6919 100644
> > --- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c
> > +++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
> > @@ -247,7 +247,7 @@ static const struct drm_display_mode visionox_rm69299_1080x2248_60hz = {
> > };
> >
> > static const struct drm_display_mode visionox_rm69299_1080x2160_60hz = {
> > - .clock = 158695,
> > + .clock = 149360,
>
> clock = (2160 + 8 + 4 + 4) * (1080 + 26 + 2 + 36) * 60 / 1000 ?
IIRC I was asked to use the resulting clock rather then the clock
formula in another driver a while back but I like that variant better
too, will change in v3.
Thanks,
-- Guido
>
> > .hdisplay = 1080,
> > .hsync_start = 1080 + 26,
> > .hsync_end = 1080 + 26 + 2,
> >
> > --
> > 2.51.0
> >
>
> --
> With best wishes
> Dmitry
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-07 11:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-06 15:17 [PATCH v2 0/3] drm/panel: visionox-rm69299: Add backlight support and small fixes Guido Günther
2025-09-06 15:17 ` [PATCH v2 1/3] drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq Guido Günther
2025-09-06 19:08 ` Dmitry Baryshkov
2025-09-07 11:23 ` Guido Günther
2025-09-06 15:17 ` [PATCH v2 2/3] drm/panel: visionox-rm69299: Don't clear all mode flags Guido Günther
2025-09-06 15:17 ` [PATCH v2 3/3] drm/panel: visionox-rm69299: Add backlight support Guido Günther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®