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

Commit 306bd2cf authored by Fei Mao's avatar Fei Mao Committed by Gerrit - the friendly Code Review server
Browse files

input: touchscreen: hxchipset: register the input device



Split the initialization function into two parts, one is for the driver
probe, another is for the deferred hw driver initialization. And the input
device will be registered as soon as possible.

Change-Id: I719ca348fc7a9d460ef91c0ea26d79e5b42384ac
Signed-off-by: default avatarFei Mao <feim1@codeaurora.org>
parent 0aa9aa46
Loading
Loading
Loading
Loading
+11 −60
Original line number Diff line number Diff line
@@ -438,9 +438,9 @@ int himax_input_register(struct himax_ts_data *ts)
#else
	set_bit(MT_TOOL_FINGER, ts->input_dev->keybit);
#if defined(HX_PROTOCOL_B_3PA)
	input_mt_init_slots(ts->input_dev, ts->nFinger_support, INPUT_MT_DIRECT);
	input_mt_init_slots(ts->input_dev, HX_TOUCH_ID_MAX, INPUT_MT_DIRECT);
#else
	input_mt_init_slots(ts->input_dev, ts->nFinger_support);
	input_mt_init_slots(ts->input_dev, HX_TOUCH_ID_MAX);
#endif
#endif
	D("input_set_abs_params: mix_x %d, max_x %d, min_y %d, max_y %d\n",
@@ -1942,16 +1942,9 @@ int himax_chip_common_init(void)
#if defined(HX_AUTO_UPDATE_FW) || defined(HX_ZERO_FLASH)
	bool auto_update_flag = false;
#endif
	int ret = 0, err = -1;
	int err = -1;
	struct himax_ts_data *ts = private_ts;
	struct himax_i2c_platform_data *pdata;

	D("PDATA START\n");
	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
	if (pdata == NULL) { /* Allocate Platform data space */
		err = -ENOMEM;
		goto err_dt_platform_data_fail;
	}
	struct himax_i2c_platform_data *pdata = ts->pdata;

	D("ic_data START\n");
	ic_data = kzalloc(sizeof(*ic_data), GFP_KERNEL);
@@ -1967,12 +1960,6 @@ int himax_chip_common_init(void)
		goto err_alloc_touch_data_failed;
	}

	if (himax_parse_dt(ts, pdata) < 0) {
		E(" pdata is NULL for DT\n");
		err = -ECANCELED;
		goto err_alloc_dt_pdata_failed;
	}

#ifdef HX_RST_PIN_FUNC
	ts->rst_gpio = pdata->gpio_reset;
#endif
@@ -2005,9 +1992,6 @@ int himax_chip_common_init(void)
		goto error_ic_detect_failed;
	}

	if (pdata->virtual_key)
		ts->button = pdata->virtual_key;

	g_core_fp.fp_read_FW_ver();

#ifdef HX_AUTO_UPDATE_FW
@@ -2034,41 +2018,13 @@ int himax_chip_common_init(void)
#ifdef CONFIG_OF
	ts->power = pdata->power;
#endif
	ts->pdata = pdata;

	ts->x_channel = ic_data->HX_RX_NUM;
	ts->y_channel = ic_data->HX_TX_NUM;
	ts->nFinger_support = ic_data->HX_MAX_PT;
	/* calculate the i2c data size */
	calcDataSize(ts->nFinger_support);
	D("%s: calcDataSize complete\n", __func__);
#ifdef CONFIG_OF
	ts->pdata->abs_pressure_min        = 0;
	ts->pdata->abs_pressure_max        = 200;
	ts->pdata->abs_width_min           = 0;
	ts->pdata->abs_width_max           = 200;
	pdata->cable_config[0]             = 0xF0;
	pdata->cable_config[1]             = 0x00;
#endif
	ts->suspended                      = false;
#if defined(HX_USB_DETECT_CALLBACK) || defined(HX_USB_DETECT_GLOBAL)
	ts->usb_connected = 0x00;
	ts->cable_config = pdata->cable_config;
#endif
#ifdef	HX_PROTOCOL_A
	ts->protocol_type = PROTOCOL_TYPE_A;
#else
	ts->protocol_type = PROTOCOL_TYPE_B;
#endif
	D("%s: Use Protocol Type %c\n", __func__,
	  ts->protocol_type == PROTOCOL_TYPE_A ? 'A' : 'B');

	ret = himax_input_register(ts);
	if (ret) {
		E("%s: Unable to register %s input device\n",
		  __func__, ts->input_dev->name);
		err = ret;
		goto err_input_register_device_failed;
	}

#ifdef HX_SMART_WAKEUP
	ts->SMWP_enable = 0;
@@ -2111,14 +2067,13 @@ int himax_chip_common_init(void)
	if (err)
		goto err_register_interrupt_failed;


#ifdef CONFIG_TOUCHSCREEN_HIMAX_DEBUG
	if (himax_debug_init())
		E(" %s: debug initial failed!\n", __func__);
#endif


	return 0;

err_register_interrupt_failed:
	remove_proc_entry(HIMAX_PROC_TOUCH_FOLDER, NULL);
err_creat_proc_file_failed:
@@ -2130,15 +2085,12 @@ remove_proc_entry(HIMAX_PROC_TOUCH_FOLDER, NULL);
#ifdef HX_SMART_WAKEUP
	wakeup_source_trash(&ts->ts_SMWP_wake_src);
#endif
err_input_register_device_failed:
	input_free_device(ts->input_dev);
err_detect_failed:
#ifdef HX_AUTO_UPDATE_FW
	if (auto_update_flag) {
		cancel_delayed_work_sync(&ts->work_update);
		destroy_workqueue(ts->himax_update_wq);
	}

#endif

error_ic_detect_failed:
@@ -2146,23 +2098,18 @@ remove_proc_entry(HIMAX_PROC_TOUCH_FOLDER, NULL);
		gpio_free(pdata->gpio_irq);

#ifdef HX_RST_PIN_FUNC

	if (gpio_is_valid(pdata->gpio_reset))
		gpio_free(pdata->gpio_reset);

#endif

#ifndef CONFIG_OF
err_power_failed:
#endif

err_alloc_dt_pdata_failed:
	kfree(hx_touch_data);
err_alloc_touch_data_failed:
	kfree(ic_data);
err_dt_ic_data_fail:
	kfree(pdata);
err_dt_platform_data_fail:
	probe_fail_flag = 1;
	return err;
}
@@ -2230,6 +2177,10 @@ int himax_chip_common_suspend(struct himax_ts_data *ts)
		return 0;
	}

#ifdef HX_ESD_RECOVERY
	HX_ESD_RESET_ACTIVATE = 0;
#endif

	ts->suspended = true;
	D("%s: enter\n", __func__);

+6 −5
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@
/*#define HX_PLATFOME_DEFINE_KEY*/  /* for specific platform to set key(button) */
#endif

#define HX_TOUCH_ID_MAX 10
#define HX_KEY_MAX_COUNT 4
#define DEFAULT_RETRY_CNT 3

+1 −1
Original line number Diff line number Diff line
@@ -1848,7 +1848,7 @@ static int himax_mcu_ic_esd_recovery(int hx_esd_event, int hx_zero_event, int le

static void himax_mcu_esd_ic_reset(void)
{
	HX_ESD_RESET_ACTIVATE = 0;
	HX_ESD_RESET_ACTIVATE = 1;
#ifdef HX_RST_PIN_FUNC
	himax_mcu_pin_reset();
#endif
+50 −0
Original line number Diff line number Diff line
@@ -791,6 +791,7 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i
	int ret = 0;
	struct himax_ts_data *ts;
	struct device_node *dt = client->dev.of_node;
	struct himax_i2c_platform_data *pdata;

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

@@ -844,8 +845,57 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i
	}
	INIT_DELAYED_WORK(&ts->work_update, himax_update_register);
#endif

	D("PDATA START\n");
	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
	if (pdata == NULL) { /* Allocate Platform data space */
		ret = -ENOMEM;
		goto err_fb_notify_reg_failed;
	}

	if (himax_parse_dt(ts, pdata) < 0) {
		E(" pdata is NULL for DT\n");
		ret = -ECANCELED;
		goto err_alloc_dt_pdata_failed;
	}

	if (pdata->virtual_key)
		ts->button = pdata->virtual_key;

	ts->pdata = pdata;

#ifdef CONFIG_OF
	pdata->cable_config[0] = 0xF0;
	pdata->cable_config[1] = 0x00;

	ts->pdata->abs_pressure_min = 0;
	ts->pdata->abs_pressure_max = 200;
	ts->pdata->abs_width_min = 0;
	ts->pdata->abs_width_max = 200;
#endif

	ts->suspended = false;
#if defined(HX_USB_DETECT_CALLBACK) || defined(HX_USB_DETECT_GLOBAL)
	ts->usb_connected = 0x00;
	ts->cable_config = pdata->cable_config;
#endif
#ifdef	HX_PROTOCOL_A
	ts->protocol_type = PROTOCOL_TYPE_A;
#else
	ts->protocol_type = PROTOCOL_TYPE_B;
#endif
	D("%s: Use Protocol Type %c\n", __func__,
	  ts->protocol_type == PROTOCOL_TYPE_A ? 'A' : 'B');

	ret = himax_input_register(ts);
	if (ret) {
		E("%s: Unable to register %s input device\n",
		  __func__, ts->input_dev->name);
	}
	return ret;

err_alloc_dt_pdata_failed:
	kfree(pdata);
err_fb_notify_reg_failed:
	kfree(ts->i2c_data);
err_alloc_i2c_data: