From: ChiHun Won Date: Wed, 4 Jul 2018 06:10:34 +0000 (+0900) Subject: fbdev: dpu20: sync-up dpu common code X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ef006c267ddbaa8baf27d7b1160a1817ad7dcca0;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git fbdev: dpu20: sync-up dpu common code Change-Id: Ifa434bd0a2d91bbf1d5cea3fbbd092ae4a8368c9 Signed-off-by: ChiHun Won --- diff --git a/drivers/video/fbdev/exynos/dpu20/Kconfig b/drivers/video/fbdev/exynos/dpu20/Kconfig index 1d046d1c48b3..186659139475 100644 --- a/drivers/video/fbdev/exynos/dpu20/Kconfig +++ b/drivers/video/fbdev/exynos/dpu20/Kconfig @@ -51,7 +51,7 @@ config EXYNOS_AFBC_DEBUG config EXYNOS_MULTIRESOLUTION bool "Support Multi Resolution LCD" depends on EXYNOS_DPU20 && EXYNOS_WINDOW_UPDATE - default y + default n config EXYNOS_VIRTUAL_DISPLAY bool "Support Virtual Display Mode" diff --git a/drivers/video/fbdev/exynos/dpu20/Makefile b/drivers/video/fbdev/exynos/dpu20/Makefile index 91bbeec38e64..09551b716a3b 100644 --- a/drivers/video/fbdev/exynos/dpu20/Makefile +++ b/drivers/video/fbdev/exynos/dpu20/Makefile @@ -9,9 +9,12 @@ obj-$(CONFIG_EXYNOS_DPP) += dpp.o dpp-y := dpp_drv.o obj-$(CONFIG_EXYNOS_MIPI_DSIM) += dsim.o dsim-y += dsim_drv.o -obj-$(CONFIG_EXYNOS_DISPLAYPORT) += displayport.o -displayport-y += displayport_drv.o displayport_edid.o displayport_hdcp13.o ./cal_9610/displayport_reg.o obj-$(CONFIG_SOC_EXYNOS9610) += ./cal_9610/dsim_reg.o ./cal_9610/dpp_reg.o ./cal_9610/decon_reg.o +ifdef CONFIG_EXYNOS_DISPLAYPORT +obj-$(CONFIG_EXYNOS_DISPLAYPORT) += displayport.o +displayport-y += displayport_drv.o displayport_edid.o displayport_hdcp13.o decon_displayport.o +obj-$(CONFIG_SOC_EXYNOS9610) += ./cal_9610/displayport_reg.o +endif obj-$(CONFIG_EXYNOS_DPU20) += decon.o obj-$(CONFIG_EXYNOS_BTS) += bts.o decon-y += decon_core.o decon_dsi.o decon_wb.o helper.o win_update.o cursor.o fence.o event_log.o diff --git a/drivers/video/fbdev/exynos/dpu20/decon.h b/drivers/video/fbdev/exynos/dpu20/decon.h index 606ed83a04c0..a208d4b70cce 100644 --- a/drivers/video/fbdev/exynos/dpu20/decon.h +++ b/drivers/video/fbdev/exynos/dpu20/decon.h @@ -49,7 +49,9 @@ #include "./panels/decon_lcd.h" #include "dsim.h" +#if defined(CONFIG_EXYNOS_DISPLAYPORT) #include "displayport.h" +#endif #if defined(CONFIG_SUPPORT_LEGACY_FENCE) #include "../../../../dma-buf/sync_debug.h" #endif @@ -80,8 +82,6 @@ extern struct decon_bts_ops decon_bts_control; #define MIN_BLK_MODE_HEIGHT 16 #define VSYNC_TIMEOUT_MSEC 200 #define DEFAULT_BPP 32 -#define MIN_WIN_BLOCK_WIDTH 8 -#define MIN_WIN_BLOCK_HEIGHT 1 #define FD_TRY_CNT 3 #define VALID_FD_VAL 3 #define DECON_TRACE_BUF_SIZE 40 @@ -582,7 +582,9 @@ struct disp_log_dpp { u32 id; u32 start_cnt; u32 done_cnt; - u32 comp_src; + u32 comp; + u32 rot; + u32 hdr_std; struct decon_frame src; struct decon_frame dst; }; @@ -1038,6 +1040,7 @@ int decon_wb_get_clocks(struct decon_device *decon); void decon_wb_set_clocks(struct decon_device *decon); int decon_wb_get_out_sd(struct decon_device *decon); +#if defined(CONFIG_EXYNOS_DISPLAYPORT) /* DECON to DISPLAYPORT interface functions */ int decon_displayport_register_irq(struct decon_device *decon); void decon_displayport_free_irq(struct decon_device *decon); @@ -1052,6 +1055,7 @@ int decon_displayport_get_config(struct decon_device *dex, struct exynos_displayport_data *displayport_data); int decon_displayport_set_config(struct decon_device *dex, struct exynos_displayport_data *displayport_data); +#endif /* window update related function */ #define DPU_FULL_RECT(r, lcd) \ diff --git a/drivers/video/fbdev/exynos/dpu20/decon_core.c b/drivers/video/fbdev/exynos/dpu20/decon_core.c index d3000910cc38..16f2875bd50f 100644 --- a/drivers/video/fbdev/exynos/dpu20/decon_core.c +++ b/drivers/video/fbdev/exynos/dpu20/decon_core.c @@ -53,7 +53,9 @@ #include "./panels/lcd_ctrl.h" #include "../../../../dma-buf/sync_debug.h" #include "dpp.h" +#if defined(CONFIG_EXYNOS_DISPLAYPORT) #include "displayport.h" +#endif int decon_log_level = 6; module_param(decon_log_level, int, 0644); @@ -1250,7 +1252,9 @@ static int decon_import_buffer(struct decon_device *decon, int idx, #endif struct dma_buf *buf = NULL; struct decon_dma_buf_data *dma_buf_data = NULL; +#if defined(CONFIG_EXYNOS_DISPLAYPORT) struct displayport_device *displayport; +#endif struct dsim_device *dsim; struct device *dev; int i; @@ -1284,8 +1288,10 @@ static int decon_import_buffer(struct decon_device *decon, int idx, return PTR_ERR(buf); } if (decon->dt.out_type == DECON_OUT_DP) { +#if defined(CONFIG_EXYNOS_DISPLAYPORT) displayport = v4l2_get_subdevdata(decon->out_sd[0]); dev = displayport->dev; +#endif } else { /* DSI case */ dsim = v4l2_get_subdevdata(decon->out_sd[0]); dev = dsim->dev; @@ -1716,6 +1722,10 @@ static int __decon_update_regs(struct decon_device *decon, struct decon_reg_data return 0; } +#if defined(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION) + decon_set_protected_content(decon, regs); +#endif + for (i = 0; i < decon->dt.max_win; i++) { if (regs->is_cursor_win[i]) { dpu_cursor_win_update_config(decon, regs); @@ -1742,10 +1752,6 @@ static int __decon_update_regs(struct decon_device *decon, struct decon_reg_data decon_reg_config_wb_size(decon->id, decon->lcd_info, &p); } -#if defined(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION) - decon_set_protected_content(decon, regs); -#endif - decon_reg_all_win_shadow_update_req(decon->id); decon_to_psr_info(decon, &psr); if (decon_reg_start(decon->id, &psr) < 0) { @@ -1852,7 +1858,10 @@ static int decon_set_hdr_info(struct decon_device *decon, struct decon_reg_data *regs, int win_num, bool on) { struct exynos_video_meta *video_meta; - int ret = 0, hdr_cmp = 0; +#if defined(CONFIG_EXYNOS_DISPLAYPORT) + int ret = 0; +#endif + int hdr_cmp = 0; int meta_plane = 0; if (!on) { @@ -1860,12 +1869,13 @@ static int decon_set_hdr_info(struct decon_device *decon, hdr_static_info.mid = -1; decon->prev_hdr_info.mid = -1; +#if defined(CONFIG_EXYNOS_DISPLAYPORT) ret = v4l2_subdev_call(decon->displayport_sd, core, ioctl, DISPLAYPORT_IOC_SET_HDR_METADATA, &hdr_static_info); if (ret) goto err_hdr_io; - +#endif return 0; } @@ -1889,7 +1899,7 @@ static int decon_set_hdr_info(struct decon_device *decon, #endif hdr_cmp = memcmp(&decon->prev_hdr_info, - &video_meta->data.dec.shdr_static_info, + &video_meta->shdr_static_info, sizeof(struct exynos_hdr_static_info)); /* HDR metadata is same, so skip subdev call. @@ -1901,22 +1911,24 @@ static int decon_set_hdr_info(struct decon_device *decon, #endif return 0; } - +#if defined(CONFIG_EXYNOS_DISPLAYPORT) ret = v4l2_subdev_call(decon->displayport_sd, core, ioctl, DISPLAYPORT_IOC_SET_HDR_METADATA, - &video_meta->data.dec.shdr_static_info); + &video_meta->shdr_static_info); if (ret) goto err_hdr_io; - +#endif memcpy(&decon->prev_hdr_info, - &video_meta->data.dec.shdr_static_info, + &video_meta->shdr_static_info, sizeof(struct exynos_hdr_static_info)); #if !defined(CONFIG_SUPPORT_LEGACY_ION) dma_buf_vunmap(regs->dma_buf_data[win_num][meta_plane].dma_buf, video_meta); #endif return 0; +#if defined(CONFIG_EXYNOS_DISPLAYPORT) err_hdr_io: +#endif /* When the subdev call is failed, * current hdr_static_info is not copied to prev. */ @@ -2314,7 +2326,7 @@ static int decon_prepare_win_config(struct decon_device *decon, &win_config[decon->dt.max_win], regs); } - for (i = 0; i < decon->dt.dpp_cnt; i++) { + for (i = 0; i < (decon->dt.dpp_cnt + 1); i++) { memcpy(®s->dpp_config[i], &win_config[i], sizeof(struct decon_win_config)); regs->dpp_config[i].format = @@ -2961,6 +2973,8 @@ static int decon_register_subdevs(struct decon_device *decon) else if (decon->dt.out_type == DECON_OUT_DP) ret = decon_displayport_get_out_sd(decon); #endif + else + ret = -ENODEV; return ret; } @@ -3529,7 +3543,7 @@ static int decon_itmon_notifier(struct notifier_block *nb, static int decon_initial_display(struct decon_device *decon, bool is_colormap) { struct decon_param p; - struct fb_info *fbinfo = decon->win[decon->dt.dft_win]->fbinfo; + struct fb_info *fbinfo; struct decon_window_regs win_regs; struct decon_win_config config; struct v4l2_subdev *sd = NULL; @@ -3545,6 +3559,8 @@ static int decon_initial_display(struct decon_device *decon, bool is_colormap) return 0; } + fbinfo = decon->win[decon->dt.dft_win]->fbinfo; + pm_stay_awake(decon->dev); dev_warn(decon->dev, "pm_stay_awake"); diff --git a/drivers/video/fbdev/exynos/dpu20/decon_dsi.c b/drivers/video/fbdev/exynos/dpu20/decon_dsi.c index f141ddc7ac18..ad572985449e 100644 --- a/drivers/video/fbdev/exynos/dpu20/decon_dsi.c +++ b/drivers/video/fbdev/exynos/dpu20/decon_dsi.c @@ -400,6 +400,12 @@ static ssize_t decon_show_psr_info(struct device *dev, char *p = buf; struct lcd_mres_info *mres_info = &lcd_info->dt_lcd_mres; int len; + struct v4l2_subdev *sd; + struct dpp_restriction res; + int sz_align = 1; + + sd = decon->dpp_sd[0]; + v4l2_subdev_call(sd, core, ioctl, DPP_GET_RESTRICTION, &res); len = sprintf(p, "%d\n", decon->dt.psr_mode); len += sprintf(p + len, "%d\n", mres_info->mres_number); @@ -415,8 +421,8 @@ static ssize_t decon_show_psr_info(struct device *dev, len += sprintf(p + len, "%d\n%d\n%d\n%d\n%d\n", mres_info->res_info[i].width, mres_info->res_info[i].height, - MIN_WIN_BLOCK_WIDTH, - MIN_WIN_BLOCK_HEIGHT, + (res.src_f_w.min * sz_align), + (res.src_f_h.min * sz_align), mres_info->res_info[i].dsc_en); } return len; diff --git a/drivers/video/fbdev/exynos/dpu20/dpp_drv.c b/drivers/video/fbdev/exynos/dpu20/dpp_drv.c index 3400c34c6147..70a792d4200f 100644 --- a/drivers/video/fbdev/exynos/dpu20/dpp_drv.c +++ b/drivers/video/fbdev/exynos/dpu20/dpp_drv.c @@ -94,6 +94,8 @@ static void dpp_get_params(struct dpp_device *dpp, struct dpp_params_info *p) p->addr[3] = 0; p->eq_mode = config->dpp_parm.eq_mode; p->hdr = config->dpp_parm.hdr_std; + p->max_luminance = config->dpp_parm.max_luminance; + p->min_luminance = config->dpp_parm.min_luminance; p->is_4p = false; p->y_2b_strd = 0; p->c_2b_strd = 0; diff --git a/drivers/video/fbdev/exynos/dpu20/dsim.h b/drivers/video/fbdev/exynos/dpu20/dsim.h index 6e1c0e63d0ac..e456974b9270 100644 --- a/drivers/video/fbdev/exynos/dpu20/dsim.h +++ b/drivers/video/fbdev/exynos/dpu20/dsim.h @@ -196,7 +196,7 @@ struct dsim_resources { struct clk *rgb_vclk0; struct clk *pclk_disp; struct clk *aclk; - int lcd_power[2]; + int lcd_power[3]; int lcd_reset; int irq; void __iomem *regs; diff --git a/drivers/video/fbdev/exynos/dpu20/dsim_drv.c b/drivers/video/fbdev/exynos/dpu20/dsim_drv.c index ef5f28c950e3..0f2b46f0abab 100644 --- a/drivers/video/fbdev/exynos/dpu20/dsim_drv.c +++ b/drivers/video/fbdev/exynos/dpu20/dsim_drv.c @@ -326,6 +326,7 @@ int dsim_read_data(struct dsim_device *dsim, u32 id, u32 addr, u32 cnt, u8 *buf) dsim_dbg("Short Packet was received from LCD module.\n"); for (i = 0; i <= cnt; i++) buf[i] = (rx_fifo >> (8 + i * 8)) & 0xff; + rx_size = cnt; break; case MIPI_DSI_RX_DCS_LONG_READ_RESPONSE: case MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE: @@ -550,6 +551,11 @@ static int dsim_get_gpios(struct dsim_device *dsim) res->lcd_power[1] = -1; dsim_info("This board doesn't support 2nd LCD power GPIO"); } + res->lcd_power[2] = of_get_gpio(dev->of_node, 3); + if (res->lcd_power[2] < 0) { + res->lcd_power[2] = -1; + dsim_info("This board doesn't support 3rd LCD power GPIO"); + } } dsim_info("%s -\n", __func__); @@ -644,6 +650,16 @@ int dsim_set_panel_power(struct dsim_device *dsim, bool on) gpio_free(res->lcd_power[1]); usleep_range(10000, 11000); } + if (res->lcd_power[2] > 0) { + ret = gpio_request_one(res->lcd_power[2], + GPIOF_OUT_INIT_HIGH, "lcd_power2"); + if (ret < 0) { + dsim_err("failed 3rd LCD power on\n"); + return -EINVAL; + } + gpio_free(res->lcd_power[2]); + usleep_range(10000, 11000); + } if (res->regulator_1p8v > 0) { ret = regulator_enable(res->regulator_1p8v); if (ret) { @@ -690,6 +706,16 @@ int dsim_set_panel_power(struct dsim_device *dsim, bool on) gpio_free(res->lcd_power[1]); usleep_range(5000, 6000); } + if (res->lcd_power[2] > 0) { + ret = gpio_request_one(res->lcd_power[2], + GPIOF_OUT_INIT_LOW, "lcd_power2"); + if (ret < 0) { + dsim_err("failed 3nd LCD power off\n"); + return -EINVAL; + } + gpio_free(res->lcd_power[2]); + usleep_range(5000, 6000); + } if (res->regulator_1p8v > 0) { ret = regulator_disable(res->regulator_1p8v); if (ret) { diff --git a/drivers/video/fbdev/exynos/dpu20/event_log.c b/drivers/video/fbdev/exynos/dpu20/event_log.c index e194c25858e8..56cb1c92b1cf 100644 --- a/drivers/video/fbdev/exynos/dpu20/event_log.c +++ b/drivers/video/fbdev/exynos/dpu20/event_log.c @@ -178,6 +178,9 @@ static inline void dpu_event_log_dpp break; case DPU_EVT_DPP_WINCON: log->data.dpp.id = dpp->id; + log->data.dpp.comp = dpp->dpp_config->config.compression; + log->data.dpp.rot = dpp->dpp_config->config.dpp_parm.rot; + log->data.dpp.hdr_std = dpp->dpp_config->config.dpp_parm.hdr_std; memcpy(&log->data.dpp.src, &dpp->dpp_config->config.src, sizeof(struct decon_frame)); memcpy(&log->data.dpp.dst, &dpp->dpp_config->config.dst, sizeof(struct decon_frame)); break; @@ -597,10 +600,11 @@ void DPU_EVENT_SHOW(struct seq_file *s, struct decon_device *decon) break; case DPU_EVT_DPP_WINCON: seq_printf(s, "%20s ", "DPP_WINCON"); - seq_printf(s, "ID:%d, start= %d, done= %d\n", + seq_printf(s, "ID:%d, comp= %d, rot= %d, hdr= %d\n", log->data.dpp.id, - log->data.dpp.start_cnt, - log->data.dpp.done_cnt); + log->data.dpp.comp, + log->data.dpp.rot, + log->data.dpp.hdr_std); break; case DPU_EVT_DPP_FRAMEDONE: seq_printf(s, "%20s ", "DPP_FRAMEDONE"); diff --git a/drivers/video/fbdev/exynos/dpu20/hdr_metadata.h b/drivers/video/fbdev/exynos/dpu20/hdr_metadata.h index 1c82f9ff42d2..fa3c1698ef1c 100644 --- a/drivers/video/fbdev/exynos/dpu20/hdr_metadata.h +++ b/drivers/video/fbdev/exynos/dpu20/hdr_metadata.h @@ -58,20 +58,18 @@ struct exynos_hdr_static_info { }; struct exynos_video_dec_data { - struct exynos_hdr_static_info shdr_static_info; - struct exynos_color_aspects scolor_aspects; int ninterlaced_type; }; struct exynos_video_enc_data { - struct exynos_hdr_static_info shdr_static_info; - struct exynos_color_aspects scolor_aspects; struct exynos_video_ysum_data sysum_data; }; struct exynos_video_meta { enum exynos_video_info_type etype; - + /* common */ + struct exynos_hdr_static_info shdr_static_info; + struct exynos_color_aspects scolor_aspects; union { struct exynos_video_dec_data dec; struct exynos_video_enc_data enc; diff --git a/drivers/video/fbdev/exynos/dpu20/helper.c b/drivers/video/fbdev/exynos/dpu20/helper.c index 21e42c180712..5405128cffdc 100644 --- a/drivers/video/fbdev/exynos/dpu20/helper.c +++ b/drivers/video/fbdev/exynos/dpu20/helper.c @@ -24,7 +24,9 @@ #include "decon.h" #include "dsim.h" #include "dpp.h" +#if defined(CONFIG_EXYNOS_DISPLAYPORT) #include "displayport.h" +#endif #include "./panels/lcd_ctrl.h" #include