Эх сурвалжийг харах

touchscreen: raydium: Fix Touch_to_wake issue with AOD_OFF

New DRM events were added as a part of deep sleep features,
hence added changes to handle DRM events in callback function
and interrupt work handler.

Change-Id: If4ccfb12cb9c6df98eccc1ae5968be8e1225f711
Signed-off-by: ppadasal <[email protected]>
ppadasal 2 жил өмнө
parent
commit
6c84669c98
1 өөрчлөгдсөн 48 нэмэгдсэн , 56 устгасан
  1. 48 56
      raydium/raydium_driver.c

+ 48 - 56
raydium/raydium_driver.c

@@ -58,6 +58,8 @@ struct raydium_slot_status gst_slot[MAX_TOUCH_NUM * 2];
 struct raydium_slot_status gst_slot_init = {0xFF, 0, 0};
 
 static int raydium_enable_regulator(struct raydium_ts_data *cd, bool en);
+
+
 #if (defined(CONFIG_RM_SYSFS_DEBUG))
 const struct attribute_group raydium_attr_group;
 #endif /*end of CONFIG_RM_SYSFS_DEBUG*/
@@ -1186,9 +1188,9 @@ static void raydium_work_handler(struct work_struct *work)
 
 #ifdef GESTURE_EN
 	unsigned char u8_i;
