Skip to content

Pulls in changes from fairphone #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: staging/lineage-20
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/arm64/configs/vendor/fp5_QGKI.config
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ CONFIG_MSM_DEBUGCC_LAHAINA=y
# CONFIG_SERIAL_DEV_BUS is not set
CONFIG_MSM_GPI_DMA=y
#Add by T2M-mingwu.zhang for FP5-1099 remarks: Temporary plan.[Begin]
#CONFIG_SERIAL_MSM_GENI_CONSOLE=y
CONFIG_SERIAL_MSM_GENI_CONSOLE=y
#Add by T2M-mingwu.zhang [End]
CONFIG_MSM_GPI_DMA_DEBUG=y
# CONFIG_I3C is not set
Expand Down
151 changes: 150 additions & 1 deletion drivers/input/touchscreen/goodix_berlin_a_driver/goodix_ts_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@

#define GOODIX_DEFAULT_CFG_NAME "goodix_cfg_group.cfg"

/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
static int goodix_aod_suspend(struct goodix_ts_core *core_data);
static int goodix_aod_resume(struct goodix_ts_core *core_data);
#endif
/*Add by T2M-mingwu.zhang [End]*/

struct goodix_module goodix_modules;
int core_module_prob_sate = CORE_MODULE_UNPROBED;

Expand Down Expand Up @@ -1969,12 +1976,22 @@ static int goodix_esd_notifier_callback(struct notifier_block *nb,
switch (action) {
case NOTIFY_FWUPDATE_START:
case NOTIFY_SUSPEND:
/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
case NOTIFY_AOD_SUSPEND:
#endif
/*Add by T2M-mingwu.zhang [End]*/
case NOTIFY_ESD_OFF:
goodix_ts_esd_off(ts_esd->ts_core);
break;
case NOTIFY_FWUPDATE_FAILED:
case NOTIFY_FWUPDATE_SUCCESS:
case NOTIFY_RESUME:
/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
case NOTIFY_AOD_RESUME:
#endif
/*Add by T2M-mingwu.zhang [End]*/
case NOTIFY_ESD_ON:
goodix_ts_esd_on(ts_esd->ts_core);
break;
Expand Down Expand Up @@ -2203,6 +2220,119 @@ static int goodix_ts_resume(struct goodix_ts_core *core_data)
return 0;
}

/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
static int goodix_aod_resume(struct goodix_ts_core *core_data)
{
struct goodix_ext_module *ext_module, *next;
struct goodix_ts_hw_ops *hw_ops = core_data->hw_ops;
int ret;

if (core_data->init_stage < CORE_INIT_STAGE2 ||
!atomic_read(&core_data->is_aod))
return 0;

if(core_data->gesture_type != GESTURE_DOUBLE_TAP){
ts_err("Gesture type mismatch, gesture_type=[%d]!",core_data->gesture_type);
return 0;
}

ts_info("AOD resume start!");
atomic_set(&core_data->is_aod, 0);
ts_info("%s: is_aod=[%d]!",__func__,atomic_read(&core_data->is_aod));

hw_ops->irq_enable(core_data, false);

mutex_lock(&goodix_modules.mutex);
if (!list_empty(&goodix_modules.head)) {
list_for_each_entry_safe(ext_module, next,
&goodix_modules.head, list) {
if (!ext_module->funcs->before_resume)
continue;

ret = ext_module->funcs->before_resume(core_data,
ext_module);
if (ret == EVT_CANCEL_RESUME) {
mutex_unlock(&goodix_modules.mutex);
ts_info("Canceled by module:%s",
ext_module->name);
goto out;
}
}
}
mutex_unlock(&goodix_modules.mutex);

out:
if(tp_if_suspend && (tp_if_exist != false)){
tp_if_suspend = false;
schedule_work(&global_core_data->tpusb_online_work);
}
/* enable irq */
hw_ops->irq_enable(core_data, true);
/* open esd */
goodix_ts_blocking_notify(NOTIFY_AOD_RESUME, NULL);

ts_info("AOD resume end!");
return 0;
}

static int goodix_aod_suspend(struct goodix_ts_core *core_data)
{
struct goodix_ext_module *ext_module, *next;
struct goodix_ts_hw_ops *hw_ops = core_data->hw_ops;
int ret;

if (core_data->init_stage < CORE_INIT_STAGE2 ||
atomic_read(&core_data->is_aod))
return 0;

if(core_data->gesture_type != GESTURE_DOUBLE_TAP){
ts_info("Gesture type mismatch, gesture_type=[%d]!",core_data->gesture_type);
return 0;
}

ts_info("AOD suspend start!");
atomic_set(&core_data->is_aod, 1);
ts_info("%s: is_aod=[%d]!",__func__,atomic_read(&core_data->is_aod));

/* disable irq */
hw_ops->irq_enable(core_data, false);

goodix_ts_blocking_notify(NOTIFY_AOD_SUSPEND, NULL);

/* inform external module */
mutex_lock(&goodix_modules.mutex);
if (!list_empty(&goodix_modules.head)) {
list_for_each_entry_safe(ext_module, next,
&goodix_modules.head, list) {
if (!ext_module->funcs->before_suspend)
continue;

ret = ext_module->funcs->before_suspend(core_data,
ext_module);
if (ret == EVT_CANCEL_SUSPEND) {
mutex_unlock(&goodix_modules.mutex);
ts_info("Canceled by module:%s",
ext_module->name);
goto out;
}
}
}
mutex_unlock(&goodix_modules.mutex);

out:
goodix_ts_release_connects(core_data);

usb_if_err = -EPERM;
tp_if_suspend = true;
ts_info("usb_if_err=[%d],tp_if_suspend=[%d]",usb_if_err,tp_if_suspend);

ts_info("AOD suspend end");
return 0;
}
#endif
/*Add by T2M-mingwu.zhang [End]*/

#if IS_ENABLED(CONFIG_FB)
/**
* goodix_ts_fb_notifier_callback - Framebuffer notifier callback
Expand Down Expand Up @@ -2255,8 +2385,14 @@ int goodix_ts_drm_notifier_callback(struct notifier_block *self,
switch (*blank) {
case DRM_PANEL_BLANK_UNBLANK:
if (event == DRM_PANEL_EARLY_EVENT_BLANK) {
ts_info("resume: event = %lu, not care\n", event);
/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
ts_info("AOD resume\n");
goodix_aod_resume(core_data);
#endif
/*Add by T2M-mingwu.zhang [End]*/
} else if (event == DRM_PANEL_EVENT_BLANK) {
ts_info("TS resume\n");
goodix_ts_resume(core_data);
}
break;
Expand All @@ -2269,6 +2405,19 @@ int goodix_ts_drm_notifier_callback(struct notifier_block *self,
}
break;

