Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7e0736d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: touchpanel: enable protocol B for skuf CTP driver"

parents 4481a4fb 83c16c4d
Loading
Loading
Loading
Loading
+97 −25
Original line number Diff line number Diff line
@@ -97,7 +97,10 @@ static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms);
static void gtp_int_sync(struct goodix_ts_data *ts, int ms);
static int gtp_i2c_test(struct i2c_client *client);

#ifdef CONFIG_HAS_EARLYSUSPEND
#if defined(CONFIG_FB)
static int fb_notifier_callback(struct notifier_block *self,
				 unsigned long event, void *data);
#elif defined(CONFIG_HAS_EARLYSUSPEND)
static void goodix_ts_early_suspend(struct early_suspend *h);
static void goodix_ts_late_resume(struct early_suspend *h);
#endif
@@ -772,7 +775,7 @@ static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms)
#endif
}

#ifdef CONFIG_HAS_EARLYSUSPEND
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB)
#if GTP_SLIDE_WAKEUP
/*******************************************************
Function:
@@ -877,16 +880,12 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts)
	GTP_DEBUG_FUNC();

#if GTP_POWER_CTRL_SLEEP
	while (retry++ < 5) {
	gtp_reset_guitar(ts, 20);

	ret = gtp_send_cfg(ts);
	if (ret > 0) {
		dev_dbg(&ts->client->dev,
			"Wakeup sleep send config success.");
			continue;
		}
		dev_dbg(&ts->client->dev, "GTP Wakeup!");
		return 1;
	}
#else
@@ -927,7 +926,7 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts)
	dev_err(&ts->client->dev, "GTP wakeup sleep failed.\n");
	return ret;
}
#endif /* !CONFIG_HAS_EARLYSUSPEND */
#endif /* !CONFIG_HAS_EARLYSUSPEND && !CONFIG_FB*/

/*******************************************************
Function:
@@ -1790,6 +1789,20 @@ static int goodix_ts_probe(struct i2c_client *client,
		goto exit_free_inputdev;
	}

#if defined(CONFIG_FB)
	ts->fb_notif.notifier_call = fb_notifier_callback;
	ret = fb_register_client(&ts->fb_notif);
	if (ret)
		dev_err(&ts->client->dev,
			"Unable to register fb_notifier: %d\n",
			ret);
#elif defined(CONFIG_HAS_EARLYSUSPEND)
	ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
	ts->early_suspend.suspend = goodix_ts_early_suspend;
	ts->early_suspend.resume = goodix_ts_late_resume;
	register_early_suspend(&ts->early_suspend);
#endif

	ts->goodix_wq = create_singlethread_workqueue("goodix_wq");
	INIT_WORK(&ts->work, goodix_ts_work_func);

@@ -1817,6 +1830,13 @@ static int goodix_ts_probe(struct i2c_client *client,
	init_done = true;
	return 0;
exit_free_irq:
#if defined(CONFIG_FB)
	if (fb_unregister_client(&ts->fb_notif))
		dev_err(&client->dev,
			"Error occurred while unregistering fb_notifier.\n");
#elif defined(CONFIG_HAS_EARLYSUSPEND)
	unregister_early_suspend(&ts->early_suspend);
#endif
	if (ts->use_irq)
		free_irq(client->irq, ts);
	else
@@ -1860,7 +1880,11 @@ static int goodix_ts_remove(struct i2c_client *client)
	struct goodix_ts_data *ts = i2c_get_clientdata(client);

	GTP_DEBUG_FUNC();
#ifdef CONFIG_HAS_EARLYSUSPEND
#if defined(CONFIG_FB)
	if (fb_unregister_client(&ts->fb_notif))
		dev_err(&client->dev,
			"Error occurred while unregistering fb_notifier.\n");
#elif defined(CONFIG_HAS_EARLYSUSPEND)
	unregister_early_suspend(&ts->early_suspend);
#endif

@@ -1905,7 +1929,7 @@ static int goodix_ts_remove(struct i2c_client *client)
	return 0;
}

#ifdef CONFIG_HAS_EARLYSUSPEND
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB)
/*******************************************************
Function:
	Early suspend function.
@@ -1914,12 +1938,9 @@ Input:
Output:
	None.
*******************************************************/
static void goodix_ts_early_suspend(struct early_suspend *h)
static void goodix_ts_suspend(struct goodix_ts_data *ts)
{
	struct goodix_ts_data *ts;
	s8 ret = -1;

	ts = container_of(h, struct goodix_ts_data, early_suspend);
	int ret = -1;

	GTP_DEBUG_FUNC();

@@ -1953,12 +1974,9 @@ Input:
Output:
	None.
*******************************************************/
static void goodix_ts_late_resume(struct early_suspend *h)
static void goodix_ts_resume(struct goodix_ts_data *ts)
{
	struct goodix_ts_data *ts;
	s8 ret = -1;

	ts = container_of(h, struct goodix_ts_data, early_suspend);
	int ret = -1;

	GTP_DEBUG_FUNC();

@@ -1969,7 +1987,7 @@ static void goodix_ts_late_resume(struct early_suspend *h)
#endif

	if (ret < 0)
		dev_err(&ts->client->dev, "GTP later resume failed.\n");
		dev_err(&ts->client->dev, "GTP resume failed.\n");

	if (ts->use_irq)
		gtp_irq_enable(ts);
@@ -1982,7 +2000,61 @@ static void goodix_ts_late_resume(struct early_suspend *h)
	gtp_esd_switch(ts->client, SWITCH_ON);
#endif
}

#if defined(CONFIG_FB)
static int fb_notifier_callback(struct notifier_block *self,
				 unsigned long event, void *data)
{
	struct fb_event *evdata = data;
	int *blank;
	struct goodix_ts_data *ts =
		container_of(self, struct goodix_ts_data, fb_notif);

	if (evdata && evdata->data && event == FB_EVENT_BLANK &&
			ts && ts->client) {
		blank = evdata->data;
		if (*blank == FB_BLANK_UNBLANK)
			goodix_ts_resume(ts);
		else if (*blank == FB_BLANK_POWERDOWN)
			goodix_ts_suspend(ts);
	}

	return 0;
}
#elif defined(CONFIG_HAS_EARLYSUSPEND)
/*******************************************************
Function:
	Early suspend function.
Input:
	h: early_suspend struct.
Output:
	None.
*******************************************************/
static void goodix_ts_early_suspend(struct early_suspend *h)
{
	struct goodix_ts_data *ts;

	ts = container_of(h, struct goodix_ts_data, early_suspend);
	goodix_ts_suspend(ts);
}

/*******************************************************
Function:
	Late resume function.
Input:
	h: early_suspend struct.
Output:
	None.
*******************************************************/
static void goodix_ts_late_resume(struct early_suspend *h)
{
	struct goodix_ts_data *ts;

	ts = container_of(h, struct goodix_ts_data, early_suspend);
	goodix_ts_late_resume(ts);
}
#endif
#endif /* !CONFIG_HAS_EARLYSUSPEND && !CONFIG_FB*/

#if GTP_ESD_PROTECT
/*******************************************************
+12 −6
Original line number Diff line number Diff line
@@ -36,7 +36,11 @@
#include <linux/regulator/consumer.h>
#include <linux/firmware.h>
#include <linux/debugfs.h>
#if defined(CONFIG_HAS_EARLYSUSPEND)

#if defined(CONFIG_FB)
#include <linux/notifier.h>
#include <linux/fb.h>
#elif defined(CONFIG_HAS_EARLYSUSPEND)
#include <linux/earlysuspend.h>
#define GOODIX_SUSPEND_LEVEL 1
#endif
@@ -68,9 +72,6 @@ struct goodix_ts_data {
	struct hrtimer timer;
	struct workqueue_struct *goodix_wq;
	struct work_struct	work;
#if defined(CONFIG_HAS_EARLYSUSPEND)
	struct early_suspend early_suspend;
#endif
	s32 irq_is_disabled;
	s32 use_irq;
	u16 abs_x_max;
@@ -90,6 +91,11 @@ struct goodix_ts_data {
	struct regulator *avdd;
	struct regulator *vdd;
	struct regulator *vcc_i2c;
#if defined(CONFIG_FB)
	struct notifier_block fb_notif;
#elif defined(CONFIG_HAS_EARLYSUSPEND)
	struct early_suspend early_suspend;
#endif
};

extern u16 show_len;
@@ -100,8 +106,8 @@ extern u16 total_len;
#define GTP_CHANGE_X2Y			0
#define GTP_DRIVER_SEND_CFG		1
#define GTP_HAVE_TOUCH_KEY		1
#define GTP_POWER_CTRL_SLEEP	1
#define GTP_ICS_SLOT_REPORT	0
#define GTP_POWER_CTRL_SLEEP	0
#define GTP_ICS_SLOT_REPORT	1

/* auto updated by .bin file as default */
#define GTP_AUTO_UPDATE			0