synaptics_mmi: DRM panel state machine

State machine needed to indicate DRM panel states. This fixes
unloading of DLKM.

Change-Id: I8093337c3890f8e76dd4b3b7290cc8e311d245d1
Signed-off-by: Konstantin Makariev <hcv867@motorola.com>
Reviewed-on: https://gerrit.mot.com/1330943
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Konstantin Makariev 2019-04-01 17:09:57 -05:00 • committed by Konstantin Makariev
commit 5eb1814dc5
2 changed files with 19 additions and 7 deletions

View file

@ -6603,25 +6603,28 @@ static void synaptics_rmi4_detection_work(struct work_struct *work)
#if defined(CONFIG_DRM)
if (rmi4_data->splash_screen_mode) {
/* DRM status of primary panel */
/* DRM panel status */
panel_ready = dsi_display_is_panel_enable(rmi4_data->ctrl_dsi,
&probe_status, &pname);
dev_dbg(dev, "%s: drm: probe=%d, enable=%d, panel'%s'\n",
__func__, probe_status, panel_ready, pname);
/* check if primary panel is not a dummy one */
if (pname && strstr(pname, "dummy")) {
dev_info(dev, "%s: dummy panel detected; terminating...\n", __func__);
terminate = true;
dev_info(dev, "%s: dummy panel detected\n", __func__);
rmi4_data->drm_state = DRM_ST_TERM;
} else if (panel_ready) {
dev_dbg(dev, "%s: panel ready\n", __func__);
rmi4_data->drm_state = DRM_ST_READY;
}
}
#endif
/* pname only gets initialized by DRM */
/* it implies RMI_DRM_FRAMEWORK handler running */
if (pname) {
if (!panel_ready)
if (ASSERT(DRM_ST_UNDEF))
goto exit_reschedule;
if (rmi4_data->terminating) {
if (ASSERT(DRM_ST_TERM)) {
/* hw init failed on previous step, thus
* continue shutting things down */
terminate = true;
@ -6845,7 +6848,7 @@ static void synaptics_rmi4_detection_work(struct work_struct *work)
dev_dbg(dev, "%s: hw init failed\n", __func__);
/* not dummy panel found, but touch hw init failed, */
/* thus we need to terminate further processing */
rmi4_data->terminating = true;
rmi4_data->drm_state = DRM_ST_TERM;
}
exp_fhandler->func_init = NULL;
dev_dbg(dev, "%s: removing DRM\n", __func__);

View file

@ -568,7 +568,7 @@ struct synaptics_rmi4_data {
struct synaptics_exp_fn_ctrl exp_fn_ctrl;
struct list_head node;
struct semaphore reset_semaphore;
bool terminating;
int drm_state;
int instance;
char *irq_name;
char *reset_name;
@ -592,6 +592,15 @@ struct synaptics_rmi4_data {
struct synaptics_rmi4_func_packet_regs config_regs[MAX_CONFIG_REGS];
};
enum {
DRM_ST_UNDEF = 0,
DRM_ST_READY,
DRM_ST_TERM,
DRM_ST_MAX
};
#define ASSERT(s) (rmi4_data->drm_state == s)
struct pdt_properties {
union {
struct {