From 3b942d1675d4f40f38f02a8055c43b02ec278a91 Mon Sep 17 00:00:00 2001 From: William Tai Date: Thu, 21 Sep 2023 06:47:14 +0000 Subject: dsi: skip panel on op in petc aod-off Skip panel on operation and brightness level 0 config with the setting aod-off when out of false-interactive mode. Test: check if skip panel on operation and brightness level 0 config properly. Bug: 299561981 Bug: 300323132 Signed-off-by: William Tai (cherry picked from https://partner-android-review.googlesource.com/q/commit:2bb52160ac3ac5f58f38a94bbdbea4b205468045) Merged-In: I62f89fd25b3a9fd38a28fa8227749f3a6d9e37bc Change-Id: I62f89fd25b3a9fd38a28fa8227749f3a6d9e37bc --- Makefile | 3 ++- msm/Kbuild | 2 ++ msm/dsi/dsi_drm.c | 12 ++++++++++++ msm/dsi/dsi_panel.c | 43 ++++++++++++++++++++++++++----------------- msm/dsi/dsi_panel.h | 1 + msm/sde/sde_connector.c | 4 +++- 6 files changed, 46 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 47413131..9822286a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only -KBUILD_OPTIONS+= DISPLAY_ROOT=$(KERNEL_SRC)/$(M) +KBUILD_OPTIONS+= DISPLAY_ROOT=$(KERNEL_SRC)/$(M) \ + KBUILD_EXTRA_SYMBOLS+=$(OUT_DIR)/../google-modules/nanohub/Module.symvers all: $(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS) diff --git a/msm/Kbuild b/msm/Kbuild index 3165ef70..a3384016 100644 --- a/msm/Kbuild +++ b/msm/Kbuild @@ -54,6 +54,7 @@ LINUX_INC += -I$(DISPLAY_ROOT) \ -I$(DISPLAY_ROOT)/include \ -I$(KERNEL_ROOT)/drivers/clk/qcom \ -I$(KERNEL_SRC)/drivers/clk/qcom \ + -I$(KERNEL_SRC)/../google-modules/nanohub \ -I$(DISPLAY_ROOT)/include/linux \ -I$(DISPLAY_ROOT)/rotator \ -I$(DISPLAY_ROOT)/msm \ @@ -82,6 +83,7 @@ endif KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/display-drivers/hdcp/Module.symvers KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/display-drivers/msm/Module.symvers +KBUILD_EXTRA_SYMBOLS +=$(OUT)/../google-modules/nanohub/Module.symvers ifeq ($(call cc-option-yn, -Wheader-guard),y) EXTRA_CFLAGS += -Wheader-guard diff --git a/msm/dsi/dsi_drm.c b/msm/dsi/dsi_drm.c index 33a2f508..7ee15865 100644 --- a/msm/dsi/dsi_drm.c +++ b/msm/dsi/dsi_drm.c @@ -9,6 +9,7 @@ #include #include "msm_kms.h" +#include "nanohub_exports.h" #include "sde_connector.h" #include "dsi_drm.h" #include "sde_trace.h" @@ -180,6 +181,7 @@ static int dsi_bridge_attach(struct drm_bridge *bridge, static void dsi_bridge_pre_enable(struct drm_bridge *bridge) { int rc = 0; + bool skip_panel_on_seq_check_enabled = false; struct dsi_bridge *c_bridge = to_dsi_bridge(bridge); if (!bridge) { @@ -192,6 +194,9 @@ static void dsi_bridge_pre_enable(struct drm_bridge *bridge) return; } + if (!atomic_read(&c_bridge->display->panel->esd_recovery_pending)) + skip_panel_on_seq_check_enabled = true; + atomic_set(&c_bridge->display->panel->esd_recovery_pending, 0); /* By this point mode should have been validated through mode_fixup */ @@ -210,6 +215,13 @@ static void dsi_bridge_pre_enable(struct drm_bridge *bridge) return; } + c_bridge->display->panel->skip_panel_on_from_off = false; + if (skip_panel_on_seq_check_enabled) + if (nanohub_query_display_state_no_check() == MCU_DISPLAY_ON) { + DSI_INFO("skip panel on\n"); + c_bridge->display->panel->skip_panel_on_from_off = true; + } + SDE_ATRACE_BEGIN("dsi_display_prepare"); rc = dsi_display_prepare(c_bridge->display); if (rc) { diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 05b6190b..3202b126 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -277,6 +277,9 @@ static int dsi_panel_reset(struct dsi_panel *panel) } } + if (panel->skip_panel_on_from_off) + goto exit; + if (r_config->count) { rc = gpio_direction_output(r_config->reset_gpio, r_config->sequence[0].level); @@ -4907,26 +4910,28 @@ int dsi_panel_enable(struct dsi_panel *panel) mutex_lock(&panel->panel_lock); - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ON); - if (rc) { - DSI_ERR("[%s] failed to send DSI_CMD_SET_ON cmds, rc=%d\n", - panel->name, rc); - goto error; - } - - if (panel->panel_mode == DSI_OP_CMD_MODE) { - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_CMD_ON); + if (!panel->skip_panel_on_from_off) { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ON); if (rc) { - DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_ON cmds, rc=%d\n", - panel->name, rc); + DSI_ERR("[%s] failed to send DSI_CMD_SET_ON cmds, rc=%d\n", panel->name, + rc); goto error; } - } else if (panel->panel_mode == DSI_OP_VIDEO_MODE) { - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_VID_ON); - if (rc) { - DSI_ERR("[%s] failed to send DSI_CMD_SET_VID_ON cmds, rc=%d\n", - panel->name, rc); - goto error; + + if (panel->panel_mode == DSI_OP_CMD_MODE) { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_CMD_ON); + if (rc) { + DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_ON cmds, rc=%d\n", + panel->name, rc); + goto error; + } + } else if (panel->panel_mode == DSI_OP_VIDEO_MODE) { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_VID_ON); + if (rc) { + DSI_ERR("[%s] failed to send DSI_CMD_SET_VID_ON cmds, rc=%d\n", + panel->name, rc); + goto error; + } } } panel->panel_initialized = true; @@ -4945,6 +4950,9 @@ int dsi_panel_post_enable(struct dsi_panel *panel) return -EINVAL; } + if (panel->skip_panel_on_from_off) + return 0; + mutex_lock(&panel->panel_lock); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_POST_ON); @@ -4953,6 +4961,7 @@ int dsi_panel_post_enable(struct dsi_panel *panel) panel->name, rc); goto error; } + error: mutex_unlock(&panel->panel_lock); return rc; diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 5e97d8aa..423e167c 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -263,6 +263,7 @@ struct dsi_panel { bool is_twm_en; bool skip_panel_off; + bool skip_panel_on_from_off; bool panel_initialized; bool te_using_watchdog_timer; struct dsi_qsync_capabilities qsync_caps; diff --git a/msm/sde/sde_connector.c b/msm/sde/sde_connector.c index 3e869bae..6046f98b 100644 --- a/msm/sde/sde_connector.c +++ b/msm/sde/sde_connector.c @@ -1229,7 +1229,9 @@ void sde_connector_helper_bridge_enable(struct drm_connector *connector) if (!sde_in_trusted_vm(sde_kms) && c_conn->bl_device && !display->poms_pending) { c_conn->bl_device->props.power = FB_BLANK_UNBLANK; c_conn->bl_device->props.state &= ~BL_CORE_FBBLANK; - backlight_update_status(c_conn->bl_device); + // skip restoring panel brightness when panel on sequence is skipped. + if (!(display->panel->skip_panel_on_from_off)) + backlight_update_status(c_conn->bl_device); } } -- cgit v1.2.3