Update backlight to use macro for initialization and the backlight_get_brightness() operation to simply the update operation. Moved init of backlight device so it comes after drm_panel_init(). This is the order that is required by drm_panel. Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx> Cc: Vinay Simha BN <simhavcs@xxxxxxxxx> Cc: Thierry Reding <thierry.reding@xxxxxxxxx> Cc: Sam Ravnborg <sam@xxxxxxxxxxxx> --- drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c index 4bfd8c877c8e..bacb1b5bc524 100644 --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c @@ -329,7 +329,7 @@ static int dsi_dcs_bl_get_brightness(struct backlight_device *bl) { struct mipi_dsi_device *dsi = bl_get_data(bl); int ret; - u16 brightness = bl->props.brightness; + u16 brightness = backlight_get_brightness(bl); dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; @@ -349,7 +349,7 @@ static int dsi_dcs_bl_update_status(struct backlight_device *bl) dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - ret = mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness); + ret = mipi_dsi_dcs_set_display_brightness(dsi, backlight_get_brightness(bl)); if (ret < 0) return ret; @@ -367,12 +367,7 @@ static struct backlight_device * drm_panel_create_dsi_backlight(struct mipi_dsi_device *dsi) { struct device *dev = &dsi->dev; - struct backlight_properties props; - - memset(&props, 0, sizeof(props)); - props.type = BACKLIGHT_RAW; - props.brightness = 255; - props.max_brightness = 255; + DECLARE_BACKLIGHT_INIT_RAW(props, 255, 255); return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, &dsi_bl_ops, &props); @@ -431,6 +426,9 @@ static int jdi_panel_add(struct jdi_panel *jdi) return ret; } + drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs, + DRM_MODE_CONNECTOR_DSI); + jdi->backlight = drm_panel_create_dsi_backlight(jdi->dsi); if (IS_ERR(jdi->backlight)) { ret = PTR_ERR(jdi->backlight); @@ -438,9 +436,6 @@ static int jdi_panel_add(struct jdi_panel *jdi) return ret; } - drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs, - DRM_MODE_CONNECTOR_DSI); - ret = drm_panel_add(&jdi->base); return ret; -- 2.25.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel