Skip to contentSkip to conversation

input: cyapa: instruction of cyapa patches

PATCH Superseded Dudley Du 4 participants 33 messages Nov 19, 2014 – Dec 3, 2014

Subsystems (2)

v11 of 15 Superseded Latest is v15 →

lore
Share & tools
lore

Dudley Du

author
#0 lore raw

v11 cover input: cyapa: instruction of cyapa patches

V11 patches have below main updates compared with v10 patches:
1) Add add acpi device id supported for old gen3 and new gen5 trackpad devices.
2) Fix the unable to update firmware issue when cyapa_open is not called which means the irq for firwmare update process is not enabled. This fix by checking if the irq is enabled, if not then enable irq before start to do firmware update.

V10 patches have below main updates compared with v9 patches:
1) Modify code to following kernel code style.
e.g.: correct to use error as return name when there is only error path, and fix the checkpatch.sh wanting in the driver.
2) Remove cyapa_remove method and use input open and close interface to following device resouse management infrastructure.
3) Modify cyapa_detect method to return tristate issue to make the return value much more consistent and clear.
4) Use platform supplied functions as possible instead of driver specific rewritten version.

V9 patches have below updates compared with v8 patches:
1) Removed all async thread stuff from the driver.
2) Split driver into 18 patches for each function change one patch.

V8 patches have below updates compared with v7 patches:
1) [PATCH v8 01/13] - Remove the async thread for device detect in probe routine, now the device detect process is completely done within the device probe routine.
2) [PATCH v8 01/13] - Split the irq cmd hander function to separated function cyapa_default_irq_cmd_handler() and set it to interface cyapa_default_ops.irq_cmd_handler.
3) [PATCH v8 06/13] - Add cyapa->gen check in cyapa_gen3_irq_cmd_handler() to avoid miss-enter when device protocol is still in detecting.

V7 patches have below updates compared with v6 patches:
1) [PATCH v7 01/13] - Split the irq cmd hander function to separated function cyapa_default_irq_cmd_handler() and set it to interface cyapa_default_ops.irq_cmd_handler.
2) [PATCH v7 06/13] - Add cyapa->gen check in cyapa_gen3_irq_cmd_handler() to avoid miss-enter when device protocol is still in detecting.

V6 patches have below updates compared with v5 patches:
1) Remove patch 14 of the lid filtering from the cyapa driver.

V5 patches have below updates compared with v4 patches:
1) Uses get_device()/put_device() instead of kobject_get()/kobject_put();
2) Fix memories freed before debugfs entries issue;
3) Make cyapa_debugs_root valid in driver module level
in module_init()/moudle_exit() ;
4) Fix i2c_transfer() may return partial transfer issues.
5) Add cyapa->removed flag to avoid detecting thread may still running when driver module is removed.
6) Fix the meanings of some comments and return error code not clear issue.

This patch set is aimed to re-design the cyapa driver to support old gen3 trackpad devices and new gen5 trackpad devices in one cyapa driver, it's for easily productions support based on customers' requirements. And add sysfs functions and interfaces supported that required by users and customers.

Since the earlier gen3 and the latest gen5 trackpad devices using two different chipsets, and have different protocols and interfaces, so if supported these two type trackpad devices in two different drivers, then it will be difficult to manage productions and later firmware updates. e.g.: It will cause customer don't know which one trackpad device firmware image to use and update when it has been used and integrated
in same one productions, so here we support these two trackpad devices in same on driver.

The new design cyapa driver contains:
cyapa.c - the core of the re-design, supply interfaces and functions to system and read trackpad devices.
cyapa.h - header file including macros and data structure definitions. cyapa_gen3.c - functions support for gen3 trackpad devices, cyapa_gen5.c - functions support for gen5 trackpad devices.

Beside this introduction patch, it has 18 patches listed as below. For these patches each one is patched based on previous one.

patch 1/19: modify code to following kernel code style.

patch 2/19: add device resource management infrastructure support.

patch 3/19: re-design cyapa driver with core functions and interface to support multi-type trackpad devices.

patch 4/19: add gen5 trackpad device basic functions supported into the re-design cyapa driver.

patch 5/19: add power management interfaces supported for the deivce.

patch 6/19: add runtime power management interfaces supported for the device.

patch 7/19: add sysfs interfaces supported in the cyapa driver. Including read firmware version, get production ID, read baseline, re-calibrate trackpad baselines and do trackpad firmware update.

patch 8/19: add gen3 trackpad device's firmware update function supported.

patch 9/19: add gen3 trackpad device's read baseline function supported.

patch 10/19: add gen3 trackpad device's force re-calibrate function supported.

patch 11/19: add gen5 trackpad device's firmware update function supported.

patch 12/19: add gen5 trackpad device's read baseline function supported.

patch 13/19: add gen5 trackpad device's force re-calibrate function.

patch 14/19: add read firmware image debugfs interface supported in the cyapa driver.

patch 15/19: add gen3 trackpad device's read firmware image function supported.

patch 16/19: add gen5 trackpad device's read firmware image function supported.

patch 17/19: add read trackpad device's sensors' raw data debugfs interface supported in the cyapa driver.

patch 18/19: add gen5 trackpad device's read read raw function supported.

patch 19/19: add acpi device id supported.

author
#1 lore raw

PATCH v11 1/19 input: cyapa: modify code to following kernel code style

This patch modified the code to fix the patch check warning issue with latest checkpatch.sh tool, and also changed the return variable name from "ret" to "error" when there is only one error path to follow code style. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.c | 151 ++++++++++++++++++++++----------------------
 1 file changed, 75 insertions(+), 76 deletions(-)
drivers/input/mouse/cyapa.c +75 -76
index b409c3d..c35f398 100644
@@ -409,11 +409,11 @@ static ssize_t cyapa_read_block(struct cyapa *cyapa, u8 cmd_idx, u8 *values)
 		cmd = cyapa_smbus_cmds[cmd_idx].cmd;
 		len = cyapa_smbus_cmds[cmd_idx].len;
 		return cyapa_smbus_read_block(cyapa, cmd, len, values);
-	} else {
-		cmd = cyapa_i2c_cmds[cmd_idx].cmd;
-		len = cyapa_i2c_cmds[cmd_idx].len;
-		return cyapa_i2c_reg_read_block(cyapa, cmd, len, values);
 	}
+
+	cmd = cyapa_i2c_cmds[cmd_idx].cmd;
+	len = cyapa_i2c_cmds[cmd_idx].len;
+	return cyapa_i2c_reg_read_block(cyapa, cmd, len, values);
 }
 
 /*
@@ -422,8 +422,8 @@ static ssize_t cyapa_read_block(struct cyapa *cyapa, u8 cmd_idx, u8 *values)
  */
 static int cyapa_get_state(struct cyapa *cyapa)
 {
-	int ret;
 	u8 status[BL_STATUS_SIZE];
+	int error;
 
 	cyapa->state = CYAPA_STATE_NO_DEVICE;
 
@@ -433,7 +433,7 @@ static int cyapa_get_state(struct cyapa *cyapa)
 	 * If the device is in operation mode, this will be the DATA regs.
 	 *
 	 */
-	ret = cyapa_i2c_reg_read_block(cyapa, BL_HEAD_OFFSET, BL_STATUS_SIZE,
+	error = cyapa_i2c_reg_read_block(cyapa, BL_HEAD_OFFSET, BL_STATUS_SIZE,
 				       status);
 
 	/*
@@ -441,10 +441,10 @@ static int cyapa_get_state(struct cyapa *cyapa)
 	 * -ETIMEDOUT.  In this case, try again using the smbus equivalent
 	 * command.  This should return a BL_HEAD indicating CYAPA_STATE_OP.
 	 */
-	if (cyapa->smbus && (ret == -ETIMEDOUT || ret == -ENXIO))
-		ret = cyapa_read_block(cyapa, CYAPA_CMD_BL_STATUS, status);
+	if (cyapa->smbus && (error == -ETIMEDOUT || error == -ENXIO))
+		error = cyapa_read_block(cyapa, CYAPA_CMD_BL_STATUS, status);
 
-	if (ret != BL_STATUS_SIZE)
+	if (error != BL_STATUS_SIZE)
 		goto error;
 
 	if ((status[REG_OP_STATUS] & OP_STATUS_SRC) == OP_STATUS_SRC) {
@@ -454,7 +454,7 @@ static int cyapa_get_state(struct cyapa *cyapa)
 			cyapa->state = CYAPA_STATE_OP;
 			break;
 		default:
-			ret = -EAGAIN;
+			error = -EAGAIN;
 			goto error;
 		}
 	} else {
@@ -468,7 +468,7 @@ static int cyapa_get_state(struct cyapa *cyapa)
 
 	return 0;
 error:
-	return (ret < 0) ? ret : -EAGAIN;
+	return (error < 0) ? error : -EAGAIN;
 }
 
 /*
@@ -487,31 +487,31 @@ error:
  */
 static int cyapa_poll_state(struct cyapa *cyapa, unsigned int timeout)
 {
-	int ret;
+	int error;
 	int tries = timeout / 100;
 
-	ret = cyapa_get_state(cyapa);
-	while ((ret || cyapa->state >= CYAPA_STATE_BL_BUSY) && tries--) {
+	error = cyapa_get_state(cyapa);
+	while ((error || cyapa->state >= CYAPA_STATE_BL_BUSY) && tries--) {
 		msleep(100);
-		ret = cyapa_get_state(cyapa);
+		error = cyapa_get_state(cyapa);
 	}
-	return (ret == -EAGAIN || ret == -ETIMEDOUT) ? -ETIMEDOUT : ret;
+	return (error == -EAGAIN || error == -ETIMEDOUT) ? -ETIMEDOUT : error;
 }
 
 static int cyapa_bl_deactivate(struct cyapa *cyapa)
 {
-	int ret;
+	int error;
 
-	ret = cyapa_i2c_reg_write_block(cyapa, 0, sizeof(bl_deactivate),
+	error = cyapa_i2c_reg_write_block(cyapa, 0, sizeof(bl_deactivate),
 					bl_deactivate);
-	if (ret < 0)
-		return ret;
+	if (error)
+		return error;
 
 	/* wait for bootloader to switch to idle state; should take < 100ms */
 	msleep(100);
-	ret = cyapa_poll_state(cyapa, 500);
-	if (ret < 0)
-		return ret;
+	error = cyapa_poll_state(cyapa, 500);
+	if (error)
+		return error;
 	if (cyapa->state != CYAPA_STATE_BL_IDLE)
 		return -EAGAIN;
 	return 0;
@@ -532,11 +532,11 @@ static int cyapa_bl_deactivate(struct cyapa *cyapa)
  */
 static int cyapa_bl_exit(struct cyapa *cyapa)
 {
-	int ret;
+	int error;
 
-	ret = cyapa_i2c_reg_write_block(cyapa, 0, sizeof(bl_exit), bl_exit);
-	if (ret < 0)
-		return ret;
+	error = cyapa_i2c_reg_write_block(cyapa, 0, sizeof(bl_exit), bl_exit);
+	if (error)
+		return error;
 
 	/*
 	 * Wait for bootloader to exit, and operation mode to start.
@@ -548,9 +548,9 @@ static int cyapa_bl_exit(struct cyapa *cyapa)
 	 * updated to new firmware, it must first calibrate its sensors, which
 	 * can take up to an additional 2 seconds.
 	 */
-	ret = cyapa_poll_state(cyapa, 2000);
-	if (ret < 0)
-		return ret;
+	error = cyapa_poll_state(cyapa, 2000);
+	if (error < 0)
+		return error;
 	if (cyapa->state != CYAPA_STATE_OP)
 		return -EAGAIN;
 
@@ -637,28 +637,28 @@ static int cyapa_check_is_operational(struct cyapa *cyapa)
 {
 	struct device *dev = &cyapa->client->dev;
 	static const char unique_str[] = "CYTRA";
-	int ret;
+	int error;
 
-	ret = cyapa_poll_state(cyapa, 2000);
-	if (ret < 0)
-		return ret;
+	error = cyapa_poll_state(cyapa, 2000);
+	if (error)
+		return error;
 	switch (cyapa->state) {
 	case CYAPA_STATE_BL_ACTIVE:
-		ret = cyapa_bl_deactivate(cyapa);
-		if (ret)
-			return ret;
+		error = cyapa_bl_deactivate(cyapa);
+		if (error)
+			return error;
 
 	/* Fallthrough state */
 	case CYAPA_STATE_BL_IDLE:
-		ret = cyapa_bl_exit(cyapa);
-		if (ret)
-			return ret;
+		error = cyapa_bl_exit(cyapa);
+		if (error)
+			return error;
 
 	/* Fallthrough state */
 	case CYAPA_STATE_OP:
-		ret = cyapa_get_query_data(cyapa);
-		if (ret < 0)
-			return ret;
+		error = cyapa_get_query_data(cyapa);
+		if (error)
+			return error;
 
 		/* only support firmware protocol gen3 */
 		if (cyapa->gen != CYAPA_GEN3) {
@@ -756,8 +756,8 @@ static u8 cyapa_check_adapter_functionality(struct i2c_client *client)
 static int cyapa_create_input_dev(struct cyapa *cyapa)
 {
 	struct device *dev = &cyapa->client->dev;
-	int ret;
 	struct input_dev *input;
+	int error;
 
 	if (!cyapa->physical_size_x || !cyapa->physical_size_y)
 		return -EINVAL;
@@ -802,17 +802,18 @@ static int cyapa_create_input_dev(struct cyapa *cyapa)
 		__set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
 
 	/* handle pointer emulation and unused slots in core */
-	ret = input_mt_init_slots(input, CYAPA_MAX_MT_SLOTS,
+	error = input_mt_init_slots(input, CYAPA_MAX_MT_SLOTS,
 				  INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED);
-	if (ret) {
-		dev_err(dev, "allocate memory for MT slots failed, %d\n", ret);
+	if (error) {
+		dev_err(dev, "allocate memory for MT slots failed, %d\n",
+				error);
 		goto err_free_device;
 	}
 
 	/* Register the device in input subsystem */
-	ret = input_register_device(input);
-	if (ret) {
-		dev_err(dev, "input device register failed, %d\n", ret);
+	error = input_register_device(input);
+	if (error) {
+		dev_err(dev, "input device register failed, %d\n", error);
 		goto err_free_device;
 	}
 	return 0;
@@ -820,16 +821,16 @@ static int cyapa_create_input_dev(struct cyapa *cyapa)
 err_free_device:
 	input_free_device(input);
 	cyapa->input = NULL;
-	return ret;
+	return error;
 }
 
 static int cyapa_probe(struct i2c_client *client,
 		       const struct i2c_device_id *dev_id)
 {
-	int ret;
 	u8 adapter_func;
 	struct cyapa *cyapa;
 	struct device *dev = &client->dev;
+	int error;
 
 	adapter_func = cyapa_check_adapter_functionality(client);
 	if (adapter_func == CYAPA_ADAPTER_FUNC_NONE) {
@@ -838,10 +839,8 @@ static int cyapa_probe(struct i2c_client *client,
 	}
 
 	cyapa = kzalloc(sizeof(struct cyapa), GFP_KERNEL);
-	if (!cyapa) {
-		dev_err(dev, "allocate memory for cyapa failed\n");
+	if (!cyapa)
 		return -ENOMEM;
-	}
 
 	cyapa->gen = CYAPA_GEN3;
 	cyapa->client = client;
@@ -853,33 +852,33 @@ static int cyapa_probe(struct i2c_client *client,
 	if (adapter_func == CYAPA_ADAPTER_FUNC_SMBUS)
 		cyapa->smbus = true;
 	cyapa->state = CYAPA_STATE_NO_DEVICE;
-	ret = cyapa_check_is_operational(cyapa);
-	if (ret) {
-		dev_err(dev, "device not operational, %d\n", ret);
+	error = cyapa_check_is_operational(cyapa);
+	if (error) {
+		dev_err(dev, "device not operational, %d\n", error);
 		goto err_mem_free;
 	}
 
-	ret = cyapa_create_input_dev(cyapa);
-	if (ret) {
-		dev_err(dev, "create input_dev instance failed, %d\n", ret);
+	error = cyapa_create_input_dev(cyapa);
+	if (error) {
+		dev_err(dev, "create input_dev instance failed, %d\n", error);
 		goto err_mem_free;
 	}
 
-	ret = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);
-	if (ret) {
-		dev_err(dev, "set active power failed, %d\n", ret);
+	error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);
+	if (error) {
+		dev_err(dev, "set active power failed, %d\n", error);
 		goto err_unregister_device;
 	}
 
 	cyapa->irq = client->irq;
-	ret = request_threaded_irq(cyapa->irq,
+	error = request_threaded_irq(cyapa->irq,
 				   NULL,
 				   cyapa_irq,
 				   IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 				   "cyapa",
 				   cyapa);
-	if (ret) {
-		dev_err(dev, "IRQ request failed: %d\n, ", ret);
+	if (error) {
+		dev_err(dev, "IRQ request failed: %d\n, ", error);
 		goto err_unregister_device;
 	}
 
@@ -890,7 +889,7 @@ err_unregister_device:
 err_mem_free:
 	kfree(cyapa);
 
-	return ret;
+	return error;
 }
 
 static int cyapa_remove(struct i2c_client *client)
@@ -908,7 +907,7 @@ static int cyapa_remove(struct i2c_client *client)
 #ifdef CONFIG_PM_SLEEP
 static int cyapa_suspend(struct device *dev)
 {
-	int ret;
+	int error;
 	u8 power_mode;
 	struct cyapa *cyapa = dev_get_drvdata(dev);
 
@@ -920,9 +919,9 @@ static int cyapa_suspend(struct device *dev)
 	 */
 	power_mode = device_may_wakeup(dev) ? PWR_MODE_IDLE
 					    : PWR_MODE_OFF;
-	ret = cyapa_set_power_mode(cyapa, power_mode);
-	if (ret < 0)
-		dev_err(dev, "set power mode failed, %d\n", ret);
+	error = cyapa_set_power_mode(cyapa, power_mode);
+	if (error)
+		dev_err(dev, "set power mode failed, %d\n", error);
 
 	if (device_may_wakeup(dev))
 		cyapa->irq_wake = (enable_irq_wake(cyapa->irq) == 0);
@@ -931,15 +930,15 @@ static int cyapa_suspend(struct device *dev)
 
 static int cyapa_resume(struct device *dev)
 {
-	int ret;
+	int error;
 	struct cyapa *cyapa = dev_get_drvdata(dev);
 
 	if (device_may_wakeup(dev) && cyapa->irq_wake)
 		disable_irq_wake(cyapa->irq);
 
-	ret = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);
-	if (ret)
-		dev_warn(dev, "resume active power failed, %d\n", ret);
+	error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);
+	if (error)
+		dev_warn(dev, "resume active power failed, %d\n", error);
 
 	enable_irq(cyapa->irq);
 	return 0;
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v11 2/19 input: cyapa: add device resource management infrastructure support

In reply to Dudley Du

Remove cyapa_remove() method, add cyapa_open() and cyapa_close() methods for input interface, also modified together with driver's memory and IRQ resource allocations to support device resource management infrastructure to reduce the mistakes of resource management.
TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.c | 77 +++++++++++++++++++++++++--------------------
 1 file changed, 43 insertions(+), 34 deletions(-)
drivers/input/mouse/cyapa.c +43 -34
index c35f398..06c94a3 100644
@@ -753,6 +753,22 @@ static u8 cyapa_check_adapter_functionality(struct i2c_client *client)
 	return ret;
 }
 
+static int cyapa_open(struct input_dev *input)
+{
+	struct cyapa *cyapa = input_get_drvdata(input);
+	struct i2c_client *client = cyapa->client;
+
+	enable_irq(client->irq);
+	return 0;
+}
+
+static void cyapa_close(struct input_dev *input)
+{
+	struct cyapa *cyapa = input_get_drvdata(input);
+
+	disable_irq(cyapa->client->irq);
+}
+
 static int cyapa_create_input_dev(struct cyapa *cyapa)
 {
 	struct device *dev = &cyapa->client->dev;
@@ -762,7 +778,7 @@ static int cyapa_create_input_dev(struct cyapa *cyapa)
 	if (!cyapa->physical_size_x || !cyapa->physical_size_y)
 		return -EINVAL;
 
-	input = cyapa->input = input_allocate_device();
+	input = cyapa->input = devm_input_allocate_device(dev);
 	if (!input) {
 		dev_err(dev, "allocate memory for input device failed\n");
 		return -ENOMEM;
@@ -775,6 +791,9 @@ static int cyapa_create_input_dev(struct cyapa *cyapa)
 	input->id.product = 0;  /* means any product in eventcomm. */
 	input->dev.parent = &cyapa->client->dev;
 
+	input->open = cyapa_open;
+	input->close = cyapa_close;
+
 	input_set_drvdata(input, cyapa);
 
 	__set_bit(EV_ABS, input->evbit);
@@ -807,21 +826,17 @@ static int cyapa_create_input_dev(struct cyapa *cyapa)
 	if (error) {
 		dev_err(dev, "allocate memory for MT slots failed, %d\n",
 				error);
-		goto err_free_device;
+		return error;
 	}
 
 	/* Register the device in input subsystem */
 	error = input_register_device(input);
 	if (error) {
 		dev_err(dev, "input device register failed, %d\n", error);
-		goto err_free_device;
+		return error;
 	}
-	return 0;
 
-err_free_device:
-	input_free_device(input);
-	cyapa->input = NULL;
-	return error;
+	return 0;
 }
 
 static int cyapa_probe(struct i2c_client *client,
@@ -838,7 +853,7 @@ static int cyapa_probe(struct i2c_client *client,
 		return -EIO;
 	}
 
-	cyapa = kzalloc(sizeof(struct cyapa), GFP_KERNEL);
+	cyapa = devm_kzalloc(dev, sizeof(struct cyapa), GFP_KERNEL);
 	if (!cyapa)
 		return -ENOMEM;
 
@@ -855,51 +870,45 @@ static int cyapa_probe(struct i2c_client *client,
 	error = cyapa_check_is_operational(cyapa);
 	if (error) {
 		dev_err(dev, "device not operational, %d\n", error);
-		goto err_mem_free;
-	}
-
-	error = cyapa_create_input_dev(cyapa);
-	if (error) {
-		dev_err(dev, "create input_dev instance failed, %d\n", error);
-		goto err_mem_free;
+		return error;
 	}
 
 	error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);
 	if (error) {
 		dev_err(dev, "set active power failed, %d\n", error);
-		goto err_unregister_device;
+		return error;
 	}
 
 	cyapa->irq = client->irq;
-	error = request_threaded_irq(cyapa->irq,
-				   NULL,
-				   cyapa_irq,
-				   IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-				   "cyapa",
-				   cyapa);
+	error = devm_request_threaded_irq(dev,
+					cyapa->irq,
+					NULL,
+					cyapa_irq,
+					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+					"cyapa",
+					cyapa);
 	if (error) {
 		dev_err(dev, "IRQ request failed: %d\n, ", error);
-		goto err_unregister_device;
+		return error;
 	}
+	/* Disable IRQ until the device is opened. */
+	disable_irq(client->irq);
 
-	return 0;
-
-err_unregister_device:
-	input_unregister_device(cyapa->input);
-err_mem_free:
-	kfree(cyapa);
+	error = cyapa_create_input_dev(cyapa);
+	if (error) {
+		dev_err(dev, "create input_dev instance failed, %d\n", error);
+		return error;
+	}
 
-	return error;
+	return 0;
 }
 
 static int cyapa_remove(struct i2c_client *client)
 {
 	struct cyapa *cyapa = i2c_get_clientdata(client);
 
-	free_irq(cyapa->irq, cyapa);
-	input_unregister_device(cyapa->input);
+	disable_irq(cyapa->irq);
 	cyapa_set_power_mode(cyapa, PWR_MODE_OFF);
-	kfree(cyapa);
 
 	return 0;
 }
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v11 3/19 input: cyapa: re-design driver to support multi-trackpad in one driver

In reply to Dudley Du

In order to support multiple different chipsets and communication protocols trackpad devices in one cyapa driver, the new cyapa driver is re-designed with one cyapa driver core and multiple device specific functions component. The cyapa driver core is contained in this patch, it supplies basic functions that working with kernel and input subsystem, and also supplies the interfaces that the specific devices' component can connect and work together with as one driver.
TEST=test on Chromebooks.

---
 drivers/input/mouse/Makefile     |    3 +-
 drivers/input/mouse/cyapa.c      | 1148 ++++++++++++++------------------------
 drivers/input/mouse/cyapa.h      |  318 +++++++++++
 drivers/input/mouse/cyapa_gen3.c |  792 ++++++++++++++++++++++++++
 4 files changed, 1534 insertions(+), 727 deletions(-)
 create mode 100644 drivers/input/mouse/cyapa.h
 create mode 100644 drivers/input/mouse/cyapa_gen3.c
drivers/input/mouse/Makefile +2 -1
index dda507f..4bf6c83 100644
@@ -8,7 +8,7 @@ obj-$(CONFIG_MOUSE_AMIGA)		+= amimouse.o
 obj-$(CONFIG_MOUSE_APPLETOUCH)		+= appletouch.o
 obj-$(CONFIG_MOUSE_ATARI)		+= atarimouse.o
 obj-$(CONFIG_MOUSE_BCM5974)		+= bcm5974.o
-obj-$(CONFIG_MOUSE_CYAPA)		+= cyapa.o
+obj-$(CONFIG_MOUSE_CYAPA)		+= cyapatp.o
 obj-$(CONFIG_MOUSE_GPIO)		+= gpio_mouse.o
 obj-$(CONFIG_MOUSE_INPORT)		+= inport.o
 obj-$(CONFIG_MOUSE_LOGIBM)		+= logibm.o
@@ -23,6 +23,7 @@ obj-$(CONFIG_MOUSE_SYNAPTICS_I2C)	+= synaptics_i2c.o
 obj-$(CONFIG_MOUSE_SYNAPTICS_USB)	+= synaptics_usb.o
 obj-$(CONFIG_MOUSE_VSXXXAA)		+= vsxxxaa.o
 
+cyapatp-objs := cyapa.o cyapa_gen3.o
 psmouse-objs := psmouse-base.o synaptics.o focaltech.o
 
 psmouse-$(CONFIG_MOUSE_PS2_ALPS)	+= alps.o
drivers/input/mouse/cyapa.c +422 -726

1,348 lines not on this page · raw message

drivers/input/mouse/cyapa.h new file +318 -0

318 lines not on this page · raw message

drivers/input/mouse/cyapa_gen3.c new file +792 -0

792 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#4 lore raw

PATCH v11 4/19 input: cyapa: add gen5 trackpad device basic functions support

In reply to Dudley Du

Based on the cyapa core, add the gen5 trackpad device's basic functions supported, so gen5 trackpad device can work with kernel input system. And also based on the state parse interface, the cyapa driver can automatically determine the attached is gen3 or gen5 protocol trackpad device, then set the correct protocol to work with the attached trackpad device.
TEST=test on Chromebooks.

---
 drivers/input/mouse/Makefile     |    2 +-
 drivers/input/mouse/cyapa.c      |   13 +
 drivers/input/mouse/cyapa.h      |    1 +
 drivers/input/mouse/cyapa_gen5.c | 1658 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 1673 insertions(+), 1 deletion(-)
 create mode 100644 drivers/input/mouse/cyapa_gen5.c
drivers/input/mouse/Makefile +1 -1
index 4bf6c83..1d3d997 100644
@@ -23,7 +23,7 @@ obj-$(CONFIG_MOUSE_SYNAPTICS_I2C)	+= synaptics_i2c.o
 obj-$(CONFIG_MOUSE_SYNAPTICS_USB)	+= synaptics_usb.o
 obj-$(CONFIG_MOUSE_VSXXXAA)		+= vsxxxaa.o
 
-cyapatp-objs := cyapa.o cyapa_gen3.o
+cyapatp-objs := cyapa.o cyapa_gen3.o cyapa_gen5.o
 psmouse-objs := psmouse-base.o synaptics.o focaltech.o
 
 psmouse-$(CONFIG_MOUSE_PS2_ALPS)	+= alps.o
drivers/input/mouse/cyapa.c +13 -0
index 3771c5b..a053a90 100644
@@ -275,6 +275,9 @@ static int cyapa_check_is_operational(struct cyapa *cyapa)
 		return error;
 
 	switch (cyapa->gen) {
+	case CYAPA_GEN5:
+		cyapa->ops = &cyapa_gen5_ops;
+		break;
 	case CYAPA_GEN3:
 		cyapa->ops = &cyapa_gen3_ops;
 		break;
@@ -380,6 +383,14 @@ static int cyapa_get_state(struct cyapa *cyapa)
 			if (!error)
 				goto out_detected;
 		}
+		if ((cyapa->gen == CYAPA_GEN_UNKNOWN ||
+				cyapa->gen == CYAPA_GEN5) &&
+			!smbus && even_addr) {
+			error = cyapa_gen5_ops.state_parse(cyapa,
+					status, BL_STATUS_SIZE);
+			if (!error)
+				goto out_detected;
+		}
 
 		/*
 		 * Write 0x00 0x00 to trackpad device to force update its
@@ -518,6 +529,8 @@ static int cyapa_initialize(struct cyapa *cyapa)
 
 	if (cyapa_gen3_ops.initialize)
 		error = cyapa_gen3_ops.initialize(cyapa);
+	if (!error && cyapa_gen5_ops.initialize)
+		error = cyapa_gen5_ops.initialize(cyapa);
 	if (error)
 		return error;
 
drivers/input/mouse/cyapa.h +1 -0
index aebc777..10eaff0 100644
@@ -314,5 +314,6 @@ u16 cyapa_pwr_cmd_to_sleep_time(u8 pwr_mode);
 
 extern const char unique_str[];
 extern const struct cyapa_dev_ops cyapa_gen3_ops;
+extern const struct cyapa_dev_ops cyapa_gen5_ops;
 
 #endif
drivers/input/mouse/cyapa_gen5.c new file +1658 -0

1,658 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#5 lore raw

PATCH v11 5/19 input: cyapa: add power management interfaces supported for the device

In reply to Dudley Du

Add suspend_scanrate_ms power management interfaces in device's power group, so users or applications can control the power management strategy of trackpad device as their requirements. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.c | 105 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)
drivers/input/mouse/cyapa.c +105 -0
index a053a90..9fc60c3 100644
@@ -505,6 +505,90 @@ u16 cyapa_pwr_cmd_to_sleep_time(u8 pwr_mode)
 				   : (encoded_time - 5) * 20;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static ssize_t cyapa_show_suspend_scanrate(struct device *dev,
+					   struct device_attribute *attr,
+					   char *buf)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	u8 pwr_cmd = cyapa->suspend_power_mode;
+	u16 sleep_time;
+	int len;
+	int error;
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+	pwr_cmd = cyapa->suspend_power_mode;
+	sleep_time = cyapa->suspend_sleep_time;
+	mutex_unlock(&cyapa->state_sync_lock);
+
+	if (pwr_cmd == PWR_MODE_BTN_ONLY) {
+		len = scnprintf(buf, PAGE_SIZE, "%s\n", BTN_ONLY_MODE_NAME);
+	} else if (pwr_cmd == PWR_MODE_OFF) {
+		len = scnprintf(buf, PAGE_SIZE, "%s\n", OFF_MODE_NAME);
+	} else {
+		if (cyapa->gen == CYAPA_GEN3)
+			sleep_time = cyapa_pwr_cmd_to_sleep_time(pwr_cmd);
+		len = scnprintf(buf, PAGE_SIZE, "%u\n", sleep_time);
+	}
+
+	return len;
+}
+
+static ssize_t cyapa_update_suspend_scanrate(struct device *dev,
+					     struct device_attribute *attr,
+					     const char *buf, size_t count)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	u16 sleep_time;
+	int error;
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+
+	if (sysfs_streq(buf, BTN_ONLY_MODE_NAME)) {
+		cyapa->suspend_power_mode = PWR_MODE_BTN_ONLY;
+	} else if (sysfs_streq(buf, OFF_MODE_NAME)) {
+		cyapa->suspend_power_mode = PWR_MODE_OFF;
+	} else if (!kstrtou16(buf, 10, &sleep_time)) {
+		cyapa->suspend_sleep_time = max_t(u16, sleep_time, 1000);
+		cyapa->suspend_power_mode =
+			cyapa_sleep_time_to_pwr_cmd(cyapa->suspend_sleep_time);
+	} else {
+		count = 0;
+	}
+
+	mutex_unlock(&cyapa->state_sync_lock);
+	if (!count)
+		dev_err(dev, "invalid suspend scanrate ms parameters\n");
+	return count ? count : -EINVAL;
+}
+
+static DEVICE_ATTR(suspend_scanrate_ms, S_IRUGO|S_IWUSR,
+		   cyapa_show_suspend_scanrate,
+		   cyapa_update_suspend_scanrate);
+
+static struct attribute *cyapa_power_wakeup_entries[] = {
+	&dev_attr_suspend_scanrate_ms.attr,
+	NULL,
+};
+
+static const struct attribute_group cyapa_power_wakeup_group = {
+	.name = power_group_name,
+	.attrs = cyapa_power_wakeup_entries,
+};
+
+static void cyapa_remove_power_wakeup_group(void *data)
+{
+	struct cyapa *cyapa = data;
+
+	sysfs_unmerge_group(&cyapa->client->dev.kobj,
+				&cyapa_power_wakeup_group);
+}
+#endif /* CONFIG_PM_SLEEP */
+
 /*
  * Returns:
  *   0    Driver and device initialization successfully done.
@@ -576,6 +660,27 @@ static int cyapa_probe(struct i2c_client *client,
 		return error;
 	}
 
+#ifdef CONFIG_PM_SLEEP
+	if (device_can_wakeup(dev)) {
+		error = sysfs_merge_group(&client->dev.kobj,
+					&cyapa_power_wakeup_group);
+		if (error) {
+			dev_err(dev, "failed to add power wakeup group: %d\n",
+				error);
+			return error;
+		}
+
+		error = devm_add_action(dev,
+				cyapa_remove_power_wakeup_group, cyapa);
+		if (error) {
+			cyapa_remove_power_wakeup_group(cyapa);
+			dev_err(dev, "failed to add power cleanup action: %d\n",
+				error);
+			return error;
+		}
+	}
+#endif /* CONFIG_PM_SLEEP */
+
 	error = devm_request_threaded_irq(dev,
 					client->irq,
 					NULL,
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH v11 6/19 input: cyapa: add runtime power management interfaces supported for the device

In reply to Dudley Du

Add runtime_suspend_scanrate_ms power management interfaces in device's power group, so users or applications can control the runtime power management strategy of trackpad device as their requirements. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.c | 167 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/input/mouse/cyapa.h |   4 ++
 2 files changed, 171 insertions(+)
drivers/input/mouse/cyapa.c +167 -0
index 9fc60c3..64bb067 100644
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
+#include <linux/pm_runtime.h>
 #include "cyapa.h"
 
 
@@ -153,6 +154,7 @@ static void cyapa_close(struct input_dev *input)
 
 	disable_irq(cyapa->client->irq);
 	cyapa->opened = false;
+	pm_runtime_disable(&cyapa->client->dev);
 
 	if (cyapa->operational && cyapa->ops->set_power_mode)
 		cyapa->ops->set_power_mode(cyapa, PWR_MODE_OFF, 0);
@@ -303,6 +305,7 @@ static irqreturn_t cyapa_irq(int irq, void *dev_id)
 	struct device *dev = &cyapa->client->dev;
 	bool cont;
 
+	pm_runtime_get_sync(dev);
 	if (device_may_wakeup(dev))
 		pm_wakeup_event(dev, 0);
 
@@ -327,6 +330,8 @@ static irqreturn_t cyapa_irq(int irq, void *dev_id)
 	}
 
 out:
+	pm_runtime_mark_last_busy(dev);
+	pm_runtime_put_sync_autosuspend(dev);
 	return IRQ_HANDLED;
 }
 
@@ -589,6 +594,116 @@ static void cyapa_remove_power_wakeup_group(void *data)
 }
 #endif /* CONFIG_PM_SLEEP */
 
+#ifdef CONFIG_PM_RUNTIME
+static ssize_t cyapa_show_rt_suspend_scanrate(struct device *dev,
+					      struct device_attribute *attr,
+					      char *buf)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	u8 pwr_cmd;
+	u16 sleep_time;
+	int error;
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+	pwr_cmd = cyapa->runtime_suspend_power_mode;
+	sleep_time = cyapa->runtime_suspend_sleep_time;
+	mutex_unlock(&cyapa->state_sync_lock);
+
+	if (cyapa->gen == CYAPA_GEN3)
+		return scnprintf(buf, PAGE_SIZE, "%u\n",
+			cyapa_pwr_cmd_to_sleep_time(pwr_cmd));
+	return scnprintf(buf, PAGE_SIZE, "%u\n", sleep_time);
+}
+
+static ssize_t cyapa_update_rt_suspend_scanrate(struct device *dev,
+						struct device_attribute *attr,
+						const char *buf, size_t count)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	u16 time;
+	int error;
+
+	if (buf == NULL || count == 0 || kstrtou16(buf, 10, &time)) {
+		dev_err(dev, "invalid runtime suspend scanrate ms parameter\n");
+		return -EINVAL;
+	}
+
+	/*
+	 * When the suspend scanrate is changed, pm_runtime_get to resume
+	 * a potentially suspended device, update to the new pwr_cmd
+	 * and then pm_runtime_put to suspend into the new power mode.
+	 */
+	pm_runtime_get_sync(dev);
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+	cyapa->runtime_suspend_sleep_time = max_t(u16, time, 1000);
+	cyapa->runtime_suspend_power_mode =
+		cyapa_sleep_time_to_pwr_cmd(cyapa->runtime_suspend_sleep_time);
+	mutex_unlock(&cyapa->state_sync_lock);
+	pm_runtime_put_sync_autosuspend(dev);
+
+	return count;
+}
+
+static DEVICE_ATTR(runtime_suspend_scanrate_ms, S_IRUGO|S_IWUSR,
+		   cyapa_show_rt_suspend_scanrate,
+		   cyapa_update_rt_suspend_scanrate);
+
+static struct attribute *cyapa_power_runtime_entries[] = {
+	&dev_attr_runtime_suspend_scanrate_ms.attr,
+	NULL,
+};
+
+static const struct attribute_group cyapa_power_runtime_group = {
+	.name = power_group_name,
+	.attrs = cyapa_power_runtime_entries,
+};
+
+static void cyapa_remove_power_runtime_group(void *data)
+{
+	struct cyapa *cyapa = data;
+
+	sysfs_unmerge_group(&cyapa->client->dev.kobj,
+				&cyapa_power_runtime_group);
+}
+
+static int cyapa_start_runtime(struct cyapa *cyapa)
+{
+	struct device *dev = &cyapa->client->dev;
+	int error;
+
+	cyapa->runtime_suspend_power_mode = PWR_MODE_IDLE;
+	cyapa->runtime_suspend_sleep_time =
+		cyapa_pwr_cmd_to_sleep_time(cyapa->runtime_suspend_power_mode);
+
+	error = sysfs_merge_group(&dev->kobj, &cyapa_power_runtime_group);
+	if (error) {
+		dev_err(dev,
+			"failed to create power runtime group: %d\n", error);
+		return error;
+	}
+
+	error = devm_add_action(dev, cyapa_remove_power_runtime_group, cyapa);
+	if (error) {
+		cyapa_remove_power_runtime_group(cyapa);
+		dev_err(dev,
+			"failed to add power runtime cleanup action: %d\n",
+			error);
+		return error;
+	}
+
+	pm_runtime_set_active(dev);
+	pm_runtime_use_autosuspend(dev);
+	pm_runtime_set_autosuspend_delay(dev, AUTOSUSPEND_DELAY);
+	pm_runtime_enable(dev);
+
+	return 0;
+}
+#endif /* CONFIG_PM_RUNTIME */
+
 /*
  * Returns:
  *   0    Driver and device initialization successfully done.
@@ -681,6 +796,14 @@ static int cyapa_probe(struct i2c_client *client,
 	}
 #endif /* CONFIG_PM_SLEEP */
 
+#ifdef CONFIG_PM_RUNTIME
+	error = cyapa_start_runtime(cyapa);
+	if (error) {
+		dev_err(dev, "failed to start pm_runtime: %d\n", error);
+		return error;
+	}
+#endif /* CONFIG_PM_RUNTIME */
+
 	error = devm_request_threaded_irq(dev,
 					client->irq,
 					NULL,
@@ -715,6 +838,7 @@ static int __maybe_unused cyapa_suspend(struct device *dev)
 	if (error)
 		return error;
 
+	pm_runtime_disable(dev);
 	/*
 	 * Disable IRQ to avoid the command response interrupt cause system
 	 * suspending process interrupted and failed.
@@ -738,6 +862,8 @@ static int __maybe_unused cyapa_suspend(struct device *dev)
 					error);
 	}
 
+	pm_runtime_set_suspended(dev);
+
 	if (device_may_wakeup(dev))
 		cyapa->irq_wake = (enable_irq_wake(cyapa->client->irq) == 0);
 
@@ -757,18 +883,59 @@ static int __maybe_unused cyapa_resume(struct device *dev)
 		cyapa->irq_wake = false;
 	}
 
+	/* Runtime set active to reflect active state. */
+	pm_runtime_set_active(dev);
+
 	/* Re-detect device state and reset it to active power mode. */
 	cyapa_detect(cyapa);
 
 	if (cyapa->opened)
 		enable_irq(cyapa->client->irq);
 
+	pm_runtime_enable(dev);
+
 	mutex_unlock(&cyapa->state_sync_lock);
 	return 0;
 }
 
+#ifdef CONFIG_PM_RUNTIME
+static int cyapa_runtime_suspend(struct device *dev)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	int error;
+
+	if (cyapa->operational && cyapa->ops->set_power_mode) {
+		/* Set trackpad device to idle mode. */
+		error = cyapa->ops->set_power_mode(cyapa,
+				cyapa->runtime_suspend_power_mode,
+				cyapa->runtime_suspend_sleep_time);
+		if (error)
+			dev_err(dev, "runtime suspend failed: %d\n", error);
+	}
+
+	return 0;
+}
+
+static int cyapa_runtime_resume(struct device *dev)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	int error;
+
+	if (cyapa->operational && cyapa->ops->set_power_mode) {
+		/* Resume to full active mode. */
+		error = cyapa->ops->set_power_mode(cyapa,
+				PWR_MODE_FULL_ACTIVE, 0);
+		if (error)
+			dev_err(dev, "runtime resume failed: %d\n", error);
+	}
+
+	return 0;
+}
+#endif /* CONFIG_PM_RUNTIME */
+
 static const struct dev_pm_ops cyapa_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(cyapa_suspend, cyapa_resume)
+	SET_RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume, NULL)
 };
 
 static const struct i2c_device_id cyapa_id_table[] = {
drivers/input/mouse/cyapa.h +4 -0
index 10eaff0..a1a42f2 100644
@@ -263,6 +263,10 @@ struct cyapa {
 	/* power mode settings */
 	u8 suspend_power_mode;
 	u16 suspend_sleep_time;
+#ifdef CONFIG_PM_RUNTIME
+	u8 runtime_suspend_power_mode;
+	u16 runtime_suspend_sleep_time;
+#endif /* CONFIG_PM_RUNTIME */
 	u8 dev_pwr_mode;
 	u16 dev_sleep_time;
 
Signature · 1 line
1.9.1
author
#7 lore raw

PATCH v11 7/19 input: cyapa: add sysfs interfaces supported in the cyapa driver

In reply to Dudley Du

Add device's basic control and features supported in cyapa driver through sysfs file system interfaces. These interfaces are commonly used in pre- and after production, for trackpad device state checking, managing and firmware image updating.
These interfaces including mode, firmware_version and product_id interfaces for reading firmware version and trackpad device product id values, and including update_fw interface to command firmware image update process. Also including baseline and calibrate interfaces for reading and checking trackpad device's sensors states. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.c | 301 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 301 insertions(+)
drivers/input/mouse/cyapa.c +301 -0
index 64bb067..305dffe 100644
@@ -32,6 +32,8 @@
 #define CYAPA_ADAPTER_FUNC_SMBUS  2
 #define CYAPA_ADAPTER_FUNC_BOTH   3
 
+#define CYAPA_FW_NAME		"cyapa.bin"
+
 const char unique_str[] = "CYTRA";
 
 /* Returns 0 on success, else negative errno on failure. */
@@ -475,6 +477,25 @@ int cyapa_detect(struct cyapa *cyapa)
 	return 0;
 }
 
+static void cyapa_enable_irq_for_cmd(struct cyapa *cyapa)
+{
+	if (!cyapa->opened) {
+		if (cyapa->operational && cyapa->ops->set_power_mode)
+			cyapa->ops->set_power_mode(cyapa,
+				PWR_MODE_FULL_ACTIVE, 0);
+		enable_irq(cyapa->client->irq);
+	}
+}
+
+static void cyapa_disable_irq_for_cmd(struct cyapa *cyapa)
+{
+	if (!cyapa->opened) {
+		disable_irq(cyapa->client->irq);
+		if (cyapa->operational && cyapa->ops->set_power_mode)
+			cyapa->ops->set_power_mode(cyapa, PWR_MODE_OFF, 0);
+	}
+}
+
 /*
  * Sysfs Interface.
  */
@@ -704,6 +725,273 @@ static int cyapa_start_runtime(struct cyapa *cyapa)
 }
 #endif /* CONFIG_PM_RUNTIME */
 
+static ssize_t cyapa_show_fm_ver(struct device *dev,
+				 struct device_attribute *attr, char *buf)
+{
+	int error;
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+	error = scnprintf(buf, PAGE_SIZE, "%d.%d\n", cyapa->fw_maj_ver,
+			 cyapa->fw_min_ver);
+	mutex_unlock(&cyapa->state_sync_lock);
+	return error;
+}
+
+static ssize_t cyapa_show_product_id(struct device *dev,
+				     struct device_attribute *attr, char *buf)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	int size;
+	int error;
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+	size = scnprintf(buf, PAGE_SIZE, "%s\n", cyapa->product_id);
+	mutex_unlock(&cyapa->state_sync_lock);
+	return size;
+}
+
+static int cyapa_firmware(struct cyapa *cyapa, const char *fw_name)
+{
+	struct device *dev = &cyapa->client->dev;
+	const struct firmware *fw;
+	int error;
+
+	error = request_firmware(&fw, fw_name, dev);
+	if (error) {
+		dev_err(dev, "Could not load firmware from %s: %d\n",
+			fw_name, error);
+		return error;
+	}
+
+	if (cyapa->ops->check_fw) {
+		error = cyapa->ops->check_fw(cyapa, fw);
+		if (error) {
+			dev_err(dev, "Invalid CYAPA firmware image: %s\n",
+					fw_name);
+			goto done;
+		}
+	} else {
+		dev_err(dev, "No valid device ops->check_fw handler set.\n");
+		error = -ENODEV;
+		goto done;
+	}
+
+	/*
+	 * Resume the potentially suspended device because doing FW
+	 * update on a device not in the FULL mode has a chance to
+	 * fail.
+	 */
+	pm_runtime_get_sync(dev);
+
+	if (cyapa->ops->bl_enter) {
+		error = cyapa->ops->bl_enter(cyapa);
+		if (error)
+			goto err_detect;
+	}
+
+	if (cyapa->ops->bl_activate) {
+		error = cyapa->ops->bl_activate(cyapa);
+		if (error)
+			goto err_detect;
+	}
+
+	if (cyapa->ops->bl_initiate) {
+		error = cyapa->ops->bl_initiate(cyapa, fw);
+		if (error)
+			goto err_detect;
+	}
+
+	if (cyapa->ops->update_fw) {
+		error = cyapa->ops->update_fw(cyapa, fw);
+		if (error)
+			goto err_detect;
+	}
+
+	if (cyapa->ops->bl_verify_app_integrity) {
+		error = cyapa->ops->bl_verify_app_integrity(cyapa);
+		if (error)
+			goto err_detect;
+	}
+
+err_detect:
+	pm_runtime_put_noidle(dev);
+
+done:
+	release_firmware(fw);
+	return error;
+}
+
+static ssize_t cyapa_update_fw_store(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	char fw_name[64];
+	int error;
+
+	if (count > 64) {
+		dev_err(dev, "File name too long\n");
+		return -EINVAL;
+	}
+
+	memcpy(fw_name, buf, count);
+	if (fw_name[count - 1] == '\n')
+		fw_name[count - 1] = '\0';
+	else
+		fw_name[count] = '\0';
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+
+	/* Require IRQ support for firmware update commands. */
+	cyapa_enable_irq_for_cmd(cyapa);
+
+	if (cyapa->operational)
+		cyapa->operational = false;
+
+	error = cyapa_firmware(cyapa, fw_name);
+	if (error)
+		dev_err(dev, "firmware update failed: %d\n", error);
+	else
+		dev_dbg(dev, "firmware update successfully done.\n");
+
+	cyapa_disable_irq_for_cmd(cyapa);
+
+	/*
+	 * Redetect trackpad device states because firmware update process
+	 * will reset trackpad device into bootloader mode.
+	 */
+	cyapa_detect(cyapa);
+
+	mutex_unlock(&cyapa->state_sync_lock);
+
+	return error ? error : count;
+}
+
+static ssize_t cyapa_calibrate_store(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	int error;
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+
+	/* Require IRQ support for force calibrate commands. */
+	cyapa_enable_irq_for_cmd(cyapa);
+
+	if (!cyapa->ops->calibrate_store) {
+		dev_err(dev, "Calibrate operation not supported.\n");
+		error = -ENOTSUPP;
+	} else {
+		error = cyapa->ops->calibrate_store(dev, attr, buf, count);
+	}
+
+	cyapa_disable_irq_for_cmd(cyapa);
+
+	mutex_unlock(&cyapa->state_sync_lock);
+	return error < 0 ? error : count;
+}
+
+static ssize_t cyapa_show_baseline(struct device *dev,
+				   struct device_attribute *attr, char *buf)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	ssize_t error;
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+
+	/* Require IRQ support for read baseline commands. */
+	cyapa_enable_irq_for_cmd(cyapa);
+
+	if (!cyapa->ops->show_baseline) {
+		dev_err(dev, "Calibrate operation not supported.\n");
+		error = -ENOTSUPP;
+	} else {
+		error = cyapa->ops->show_baseline(dev, attr, buf);
+	}
+
+	cyapa_disable_irq_for_cmd(cyapa);
+
+	mutex_unlock(&cyapa->state_sync_lock);
+	return error;
+}
+
+static char *cyapa_state_to_string(struct cyapa *cyapa)
+{
+	switch (cyapa->state) {
+	case CYAPA_STATE_BL_BUSY:
+		return "bootloader busy";
+	case CYAPA_STATE_BL_IDLE:
+		return "bootloader idle";
+	case CYAPA_STATE_BL_ACTIVE:
+		return "bootloader active";
+	case CYAPA_STATE_GEN5_BL:
+		return "bootloader";
+	case CYAPA_STATE_OP:
+	case CYAPA_STATE_GEN5_APP:
+		return "operational";
+	default:
+		return "invalid mode";
+	}
+}
+
+static ssize_t cyapa_show_mode(struct device *dev,
+				   struct device_attribute *attr, char *buf)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	int size;
+	int error;
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+
+	size = scnprintf(buf, PAGE_SIZE, "gen%d %s\n",
+			cyapa->gen, cyapa_state_to_string(cyapa));
+
+	mutex_unlock(&cyapa->state_sync_lock);
+	return size;
+}
+
+static DEVICE_ATTR(firmware_version, S_IRUGO, cyapa_show_fm_ver, NULL);
+static DEVICE_ATTR(product_id, S_IRUGO, cyapa_show_product_id, NULL);
+static DEVICE_ATTR(update_fw, S_IWUSR, NULL, cyapa_update_fw_store);
+static DEVICE_ATTR(baseline, S_IRUGO, cyapa_show_baseline, NULL);
+static DEVICE_ATTR(calibrate, S_IWUSR, NULL, cyapa_calibrate_store);
+static DEVICE_ATTR(mode, S_IRUGO, cyapa_show_mode, NULL);
+
+static struct attribute *cyapa_sysfs_entries[] = {
+	&dev_attr_firmware_version.attr,
+	&dev_attr_product_id.attr,
+	&dev_attr_update_fw.attr,
+	&dev_attr_baseline.attr,
+	&dev_attr_calibrate.attr,
+	&dev_attr_mode.attr,
+	NULL,
+};
+
+static const struct attribute_group cyapa_sysfs_group = {
+	.attrs = cyapa_sysfs_entries,
+};
+
+static void cyapa_remove_sysfs_group(void *data)
+{
+	struct cyapa *cyapa = data;
+
+	sysfs_remove_group(&cyapa->client->dev.kobj, &cyapa_sysfs_group);
+}
+
 /*
  * Returns:
  *   0    Driver and device initialization successfully done.
@@ -775,6 +1063,19 @@ static int cyapa_probe(struct i2c_client *client,
 		return error;
 	}
 
+	error = sysfs_create_group(&client->dev.kobj, &cyapa_sysfs_group);
+	if (error) {
+		dev_err(dev, "failed to create sysfs entries: %d\n", error);
+		return error;
+	}
+
+	error = devm_add_action(dev, cyapa_remove_sysfs_group, cyapa);
+	if (error) {
+		cyapa_remove_sysfs_group(cyapa);
+		dev_err(dev, "failed to add sysfs cleanup action: %d\n", error);
+		return error;
+	}
+
 #ifdef CONFIG_PM_SLEEP
 	if (device_can_wakeup(dev)) {
 		error = sysfs_merge_group(&client->dev.kobj,
Signature · 1 line
1.9.1
author
#8 lore raw

PATCH v11 8/19 input: cyapa: add gen3 trackpad device firmware update function support

In reply to Dudley Du

Add firmware image update function supported for gen3 trackpad device, it can be used through sysfs update_fw interface.
TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa_gen3.c | 284 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 284 insertions(+)
drivers/input/mouse/cyapa_gen3.c +284 -0
index 58c23e1..fc1b781 100644
@@ -416,6 +416,72 @@ static int cyapa_gen3_state_parse(struct cyapa *cyapa, u8 *reg_data, int len)
 	return -EAGAIN;
 }
 
+/*
+ * Enter bootloader by soft resetting the device.
+ *
+ * If device is already in the bootloader, the function just returns.
+ * Otherwise, reset the device; after reset, device enters bootloader idle
+ * state immediately.
+ *
+ * Also, if device was unregister device from input core.  Device will
+ * re-register after it is detected following resumption of operational mode.
+ *
+ * Returns:
+ *   0 on success
+ *   -EAGAIN  device was reset, but is not now in bootloader idle state
+ *   < 0 if the device never responds within the timeout
+ */
+static int cyapa_gen3_bl_enter(struct cyapa *cyapa)
+{
+	int error;
+
+	error = cyapa_poll_state(cyapa, 500);
+	if (error)
+		return error;
+	if (cyapa->state == CYAPA_STATE_BL_IDLE) {
+		/* Already in BL_IDLE. Skipping reset. */
+		return 0;
+	}
+
+	if (cyapa->state != CYAPA_STATE_OP)
+		return -EAGAIN;
+
+	cyapa->state = CYAPA_STATE_NO_DEVICE;
+	error = cyapa_write_byte(cyapa, CYAPA_CMD_SOFT_RESET, 0x01);
+	if (error)
+		return -EIO;
+
+	usleep_range(25000, 50000);
+	error = cyapa_poll_state(cyapa, 500);
+	if (error)
+		return error;
+	if ((cyapa->state != CYAPA_STATE_BL_IDLE) ||
+		(cyapa->status[REG_BL_STATUS] & BL_STATUS_WATCHDOG))
+		return -EAGAIN;
+
+	return 0;
+}
+
+static int cyapa_gen3_bl_activate(struct cyapa *cyapa)
+{
+	int error;
+
+	error = cyapa_i2c_reg_write_block(cyapa, 0, sizeof(bl_activate),
+					bl_activate);
+	if (error)
+		return error;
+
+	/* Wait for bootloader to activate; takes between 2 and 12 seconds */
+	msleep(2000);
+	error = cyapa_poll_state(cyapa, 11000);
+	if (error)
+		return error;
+	if (cyapa->state != CYAPA_STATE_BL_ACTIVE)
+		return -EAGAIN;
+
+	return 0;
+}
+
 static int cyapa_gen3_bl_deactivate(struct cyapa *cyapa)
 {
 	int error;
@@ -476,6 +542,218 @@ static int cyapa_gen3_bl_exit(struct cyapa *cyapa)
 	return 0;
 }
 
+/* Used in gen3 bootloader commands. */
+static u16 cyapa_gen3_csum(const u8 *buf, size_t count)
+{
+	int i;
+	u16 csum = 0;
+
+	for (i = 0; i < count; i++)
+		csum += buf[i];
+
+	return csum;
+}
+
+/*
+ * Verify the integrity of a CYAPA firmware image file.
+ *
+ * The firmware image file is 30848 bytes, composed of 482 64-byte blocks.
+ *
+ * The first 2 blocks are the firmware header.
+ * The next 480 blocks are the firmware image.
+ *
+ * The first two bytes of the header hold the header checksum, computed by
+ * summing the other 126 bytes of the header.
+ * The last two bytes of the header hold the firmware image checksum, computed
+ * by summing the 30720 bytes of the image modulo 0xffff.
+ *
+ * Both checksums are stored little-endian.
+ */
+static int cyapa_gen3_check_fw(struct cyapa *cyapa, const struct firmware *fw)
+{
+	struct device *dev = &cyapa->client->dev;
+	u16 csum;
+	u16 csum_expected;
+
+	/* Firmware must match exact 30848 bytes = 482 64-byte blocks. */
+	if (fw->size != CYAPA_FW_SIZE) {
+		dev_err(dev, "invalid firmware size = %zu, expected %u.\n",
+			fw->size, CYAPA_FW_SIZE);
+		return -EINVAL;
+	}
+
+	/* Verify header block */
+	csum_expected = (fw->data[0] << 8) | fw->data[1];
+	csum = cyapa_gen3_csum(&fw->data[2], CYAPA_FW_HDR_SIZE - 2);
+	if (csum != csum_expected) {
+		dev_err(dev, "%s %04x, expected: %04x\n",
+			"invalid firmware header checksum = ",
+			csum, csum_expected);
+		return -EINVAL;
+	}
+
+	/* Verify firmware image */
+	csum_expected = (fw->data[CYAPA_FW_HDR_SIZE - 2] << 8) |
+			 fw->data[CYAPA_FW_HDR_SIZE - 1];
+	csum = cyapa_gen3_csum(&fw->data[CYAPA_FW_HDR_SIZE],
+			CYAPA_FW_DATA_SIZE);
+	if (csum != csum_expected) {
+		dev_err(dev, "%s %04x, expected: %04x\n",
+			"invalid firmware header checksum = ",
+			csum, csum_expected);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+/*
+ * Write a |len| byte long buffer |buf| to the device, by chopping it up into a
+ * sequence of smaller |CYAPA_CMD_LEN|-length write commands.
+ *
+ * The data bytes for a write command are prepended with the 1-byte offset
+ * of the data relative to the start of |buf|.
+ */
+static int cyapa_gen3_write_buffer(struct cyapa *cyapa,
+		const u8 *buf, size_t len)
+{
+	int error;
+	size_t i;
+	unsigned char cmd[CYAPA_CMD_LEN + 1];
+	size_t cmd_len;
+
+	for (i = 0; i < len; i += CYAPA_CMD_LEN) {
+		const u8 *payload = &buf[i];
+
+		cmd_len = (len - i >= CYAPA_CMD_LEN) ? CYAPA_CMD_LEN : len - i;
+		cmd[0] = i;
+		memcpy(&cmd[1], payload, cmd_len);
+
+		error = cyapa_i2c_reg_write_block(cyapa, 0, cmd_len + 1, cmd);
+		if (error)
+			return error;
+	}
+	return 0;
+}
+
+/*
+ * A firmware block write command writes 64 bytes of data to a single flash
+ * page in the device.  The 78-byte block write command has the format:
+ *   <0xff> <CMD> <Key> <Start> <Data> <Data-Checksum> <CMD Checksum>
+ *
+ *  <0xff>  - every command starts with 0xff
+ *  <CMD>   - the write command value is 0x39
+ *  <Key>   - write commands include an 8-byte key: { 00 01 02 03 04 05 06 07 }
+ *  <Block> - Memory Block number (address / 64) (16-bit, big-endian)
+ *  <Data>  - 64 bytes of firmware image data
+ *  <Data Checksum> - sum of 64 <Data> bytes, modulo 0xff
+ *  <CMD Checksum> - sum of 77 bytes, from 0xff to <Data Checksum>
+ *
+ * Each write command is split into 5 i2c write transactions of up to 16 bytes.
+ * Each transaction starts with an i2c register offset: (00, 10, 20, 30, 40).
+ */
+static int cyapa_gen3_write_fw_block(struct cyapa *cyapa,
+		u16 block, const u8 *data)
+{
+	int ret;
+	u8 cmd[78];
+	u8 status[BL_STATUS_SIZE];
+	/* Programming for one block can take about 100ms. */
+	int tries = 11;
+	u8 bl_status, bl_error;
+
+	/* Set write command and security key bytes. */
+	cmd[0] = 0xff;
+	cmd[1] = 0x39;
+	cmd[2] = 0x00;
+	cmd[3] = 0x01;
+	cmd[4] = 0x02;
+	cmd[5] = 0x03;
+	cmd[6] = 0x04;
+	cmd[7] = 0x05;
+	cmd[8] = 0x06;
+	cmd[9] = 0x07;
+	cmd[10] = block >> 8;
+	cmd[11] = block;
+	memcpy(&cmd[12], data, CYAPA_FW_BLOCK_SIZE);
+	cmd[76] = cyapa_gen3_csum(data, CYAPA_FW_BLOCK_SIZE);
+	cmd[77] = cyapa_gen3_csum(cmd, sizeof(cmd) - 1);
+
+	ret = cyapa_gen3_write_buffer(cyapa, cmd, sizeof(cmd));
+	if (ret)
+		return ret;
+
+	/* Wait for write to finish */
+	do {
+		usleep_range(10000, 20000);
+
+		/* Check block write command result status. */
+		ret = cyapa_i2c_reg_read_block(cyapa, BL_HEAD_OFFSET,
+					       BL_STATUS_SIZE, status);
+		if (ret != BL_STATUS_SIZE)
+			return (ret < 0) ? ret : -EIO;
+	} while ((status[REG_BL_STATUS] & BL_STATUS_BUSY) && --tries);
+
+	/* Ignore WATCHDOG bit and reserved bits. */
+	bl_status = status[REG_BL_STATUS] & ~BL_STATUS_REV_MASK;
+	bl_error = status[REG_BL_ERROR] & ~BL_ERROR_RESERVED;
+
+	if (bl_status & BL_STATUS_BUSY)
+		ret = -ETIMEDOUT;
+	else if (bl_status != BL_STATUS_RUNNING ||
+		bl_error != BL_ERROR_BOOTLOADING)
+		ret = -EIO;
+	else
+		ret = 0;
+
+	return ret;
+}
+
+static int cyapa_gen3_write_blocks(struct cyapa *cyapa,
+		size_t start_block, size_t block_count,
+		const u8 *image_data)
+{
+	int error;
+	int i;
+
+	for (i = 0; i < block_count; i++) {
+		size_t block = start_block + i;
+		size_t addr = i * CYAPA_FW_BLOCK_SIZE;
+		const u8 *data = &image_data[addr];
+
+		error = cyapa_gen3_write_fw_block(cyapa, block, data);
+		if (error)
+			return error;
+	}
+	return 0;
+}
+
+static int cyapa_gen3_do_fw_update(struct cyapa *cyapa,
+		const struct firmware *fw)
+{
+	struct device *dev = &cyapa->client->dev;
+	int error;
+
+	/* First write data, starting at byte 128  of fw->data */
+	error = cyapa_gen3_write_blocks(cyapa,
+		CYAPA_FW_DATA_BLOCK_START, CYAPA_FW_DATA_BLOCK_COUNT,
+		&fw->data[CYAPA_FW_HDR_BLOCK_COUNT * CYAPA_FW_BLOCK_SIZE]);
+	if (error) {
+		dev_err(dev, "FW update aborted, write image: %d\n", error);
+		return error;
+	}
+
+	/* Then write checksum */
+	error = cyapa_gen3_write_blocks(cyapa,
+		CYAPA_FW_HDR_BLOCK_START, CYAPA_FW_HDR_BLOCK_COUNT,
+		&fw->data[0]);
+	if (error) {
+		dev_err(dev, "FW update aborted, write checksum: %d\n", error);
+		return error;
+	}
+
+	return 0;
+}
+
 /*
  * cyapa_get_wait_time_for_pwr_cmd
  *
@@ -782,6 +1060,12 @@ static int cyapa_gen3_irq_handler(struct cyapa *cyapa)
 }
 
 const struct cyapa_dev_ops cyapa_gen3_ops = {
+	.check_fw = cyapa_gen3_check_fw,
+	.bl_enter = cyapa_gen3_bl_enter,
+	.bl_activate = cyapa_gen3_bl_activate,
+	.update_fw = cyapa_gen3_do_fw_update,
+	.bl_deactivate = cyapa_gen3_bl_deactivate,
+
 	.state_parse = cyapa_gen3_state_parse,
 	.operational_check = cyapa_gen3_do_operational_check,
 
Signature · 1 line
1.9.1
author
#9 lore raw

PATCH v11 9/19 input: cyapa: add gen3 trackpad device read baseline function support

In reply to Dudley Du

Add read baseline function supported for gen3 trackpad device, it can be used through sysfs baseline interface. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa_gen3.c | 71 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
drivers/input/mouse/cyapa_gen3.c +71 -0
index fc1b781..bc2be93 100644
@@ -754,6 +754,75 @@ static int cyapa_gen3_do_fw_update(struct cyapa *cyapa,
 	return 0;
 }
 
+static ssize_t cyapa_gen3_show_baseline(struct device *dev,
+				   struct device_attribute *attr, char *buf)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	int max_baseline, min_baseline;
+	int tries = 3;
+	int ret;
+
+	ret = cyapa_read_byte(cyapa, CYAPA_CMD_DEV_STATUS);
+	if (ret < 0) {
+		dev_err(dev, "Error reading dev status. err = %d\n", ret);
+		goto out;
+	}
+	if ((ret & CYAPA_DEV_NORMAL) != CYAPA_DEV_NORMAL) {
+		dev_warn(dev, "Trackpad device is busy. device state = 0x%x\n",
+			 ret);
+		ret = -EAGAIN;
+		goto out;
+	}
+
+	ret = cyapa_write_byte(cyapa, CYAPA_CMD_SOFT_RESET,
+			       OP_REPORT_BASELINE_MASK);
+	if (ret < 0) {
+		dev_err(dev, "Failed to send report baseline command. %d\n",
+			ret);
+		goto out;
+	}
+
+	do {
+		usleep_range(10000, 20000);
+
+		ret = cyapa_read_byte(cyapa, CYAPA_CMD_DEV_STATUS);
+		if (ret < 0) {
+			dev_err(dev, "Error reading dev status. err = %d\n",
+				ret);
+			goto out;
+		}
+		if ((ret & CYAPA_DEV_NORMAL) == CYAPA_DEV_NORMAL)
+			break;
+	} while (--tries);
+
+	if (tries == 0) {
+		dev_err(dev, "Device timed out going to Normal state.\n");
+		ret = -ETIMEDOUT;
+		goto out;
+	}
+
+	ret = cyapa_read_byte(cyapa, CYAPA_CMD_MAX_BASELINE);
+	if (ret < 0) {
+		dev_err(dev, "Failed to read max baseline. err = %d\n", ret);
+		goto out;
+	}
+	max_baseline = ret;
+
+	ret = cyapa_read_byte(cyapa, CYAPA_CMD_MIN_BASELINE);
+	if (ret < 0) {
+		dev_err(dev, "Failed to read min baseline. err = %d\n", ret);
+		goto out;
+	}
+	min_baseline = ret;
+
+	dev_dbg(dev, "Baseline report successful. Max: %d Min: %d\n",
+		max_baseline, min_baseline);
+	ret = scnprintf(buf, PAGE_SIZE, "%d %d\n", max_baseline, min_baseline);
+
+out:
+	return ret;
+}
+
 /*
  * cyapa_get_wait_time_for_pwr_cmd
  *
@@ -1066,6 +1135,8 @@ const struct cyapa_dev_ops cyapa_gen3_ops = {
 	.update_fw = cyapa_gen3_do_fw_update,
 	.bl_deactivate = cyapa_gen3_bl_deactivate,
 
+	.show_baseline = cyapa_gen3_show_baseline,
+
 	.state_parse = cyapa_gen3_state_parse,
 	.operational_check = cyapa_gen3_do_operational_check,
 
Signature · 1 line
1.9.1
author
#10 lore raw

PATCH v11 10/19 input: cyapa: add gen3 trackpad device force re-calibrate function support

In reply to Dudley Du

Add force re-calibrate function supported for gen3 trackpad device, it can be used through sysfs calibrate interface. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa_gen3.c | 58 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
drivers/input/mouse/cyapa_gen3.c +58 -0
index bc2be93..281209f 100644
@@ -754,6 +754,63 @@ static int cyapa_gen3_do_fw_update(struct cyapa *cyapa,
 	return 0;
 }
 
+static ssize_t cyapa_gen3_do_calibrate(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	int tries = 20;  /* max recalibration timeout 2s. */
+	int ret;
+
+	ret = cyapa_read_byte(cyapa, CYAPA_CMD_DEV_STATUS);
+	if (ret < 0) {
+		dev_err(dev, "Error reading dev status: %d\n", ret);
+		goto out;
+	}
+	if ((ret & CYAPA_DEV_NORMAL) != CYAPA_DEV_NORMAL) {
+		dev_warn(dev, "Trackpad device is busy, device state: 0x%02x\n",
+			 ret);
+		ret = -EAGAIN;
+		goto out;
+	}
+
+	ret = cyapa_write_byte(cyapa, CYAPA_CMD_SOFT_RESET,
+			       OP_RECALIBRATION_MASK);
+	if (ret < 0) {
+		dev_err(dev, "Failed to send calibrate command: %d\n",
+			ret);
+		goto out;
+	}
+
+	do {
+		/*
+		 * For this recalibration, the max time will not exceed 2s.
+		 * The average time is approximately 500 - 700 ms, and we
+		 * will check the status every 100 - 200ms.
+		 */
+		usleep_range(100000, 200000);
+
+		ret = cyapa_read_byte(cyapa, CYAPA_CMD_DEV_STATUS);
+		if (ret < 0) {
+			dev_err(dev, "Error reading dev status: %d\n",
+				ret);
+			goto out;
+		}
+		if ((ret & CYAPA_DEV_NORMAL) == CYAPA_DEV_NORMAL)
+			break;
+	} while (--tries);
+
+	if (tries == 0) {
+		dev_err(dev, "Failed to calibrate. Timeout.\n");
+		ret = -ETIMEDOUT;
+		goto out;
+	}
+	dev_dbg(dev, "Calibration successful.\n");
+
+out:
+	return ret < 0 ? ret : count;
+}
+
 static ssize_t cyapa_gen3_show_baseline(struct device *dev,
 				   struct device_attribute *attr, char *buf)
 {
@@ -1136,6 +1193,7 @@ const struct cyapa_dev_ops cyapa_gen3_ops = {
 	.bl_deactivate = cyapa_gen3_bl_deactivate,
 
 	.show_baseline = cyapa_gen3_show_baseline,
+	.calibrate_store = cyapa_gen3_do_calibrate,
 
 	.state_parse = cyapa_gen3_state_parse,
 	.operational_check = cyapa_gen3_do_operational_check,
Signature · 1 line
1.9.1
author
#11 lore raw

PATCH v11 11/19 input: cyapa: add gen5 trackpad device firmware update function support

In reply to Dudley Du

Add firmware image update function supported for gen5 trackpad device, it can be used through sysfs update_fw interface.
TEST=test on Chromebooks.

---
 drivers/input/mouse/Kconfig      |   2 +-
 drivers/input/mouse/cyapa_gen5.c | 290 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 291 insertions(+), 1 deletion(-)
drivers/input/mouse/Kconfig +1 -1
index 366fc7a..005d69b 100644
@@ -205,7 +205,7 @@ config MOUSE_BCM5974
 
 config MOUSE_CYAPA
 	tristate "Cypress APA I2C Trackpad support"
-	depends on I2C
+	depends on I2C && CRC_ITU_T
 	help
 	  This driver adds support for Cypress All Points Addressable (APA)
 	  I2C Trackpads, including the ones used in 2012 Samsung Chromebooks.
drivers/input/mouse/cyapa_gen5.c +290 -0

314 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#12 lore raw

PATCH v11 12/19 input: cyapa: add gen5 trackpad device read baseline function support

In reply to Dudley Du

Add read baseline function supported for gen5 trackpad device, it can be used through sysfs baseline interface. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.h      |   2 +
 drivers/input/mouse/cyapa_gen5.c | 621 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 623 insertions(+)
drivers/input/mouse/cyapa.h +2 -0
index a1a42f2..0dc76d8 100644
@@ -286,6 +286,8 @@ struct cyapa {
 	u8 y_origin;  /* Y Axis Origin: 0 = top; 1 = bottom. */
 	int electrodes_x;  /* Number of electrodes on the X Axis*/
 	int electrodes_y;  /* Number of electrodes on the Y Axis*/
+	int electrodes_rx;  /* Number of Rx electrodes */
+	int algined_electrodes_rx;  /* 4 aligned */
 	int max_z;
 
 	/*
drivers/input/mouse/cyapa_gen5.c +621 -0

633 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#13 lore raw

PATCH v11 13/19 input: cyapa: add gen5 trackpad device force re-calibrate function support

In reply to Dudley Du

Add force re-calibrate function supported for gen5 trackpad device, it can be used through sysfs calibrate interface. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa_gen5.c | 65 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
drivers/input/mouse/cyapa_gen5.c +65 -0
index b401b2a..51bdf06 100644
@@ -1580,6 +1580,70 @@ static int cyapa_gen5_suspend_scanning(struct cyapa *cyapa)
 	return 0;
 }
 
+static int cyapa_gen5_calibrate_pwcs(struct cyapa *cyapa,
+		u8 calibrate_sensing_mode_type)
+{
+	u8 cmd[8];
+	u8 resp_data[6];
+	int resp_len;
+	int error;
+
+	/* Try to dump all bufferred data before doing command. */
+	cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL);
+
+	cmd[0] = 0x04;
+	cmd[1] = 0x00;
+	cmd[2] = 0x06;
+	cmd[3] = 0x00;
+	cmd[4] = GEN5_APP_CMD_REPORT_ID;
+	cmd[5] = 0x00;
+	cmd[6] = GEN5_CMD_CALIBRATE;
+	cmd[7] = calibrate_sensing_mode_type;
+	resp_len = sizeof(resp_data);
+	error = cyapa_i2c_pip_cmd_irq_sync(cyapa,
+			cmd, sizeof(cmd),
+			resp_data, &resp_len,
+			5000, cyapa_gen5_sort_tsg_pip_app_resp_data, true);
+	if (error || !VALID_CMD_RESP_HEADER(resp_data, GEN5_CMD_CALIBRATE) ||
+			!GEN5_CMD_COMPLETE_SUCCESS(resp_data[5]))
+		return error < 0 ? error : -EAGAIN;
+
+	return 0;
+}
+
+static ssize_t cyapa_gen5_do_calibrate(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct cyapa *cyapa = dev_get_drvdata(dev);
+	int error, calibrate_error;
+
+	/* 1. Suspend Scanning*/
+	error = cyapa_gen5_suspend_scanning(cyapa);
+	if (error)
+		return error;
+
+	/* 2. Do mutual capacitance fine calibrate. */
+	calibrate_error = cyapa_gen5_calibrate_pwcs(cyapa,
+				CYAPA_SENSING_MODE_MUTUAL_CAP_FINE);
+	if (calibrate_error)
+		goto resume_scanning;
+
+	/* 3. Do self capacitance calibrate. */
+	calibrate_error = cyapa_gen5_calibrate_pwcs(cyapa,
+				CYAPA_SENSING_MODE_SELF_CAP);
+	if (calibrate_error)
+		goto resume_scanning;
+
+resume_scanning:
+	/* 4. Resume Scanning*/
+	error = cyapa_gen5_resume_scanning(cyapa);
+	if (error || calibrate_error)
+		return error ? error : calibrate_error;
+
+	return count;
+}
+
 static s32 two_complement_to_s32(s32 value, int num_bits)
 {
 	if (value >> (num_bits - 1))
@@ -2556,6 +2620,7 @@ const struct cyapa_dev_ops cyapa_gen5_ops = {
 	.update_fw = cyapa_gen5_do_fw_update,
 
 	.show_baseline = cyapa_gen5_show_baseline,
+	.calibrate_store = cyapa_gen5_do_calibrate,
 
 	.initialize = cyapa_gen5_initialize,
 
Signature · 1 line
1.9.1
author
#14 lore raw

PATCH v11 14/19 input: cyapa: add read firmware image debugfs interface support

In reply to Dudley Du

Add read firmware image from trackpad device interface supported in cyapa driver through debugfs read_fw interface.
Through this interface user can read out, check and backup the firmware image of the trackpad device before any firmware update, or can use the backed image to do firmware image recovery.
TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.c | 179 +++++++++++++++++++++++++++++++++++++++++++-
 drivers/input/mouse/cyapa.h |  10 +++
 2 files changed, 188 insertions(+), 1 deletion(-)
drivers/input/mouse/cyapa.c +178 -1
index 305dffe..2e394c0 100644
@@ -14,6 +14,7 @@
  * more details.
  */
 
+#include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/input.h>
@@ -32,10 +33,14 @@
 #define CYAPA_ADAPTER_FUNC_SMBUS  2
 #define CYAPA_ADAPTER_FUNC_BOTH   3
 
+#define CYAPA_DEBUGFS_READ_FW	"read_fw"
 #define CYAPA_FW_NAME		"cyapa.bin"
 
 const char unique_str[] = "CYTRA";
 
+/* Global root node of the cyapa debugfs directory. */
+static struct dentry *cyapa_debugfs_root;
+
 /* Returns 0 on success, else negative errno on failure. */
 ssize_t cyapa_i2c_read(struct cyapa *cyapa, u8 reg, size_t len,
 					u8 *values)
@@ -497,6 +502,138 @@ static void cyapa_disable_irq_for_cmd(struct cyapa *cyapa)
 }
 
 /*
+ **************************************************************
+ * debugfs interface
+ **************************************************************
+*/
+static int cyapa_debugfs_open(struct inode *inode, struct file *file)
+{
+	struct cyapa *cyapa = inode->i_private;
+	int error;
+
+	if (!cyapa)
+		return -ENODEV;
+
+	error = mutex_lock_interruptible(&cyapa->debugfs_mutex);
+	if (error)
+		return error;
+
+	if (!get_device(&cyapa->client->dev)) {
+		error = -ENODEV;
+		goto out;
+	}
+
+	file->private_data = cyapa;
+
+	if (cyapa->fw_image && cyapa->fw_image_size) {
+		error = 0;
+		goto out;
+	}
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		goto out;
+
+	/*
+	 * If firmware hasn't been read yet, read it all in one pass.
+	 * Subsequent opens will reuse the data in this same buffer.
+	 */
+	if (cyapa->ops->read_fw) {
+		cyapa_enable_irq_for_cmd(cyapa);
+		error = cyapa->ops->read_fw(cyapa);
+		cyapa_disable_irq_for_cmd(cyapa);
+
+		/*
+		 * Redetect trackpad device states because read_fw will
+		 * reset trackpad device into bootloader mode.
+		 */
+		cyapa_detect(cyapa);
+	} else {
+		error = -EPERM;
+	}
+
+	mutex_unlock(&cyapa->state_sync_lock);
+out:
+	mutex_unlock(&cyapa->debugfs_mutex);
+	return error;
+}
+
+static int cyapa_debugfs_release(struct inode *inode, struct file *file)
+{
+	struct cyapa *cyapa = file->private_data;
+	int error;
+
+	if (!cyapa)
+		return 0;
+
+	error = mutex_lock_interruptible(&cyapa->debugfs_mutex);
+	if (error)
+		return error;
+	file->private_data = NULL;
+	put_device(&cyapa->client->dev);
+	mutex_unlock(&cyapa->debugfs_mutex);
+
+	return 0;
+}
+
+/* Return some bytes from the buffered firmware image, starting from *ppos */
+static ssize_t cyapa_debugfs_read_fw(struct file *file, char __user *buffer,
+				     size_t count, loff_t *ppos)
+{
+	struct cyapa *cyapa = file->private_data;
+
+	if (!cyapa->fw_image)
+		return -EINVAL;
+
+	if (*ppos >= cyapa->fw_image_size)
+		return 0;
+
+	if (count + *ppos > cyapa->fw_image_size)
+		count = cyapa->fw_image_size - *ppos;
+
+	if (copy_to_user(buffer, &cyapa->fw_image[*ppos], count))
+		return -EFAULT;
+
+	*ppos += count;
+	return count;
+}
+
+static const struct file_operations cyapa_read_fw_fops = {
+	.open = cyapa_debugfs_open,
+	.release = cyapa_debugfs_release,
+	.read = cyapa_debugfs_read_fw
+};
+
+static int cyapa_debugfs_init(struct cyapa *cyapa)
+{
+	struct device *dev = &cyapa->client->dev;
+
+	if (!cyapa_debugfs_root)
+		return -ENODEV;
+
+	cyapa->dentry_dev = debugfs_create_dir(kobject_name(&dev->kobj),
+					       cyapa_debugfs_root);
+
+	if (!cyapa->dentry_dev)
+		return -ENODEV;
+
+	mutex_init(&cyapa->debugfs_mutex);
+
+	debugfs_create_file(CYAPA_DEBUGFS_READ_FW, S_IRUSR, cyapa->dentry_dev,
+			    cyapa, &cyapa_read_fw_fops);
+
+	return 0;
+}
+
+static void cyapa_remove_debugfs(void *data)
+{
+	struct cyapa *cyapa = data;
+
+	debugfs_remove_recursive(cyapa->dentry_dev);
+	mutex_destroy(&cyapa->debugfs_mutex);
+}
+
+/*
  * Sysfs Interface.
  */
 
@@ -1076,6 +1213,20 @@ static int cyapa_probe(struct i2c_client *client,
 		return error;
 	}
 
+	error = cyapa_debugfs_init(cyapa);
+	if (error) {
+		dev_err(dev, "failed to create debugfs entries: %d\n", error);
+		return error;
+	}
+
+	error = devm_add_action(dev, cyapa_remove_debugfs, cyapa);
+	if (error) {
+		cyapa_remove_debugfs(cyapa);
+		dev_err(dev, "failed to add debugfs cleanup action :%d\n",
+			error);
+		return error;
+	}
+
 #ifdef CONFIG_PM_SLEEP
 	if (device_can_wakeup(dev)) {
 		error = sysfs_merge_group(&client->dev.kobj,
@@ -1256,7 +1407,33 @@ static struct i2c_driver cyapa_driver = {
 	.id_table = cyapa_id_table,
 };
 
-module_i2c_driver(cyapa_driver);
+static int __init cyapa_init(void)
+{
+	int error;
+
+	/* Create a global debugfs root for all cyapa devices */
+	cyapa_debugfs_root = debugfs_create_dir("cyapa", NULL);
+	if (cyapa_debugfs_root == ERR_PTR(-ENODEV))
+		cyapa_debugfs_root = NULL;
+
+	error = i2c_add_driver(&cyapa_driver);
+	if (error) {
+		pr_err("cyapa driver register FAILED.\n");
+		return error;
+	}
+
+	return 0;
+}
+
+static void __exit cyapa_exit(void)
+{
+	debugfs_remove_recursive(cyapa_debugfs_root);
+
+	i2c_del_driver(&cyapa_driver);
+}
+
+module_init(cyapa_init);
+module_exit(cyapa_exit);
 
 MODULE_DESCRIPTION("Cypress APA I2C Trackpad Driver");
 MODULE_AUTHOR("Dudley Du <[email protected]>");
drivers/input/mouse/cyapa.h +10 -0
index 0dc76d8..ceed843 100644
@@ -186,6 +186,8 @@ struct cyapa_dev_ops {
 	ssize_t (*calibrate_store)(struct device *,
 			struct device_attribute *, const char *, size_t);
 
+	int (*read_fw)(struct cyapa *);
+
 	int (*initialize)(struct cyapa *cyapa);
 
 	int (*state_parse)(struct cyapa *cyapa, u8 *reg_status, int len);
@@ -298,6 +300,14 @@ struct cyapa {
 	 */
 	struct mutex state_sync_lock;
 
+	/* Per-instance debugfs root */
+	struct dentry *dentry_dev;
+
+	/* Buffer to store firmware read using debugfs */
+	struct mutex debugfs_mutex;
+	u8 *fw_image;
+	size_t fw_image_size;
+
 	const struct cyapa_dev_ops *ops;
 
 	union cyapa_cmd_states cmd_states;
Signature · 1 line
1.9.1
author
#15 lore raw

PATCH v11 15/19 input: cyapa: add gen3 trackpad device read firmware image function support

In reply to Dudley Du

Add read firmware image function supported for gen3 trackpad device, it can be used through debugfs read_fw interface. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa_gen3.c | 67 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
drivers/input/mouse/cyapa_gen3.c +67 -0
index 281209f..98513eb 100644
@@ -708,6 +708,36 @@ static int cyapa_gen3_write_fw_block(struct cyapa *cyapa,
 	return ret;
 }
 
+/*
+ * A firmware block read command reads 16 bytes of data from flash starting
+ * from a given address.  The 12-byte block read command has the format:
+ *   <0xff> <CMD> <Key> <Addr>
+ *
+ *  <0xff>  - every command starts with 0xff
+ *  <CMD>   - the read command value is 0x3c
+ *  <Key>   - read commands include an 8-byte key: { 00 01 02 03 04 05 06 07 }
+ *  <Addr>  - Memory address (16-bit, big-endian)
+ *
+ * The command is followed by an i2c block read to read the 16 bytes of data.
+ */
+static int cyapa_gen3_read_fw_bytes(struct cyapa *cyapa, u16 addr, u8 *data)
+{
+	u8 cmd[] = { 0xff, 0x3c, 0x00, 0x01, 0x02, 0x03, 0x04,
+		0x05, 0x06, 0x07, addr >> 8, addr };
+	int ret, error;
+
+	error = cyapa_gen3_write_buffer(cyapa, cmd, sizeof(cmd));
+	if (error)
+		return error;
+
+	/* Read data buffer starting from offset 16 */
+	ret = cyapa_i2c_reg_read_block(cyapa, 16, CYAPA_FW_READ_SIZE, data);
+	if (ret != CYAPA_FW_READ_SIZE)
+		return (ret < 0) ? ret : -EIO;
+
+	return 0;
+}
+
 static int cyapa_gen3_write_blocks(struct cyapa *cyapa,
 		size_t start_block, size_t block_count,
 		const u8 *image_data)
@@ -754,6 +784,41 @@ static int cyapa_gen3_do_fw_update(struct cyapa *cyapa,
 	return 0;
 }
 
+/*
+ * Read the entire firmware image into ->fw_image.
+ * If the ->fw_image has already been allocated, then this function
+ * doesn't do anything and just returns 0.
+ * If an error occurs while reading the image, ->fw_image is freed, and
+ * the error is returned.
+ *
+ * The firmware is a fixed size (CYAPA_FW_SIZE), and is read out in
+ * fixed length (CYAPA_FW_READ_SIZE) chunks.
+ */
+static int cyapa_gen3_read_fw(struct cyapa *cyapa)
+{
+	int error;
+	int addr;
+
+	error = cyapa_gen3_bl_enter(cyapa);
+	if (error)
+		return error;
+
+	cyapa->fw_image = cyapa->fw_image ? cyapa->fw_image :
+		devm_kzalloc(&cyapa->client->dev, CYAPA_FW_SIZE, GFP_KERNEL);
+	if (!cyapa->fw_image)
+		return -ENOMEM;
+
+	for (addr = 0; addr < CYAPA_FW_SIZE; addr += CYAPA_FW_READ_SIZE) {
+		error = cyapa_gen3_read_fw_bytes(cyapa,
+			CYAPA_FW_HDR_START + addr, &cyapa->fw_image[addr]);
+		if (error)
+			return error;
+	}
+
+	cyapa->fw_image_size = CYAPA_FW_SIZE;
+	return 0;
+}
+
 static ssize_t cyapa_gen3_do_calibrate(struct device *dev,
 				     struct device_attribute *attr,
 				     const char *buf, size_t count)
@@ -1195,6 +1260,8 @@ const struct cyapa_dev_ops cyapa_gen3_ops = {
 	.show_baseline = cyapa_gen3_show_baseline,
 	.calibrate_store = cyapa_gen3_do_calibrate,
 
+	.read_fw = cyapa_gen3_read_fw,
+
 	.state_parse = cyapa_gen3_state_parse,
 	.operational_check = cyapa_gen3_do_operational_check,
 
Signature · 1 line
1.9.1
author
#16 lore raw

PATCH v11 16/19 input: cyapa: add gen5 trackpad device read firmware image function support

In reply to Dudley Du

Add read firmware image function supported for gen5 trackpad device, it can be used through debugfs read_fw interface. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.h      |   1 +
 drivers/input/mouse/cyapa_gen5.c | 155 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 156 insertions(+)
drivers/input/mouse/cyapa.h +1 -0
index ceed843..b6e1b22 100644
@@ -305,6 +305,7 @@ struct cyapa {
 
 	/* Buffer to store firmware read using debugfs */
 	struct mutex debugfs_mutex;
+	struct cyapa_tsg_bin_image_head fw_img_head;
 	u8 *fw_image;
 	size_t fw_image_size;
 
drivers/input/mouse/cyapa_gen5.c +155 -0

173 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#17 lore raw

PATCH v11 17/19 input: cyapa: add read sensors raw data debugfs interface support

In reply to Dudley Du

Add read sensors' raw data from trackpad device interface supported in cyapa driver through debugfs raw_data interface.
Through this interface, user can read difference count map of each sensors directly from trackpad device (some customers want). And it's useful to help users to find out the root cause when there is performance gap happened. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.c | 105 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/input/mouse/cyapa.h |   4 ++
 2 files changed, 109 insertions(+)
drivers/input/mouse/cyapa.c +105 -0
index 2e394c0..ca31119 100644
@@ -34,6 +34,7 @@
 #define CYAPA_ADAPTER_FUNC_BOTH   3
 
 #define CYAPA_DEBUGFS_READ_FW	"read_fw"
+#define CYAPA_DEBUGFS_RAW_DATA	"raw_data"
 #define CYAPA_FW_NAME		"cyapa.bin"
 
 const char unique_str[] = "CYTRA";
@@ -604,6 +605,106 @@ static const struct file_operations cyapa_read_fw_fops = {
 	.read = cyapa_debugfs_read_fw
 };
 
+static int cyapa_debugfs_raw_data_open(struct inode *inode, struct file *file)
+{
+	struct cyapa *cyapa = inode->i_private;
+	int error;
+
+	if (!cyapa)
+		return -ENODEV;
+
+	/* Start to be supported after Gen5 trackpad devices. */
+	if (cyapa->gen < CYAPA_GEN5)
+		return -ENOTSUPP;
+
+	error = mutex_lock_interruptible(&cyapa->debugfs_mutex);
+	if (error)
+		return error;
+
+	if (!get_device(&cyapa->client->dev)) {
+		error = -ENODEV;
+		goto out;
+	}
+
+	file->private_data = cyapa;
+
+	/*
+	 * Enale IRQ for raw data read command, and must be enable during
+	 * the whole process.
+	 */
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		goto out;
+	cyapa_enable_irq_for_cmd(cyapa);
+	mutex_unlock(&cyapa->state_sync_lock);
+out:
+	mutex_unlock(&cyapa->debugfs_mutex);
+	return error;
+}
+
+static int cyapa_debugfs_raw_data_release(struct inode *inode,
+				struct file *file)
+{
+	struct cyapa *cyapa = file->private_data;
+	int error;
+
+	if (!cyapa)
+		return 0;
+
+	/* Disable IRQ if enabled when raw_data file was opened. */
+	mutex_lock(&cyapa->state_sync_lock);
+	cyapa_disable_irq_for_cmd(cyapa);
+	mutex_unlock(&cyapa->state_sync_lock);
+
+	error = mutex_lock_interruptible(&cyapa->debugfs_mutex);
+	if (error)
+		return error;
+	file->private_data = NULL;
+	put_device(&cyapa->client->dev);
+	mutex_unlock(&cyapa->debugfs_mutex);
+
+	return 0;
+}
+
+/* Always return the sensors' latest raw data from trackpad device. */
+static ssize_t cyapa_debugfs_read_raw_data(struct file *file,
+				     char __user *buffer,
+				     size_t count, loff_t *ppos)
+{
+	int error;
+	struct cyapa *cyapa = file->private_data;
+
+	error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+
+	if (cyapa->ops->read_raw_data)
+		error = cyapa->ops->read_raw_data(cyapa);
+	else
+		error = -EPERM;
+	mutex_unlock(&cyapa->state_sync_lock);
+	if (error)
+		return error;
+
+	if (*ppos >= cyapa->tp_raw_data_size)
+		return 0;
+
+	if (count + *ppos > cyapa->tp_raw_data_size)
+		count = cyapa->tp_raw_data_size - *ppos;
+
+	if (copy_to_user(buffer, &cyapa->tp_raw_data[*ppos], count))
+		return -EFAULT;
+
+	*ppos += count;
+	return count;
+}
+
+static const struct file_operations cyapa_read_raw_data_fops = {
+	.open = cyapa_debugfs_raw_data_open,
+	.release = cyapa_debugfs_raw_data_release,
+	.read = cyapa_debugfs_read_raw_data
+};
+
 static int cyapa_debugfs_init(struct cyapa *cyapa)
 {
 	struct device *dev = &cyapa->client->dev;
@@ -622,6 +723,10 @@ static int cyapa_debugfs_init(struct cyapa *cyapa)
 	debugfs_create_file(CYAPA_DEBUGFS_READ_FW, S_IRUSR, cyapa->dentry_dev,
 			    cyapa, &cyapa_read_fw_fops);
 
+	if (cyapa->gen >= CYAPA_GEN5)
+		debugfs_create_file(CYAPA_DEBUGFS_RAW_DATA, S_IRUSR,
+			cyapa->dentry_dev, cyapa, &cyapa_read_raw_data_fops);
+
 	return 0;
 }
 
drivers/input/mouse/cyapa.h +4 -0
index b6e1b22..9dbf92f 100644
@@ -187,6 +187,7 @@ struct cyapa_dev_ops {
 			struct device_attribute *, const char *, size_t);
 
 	int (*read_fw)(struct cyapa *);
+	int (*read_raw_data)(struct cyapa *);
 
 	int (*initialize)(struct cyapa *cyapa);
 
@@ -308,6 +309,9 @@ struct cyapa {
 	struct cyapa_tsg_bin_image_head fw_img_head;
 	u8 *fw_image;
 	size_t fw_image_size;
+	/* Buffer to store sensors' raw data */
+	u8 *tp_raw_data;
+	size_t tp_raw_data_size;
 
 	const struct cyapa_dev_ops *ops;
 
Signature · 1 line
1.9.1
author
#18 lore raw

PATCH v11 18/19 input: cyapa: add gen5 trackpad device read raw data function support

In reply to Dudley Du

Add read raw data function supported for gen5 trackpad device, it can be used through debugfs raw_data interface. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa_gen5.c | 138 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 138 insertions(+)
drivers/input/mouse/cyapa_gen5.c +138 -0
index aee3e57..52c915b 100644
@@ -2363,6 +2363,143 @@ resume_scanning:
 	return size;
 }
 
+static int cyapa_gen5_read_electrodies_rx_tx(struct cyapa *cyapa)
+{
+	u8 cmd[7] = { 0x04, 0x00, 0x05, 0x00, 0x2f, 0x00, 0x71 };
+	u8 resp_data[7];
+	int resp_len;
+	int error;
+
+	resp_len = sizeof(resp_data);
+	error = cyapa_i2c_pip_cmd_irq_sync(cyapa,
+			cmd, 7,
+			resp_data, &resp_len,
+			150, cyapa_gen5_sort_tsg_pip_app_resp_data, true);
+	if (error || !VALID_CMD_RESP_HEADER(resp_data, 0x71) ||
+		!resp_data[5] || !resp_data[6])
+		return -EINVAL;
+
+	cyapa->electrodes_rx = resp_data[6];
+
+	return 0;
+}
+
+static int cyapa_gen5_read_raw_data(struct cyapa *cyapa)
+{
+	int raw_cap_mutual_max, raw_cap_mutual_min, raw_cap_mutual_ave;
+	int raw_cap_self_max, raw_cap_self_min, raw_cap_self_ave;
+	int offset;
+	int data_size, max, min, ave;
+	ktime_t time_mono;
+	int error, resume_error;
+
+	offset = 0;
+	if (!cyapa->tp_raw_data) {
+		if (cyapa->state != CYAPA_STATE_GEN5_APP ||
+			!cyapa->electrodes_x || !cyapa->electrodes_y)
+			return  -EINVAL;
+
+		cyapa->tp_raw_data_size = sizeof(s32) * (cyapa->electrodes_x *
+			cyapa->electrodes_y + cyapa->electrodes_x +
+			cyapa->electrodes_y) + GEN5_RAW_DATA_HEAD_SIZE;
+		/*
+		 * This buffer will be hold after used until the driver is
+		 * unloaded, the purpose of it is to improve the performace
+		 * to avoid frequently allocate and release the buffer.
+		 */
+		cyapa->tp_raw_data = devm_kzalloc(&cyapa->client->dev,
+					cyapa->tp_raw_data_size, GFP_KERNEL);
+		if (!cyapa->tp_raw_data)
+			return -ENOMEM;
+	}
+
+	/*
+	 * 1. Suspend Scanning.
+	 *
+	 * After suspend scanning, the raw data will not be updated,
+	 * so the time of the raw data is before scanning suspended.
+	 */
+	time_mono = ktime_get();
+	error = cyapa_gen5_suspend_scanning(cyapa);
+	if (error)
+		return error;
+
+	/* 2. Get the correct electrodes_rx number. */
+	if (cyapa->electrodes_rx == 0) {
+		error = cyapa_gen5_read_electrodies_rx_tx(cyapa);
+		if (error || cyapa->electrodes_rx == 0) {
+			cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL);
+
+			/*
+			 * Since, old firmware doesn't support the command to
+			 * read the electrodies' Rx and Tx values, so using
+			 * the read global idac interface to get the Rx number,
+			 * this value is useful to analyze and
+			 * display the raw data map in userspace.
+			 */
+			data_size = 0;
+			error = cyapa_gen5_read_idac_data(cyapa,
+					GEN5_CMD_RETRIEVE_DATA_STRUCTURE,
+					GEN5_RETRIEVE_MUTUAL_PWC_DATA,
+					&data_size, &max, &min, &ave);
+			if (error || cyapa->electrodes_rx == 0)
+				goto resume_scanning;
+		}
+	}
+
+	/* 3. Execuate panel scan. It must be executed before read data. */
+	error = cyapa_gen5_execute_panel_scan(cyapa);
+	if (error)
+		goto resume_scanning;
+
+	/* 4. Retrieve panel scan, mutual cap raw data. */
+	offset = GEN5_RAW_DATA_HEAD_SIZE;
+	error = cyapa_gen5_read_panel_scan_raw_data(cyapa,
+				GEN5_CMD_RETRIEVE_PANEL_SCAN,
+				GEN5_PANEL_SCAN_MUTUAL_DIFFCOUNT,
+				cyapa->electrodes_x * cyapa->electrodes_y,
+				&raw_cap_mutual_max, &raw_cap_mutual_min,
+				&raw_cap_mutual_ave,
+				cyapa->tp_raw_data + offset);
+	if (error)
+		goto resume_scanning;
+
+	offset += sizeof(s32) * cyapa->electrodes_x * cyapa->electrodes_y;
+
+	/* 5. Retrieve panel scan, self cap raw data. */
+	error = cyapa_gen5_read_panel_scan_raw_data(cyapa,
+				GEN5_CMD_RETRIEVE_PANEL_SCAN,
+				GEN5_PANEL_SCAN_SELF_DIFFCOUNT,
+				cyapa->electrodes_x + cyapa->electrodes_y,
+				&raw_cap_self_max, &raw_cap_self_min,
+				&raw_cap_self_ave,
+				cyapa->tp_raw_data + offset);
+	if (error)
+		goto resume_scanning;
+
+	offset += sizeof(s32) * (cyapa->electrodes_x + cyapa->electrodes_y);
+
+resume_scanning:
+	/* 6. Resume Scanning*/
+	resume_error = cyapa_gen5_resume_scanning(cyapa);
+	if (resume_error || error)
+		return resume_error ? resume_error : error;
+
+	*((struct timeval *)&cyapa->tp_raw_data[0]) =
+						ktime_to_timeval(time_mono);
+	cyapa->tp_raw_data[16] = (u8)cyapa->electrodes_x;
+	cyapa->tp_raw_data[17] = (u8)cyapa->electrodes_y;
+	cyapa->tp_raw_data[18] = (u8)cyapa->x_origin;
+	cyapa->tp_raw_data[19] = (u8)cyapa->y_origin;
+	cyapa->tp_raw_data[20] = (u8)sizeof(s32);
+	cyapa->tp_raw_data[21] = (u8)sizeof(s32);
+	cyapa->tp_raw_data[22] = (u8)cyapa->electrodes_rx;
+	cyapa->tp_raw_data[23] = 0;  /* Reserved. */
+
+	cyapa->tp_raw_data_size = offset;
+	return 0;
+}
+
 static bool cyapa_gen5_sort_system_info_data(struct cyapa *cyapa,
 		u8 *buf, int len)
 {
@@ -2776,6 +2913,7 @@ const struct cyapa_dev_ops cyapa_gen5_ops = {
 	.calibrate_store = cyapa_gen5_do_calibrate,
 
 	.read_fw = cyapa_gen5_read_fw,
+	.read_raw_data = cyapa_gen5_read_raw_data,
 
 	.initialize = cyapa_gen5_initialize,
 
Signature · 1 line
1.9.1
author
#19 lore raw

PATCH v11 19/19 input: cyapa: add acpi device id supported

In reply to Dudley Du

Add acpi device tree supported.
acpi device id "CYAP0000" is for old gen3 trackpad devices. acpi device id "CYAP0001" is for new gen5 trackpad devices. TEST=test on Chromebooks.

---
 drivers/input/mouse/cyapa.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/input/mouse/cyapa.c +13 -0
index ca31119..eb53aa0 100644
@@ -25,6 +25,7 @@
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 #include <linux/pm_runtime.h>
+#include <linux/acpi.h>
 #include "cyapa.h"
 
 
@@ -1501,11 +1502,23 @@ static const struct i2c_device_id cyapa_id_table[] = {
 };
 MODULE_DEVICE_TABLE(i2c, cyapa_id_table);
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id cyapa_acpi_id[] = {
+	{ "CYAP0000", 0 },  /* Gen3 trackpad with 0x67 I2C address. */
+	{ "CYAP0001", 0 },  /* Gen5 trackpad with 0x24 I2C address. */
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, cyapa_acpi_id);
+#endif
+
 static struct i2c_driver cyapa_driver = {
 	.driver = {
 		.name = "cyapa",
 		.owner = THIS_MODULE,
 		.pm = &cyapa_pm_ops,
+#ifdef CONFIG_ACPI
+		.acpi_match_table = ACPI_PTR(cyapa_acpi_id),
+#endif
 	},
 
 	.probe = cyapa_probe,
Signature · 1 line
1.9.1
#20 lore raw
In reply to Dudley Du

Dudley,

Quoted 4 lines · Dudley Du

V11 patches have below main updates compared with v10 patches:
1) Add add acpi device id supported for old gen3 and new gen5 trackpad devices.
2) Fix the unable to update firmware issue when cyapa_open is not called which means the irq for firwmare update process is not enabled. This fix

[]

I am having a problem with an older patch which is currently in linux-next (20141120) and which might be related to this new patch set.

On an Acer C720 if a suspend and resume is performed the touchpad will stop working. If the cyapa driver is reloaded it will begin working again.

I performed a bisect and found that the following patch was the cause.

From b1cfa7b4388285c0f0b486f152ab0cb18612c779 Mon Sep 17 00:00:00 2001
From: Dudley Du <[email protected]>
Date: Sun, 9 Nov 2014 12:36:34 -0800
Subject: [PATCH] Input: cyapa - switch to using managed resources

Use of managed resources simplifies error handling and device removal code.

[Dmitry: added open/close methods so cyapa_remove is no longer needed.]

If I can provide any other information that would be of help let me know. I will try out your new patchset if I get a chance.

Signature · 1 line
- Jeremiah Mahler
author
#21 lore raw

Jeremiah,

Thank you very much for your information.
I will look into this issue.
Could you send me the system log if possible when you encounter this issue.

Thanks
Dudley

Quoted 7 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?21? 16:56
To: Dudley Du
Cc: [email protected]
Subject: Re: [PATCH v11 00/19] input: cyapa: instruction of cyapa patches

Quoted 5 lines

Dudley,

Quoted 2 lines · Dudley Du

V11 patches have below main updates compared with v10 patches:
1) Add add acpi device id supported for old gen3 and new gen5 trackpad

devices.

Quoted 30 lines
Quoted 2 lines

2) Fix the unable to update firmware issue when cyapa_open is not called which means the irq for firwmare update process is not enabled. This fix

[]

I am having a problem with an older patch which is currently in linux-next (20141120) and which might be related to this new patch set.

On an Acer C720 if a suspend and resume is performed the touchpad will stop working. If the cyapa driver is reloaded it will begin working again.

I performed a bisect and found that the following patch was the cause.

From b1cfa7b4388285c0f0b486f152ab0cb18612c779 Mon Sep 17 00:00:00 2001
From: Dudley Du <[email protected]>
Date: Sun, 9 Nov 2014 12:36:34 -0800
Subject: [PATCH] Input: cyapa - switch to using managed resources

Use of managed resources simplifies error handling and device removal code.

[Dmitry: added open/close methods so cyapa_remove is no longer needed.]

If I can provide any other information that would be of help let me know. I will try out your new patchset if I get a chance.

--
- Jeremiah Mahler

#22 lore raw

Dudley,

Quoted 9 lines · Dudley Du

Jeremiah,

Thank you very much for your information.
I will look into this issue.
Could you send me the system log if possible when you encounter this issue.

Thanks
Dudley

I did a clean reboot, the touch pad worked, then a suspend and resume, the touchpad quit working. Attached is the dmesg after this sequence. There is an oops with a trace in there that looks interesting...

[]

Signature · 1 line
- Jeremiah Mahler
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.18.0-rc5-next-20141121 (jeri@newt) (gcc version 4.9.2 (Debian 4.9.2-2) ) #50 SMP Fri Nov 21 01:17:40 PST 2014
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.18.0-rc5-next-20141121 root=UUID=e5fd0a8b-e57d-428c-831e-3aff30526800 ro quiet
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000002ffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000030000-0x000000000003ffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000040000-0x000000000009e3ff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009e400-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000000efffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000f00000-0x0000000000ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000001000000-0x000000007bf79fff] usable
[    0.000000] BIOS-e820: [mem 0x000000007bf7a000-0x000000007e9fffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000f0000000-0x00000000f3ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed10000-0x00000000fed19fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed84000-0x00000000fed84fff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x00000001005fffff] usable
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.7 present.
[    0.000000] DMI: Acer Peppy, BIOS          04/30/2014
[    0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.000000] AGP: No AGP bridge found
[    0.000000] e820: last_pfn = 0x100600 max_arch_pfn = 0x400000000
[    0.000000] MTRR default type: uncachable
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF uncachable
[    0.000000]   C0000-FFFFF write-back
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 0000000000 mask 7F80000000 write-back
[    0.000000]   1 base 007C800000 mask 7FFF800000 uncachable
[    0.000000]   2 base 007D000000 mask 7FFF000000 uncachable
[    0.000000]   3 base 007E000000 mask 7FFE000000 uncachable
[    0.000000]   4 base 00D0000000 mask 7FF0000000 write-combining
[    0.000000]   5 base 00FF800000 mask 7FFF800000 uncachable
[    0.000000]   6 base 0100000000 mask 7F00000000 write-back
[    0.000000]   7 disabled
[    0.000000]   8 disabled
[    0.000000]   9 disabled
[    0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
[    0.000000] e820: last_pfn = 0x7bf7a max_arch_pfn = 0x400000000
[    0.000000] Base memory trampoline at [ffff880000098000] 98000 size 24576
[    0.000000] Using GB pages for direct mapping
[    0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
[    0.000000]  [mem 0x00000000-0x000fffff] page 4k
[    0.000000] BRK [0x01b0f000, 0x01b0ffff] PGTABLE
[    0.000000] BRK [0x01b10000, 0x01b10fff] PGTABLE
[    0.000000] BRK [0x01b11000, 0x01b11fff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0x100400000-0x1005fffff]
[    0.000000]  [mem 0x100400000-0x1005fffff] page 2M
[    0.000000] BRK [0x01b12000, 0x01b12fff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0x100000000-0x1003fffff]
[    0.000000]  [mem 0x100000000-0x1003fffff] page 2M
[    0.000000] init_memory_mapping: [mem 0x00100000-0x00efffff]
[    0.000000]  [mem 0x00100000-0x001fffff] page 4k
[    0.000000]  [mem 0x00200000-0x00dfffff] page 2M
[    0.000000]  [mem 0x00e00000-0x00efffff] page 4k
[    0.000000] BRK [0x01b13000, 0x01b13fff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0x01000000-0x7bf79fff]
[    0.000000]  [mem 0x01000000-0x7bdfffff] page 2M
[    0.000000]  [mem 0x7be00000-0x7bf79fff] page 4k
[    0.000000] RAMDISK: [mem 0x3544e000-0x36a1efff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000000FDBB0 000024 (v02 CORE  )
[    0.000000] ACPI: XSDT 0x000000007BF840E0 000054 (v01 CORE   COREBOOT 00000000 CORE 00000000)
[    0.000000] ACPI: FACP 0x000000007BF88690 0000F4 (v03 CORE   COREBOOT 00000000 CORE 00000001)
[    0.000000] ACPI: DSDT 0x000000007BF84250 004431 (v02 COREv4 COREBOOT 20110725 INTL 20090123)
[    0.000000] ACPI: FACS 0x000000007BF84210 000040
[    0.000000] ACPI: HPET 0x000000007BF88790 000038 (v01 CORE   COREBOOT 00000000 CORE 00000000)
[    0.000000] ACPI: APIC 0x000000007BF887D0 00005C (v01 CORE   COREBOOT 00000000 CORE 00000000)
[    0.000000] ACPI: MCFG 0x000000007BF88830 00003C (v01 CORE   COREBOOT 00000000 CORE 00000000)
[    0.000000] ACPI: SSDT 0x000000007BF89730 0008A0 (v02 CORE   COREBOOT 0000002A CORE 0000002A)
[    0.000000] ACPI: SSDT 0x000000007BF89FD0 00005C (v02 CORE   COREBOOT 0000002A CORE 0000002A)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at [mem 0x0000000000000000-0x00000001005fffff]
[    0.000000] NODE_DATA(0) allocated [mem 0x1005fa000-0x1005fdfff]
[    0.000000]  [ffffea0000000000-ffffea00041fffff] PMD -> [ffff880079800000-ffff88007b9fffff] on node 0
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x00001000-0x00ffffff]
[    0.000000]   DMA32    [mem 0x01000000-0xffffffff]
[    0.000000]   Normal   [mem 0x100000000-0x1005fffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00001000-0x0002ffff]
[    0.000000]   node   0: [mem 0x00040000-0x0009dfff]
[    0.000000]   node   0: [mem 0x00100000-0x00efffff]
[    0.000000]   node   0: [mem 0x01000000-0x7bf79fff]
[    0.000000]   node   0: [mem 0x100000000-0x1005fffff]
[    0.000000] Initmem setup node 0 [mem 0x00001000-0x1005fffff]
[    0.000000] On node 0 totalpages: 508935
[    0.000000]   DMA zone: 59 pages used for memmap
[    0.000000]   DMA zone: 21 pages reserved
[    0.000000]   DMA zone: 3725 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 7870 pages used for memmap
[    0.000000]   DMA32 zone: 503674 pages, LIFO batch:31
[    0.000000]   Normal zone: 24 pages used for memmap
[    0.000000]   Normal zone: 1536 pages, LIFO batch:0
[    0.000000] Reserving Intel graphics stolen memory at 0x7ca00000-0x7e9fffff
[    0.000000] ACPI: PM-Timer IO Port: 0x1008
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x02] enabled)
[    0.000000] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-39
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: Registered nosave memory: [mem 0x00030000-0x0003ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009e000-0x0009efff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.000000] PM: Registered nosave memory: [mem 0x00f00000-0x00ffffff]
[    0.000000] PM: Registered nosave memory: [mem 0x7bf7a000-0x7e9fffff]
[    0.000000] PM: Registered nosave memory: [mem 0x7ea00000-0xefffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xf0000000-0xf3ffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xf4000000-0xfed0ffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfed10000-0xfed19fff]
[    0.000000] PM: Registered nosave memory: [mem 0xfed1a000-0xfed83fff]
[    0.000000] PM: Registered nosave memory: [mem 0xfed84000-0xfed84fff]
[    0.000000] PM: Registered nosave memory: [mem 0xfed85000-0xffffffff]
[    0.000000] e820: [mem 0x7ea00000-0xefffffff] available for PCI devices
[    0.000000] Booting paravirtualized kernel on bare hardware
[    0.000000] setup_percpu: NR_CPUS:512 nr_cpumask_bits:512 nr_cpu_ids:2 nr_node_ids:1
[    0.000000] PERCPU: Embedded 31 pages/cpu @ffff880100200000 s87104 r8192 d31680 u1048576
[    0.000000] pcpu-alloc: s87104 r8192 d31680 u1048576 alloc=1*2097152
[    0.000000] pcpu-alloc: [0] 0 1 
[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 500961
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.18.0-rc5-next-20141121 root=UUID=e5fd0a8b-e57d-428c-831e-3aff30526800 ro quiet
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] xsave: enabled xstate_bv 0x3, cntxt size 0x240 using standard form
[    0.000000] AGP: Checking aperture...
[    0.000000] AGP: No AGP bridge found
[    0.000000] Calgary: detecting Calgary via BIOS EBDA area
[    0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing!
[    0.000000] Memory: 1900572K/2035740K available (5378K kernel code, 1028K rwdata, 1832K rodata, 1224K init, 844K bss, 135168K reserved, 0K cma-reserved)
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	RCU dyntick-idle grace-period acceleration is enabled.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=512 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS:33024 nr_irqs:512 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [tty0] enabled
[    0.000000] hpet clockevent registered
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] tsc: Detected 1396.798 MHz processor
[    0.000045] Calibrating delay loop (skipped), value calculated using timer frequency.. 2793.59 BogoMIPS (lpj=5587192)
[    0.000049] pid_max: default: 32768 minimum: 301
[    0.000058] ACPI: Core revision 20140926
[    0.004314] ACPI: All ACPI Tables successfully acquired
[    0.008090] Security Framework initialized
[    0.008100] AppArmor: AppArmor disabled by boot time parameter
[    0.008102] Yama: becoming mindful.
[    0.008343] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[    0.008976] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.009255] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.009261] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.009551] Initializing cgroup subsys memory
[    0.009558] Initializing cgroup subsys devices
[    0.009562] Initializing cgroup subsys freezer
[    0.009565] Initializing cgroup subsys net_cls
[    0.009568] Initializing cgroup subsys blkio
[    0.009571] Initializing cgroup subsys perf_event
[    0.009574] Initializing cgroup subsys net_prio
[    0.009609] CPU: Physical Processor ID: 0
[    0.009610] CPU: Processor Core ID: 0
[    0.010965] mce: CPU supports 7 MCE banks
[    0.010984] CPU0: Thermal monitoring enabled (TM1)
[    0.011137] Freeing SMP alternatives memory: 20K (ffffffff81a35000 - ffffffff81a3a000)
[    0.012413] ftrace: allocating 21892 entries in 86 pages
[    0.026029] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.065711] smpboot: CPU0: Intel(R) Celeron(R) 2955U @ 1.40GHz (fam: 06, model: 45, stepping: 01)
[    0.065720] TSC deadline timer enabled
[    0.065751] Performance Events: PEBS fmt2+, 16-deep LBR, Haswell events, full-width counters, Intel PMU driver.
[    0.065782] ... version:                3
[    0.065783] ... bit width:              48
[    0.065784] ... generic registers:      8
[    0.065786] ... value mask:             0000ffffffffffff
[    0.065787] ... max period:             0000ffffffffffff
[    0.065788] ... fixed-purpose events:   3
[    0.065789] ... event mask:             00000007000000ff
[    0.067751] x86: Booting SMP configuration:
[    0.067754] .... node  #0, CPUs:      #1
[    0.082303] x86: Booted up 1 node, 2 CPUs
[    0.082307] smpboot: Total of 2 processors activated (5587.19 BogoMIPS)
[    0.082341] NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.
[    0.084341] devtmpfs: initialized
[    0.088461] pinctrl core: initialized pinctrl subsystem
[    0.088517] RTC time:  8:42:08, date: 11/24/14
[    0.088649] NET: Registered protocol family 16
[    0.102314] cpuidle: using governor ladder
[    0.118319] cpuidle: using governor menu
[    0.118392] ACPI: bus type PCI registered
[    0.118395] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.118467] PCI: MMCONFIG for domain 0000 [bus 00-3f] at [mem 0xf0000000-0xf3ffffff] (base 0xf0000000)
[    0.118470] PCI: MMCONFIG at [mem 0xf0000000-0xf3ffffff] reserved in E820
[    0.118586] PCI: Using configuration type 1 for base access
[    0.134846] ACPI: Added _OSI(Module Device)
[    0.134849] ACPI: Added _OSI(Processor Device)
[    0.134851] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.134853] ACPI: Added _OSI(Processor Aggregator Device)
[    0.138445] ACPI: Interpreter enabled
[    0.138453] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S1_] (20140926/hwxface-580)
[    0.138459] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S2_] (20140926/hwxface-580)
[    0.138475] ACPI: (supports S0 S3 S4 S5)
[    0.138477] ACPI: Using IOAPIC for interrupt routing
[    0.138506] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.143777] ACPI: Power Resource [TNP0] (off)
[    0.143826] ACPI: Power Resource [TNP1] (on)
[    0.144482] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.144490] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI]
[    0.144543] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME AER PCIeCapability]
[    0.144673] acpi PNP0A08:00: ignoring host bridge window [mem 0x000cc000-0x000cffff] (conflicts with Video ROM [mem 0x000c0000-0x000cebff])
[    0.144678] acpi PNP0A08:00: [Firmware Info]: MMCONFIG for domain 0000 [bus 00-3f] only partially covers this bridge
[    0.144911] PCI host bridge to bus 0000:00
[    0.144915] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.144918] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7]
[    0.144920] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff]
[    0.144922] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff]
[    0.144924] pci_bus 0000:00: root bus resource [mem 0x000c0000-0x000c3fff]
[    0.144926] pci_bus 0000:00: root bus resource [mem 0x000c4000-0x000c7fff]
[    0.144928] pci_bus 0000:00: root bus resource [mem 0x000c8000-0x000cbfff]
[    0.144930] pci_bus 0000:00: root bus resource [mem 0x000d0000-0x000d3fff]
[    0.144932] pci_bus 0000:00: root bus resource [mem 0x000d4000-0x000d7fff]
[    0.144935] pci_bus 0000:00: root bus resource [mem 0x000d8000-0x000dbfff]
[    0.144937] pci_bus 0000:00: root bus resource [mem 0x000dc000-0x000dffff]
[    0.144939] pci_bus 0000:00: root bus resource [mem 0x000e0000-0x000e3fff]
[    0.144941] pci_bus 0000:00: root bus resource [mem 0x000e4000-0x000e7fff]
[    0.144943] pci_bus 0000:00: root bus resource [mem 0x000e8000-0x000ebfff]
[    0.144945] pci_bus 0000:00: root bus resource [mem 0x000ec000-0x000effff]
[    0.144947] pci_bus 0000:00: root bus resource [mem 0x000f0000-0x000fffff]
[    0.144949] pci_bus 0000:00: root bus resource [mem 0x7ea00001-0xfebfffff]
[    0.144951] pci_bus 0000:00: root bus resource [mem 0xfed40000-0xfed44fff]
[    0.144962] pci 0000:00:00.0: [8086:0a04] type 00 class 0x060000
[    0.145101] pci 0000:00:02.0: [8086:0a06] type 00 class 0x030000
[    0.145117] pci 0000:00:02.0: reg 0x10: [mem 0xe0000000-0xe03fffff 64bit]
[    0.145127] pci 0000:00:02.0: reg 0x18: [mem 0xd0000000-0xdfffffff 64bit pref]
[    0.145134] pci 0000:00:02.0: reg 0x20: [io  0x1800-0x183f]
[    0.145260] pci 0000:00:03.0: [8086:0a0c] type 00 class 0x040300
[    0.145272] pci 0000:00:03.0: reg 0x10: [mem 0xe0510000-0xe0513fff 64bit]
[    0.145423] pci 0000:00:14.0: [8086:9c31] type 00 class 0x0c0330
[    0.145444] pci 0000:00:14.0: reg 0x10: [mem 0xe0500000-0xe050ffff 64bit]
[    0.145514] pci 0000:00:14.0: PME# supported from D3hot D3cold
[    0.145570] pci 0000:00:14.0: System wakeup disabled by ACPI
[    0.145628] pci 0000:00:15.0: [8086:9c60] type 00 class 0x080102
[    0.145647] pci 0000:00:15.0: reg 0x10: [mem 0xe0518000-0xe0518fff]
[    0.145659] pci 0000:00:15.0: reg 0x14: [mem 0xe0519000-0xe0519fff]
[    0.145827] pci 0000:00:15.1: [8086:9c61] type 00 class 0x0c8000
[    0.145847] pci 0000:00:15.1: reg 0x10: [mem 0xe051a000-0xe051afff]
[    0.145858] pci 0000:00:15.1: reg 0x14: [mem 0xe051b000-0xe051bfff]
[    0.146026] pci 0000:00:15.2: [8086:9c62] type 00 class 0x0c8000
[    0.146044] pci 0000:00:15.2: reg 0x10: [mem 0xe051c000-0xe051cfff]
[    0.146056] pci 0000:00:15.2: reg 0x14: [mem 0xe051d000-0xe051dfff]
[    0.146234] pci 0000:00:1b.0: [8086:9c20] type 00 class 0x040300
[    0.146252] pci 0000:00:1b.0: reg 0x10: [mem 0xe0514000-0xe0517fff 64bit]
[    0.146336] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold
[    0.146393] pci 0000:00:1b.0: System wakeup disabled by ACPI
[    0.146446] pci 0000:00:1c.0: [8086:9c10] type 01 class 0x060400
[    0.146525] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
[    0.146645] pci 0000:00:1d.0: [8086:9c26] type 00 class 0x0c0320
[    0.146668] pci 0000:00:1d.0: reg 0x10: [mem 0xe051f800-0xe051fbff]
[    0.146771] pci 0000:00:1d.0: PME# supported from D0 D3hot D3cold
[    0.146829] pci 0000:00:1d.0: System wakeup disabled by ACPI
[    0.146886] pci 0000:00:1f.0: [8086:9c45] type 00 class 0x060100
[    0.147104] pci 0000:00:1f.2: [8086:9c03] type 00 class 0x010601
[    0.147122] pci 0000:00:1f.2: reg 0x10: [io  0x1860-0x1867]
[    0.147130] pci 0000:00:1f.2: reg 0x14: [io  0x1870-0x1873]
[    0.147139] pci 0000:00:1f.2: reg 0x18: [io  0x1868-0x186f]
[    0.147148] pci 0000:00:1f.2: reg 0x1c: [io  0x1874-0x1877]
[    0.147156] pci 0000:00:1f.2: reg 0x20: [io  0x1840-0x185f]
[    0.147165] pci 0000:00:1f.2: reg 0x24: [mem 0xe051f000-0xe051f7ff]
[    0.147208] pci 0000:00:1f.2: PME# supported from D3hot
[    0.147309] pci 0000:00:1f.3: [8086:9c22] type 00 class 0x0c0500
[    0.147326] pci 0000:00:1f.3: reg 0x10: [mem 0xe051fc00-0xe051fcff 64bit]
[    0.147349] pci 0000:00:1f.3: reg 0x20: [io  0x0400-0x041f]
[    0.147470] pci 0000:00:1f.6: [8086:9c24] type 00 class 0x118000
[    0.147504] pci 0000:00:1f.6: reg 0x10: [mem 0xe051e000-0xe051efff 64bit]
[    0.147781] pci 0000:01:00.0: [168c:0034] type 00 class 0x028000
[    0.147809] pci 0000:01:00.0: reg 0x10: [mem 0xe0400000-0xe047ffff 64bit]
[    0.147868] pci 0000:01:00.0: reg 0x30: [mem 0xe0480000-0xe048ffff pref]
[    0.147944] pci 0000:01:00.0: supports D1 D2
[    0.147946] pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.154369] pci 0000:00:1c.0: PCI bridge to [bus 01]
[    0.154375] pci 0000:00:1c.0:   bridge window [mem 0xe0400000-0xe04fffff]
[    0.154512] ACPI: PCI Interrupt Link [LNKA] (IRQs 1 3 4 5 6 7 10 12 14 15) *11, disabled.
[    0.154576] ACPI: PCI Interrupt Link [LNKB] (IRQs 1 3 4 5 6 7 11 12 14 15) *10, disabled.
[    0.154634] ACPI: PCI Interrupt Link [LNKC] (IRQs 1 3 4 5 6 7 10 12 14 15) *11, disabled.
[    0.154691] ACPI: PCI Interrupt Link [LNKD] (IRQs 1 3 4 5 6 7 *11 12 14 15), disabled.
[    0.154749] ACPI: PCI Interrupt Link [LNKE] (IRQs 1 3 4 5 6 7 10 12 14 15) *0, disabled.
[    0.154805] ACPI: PCI Interrupt Link [LNKF] (IRQs 1 3 4 5 6 7 11 12 14 15) *0, disabled.
[    0.154862] ACPI: PCI Interrupt Link [LNKG] (IRQs 1 3 4 5 6 7 10 12 14 15) *0, disabled.
[    0.154919] ACPI: PCI Interrupt Link [LNKH] (IRQs 1 3 4 5 6 7 11 12 14 15) *0, disabled.
[    0.155668] ACPI : EC: GPE = 0x24, I/O: command/status = 0x66, data = 0x62
[    0.155811] vgaarb: setting as boot device: PCI:0000:00:02.0
[    0.155814] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[    0.155818] vgaarb: loaded
[    0.155820] vgaarb: bridge control possible 0000:00:02.0
[    0.155912] PCI: Using ACPI for IRQ routing
[    0.157514] PCI: pci_cache_line_size set to 64 bytes
[    0.157566] e820: reserve RAM buffer [mem 0x0009e400-0x0009ffff]
[    0.157568] e820: reserve RAM buffer [mem 0x7bf7a000-0x7bffffff]
[    0.157570] e820: reserve RAM buffer [mem 0x100600000-0x103ffffff]
[    0.157765] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0, 0, 0, 0, 0, 0
[    0.157772] hpet0: 8 comparators, 64-bit 14.318180 MHz counter
[    0.159807] Switched to clocksource hpet
[    0.166911] pnp: PnP ACPI init
[    0.167030] system 00:00: [mem 0xfed1c000-0xfed1ffff] has been reserved
[    0.167034] system 00:00: [mem 0xfed10000-0xfed13fff] has been reserved
[    0.167036] system 00:00: [mem 0xfed18000-0xfed18fff] has been reserved
[    0.167039] system 00:00: [mem 0xfed19000-0xfed19fff] has been reserved
[    0.167042] system 00:00: [mem 0xf0000000-0xf3ffffff] has been reserved
[    0.167044] system 00:00: [mem 0xfed20000-0xfed3ffff] has been reserved
[    0.167047] system 00:00: [mem 0xfed40000-0xfed44fff] has been reserved
[    0.167050] system 00:00: [mem 0xfed45000-0xfed8ffff] could not be reserved
[    0.167053] system 00:00: [mem 0x00f00000-0x00ffffff] has been reserved
[    0.167057] system 00:00: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.167370] system 00:01: [mem 0xfed00000-0xfed003ff] has been reserved
[    0.167374] system 00:01: Plug and Play ACPI device, IDs PNP0103 PNP0c01 (active)
[    0.167454] system 00:02: [io  0x1000-0x10fe] could not be reserved
[    0.167458] system 00:02: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.167491] pnp 00:03: Plug and Play ACPI device, IDs PNP0b00 (active)
[    0.167541] system 00:04: [io  0x0900-0x09fe] has been reserved
[    0.167544] system 00:04: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.167594] system 00:05: [io  0x0200] has been reserved
[    0.167596] system 00:05: [io  0x0204] has been reserved
[    0.167599] system 00:05: [io  0x0800-0x087f] has been reserved
[    0.167601] system 00:05: [io  0x0880-0x08ff] has been reserved
[    0.167604] system 00:05: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.167651] pnp 00:06: Plug and Play ACPI device, IDs PNP0501 (active)
[    0.167694] pnp 00:07: Plug and Play ACPI device, IDs PNP0303 PNP030b (active)
[    0.167743] pnp 00:08: Plug and Play ACPI device, IDs IFX0102 PNP0c31 (active)
[    0.167868] system 00:09: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.168007] pnp: PnP ACPI: found 10 devices
[    0.174967] pci 0000:00:1c.0: PCI bridge to [bus 01]
[    0.174974] pci 0000:00:1c.0:   bridge window [mem 0xe0400000-0xe04fffff]
[    0.174985] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7]
[    0.174987] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff]
[    0.174989] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff]
[    0.174991] pci_bus 0000:00: resource 7 [mem 0x000c0000-0x000c3fff]
[    0.174993] pci_bus 0000:00: resource 8 [mem 0x000c4000-0x000c7fff]
[    0.174995] pci_bus 0000:00: resource 9 [mem 0x000c8000-0x000cbfff]
[    0.174998] pci_bus 0000:00: resource 10 [mem 0x000d0000-0x000d3fff]
[    0.175000] pci_bus 0000:00: resource 11 [mem 0x000d4000-0x000d7fff]
[    0.175002] pci_bus 0000:00: resource 12 [mem 0x000d8000-0x000dbfff]
[    0.175004] pci_bus 0000:00: resource 13 [mem 0x000dc000-0x000dffff]
[    0.175006] pci_bus 0000:00: resource 14 [mem 0x000e0000-0x000e3fff]
[    0.175008] pci_bus 0000:00: resource 15 [mem 0x000e4000-0x000e7fff]
[    0.175010] pci_bus 0000:00: resource 16 [mem 0x000e8000-0x000ebfff]
[    0.175012] pci_bus 0000:00: resource 17 [mem 0x000ec000-0x000effff]
[    0.175014] pci_bus 0000:00: resource 18 [mem 0x000f0000-0x000fffff]
[    0.175016] pci_bus 0000:00: resource 19 [mem 0x7ea00001-0xfebfffff]
[    0.175018] pci_bus 0000:00: resource 20 [mem 0xfed40000-0xfed44fff]
[    0.175021] pci_bus 0000:01: resource 1 [mem 0xe0400000-0xe04fffff]
[    0.175077] NET: Registered protocol family 2
[    0.175276] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.175329] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[    0.175377] TCP: Hash tables configured (established 16384 bind 16384)
[    0.175401] TCP: reno registered
[    0.175409] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[    0.175421] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[    0.175491] NET: Registered protocol family 1
[    0.175512] pci 0000:00:02.0: Video device with shadowed ROM
[    0.176067] PCI: CLS 64 bytes, default 64
[    0.176128] Unpacking initramfs...
[    0.779548] Freeing initrd memory: 22340K (ffff88003544e000 - ffff880036a1f000)
[    0.779562] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    0.779566] software IO TLB [mem 0x75800000-0x79800000] (64MB) mapped at [ffff880075800000-ffff8800797fffff]
[    0.779762] RAPL PMU detected, hw unit 2^-14 Joules, API unit is 2^-32 Joules, 4 fixed counters 655360 ms ovfl timer
[    0.779836] microcode: CPU0 sig=0x40651, pf=0x40, revision=0x15
[    0.779844] microcode: CPU1 sig=0x40651, pf=0x40, revision=0x15
[    0.779907] microcode: Microcode Update Driver: v2.00 <[email protected]>, Peter Oruba
[    0.780303] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.780349] audit: initializing netlink subsys (disabled)
[    0.780368] audit: type=2000 audit(1416818528.780:1): initialized
[    0.780823] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    0.780861] zpool: loaded
[    0.780866] zbud: loaded
[    0.781053] VFS: Disk quotas dquot_6.5.2
[    0.781073] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.781581] alg: No test for stdrng (krng)
[    0.781613] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.781653] io scheduler noop registered
[    0.781658] io scheduler deadline registered
[    0.781671] io scheduler cfq registered (default)
[    0.782061] aer 0000:00:1c.0:pcie02: service driver aer loaded
[    0.782086] pcieport 0000:00:1c.0: Signaling PME through PCIe PME interrupt
[    0.782088] pci 0000:01:00.0: Signaling PME through PCIe PME interrupt
[    0.782093] pcie_pme 0000:00:1c.0:pcie01: service driver pcie_pme loaded
[    0.782104] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    0.782129] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[    0.782157] intel_idle: MWAIT substates: 0x11142120
[    0.782158] intel_idle: v0.4 model 0x45
[    0.782160] intel_idle: lapic_timer_reliable_states 0xffffffff
[    0.782373] GHES: HEST is not enabled!
[    0.782468] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.783089] Linux agpgart interface v0.103
[    0.783195] error detecting cacheinfo..cpu0
[    0.783299] i8042: PNP: PS/2 Controller [PNP0303:PS2K] at 0x60,0x64 irq 1
[    0.783300] i8042: PNP: PS/2 appears to have AUX port disabled, if this is incorrect please boot with i8042.nopnp
[    0.784674] i8042: Warning: Keylock active
[    0.784864] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.785040] mousedev: PS/2 mouse device common for all mice
[    0.785098] rtc_cmos 00:03: RTC can wake from S4
[    0.785267] rtc_cmos 00:03: rtc core: registered rtc_cmos as rtc0
[    0.785297] rtc_cmos 00:03: alarms up to one month, 242 bytes nvram, hpet irqs
[    0.785311] Intel P-state driver initializing.
[    0.785440] ledtrig-cpu: registered to indicate activity on CPUs
[    0.785648] AMD IOMMUv2 driver by Joerg Roedel <[email protected]>
[    0.785650] AMD IOMMUv2 functionality not available on this system
[    0.785878] TCP: cubic registered
[    0.785978] NET: Registered protocol family 10
[    0.786398] mip6: Mobile IPv6
[    0.786405] NET: Registered protocol family 17
[    0.786417] mpls_gso: MPLS GSO support
[    0.787325] registered taskstats version 1
[    0.787946]   Magic number: 6:366:726
[    0.788058] rtc_cmos 00:03: setting system clock to 2014-11-24 08:42:09 UTC (1416818529)
[    0.788211] PM: Hibernation image not present or could not be loaded.
[    0.790172] Freeing unused kernel memory: 1224K (ffffffff81903000 - ffffffff81a35000)
[    0.790175] Write protecting the kernel read-only data: 8192k
[    0.794437] Freeing unused kernel memory: 756K (ffff880001543000 - ffff880001600000)
[    0.795572] Freeing unused kernel memory: 216K (ffff8800017ca000 - ffff880001800000)
[    0.795690] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
[    0.813536] systemd-udevd[62]: starting version 215
[    0.813972] random: systemd-udevd urandom read with 2 bits of entropy available
[    0.832456] sdhci: Secure Digital Host Controller Interface driver
[    0.832461] sdhci: Copyright(c) Pierre Ossman
[    0.834234] thermal LNXTHERM:00: registered as thermal_zone0
[    0.834239] ACPI: Thermal Zone [THRM] (41 C)
[    0.843216] SCSI subsystem initialized
[    0.845725] libata version 3.00 loaded.
[    0.846784] ahci 0000:00:1f.2: version 3.0
[    0.846987] ahci 0000:00:1f.2: SSS flag set, parallel bus scan disabled
[    0.847005] ahci 0000:00:1f.2: AHCI 0001.0300 32 slots 2 ports 6 Gbps 0x1 impl SATA mode
[    0.847009] ahci 0000:00:1f.2: flags: 64bit ncq ilck stag pm led clo only pio slum part deso sadm sds apst 
[    0.849805] scsi host0: ahci
[    0.854265] scsi host1: ahci
[    0.854357] ata1: SATA max UDMA/133 abar m2048@0xe051f000 port 0xe051f100 irq 41
[    0.854361] ata2: DUMMY
[    1.171719] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    1.171981] ata1.00: ATA-10: SC2 M2 SSD, S9FM01.7, max UDMA/100
[    1.171986] ata1.00: 234441648 sectors, multi 16: LBA48 NCQ (depth 31/32), AA
[    1.172267] ata1.00: configured for UDMA/100
[    1.172448] scsi 0:0:0:0: Direct-Access     ATA      SC2 M2 SSD       01.7 PQ: 0 ANSI: 5
[    1.174750] sd 0:0:0:0: [sda] 234441648 512-byte logical blocks: (120 GB/111 GiB)
[    1.174828] sd 0:0:0:0: [sda] Write Protect is off
[    1.174833] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    1.174852] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.175298]  sda: sda1 sda2 < sda5 >
[    1.175796] sd 0:0:0:0: [sda] Attached SCSI disk
[    1.176514] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    1.287653] PM: Starting manual resume from disk
[    1.287659] PM: Hibernation image partition 8:5 present
[    1.287661] PM: Looking for hibernation image.
[    1.287866] PM: Image not found (code -22)
[    1.287868] PM: Hibernation image not present or could not be loaded.
[    1.340133] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[    1.668889] fuse init (API version 7.23)
[    1.700727] systemd-udevd[160]: starting version 215
[    1.775547] tsc: Refined TSC clocksource calibration: 1396.767 MHz
[    1.825229] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[    1.844325] systemd-journald[140]: Received request to flush runtime journal from PID 1
[    1.869216] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input1
[    1.869459] ACPI: Lid Switch [LID0]
[    1.869538] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input2
[    1.869543] ACPI: Power Button [PWRB]
[    1.869603] input: Sleep Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:00/input/input3
[    1.869607] ACPI: Sleep Button [TPAD]
[    1.869663] input: Sleep Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:01/input/input4
[    1.869666] ACPI: Sleep Button [TSCR]
[    1.869745] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input5
[    1.869748] ACPI: Power Button [PWRF]
[    1.888916] ACPI: AC Adapter [AC] (on-line)
[    1.890188] ACPI: Battery Slot [BAT0] (battery present)
[    1.896532] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
[    1.896696] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input6
[    1.898266] tpm_tis tpm_tis: 1.2 TPM (device-id 0xB, rev-id 16)
[    1.924607] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[    1.924898] i801_smbus 0000:00:1f.3: SMBus using PCI interrupt
[    1.935441] input: PC Speaker as /devices/platform/pcspkr/input/input7
[    1.944716] ACPI: bus type USB registered
[    1.944758] usbcore: registered new interface driver usbfs
[    1.944775] usbcore: registered new interface driver hub
[    1.944801] usbcore: registered new device driver usb
[    1.954045] [drm] Initialized drm 1.1.0 20060810
[    1.971525] xhci_hcd 0000:00:14.0: xHCI Host Controller
[    1.971631] xhci_hcd 0000:00:14.0: new USB bus registered, assigned bus number 1
[    1.971730] xhci_hcd 0000:00:14.0: cache line size of 64 is not supported
[    1.971833] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.971836] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.971838] usb usb1: Product: xHCI Host Controller
[    1.971840] usb usb1: Manufacturer: Linux 3.18.0-rc5-next-20141121 xhci-hcd
[    1.971842] usb usb1: SerialNumber: 0000:00:14.0
[    1.972055] hub 1-0:1.0: USB hub found
[    1.972068] hub 1-0:1.0: 8 ports detected
[    1.972402] xhci_hcd 0000:00:14.0: xHCI Host Controller
[    1.972407] xhci_hcd 0000:00:14.0: new USB bus registered, assigned bus number 2
[    1.972447] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
[    1.972449] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.972452] usb usb2: Product: xHCI Host Controller
[    1.972454] usb usb2: Manufacturer: Linux 3.18.0-rc5-next-20141121 xhci-hcd
[    1.972456] usb usb2: SerialNumber: 0000:00:14.0
[    1.972599] hub 2-0:1.0: USB hub found
[    1.972609] hub 2-0:1.0: 4 ports detected
[    1.986251] alg: No test for crc32 (crc32-pclmul)
[    2.009863] __add_probed_i2c_device failed to register device 1-4a
[    2.015824] sound hdaudioC1D0: autoconfig: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
[    2.015830] sound hdaudioC1D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.015832] sound hdaudioC1D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    2.015834] sound hdaudioC1D0:    mono: mono_out=0x0
[    2.015836] sound hdaudioC1D0:    inputs:
[    2.015839] sound hdaudioC1D0:      Internal Mic=0x1a
[    2.015842] sound hdaudioC1D0:      Mic=0x19
[    2.025441] platform chromeos_laptop: Driver chromeos_laptop requests probe deferral
[    2.028627] input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/sound/card1/hdaudioC1D0/input8
[    2.031756] input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1b.0/sound/card1/input9
[    2.031846] input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card1/input10
[    2.050252] cfg80211: Calling CRDA to update world regulatory domain
[    2.094419] __add_probed_i2c_device failed to register device 1-4a
[    2.094435] platform chromeos_laptop: Driver chromeos_laptop requests probe deferral
[    2.100692] intel_rapl: Found RAPL domain package
[    2.100697] intel_rapl: Found RAPL domain core
[    2.100699] intel_rapl: Found RAPL domain uncore
[    2.100701] intel_rapl: Found RAPL domain dram
[    2.103203] iTCO_vendor_support: vendor-support=0
[    2.105380] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.11
[    2.105428] iTCO_wdt: Found a Lynx Point_LP TCO device (Version=2, TCOBASE=0x1060)
[    2.105543] iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)
[    2.106465] __add_probed_i2c_device failed to register device 1-4a
[    2.106477] platform chromeos_laptop: Driver chromeos_laptop requests probe deferral
[    2.111523] input: Cypress APA Trackpad (cyapa) as /devices/pci0000:00/0000:00:15.1/i2c-0/0-0067/input/input11
[    2.113048] __add_probed_i2c_device failed to register device 1-4a
[    2.113061] platform chromeos_laptop: Driver chromeos_laptop requests probe deferral
[    2.158871] [drm] Memory usable by graphics device = 2048M
[    2.158876] [drm] Replacing VGA console driver
[    2.160335] Console: switching to colour dummy device 80x25
[    2.161651] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    2.161655] [drm] Driver supports precise vblank timestamp query.
[    2.161741] [drm] applying backlight present quirk
[    2.161765] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
[    2.166721] tpm_inf_pnp 00:08: Found TPM with ID IFX0102
[    2.186204] cfg80211: World regulatory domain updated:
[    2.186209] cfg80211:  DFS Master region: unset
[    2.186211] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    2.186214] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    2.186217] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    2.186219] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[    2.186220] cfg80211:   (5170000 KHz - 5250000 KHz @ 160000 KHz), (N/A, 2000 mBm), (N/A)
[    2.186223] cfg80211:   (5250000 KHz - 5330000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    2.186224] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    2.186226] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[    2.186228] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[    2.226412] Adding 4069372k swap on /dev/sda5.  Priority:-1 extents:1 across:4069372k SSFS
[    2.236157] [drm] Initialized i915 1.6.0 20141107 for 0000:00:02.0 on minor 0
[    2.237581] fbcon: inteldrmfb (fb0) is primary device
[    2.238400] __add_probed_i2c_device failed to register device 1-4a
[    2.238401] chromeos_laptop_probe: Ran out of tries for device.
[    2.256985] input: HDA Intel HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/sound/card0/input12
[    2.257068] input: HDA Intel HDMI HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/sound/card0/input13
[    2.257139] input: HDA Intel HDMI HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/sound/card0/input14
[    2.270428] ath: phy0: ASPM enabled: 0x43
[    2.270430] ath: EEPROM regdomain: 0x6c
[    2.270431] ath: EEPROM indicates we should expect a direct regpair map
[    2.270433] ath: Country alpha2 being used: 00
[    2.270433] ath: Regpair used: 0x6c
[    2.275245] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[    2.275576] ieee80211 phy0: Atheros AR9462 Rev:2 mem=0xffffc90004980000, irq=16
[    2.283501] usb 1-3: new high-speed USB device number 2 using xhci_hcd
[    2.292068] RPC: Registered named UNIX socket transport module.
[    2.292069] RPC: Registered udp transport module.
[    2.292070] RPC: Registered tcp transport module.
[    2.292070] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    2.302509] FS-Cache: Loaded
[    2.356359] FS-Cache: Netfs 'nfs' registered for caching
[    2.395839] Installing knfsd (copyright (C) 1996 [email protected]).
[    2.536811] usb 1-3: New USB device found, idVendor=1bcf, idProduct=2c67
[    2.536813] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.536814] usb 1-3: Product: HD WebCam
[    2.536816] usb 1-3: Manufacturer: NC.21411.024409008DCLM0001
[    2.612620] media: Linux media interface: v0.10
[    2.626063] Linux video capture interface: v2.00
[    2.643357] uvcvideo: Found UVC 1.00 device HD WebCam (1bcf:2c67)
[    2.652139] input: HD WebCam as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/input/input15
[    2.652237] usbcore: registered new interface driver uvcvideo
[    2.652238] USB Video Class driver (1.1.1)
[    2.775489] usb 1-4: new full-speed USB device number 3 using xhci_hcd
[    2.775652] Switched to clocksource tsc
[    2.905355] usb 1-4: language id specifier not provided by device, defaulting to English
[    2.907453] usb 1-4: New USB device found, idVendor=0489, idProduct=e056
[    2.907455] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.943301] Bluetooth: Core ver 2.19
[    2.943319] NET: Registered protocol family 31
[    2.943320] Bluetooth: HCI device and connection manager initialized
[    2.943323] Bluetooth: HCI socket layer initialized
[    2.943325] Bluetooth: L2CAP socket layer initialized
[    2.943335] Bluetooth: SCO socket layer initialized
[    2.946800] usbcore: registered new interface driver btusb
[    2.948917] usbcore: registered new interface driver ath3k
[    3.307470] Console: switching to colour frame buffer device 170x48
[    3.311164] i915 0000:00:02.0: fb0: inteldrmfb frame buffer device
[    3.311166] i915 0000:00:02.0: registered panic notifier
[    3.330492] systemd-journald[140]: Received request to flush runtime journal from PID 1
[    3.615377] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    3.615381] Bluetooth: BNEP filters: protocol multicast
[    3.615387] Bluetooth: BNEP socket layer initialized
[    4.564020] random: nonblocking pool is initialized
[    7.436824] wlan0: authenticate with 00:1a:70:5a:6e:0b
[    7.448022] wlan0: send auth to 00:1a:70:5a:6e:0b (try 1/3)
[    7.450079] wlan0: authenticated
[    7.450415] ath9k 0000:01:00.0 wlan0: disabling HT as WMM/QoS is not supported by the AP
[    7.450419] ath9k 0000:01:00.0 wlan0: disabling VHT as WMM/QoS is not supported by the AP
[    7.450690] wlan0: associate with 00:1a:70:5a:6e:0b (try 1/3)
[    7.453088] wlan0: RX AssocResp from 00:1a:70:5a:6e:0b (capab=0x401 status=0 aid=8)
[    7.453184] wlan0: associated
[   21.081101] PM: Syncing filesystems ... done.
[   21.102575] PM: Preparing system for mem sleep
[   21.102716] Freezing user space processes ... (elapsed 0.001 seconds) done.
[   21.104134] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[   21.105392] PM: Entering mem sleep
[   21.105412] Suspending console(s) (use no_console_suspend to debug)
[   21.105690] wlan0: deauthenticating from 00:1a:70:5a:6e:0b by local choice (Reason: 3=DEAUTH_LEAVING)
[   21.114830] cfg80211: Calling CRDA to update world regulatory domain
[   21.212603] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[   21.212796] sd 0:0:0:0: [sda] Stopping disk
[   21.518754] PM: suspend of devices complete after 413.236 msecs
[   21.556533] PM: late suspend of devices complete after 37.779 msecs
[   21.557151] xhci_hcd 0000:00:14.0: System wakeup enabled by ACPI
[   21.572596] PM: noirq suspend of devices complete after 16.061 msecs
[   21.572878] ACPI: Preparing to enter system sleep state S3
[   21.573253] PM: Saving platform NVS memory
[   21.573254] Disabling non-boot CPUs ...
[   21.573299] intel_pstate CPU 1 exiting
[   21.573498] Broke affinity for irq 21
[   21.573509] Broke affinity for irq 41
[   21.573510] Broke affinity for irq 42
[   21.574517] kvm: disabling virtualization on CPU1
[   21.574528] smpboot: CPU 1 is now offline
[   21.576137] ACPI: Low-level resume complete
[   21.576200] PM: Restoring platform NVS memory
[   21.576582] Enabling non-boot CPUs ...
[   21.576650] x86: Booting SMP configuration:
[   21.576651] smpboot: Booting Node 0 Processor 1 APIC 0x2
[   21.589127] kvm: enabling virtualization on CPU1
[   21.591506] CPU1 is up
[   21.593253] ACPI: Waking up from system sleep state S3
[   21.654266] xhci_hcd 0000:00:14.0: System wakeup disabled by ACPI
[   21.654374] PM: noirq resume of devices complete after 60.962 msecs
[   21.678090] PM: early resume of devices complete after 23.694 msecs
[   21.678665] rtc_cmos 00:03: System wakeup disabled by ACPI
[   21.679279] ath: phy0: ASPM enabled: 0x43
[   21.694021] sd 0:0:0:0: [sda] Starting disk
[   21.803878] ------------[ cut here ]------------
[   21.803886] WARNING: CPU: 0 PID: 901 at kernel/irq/manage.c:444 enable_irq+0x3a/0x80()
[   21.803886] Unbalanced enable for IRQ 0
[   21.803927] Modules linked in: binfmt_misc bnep ecb ath3k btusb bluetooth uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscache sunrpc arc4 ath9k snd_hda_codec_hdmi ath9k_common ath9k_hw ath tpm_infineon mac80211 i915 joydev x86_pkg_temp_thermal iTCO_wdt intel_powerclamp cyapa iTCO_vendor_support intel_rapl iosf_mbi coretemp kvm_intel kvm cfg80211 snd_hda_codec_realtek snd_hda_codec_generic chromeos_laptop crct10dif_pclmul crc32_pclmul i2c_algo_bit crc32c_intel snd_hda_intel drm_kms_helper xhci_pci xhci_hcd ghash_clmulni_intel snd_hda_controller snd_hda_codec cryptd rfkill drm usbcore evdev pcspkr snd_hwdep serio_raw snd_pcm i2c_i801 shpchp snd_timer usb_common lpc_ich snd tpm_tis mfd_core video i2c_designware_pci
[   21.803941]  tpm battery ac soundcore i2c_designware_platform i2c_designware_core i2c_core processor button fuse autofs4 ext4 crc16 mbcache jbd2 sg sd_mod ahci libahci libata scsi_mod fan thermal thermal_sys sdhci_acpi sdhci mmc_core
[   21.803945] CPU: 0 PID: 901 Comm: systemd-sleep Not tainted 3.18.0-rc5-next-20141121 #50
[   21.803946] Hardware name: Acer Peppy, BIOS          04/30/2014
[   21.803949]  0000000000000000 ffffffff81725091 ffffffff81535c6c ffff8800740cbc78
[   21.803951]  ffffffff81069f61 ffff880100405400 0000000000000000 ffff88006c9c1c20
[   21.803953]  ffff88006ae73220 0000000000000010 ffffffff81069fda ffffffff8171bbb8
[   21.803953] Call Trace:
[   21.803959]  [<ffffffff81535c6c>] ? dump_stack+0x40/0x50
[   21.803964]  [<ffffffff81069f61>] ? warn_slowpath_common+0x81/0xb0
[   21.803967]  [<ffffffff81069fda>] ? warn_slowpath_fmt+0x4a/0x50
[   21.803969]  [<ffffffff810b9792>] ? __irq_get_desc_lock+0x52/0x90
[   21.803971]  [<ffffffff810bb32a>] ? enable_irq+0x3a/0x80
[   21.803976]  [<ffffffffa0412535>] ? cyapa_resume+0x85/0xb0 [cyapa]
[   21.803984]  [<ffffffffa01c3e90>] ? i2c_device_pm_thaw+0x40/0x40 [i2c_core]
[   21.803988]  [<ffffffff813ce85a>] ? dpm_run_callback+0x4a/0x100
[   21.803991]  [<ffffffff813cedd6>] ? device_resume+0xd6/0x210
[   21.803994]  [<ffffffff813d02c9>] ? dpm_resume+0x109/0x2c0
[   21.803997]  [<ffffffff813d07cd>] ? dpm_resume_end+0xd/0x20
[   21.804000]  [<ffffffff810ae1e7>] ? suspend_devices_and_enter+0x137/0x630
[   21.804003]  [<ffffffff810aea32>] ? pm_suspend+0x352/0x3d0
[   21.804005]  [<ffffffff810ad266>] ? state_store+0x76/0xf0
[   21.804010]  [<ffffffff8122bd5c>] ? kernfs_fop_write+0x12c/0x180
[   21.804013]  [<ffffffff811b78a2>] ? vfs_write+0xb2/0x1f0
[   21.804015]  [<ffffffff811b8432>] ? SyS_write+0x42/0xb0
[   21.804018]  [<ffffffff8153b6ad>] ? system_call_fastpath+0x16/0x1b
[   21.804020] ---[ end trace 83d258439f6abe06 ]---
[   21.950207] usb 1-3: reset high-speed USB device number 2 using xhci_hcd
[   21.950304] xhci_hcd 0000:00:14.0: Setup ERROR: setup context command for slot 1.
[   21.950318] usb 1-3: hub failed to enable device, error -22
[   22.013961] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[   22.014501] ata1.00: configured for UDMA/100
[   22.061971] usb 1-3: reset high-speed USB device number 2 using xhci_hcd
[   22.061994] xhci_hcd 0000:00:14.0: Setup ERROR: setup context command for slot 1.
[   22.061997] usb 1-3: hub failed to enable device, error -22
[   22.174015] usb 1-3: reset high-speed USB device number 2 using xhci_hcd
[   22.248252] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ffff8800743acdc0
[   22.318296] PM: resume of devices complete after 640.307 msecs
[   22.318523] PM: Finishing wakeup.
[   22.318525] Restarting tasks ... 
[   22.326581] cfg80211: World regulatory domain updated:
[   22.326587] cfg80211:  DFS Master region: unset
[   22.326588] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   22.326592] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   22.326594] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   22.326596] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   22.326598] cfg80211:   (5170000 KHz - 5250000 KHz @ 160000 KHz), (N/A, 2000 mBm), (N/A)
[   22.326600] cfg80211:   (5250000 KHz - 5330000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   22.326602] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   22.326604] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   22.326606] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   22.327163] done.
[   22.333946] usb 1-4: USB disconnect, device number 3
[   22.450841] wlan0: authenticate with 00:1a:70:5a:6e:0b
[   22.458798] wlan0: send auth to 00:1a:70:5a:6e:0b (try 1/3)
[   22.460935] wlan0: authenticated
[   22.461208] ath9k 0000:01:00.0 wlan0: disabling HT as WMM/QoS is not supported by the AP
[   22.461215] ath9k 0000:01:00.0 wlan0: disabling VHT as WMM/QoS is not supported by the AP
[   22.461907] wlan0: associate with 00:1a:70:5a:6e:0b (try 1/3)
[   22.466033] wlan0: RX AssocResp from 00:1a:70:5a:6e:0b (capab=0x401 status=0 aid=8)
[   22.466126] wlan0: associated
[   23.677715] usb 1-4: new full-speed USB device number 4 using xhci_hcd
[   23.807361] usb 1-4: language id specifier not provided by device, defaulting to English
[   23.809240] usb 1-4: New USB device found, idVendor=0489, idProduct=e056
[   23.809245] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   23.847691] usb 1-4: USB disconnect, device number 4
[   24.117655] usb 1-4: new full-speed USB device number 5 using xhci_hcd
[   24.247363] usb 1-4: language id specifier not provided by device, defaulting to English
[   24.249285] usb 1-4: New USB device found, idVendor=0489, idProduct=e056
[   24.249292] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
#23 lore raw

PATCH 1/1 next: cyapa: fix inop touchpad after resume on Acer C720

On an Acer C720 running linux-next (20141124) the touchpad will become inoperative after a resume. Reloading the cyapa driver restores normal operation.

The following trace appeared in dmesg after a resume.

  [   21.803878] ------------[ cut here ]------------
  [   21.803886] WARNING: CPU: 0 PID: 901 at kernel/irq/manage.c:444 enable_irq+0x3a/0x80()
  [   21.803886] Unbalanced enable for IRQ 0
  [   21.803927] Modules linked in: binfmt_misc bnep ecb ath3k btusb bluetooth uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscache sunrpc arc4 ath9k snd_hda_codec_hdmi ath9k_common ath9k_hw ath tpm_infineon mac80211 i915 joydev x86_pkg_temp_thermal iTCO_wdt intel_powerclamp cyapa iTCO_vendor_support intel_rapl iosf_mbi coretemp kvm_intel kvm cfg80211 snd_hda_codec_realtek snd_hda_codec_generic chromeos_laptop crct10dif_pclmul crc32_pclmul i2c_algo_bit crc32c_intel snd_hda_intel drm_kms_helper xhci_pci xhci_hcd ghash_clmulni_intel snd_hda_controller snd_hda_codec cryptd rfkill drm usbcore evdev pcspkr snd_hwdep serio_raw snd_pcm i2c_i801 shpchp snd_timer usb_common lpc_ich snd tpm_tis mfd_core video i2c_designware_pci
  [   21.803941]  tpm battery ac soundcore i2c_designware_platform i2c_designware_core i2c_core processor button fuse autofs4 ext4 crc16 mbcache jbd2 sg sd_mod ahci libahci libata scsi_mod fan thermal thermal_sys sdhci_acpi sdhci mmc_core
  [   21.803945] CPU: 0 PID: 901 Comm: systemd-sleep Not tainted 3.18.0-rc5-next-20141121 #50
  [   21.803946] Hardware name: Acer Peppy, BIOS          04/30/2014
  [   21.803949]  0000000000000000 ffffffff81725091 ffffffff81535c6c ffff8800740cbc78
  [   21.803951]  ffffffff81069f61 ffff880100405400 0000000000000000 ffff88006c9c1c20
  [   21.803953]  ffff88006ae73220 0000000000000010 ffffffff81069fda ffffffff8171bbb8
  [   21.803953] Call Trace:
  [   21.803959]  [<ffffffff81535c6c>] ? dump_stack+0x40/0x50
  [   21.803964]  [<ffffffff81069f61>] ? warn_slowpath_common+0x81/0xb0
  [   21.803967]  [<ffffffff81069fda>] ? warn_slowpath_fmt+0x4a/0x50
  [   21.803969]  [<ffffffff810b9792>] ? __irq_get_desc_lock+0x52/0x90
  [   21.803971]  [<ffffffff810bb32a>] ? enable_irq+0x3a/0x80
  [   21.803976]  [<ffffffffa0412535>] ? cyapa_resume+0x85/0xb0 [cyapa]
  [   21.803984]  [<ffffffffa01c3e90>] ? i2c_device_pm_thaw+0x40/0x40 [i2c_core]
  [   21.803988]  [<ffffffff813ce85a>] ? dpm_run_callback+0x4a/0x100
  [   21.803991]  [<ffffffff813cedd6>] ? device_resume+0xd6/0x210
  [   21.803994]  [<ffffffff813d02c9>] ? dpm_resume+0x109/0x2c0
  [   21.803997]  [<ffffffff813d07cd>] ? dpm_resume_end+0xd/0x20
  [   21.804000]  [<ffffffff810ae1e7>] ? suspend_devices_and_enter+0x137/0x630
  [   21.804003]  [<ffffffff810aea32>] ? pm_suspend+0x352/0x3d0
  [   21.804005]  [<ffffffff810ad266>] ? state_store+0x76/0xf0
  [   21.804010]  [<ffffffff8122bd5c>] ? kernfs_fop_write+0x12c/0x180
  [   21.804013]  [<ffffffff811b78a2>] ? vfs_write+0xb2/0x1f0
  [   21.804015]  [<ffffffff811b8432>] ? SyS_write+0x42/0xb0
  [   21.804018]  [<ffffffff8153b6ad>] ? system_call_fastpath+0x16/0x1b
  [   21.804020] ---[ end trace 83d258439f6abe06 ]---

