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 <houdz1@motorola.com>
Reviewed-on: https://gerrit.mot.com/1784647
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jun Weng <wengjun1@motorola.com>
Reviewed-by: Yeqing Wang <wangyq13@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: litong <litong20@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
houdz1 2020-10-26 14:09:53 +08:00 • committed by tongkun1
commit eb4eb54d41
3 changed files with 32 additions and 8 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;