diff options
-rw-r--r-- | display/panel-samsung-ea8182-f10.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/display/panel-samsung-ea8182-f10.c b/display/panel-samsung-ea8182-f10.c index 5489d34..e0baba7 100644 --- a/display/panel-samsung-ea8182-f10.c +++ b/display/panel-samsung-ea8182-f10.c @@ -40,6 +40,11 @@ struct ea8182_f10_panel { u8 vreg_default[VREG_CMD_SIZE]; u8 vreg_offset[VREG_CMD_SIZE]; } panel_voltage; + /** + * @is_pixel_off: pixel-off command is sent to panel. Only sending normal-on or resetting + * panel can recover to normal mode after entering pixel-off state. + */ + bool is_pixel_off; }; #define to_spanel(ctx) container_of(ctx, struct ea8182_f10_panel, base) @@ -71,6 +76,8 @@ static const u8 unlock_cmd_f0[] = { 0xF0, 0x5A, 0x5A }; static const u8 lock_cmd_f0[] = { 0xF0, 0xA5, 0xA5 }; static const u8 vlin1_7v9[] = { 0xE7, 0x01 }; static const u8 vgh_7v4[] = { 0xE3, 0x12, 0x12, 0x12 }; +static const u8 pixel_off[] = { 0x22 }; +static const u8 normal_on[] = { 0x13 }; static const struct exynos_dsi_cmd ea8182_f10_off_cmds[] = { EXYNOS_DSI_CMD(display_off, 20), @@ -481,6 +488,44 @@ static int ea8182_f10_set_power(struct exynos_panel *ctx, bool enable) return 0; } +static int ea8182_f10_set_brightness(struct exynos_panel *ctx, u16 br) +{ + u16 brightness; + struct ea8182_f10_panel *spanel = to_spanel(ctx); + + if (ctx->current_mode->exynos_mode.is_lp_mode) { + const struct exynos_panel_funcs *funcs; + + /* don't stay at pixel-off state in AOD, or black screen is possibly seen */ + if (spanel->is_pixel_off) { + EXYNOS_DCS_WRITE_TABLE(ctx, normal_on); + spanel->is_pixel_off = false; + } + funcs = ctx->desc->exynos_panel_func; + if (funcs && funcs->set_binned_lp) + funcs->set_binned_lp(ctx, br); + return 0; + } + + /* Use pixel off command instead of setting DBV 0 */ + if (!br) { + if (!spanel->is_pixel_off) { + EXYNOS_DCS_WRITE_TABLE(ctx, pixel_off); + spanel->is_pixel_off = true; + dev_dbg(ctx->dev, "%s: pixel off instead of dbv 0\n", __func__); + } + return 0; + } else if (br && spanel->is_pixel_off) { + EXYNOS_DCS_WRITE_TABLE(ctx, normal_on); + spanel->is_pixel_off = false; + } + + brightness = (br & 0xff) << 8 | br >> 8; + + return exynos_dcs_set_brightness(ctx, brightness); +} + + static void ea8182_f10_get_vreg_offset_voltage(struct exynos_panel *ctx) { struct ea8182_f10_panel *spanel = to_spanel(ctx); @@ -575,6 +620,8 @@ static int ea8182_f10_panel_probe(struct mipi_dsi_device *dsi) if (!spanel) return -ENOMEM; + spanel->is_pixel_off = false; + return exynos_panel_common_init(dsi, &spanel->base); } @@ -694,7 +741,7 @@ static const struct drm_panel_funcs ea8182_f10_drm_funcs = { }; static const struct exynos_panel_funcs ea8182_f10_exynos_funcs = { - .set_brightness = exynos_panel_set_brightness, + .set_brightness = ea8182_f10_set_brightness, .set_lp_mode = exynos_panel_set_lp_mode, .set_nolp_mode = ea8182_f10_set_nolp_mode, .set_binned_lp = exynos_panel_set_binned_lp, |