-	LOGD(LOG_DEBUG, "[touch]ts->blank:%x, g_u8_i2c_mode:%x\n",
+	LOGD(LOG_INFO, "[touch]ts->blank:%x, g_u8_i2c_mode:%x\n",
 			g_raydium_ts->blank, g_u8_i2c_mode);
-	LOGD(LOG_DEBUG, "[touch]u8_tp_status:%x, g_raydium_ts->is_palm:%x\n",
+	LOGD(LOG_INFO, "[touch]u8_tp_status:%x, g_raydium_ts->is_palm:%x\n",
 			u8_tp_status[POS_GES_STATUS], g_raydium_ts->is_palm);
 
 	if (g_u8_i2c_mode == PDA2_MODE) {
@@ -1199,8 +1201,26 @@ static void raydium_work_handler(struct work_struct *work)
 			return;
 		}
 	}
+
+	if (g_raydium_ts->blank == DRM_PANEL_BLANK_LP ||
+	g_raydium_ts->blank == DRM_PANEL_BLANK_POWERDOWN || g_raydium_ts->fb_state == FB_OFF) {
+		LOGD(LOG_INFO, "[touch] elseif u8_tp_status:%x\n", u8_tp_status[POS_GES_STATUS]);
+		/*need check small area*/
+		/*if (u8_tp_status[POS_GES_STATUS] == RAD_WAKE_UP */
+		 /*&& g_u8_wakeup_flag == false) { */
+		if (u8_tp_status[POS_GES_STATUS] == 0)	{
+			input_report_key(g_raydium_ts->input_dev, KEY_POWER, true);
+			usleep_range(9500, 10500);
+			input_sync(g_raydium_ts->input_dev);
+
+			input_report_key(g_raydium_ts->input_dev, KEY_POWER, false);
+			input_sync(g_raydium_ts->input_dev);
+			LOGD(LOG_INFO, "[touch]display wake up with g_u8_resetflag true\n");
+			/*goto exit;*/
+		}
+	}
 	/*when display on can use palm to suspend*/
-	if (g_raydium_ts->blank == DRM_PANEL_BLANK_UNBLANK) {
+	else if (g_raydium_ts->blank == DRM_PANEL_BLANK_UNBLANK) {
 		if (u8_tp_status[POS_GES_STATUS] == RAD_PALM_ENABLE) {
 			if (g_raydium_ts->is_palm == 0) {
 				/* release all touches*/
@@ -1238,22 +1258,6 @@ static void raydium_work_handler(struct work_struct *work)
 			g_raydium_ts->is_palm = 0;
 			/*goto exit;*/
 		}
-	} else if (g_raydium_ts->blank == DRM_PANEL_BLANK_LP ||
-		g_raydium_ts->blank == DRM_PANEL_BLANK_POWERDOWN) {
-		LOGD(LOG_INFO, "[touch] elseif u8_tp_status:%x\n", u8_tp_status[POS_GES_STATUS]);
-		/*need check small area*/
-		/*if (u8_tp_status[POS_GES_STATUS] == RAD_WAKE_UP*/
-		/*&& g_u8_wakeup_flag == false) {*/
-		if (u8_tp_status[POS_GES_STATUS] == 0)	{
-			input_report_key(g_raydium_ts->input_dev, KEY_POWER, true);
-			usleep_range(9500, 10500);
-			input_sync(g_raydium_ts->input_dev);
-
-			input_report_key(g_raydium_ts->input_dev, KEY_POWER, false);
-			input_sync(g_raydium_ts->input_dev);
-			LOGD(LOG_INFO, "[touch]display wake up with g_u8_resetflag true\n");
-			/*goto exit;*/
-		}
 	}
 #else
 	if (g_u8_i2c_mode == PDA2_MODE) {
@@ -1275,6 +1279,7 @@ static irqreturn_t raydium_ts_interrupt(int irq, void *dev_id)
 	bool result = false;
 
 	LOGD(LOG_DEBUG, "[touch]%s\n", __func__);
+
 	/*For bootloader wrt/erase flash and software reset interrupt*/
 	if ((g_u8_raydium_flag & ENG_MODE) != 0) {
 		LOGD(LOG_INFO, "[touch]RAD_ENG_MODE\n");
@@ -1351,7 +1356,8 @@ exit_error:
 static void raydium_ts_do_suspend(void)
 {
 	unsigned char u8_i = 0;
-	int rc = 0;
+
+	LOGD(LOG_INFO, "[touch]%s.\n", __func__);
 
 	if (g_u8_raw_data_type == 0)
 		g_u8_resetflag = false;
@@ -1359,14 +1365,6 @@ static void raydium_ts_do_suspend(void)
 		LOGD(LOG_WARNING, "[touch]Already in suspend state\n");
 		return;
 	}
-
-	rc = raydium_enable_regulator(g_raydium_ts, false);
-	if (rc < 0) {
-		LOGD(LOG_ERR, "[touch]%s:Failed to disable regulators:rc=%d\n",
-			__func__, rc);
-	}
-	LOGD(LOG_INFO, "[touch]%s:voltage regulators disabled:rc=%d\n",
-		__func__, rc);
 	/*#ifndef GESTURE_EN*/
 	raydium_irq_control(DISABLE);
 	/*#endif*/
@@ -1375,8 +1373,6 @@ static void raydium_ts_do_suspend(void)
 	if (!cancel_work_sync(&g_raydium_ts->work))
 		LOGD(LOG_DEBUG, "[touch]workqueue is empty!\n");
 
-	LOGD(LOG_INFO, "[touch]%s.\n", __func__);
-
 	/* release all touches */
 	for (u8_i = 0; u8_i < g_raydium_ts->u8_max_touchs; u8_i++) {
 		input_mt_slot(g_raydium_ts->input_dev, u8_i);
@@ -1408,8 +1404,6 @@ static void raydium_ts_do_resume(void)
 	int i32_ret = 0;
 	unsigned char u8_retry = 0;
 #endif
-	int rc = 0;
-
 
 	LOGD(LOG_INFO, "[touch]%s, %d.\n", __func__, g_raydium_ts->is_suspend);
 	if (g_raydium_ts->is_suspend == 0) {
@@ -1448,14 +1442,6 @@ static void raydium_ts_do_resume(void)
 		g_u8_checkflag = false;
 	}
 #endif
-
-	rc = raydium_enable_regulator(g_raydium_ts, true);
-	if (rc < 0) {
-		LOGD(LOG_ERR, "[touch]%s: failed to enable regulators: rc=%d\n",
-			__func__, rc);
-	}
-	LOGD(LOG_INFO, "[touch]%s: voltage regulators enabled: rc=%d\n",
-		__func__, rc);
 	raydium_irq_control(ENABLE);
 #ifdef GESTURE_EN
 	if (device_may_wakeup(&g_raydium_ts->client->dev)) {
@@ -1483,10 +1469,11 @@ static int raydium_ts_resume(struct device *dev)
 	return 0;
 }
 
+
 static const struct dev_pm_ops raydium_ts_pm_ops = {
 #if (!defined(CONFIG_FB) && !defined(CONFIG_HAS_EARLYSUSPEND))
-	.suspend    = raydium_ts_suspend,
-	.resume        = raydium_ts_resume,
+	.suspend	= raydium_ts_suspend,
+	.resume		= raydium_ts_resume,
 #endif /*end of CONFIG_PM*/
 };
 
@@ -1635,20 +1622,30 @@ static int drm_notifier_callback(struct notifier_block *self,
 			if (g_raydium_ts->fb_state != FB_ON) {
 				LOGD(LOG_INFO, "%s: Resume notifier called!\n",
 					__func__);
+#ifdef GESTURE_EN
+			/* clear palm status */
+			g_raydium_ts->is_palm = 0;
+#endif
 
 #if defined(CONFIG_PM)
 				raydium_ts_resume(&g_raydium_ts->client->dev);
 #endif
 				g_raydium_ts->fb_state = FB_ON;
-				LOGD(LOG_INFO, "%s: Resume notified!\n", __func__);
+			LOGD(LOG_INFO, "%s: Resume notified!\n", __func__);
 			}
 		}
-	} else if (*blank == DRM_PANEL_BLANK_LP || *blank == DRM_PANEL_BLANK_POWERDOWN) {
+	} else if (*blank == DRM_PANEL_BLANK_LP || *blank == DRM_PANEL_BLANK_POWERDOWN
+		|| *blank == DRM_PANEL_BLANK_FPS_CHANGE) {
 		LOGD(LOG_INFO, "%s: LOWPOWER!\n", __func__);
 		if (event == DRM_PANEL_EARLY_EVENT_BLANK) {
 			if (g_raydium_ts->fb_state != FB_OFF) {
 				LOGD(LOG_INFO, "%s: Suspend notifier called!\n",
 					__func__);
+#ifdef GESTURE_EN
+			/* clear palm status */
+			g_raydium_ts->is_palm = 0;
+#endif
+
 #if defined(CONFIG_PM)
 				raydium_ts_suspend(&g_raydium_ts->client->dev);
 #endif
@@ -1842,13 +1839,13 @@ static int raydium_get_dt_coords(struct device *dev, char *name,
 
 static int raydium_check_dsi_panel_dt(struct device_node *np, struct drm_panel **active_panel)
 {
-	int i = 0;
+	int i = 0, rc = 0;
 	int count = 0;
 	struct device_node *node = NULL;
 	struct drm_panel *panel;
 
 	count = of_count_phandle_with_args(np, "panel", NULL);
-	LOGD(LOG_ERR, "[touch]%s: Active panel count: %d\n", __func__, count);
+	LOGD(LOG_INFO, "[touch]%s: Active panel count: %d\n", __func__, count);
 	if (count <= 0)
 		return 0;
 
@@ -1867,8 +1864,8 @@ static int raydium_check_dsi_panel_dt(struct device_node *np, struct drm_panel *
 		}
 	}
 	LOGD(LOG_ERR, "[touch]%s: Active panel NOT selected !\n", __func__);
-
-	return PTR_ERR(panel);
+	rc = PTR_ERR(panel);
+	return rc;
 }
 
 static int raydium_parse_dt(struct device *dev,
@@ -2149,6 +2146,7 @@ exit:
 #endif
 	return rc;
 }
+
 static int raydium_ts_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
@@ -2208,6 +2206,8 @@ static int raydium_ts_probe(struct i2c_client *client,
 	g_raydium_ts->y_max = pdata->y_max - 1;
 	g_raydium_ts->is_suspend = 0;
 	g_raydium_ts->is_sleep = 0;
+
+
 #ifdef GESTURE_EN
 	g_raydium_ts->is_palm = 0;
 #endif
@@ -2260,13 +2260,6 @@ static int raydium_ts_probe(struct i2c_client *client,
 		ret = -EPROBE_DEFER;
 		goto exit_check_i2c;
 	}
-
-	if (!pdata->active_panel) {
-//		LOGD(LOG_ERR, "[touch]active_panel null, check again!\n");
-		raydium_check_dsi_panel_dt(client->dev.of_node,
-					&pdata->active_panel);
-	}
-
 #ifdef CONFIG_DRM
 	/* Setup active dsi panel */
 	active_panel = pdata->active_panel;
@@ -2328,7 +2321,6 @@ static int raydium_ts_probe(struct i2c_client *client,
 	ret = request_threaded_irq(g_raydium_ts->irq, NULL, raydium_ts_interrupt,
 				   IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_NO_SUSPEND,
 				   client->dev.driver->name, g_raydium_ts);
-
 	if (ret < 0) {
 		LOGD(LOG_ERR, "[touch]raydium_probe: request irq failed\n");
 		goto exit_irq_request_failed;