diff options
author | Sandeep Patil <sspatil@google.com> | 2020-03-18 22:26:35 -0700 |
---|---|---|
committer | Sandeep Patil <sspatil@google.com> | 2020-03-18 22:26:35 -0700 |
commit | eeb66830c1b9392097aa615bb60b7013c47a2140 (patch) | |
tree | 26c37aebcd83da8245648b298cbc0535fa2c461c | |
parent | d28b5d2e22ec81dc8b4312031dd53076e9daa1d0 (diff) | |
download | fts_touch-eeb66830c1b9392097aa615bb60b7013c47a2140.tar.gz |
GKI: ANDROID: Replace wakeup_source_init w/ wakeup_source_register
This replacement allows for all drivers to have their wakeup sources
show up in /sys/class/wakeup. Starting with Android 12 all wakeup sources
are read out of sysfs (instead of the old debugfs path).
Bug: 129087298
Bug: 151789966
Test: Launch Camera + Take Picture / Record Video
Test: Connect to Wifi Network
Test: Play Youtube Video
Test: USB debugging works
Test: Touchscreen / multi touch works
Test: Audio playback
Test: Battery percentage and power supplies work.
Signed-off-by: Sandeep Patil <sspatil@google.com>
Change-Id: Id03cf07c9271b4a54318908ab881adfed65da653
-rw-r--r-- | fts.c | 25 | ||||
-rw-r--r-- | fts.h | 2 | ||||
-rw-r--r-- | fts_proc.c | 4 |
3 files changed, 18 insertions, 13 deletions
@@ -1505,7 +1505,7 @@ static void touchsim_work(struct work_struct *work) pm_qos_update_request(&info->pm_qos_req, 100); /* Notify the PM core that the wakeup event will take 1 sec */ - __pm_wakeup_event(&info->wakesrc, jiffies_to_msecs(HZ)); + __pm_wakeup_event(info->wakesrc, jiffies_to_msecs(HZ)); /* get the next touch coordinates */ touchsim_refresh_coordinates(touchsim); @@ -3903,7 +3903,7 @@ static irqreturn_t fts_interrupt_handler(int irq, void *handle) /* prevent CPU from entering deep sleep */ pm_qos_update_request(&info->pm_qos_req, 100); - __pm_wakeup_event(&info->wakesrc, jiffies_to_msecs(HZ)); + __pm_wakeup_event(info->wakesrc, jiffies_to_msecs(HZ)); /* Read the first FIFO event and the number of events remaining */ error = fts_writeReadU8UX(regAdd, 0, 0, data, FIFO_EVENT_SIZE, @@ -4851,7 +4851,7 @@ static void fts_resume_work(struct work_struct *work) fts_pinctrl_setup(info, true); - __pm_wakeup_event(&info->wakesrc, jiffies_to_msecs(HZ)); + __pm_wakeup_event(info->wakesrc, jiffies_to_msecs(HZ)); info->resume_bit = 1; @@ -4888,7 +4888,7 @@ static void fts_suspend_work(struct work_struct *work) reinit_completion(&info->bus_resumed); - __pm_stay_awake(&info->wakesrc); + __pm_stay_awake(info->wakesrc); info->resume_bit = 0; @@ -4912,7 +4912,7 @@ static void fts_suspend_work(struct work_struct *work) #endif info->sensor_sleep = true; - __pm_relax(&info->wakesrc); + __pm_relax(info->wakesrc); } /** @}*/ @@ -5569,7 +5569,13 @@ static int fts_probe(struct spi_device *client) pr_info("SET Event Handler:\n"); - wakeup_source_init(&info->wakesrc, "fts_tp"); + info->wakesrc = wakeup_source_register("fts_tp"); + if (!info->wakesrc) { + pr_err("%s: failed to register wakeup source\n", __func__); + error = -ENODEV; + goto ProbeErrorExit_3; + + } info->event_wq = alloc_workqueue("fts-event-queue", WQ_UNBOUND | WQ_HIGHPRI | WQ_CPU_INTENSIVE, 1); if (!info->event_wq) { @@ -5845,9 +5851,9 @@ ProbeErrorExit_5: ProbeErrorExit_4: /* destroy_workqueue(info->fwu_workqueue); */ - wakeup_source_remove(&info->wakesrc); - __pm_relax(&info->wakesrc); + wakeup_source_unregister(info->wakesrc); +ProbeErrorExit_3: fts_pinctrl_get(info, false); fts_enable_reg(info, false); @@ -5914,8 +5920,7 @@ static int fts_remove(struct spi_device *client) /* Remove the work thread */ destroy_workqueue(info->event_wq); - wakeup_source_remove(&info->wakesrc); - __pm_relax(&info->wakesrc); + wakeup_source_unregister(info->wakesrc); if(info->touchsim.wq) destroy_workqueue(info->touchsim.wq); @@ -456,7 +456,7 @@ struct fts_ts_info { int display_refresh_rate; /* Display rate in Hz */ #endif bool sensor_sleep; /* True if suspend called */ - struct wakeup_source wakesrc; /* Wake Lock struct */ + struct wakeup_source *wakesrc; /* Wake Lock struct */ /* input lock */ struct mutex input_report_mutex; /* Mutex for pressure report */ @@ -2876,9 +2876,9 @@ END_DIAGNOSTIC: cmd[1]); res = OK; if (cmd[1]) - __pm_stay_awake(&info->wakesrc); + __pm_stay_awake(info->wakesrc); else - __pm_relax(&info->wakesrc); + __pm_relax(info->wakesrc); } } else { pr_err("Wrong number of parameters!\n"); |