From eb4eb54d415e0cf60f0595cb65e0fc95f20c0cea Mon Sep 17 00:00:00 2001 From: houdz1 Date: Mon, 26 Oct 2020 14:09:53 +0800 Subject: [PATCH] dsi_panel: Add support the state of the touch screen Touch have a feature named "single tap". 1. When the feature enbled, we can not power down panel, and keep rest signal high. 2. When the feature disabled, the touch state is 0, Instead, the touch state is 1. 3. Touch driver will call set() function to set the touch state, And panel driver will call check() function to check state. Change-Id: I034909007678ae940769ec8e350518185cc5fad3 Signed-off-by: houdz1 Reviewed-on: https://gerrit.mot.com/1784647 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jun Weng Reviewed-by: Yeqing Wang Reviewed-by: Huosheng Liao Reviewed-by: litong Submit-Approved: Jira Key --- msm/dsi/dsi_display.c | 9 ++++----- msm/dsi/dsi_display.h | 2 +- msm/dsi/dsi_panel.c | 29 +++++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 85bfe304119d..b027fc73e723 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -4729,7 +4729,6 @@ static int dsi_display_res_init(struct dsi_display *display) int rc = 0; int i; struct dsi_display_ctrl *ctrl; - u32 panel_idx = 0; display_for_each_ctrl(i, display) { ctrl = &display->ctrl[i]; @@ -4752,12 +4751,12 @@ static int dsi_display_res_init(struct dsi_display *display) } if (!strcmp(display->display_type, "primary")) - panel_idx = 0; + display->panel_idx = 0; else if (!strcmp(display->display_type, "secondary")) - panel_idx = 1; + display->panel_idx = 1; else { DSI_WARN("Unalbe to find the display type"); - panel_idx = 0; + display->panel_idx = 0; } display->panel = dsi_panel_get(&display->pdev->dev, display->panel_node, @@ -4765,7 +4764,7 @@ static int dsi_display_res_init(struct dsi_display *display) display->display_type, display->cmdline_topology, display->trusted_vm_env, - panel_idx); + display->panel_idx); if (IS_ERR_OR_NULL(display->panel)) { rc = PTR_ERR(display->panel); DSI_ERR("failed to get panel, rc=%d\n", rc); diff --git a/msm/dsi/dsi_display.h b/msm/dsi/dsi_display.h index 1de87cb0019a..f8d67ac8759f 100644 --- a/msm/dsi/dsi_display.h +++ b/msm/dsi/dsi_display.h @@ -302,8 +302,8 @@ struct dsi_display { int tx_cmd_buf_ndx; struct dsi_panel_cmd_set cmd_set; - bool enabled; + u32 panel_idx; }; int dsi_display_dev_probe(struct platform_device *pdev); diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 75ffd00a677a..dda75a867ead 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -397,7 +397,32 @@ static int dsi_panel_set_pinctrl_state(struct dsi_panel *panel, bool enable) return rc; } -#if defined(CONFIG_PANEL_NOTIFICATIONS) +#if defined(MOTO_PANEL_CHECK_TOUCH_STATE) +static int touch_state[PANEL_IDX_MAX] = {0}; +int touch_set_state(int state, int panel_idx) +{ + int rc = 0; + + if (panel_idx >= PANEL_IDX_MAX) + rc = -EINVAL; + else + touch_state[panel_idx] = state; + + return rc; +} +EXPORT_SYMBOL_GPL(touch_set_state); + +static int check_touch_state(int *state, int panel_idx) +{ + int rc = 0; + + if (panel_idx >= PANEL_IDX_MAX) rc = -EINVAL; + else *state = touch_state[panel_idx]; + + return rc; +} + + static bool panel_power_is_alway_on(struct dsi_panel *panel) { int touch_state = 0; @@ -409,7 +434,7 @@ static bool panel_power_is_alway_on(struct dsi_panel *panel) if (unlikely(dsi_display == NULL)) return rc; - if( check_touch_state(&touch_state, dsi_display->display_idx) == 0) + if( check_touch_state(&touch_state, dsi_display->panel_idx) == 0) { panel->tp_state = touch_state; rc = touch_state ? 1: 0;