Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 1c316cc8 authored by yushixian's avatar yushixian Committed by Michael Bestas
Browse files

[ALM:10872955] [FP4]:TP drm notifier debug

 &&&%%%comment:[FP4]:TP drm notifier debug
 &&&%%%bug number:10872955
 &&&%%%product name:sm7225_r_fp4
 &&&%%%root cause:Coding
 &&&%%%Bug category:T2M
 &&&%%%Module_Impact:kernel
 &&&%%%Test_Suggestion:TP can suspend and resume
 &&&%%%Solution:enable drm notifier
 &&&%%%Test_Report:test is ok
 &&&%%%VAL Can Test:yes

Change-Id: I8ebfa1e11160d329c8eab74969d031f227714670
parent 643cb710
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -4,10 +4,6 @@ ifneq ($(filter y, $(CONFIG_KALLSYMS_ALL)),)
	ccflags-y += -D__KERNEL_KALLSYMS_ALL_ENABLED__
endif

ifneq ($(filter y, $(CONFIG_FB)),)
	ccflags-y += -DHX_CONFIG_FB
endif

ifneq ($(filter y, $(CONFIG_DRM)),)
	ccflags-y += -DHX_CONFIG_DRM
endif
+19 −14
Original line number Diff line number Diff line
@@ -2802,18 +2802,16 @@ static void himax_fb_register(struct work_struct *work)
	ts->fb_notif.notifier_call = fb_notifier_callback;
	ret = fb_register_client(&ts->fb_notif);
#elif defined(HX_CONFIG_DRM)
#if defined(__HIMAX_MOD__)
	hx_msm_drm_register_client =
		(void *)kallsyms_lookup_name("msm_drm_register_client");
	if (hx_msm_drm_register_client != NULL) {
		ts->fb_notif.notifier_call = drm_notifier_callback;
		ret = hx_msm_drm_register_client(&ts->fb_notif);
	}	else
		E("hx_msm_drm_register_client is NULL\n");
#else
	ts->fb_notif.notifier_call = drm_notifier_callback;
	ret = msm_drm_register_client(&ts->fb_notif);
#endif
	if (active_panel) {
		ret = drm_panel_notifier_register(active_panel,
			&ts->fb_notif);
		if (ret)
			E("Failed to register fb notifier client");
	}
	else {
		E("active_panel error\n");
	}
#endif
	if (ret)
		E("Unable to register fb_notifier: %d\n", ret);
@@ -2870,6 +2868,8 @@ int himax_chip_common_init(void)
		goto err_xfer_buff_fail;
	}



#if defined(__EMBEDDED_FW__)
	g_embedded_fw.size = (size_t)_binary___Himax_firmware_bin_end -
			(size_t)_binary___Himax_firmware_bin_start;
@@ -3072,7 +3072,7 @@ int himax_chip_common_init(void)
		err = -ENOMEM;
		goto err_get_intr_bit_failed;
	}

	I("register fb  \n");
	INIT_DELAYED_WORK(&ts->work_att, himax_fb_register);
	queue_delayed_work(ts->himax_att_wq, &ts->work_att,
			msecs_to_jiffies(15000));
@@ -3155,6 +3155,7 @@ int himax_chip_common_init(void)
void himax_chip_common_deinit(void)
{
	struct himax_ts_data *ts = private_ts;
	int ret = 0;

	himax_ts_unregister_interrupt();

@@ -3187,8 +3188,12 @@ void himax_chip_common_deinit(void)
	} else
		E("hx_msm_drm_unregister_client is NULL\n");
#else
	if (msm_drm_unregister_client(&ts->fb_notif))
		E("Error occurred while unregistering drm_notifier.\n");
    if (active_panel) {
		ret = drm_panel_notifier_unregister(active_panel,
				&ts->fb_notif);
		if (ret < 0)
            E("Failed to unregister fb notifier client");
	}
#endif
	cancel_delayed_work_sync(&ts->work_att);
	destroy_workqueue(ts->himax_att_wq);
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include <linux/proc_fs.h>
#include "himax_platform.h"
#include <linux/kallsyms.h>
#include <drm/drm_panel.h>

#if defined(CONFIG_OF)
	#include <linux/of_gpio.h>
@@ -572,6 +573,7 @@ extern struct himax_core_fp g_core_fp;
extern struct himax_ts_data *private_ts;
extern struct himax_ic_data *ic_data;
extern struct device *g_device;
extern struct drm_panel *active_panel;

#if defined(CONFIG_TOUCHSCREEN_HIMAX_DEBUG)
	int himax_debug_init(void);
+7 −1
Original line number Diff line number Diff line
@@ -158,7 +158,13 @@ void himax_get_arraydata_edge(int *RAW)
{
	int temp, i, j;
	int len = ic_data->HX_RX_NUM * ic_data->HX_TX_NUM;
	int ArrayData[len];
	int *ArrayData;
 
	ArrayData = kcalloc(len, sizeof(int), GFP_KERNEL);
	if (ArrayData == NULL) {
		E("%s: allocate ArrayData failed\n", __func__);
		return;
	}

	for (i = 0; i < len; i++)
		ArrayData[i] = RAW[i];
+107 −37
Original line number Diff line number Diff line
@@ -19,6 +19,61 @@
int i2c_error_count;
u8 *gp_rw_buf;

struct drm_panel *active_panel;

int check_dt(struct device_node *np)
{
	int i;
	int count;
	struct device_node *node;
	struct drm_panel *panel;

	count = of_count_phandle_with_args(np, "panel", NULL);
	if (count <= 0)
		return 0;

	for (i = 0; i < count; i++) {
		node = of_parse_phandle(np, "panel", i);
		panel = of_drm_find_panel(node);
		of_node_put(node);
		if (!IS_ERR(panel)) {
			active_panel = panel;
			return 0;
		}
	}

	return -ENODEV;
}

int check_default_tp(struct device_node *dt, const char *prop)
{
	const char *active_tp;
	const char *compatible;
	char *start;
	int ret;

	ret = of_property_read_string(dt->parent, prop, &active_tp);
	if (ret) {
		pr_err(" %s:fail to read %s %d\n", __func__, prop, ret);
		return -ENODEV;
	}

	ret = of_property_read_string(dt, "compatible", &compatible);
	if (ret < 0) {
		pr_err(" %s:fail to read %s %d\n", __func__, "compatible", ret);
		return -ENODEV;
	}

	start = strnstr(active_tp, compatible, strlen(active_tp));
	if (start == NULL) {
		pr_err(" %s:no match compatible, %s, %s\n",
			__func__, compatible, active_tp);
		ret = -ENODEV;
	}

	return ret;
}

int himax_dev_set(struct himax_ts_data *ts)
{
	int ret = 0;
@@ -913,43 +968,48 @@ int fb_notifier_callback(struct notifier_block *self,
int drm_notifier_callback(struct notifier_block *self,
        unsigned long event, void *data)
{
	struct msm_drm_notifier *evdata = data;
	int *blank;
    struct drm_panel_notifier *evdata = data;
    int *blank = NULL;
    struct himax_ts_data *ts =
        container_of(self, struct himax_ts_data, fb_notif);
 
	if (!evdata || (evdata->id != 0))
    I("in\n");
 
    if (!evdata)
        return 0;
 
	D("DRM  %s\n", __func__);
    if (!(event == DRM_PANEL_EARLY_EVENT_BLANK ||
        event == DRM_PANEL_EVENT_BLANK)) {
        I("event(%lu) do not need process\n", event);
        return 0;
    }
 
	if (evdata->data
	&& event == MSM_DRM_EARLY_EVENT_BLANK
	&& ts
	&& ts->client) {
    blank = evdata->data;
    I("FB event:%lu,blank:%d", event, *blank);
    switch (*blank) {
		case MSM_DRM_BLANK_POWERDOWN:
			if (!ts->initialized)
				return -ECANCELED;
			himax_common_suspend(&ts->client->dev);
			break;
    case DRM_PANEL_BLANK_UNBLANK:
        if (event == DRM_PANEL_EARLY_EVENT_BLANK) {
            I("resume: event = %lu, not care\n", event);
        } else if (event == DRM_PANEL_EVENT_BLANK) {
            himax_common_resume(ts->dev);
        }
        break;
 
    case DRM_PANEL_BLANK_POWERDOWN:
        if (event == DRM_PANEL_EARLY_EVENT_BLANK) {
            himax_common_suspend(ts->dev);
        } else if (event == DRM_PANEL_EVENT_BLANK) {
            I("suspend: event = %lu, not care\n", event);
        }
        break;
 
	if (evdata->data
	&& event == MSM_DRM_EVENT_BLANK
	&& ts
	&& ts->client) {
		blank = evdata->data;
		switch (*blank) {
		case MSM_DRM_BLANK_UNBLANK:
			himax_common_resume(&ts->client->dev);
    default:
        E("FB BLANK(%d) do not need process\n", *blank);
        break;
    }
	}
 
    return 0;

}
#endif

@@ -958,6 +1018,7 @@ int himax_chip_common_probe(struct i2c_client *client,
{
	int ret = 0;
	struct himax_ts_data *ts;
	struct device_node *dp = client->dev.of_node;

	I("%s:Enter\n", __func__);

@@ -974,6 +1035,15 @@ int himax_chip_common_probe(struct i2c_client *client,
		return -ENODEV;
	}

	if (check_dt(dp)) {
		if (!check_default_tp(dp, "qcom,i2c-touch-active"))
			ret = -EPROBE_DEFER;
		else
			ret = -ENODEV;
        	E("check_dt failed, error=%d", ret);
		return ret;
	}

	ts = kzalloc(sizeof(struct himax_ts_data), GFP_KERNEL);
	if (ts == NULL) {
		E("%s: allocate himax_ts_data failed\n", __func__);