drm/panel: visionox-rm69299: Add backlight support and small fixes
Subsystems (3)
cover drm/panel: visionox-rm69299: Add backlight support and small fixes
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.
---
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,
Signature · 1 line
Guido Günther <[email protected]>
PATCH 1/3 drm/panel: visionox-rm69299: Fix clock frequency for SHIFT6mq
Make the clock frequency match what the sdm845 downstream kernel uses. Otherwise the panel stays black.
--- drivers/gpu/drm/panel/panel-visionox-rm69299.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-visionox-rm69299.c +1 -1
@@ -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 ,
Signature · 1 line
2.51.0
PATCH 2/3 drm/panel: visionox-rm69299: Don't clear all mode flags
In reply to Guido GüntherDon't clear all mode flags. We only want to maek sure we use HS mode during unprepare.
--- drivers/gpu/drm/panel/panel-visionox-rm69299.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-visionox-rm69299.c +1 -1
@@ -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);
Signature · 1 line
2.51.0
Re: [PATCH 2/3] drm/panel: visionox-rm69299: Don't clear all mode flags
Quoted 14 lines · Guido Günther
Don't clear all mode flags. We only want to maek sure we use HS mode during unprepare.
Signed-off-by Guido Günther <[email protected]>--- drivers/gpu/drm/panel/panel-visionox-rm69299.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/panel/panel-visionox-rm69299.c +0
-0
drivers/gpu/drm/panel/panel-visionox-rm69299.c static int visionox_rm69299_unprepare(struct drm_panel *panel) · line 198
Quoted 8 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c +1
-1@@ -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);
PATCH 3/3 drm/panel: visionox-rm69299: Add backlight support
In reply to Guido GüntherThe shift6mq's variant supports controlling the backlight via DSI commands. Use that if a max_brightness is set in the device specific data.
--- drivers/gpu/drm/panel/panel-visionox-rm69299.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
drivers/gpu/drm/panel/panel-visionox-rm69299.c +67 -0
@@ -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[] = {
Signature · 1 line
2.51.0
Re: [PATCH 3/3] drm/panel: visionox-rm69299: Add backlight support
Quoted 108 lines · Guido Günther
The shift6mq's variant supports controlling the backlight via DSI commands. Use that if a
max_brightnessis set in the device specific data.Signed-off-by Guido Günther <[email protected]>--- drivers/gpu/drm/panel/panel-visionox-rm69299.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)drivers/gpu/drm/panel/panel-visionox-rm69299.c +65
-0@@ -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 ;
drivers/gpu/drm/panel/panel-visionox-rm69299.c const struct visionox_rm69299_panel_desc visionox_rm69299_shift_desc = { · line 425
Quoted 8 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c +2
-0@@ -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[] = {
kernel test robot
build botRe: [PATCH 3/3] drm/panel: visionox-rm69299: Add backlight support
In reply to Guido Güntherkernel test robot noticed the following build warnings:
Hi Guido,
kernel test robot noticed the following build warnings:
[auto build test WARNING on b320789d6883cc00ac78ce83bccbfe7ed58afcf0]
url: https://github.com/intel-lab-lkp/linux/commits/Guido-G-nther/drm-panel-visionox-rm69299-Fix-clock-frequency-for-SHIFT6mq/20250901-222400 base: b320789d6883cc00ac78ce83bccbfe7ed58afcf0 patch link: https://lore.kernel.org/r/20250901-shift6mq-panel-v1-3-444b4abbfaea%40sigxcpu.org patch subject: [PATCH 3/3] drm/panel: visionox-rm69299: Add backlight support config: x86_64-randconfig-123-20250902 (https://download.01.org/0day-ci/archive/20250902/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250902/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/panel/panel-visionox-rm69299.c:341:24: sparse: sparse: Using plain integer as NULL pointer
drivers/gpu/drm/panel/panel-visionox-rm69299.c:411:42: sparse: sparse: symbol 'visionox_rm69299_1080p_display_desc' was not declared. Should it be static? drivers/gpu/drm/panel/panel-visionox-rm69299.c:417:42: sparse: sparse: symbol 'visionox_rm69299_shift_desc' was not declared. Should it be static?
vim +341 drivers/gpu/drm/panel/panel-visionox-rm69299.c
329
330 static struct backlight_device *
331 visionox_rm69299_create_backlight(struct visionox_rm69299 *ctx)
332 {
333 struct device *dev = &ctx->dsi->dev;
334 const struct backlight_properties props = {
335 .type = BACKLIGHT_RAW,
336 .brightness = ctx->desc->initial_brightness,
337 .max_brightness = ctx->desc->max_brightness,
338 };
339
340 if (!ctx->desc->max_brightness)
> 341 return 0;
342
343 return devm_backlight_device_register(dev, dev_name(dev), dev, ctx->dsi,
344 &visionox_rm69299_bl_ops,
345 &props);
346 }
347
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki