Skip to content

Commit

Permalink
goodix_driver_gt9886: switch to qcom drm notifier
Browse files Browse the repository at this point in the history
* also switch fb notifier api to qcom drm notifier

Signed-off-by: UtsavisGreat <[email protected]>
  • Loading branch information
UtsavBalar1231 authored and penglezos committed May 30, 2020
1 parent dc255c4 commit a64c750
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "goodix_cfg_bin.h"
#include <drm/drm_notifier.h>
#include <linux/msm_drm_notify.h>

extern int goodix_i2c_write(struct goodix_ts_device *dev, unsigned int reg, unsigned char *data, unsigned int len);
extern int goodix_i2c_read(struct goodix_ts_device *dev, unsigned int reg, unsigned char *data, unsigned int len);
Expand Down Expand Up @@ -250,9 +250,9 @@ int goodix_cfg_bin_proc(void *data)
/*complete_all(&goodix_modules.core_comp);*/

#ifdef CONFIG_DRM
core_data->fb_notifier.notifier_call = goodix_ts_fb_notifier_callback;
if (drm_register_client(&core_data->fb_notifier))
ts_err("Failed to register fb notifier client:%d", r);
core_data->msm_drm_notifier.notifier_call = goodix_ts_msm_drm_notifier_callback;
if (msm_drm_register_client(&core_data->msm_drm_notifier))
ts_err("Failed to register drm notifier client:%d", r);
#elif defined(CONFIG_HAS_EARLYSUSPEND)
core_data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
core_data->early_suspend.resume = goodix_ts_lateresume;
Expand Down
29 changes: 14 additions & 15 deletions drivers/input/touchscreen/goodix_driver_gt9886/goodix_ts_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
#include <linux/debugfs.h>
#include <linux/of_irq.h>
#ifdef CONFIG_DRM
#include <drm/drm_notifier.h>
#include <linux/msm_drm_notify.h>
#include <linux/notifier.h>
#include <linux/fb.h>
#endif
#include <linux/uaccess.h>
#include <linux/proc_fs.h>
Expand Down Expand Up @@ -694,7 +693,7 @@ int goodix_ts_unregister_notifier(struct notifier_block *nb)
EXPORT_SYMBOL(goodix_ts_unregister_notifier);

