Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
drivers/input: oplus-ts-v2: cleanup mtk code
Browse files Browse the repository at this point in the history
unused on qcom driver

Change-Id: I14de4b8aa98f88afd38a21101f20e82078397096
Signed-off-by: Vaisakh Murali <[email protected]>
  • Loading branch information
mvaisakh committed Mar 16, 2023
1 parent 80c9116 commit 6521e93
Showing 1 changed file with 2 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@
#include "touch_comon_api/touch_comon_api.h"
#include "touchpanel_healthinfo/touchpanel_healthinfo.h"
#ifndef CONFIG_REMOVE_OPLUS_FUNCTION
#ifdef CONFIG_TOUCHPANEL_MTK_PLATFORM
#include<mt-plat/mtk_boot_common.h>
#else
#include <soc/oplus/system/boot_mode.h>
#endif
#endif

#if IS_ENABLED(CONFIG_DRM_OPLUS_PANEL_NOTIFY)
#include <linux/msm_drm_notify.h>
Expand All @@ -44,26 +40,12 @@
#include <drm/drm_panel.h>
#elif IS_ENABLED(CONFIG_DRM_MSM) || IS_ENABLED(CONFIG_DRM_OPLUS_NOTIFY)
#include <linux/msm_drm_notify.h>
#elif IS_ENABLED(CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY)
#include <linux/mtk_panel_ext.h>
#include <linux/mtk_disp_notify.h>
#endif

#if IS_ENABLED(CONFIG_TOUCHPANEL_NOTIFY)
#include "touchpanel_notify/touchpanel_event_notify.h"
#endif

/*******Part0:LOG TAG Declear************************/
#if defined(CONFIG_TOUCHPANEL_MTK_PLATFORM) && defined(CONFIG_TOUCHIRQ_UPDATE_QOS)
#error CONFIG_TOUCHPANEL_MTK_PLATFORM and CONFIG_TOUCHIRQ_UPDATE_QOS
#error can not defined same time
#endif

#define TP_ALL_GESTURE_SUPPORT \
(ts->black_gesture_support || ts->fingerprint_underscreen_support)
#define TP_ALL_GESTURE_ENABLE \
((ts->gesture_enable & 0x01) == 1 || ts->fp_enable)

