From: hwangjae lee Date: Fri, 2 Nov 2018 08:23:10 +0000 (+0900) Subject: [Robusta2] fbdev: dpu: command is written in LPDT mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d0aa697814dad63221f821398abb4a9cc07704a2;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [Robusta2] fbdev: dpu: command is written in LPDT mode Change-Id: I045783d47f7fa15ab3228c9b1d1af1d6b0ce7cc9 Signed-off-by: hwangjae lee --- diff --git a/arch/arm64/boot/dts/exynos/exynos9610-display-lcd.dtsi b/arch/arm64/boot/dts/exynos/exynos9610-display-lcd.dtsi index 87d8a81ac890..8a8452a72138 100755 --- a/arch/arm64/boot/dts/exynos/exynos9610-display-lcd.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos9610-display-lcd.dtsi @@ -266,7 +266,7 @@ timing,dsi-hs-clk = <1300>; /* TODO : pms value to be set */ timing,pmsk = <1 100 1 0>; - timing,dsi-escape-clk = <20>; + timing,dsi-escape-clk = <10>; mic_en = <0>; /* 0: Disable, 1: Enable */ mic_ratio = <0>; /* 0: 1/2 mic, 1: 1/3 mic */ mic_ver = <0>; /* 0: mic v1.1, 1: v1.2, 2: v2.0 */ diff --git a/drivers/video/fbdev/exynos/dpu20/Kconfig b/drivers/video/fbdev/exynos/dpu20/Kconfig index 49a5f8deac52..712dc9a00533 100644 --- a/drivers/video/fbdev/exynos/dpu20/Kconfig +++ b/drivers/video/fbdev/exynos/dpu20/Kconfig @@ -124,6 +124,12 @@ config EXYNOS_DECON_DQE depends on EXYNOS_DPU20 default n +config EXYNOS_PANEL_INIT_LPDT + bool "Support PANEL INIT LPDT command" + depends on EXYNOS_DPU20 + default n + help + If this menu is enabled, COMMAND will write in LPDT mode. endif source "drivers/video/fbdev/exynos/dpu20/panels/Kconfig" diff --git a/drivers/video/fbdev/exynos/dpu20/cal_9610/dsim_cal.h b/drivers/video/fbdev/exynos/dpu20/cal_9610/dsim_cal.h index abd244f235e7..d14a42a3afaf 100644 --- a/drivers/video/fbdev/exynos/dpu20/cal_9610/dsim_cal.h +++ b/drivers/video/fbdev/exynos/dpu20/cal_9610/dsim_cal.h @@ -73,6 +73,9 @@ void dsim_reg_set_bist(u32 id, u32 en); void dsim_reg_set_cmd_transfer_mode(u32 id, u32 lp); +void dsim_reg_set_int(u32 id, u32 en); + +int dsim_reg_set_hs_clock(u32 id, u32 en); /* DSIM SFR dump */ void __dsim_dump(u32 id, struct dsim_regs *regs); diff --git a/drivers/video/fbdev/exynos/dpu20/cal_9610/dsim_reg.c b/drivers/video/fbdev/exynos/dpu20/cal_9610/dsim_reg.c index 9d0bee02dfb3..b4c68ac8fbc0 100644 --- a/drivers/video/fbdev/exynos/dpu20/cal_9610/dsim_reg.c +++ b/drivers/video/fbdev/exynos/dpu20/cal_9610/dsim_reg.c @@ -1552,7 +1552,7 @@ static u32 dsim_reg_is_noncont_clk_enabled(u32 id) return ret; } -static int dsim_reg_set_hs_clock(u32 id, u32 en) +int dsim_reg_set_hs_clock(u32 id, u32 en) { int reg = 0; int is_noncont = dsim_reg_is_noncont_clk_enabled(id); @@ -1568,7 +1568,7 @@ static int dsim_reg_set_hs_clock(u32 id, u32 en) return reg; } -static void dsim_reg_set_int(u32 id, u32 en) +void dsim_reg_set_int(u32 id, u32 en) { u32 val = en ? 0 : ~0; u32 mask; @@ -1762,6 +1762,10 @@ void dsim_reg_init(u32 id, struct decon_lcd *lcd_info, struct dsim_clks *clks, dsim_reg_set_config(id, lcd_info, clks); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 1); +#endif + if (panel_ctrl) dsim_reset_panel(dsim); } @@ -1770,7 +1774,6 @@ void dsim_reg_init(u32 id, struct decon_lcd *lcd_info, struct dsim_clks *clks, void dsim_reg_start(u32 id) { dsim_reg_set_hs_clock(id, 1); - dsim_reg_set_int(id, 1); } /* Unset clocks and lanes and stop_state */ @@ -1813,7 +1816,10 @@ int dsim_reg_exit_ulps_and_start(u32 id, u32 ddi_type, u32 lanes) /* try to exit ULPS mode. The sequence is depends on DDI type */ ret = dsim_reg_set_ulps_by_ddi(id, ddi_type, lanes, 0); +#if !defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) dsim_reg_start(id); +#endif + dsim_reg_set_int(id, 1); return ret; } diff --git a/drivers/video/fbdev/exynos/dpu20/decon_core.c b/drivers/video/fbdev/exynos/dpu20/decon_core.c index da62add4d278..2463fc33d9d2 100755 --- a/drivers/video/fbdev/exynos/dpu20/decon_core.c +++ b/drivers/video/fbdev/exynos/dpu20/decon_core.c @@ -4006,7 +4006,21 @@ static int decon_initial_display(struct decon_device *decon, bool is_colormap) dsim = container_of(decon->out_sd[0], struct dsim_device, sd); decon_reg_start(decon->id, &psr); decon_reg_set_int(decon->id, &psr, 1); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + if (decon->dt.out_type == DECON_OUT_DSI) + v4l2_subdev_call(decon->out_sd[0], core, ioctl, + DSIM_IOC_LPDT_CMD, (unsigned long *)1); +#endif call_panel_ops(dsim, displayon, dsim); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + if (decon->dt.out_type == DECON_OUT_DSI) { + v4l2_subdev_call(decon->out_sd[0], core, ioctl, + DSIM_IOC_HS_CLK_ENABLE, NULL); + v4l2_subdev_call(decon->out_sd[0], core, ioctl, + DSIM_IOC_LPDT_CMD, (unsigned long *)0); + + } +#endif decon_wait_for_vsync(decon, VSYNC_TIMEOUT_MSEC); if (decon_reg_wait_update_done_and_mask(decon->id, &psr, SHADOW_UPDATE_TIMEOUT) < 0) diff --git a/drivers/video/fbdev/exynos/dpu20/dsim.h b/drivers/video/fbdev/exynos/dpu20/dsim.h index 349d6d1d036e..f1208ea5f199 100755 --- a/drivers/video/fbdev/exynos/dpu20/dsim.h +++ b/drivers/video/fbdev/exynos/dpu20/dsim.h @@ -409,6 +409,8 @@ static inline bool IS_DSIM_OFF_STATE(struct dsim_device *dsim) #define DSIM_IOC_FREE_FB_RES _IOW('D', 11, u32) #define DSIM_IOC_DOZE _IOW('D', 20, u32) #define DSIM_IOC_DOZE_SUSPEND _IOW('D', 21, u32) +#define DSIM_IOC_HS_CLK_ENABLE _IOW('D', 30, int) +#define DSIM_IOC_LPDT_CMD _IOW('D', 31, int) #if defined(CONFIG_EXYNOS_READ_ESD_SOLUTION) #define DSIM_ESD_OK 0 diff --git a/drivers/video/fbdev/exynos/dpu20/dsim_drv.c b/drivers/video/fbdev/exynos/dpu20/dsim_drv.c index fa64f574a697..3d70566bb7b2 100755 --- a/drivers/video/fbdev/exynos/dpu20/dsim_drv.c +++ b/drivers/video/fbdev/exynos/dpu20/dsim_drv.c @@ -814,7 +814,10 @@ static int _dsim_enable(struct dsim_device *dsim, enum dsim_state state) panel_ctrl = (state == DSIM_STATE_ON) ? true : false; dsim_reg_init(dsim->id, &dsim->lcd_info, &dsim->clks, panel_ctrl); +#if !defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) dsim_reg_start(dsim->id); +#endif + dsim_reg_set_int(dsim->id, 1); dsim->state = state; enable_irq(dsim->res.irq); @@ -842,8 +845,16 @@ static int dsim_enable(struct dsim_device *dsim) goto out; } - if (prev_state != DSIM_STATE_INIT) + if (prev_state != DSIM_STATE_INIT) { +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 1); +#endif call_panel_ops(dsim, displayon, dsim); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_start(dsim->id); + dsim_reg_set_cmd_transfer_mode(dsim->id, 0); +#endif + } dsim_info("dsim-%d %s - (state:%s -> %s)\n", dsim->id, __func__, dsim_state_names[prev_state], @@ -872,8 +883,15 @@ static int dsim_doze(struct dsim_device *dsim) dsim->id, dsim_state_names[next_state], ret); goto out; } - if (prev_state != DSIM_STATE_INIT) + if (prev_state != DSIM_STATE_INIT) { +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 1); +#endif call_panel_ops(dsim, doze, dsim); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 0); +#endif + } dsim_info("dsim-%d %s - (state:%s -> %s)\n", dsim->id, __func__, dsim_state_names[prev_state], dsim_state_names[dsim->state]); @@ -939,8 +957,15 @@ static int dsim_disable(struct dsim_device *dsim) return 0; } +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_hs_clock(dsim->id, 0); + dsim_reg_set_cmd_transfer_mode(dsim->id, 1); +#endif dsim_info("dsim-%d %s +\n", dsim->id, __func__); call_panel_ops(dsim, suspend, dsim); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 0); +#endif ret = _dsim_disable(dsim, next_state); if (ret < 0) { dsim_err("dsim-%d failed to set %s (ret %d)\n", @@ -967,8 +992,14 @@ static int dsim_doze_suspend(struct dsim_device *dsim) return 0; } +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 1); +#endif dsim_info("dsim-%d %s +\n", dsim->id, __func__); call_panel_ops(dsim, doze_suspend, dsim); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 0); +#endif ret = _dsim_disable(dsim, next_state); if (ret < 0) { dsim_err("dsim-%d failed to set %s (ret %d)\n", @@ -1155,6 +1186,18 @@ static long dsim_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) ret = dsim_doze_suspend(dsim); break; + case DSIM_IOC_HS_CLK_ENABLE: + ret = dsim_reg_set_hs_clock(dsim->id, 1); + break; + + case DSIM_IOC_LPDT_CMD: + if ((unsigned long)arg) + dsim_reg_set_cmd_transfer_mode(dsim->id, 1); + else + dsim_reg_set_cmd_transfer_mode(dsim->id, 0); + + break; + default: dsim_err("unsupported ioctl"); ret = -EINVAL; @@ -1312,7 +1355,13 @@ static ssize_t dsim_cmd_sysfs_store(struct device *dev, switch (cmd) { case 1: ret = dsim_cmd_sysfs_read(dsim); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 1); +#endif call_panel_ops(dsim, dump, dsim); +#if defined(CONFIG_EXYNOS_PANEL_INIT_LPDT) + dsim_reg_set_cmd_transfer_mode(dsim->id, 0); +#endif if (ret) return ret; break;