Performing a bisect on the kernel revealed that the following commit introduced the bug.

commit b1cfa7b4388285c0f0b486f152ab0cb18612c779
Author: Dudley Du <[email protected]>
Date: Sun Nov 9 12:36:34 2014 -0800

Input: cyapa - switch to using managed resources

Use of managed resources simplifies error handling and device removal code.

[Dmitry: added open/close methods so cyapa_remove is no longer needed.]

The trace message "Unbalanced enable for IRQ 0" suggests there is a problem with the interrupts. Examing the patch which introduced the bug revealed that the variable used to store the interrupt number was changed from cyapa->irq to client->irq. However, there was an old entry in cyapa_resume() which wasn't updated and was trying to enable interrupts using the old name. Since it was undefined, it was trying to enable irq 0, which produced the error.

Fix the bug by using the correct variable name in cyapa_resume().

---
 drivers/input/mouse/cyapa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/cyapa.c +1 -1
index c84a9eb..d8d2ccb 100644
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)
 		dev_warn(dev, "resume: set power mode to %d failed: %d\n",
 			 power_mode, error);
 
-	enable_irq(cyapa->irq);
+	enable_irq(client->irq);
 
 	mutex_unlock(&input->mutex);
 
Signature · 5 lines
2.1.3


-- 
- Jeremiah Mahler
#24 lore raw