/*******Part1:Global variables Area********************/
struct touchpanel_data *g_tp[TP_SUPPORT_MAX] = {NULL};
static DEFINE_MUTEX(tp_core_lock);
Expand All @@ -81,9 +63,6 @@ static int fb_notifier_callback(struct notifier_block *self,
#elif IS_ENABLED(CONFIG_DRM_PANEL_NOTIFY)
static void ts_panel_notifier_callback(enum panel_event_notifier_tag tag,
struct panel_event_notification *event, void *client_data);
#elif IS_ENABLED(CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY)
static int ts_mtk_drm_notifier_callback(struct notifier_block *nb,
unsigned long event, void *data);
#endif

static void tp_touch_release(struct touchpanel_data *ts);
Expand All @@ -104,32 +83,16 @@ static int tp_gesture_enable_flag(unsigned int tp_index);
extern int (*tp_gesture_enable_notifier)(unsigned int tp_index);
#endif

#ifdef CONFIG_TOUCHPANEL_MTK_PLATFORM
#ifndef CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY
extern enum boot_mode_t get_boot_mode(void);
#endif
#else
extern int get_boot_mode(void);
#endif

#ifdef CONFIG_TOUCHPANEL_MTK_PLATFORM
#ifndef CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY
extern void primary_display_esd_check_enable(int enable);
#endif
#endif
void display_esd_check_enable_bytouchpanel(bool enable);

/*******Part3:Function Area********************************/
bool inline is_ftm_boot_mode(struct touchpanel_data *ts)
{
#ifndef CONFIG_REMOVE_OPLUS_FUNCTION
#ifdef CONFIG_TOUCHPANEL_MTK_PLATFORM

if ((ts->boot_mode == META_BOOT || ts->boot_mode == FACTORY_BOOT))
#else
if ((ts->boot_mode == MSM_BOOT_MODE__FACTORY
|| ts->boot_mode == MSM_BOOT_MODE__RF || ts->boot_mode == MSM_BOOT_MODE__WLAN))
#endif
{
return true;
}
Expand Down Expand Up @@ -1003,11 +966,6 @@ static void tp_fw_update_work(struct work_struct *work)
}

display_esd_check_enable_bytouchpanel(0);
#ifdef CONFIG_TOUCHPANEL_MTK_PLATFORM
#ifndef CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY
primary_display_esd_check_enable(0); /*avoid rst pulled to low while updating*/
#endif
#endif

if (ts->ts_ops->fw_update) {
do {
Expand Down Expand Up @@ -1106,11 +1064,6 @@ static void tp_fw_update_work(struct work_struct *work)
ts->loading_fw = false;

display_esd_check_enable_bytouchpanel(1);
#ifdef CONFIG_TOUCHPANEL_MTK_PLATFORM
#ifndef CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY
primary_display_esd_check_enable(1); /*avoid rst pulled to low while updating*/
#endif
#endif

if (ts->esd_handle_support) {
esd_handle_switch(&ts->esd_info, true);
Expand Down Expand Up @@ -2910,13 +2863,6 @@ int register_common_touch_device(struct touchpanel_data *pdata)
ts->notifier_cookie = cookie;
}

#elif IS_ENABLED(CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY)
ts->disp_notifier.notifier_call = ts_mtk_drm_notifier_callback;
if (mtk_disp_notifier_register("Oplus_touch_v2", &ts->disp_notifier)) {
TP_INFO(ts->tp_index, "Failed to register disp notifier client!!\n");
goto err_check_functionality_failed;
}

#elif IS_ENABLED(CONFIG_DRM_MSM) || IS_ENABLED(CONFIG_DRM_OPLUS_NOTIFY)
ts->fb_notif.notifier_call = fb_notifier_callback;
ret = msm_drm_register_client(&ts->fb_notif);
Expand Down Expand Up @@ -3130,8 +3076,6 @@ int register_common_touch_device(struct touchpanel_data *pdata)
if (ts->active_panel && ts->notifier_cookie) {
panel_event_notifier_unregister(ts->notifier_cookie);
}
#elif IS_ENABLED(CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY)
mtk_disp_notifier_unregister(&ts->disp_notifier);
#elif IS_ENABLED(CONFIG_DRM_MSM) || IS_ENABLED(CONFIG_DRM_OPLUS_NOTIFY)
msm_drm_unregister_client(&ts->fb_notif);
#endif
Expand Down Expand Up @@ -3223,10 +3167,6 @@ void unregister_common_touch_device(struct touchpanel_data *pdata)
if (ts->active_panel && ts->notifier_cookie) {
panel_event_notifier_unregister(ts->notifier_cookie);
}
#elif IS_ENABLED(CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY)
if (ts->disp_notifier.notifier_call) {
mtk_disp_notifier_unregister(&ts->disp_notifier);
}
#elif IS_ENABLED(CONFIG_DRM_MSM) || IS_ENABLED(CONFIG_DRM_OPLUS_NOTIFY)

if (ts->fb_notif.notifier_call) {
Expand Down Expand Up @@ -3542,8 +3482,7 @@ static void speedup_resume(struct work_struct *work)

#if IS_ENABLED(CONFIG_DRM_MSM) || \
IS_ENABLED(CONFIG_DRM_OPLUS_NOTIFY) || \
IS_ENABLED(CONFIG_DRM_PANEL_NOTIFY) || \
IS_ENABLED(CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY)
IS_ENABLED(CONFIG_DRM_PANEL_NOTIFY)
static void lcd_off_early_event(struct touchpanel_data *ts)
{
ts->suspend_state = TP_SUSPEND_EARLY_EVENT; /*set suspend_resume_state*/
Expand Down Expand Up @@ -3588,11 +3527,7 @@ static void lcd_on_early_event(struct touchpanel_data *ts)

static void lcd_on_event(struct touchpanel_data *ts)
{
if (ts->tp_resume_order == TP_LCD_RESUME) {
#ifdef CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY
tp_resume(ts->dev);
#endif
} else if (ts->tp_resume_order == LCD_TP_RESUME) {
if (ts->tp_resume_order == LCD_TP_RESUME) {
tp_resume(ts->dev);
if (!(ts->tp_ic_type == TYPE_TDDI_TCM && ts->is_noflash_ic)) {
enable_irq(ts->irq);
Expand Down Expand Up @@ -3677,44 +3612,6 @@ static void ts_panel_notifier_callback(enum panel_event_notifier_tag tag,
}
}

#elif IS_ENABLED(CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY)
static int ts_mtk_drm_notifier_callback(struct notifier_block *nb,
unsigned long event, void *data)
{
struct touchpanel_data *ts = container_of(nb, struct touchpanel_data,
disp_notifier);
int *blank = (int *)data;

TP_INFO(ts->tp_index, "mtk gki notifier event:%d, blank:%d",
event, *blank);

switch (event) {
case MTK_DISP_EARLY_EVENT_BLANK:
if (*blank == MTK_DISP_BLANK_UNBLANK) {
lcd_on_early_event(ts);
} else if (*blank == MTK_DISP_BLANK_POWERDOWN) {
if (ts->speedup_resume_wq) {
flush_workqueue(ts->speedup_resume_wq); /*wait speedup_resume_wq done*/
}
lcd_off_early_event(ts);
}
break;
case MTK_DISP_EVENT_BLANK:
if (*blank == MTK_DISP_BLANK_UNBLANK) {
lcd_on_event(ts);
} else if (*blank == MTK_DISP_BLANK_POWERDOWN) {
lcd_off_event(ts);
}
break;
default:
TP_INFO(ts->tp_index, "nuknown event :%d\n", event);
lcd_other_event(blank, ts);
break;
}

return 0;
}

#else
static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data)
{
Expand Down Expand Up @@ -3777,13 +3674,6 @@ void tp_shutdown(struct touchpanel_data *ts)
return;
}

#ifdef CONFIG_OPLUS_MTK_DRM_GKI_NOTIFY
TPD_INFO("mtk gki2.0 need to unregister notifier");
if (mtk_disp_notifier_unregister(&ts->disp_notifier)) {
TP_INFO(ts->tp_index, "Failed to unregister mtk gki 2.0 disp notifier!!\n");
}
#endif

/*step0 :close esd*/
if (ts->esd_handle_support) {
esd_handle_switch(&ts->esd_info, false);
Expand Down

0 comments on commit 6521e93

Please sign in to comment.