//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2006-2012 MStar Semiconductor, Inc. // All rights reserved. // // Unless otherwise stipulated in writing, any and all information contained // herein regardless in any format shall remain the sole proprietary of // MStar Semiconductor Inc. and be kept in strict confidence // (??MStar Confidential Information??) by the recipient. // Any unauthorized act including without limitation unauthorized disclosure, // copying, use, reproduction, sale, distribution, modification, disassembling, // reverse engineering and compiling of the contents of MStar Confidential // Information is unlawful and strictly prohibited. MStar hereby reserves the // rights to any and all damages, losses, costs and expenses resulting therefrom. // //////////////////////////////////////////////////////////////////////////////// /** * * @file mstar_drv_platform_porting_layer.c * * @brief This file defines the interface of touch screen * * @version v2.2.0.0 * */ /*=============================================================*/ // INCLUDE FILE /*=============================================================*/ #include "mstar_drv_platform_porting_layer.h" #include "mstar_drv_ic_fw_porting_layer.h" #include "mstar_drv_platform_interface.h" /*=============================================================*/ // EXTREN VARIABLE DECLARATION /*=============================================================*/ #ifdef CONFIG_ENABLE_FIRMWARE_DATA_LOG extern struct kset *g_TouchKSet; extern struct kobject *g_TouchKObj; #endif //CONFIG_ENABLE_FIRMWARE_DATA_LOG #ifdef CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM extern struct tpd_device *tpd; #endif //CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) extern struct regulator *g_ReguVdd; #endif /*=============================================================*/ // LOCAL VARIABLE DEFINITION /*=============================================================*/ struct mutex g_Mutex; static struct work_struct _gFingerTouchWork; #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) static struct early_suspend _gEarlySuspend; #endif #ifdef CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM #ifndef CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM static DECLARE_WAIT_QUEUE_HEAD(_gWaiter); static struct task_struct *_gThread = NULL; static int _gTpdFlag = 0; #endif //CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM #endif //CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM /*=============================================================*/ // GLOBAL VARIABLE DEFINITION /*=============================================================*/ struct input_dev *g_InputDevice = NULL; static int _gIrq = -1; /*=============================================================*/ // LOCAL FUNCTION DEFINITION /*=============================================================*/ /* read data through I2C then report data to input sub-system when interrupt occurred */ static void _DrvPlatformLyrFingerTouchDoWork(struct work_struct *pWork) { DBG("*** %s() ***\n", __func__); mutex_lock(&g_Mutex); DrvIcFwLyrHandleFingerTouch(NULL, 0); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) // enable_irq(MS_TS_MSG_IC_GPIO_INT); enable_irq(_gIrq); #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) mt_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM); #endif mutex_unlock(&g_Mutex); } #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) /* The interrupt service routine will be triggered when interrupt occurred */ static irqreturn_t _DrvPlatformLyrFingerTouchInterruptHandler(s32 nIrq, void *pDeviceId) { DBG("*** %s() ***\n", __func__); // disable_irq_nosync(MS_TS_MSG_IC_GPIO_INT); disable_irq_nosync(_gIrq); schedule_work(&_gFingerTouchWork); return IRQ_HANDLED; } #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) static void _DrvPlatformLyrFingerTouchInterruptHandler(void) { #ifdef CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM mt_eint_mask(CUST_EINT_TOUCH_PANEL_NUM); schedule_work(&_gFingerTouchWork); #else mt_eint_mask(CUST_EINT_TOUCH_PANEL_NUM); _gTpdFlag = 1; wake_up_interruptible(&_gWaiter); #endif //CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM } static int _DrvPlatformLyrFingerTouchHandler(void *pUnUsed) { struct sched_param param = { .sched_priority = RTPM_PRIO_TPD }; sched_setscheduler(current, SCHED_RR, ¶m); do { set_current_state(TASK_INTERRUPTIBLE); wait_event_interruptible(_gWaiter, _gTpdFlag != 0); _gTpdFlag = 0; set_current_state(TASK_RUNNING); mutex_lock(&g_Mutex); DrvIcFwLyrHandleFingerTouch(NULL, 0); mutex_unlock(&g_Mutex); mt_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM); } while (!kthread_should_stop()); return 0; } #endif /*=============================================================*/ // GLOBAL FUNCTION DEFINITION /*=============================================================*/ #ifdef CONFIG_ENABLE_REGULATOR_POWER_ON void DrvPlatformLyrTouchDeviceRegulatorPowerOn(void) { #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) s32 nRetVal = 0; DBG("*** %s() ***\n", __func__); nRetVal = regulator_set_voltage(g_ReguVdd, 2800000, 2800000); // For specific SPRD BB chip(ex. SC7715) or QCOM BB chip, need to enable this function call for correctly power on Touch IC. if (nRetVal) { DBG("Could not set to 2800mv.\n"); } regulator_enable(g_ReguVdd); mdelay(20); //mdelay(100); #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) hwPowerOn(MT6323_POWER_LDO_VGP1, VOL_2800, "TP"); // For specific MTK BB chip(ex. MT6582), need to enable this function call for correctly power on Touch IC. #endif } #endif //CONFIG_ENABLE_REGULATOR_POWER_ON void DrvPlatformLyrTouchDevicePowerOn(void) { DBG("*** %s() ***\n", __func__); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) gpio_direction_output(MS_TS_MSG_IC_GPIO_RST, 1); // gpio_set_value(MS_TS_MSG_IC_GPIO_RST, 1); // mdelay(100); gpio_set_value(MS_TS_MSG_IC_GPIO_RST, 0); mdelay(10); gpio_set_value(MS_TS_MSG_IC_GPIO_RST, 1); mdelay(50); #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) mt_set_gpio_mode(MS_TS_MSG_IC_GPIO_RST, GPIO_CTP_RST_PIN_M_GPIO); mt_set_gpio_dir(MS_TS_MSG_IC_GPIO_RST, GPIO_DIR_OUT); mt_set_gpio_out(MS_TS_MSG_IC_GPIO_RST, GPIO_OUT_ZERO); #ifdef TPD_CLOSE_POWER_IN_SLEEP hwPowerDown(TPD_POWER_SOURCE, "TP"); mdelay(100); hwPowerOn(TPD_POWER_SOURCE, VOL_2800, "TP"); mdelay(10); // reset pulse #endif //TPD_CLOSE_POWER_IN_SLEEP mt_set_gpio_out(MS_TS_MSG_IC_GPIO_RST, GPIO_OUT_ONE); mdelay(180); // wait stable #endif } void DrvPlatformLyrTouchDevicePowerOff(void) { DBG("*** %s() ***\n", __func__); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) // gpio_direction_output(MS_TS_MSG_IC_GPIO_RST, 0); gpio_set_value(MS_TS_MSG_IC_GPIO_RST, 0); #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) mt_set_gpio_mode(MS_TS_MSG_IC_GPIO_RST, GPIO_CTP_RST_PIN_M_GPIO); mt_set_gpio_dir(MS_TS_MSG_IC_GPIO_RST, GPIO_DIR_OUT); mt_set_gpio_out(MS_TS_MSG_IC_GPIO_RST, GPIO_OUT_ZERO); #ifdef TPD_CLOSE_POWER_IN_SLEEP hwPowerDown(TPD_POWER_SOURCE, "TP"); #endif //TPD_CLOSE_POWER_IN_SLEEP #endif } void DrvPlatformLyrTouchDeviceResetHw(void) { DBG("*** %s() ***\n", __func__); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) gpio_direction_output(MS_TS_MSG_IC_GPIO_RST, 1); // gpio_set_value(MS_TS_MSG_IC_GPIO_RST, 1); gpio_set_value(MS_TS_MSG_IC_GPIO_RST, 0); mdelay(10); gpio_set_value(MS_TS_MSG_IC_GPIO_RST, 1); mdelay(50); #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) mt_set_gpio_mode(MS_TS_MSG_IC_GPIO_RST, GPIO_CTP_RST_PIN_M_GPIO); mt_set_gpio_dir(MS_TS_MSG_IC_GPIO_RST, GPIO_DIR_OUT); mt_set_gpio_out(MS_TS_MSG_IC_GPIO_RST, GPIO_OUT_ONE); mdelay(10); mt_set_gpio_mode(MS_TS_MSG_IC_GPIO_RST, GPIO_CTP_RST_PIN_M_GPIO); mt_set_gpio_dir(MS_TS_MSG_IC_GPIO_RST, GPIO_DIR_OUT); mt_set_gpio_out(MS_TS_MSG_IC_GPIO_RST, GPIO_OUT_ZERO); mdelay(50); mt_set_gpio_mode(MS_TS_MSG_IC_GPIO_RST, GPIO_CTP_RST_PIN_M_GPIO); mt_set_gpio_dir(MS_TS_MSG_IC_GPIO_RST, GPIO_DIR_OUT); mt_set_gpio_out(MS_TS_MSG_IC_GPIO_RST, GPIO_OUT_ONE); mdelay(50); #endif } void DrvPlatformLyrDisableFingerTouchReport(void) { DBG("*** %s() ***\n", __func__); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) // disable_irq(MS_TS_MSG_IC_GPIO_RST); disable_irq(_gIrq); #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) mt_eint_mask(CUST_EINT_TOUCH_PANEL_NUM); #endif } void DrvPlatformLyrEnableFingerTouchReport(void) { DBG("*** %s() ***\n", __func__); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) // enable_irq(MS_TS_MSG_IC_GPIO_RST); enable_irq(_gIrq); #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) mt_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM); #endif } void DrvPlatformLyrFingerTouchPressed(s32 nX, s32 nY, s32 nPressure, s32 nId) { DBG("*** %s() ***\n", __func__); DBG("point touch pressed\n"); input_report_key(g_InputDevice, BTN_TOUCH, 1); #if defined(CONFIG_ENABLE_CHIP_MSG26XXM) input_report_abs(g_InputDevice, ABS_MT_TRACKING_ID, nId); #endif //CONFIG_ENABLE_CHIP_MSG26XXM input_report_abs(g_InputDevice, ABS_MT_TOUCH_MAJOR, 1); input_report_abs(g_InputDevice, ABS_MT_WIDTH_MAJOR, 1); input_report_abs(g_InputDevice, ABS_MT_POSITION_X, nX); input_report_abs(g_InputDevice, ABS_MT_POSITION_Y, nY); input_mt_sync(g_InputDevice); } void DrvPlatformLyrFingerTouchReleased(s32 nX, s32 nY) { DBG("*** %s() ***\n", __func__); DBG("point touch released\n"); input_report_key(g_InputDevice, BTN_TOUCH, 0); input_mt_sync(g_InputDevice); } s32 DrvPlatformLyrInputDeviceInitialize(struct i2c_client *pClient) { s32 nRetVal = 0; DBG("*** %s() ***\n", __func__); mutex_init(&g_Mutex); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) /* allocate an input device */ g_InputDevice = input_allocate_device(); if (g_InputDevice == NULL) { DBG("*** input device allocation failed ***\n"); return -ENOMEM; } g_InputDevice->name = MSG_TP_IC_NAME; g_InputDevice->phys = "I2C"; g_InputDevice->dev.parent = &pClient->dev; g_InputDevice->id.bustype = BUS_I2C; /* set the supported event type for input device */ __set_bit(EV_KEY, g_InputDevice->evbit); __set_bit(EV_ABS, g_InputDevice->evbit); __set_bit(EV_SYN, g_InputDevice->evbit); //__set_bit(BTN_TOUCH, g_InputDevice->keybit); __set_bit(ABS_MT_TOUCH_MAJOR, g_InputDevice->absbit); __set_bit(ABS_MT_POSITION_X, g_InputDevice->absbit); __set_bit(ABS_MT_POSITION_Y, g_InputDevice->absbit); __set_bit(ABS_MT_WIDTH_MAJOR, g_InputDevice->absbit); __set_bit(KEY_MENU, g_InputDevice->keybit); __set_bit(KEY_BACK, g_InputDevice->keybit); __set_bit(KEY_HOME, g_InputDevice->keybit); #ifdef CONFIG_ENABLE_GESTURE_WAKEUP input_set_capability(g_InputDevice, EV_KEY, KEY_POWER); input_set_capability(g_InputDevice, EV_KEY, KEY_UP); input_set_capability(g_InputDevice, EV_KEY, KEY_DOWN); input_set_capability(g_InputDevice, EV_KEY, KEY_LEFT); input_set_capability(g_InputDevice, EV_KEY, KEY_RIGHT); input_set_capability(g_InputDevice, EV_KEY, KEY_W); input_set_capability(g_InputDevice, EV_KEY, KEY_Z); input_set_capability(g_InputDevice, EV_KEY, KEY_V); input_set_capability(g_InputDevice, EV_KEY, KEY_O); input_set_capability(g_InputDevice, EV_KEY, KEY_M); input_set_capability(g_InputDevice, EV_KEY, KEY_C); input_set_capability(g_InputDevice, EV_KEY, KEY_E); input_set_capability(g_InputDevice, EV_KEY, KEY_S); #endif //CONFIG_ENABLE_GESTURE_WAKEUP /* #ifdef CONFIG_TP_HAVE_KEY set_bit(TOUCH_KEY_MENU, g_InputDevice->keybit); //Menu set_bit(TOUCH_KEY_HOME, g_InputDevice->keybit); //Home set_bit(TOUCH_KEY_BACK, g_InputDevice->keybit); //Back set_bit(TOUCH_KEY_SEARCH, g_InputDevice->keybit); //Search #endif */ #if defined(CONFIG_ENABLE_CHIP_MSG26XXM) input_set_abs_params(g_InputDevice, ABS_MT_TRACKING_ID, 0, 255, 0, 0); #endif //CONFIG_ENABLE_CHIP_MSG26XXM input_set_abs_params(g_InputDevice, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); input_set_abs_params(g_InputDevice, ABS_MT_WIDTH_MAJOR, 0, 15, 0, 0); input_set_abs_params(g_InputDevice, ABS_MT_POSITION_X, 0, TOUCH_SCREEN_X_MAX, 0, 0); input_set_abs_params(g_InputDevice, ABS_MT_POSITION_Y, 0, TOUCH_SCREEN_Y_MAX, 0, 0); /* register the input device to input sub-system */ nRetVal = input_register_device(g_InputDevice); if (nRetVal < 0) { DBG("*** Unable to register touch input device ***\n"); } #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) g_InputDevice = tpd->dev; // g_InputDevice->name = pClient->name; g_InputDevice->phys = "I2C"; g_InputDevice->dev.parent = &pClient->dev; g_InputDevice->id.bustype = BUS_I2C; /* set the supported event type for input device */ set_bit(EV_ABS, g_InputDevice->evbit); set_bit(EV_SYN, g_InputDevice->evbit); set_bit(EV_KEY, g_InputDevice->evbit); set_bit(BTN_TOUCH, g_InputDevice->keybit); set_bit(INPUT_PROP_DIRECT, g_InputDevice->propbit); #ifdef CONFIG_ENABLE_GESTURE_WAKEUP input_set_capability(g_InputDevice, EV_KEY, KEY_POWER); input_set_capability(g_InputDevice, EV_KEY, KEY_UP); input_set_capability(g_InputDevice, EV_KEY, KEY_DOWN); input_set_capability(g_InputDevice, EV_KEY, KEY_LEFT); input_set_capability(g_InputDevice, EV_KEY, KEY_RIGHT); input_set_capability(g_InputDevice, EV_KEY, KEY_W); input_set_capability(g_InputDevice, EV_KEY, KEY_Z); input_set_capability(g_InputDevice, EV_KEY, KEY_V); input_set_capability(g_InputDevice, EV_KEY, KEY_O); input_set_capability(g_InputDevice, EV_KEY, KEY_M); input_set_capability(g_InputDevice, EV_KEY, KEY_C); input_set_capability(g_InputDevice, EV_KEY, KEY_E); input_set_capability(g_InputDevice, EV_KEY, KEY_S); #endif //CONFIG_ENABLE_GESTURE_WAKEUP /* #ifdef CONFIG_TP_HAVE_KEY set_bit(TOUCH_KEY_MENU, g_InputDevice->keybit); //Menu set_bit(TOUCH_KEY_HOME, g_InputDevice->keybit); //Home set_bit(TOUCH_KEY_BACK, g_InputDevice->keybit); //Back set_bit(TOUCH_KEY_SEARCH, g_InputDevice->keybit); //Search #endif */ #if defined(CONFIG_ENABLE_CHIP_MSG26XXM) input_set_abs_params(g_InputDevice, ABS_MT_TRACKING_ID, 0, 255, 0, 0); #endif //CONFIG_ENABLE_CHIP_MSG26XXM input_set_abs_params(g_InputDevice, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); input_set_abs_params(g_InputDevice, ABS_MT_WIDTH_MAJOR, 0, 15, 0, 0); input_set_abs_params(g_InputDevice, ABS_MT_POSITION_X, 0, TOUCH_SCREEN_X_MAX, 0, 0); input_set_abs_params(g_InputDevice, ABS_MT_POSITION_Y, 0, TOUCH_SCREEN_Y_MAX, 0, 0); #endif return nRetVal; } s32 DrvPlatformLyrTouchDeviceRequestGPIO(void) { s32 nRetVal = 0; DBG("*** %s() ***\n", __func__); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) nRetVal = gpio_request(MS_TS_MSG_IC_GPIO_RST, "C_TP_RST"); if (nRetVal < 0) { DBG("*** Failed to request GPIO %d, error %d ***\n", MS_TS_MSG_IC_GPIO_RST, nRetVal); } nRetVal = gpio_request(MS_TS_MSG_IC_GPIO_INT, "C_TP_INT"); if (nRetVal < 0) { DBG("*** Failed to request GPIO %d, error %d ***\n", MS_TS_MSG_IC_GPIO_INT, nRetVal); } #endif return nRetVal; } s32 DrvPlatformLyrTouchDeviceRegisterFingerTouchInterruptHandler(void) { s32 nRetVal = 0; DBG("*** %s() ***\n", __func__); if (DrvIcFwLyrIsRegisterFingerTouchInterruptHandler()) { #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) /* initialize the finger touch work queue */ INIT_WORK(&_gFingerTouchWork, _DrvPlatformLyrFingerTouchDoWork); _gIrq = gpio_to_irq(MS_TS_MSG_IC_GPIO_INT); /* request an irq and register the isr */ nRetVal = request_irq(_gIrq/*MS_TS_MSG_IC_GPIO_INT*/, _DrvPlatformLyrFingerTouchInterruptHandler, IRQF_TRIGGER_RISING /* | IRQF_NO_SUSPEND *//* IRQF_TRIGGER_FALLING */, "msg2xxx", NULL); if (nRetVal != 0) { DBG("*** Unable to claim irq %d; error %d ***\n", MS_TS_MSG_IC_GPIO_INT, nRetVal); } #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) mt_set_gpio_mode(MS_TS_MSG_IC_GPIO_INT, GPIO_CTP_EINT_PIN_M_EINT); mt_set_gpio_dir(MS_TS_MSG_IC_GPIO_INT, GPIO_DIR_IN); mt_set_gpio_pull_enable(MS_TS_MSG_IC_GPIO_INT, GPIO_PULL_ENABLE); mt_set_gpio_pull_select(MS_TS_MSG_IC_GPIO_INT, GPIO_PULL_UP); mt_eint_set_hw_debounce(CUST_EINT_TOUCH_PANEL_NUM, CUST_EINT_TOUCH_PANEL_DEBOUNCE_CN); mt_eint_registration(CUST_EINT_TOUCH_PANEL_NUM, EINTF_TRIGGER_RISING, _DrvPlatformLyrFingerTouchInterruptHandler, 1); mt_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM); #ifdef CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM /* initialize the finger touch work queue */ INIT_WORK(&_gFingerTouchWork, _DrvPlatformLyrFingerTouchDoWork); #else _gThread = kthread_run(_DrvPlatformLyrFingerTouchHandler, 0, TPD_DEVICE); if (IS_ERR(_gThread)) { nRetVal = PTR_ERR(_gThread); DBG("Failed to create kernel thread: %d\n", nRetVal); } #endif //CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM #endif } return nRetVal; } void DrvPlatformLyrTouchDeviceRegisterEarlySuspend(void) { DBG("*** %s() ***\n", __func__); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) _gEarlySuspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN; _gEarlySuspend.suspend = MsDrvInterfaceTouchDeviceSuspend; _gEarlySuspend.resume = MsDrvInterfaceTouchDeviceResume; register_early_suspend(&_gEarlySuspend); #endif } /* remove function is triggered when the input device is removed from input sub-system */ s32 DrvPlatformLyrTouchDeviceRemove(struct i2c_client *pClient) { DBG("*** %s() ***\n", __func__); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) || defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) // free_irq(MS_TS_MSG_IC_GPIO_INT, g_InputDevice); free_irq(_gIrq, g_InputDevice); gpio_free(MS_TS_MSG_IC_GPIO_INT); gpio_free(MS_TS_MSG_IC_GPIO_RST); input_unregister_device(g_InputDevice); #endif #ifdef CONFIG_ENABLE_FIRMWARE_DATA_LOG kset_unregister(g_TouchKSet); kobject_put(g_TouchKObj); #endif //CONFIG_ENABLE_FIRMWARE_DATA_LOG return 0; } void DrvPlatformLyrSetIicDataRate(struct i2c_client *pClient, u32 nIicDataRate) { DBG("*** %s() nIicDataRate = %d ***\n", __func__, nIicDataRate); #if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) // TODO : Please FAE colleague to confirm with customer device driver engineer for how to set i2c data rate on SPRD platform //sprd_i2c_ctl_chg_clk(pClient->adapter->nr, nIicDataRate); //mdelay(100); #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM) // TODO : Please FAE colleague to confirm with customer device driver engineer for how to set i2c data rate on QCOM platform #elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM) pClient->timing = nIicDataRate/1000; #endif }