mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
input: touchscreen: chipone_9551r add early_suspend
Signed-off-by: Binyuan Lan <lby@rock-chips.com> Change-Id: Ic0ee4a18af52e785f0d4001b3c55e36ae4b8eaed
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
//#define CFG_CTS_CASCADE_SUPPORTED
|
||||
|
||||
/* Support RK dsi extcon notifier for suspend and resume */
|
||||
#define CONFIG_PM_DSI_EXTCON_NOTIFIER
|
||||
//#define CONFIG_PM_DSI_EXTCON_NOTIFIER
|
||||
|
||||
/* Support both finger and stylus protocol, 11 */
|
||||
// #define CFG_CTS_FINGER_STYLUS_SUPPORTED
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#define CTS_CORE_H
|
||||
|
||||
#include "cts_config.h"
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
|
||||
enum cts_dev_hw_reg {
|
||||
CTS_DEV_HW_REG_HARDWARE_ID = 0x70000u,
|
||||
@@ -529,6 +532,10 @@ struct chipone_ts_data {
|
||||
struct extcon_dev *edev;
|
||||
struct notifier_block extcon_nb;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
struct early_suspend early_suspend;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*static inline u32 get_unaligned_le24(const void *p)
|
||||
|
||||
@@ -372,6 +372,26 @@ static int ts_extcon_notifier(struct notifier_block *self,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
/* earlysuspend module the suspend/resume procedure */
|
||||
static void cts_ts_early_suspend(struct early_suspend *h)
|
||||
{
|
||||
struct chipone_ts_data *cts_data = container_of(h, struct chipone_ts_data, early_suspend);
|
||||
|
||||
pr_info("%s %d\n", __func__, __LINE__);
|
||||
flush_work(&cts_data->ts_resume_work);
|
||||
cts_suspend(cts_data);
|
||||
}
|
||||
|
||||
static void cts_ts_late_resume(struct early_suspend *h)
|
||||
{
|
||||
struct chipone_ts_data *cts_data = container_of(h, struct chipone_ts_data, early_suspend);
|
||||
|
||||
pr_info("%s %d\n", __func__, __LINE__);
|
||||
queue_work(cts_data->workqueue, &cts_data->ts_resume_work);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CTS_I2C_HOST
|
||||
static int cts_driver_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
@@ -615,6 +635,13 @@ static int cts_driver_probe(struct spi_device *client)
|
||||
#endif /* CONFIG_MTK_PLATFORM */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
cts_data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
|
||||
cts_data->early_suspend.suspend = cts_ts_early_suspend;
|
||||
cts_data->early_suspend.resume = cts_ts_late_resume;
|
||||
register_early_suspend(&cts_data->early_suspend);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_DSI_EXTCON_NOTIFIER
|
||||
cts_data->edev = extcon_get_edev_by_phandle(&client->dev, 0);
|
||||
if (IS_ERR(cts_data->edev)) {
|
||||
@@ -756,6 +783,10 @@ static void cts_driver_remove(struct spi_device *client)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
unregister_early_suspend(&cts_data->early_suspend);
|
||||
#endif
|
||||
|
||||
cts_tool_deinit(cts_data);
|
||||
|
||||
cts_sysfs_remove_device(&client->dev);
|
||||
|
||||
Reference in New Issue
Block a user