RE: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Hi Jermiah,

Does your code merged from chromiumos gerrit?
If so, the patch you used seems very old, because the log shown the cyapa driver module name still be "cyapa", and it has already been changed to "cyapatp" for log time. Currently, I have already removed all old pathces from the gerrit system, now only v11 pathces existing in gerrit system.
Could you please try to refetch again,
or
could you try the v11 patches that from http://patchwork.kernel.org/bundle/dudlx/input_cyapa_v11/
or
The attached zip file contians the v11 patches for chromiumos projects, same as currently existing in gerrit system.
Besides the first and the latest patches which are specifical for chromionos, the reset pathces are exactly same as the cyapa v11 pathces that submitted to this kernel commuinty.

Thanks,
Dudley

Quoted 114 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?25? 18:07
To: Dudley Du
Cc: [email protected]
Subject: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

On an Acer C720 running linux-next (20141124) the touchpad will become inoperative after a resume. Reloading the cyapa driver restores normal operation.

The following trace appeared in dmesg after a resume.

  [   21.803878] ------------[ cut here ]------------
  [   21.803886] WARNING: CPU: 0 PID: 901 at kernel/irq/manage.c:444
enable_irq+0x3a/0x80()
  [   21.803886] Unbalanced enable for IRQ 0
  [   21.803927] Modules linked in: binfmt_misc bnep ecb ath3k btusb bluetooth

uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscache sunrpc arc4 ath9k snd_hda_codec_hdmi ath9k_common ath9k_hw ath tpm_infineon mac80211 i915 joydev x86_pkg_temp_thermal iTCO_wdt intel_powerclamp cyapa iTCO_vendor_support intel_rapl iosf_mbi coretemp kvm_intel kvm cfg80211 snd_hda_codec_realtek snd_hda_codec_generic chromeos_laptop crct10dif_pclmul crc32_pclmul i2c_algo_bit crc32c_intel snd_hda_intel drm_kms_helper xhci_pci xhci_hcd ghash_clmulni_intel snd_hda_controller snd_hda_codec cryptd rfkill drm usbcore evdev pcspkr snd_hwdep serio_raw snd_pcm i2c_i801 shpchp snd_timer usb_common lpc_ich snd tpm_tis mfd_core video i2c_designware_pci

  [   21.803941]  tpm battery ac soundcore i2c_designware_platform
i2c_designware_core i2c_core processor button fuse autofs4 ext4 crc16 mbcache
jbd2 sg sd_mod ahci libahci libata scsi_mod fan thermal thermal_sys sdhci_acpi
sdhci mmc_core
  [   21.803945] CPU: 0 PID: 901 Comm: systemd-sleep Not tainted
3.18.0-rc5-next-20141121 #50
  [   21.803946] Hardware name: Acer Peppy, BIOS          04/30/2014
  [   21.803949]  0000000000000000 ffffffff81725091 ffffffff81535c6c
