之前的tpd_driver_t里面的suspend和resume 不跑了,因为定义了CONFIG_DRM_MEDIATEK 宏
所以要进行修改
--- a/kernel-5.10/drivers/input/touchscreen/mediatek_tpd/tlsc6xxx/tlsc6x_main.c
+++ b/kernel-5.10/drivers/input/touchscreen/mediatek_tpd/tlsc6xxx/tlsc6x_main.c
@@ -31,6 +31,12 @@ static u8 tpd_proximity_suspend = 0;
static u8 tpd_proximity_detect = 1;//0-->close ; 1--> far away
static u8 tpd_proximity_detect_prev= 0xff;//0-->close ; 1--> far away
#endif
+#if IS_ENABLED(CONFIG_DRM_MEDIATEK)
+static int xxx_ts_disp_notifier_callback(struct notifier_block *nb,
+ unsigned long value, void *v);
+#endif
@@ -1935,6 +1983,17 @@ static int tpd_probe(struct i2c_client *client, const struct i2c_device_id *id)
return -1;
}
+#if IS_ENABLED(CONFIG_DRM_MEDIATEK)
+ g_tp_drvdata->disp_notifier.notifier_call = xxx_ts_disp_notifier_callback;
+ retval = mtk_disp_notifier_register("Tlsc6x Touch", &g_tp_drvdata->disp_notifier);
+ if (retval) {
+ TPD_DEBUG("Failed to register disp notifier client:%d", retval);
+ goto err_register_disp_notif_failed;
+ }
+#endif
tlsc6x_tpd_reset();
@@ -1995,6 +2057,15 @@ static int tpd_probe(struct i2c_client *client, const struct i2c_device_id *id)
}
#endif
printk("Tlsc6x:%s --!\n", __func__);
+ return 0;
+#if IS_ENABLED(CONFIG_DRM_MEDIATEK)
+err_register_disp_notif_failed:
+ if (mtk_disp_notifier_unregister(&g_tp_drvdata->disp_notifier))
+ TPD_DEBUG("Error occurred while unregistering disp_notifier.\n");
+#endif
@@ -2006,6 +2077,12 @@ static int tpd_remove(struct i2c_client *client)
#ifdef __MSG_DMA_MODE__
msg_dma_release();
#endif
+#if IS_ENABLED(CONFIG_DRM_MEDIATEK)
+ if (mtk_disp_notifier_unregister(&g_tp_drvdata->disp_notifier))
+ TPD_DEBUG("Error occurred while unregistering disp_notifier.");
+#endif
gpio_free(tpd_rst_gpio_number);
@@ -2084,6 +2164,36 @@ static void tpd_suspend(struct device *h)
}
+#if IS_ENABLED(CONFIG_DRM_MEDIATEK)
+static int xxx_ts_disp_notifier_callback(struct notifier_block *nb,
+ unsigned long value, void *v)
+{
+ struct tlsc6x_data *ts = container_of(nb, struct tlsc6x_data, disp_notifier);
+ int *data = (int *)v;
+
+ if (ts && v) {
+ TPD_DEBUG("%s IN", __func__);
+ if (value == MTK_DISP_EARLY_EVENT_BLANK) {
+ if (*data == MTK_DISP_BLANK_POWERDOWN) {
+ tpd_suspend(ts->dev);
+ }
+ } else if (value == MTK_DISP_EVENT_BLANK) {
+ if (*data == MTK_DISP_BLANK_UNBLANK) {
+ tpd_resume(ts->dev);
+ }
+ }
+ TPD_DEBUG("%s OUT", __func__);
+ } else {
+ TPD_DEBUG("Tlsc6x touch IC can not suspend or resume");
+ return -1;
+ }
+
+ return 0;
+}
+#endif
--- a/kernel-5.10/drivers/input/touchscreen/mediatek_tpd/tlsc6xxx/tlsc6x_main.h
+++ b/kernel-5.10/drivers/input/touchscreen/mediatek_tpd/tlsc6xxx/tlsc6x_main.h
@@ -40,10 +40,16 @@
#include <linux/netdevice.h>
#include <../fs/proc/internal.h>
+#if IS_ENABLED(CONFIG_DRM_MEDIATEK)
+#include "../../../../gpu/drm/mediatek/mediatek_v2/mtk_disp_notify.h"
+#endif
+
@@ -87,6 +93,10 @@ struct tlsc6x_data {
int needKeepRamCode;
int esdHelperFreeze;
struct tlsc6x_platform_data *platform_data;
+#if IS_ENABLED(CONFIG_DRM_MEDIATEK)
+ struct device *dev;
+ struct notifier_block disp_notifier;
+#endif
};
标签:disp,kernel,tpd,struct,tp,mtk,endif,+#,notifier
From: https://blog.csdn.net/qq_49102600/article/details/141217367