input: touchscreen: st: Block resume work on PVM

While trusted touch is underway, block resume work
to flush touch FIFO since ownership of register space
is with Trusted VM. Additionally add extra regulator
vote before starting TUI.

Change-Id: I50e94400e467194b5caf615bdbd0d2f4d8630a96
Signed-off-by: Shashank Babu Chinta Venkata <sbchin@codeaurora.org>
This commit is contained in:
Shashank Babu Chinta Venkata 2020-12-11 01:30:29 -08:00 • committed by Ritesh Kumar
commit 71f19c2d0f

View file

@ -121,6 +121,7 @@ static void fts_interrupt_disable(struct fts_ts_info *info);
static void fts_interrupt_enable(struct fts_ts_info *info);
static irqreturn_t fts_interrupt_handler(int irq, void *handle);
static int fts_probe_delayed(struct fts_ts_info *info);
static int fts_enable_reg(struct fts_ts_info *info, bool enable);
#ifdef CONFIG_ST_TRUSTED_TOUCH
@ -765,7 +766,6 @@ static void fts_trusted_touch_abort_pvm(struct fts_ts_info *info)
case PVM_I2C_RESOURCE_ACQUIRED:
case PVM_INTERRUPT_ENABLED:
fts_bus_put(info);
complete(&info->trusted_touch_powerdown);
case TRUSTED_TOUCH_PVM_INIT:
case PVM_I2C_RESOURCE_RELEASED:
atomic_set(&info->trusted_touch_enabled, 0);
@ -807,6 +807,9 @@ static int fts_bus_get(struct fts_ts_info *info)
{
int rc = 0;
flush_workqueue(info->event_wq);
reinit_completion(&info->trusted_touch_powerdown);
fts_enable_reg(info, true);
mutex_lock(&info->fts_clk_io_ctrl_mutex);
rc = pm_runtime_get_sync(info->client->adapter->dev.parent);
if (rc >= 0 && info->core_clk != NULL && info->iface_clk != NULL) {
@ -825,6 +828,8 @@ static void fts_bus_put(struct fts_ts_info *info)
fts_clk_disable_unprepare(info);
pm_runtime_put_sync(info->client->adapter->dev.parent);
mutex_unlock(&info->fts_clk_io_ctrl_mutex);
complete(&info->trusted_touch_powerdown);
fts_enable_reg(info, false);
}
static struct hh_notify_vmid_desc *fts_vm_get_vmid(hh_vmid_t vmid)
@ -876,7 +881,6 @@ static void fts_trusted_touch_pvm_vm_mode_disable(struct fts_ts_info *info)
fts_bus_put(info);
fts_trusted_touch_set_pvm_driver_state(info,
PVM_I2C_RESOURCE_RELEASED);
complete(&info->trusted_touch_powerdown);
fts_trusted_touch_set_pvm_driver_state(info,
TRUSTED_TOUCH_PVM_INIT);
atomic_set(&info->trusted_touch_enabled, 0);
@ -1051,7 +1055,6 @@ static int fts_trusted_touch_pvm_vm_mode_enable(struct fts_ts_info *info)
}
fts_trusted_touch_set_pvm_driver_state(info, PVM_IRQ_LENT_NOTIFIED);
reinit_completion(&info->trusted_touch_powerdown);
atomic_set(&info->trusted_touch_enabled, 1);
pr_debug("trusted touch enabled\n");
return rc;
@ -1381,7 +1384,6 @@ static int fts_init_afterProbe(struct fts_ts_info *info);
static int fts_mode_handler(struct fts_ts_info *info, int force);
static int fts_command(struct fts_ts_info *info, unsigned char cmd);
static int fts_chip_initialization(struct fts_ts_info *info);
static int fts_enable_reg(struct fts_ts_info *info, bool enable);
static struct drm_panel *active_panel;
@ -5347,6 +5349,11 @@ static void fts_resume_work(struct work_struct *work)
info = container_of(work, struct fts_ts_info, resume_work);
#ifdef CONFIG_ST_TRUSTED_TOUCH
if (atomic_read(&info->trusted_touch_enabled))
wait_for_completion_interruptible(
&info->trusted_touch_powerdown);
#endif
__pm_wakeup_event(info->wakeup_source, HZ);
fts_chip_power_switch(info, true);