ffff8800740cbc78
  [   21.803951]  ffffffff81069f61 ffff880100405400 0000000000000000
ffff88006c9c1c20
  [   21.803953]  ffff88006ae73220 0000000000000010 ffffffff81069fda
ffffffff8171bbb8
  [   21.803953] Call Trace:
  [   21.803959]  [<ffffffff81535c6c>] ? dump_stack+0x40/0x50
  [   21.803964]  [<ffffffff81069f61>] ? warn_slowpath_common+0x81/0xb0
  [   21.803967]  [<ffffffff81069fda>] ? warn_slowpath_fmt+0x4a/0x50
  [   21.803969]  [<ffffffff810b9792>] ? __irq_get_desc_lock+0x52/0x90
  [   21.803971]  [<ffffffff810bb32a>] ? enable_irq+0x3a/0x80
  [   21.803976]  [<ffffffffa0412535>] ? cyapa_resume+0x85/0xb0 [cyapa]
  [   21.803984]  [<ffffffffa01c3e90>] ? i2c_device_pm_thaw+0x40/0x40
[i2c_core]
  [   21.803988]  [<ffffffff813ce85a>] ? dpm_run_callback+0x4a/0x100
  [   21.803991]  [<ffffffff813cedd6>] ? device_resume+0xd6/0x210
  [   21.803994]  [<ffffffff813d02c9>] ? dpm_resume+0x109/0x2c0
  [   21.803997]  [<ffffffff813d07cd>] ? dpm_resume_end+0xd/0x20
  [   21.804000]  [<ffffffff810ae1e7>] ?
suspend_devices_and_enter+0x137/0x630
  [   21.804003]  [<ffffffff810aea32>] ? pm_suspend+0x352/0x3d0
  [   21.804005]  [<ffffffff810ad266>] ? state_store+0x76/0xf0
  [   21.804010]  [<ffffffff8122bd5c>] ? kernfs_fop_write+0x12c/0x180
  [   21.804013]  [<ffffffff811b78a2>] ? vfs_write+0xb2/0x1f0
  [   21.804015]  [<ffffffff811b8432>] ? SyS_write+0x42/0xb0
  [   21.804018]  [<ffffffff8153b6ad>] ? system_call_fastpath+0x16/0x1b
  [   21.804020] ---[ end trace 83d258439f6abe06 ]---

Performing a bisect on the kernel revealed that the following commit introduced the bug.

commit b1cfa7b4388285c0f0b486f152ab0cb18612c779
Author: Dudley Du <[email protected]>
Date: Sun Nov 9 12:36:34 2014 -0800

Input: cyapa - switch to using managed resources

Use of managed resources simplifies error handling and device removal
code.

[Dmitry: added open/close methods so cyapa_remove is no longer needed.]

The trace message "Unbalanced enable for IRQ 0" suggests there is a problem with the interrupts. Examing the patch which introduced the bug revealed that the variable used to store the interrupt number was changed from cyapa->irq to client->irq. However, there was an old entry in cyapa_resume() which wasn't updated and was trying to enable interrupts using the old name. Since it was undefined, it was trying to enable irq 0, which produced the error.

Fix the bug by using the correct variable name in cyapa_resume().

---
 drivers/input/mouse/cyapa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/cyapa.c +1 -2
index c84a9eb..d8d2ccb 100644
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct device
 *dev)
 dev_warn(dev, "resume: set power mode to %d failed: %d\n",
  power_mode, error);
 
-enable_irq(cyapa->irq);
+enable_irq(client->irq);
 
 mutex_unlock(&input->mutex);
 
--

2.1.3

Quoted 2 lines

--
- Jeremiah Mahler

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.

#25 lore raw

Re: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Dudley,

Quoted 1 line · Dudley Du

Hi Jermiah,

      ^^^
	 Jeremiah,
Quoted 8 lines

Does your code merged from chromiumos gerrit?
If so, the patch you used seems very old, because the log shown the cyapa driver module name still be "cyapa", and it has already been changed to "cyapatp" for log time. Currently, I have already removed all old pathces from the gerrit system, now only v11 pathces existing in gerrit system.
Could you please try to refetch again,
or
could you try the v11 patches that from http://patchwork.kernel.org/bundle/dudlx/input_cyapa_v11/
or

I am not pulling from your gerrit system. I am pulling from linux-next.

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git

Yes, my bug is for an older patch, however this patch is still in linux-next as of the latest 20140326.

commit b1cfa7b4388285c0f0b486f152ab0cb18612c779

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=b1cfa7b4388285c0f0b486f152ab0cb18612c779

I replied to your latest patch set because it was working on the same part of the code and I thought it might be related. Perhaps your new code fixes all the problems, I'm not sure.

Quoted 16 lines

The attached zip file contians the v11 patches for chromiumos projects, same as currently existing in gerrit system.
Besides the first and the latest patches which are specifical for chromionos, the reset pathces are exactly same as the cyapa v11 pathces that submitted to this kernel commuinty.

Thanks,
Dudley

Quoted 10 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?25? 18:07
To: Dudley Du
Cc: [email protected]
Subject: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

On an Acer C720 running linux-next (20141124) the touchpad will become inoperative after a resume. Reloading the cyapa driver restores normal +enable_irq(client->irq);

[]

Signature · 1 line
- Jeremiah Mahler
#26 lore raw

RE: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

In reply to Jeremiah Mahler

More info: I did all testings based on kernel 3.14.0 on Acer C70.

Thanks,
Dudley

Quoted 140 lines

-----Original Message-----
From: Dudley Du
Sent: 2014?11?26? 14:01
To: 'Jeremiah Mahler'
Cc: '[email protected]'
Subject: RE: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Hi Jermiah,

Does your code merged from chromiumos gerrit?
If so, the patch you used seems very old, because the log shown the cyapa driver module name still be "cyapa", and it has already been changed to "cyapatp" for log time.
Currently, I have already removed all old pathces from the gerrit system, now only v11 pathces existing in gerrit system.
Could you please try to refetch again,
or
could you try the v11 patches that from
http://patchwork.kernel.org/bundle/dudlx/input_cyapa_v11/
or
The attached zip file contians the v11 patches for chromiumos projects, same as currently existing in gerrit system.
Besides the first and the latest patches which are specifical for chromionos, the reset pathces are exactly same as the cyapa v11 pathces that submitted to this kernel commuinty.

