Skip to content

Instantly share code, notes, and snippets.

@GreyElaina
Last active November 21, 2025 12:38
Show Gist options
  • Select an option

  • Save GreyElaina/7a4c7ff4189622ed84d28e8dbc79449b to your computer and use it in GitHub Desktop.

Select an option

Save GreyElaina/7a4c7ff4189622ed84d28e8dbc79449b to your computer and use it in GitHub Desktop.
diff --git a/motorola/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.c b/motorola/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.c
index 4984ec2..baa614a 100644
--- a/motorola/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.c
+++ b/motorola/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.c
@@ -1013,6 +1013,11 @@ static int goodix_ts_mmi_charger_mode(struct device *dev, int mode)
GET_GOODIX_DATA(dev);
+ if (!core_data->power_on) {
+ ts_info("skip charger mode update, touch power is off\n");
+ return -EAGAIN;
+ }
+
/* 5000ms timeout */
while (core_data->init_stage < CORE_INIT_STAGE2 && timeout--)
msleep(100);
@@ -1373,6 +1378,11 @@ static int goodix_ts_mmi_update_fps_mode(struct device *dev, int mode) {
GET_GOODIX_DATA(dev);
+ if (!core_data->power_on) {
+ ts_info("skip fod update, touch power is off\n");
+ return -EAGAIN;
+ }
+
core_data->fod_enable = (mode >0) ? 0x01 : 0x00;
ts_info(" update_fps_mode %s:%d\n", (mode > 0) ? "enable" : "disable", mode);
return 0;
diff --git a/motorola/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c b/motorola/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c
index d90daa4..a7e5435 100644
--- a/motorola/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c
+++ b/motorola/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c
@@ -298,23 +298,6 @@ static void ts_mmi_queued_resume(struct ts_mmi_dev *touch_cdev)
TRY_TO_CALL(pre_resume);
- /* touch IC baseline update always done when IC resume.
- * So touchscreen class need let vendor driver know baseline update work need to be done
- * or not before vendor resume is called.
- */
- if (touch_cdev->pdata.fps_detection) {
- if (touch_cdev->fps_state) {
- TRY_TO_CALL(update_baseline, TS_MMI_UPDATE_BASELINE_OFF);
- touch_cdev->delay_baseline_update = true;
- }
- if (!touch_cdev->fps_state) {
- TRY_TO_CALL(update_baseline, TS_MMI_UPDATE_BASELINE_ON);
- touch_cdev->delay_baseline_update = false;
- }
- }
- if (touch_cdev->pdata.fod_detection) {
- TRY_TO_CALL(update_fod_mode, touch_cdev->fps_state);
- }
if (NEED_TO_SET_POWER) {
/* power turn on in PANEL_EVENT_PRE_DISPLAY_ON.
* IC need some time to boot up.
@@ -338,6 +321,23 @@ static void ts_mmi_queued_resume(struct ts_mmi_dev *touch_cdev)
TRY_TO_CALL(drv_irq, TS_MMI_IRQ_ON);
}
+ /* touch IC baseline update always done when IC resume.
+ * Make sure the IC is ready before we request vendor specific operations.
+ */
+ if (touch_cdev->pdata.fps_detection) {
+ if (touch_cdev->fps_state) {
+ TRY_TO_CALL(update_baseline, TS_MMI_UPDATE_BASELINE_OFF);
+ touch_cdev->delay_baseline_update = true;
+ }
+ if (!touch_cdev->fps_state) {
+ TRY_TO_CALL(update_baseline, TS_MMI_UPDATE_BASELINE_ON);
+ touch_cdev->delay_baseline_update = false;
+ }
+ }
+ if (touch_cdev->pdata.fod_detection) {
+ TRY_TO_CALL(update_fod_mode, touch_cdev->fps_state);
+ }
+
if (IS_DEEPSLEEP_MODE)
TRY_TO_CALL(drv_irq, TS_MMI_IRQ_ON);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment