From 78cde5eaf5e026bbbcbdd31315840675135e8b57 Mon Sep 17 00:00:00 2001 From: Anand Tarakh Date: Thu, 12 Oct 2023 11:38:20 +0530 Subject: [PATCH] disp: msm: dsi: fix mode count for POMS enabled video mode panel In legacy POMS feature, there were separate timing nodes for video and command mode. So, while calculating the total number of modes, 1 extra mode is added for command mode if POMS feature is enabled in video mode panel. But as per the new design, this is clubbed into one timing node. So, there is no separate mode for command mode. This change removes the check to add 1 extra mode count otherwise it leads to null pointer dereference while getting lm for this extra mode. Also avoid overriding mode capability when POMS is enabled. Change-Id: I73f3b89b22f566e40c88178f2af392214b1ada8d Signed-off-by: Anand Tarakh --- msm/dsi/dsi_display.c | 5 ++++- msm/dsi/dsi_panel.c | 10 +--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 00ba7b832d..8d0ba40eeb 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -7286,7 +7286,10 @@ int dsi_display_get_modes_helper(struct dsi_display *display, dsi_display_get_dfps_timing(display, sub_mode, curr_refresh_rate); - sub_mode->panel_mode_caps = DSI_OP_VIDEO_MODE; + + /* Avoid override for first sub mode in POMS enabled video mode usecase */ + if ((i != start) && support_cmd_mode && support_video_mode) + sub_mode->panel_mode_caps = DSI_OP_VIDEO_MODE; } end = array_idx; diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 7ffe1737e1..148e1ed17c 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -4009,17 +4009,9 @@ int dsi_panel_get_mode_count(struct dsi_panel *panel) num_dfps_rates = !panel->dfps_caps.dfps_support ? 1 : panel->dfps_caps.dfps_list_len; - /* - * Inflate num_of_modes by fps in dfps. - * Single command mode for video mode panels supporting - * panel operating mode switch. - */ + /* Inflate num_of_modes by fps in dfps. */ num_video_modes = num_video_modes * num_dfps_rates; - if ((panel->panel_mode == DSI_OP_VIDEO_MODE) && - (panel->panel_mode_switch_enabled)) - num_cmd_modes = 1; - panel->num_display_modes = num_video_modes + num_cmd_modes; error: