static void tegra_onetouch_early_suspend(struct early_suspend *es) { struct tegra_onetouch_driver_data *onetouch; onetouch = container_of(es, struct tegra_onetouch_driver_data, early_suspend); printk("[ONETOUCH] tegra_onetouch_early_suspend\n"); if (onetouch && onetouch->hOneTouchDevice) { #if defined(CONFIG_MACH_STAR_SKT_REV_E) || defined(CONFIG_MACH_STAR_SKT_REV_F) NvOdmOsMutexLock(onetouch->hMutex); NvOdmOneTouchInterruptMask(onetouch->hOneTouchDevice, NV_TRUE); if (!NvOdmOneTouchSleepMode(onetouch->hOneTouchDevice, NV_TRUE)) pr_err("[ONETOUCH] tegra_onetouch_suspend: fail onetouch sleepmode\n"); NvOdmOsMutexUnlock(onetouch->hMutex); #else NvOdmOneTouchInterruptMask(onetouch->hOneTouchDevice, NV_TRUE); NvOdmOsSleepMS(50); if (!NvOdmOneTouchSleepMode(onetouch->hOneTouchDevice, NV_TRUE)) pr_err("[ONETOUCH] tegra_onetouch_suspend: fail onetouch sleepmode\n"); #endif } else { pr_err("[ONETOUCH] tegra_touch_early_suspend: NULL handles passed\n"); } return; }
static int tegra_onetouch_remove(struct platform_device *pdev) { struct tegra_onetouch_driver_data *onetouch = platform_get_drvdata(pdev); #ifdef CONFIG_HAS_EARLYSUSPEND unregister_early_suspend(&onetouch->early_suspend); #endif onetouch->shutdown = 1; NvOdmOneTouchInterruptMask(onetouch->hOneTouchDevice, NV_TRUE); NvOdmOsSleepMS(50); NvOdmOsSemaphoreDestroy(onetouch->semaphore); #if defined(CONFIG_MACH_STAR_SKT_REV_E) || defined(CONFIG_MACH_STAR_SKT_REV_F) NvOdmOsMutexDestroy(onetouch->hMutex); #endif NvOdmOneTouchDeviceClose(onetouch->hOneTouchDevice); /* FIXME How to destroy the thread? Maybe we should use workqueues? */ input_unregister_device(onetouch->input_dev); /* NvOsSemaphoreDestroy(onetouch->semaphore); */ input_unregister_device(onetouch->input_dev); kfree(onetouch); return 0; }
static void tegra_onetouch_shutdown(struct platform_device *pdev) { struct tegra_onetouch_driver_data *onetouch = platform_get_drvdata(pdev); printk("[ONETOUCH] tegra_onetouch_shutdown() \n"); #ifdef CONFIG_HAS_EARLYSUSPEND unregister_early_suspend(&onetouch->early_suspend); #endif onetouch->shutdown = 1; NvOdmOneTouchInterruptMask(onetouch->hOneTouchDevice, NV_TRUE); NvOdmOsSleepMS(50); NvOdmOsSemaphoreDestroy(onetouch->semaphore); #if defined(CONFIG_MACH_STAR_SKT_REV_E) || defined(CONFIG_MACH_STAR_SKT_REV_F) NvOdmOsMutexDestroy(onetouch->hMutex); #endif NvOdmOneTouchDeviceClose(onetouch->hOneTouchDevice); input_unregister_device(onetouch->input_dev); kfree(onetouch); return; }
static void tegra_onetouch_late_resume(struct early_suspend *es) { struct tegra_onetouch_driver_data *onetouch; onetouch = container_of(es, struct tegra_onetouch_driver_data, early_suspend); printk("[ONETOUCH] tegra_onetouch_late_resume\n"); if (onetouch && onetouch->hOneTouchDevice) { if (!NvOdmOneTouchSleepMode(onetouch->hOneTouchDevice, NV_FALSE)) { NvOdmOneTouchDeviceClose(onetouch->hOneTouchDevice); NvOdmOneTouchDeviceOpen(&onetouch->hOneTouchDevice, &onetouch->semaphore); } else NvOdmOneTouchInterruptMask(onetouch->hOneTouchDevice, NV_FALSE); } else { pr_err("[ONETOUCH] tegra_touch_late_resume: NULL handles passed\n"); } }
static void tegra_onetouch_early_suspend(struct early_suspend *es) { struct tegra_onetouch_driver_data *onetouch; onetouch = container_of(es, struct tegra_onetouch_driver_data, early_suspend); printk("[ONETOUCH] tegra_onetouch_early_suspend\n"); if (onetouch && onetouch->hOneTouchDevice) { NvOdmOneTouchInterruptMask(onetouch->hOneTouchDevice, NV_TRUE); NvOdmOsSleepMS(50); if(onetouch->isReset){ NvOdmOsSleepMS(50); onetouch->isReset = 0; } if (!NvOdmOneTouchSleepMode(onetouch->hOneTouchDevice, NV_TRUE)) pr_err("[ONETOUCH] tegra_onetouch_suspend: fail onetouch sleepmode\n"); } else { pr_err("[ONETOUCH] tegra_touch_early_suspend: NULL handles passed\n"); } return; }