/**
* fb_notifier_call_chain - notify clients of fb_events
* msm_drm_notifier_call_chain - notify clients of msm_drm_notifier
* see enum ts_notify_event in goodix_ts_core.h
*/
int goodix_ts_blocking_notify(enum ts_notify_event evt, void *v)
Expand Down Expand Up @@ -1731,29 +1730,29 @@ static int goodix_bl_state_chg_callback(struct notifier_block *nb, unsigned long

#ifdef CONFIG_DRM
/**
* goodix_ts_fb_notifier_callback - Framebuffer notifier callback
* Called by kernel during framebuffer blanck/unblank phrase
* goodix_ts_msm_drm_notifier_callback - msm drm notifier callback
* Called by kernel during drm blanck/unblank phrase
*/
int goodix_ts_fb_notifier_callback(struct notifier_block *self,
int goodix_ts_msm_drm_notifier_callback(struct notifier_block *self,
unsigned long event, void *data)
{
struct goodix_ts_core *core_data =
container_of(self, struct goodix_ts_core, fb_notifier);
struct drm_notify_data *fb_event = data;
container_of(self, struct goodix_ts_core, msm_drm_notifier);
struct msm_drm_notifier *msm_drm_event = data;
int blank;

if (fb_event && fb_event->data && core_data) {
blank = *(int *)(fb_event->data);
if (msm_drm_event && msm_drm_event->data && core_data) {
blank = *(int *)(msm_drm_event->data);
flush_workqueue(core_data->event_wq);
if (event == DRM_EVENT_BLANK && (blank == DRM_BLANK_POWERDOWN ||
blank == DRM_BLANK_LP1 || blank == DRM_BLANK_LP2)) {
if (event == MSM_DRM_EVENT_BLANK && (blank == MSM_DRM_BLANK_POWERDOWN ||
blank == MSM_DRM_BLANK_LP1 || blank == MSM_DRM_BLANK_LP2)) {
ts_info("touchpanel suspend .....blank=%d\n",blank);
ts_info("touchpanel suspend .....suspend_stat=%d\n", atomic_read(&core_data->suspend_stat));
if (atomic_read(&core_data->suspend_stat))
return 0;
ts_info("touchpanel suspend by %s", blank == DRM_BLANK_POWERDOWN ? "blank" : "doze");
ts_info("touchpanel suspend by %s", blank == MSM_DRM_BLANK_POWERDOWN ? "blank" : "doze");
queue_work(core_data->event_wq, &core_data->suspend_work);
} else if (event == DRM_EVENT_BLANK && blank == DRM_BLANK_UNBLANK) {
} else if (event == MSM_DRM_EVENT_BLANK && blank == MSM_DRM_BLANK_UNBLANK) {
//if (!atomic_read(&core_data->suspend_stat))
ts_info("core_data->suspend_stat = %d\n",atomic_read(&core_data->suspend_stat));
ts_info("touchpanel resume");
Expand Down Expand Up @@ -2523,7 +2522,7 @@ static int goodix_ts_remove(struct platform_device *pdev)
{
struct goodix_ts_core *core_data = platform_get_drvdata(pdev);
#ifdef CONFIG_DRM
drm_unregister_client(&core_data->fb_notifier);
msm_drm_unregister_client(&core_data->msm_drm_notifier);
#endif
//wake_lock_destroy(&core_data->tp_wakelock);
power_supply_unreg_notifier(&core_data->power_supply_notifier);
Expand Down
10 changes: 5 additions & 5 deletions drivers/input/touchscreen/goodix_driver_gt9886/goodix_ts_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <linux/earlysuspend.h>
#endif
#ifdef CONFIG_DRM
#include <drm/drm_notifier.h>
#include <linux/msm_drm_notify.h>
#include <linux/notifier.h>
#include <linux/fb.h>
#endif
Expand Down Expand Up @@ -422,7 +422,7 @@ struct goodix_ts_esd {
* @hw_err: indicate that hw_ops->init() failed
* @ts_notifier: generic notifier
* @ts_esd: esd protector structure
* @fb_notifier: framebuffer notifier
* @msm_drm_notifier: framebuffer notifier
* @early_suspend: early suspend
*/
struct goodix_ts_core {
Expand Down Expand Up @@ -462,7 +462,7 @@ struct goodix_ts_core {
struct proc_dir_entry *tp_fw_version_proc;
struct proc_dir_entry *tp_lockdown_info_proc;
#ifdef CONFIG_DRM
struct notifier_block fb_notifier;
struct notifier_block msm_drm_notifier;
#elif defined(CONFIG_HAS_EARLYSUSPEND)
struct early_suspend early_suspend;
#endif
Expand Down Expand Up @@ -746,7 +746,7 @@ int goodix_ts_irq_enable(struct goodix_ts_core *core_data, bool enable);
struct kobj_type *goodix_get_default_ktype(void);

/**
* fb_notifier_call_chain - notify clients of fb_events
* msm_drm_notifier_call_chain - notify clients of fb_events
* see enum ts_notify_event in goodix_ts_core.h
*/
int goodix_ts_blocking_notify(enum ts_notify_event evt, void *v);
Expand All @@ -773,7 +773,7 @@ int goodix_ts_esd_init(struct goodix_ts_core *core);
int goodix_ts_register_notifier(struct notifier_block *nb);
int goodix_generic_noti_callback(struct notifier_block *self,
unsigned long action, void *data);
int goodix_ts_fb_notifier_callback(struct notifier_block *self,
int goodix_ts_msm_drm_notifier_callback(struct notifier_block *self,
unsigned long event, void *data);
extern void goodix_msg_printf(const char *fmt, ...);
int goodix_gesture_enable(bool enable);
Expand Down

0 comments on commit a64c750

Please sign in to comment.