Thanks,
Dudley

Quoted 11 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?25? 18:07
To: Dudley Du
Cc: [email protected]
Subject: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

On an Acer C720 running linux-next (20141124) the touchpad will become inoperative after a resume. Reloading the cyapa driver restores normal operation.

Quoted 7 lines

The following trace appeared in dmesg after a resume.

  [   21.803878] ------------[ cut here ]------------
  [   21.803886] WARNING: CPU: 0 PID: 901 at kernel/irq/manage.c:444
enable_irq+0x3a/0x80()
  [   21.803886] Unbalanced enable for IRQ 0
  [   21.803927] Modules linked in: binfmt_misc bnep ecb ath3k btusb

bluetooth

Quoted 54 lines

uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscache sunrpc arc4 ath9k snd_hda_codec_hdmi ath9k_common ath9k_hw ath tpm_infineon mac80211 i915 joydev x86_pkg_temp_thermal iTCO_wdt intel_powerclamp cyapa iTCO_vendor_support intel_rapl iosf_mbi coretemp kvm_intel kvm cfg80211 snd_hda_codec_realtek snd_hda_codec_generic chromeos_laptop crct10dif_pclmul crc32_pclmul i2c_algo_bit crc32c_intel snd_hda_intel drm_kms_helper xhci_pci xhci_hcd ghash_clmulni_intel snd_hda_controller snd_hda_codec cryptd rfkill drm usbcore evdev pcspkr snd_hwdep serio_raw snd_pcm i2c_i801 shpchp snd_timer usb_common lpc_ich snd tpm_tis mfd_core video i2c_designware_pci

  [   21.803941]  tpm battery ac soundcore i2c_designware_platform
i2c_designware_core i2c_core processor button fuse autofs4 ext4 crc16 mbcache
jbd2 sg sd_mod ahci libahci libata scsi_mod fan thermal thermal_sys sdhci_acpi
sdhci mmc_core
  [   21.803945] CPU: 0 PID: 901 Comm: systemd-sleep Not tainted
3.18.0-rc5-next-20141121 #50
  [   21.803946] Hardware name: Acer Peppy, BIOS          04/30/2014
  [   21.803949]  0000000000000000 ffffffff81725091 ffffffff81535c6c
ffff8800740cbc78
  [   21.803951]  ffffffff81069f61 ffff880100405400 0000000000000000
ffff88006c9c1c20
  [   21.803953]  ffff88006ae73220 0000000000000010 ffffffff81069fda
ffffffff8171bbb8
  [   21.803953] Call Trace:
  [   21.803959]  [<ffffffff81535c6c>] ? dump_stack+0x40/0x50
  [   21.803964]  [<ffffffff81069f61>] ? warn_slowpath_common+0x81/0xb0
  [   21.803967]  [<ffffffff81069fda>] ? warn_slowpath_fmt+0x4a/0x50
  [   21.803969]  [<ffffffff810b9792>] ? __irq_get_desc_lock+0x52/0x90
  [   21.803971]  [<ffffffff810bb32a>] ? enable_irq+0x3a/0x80
  [   21.803976]  [<ffffffffa0412535>] ? cyapa_resume+0x85/0xb0 [cyapa]
  [   21.803984]  [<ffffffffa01c3e90>] ? i2c_device_pm_thaw+0x40/0x40
[i2c_core]
  [   21.803988]  [<ffffffff813ce85a>] ? dpm_run_callback+0x4a/0x100
  [   21.803991]  [<ffffffff813cedd6>] ? device_resume+0xd6/0x210
  [   21.803994]  [<ffffffff813d02c9>] ? dpm_resume+0x109/0x2c0
  [   21.803997]  [<ffffffff813d07cd>] ? dpm_resume_end+0xd/0x20
  [   21.804000]  [<ffffffff810ae1e7>] ?
suspend_devices_and_enter+0x137/0x630
  [   21.804003]  [<ffffffff810aea32>] ? pm_suspend+0x352/0x3d0
  [   21.804005]  [<ffffffff810ad266>] ? state_store+0x76/0xf0
  [   21.804010]  [<ffffffff8122bd5c>] ? kernfs_fop_write+0x12c/0x180
  [   21.804013]  [<ffffffff811b78a2>] ? vfs_write+0xb2/0x1f0
  [   21.804015]  [<ffffffff811b8432>] ? SyS_write+0x42/0xb0
  [   21.804018]  [<ffffffff8153b6ad>] ? system_call_fastpath+0x16/0x1b
  [   21.804020] ---[ end trace 83d258439f6abe06 ]---

Performing a bisect on the kernel revealed that the following commit introduced the bug.

commit b1cfa7b4388285c0f0b486f152ab0cb18612c779
Author: Dudley Du <[email protected]>
Date: Sun Nov 9 12:36:34 2014 -0800

Quoted 7 lines

Input: cyapa - switch to using managed resources

Use of managed resources simplifies error handling and device removal
code.

[Dmitry: added open/close methods so cyapa_remove is no longer

needed.]

Quoted 29 lines

The trace message "Unbalanced enable for IRQ 0" suggests there is a problem with the interrupts. Examing the patch which introduced the bug revealed that the variable used to store the interrupt number was changed from cyapa->irq to client->irq. However, there was an old entry in cyapa_resume() which wasn't updated and was trying to enable interrupts using the old name. Since it was undefined, it was trying to enable irq 0, which produced the error.

Fix the bug by using the correct variable name in cyapa_resume().

---
 drivers/input/mouse/cyapa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/cyapa.c +1 -1
index c84a9eb..d8d2ccb 100644
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct device
 *dev)
 dev_warn(dev, "resume: set power mode to %d failed: %d\n",
  power_mode, error);
 
-enable_irq(cyapa->irq);
+enable_irq(client->irq);
 
Quoted 8 lines
Quoted 8 lines
drivers/input/mouse/cyapa.c +0 -1
 mutex_unlock(&input->mutex);
 
--

2.1.3

--
- Jeremiah Mahler

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.

author
#28 lore raw

RE: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Jeremiah,

I didn't make the special patch for the linux-next before, so I don't know why this patch is there and have issue.
Based on current code in the linux-next, I made below patch to fix this issue. Could you please try again with attached patch fix.

Thanks,
Dudley

Quoted 21 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?27? 4:03
To: Dudley Du
Cc: [email protected]
Subject: Re: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Dudley,

Quoted 2 lines · Dudley Du

More info: I did all testings based on kernel 3.14.0 on Acer C70.

I am testing with linux-next 3.18-rc6 on an Acer C720.

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/

Quoted 3 lines

Thanks,
Dudley

Quoted 6 lines

[]

--
- Jeremiah Mahler

From bb717b1c1525ef6b889f0ef735d920eed9e76e72 Mon Sep 17 00:00:00 2001

From: Dudley Du <[email protected]>
Date: Thu, 27 Nov 2014 13:35:09 +0800
Subject: [PATCH] input: cyapa: fix irq error issue in cyapa_resume
To: [email protected],
[email protected]
Cc: [email protected],
[email protected]

This patch is aimed to fix the irq error happened on cyapa_resume when doing suspend/resume testing.
The root cause of this issue is that the cyapa->irq has been removed but still used in the driver.

---
 drivers/input/mouse/cyapa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/input/mouse/cyapa.c +3 -3
index c84a9eb..caaba7b 100644
@@ -938,7 +938,7 @@ static int __maybe_unused cyapa_suspend(struct device *dev)
 			 power_mode, error);
 
 	if (device_may_wakeup(dev))
-		cyapa->irq_wake = (enable_irq_wake(cyapa->irq) == 0);
+		cyapa->irq_wake = (enable_irq_wake(cyapa->client->irq) == 0);
 
 	mutex_unlock(&input->mutex);
 
@@ -956,7 +956,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)
 	mutex_lock(&input->mutex);
 
 	if (device_may_wakeup(dev) && cyapa->irq_wake)
-		disable_irq_wake(cyapa->irq);
+		disable_irq_wake(cyapa->client->irq);
 
 	power_mode = input->users ? PWR_MODE_FULL_ACTIVE : PWR_MODE_OFF;
 	error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)
 		dev_warn(dev, "resume: set power mode to %d failed: %d\n",
 			 power_mode, error);
 
-	enable_irq(cyapa->irq);
+	enable_irq(cyapa->client->irq);
 
 	mutex_unlock(&input->mutex);
 
Signature · 1 line
1.9.1
Quoted 1 line

From bb717b1c1525ef6b889f0ef735d920eed9e76e72 Mon Sep 17 00:00:00 2001

From: Dudley Du <[email protected]>
Date: Thu, 27 Nov 2014 13:35:09 +0800
Subject: [PATCH] input: cyapa: fix irq error issue in cyapa_resume
To: [email protected],
[email protected]
Cc: [email protected],
[email protected]

This patch is aimed to fix the irq error happened on cyapa_resume when doing suspend/resume testing.
The root cause of this issue is that the cyapa->irq has been removed but still used in the driver.

---
 drivers/input/mouse/cyapa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/input/mouse/cyapa.c +3 -3
index c84a9eb..caaba7b 100644
@@ -938,7 +938,7 @@ static int __maybe_unused cyapa_suspend(struct device *dev)
 			 power_mode, error);
 
 	if (device_may_wakeup(dev))
-		cyapa->irq_wake = (enable_irq_wake(cyapa->irq) == 0);
+		cyapa->irq_wake = (enable_irq_wake(cyapa->client->irq) == 0);
 
 	mutex_unlock(&input->mutex);
 
@@ -956,7 +956,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)
 	mutex_lock(&input->mutex);
 
 	if (device_may_wakeup(dev) && cyapa->irq_wake)
-		disable_irq_wake(cyapa->irq);
+		disable_irq_wake(cyapa->client->irq);
 
 	power_mode = input->users ? PWR_MODE_FULL_ACTIVE : PWR_MODE_OFF;
 	error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)
 		dev_warn(dev, "resume: set power mode to %d failed: %d\n",
 			 power_mode, error);
 
-	enable_irq(cyapa->irq);
+	enable_irq(cyapa->client->irq);
 
 	mutex_unlock(&input->mutex);
 
Signature · 1 line
1.9.1
Tested-by
#29 lore raw

Re: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Dudley,

Quoted 45 lines · Dudley Du

Jeremiah,

I didn't make the special patch for the linux-next before, so I don't know why this patch is there and have issue.
Based on current code in the linux-next, I made below patch to fix this issue. Could you please try again with attached patch fix.

Thanks,
Dudley

Quoted 18 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?27? 4:03
To: Dudley Du
Cc: [email protected]
Subject: Re: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Dudley,

Quoted 2 lines · Dudley Du

More info: I did all testings based on kernel 3.14.0 on Acer C70.

I am testing with linux-next 3.18-rc6 on an Acer C720.

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/

Quoted 7 lines
Quoted 3 lines

Thanks,
Dudley

[]

--
- Jeremiah Mahler

From bb717b1c1525ef6b889f0ef735d920eed9e76e72 Mon Sep 17 00:00:00 2001
From: Dudley Du <[email protected]>
Date: Thu, 27 Nov 2014 13:35:09 +0800
Subject: [PATCH] input: cyapa: fix irq error issue in cyapa_resume
To: [email protected],
[email protected]
Cc: [email protected],
[email protected]

Quoted 3 lines

This patch is aimed to fix the irq error happened on cyapa_resume when doing suspend/resume testing.
From my perspective this doesn't really describe the problem. It makes

no mention of the touchpad becoming inoperative or what machine it occurred on. Perhaps something like the following.

This patch fixes a problem found on Acer C720 computers which would cause the touchpad to become inoperative after a resume.

Quoted 4 lines

The root cause of this issue is that the cyapa->irq has been removed but still used in the driver.

It is a nice courtesy to give credit to those who help you with your code.

Quoted 9 lines
---
 drivers/input/mouse/cyapa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/input/mouse/cyapa.c +0 -0
index c84a9eb..caaba7b 100644

drivers/input/mouse/cyapa.c static int __maybe_unused cyapa_suspend(struct device *dev) · line 942

Quoted 6 lines
drivers/input/mouse/cyapa.c +1 -1
@@ -938,7 +938,7 @@ static int __maybe_unused cyapa_suspend(struct device *dev)
 			 power_mode, error);
 
 	if (device_may_wakeup(dev))
-		cyapa->irq_wake = (enable_irq_wake(cyapa->irq) == 0);
+		cyapa->irq_wake = (enable_irq_wake(cyapa->client->irq) == 0);
 

Looks good. I missed the _may_wakeup parts in my patch.

Since the client object is available in this context is there a reason why cyapa->client->irq is better than client->irq?

drivers/input/mouse/cyapa.c static int __maybe_unused cyapa_resume(struct device *dev) · line 960

Quoted 9 lines
drivers/input/mouse/cyapa.c +1 -1
 	mutex_unlock(&input->mutex);
 
@@ -956,7 +956,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)
 	mutex_lock(&input->mutex);
 
 	if (device_may_wakeup(dev) && cyapa->irq_wake)
-		disable_irq_wake(cyapa->irq);
+		disable_irq_wake(cyapa->client->irq);
 

Looks good, same as other.

drivers/input/mouse/cyapa.c static int __maybe_unused cyapa_resume(struct device *dev) · line 968

Quoted 9 lines
drivers/input/mouse/cyapa.c +1 -1
 	power_mode = input->users ? PWR_MODE_FULL_ACTIVE : PWR_MODE_OFF;
 	error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)
 		dev_warn(dev, "resume: set power mode to %d failed: %d\n",
 			 power_mode, error);
 
-	enable_irq(cyapa->irq);
+	enable_irq(cyapa->client->irq);
 

This was the main problem. My patch used client->irq, but cyapa->client->irq works too.

Quoted 4 lines
drivers/input/mouse/cyapa.c +0 -0
 	mutex_unlock(&input->mutex);
 
Signature · 1 line
1.9.1

I tested the patch and it works.

Thanks,

Signature · 1 line
- Jeremiah Mahler
maintainer
#30 lore raw

RE: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

In reply to Dudley Du
Quoted 5 lines · Dudley Du

Jeremiah,

I didn't make the special patch for the linux-next before, so I don't know why
this patch is there and have issue.

That was the patch we've discussed some times back and you mentioned it was working for you so I applied it to next.

I'll make sure to apply the fixup promptly.

Quoted 80 lines

Based on current code in the linux-next, I made below patch to fix this issue.
Could you please try again with attached patch fix.

Thanks,
Dudley

Quoted 6 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?27? 4:03
To: Dudley Du
Cc: [email protected]
Subject: Re: [BUG] [PATCH] next: cyapa: fix inop touchpad after

resume on Acer

Quoted 12 lines

C720

Dudley,

Quoted 2 lines · Dudley Du

More info: I did all testings based on kernel 3.14.0 on Acer C70.

I am testing with linux-next 3.18-rc6 on an Acer C720.

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/

Quoted 7 lines
Quoted 3 lines

Thanks,
Dudley

[]

--
- Jeremiah Mahler

From bb717b1c1525ef6b889f0ef735d920eed9e76e72 Mon Sep 17 00:00:00 2001
From: Dudley Du <[email protected]>
Date: Thu, 27 Nov 2014 13:35:09 +0800
Subject: [PATCH] input: cyapa: fix irq error issue in cyapa_resume
To: [email protected],
[email protected]
Cc: [email protected],
[email protected]

This patch is aimed to fix the irq error happened on cyapa_resume when doing suspend/resume testing.
The root cause of this issue is that the cyapa->irq has been removed but
still used in the driver.

---
drivers/input/mouse/cyapa.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)
drivers/input/mouse/cyapa.c +2 -2
index c84a9eb..caaba7b 100644
@@ -938,7 +938,7 @@ static int __maybe_unused cyapa_suspend(struct
 device *dev)
 			 power_mode, error);
 
 	if (device_may_wakeup(dev))
-		cyapa->irq_wake = (enable_irq_wake(cyapa->irq) == 0);
+		cyapa->irq_wake = (enable_irq_wake(cyapa->client->irq) == 0);
 
 	mutex_unlock(&input->mutex);
@@ -956,7 +956,7 @@ static int __maybe_unused cyapa_resume(struct
 device *dev)
 	mutex_lock(&input->mutex);
 
 	if (device_may_wakeup(dev) && cyapa->irq_wake)
-		disable_irq_wake(cyapa->irq);
+		disable_irq_wake(cyapa->client->irq);
 
 	power_mode = input->users ? PWR_MODE_FULL_ACTIVE : PWR_MODE_OFF;
	error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);

drivers/input/mouse/cyapa.c static int __maybe_unused cyapa_resume(struct · line 970

Quoted 8 lines
drivers/input/mouse/cyapa.c +1 -1
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct
 device *dev)
 		dev_warn(dev, "resume: set power mode to %d failed: %d\n",
 			 power_mode, error);
 
-	enable_irq(cyapa->irq);
+	enable_irq(cyapa->client->irq);
 
 	mutex_unlock(&input->mutex);

Hi Dudley,
Thanks.

Signature · 1 line
Dmitry
#31 lore raw

RE: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Dmitry,

Yes, I remebered the discussion, and I said it was working.
At that time, I though it was the suggestion to my patches, so I merged the solution to my pathces, and verified on my pathces. But did not run test on the patch you attached.
Sorry for the misunderstood and the troubles to you. :)

Regards,
Dudley

Quoted 107 lines

-----Original Message-----
From: Dmitry Torokhov [mailto:[email protected]]
Sent: 2014年11月28日 2:16
To: Dudley Du; 'Jeremiah Mahler'
Cc: [email protected]; Dudley Du
Subject: RE: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Quoted 5 lines · Dudley Du

Jeremiah,

I didn't make the special patch for the linux-next before, so I don't know why
this patch is there and have issue.

That was the patch we've discussed some times back and you mentioned it was working for you so I applied it to next.

I'll make sure to apply the fixup promptly.

Quoted 86 lines

Based on current code in the linux-next, I made below patch to fix this issue.
Could you please try again with attached patch fix.

Thanks,
Dudley

Quoted 6 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?27? 4:03
To: Dudley Du
Cc: [email protected]
Subject: Re: [BUG] [PATCH] next: cyapa: fix inop touchpad after

resume on Acer

Quoted 12 lines

C720

Dudley,

Quoted 2 lines · Dudley Du

More info: I did all testings based on kernel 3.14.0 on Acer C70.

I am testing with linux-next 3.18-rc6 on an Acer C720.

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/

Quoted 7 lines
Quoted 3 lines

Thanks,
Dudley

[]

--
- Jeremiah Mahler

From bb717b1c1525ef6b889f0ef735d920eed9e76e72 Mon Sep 17 00:00:00 2001
From: Dudley Du <[email protected]>
Date: Thu, 27 Nov 2014 13:35:09 +0800
Subject: [PATCH] input: cyapa: fix irq error issue in cyapa_resume
To: [email protected],
[email protected]
Cc: [email protected],
[email protected]

This patch is aimed to fix the irq error happened on cyapa_resume when doing suspend/resume testing.
The root cause of this issue is that the cyapa->irq has been removed but
still used in the driver.

---
drivers/input/mouse/cyapa.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)
drivers/input/mouse/cyapa.c +2 -2
index c84a9eb..caaba7b 100644
@@ -938,7 +938,7 @@ static int __maybe_unused cyapa_suspend(struct
 device *dev)
 power_mode, error);
 
 if (device_may_wakeup(dev))
-cyapa->irq_wake = (enable_irq_wake(cyapa->irq) == 0);
+cyapa->irq_wake = (enable_irq_wake(cyapa->client->irq) == 0);
 
 mutex_unlock(&input->mutex);
@@ -956,7 +956,7 @@ static int __maybe_unused cyapa_resume(struct
 device *dev)
 mutex_lock(&input->mutex);
 
 if (device_may_wakeup(dev) && cyapa->irq_wake)
-disable_irq_wake(cyapa->irq);
+disable_irq_wake(cyapa->client->irq);
 
 power_mode = input->users ? PWR_MODE_FULL_ACTIVE : PWR_MODE_OFF;

error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);

drivers/input/mouse/cyapa.c +1 -1
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct
 device *dev)
 dev_warn(dev, "resume: set power mode to %d failed: %d\n",
 power_mode, error);
 
-enable_irq(cyapa->irq);
+enable_irq(cyapa->client->irq);
 
Quoted 8 lines

drivers/input/mouse/cyapa.c static int __maybe_unused cyapa_resume(struct · line 970

Quoted 2 lines
drivers/input/mouse/cyapa.c +0 -0
 mutex_unlock(&input->mutex);

Hi Dudley,
Thanks.

--
Dmitry

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.

maintainer
#32 lore raw

Re: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Dudley,

Quoted 6 lines · Dudley Du

Dmitry,

Yes, I remebered the discussion, and I said it was working.
At that time, I though it was the suggestion to my patches, so I merged the solution to my pathces, and verified on my pathces. But did not run test on the patch you attached.
Sorry for the misunderstood and the troubles to you. :)

Sorry I was not clear in my request. Anyway, I just applied the patch (with a minor edit) and pushed it out. It shoudl make it's way into next today or tomorrow.

Thanks.

Quoted 121 lines

Regards,
Dudley

Quoted 107 lines

-----Original Message-----
From: Dmitry Torokhov [mailto:[email protected]]
Sent: 2014年11月28日 2:16
To: Dudley Du; 'Jeremiah Mahler'
Cc: [email protected]; Dudley Du
Subject: RE: [BUG] [PATCH] next: cyapa: fix inop touchpad after resume on Acer C720

Quoted 5 lines · Dudley Du

Jeremiah,

I didn't make the special patch for the linux-next before, so I don't know why
this patch is there and have issue.

That was the patch we've discussed some times back and you mentioned it was working for you so I applied it to next.

I'll make sure to apply the fixup promptly.

Quoted 86 lines

Based on current code in the linux-next, I made below patch to fix this issue.
Could you please try again with attached patch fix.

Thanks,
Dudley

Quoted 6 lines

-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2014?11?27? 4:03
To: Dudley Du
Cc: [email protected]
Subject: Re: [BUG] [PATCH] next: cyapa: fix inop touchpad after

resume on Acer

Quoted 12 lines

C720

Dudley,

Quoted 2 lines · Dudley Du

More info: I did all testings based on kernel 3.14.0 on Acer C70.

I am testing with linux-next 3.18-rc6 on an Acer C720.

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/

Quoted 7 lines
Quoted 3 lines

Thanks,
Dudley

[]

--
- Jeremiah Mahler

From bb717b1c1525ef6b889f0ef735d920eed9e76e72 Mon Sep 17 00:00:00 2001
From: Dudley Du <[email protected]>
Date: Thu, 27 Nov 2014 13:35:09 +0800
Subject: [PATCH] input: cyapa: fix irq error issue in cyapa_resume
To: [email protected],
[email protected]
Cc: [email protected],
[email protected]

This patch is aimed to fix the irq error happened on cyapa_resume when doing suspend/resume testing.
The root cause of this issue is that the cyapa->irq has been removed but
still used in the driver.

---
drivers/input/mouse/cyapa.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)
drivers/input/mouse/cyapa.c +2 -2
index c84a9eb..caaba7b 100644
@@ -938,7 +938,7 @@ static int __maybe_unused cyapa_suspend(struct
 device *dev)
 power_mode, error);
 
 if (device_may_wakeup(dev))
-cyapa->irq_wake = (enable_irq_wake(cyapa->irq) == 0);
+cyapa->irq_wake = (enable_irq_wake(cyapa->client->irq) == 0);
 
 mutex_unlock(&input->mutex);
@@ -956,7 +956,7 @@ static int __maybe_unused cyapa_resume(struct
 device *dev)
 mutex_lock(&input->mutex);
 
 if (device_may_wakeup(dev) && cyapa->irq_wake)
-disable_irq_wake(cyapa->irq);
+disable_irq_wake(cyapa->client->irq);
 
 power_mode = input->users ? PWR_MODE_FULL_ACTIVE : PWR_MODE_OFF;

error = cyapa_set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE);

drivers/input/mouse/cyapa.c +1 -1
@@ -964,7 +964,7 @@ static int __maybe_unused cyapa_resume(struct
 device *dev)
 dev_warn(dev, "resume: set power mode to %d failed: %d\n",
 power_mode, error);
 
-enable_irq(cyapa->irq);
+enable_irq(cyapa->client->irq);
 
Quoted 8 lines

drivers/input/mouse/cyapa.c static int __maybe_unused cyapa_resume(struct · line 970

Quoted 2 lines
drivers/input/mouse/cyapa.c +0 -0
 mutex_unlock(&input->mutex);

Hi Dudley,
Thanks.

--
Dmitry

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html