drivers/input/touchscreen: synaptics_dsx2: Add FB notifier
Change-Id: Ie289bd714b033790dcb06b51ddfcbbe419af1d8a
This commit is contained in:
parent
9649a17752
commit
7a4b2283bc
|
@ -30,9 +30,6 @@
|
|||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
//#include <linux/sec_batt.h>
|
||||
|
||||
//#include <plat/gpio-cfg.h>
|
||||
|
@ -58,25 +55,27 @@ static int synaptics_rmi4_start_device(struct synaptics_rmi4_data *rmi4_data);
|
|||
static void synaptics_rmi4_sensor_sleep(struct synaptics_rmi4_data *rmi4_data);
|
||||
static void synaptics_rmi4_sensor_wake(struct synaptics_rmi4_data *rmi4_data);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
static ssize_t synaptics_rmi4_full_pm_cycle_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
|
||||
static ssize_t synaptics_rmi4_full_pm_cycle_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#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 synaptics_rmi4_early_suspend(struct early_suspend *h);
|
||||
|
||||
static void synaptics_rmi4_late_resume(struct early_suspend *h);
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
static int synaptics_rmi4_suspend(struct device *dev);
|
||||
|
||||
static int synaptics_rmi4_resume(struct device *dev);
|
||||
#endif
|
||||
|
||||
static ssize_t synaptics_rmi4_full_pm_cycle_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
|
||||
static ssize_t synaptics_rmi4_full_pm_cycle_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count);
|
||||
|
||||
#ifdef PROXIMITY_MODE
|
||||
static void synaptics_rmi4_f51_finger_timer(unsigned long data);
|
||||
|
||||
|
@ -110,10 +109,8 @@ static ssize_t synaptics_rmi4_0dbutton_store(struct device *dev,
|
|||
|
||||
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
static DEVICE_ATTR(full_pm_cycle, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
synaptics_rmi4_full_pm_cycle_show, synaptics_rmi4_full_pm_cycle_store);
|
||||
#endif
|
||||
#ifdef PROXIMITY_MODE
|
||||
static DEVICE_ATTR(proximity_enables, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
synaptics_rmi4_f51_enables_show, synaptics_rmi4_f51_enables_store);
|
||||
|
@ -125,9 +122,7 @@ static DEVICE_ATTR(flashprog, S_IRUGO, synaptics_rmi4_f01_flashprog_show, NULL);
|
|||
static DEVICE_ATTR(0dbutton, (S_IRUGO | S_IWUSR | S_IWGRP), synaptics_rmi4_0dbutton_show, synaptics_rmi4_0dbutton_store);
|
||||
|
||||
static struct attribute *attrs[] = {
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
&dev_attr_full_pm_cycle.attr,
|
||||
#endif
|
||||
#ifdef PROXIMITY_MODE
|
||||
&dev_attr_proximity_enables.attr,
|
||||
#endif
|
||||
|
@ -144,7 +139,6 @@ static struct attribute_group attr_group = {
|
|||
.attrs = attrs,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
static ssize_t synaptics_rmi4_full_pm_cycle_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
|
@ -167,6 +161,35 @@ static ssize_t synaptics_rmi4_full_pm_cycle_store(struct device *dev,
|
|||
|
||||
return count;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_FB)
|
||||
static void configure_sleep(struct synaptics_rmi4_data *rmi4_data)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
rmi4_data->fb_notif.notifier_call = fb_notifier_callback;
|
||||
|
||||
retval = fb_register_client(&rmi4_data->fb_notif);
|
||||
if (retval)
|
||||
dev_err(&rmi4_data->i2c_client->dev,
|
||||
"Unable to register fb_notifier: %d\n", retval);
|
||||
return;
|
||||
}
|
||||
#elif defined(CONFIG_HAS_EARLYSUSPEND)
|
||||
static void configure_sleep(struct synaptics_rmi4_data *rmi4_data)
|
||||
{
|
||||
rmi4_data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
|
||||
rmi4_data->early_suspend.suspend = synaptics_rmi4_early_suspend;
|
||||
rmi4_data->early_suspend.resume = synaptics_rmi4_late_resume;
|
||||
register_early_suspend(&rmi4_data->early_suspend);
|
||||
|
||||
return;
|
||||
}
|
||||
#else
|
||||
static void configure_sleep(struct synaptics_rmi4_data *rmi4_data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PRINT_DEBUG_INFO
|
||||
|
@ -4095,12 +4118,7 @@ err_tsp_reboot:
|
|||
goto err_fw_update;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
rmi4_data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 1;
|
||||
rmi4_data->early_suspend.suspend = synaptics_rmi4_early_suspend;
|
||||
rmi4_data->early_suspend.resume = synaptics_rmi4_late_resume;
|
||||
register_early_suspend(&rmi4_data->early_suspend);
|
||||
#endif
|
||||
configure_sleep(rmi4_data);
|
||||
|
||||
#if defined RESET_BY_WORKQUEUE
|
||||
INIT_DELAYED_WORK(&rmi4_data->work_reset, reset_func);
|
||||
|
@ -4187,9 +4205,13 @@ static int synaptics_rmi4_remove(struct i2c_client *client)
|
|||
struct synaptics_rmi4_device_info *rmi;
|
||||
|
||||
rmi = &(rmi4_data->rmi4_mod_info);
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
|
||||
#if defined(CONFIG_FB)
|
||||
fb_unregister_client(&rmi4_data->fb_notif);
|
||||
#elif defined(CONFIG_HAS_EARLYSUSPEND)
|
||||
unregister_early_suspend(&rmi4_data->early_suspend);
|
||||
#endif
|
||||
|
||||
if(rmi4_data->resetting == true)
|
||||
cancel_delayed_work_sync(&rmi4_data->work_reset);
|
||||
synaptics_rmi4_irq_enable(rmi4_data, false);
|
||||
|
@ -4474,9 +4496,36 @@ static void synaptics_rmi4_input_close(struct input_dev *dev)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#define synaptics_rmi4_suspend NULL
|
||||
#define synaptics_rmi4_resume NULL
|
||||
#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 synaptics_rmi4_data *rmi4_data =
|
||||
container_of(self, struct synaptics_rmi4_data, fb_notif);
|
||||
|
||||
if (evdata && evdata->data && rmi4_data
|
||||
&& rmi4_data->i2c_client && event == FB_EVENT_BLANK) {
|
||||
blank = evdata->data;
|
||||
switch (*blank) {
|
||||
case FB_BLANK_UNBLANK:
|
||||
case FB_BLANK_NORMAL:
|
||||
case FB_BLANK_VSYNC_SUSPEND:
|
||||
case FB_BLANK_HSYNC_SUSPEND:
|
||||
synaptics_rmi4_resume(
|
||||
&(rmi4_data->input_dev->dev));
|
||||
break;
|
||||
default:
|
||||
case FB_BLANK_POWERDOWN:
|
||||
synaptics_rmi4_suspend(
|
||||
&(rmi4_data->input_dev->dev));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#elif defined(CONFIG_HAS_EARLYSUSPEND)
|
||||
|
||||
/**
|
||||
* synaptics_rmi4_early_suspend()
|
||||
|
@ -4537,7 +4586,7 @@ static void synaptics_rmi4_late_resume(struct early_suspend *h)
|
|||
|
||||
return;
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
/**
|
||||
* synaptics_rmi4_suspend()
|
||||
|
@ -4595,7 +4644,7 @@ static int synaptics_rmi4_resume(struct device *dev)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
if (synaptics_rmi4_start_device(rmi4_data))
|
||||
if (synaptics_rmi4_start_device(rmi4_data) < 0)
|
||||
tsp_debug_err(true, &rmi4_data->i2c_client->dev,
|
||||
"%s: Failed to start device\n", __func__);
|
||||
}
|
||||
|
@ -4605,11 +4654,12 @@ static int synaptics_rmi4_resume(struct device *dev)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct dev_pm_ops synaptics_rmi4_dev_pm_ops = {
|
||||
#if (!defined(CONFIG_FB) && !defined(CONFIG_HAS_EARLYSUSPEND))
|
||||
.suspend = synaptics_rmi4_suspend,
|
||||
.resume = synaptics_rmi4_resume,
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,9 +25,13 @@
|
|||
#include <linux/i2c/synaptics_rmi.h>
|
||||
#include <linux/cdev.h>
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#if defined(CONFIG_FB)
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/fb.h>
|
||||
#elif defined(CONFIG_HAS_EARLYSUSPEND)
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SEC_DEBUG_TSP_LOG
|
||||
#include <linux/sec_debug.h>
|
||||
#endif
|
||||
|
@ -1375,7 +1379,9 @@ struct synaptics_rmi4_data {
|
|||
struct mutex rmi4_io_ctrl_mutex;
|
||||
struct mutex rmi4_reflash_mutex;
|
||||
struct timer_list f51_finger_timer;
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#if defined(CONFIG_FB)
|
||||
struct notifier_block fb_notif;
|
||||
#elif defined(CONFIG_HAS_EARLYSUSPEND)
|
||||
struct early_suspend early_suspend;
|
||||
#endif
|
||||
const char *firmware_name;
|
||||
|
|
Loading…
Reference in New Issue