/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
case DRM_PANEL_BLANK_LP:
if (event == DRM_PANEL_EARLY_EVENT_BLANK) {
ts_info("%s:LP early event!", __func__ );
goodix_aod_suspend(core_data);
} else if (event == DRM_PANEL_EVENT_BLANK) {
ts_info("%s:LP event!",__func__);
}
break;
#endif
/*Add by T2M-mingwu.zhang [End]*/

default:
ts_err("FB BLANK(%d) do not need process\n", *blank);
break;
Expand Down
12 changes: 12 additions & 0 deletions drivers/input/touchscreen/goodix_berlin_a_driver/goodix_ts_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,12 @@ enum ts_notify_event {
NOTIFY_ESD_ON,
NOTIFY_CFG_BIN_FAILED,
NOTIFY_CFG_BIN_SUCCESS,
/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
NOTIFY_AOD_SUSPEND,
NOTIFY_AOD_RESUME,
#endif
/*Add by T2M-mingwu.zhang [End]*/
};

enum touch_point_status {
Expand Down Expand Up @@ -720,6 +726,12 @@ struct goodix_ts_core {
atomic_t usb_online;
#endif
/*Add by T2M-mingwu.zhang [End]*/

/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
atomic_t is_aod;
#endif
/*Add by T2M-mingwu.zhang [End]*/
};

/* external module structures */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,15 @@ static int gsx_gesture_ist(struct goodix_ts_core *cd,
int fodx, fody, overlay_area;
int ret;

if (atomic_read(&cd->suspended) == 0 || cd->gesture_type == 0)
/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
if ((atomic_read(&cd->suspended) || atomic_read(&cd->is_aod)) == 0 || cd->gesture_type == 0)
return EVT_CONTINUE;
#else
if (atomic_read(&cd->suspended) == 0 || cd->gesture_type == 0)
return EVT_CONTINUE;
#endif
/*Add by T2M-mingwu.zhang [End]*/

ret = hw_ops->event_handler(cd, &gs_event);
if (ret) {
Expand All @@ -260,6 +267,16 @@ static int gsx_gesture_ist(struct goodix_ts_core *cd,
goto re_send_ges_cmd;
}

/*INFO:[BEGIN] by T2M mingwu.zhang for FP5-2659 remarks: In AOD mode, double click wake-up fails.*/
#ifdef CONFIG_PROJECT_FP5
ts_info("%s:suspended=[%d] is_aod=[%d] gesture_type=[%d]! \n",
__func__,
atomic_read(&cd->suspended),
atomic_read(&cd->is_aod),
cd->gesture_type);
#endif
/*Add by T2M-mingwu.zhang [End]*/

switch (gs_event.gesture_type) {
case GOODIX_GESTURE_SINGLE_TAP:
if (cd->gesture_type & GESTURE_SINGLE_TAP) {
Expand Down
22 changes: 22 additions & 0 deletions kernel/printk/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ int console_printk[4] = {
CONSOLE_LOGLEVEL_MIN, /* minimum_console_loglevel */
CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */
};

enum console_sta{
console_open = 0,
console_close = 1,
};
bool console_enabled_userspace = console_close;

EXPORT_SYMBOL_GPL(console_printk);

atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0);
Expand Down Expand Up @@ -1848,6 +1855,8 @@ static void call_console_drivers(const char *ext_text, size_t ext_len,

trace_console_rcuidle(text, len);

if (console_enabled_userspace >= console_close)
return;
if (!console_drivers)
return;

Expand Down Expand Up @@ -2232,6 +2241,19 @@ static int __init console_msg_format_setup(char *str)
}
__setup("console_msg_format=", console_msg_format_setup);

static int __init console_control_setup(char *str)
{
if (!strcmp(str, "true"))
{
console_enabled_userspace = console_open;
}
else
{
console_enabled_userspace = console_close;
}
return 1;
}
__setup("androidboot.uartflag=", console_control_setup);
/*
* Set up a console. Called via do_early_param() in init/main.c
* for each "console=" parameter in the boot command line.
Expand Down