Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH v5 3/3] cap11xx: support for irq-active-high option
From: Matt Ranostay @ 2014-10-10  4:23 UTC (permalink / raw)
  To: dmitry.torokhov, galak, zonque; +Cc: linux-input, devicetree, Matt Ranostay
In-Reply-To: <1412914983-3742-1-git-send-email-mranostay@gmail.com>

Some applications need to use the irq-active-high push-pull option.
This allows it be enabled in the device tree child node.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
---
 Documentation/devicetree/bindings/input/cap11xx.txt | 4 ++++
 drivers/input/keyboard/cap11xx.c                    | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/cap11xx.txt b/Documentation/devicetree/bindings/input/cap11xx.txt
index 8031aa5..57407be 100644
--- a/Documentation/devicetree/bindings/input/cap11xx.txt
+++ b/Documentation/devicetree/bindings/input/cap11xx.txt
@@ -28,6 +28,10 @@ Optional properties:
 				Valid values are 1, 2, 4, and 8.
 				By default, a gain of 1 is set.
 
+	microchip,irq-active-high:	By default the interrupt pin is active low
+				open drain. This property allows using the active
+				high push-pull output.
+
 	linux,keycodes:		Specifies an array of numeric keycode values to
 				be used for the channels. If this property is
 				omitted, KEY_A, KEY_B, etc are used as
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index b605134..a75b8fc 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -45,6 +45,7 @@
 #define CAP11XX_REG_STANDBY_SENSITIVITY	0x42
 #define CAP11XX_REG_STANDBY_THRESH	0x43
 #define CAP11XX_REG_CONFIG2		0x44
+#define CAP11XX_REG_CONFIG2_ALT_POL	BIT(6)
 #define CAP11XX_REG_SENSOR_BASE_CNT(X)	(0x50 + (X))
 #define CAP11XX_REG_SENSOR_CALIB	(0xb1 + (X))
 #define CAP11XX_REG_SENSOR_CALIB_LSB1	0xb9
@@ -255,6 +256,13 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 			dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
 	}
 
+	if (of_property_read_bool(node, "microchip,irq-active-high")) {
+		error = regmap_update_bits(priv->regmap, CAP11XX_REG_CONFIG2,
+					   CAP11XX_REG_CONFIG2_ALT_POL, 0);
+		if (error)
+			return error;
+	}
+
 	/* Provide some useful defaults */
 	for (i = 0; i < priv->num_channels; i++)
 		priv->keycodes[i] = KEY_A + i;
-- 
1.9.1


^ permalink raw reply related

* [PATCH v5 2/3] cap11xx: Add support for various cap11xx devices
From: Matt Ranostay @ 2014-10-10  4:23 UTC (permalink / raw)
  To: dmitry.torokhov, galak, zonque; +Cc: linux-input, devicetree, Matt Ranostay
In-Reply-To: <1412914983-3742-1-git-send-email-mranostay@gmail.com>

Several other variants of the cap11xx device exists with a varying
number of capacitance detection channels. Add support for creating
the channels dynamically.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
---
 .../devicetree/bindings/input/cap11xx.txt          |  3 +-
 drivers/input/keyboard/cap11xx.c                   | 64 ++++++++++++++--------
 2 files changed, 44 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/cap11xx.txt b/Documentation/devicetree/bindings/input/cap11xx.txt
index 738f5f3..8031aa5 100644
--- a/Documentation/devicetree/bindings/input/cap11xx.txt
+++ b/Documentation/devicetree/bindings/input/cap11xx.txt
@@ -7,9 +7,10 @@ Required properties:
 
 	compatible:		Must be on the following, depending on the model:
 					"microchip,cap1106"
+					"microchip,cap1126"
+					"microchip,cap1188"
 
 	reg:			The I2C slave address of the device.
-				Only 0x28 is valid.
 
 	interrupts:		Property describing the interrupt line the
 				device's ALERT#/CM_IRQ# pin is connected to.
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index 0da2e83..b605134 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -1,7 +1,6 @@
 /*
  * Input driver for Microchip CAP11xx based capacitive touch sensors
  *
- *
  * (c) 2014 Daniel Mack <linux@zonque.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -54,8 +53,6 @@
 #define CAP11XX_REG_MANUFACTURER_ID	0xfe
 #define CAP11XX_REG_REVISION		0xff
 
-#define CAP11XX_NUM_CHN 6
-#define CAP11XX_PRODUCT_ID	0x55
 #define CAP11XX_MANUFACTURER_ID	0x5d
 
 struct cap11xx_priv {
@@ -63,7 +60,25 @@ struct cap11xx_priv {
 	struct input_dev *idev;
 
 	/* config */
-	unsigned short keycodes[CAP11XX_NUM_CHN];
+	unsigned int num_channels;
+	u32 keycodes[];
+};
+
+struct cap11xx_hw_model {
+	uint8_t product_id;
+	unsigned int num_channels;
+};
+
+enum {
+	CAP1106,
+	CAP1126,
+	CAP1188,
+};
+
+struct cap11xx_hw_model cap11xx_devices[] = {
+	[CAP1106] = { .product_id = 0x55, .num_channels = 6 },
+	[CAP1126] = { .product_id = 0x53, .num_channels = 6 },
+	[CAP1188] = { .product_id = 0x50, .num_channels = 8 },
 };
 
 static const struct reg_default cap11xx_reg_defaults[] = {
@@ -150,7 +165,7 @@ static irqreturn_t cap11xx_thread_func(int irq_num, void *data)
 	if (ret < 0)
 		goto out;
 
-	for (i = 0; i < CAP11XX_NUM_CHN; i++)
+	for (i = 0; i < priv->num_channels; i++)
 		input_report_key(priv->idev, priv->keycodes[i],
 				 status & (1 << i));
 
@@ -187,14 +202,20 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 	struct device *dev = &i2c_client->dev;
 	struct cap11xx_priv *priv;
 	struct device_node *node;
+	struct cap11xx_hw_model *cap = &cap11xx_devices[id->driver_data];
 	int i, error, irq, gain = 0;
 	unsigned int val, rev;
-	u32 gain32, keycodes[CAP11XX_NUM_CHN];
+	u32 gain32;
 
-	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	priv = devm_kzalloc(dev,
+		sizeof(*priv) + cap->num_channels * sizeof(u32),
+		GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
+	BUG_ON(!cap->num_channels);
+
+	priv->num_channels = cap->num_channels;
 	priv->regmap = devm_regmap_init_i2c(i2c_client, &cap11xx_regmap_config);
 	if (IS_ERR(priv->regmap))
 		return PTR_ERR(priv->regmap);
@@ -203,9 +224,9 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 	if (error)
 		return error;
 
-	if (val != CAP11XX_PRODUCT_ID) {
+	if (val != cap->product_id) {
 		dev_err(dev, "Product ID: Got 0x%02x, expected 0x%02x\n",
-			val, CAP11XX_PRODUCT_ID);
+			val, cap->product_id);
 		return -ENODEV;
 	}
 
@@ -234,17 +255,12 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 			dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
 	}
 
-	BUILD_BUG_ON(ARRAY_SIZE(keycodes) != ARRAY_SIZE(priv->keycodes));
-
 	/* Provide some useful defaults */
-	for (i = 0; i < ARRAY_SIZE(keycodes); i++)
-		keycodes[i] = KEY_A + i;
+	for (i = 0; i < priv->num_channels; i++)
+		priv->keycodes[i] = KEY_A + i;
 
 	of_property_read_u32_array(node, "linux,keycodes",
-				   keycodes, ARRAY_SIZE(keycodes));
-
-	for (i = 0; i < ARRAY_SIZE(keycodes); i++)
-		priv->keycodes[i] = keycodes[i];
+		priv->keycodes, priv->num_channels);
 
 	error = regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL,
 				   CAP11XX_REG_MAIN_CONTROL_GAIN_MASK,
@@ -268,17 +284,17 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 	if (of_property_read_bool(node, "autorepeat"))
 		__set_bit(EV_REP, priv->idev->evbit);
 
-	for (i = 0; i < CAP11XX_NUM_CHN; i++)
+	for (i = 0; i < priv->num_channels; i++)
 		__set_bit(priv->keycodes[i], priv->idev->keybit);
 
 	__clear_bit(KEY_RESERVED, priv->idev->keybit);
 
 	priv->idev->keycode = priv->keycodes;
-	priv->idev->keycodesize = sizeof(priv->keycodes[0]);
-	priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
+	priv->idev->keycodesize = sizeof(u32);
+	priv->idev->keycodemax = priv->num_channels;
 
 	priv->idev->id.vendor = CAP11XX_MANUFACTURER_ID;
-	priv->idev->id.product = CAP11XX_PRODUCT_ID;
+	priv->idev->id.product = cap->product_id;
 	priv->idev->id.version = rev;
 
 	priv->idev->open = cap11xx_input_open;
@@ -312,12 +328,16 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 
 static const struct of_device_id cap11xx_dt_ids[] = {
 	{ .compatible = "microchip,cap1106", },
+	{ .compatible = "microchip,cap1126", },
+	{ .compatible = "microchip,cap1188", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, cap11xx_dt_ids);
 
 static const struct i2c_device_id cap11xx_i2c_ids[] = {
-	{ "cap1106", 0 },
+	{ "cap1106", CAP1106 },
+	{ "cap1126", CAP1126 },
+	{ "cap1188", CAP1188 },
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids);
-- 
1.9.1


^ permalink raw reply related

* [PATCH v5 1/3] cap11xx: make driver generic for variant support
From: Matt Ranostay @ 2014-10-10  4:23 UTC (permalink / raw)
  To: dmitry.torokhov, galak, zonque; +Cc: linux-input, devicetree, Matt Ranostay
In-Reply-To: <1412914983-3742-1-git-send-email-mranostay@gmail.com>

cap1106 driver can support much more one device make the driver
generic for support of similiar parts.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
---
 .../bindings/input/{cap1106.txt => cap11xx.txt}    |   5 +-
 drivers/input/keyboard/Kconfig                     |   8 +-
 drivers/input/keyboard/Makefile                    |   2 +-
 drivers/input/keyboard/cap1106.c                   | 341 ---------------------
 drivers/input/keyboard/cap11xx.c                   | 340 ++++++++++++++++++++
 5 files changed, 348 insertions(+), 348 deletions(-)
 rename Documentation/devicetree/bindings/input/{cap1106.txt => cap11xx.txt} (89%)
 delete mode 100644 drivers/input/keyboard/cap1106.c
 create mode 100644 drivers/input/keyboard/cap11xx.c

diff --git a/Documentation/devicetree/bindings/input/cap1106.txt b/Documentation/devicetree/bindings/input/cap11xx.txt
similarity index 89%
rename from Documentation/devicetree/bindings/input/cap1106.txt
rename to Documentation/devicetree/bindings/input/cap11xx.txt
index 4b46390..738f5f3 100644
--- a/Documentation/devicetree/bindings/input/cap1106.txt
+++ b/Documentation/devicetree/bindings/input/cap11xx.txt
@@ -1,11 +1,12 @@
-Device tree bindings for Microchip CAP1106, 6 channel capacitive touch sensor
+Device tree bindings for Microchip CAP1106 based capacitive touch sensor
 
 The node for this driver must be a child of a I2C controller node, as the
 device communication via I2C only.
 
 Required properties:
 
-	compatible:		Must be "microchip,cap1106"
+	compatible:		Must be on the following, depending on the model:
+					"microchip,cap1106"
 
 	reg:			The I2C slave address of the device.
 				Only 0x28 is valid.
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index a3958c6..96ee26c 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -665,14 +665,14 @@ config KEYBOARD_CROS_EC
 	  To compile this driver as a module, choose M here: the
 	  module will be called cros_ec_keyb.
 
-config KEYBOARD_CAP1106
-	tristate "Microchip CAP1106 touch sensor"
+config KEYBOARD_CAP11XX
+	tristate "Microchip CAP11XX based touch sensors"
 	depends on OF && I2C
 	select REGMAP_I2C
 	help
-	  Say Y here to enable the CAP1106 touch sensor driver.
+	  Say Y here to enable the CAP11XX touch sensor driver.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called cap1106.
+	  module will be called cap11xx.
 
 endif
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 0a33456..febafa5 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA)		+= amikbd.o
 obj-$(CONFIG_KEYBOARD_ATARI)		+= atakbd.o
 obj-$(CONFIG_KEYBOARD_ATKBD)		+= atkbd.o
 obj-$(CONFIG_KEYBOARD_BFIN)		+= bf54x-keys.o
-obj-$(CONFIG_KEYBOARD_CAP1106)		+= cap1106.o
+obj-$(CONFIG_KEYBOARD_CAP11XX)		+= cap11xx.o
 obj-$(CONFIG_KEYBOARD_CLPS711X)		+= clps711x-keypad.o
 obj-$(CONFIG_KEYBOARD_CROS_EC)		+= cros_ec_keyb.o
 obj-$(CONFIG_KEYBOARD_DAVINCI)		+= davinci_keyscan.o
diff --git a/drivers/input/keyboard/cap1106.c b/drivers/input/keyboard/cap1106.c
deleted file mode 100644
index d70b65a..0000000
--- a/drivers/input/keyboard/cap1106.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Input driver for Microchip CAP1106, 6 channel capacitive touch sensor
- *
- * http://www.microchip.com/wwwproducts/Devices.aspx?product=CAP1106
- *
- * (c) 2014 Daniel Mack <linux@zonque.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/input.h>
-#include <linux/of_irq.h>
-#include <linux/regmap.h>
-#include <linux/i2c.h>
-#include <linux/gpio/consumer.h>
-
-#define CAP1106_REG_MAIN_CONTROL	0x00
-#define CAP1106_REG_MAIN_CONTROL_GAIN_SHIFT	(6)
-#define CAP1106_REG_MAIN_CONTROL_GAIN_MASK	(0xc0)
-#define CAP1106_REG_MAIN_CONTROL_DLSEEP		BIT(4)
-#define CAP1106_REG_GENERAL_STATUS	0x02
-#define CAP1106_REG_SENSOR_INPUT	0x03
-#define CAP1106_REG_NOISE_FLAG_STATUS	0x0a
-#define CAP1106_REG_SENOR_DELTA(X)	(0x10 + (X))
-#define CAP1106_REG_SENSITIVITY_CONTROL	0x1f
-#define CAP1106_REG_CONFIG		0x20
-#define CAP1106_REG_SENSOR_ENABLE	0x21
-#define CAP1106_REG_SENSOR_CONFIG	0x22
-#define CAP1106_REG_SENSOR_CONFIG2	0x23
-#define CAP1106_REG_SAMPLING_CONFIG	0x24
-#define CAP1106_REG_CALIBRATION		0x26
-#define CAP1106_REG_INT_ENABLE		0x27
-#define CAP1106_REG_REPEAT_RATE		0x28
-#define CAP1106_REG_MT_CONFIG		0x2a
-#define CAP1106_REG_MT_PATTERN_CONFIG	0x2b
-#define CAP1106_REG_MT_PATTERN		0x2d
-#define CAP1106_REG_RECALIB_CONFIG	0x2f
-#define CAP1106_REG_SENSOR_THRESH(X)	(0x30 + (X))
-#define CAP1106_REG_SENSOR_NOISE_THRESH	0x38
-#define CAP1106_REG_STANDBY_CHANNEL	0x40
-#define CAP1106_REG_STANDBY_CONFIG	0x41
-#define CAP1106_REG_STANDBY_SENSITIVITY	0x42
-#define CAP1106_REG_STANDBY_THRESH	0x43
-#define CAP1106_REG_CONFIG2		0x44
-#define CAP1106_REG_SENSOR_BASE_CNT(X)	(0x50 + (X))
-#define CAP1106_REG_SENSOR_CALIB	(0xb1 + (X))
-#define CAP1106_REG_SENSOR_CALIB_LSB1	0xb9
-#define CAP1106_REG_SENSOR_CALIB_LSB2	0xba
-#define CAP1106_REG_PRODUCT_ID		0xfd
-#define CAP1106_REG_MANUFACTURER_ID	0xfe
-#define CAP1106_REG_REVISION		0xff
-
-#define CAP1106_NUM_CHN 6
-#define CAP1106_PRODUCT_ID	0x55
-#define CAP1106_MANUFACTURER_ID	0x5d
-
-struct cap1106_priv {
-	struct regmap *regmap;
-	struct input_dev *idev;
-
-	/* config */
-	unsigned short keycodes[CAP1106_NUM_CHN];
-};
-
-static const struct reg_default cap1106_reg_defaults[] = {
-	{ CAP1106_REG_MAIN_CONTROL,		0x00 },
-	{ CAP1106_REG_GENERAL_STATUS,		0x00 },
-	{ CAP1106_REG_SENSOR_INPUT,		0x00 },
-	{ CAP1106_REG_NOISE_FLAG_STATUS,	0x00 },
-	{ CAP1106_REG_SENSITIVITY_CONTROL,	0x2f },
-	{ CAP1106_REG_CONFIG,			0x20 },
-	{ CAP1106_REG_SENSOR_ENABLE,		0x3f },
-	{ CAP1106_REG_SENSOR_CONFIG,		0xa4 },
-	{ CAP1106_REG_SENSOR_CONFIG2,		0x07 },
-	{ CAP1106_REG_SAMPLING_CONFIG,		0x39 },
-	{ CAP1106_REG_CALIBRATION,		0x00 },
-	{ CAP1106_REG_INT_ENABLE,		0x3f },
-	{ CAP1106_REG_REPEAT_RATE,		0x3f },
-	{ CAP1106_REG_MT_CONFIG,		0x80 },
-	{ CAP1106_REG_MT_PATTERN_CONFIG,	0x00 },
-	{ CAP1106_REG_MT_PATTERN,		0x3f },
-	{ CAP1106_REG_RECALIB_CONFIG,		0x8a },
-	{ CAP1106_REG_SENSOR_THRESH(0),		0x40 },
-	{ CAP1106_REG_SENSOR_THRESH(1),		0x40 },
-	{ CAP1106_REG_SENSOR_THRESH(2),		0x40 },
-	{ CAP1106_REG_SENSOR_THRESH(3),		0x40 },
-	{ CAP1106_REG_SENSOR_THRESH(4),		0x40 },
-	{ CAP1106_REG_SENSOR_THRESH(5),		0x40 },
-	{ CAP1106_REG_SENSOR_NOISE_THRESH,	0x01 },
-	{ CAP1106_REG_STANDBY_CHANNEL,		0x00 },
-	{ CAP1106_REG_STANDBY_CONFIG,		0x39 },
-	{ CAP1106_REG_STANDBY_SENSITIVITY,	0x02 },
-	{ CAP1106_REG_STANDBY_THRESH,		0x40 },
-	{ CAP1106_REG_CONFIG2,			0x40 },
-	{ CAP1106_REG_SENSOR_CALIB_LSB1,	0x00 },
-	{ CAP1106_REG_SENSOR_CALIB_LSB2,	0x00 },
-};
-
-static bool cap1106_volatile_reg(struct device *dev, unsigned int reg)
-{
-	switch (reg) {
-	case CAP1106_REG_MAIN_CONTROL:
-	case CAP1106_REG_SENSOR_INPUT:
-	case CAP1106_REG_SENOR_DELTA(0):
-	case CAP1106_REG_SENOR_DELTA(1):
-	case CAP1106_REG_SENOR_DELTA(2):
-	case CAP1106_REG_SENOR_DELTA(3):
-	case CAP1106_REG_SENOR_DELTA(4):
-	case CAP1106_REG_SENOR_DELTA(5):
-	case CAP1106_REG_PRODUCT_ID:
-	case CAP1106_REG_MANUFACTURER_ID:
-	case CAP1106_REG_REVISION:
-		return true;
-	}
-
-	return false;
-}
-
-static const struct regmap_config cap1106_regmap_config = {
-	.reg_bits = 8,
-	.val_bits = 8,
-
-	.max_register = CAP1106_REG_REVISION,
-	.reg_defaults = cap1106_reg_defaults,
-
-	.num_reg_defaults = ARRAY_SIZE(cap1106_reg_defaults),
-	.cache_type = REGCACHE_RBTREE,
-	.volatile_reg = cap1106_volatile_reg,
-};
-
-static irqreturn_t cap1106_thread_func(int irq_num, void *data)
-{
-	struct cap1106_priv *priv = data;
-	unsigned int status;
-	int ret, i;
-
-	/*
-	 * Deassert interrupt. This needs to be done before reading the status
-	 * registers, which will not carry valid values otherwise.
-	 */
-	ret = regmap_update_bits(priv->regmap, CAP1106_REG_MAIN_CONTROL, 1, 0);
-	if (ret < 0)
-		goto out;
-
-	ret = regmap_read(priv->regmap, CAP1106_REG_SENSOR_INPUT, &status);
-	if (ret < 0)
-		goto out;
-
-	for (i = 0; i < CAP1106_NUM_CHN; i++)
-		input_report_key(priv->idev, priv->keycodes[i],
-				 status & (1 << i));
-
-	input_sync(priv->idev);
-
-out:
-	return IRQ_HANDLED;
-}
-
-static int cap1106_set_sleep(struct cap1106_priv *priv, bool sleep)
-{
-	return regmap_update_bits(priv->regmap, CAP1106_REG_MAIN_CONTROL,
-				  CAP1106_REG_MAIN_CONTROL_DLSEEP,
-				  sleep ? CAP1106_REG_MAIN_CONTROL_DLSEEP : 0);
-}
-
-static int cap1106_input_open(struct input_dev *idev)
-{
-	struct cap1106_priv *priv = input_get_drvdata(idev);
-
-	return cap1106_set_sleep(priv, false);
-}
-
-static void cap1106_input_close(struct input_dev *idev)
-{
-	struct cap1106_priv *priv = input_get_drvdata(idev);
-
-	cap1106_set_sleep(priv, true);
-}
-
-static int cap1106_i2c_probe(struct i2c_client *i2c_client,
-			     const struct i2c_device_id *id)
-{
-	struct device *dev = &i2c_client->dev;
-	struct cap1106_priv *priv;
-	struct device_node *node;
-	int i, error, irq, gain = 0;
-	unsigned int val, rev;
-	u32 gain32, keycodes[CAP1106_NUM_CHN];
-
-	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv)
-		return -ENOMEM;
-
-	priv->regmap = devm_regmap_init_i2c(i2c_client, &cap1106_regmap_config);
-	if (IS_ERR(priv->regmap))
-		return PTR_ERR(priv->regmap);
-
-	error = regmap_read(priv->regmap, CAP1106_REG_PRODUCT_ID, &val);
-	if (error)
-		return error;
-
-	if (val != CAP1106_PRODUCT_ID) {
-		dev_err(dev, "Product ID: Got 0x%02x, expected 0x%02x\n",
-			val, CAP1106_PRODUCT_ID);
-		return -ENODEV;
-	}
-
-	error = regmap_read(priv->regmap, CAP1106_REG_MANUFACTURER_ID, &val);
-	if (error)
-		return error;
-
-	if (val != CAP1106_MANUFACTURER_ID) {
-		dev_err(dev, "Manufacturer ID: Got 0x%02x, expected 0x%02x\n",
-			val, CAP1106_MANUFACTURER_ID);
-		return -ENODEV;
-	}
-
-	error = regmap_read(priv->regmap, CAP1106_REG_REVISION, &rev);
-	if (error < 0)
-		return error;
-
-	dev_info(dev, "CAP1106 detected, revision 0x%02x\n", rev);
-	i2c_set_clientdata(i2c_client, priv);
-	node = dev->of_node;
-
-	if (!of_property_read_u32(node, "microchip,sensor-gain", &gain32)) {
-		if (is_power_of_2(gain32) && gain32 <= 8)
-			gain = ilog2(gain32);
-		else
-			dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
-	}
-
-	BUILD_BUG_ON(ARRAY_SIZE(keycodes) != ARRAY_SIZE(priv->keycodes));
-
-	/* Provide some useful defaults */
-	for (i = 0; i < ARRAY_SIZE(keycodes); i++)
-		keycodes[i] = KEY_A + i;
-
-	of_property_read_u32_array(node, "linux,keycodes",
-				   keycodes, ARRAY_SIZE(keycodes));
-
-	for (i = 0; i < ARRAY_SIZE(keycodes); i++)
-		priv->keycodes[i] = keycodes[i];
-
-	error = regmap_update_bits(priv->regmap, CAP1106_REG_MAIN_CONTROL,
-				   CAP1106_REG_MAIN_CONTROL_GAIN_MASK,
-				   gain << CAP1106_REG_MAIN_CONTROL_GAIN_SHIFT);
-	if (error)
-		return error;
-
-	/* Disable autorepeat. The Linux input system has its own handling. */
-	error = regmap_write(priv->regmap, CAP1106_REG_REPEAT_RATE, 0);
-	if (error)
-		return error;
-
-	priv->idev = devm_input_allocate_device(dev);
-	if (!priv->idev)
-		return -ENOMEM;
-
-	priv->idev->name = "CAP1106 capacitive touch sensor";
-	priv->idev->id.bustype = BUS_I2C;
-	priv->idev->evbit[0] = BIT_MASK(EV_KEY);
-
-	if (of_property_read_bool(node, "autorepeat"))
-		__set_bit(EV_REP, priv->idev->evbit);
-
-	for (i = 0; i < CAP1106_NUM_CHN; i++)
-		__set_bit(priv->keycodes[i], priv->idev->keybit);
-
-	__clear_bit(KEY_RESERVED, priv->idev->keybit);
-
-	priv->idev->keycode = priv->keycodes;
-	priv->idev->keycodesize = sizeof(priv->keycodes[0]);
-	priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
-
-	priv->idev->id.vendor = CAP1106_MANUFACTURER_ID;
-	priv->idev->id.product = CAP1106_PRODUCT_ID;
-	priv->idev->id.version = rev;
-
-	priv->idev->open = cap1106_input_open;
-	priv->idev->close = cap1106_input_close;
-
-	input_set_drvdata(priv->idev, priv);
-
-	/*
-	 * Put the device in deep sleep mode for now.
-	 * ->open() will bring it back once the it is actually needed.
-	 */
-	cap1106_set_sleep(priv, true);
-
-	error = input_register_device(priv->idev);
-	if (error)
-		return error;
-
-	irq = irq_of_parse_and_map(node, 0);
-	if (!irq) {
-		dev_err(dev, "Unable to parse or map IRQ\n");
-		return -ENXIO;
-	}
-
-	error = devm_request_threaded_irq(dev, irq, NULL, cap1106_thread_func,
-					  IRQF_ONESHOT, dev_name(dev), priv);
-	if (error)
-		return error;
-
-	return 0;
-}
-
-static const struct of_device_id cap1106_dt_ids[] = {
-	{ .compatible = "microchip,cap1106", },
-	{}
-};
-MODULE_DEVICE_TABLE(of, cap1106_dt_ids);
-
-static const struct i2c_device_id cap1106_i2c_ids[] = {
-	{ "cap1106", 0 },
-	{}
-};
-MODULE_DEVICE_TABLE(i2c, cap1106_i2c_ids);
-
-static struct i2c_driver cap1106_i2c_driver = {
-	.driver = {
-		.name	= "cap1106",
-		.owner	= THIS_MODULE,
-		.of_match_table = cap1106_dt_ids,
-	},
-	.id_table	= cap1106_i2c_ids,
-	.probe		= cap1106_i2c_probe,
-};
-
-module_i2c_driver(cap1106_i2c_driver);
-
-MODULE_ALIAS("platform:cap1106");
-MODULE_DESCRIPTION("Microchip CAP1106 driver");
-MODULE_AUTHOR("Daniel Mack <linux@zonque.org>");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
new file mode 100644
index 0000000..0da2e83
--- /dev/null
+++ b/drivers/input/keyboard/cap11xx.c
@@ -0,0 +1,340 @@
+/*
+ * Input driver for Microchip CAP11xx based capacitive touch sensors
+ *
+ *
+ * (c) 2014 Daniel Mack <linux@zonque.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/input.h>
+#include <linux/of_irq.h>
+#include <linux/regmap.h>
+#include <linux/i2c.h>
+#include <linux/gpio/consumer.h>
+
+#define CAP11XX_REG_MAIN_CONTROL	0x00
+#define CAP11XX_REG_MAIN_CONTROL_GAIN_SHIFT	(6)
+#define CAP11XX_REG_MAIN_CONTROL_GAIN_MASK	(0xc0)
+#define CAP11XX_REG_MAIN_CONTROL_DLSEEP		BIT(4)
+#define CAP11XX_REG_GENERAL_STATUS	0x02
+#define CAP11XX_REG_SENSOR_INPUT	0x03
+#define CAP11XX_REG_NOISE_FLAG_STATUS	0x0a
+#define CAP11XX_REG_SENOR_DELTA(X)	(0x10 + (X))
+#define CAP11XX_REG_SENSITIVITY_CONTROL	0x1f
+#define CAP11XX_REG_CONFIG		0x20
+#define CAP11XX_REG_SENSOR_ENABLE	0x21
+#define CAP11XX_REG_SENSOR_CONFIG	0x22
+#define CAP11XX_REG_SENSOR_CONFIG2	0x23
+#define CAP11XX_REG_SAMPLING_CONFIG	0x24
+#define CAP11XX_REG_CALIBRATION		0x26
+#define CAP11XX_REG_INT_ENABLE		0x27
+#define CAP11XX_REG_REPEAT_RATE		0x28
+#define CAP11XX_REG_MT_CONFIG		0x2a
+#define CAP11XX_REG_MT_PATTERN_CONFIG	0x2b
+#define CAP11XX_REG_MT_PATTERN		0x2d
+#define CAP11XX_REG_RECALIB_CONFIG	0x2f
+#define CAP11XX_REG_SENSOR_THRESH(X)	(0x30 + (X))
+#define CAP11XX_REG_SENSOR_NOISE_THRESH	0x38
+#define CAP11XX_REG_STANDBY_CHANNEL	0x40
+#define CAP11XX_REG_STANDBY_CONFIG	0x41
+#define CAP11XX_REG_STANDBY_SENSITIVITY	0x42
+#define CAP11XX_REG_STANDBY_THRESH	0x43
+#define CAP11XX_REG_CONFIG2		0x44
+#define CAP11XX_REG_SENSOR_BASE_CNT(X)	(0x50 + (X))
+#define CAP11XX_REG_SENSOR_CALIB	(0xb1 + (X))
+#define CAP11XX_REG_SENSOR_CALIB_LSB1	0xb9
+#define CAP11XX_REG_SENSOR_CALIB_LSB2	0xba
+#define CAP11XX_REG_PRODUCT_ID		0xfd
+#define CAP11XX_REG_MANUFACTURER_ID	0xfe
+#define CAP11XX_REG_REVISION		0xff
+
+#define CAP11XX_NUM_CHN 6
+#define CAP11XX_PRODUCT_ID	0x55
+#define CAP11XX_MANUFACTURER_ID	0x5d
+
+struct cap11xx_priv {
+	struct regmap *regmap;
+	struct input_dev *idev;
+
+	/* config */
+	unsigned short keycodes[CAP11XX_NUM_CHN];
+};
+
+static const struct reg_default cap11xx_reg_defaults[] = {
+	{ CAP11XX_REG_MAIN_CONTROL,		0x00 },
+	{ CAP11XX_REG_GENERAL_STATUS,		0x00 },
+	{ CAP11XX_REG_SENSOR_INPUT,		0x00 },
+	{ CAP11XX_REG_NOISE_FLAG_STATUS,	0x00 },
+	{ CAP11XX_REG_SENSITIVITY_CONTROL,	0x2f },
+	{ CAP11XX_REG_CONFIG,			0x20 },
+	{ CAP11XX_REG_SENSOR_ENABLE,		0x3f },
+	{ CAP11XX_REG_SENSOR_CONFIG,		0xa4 },
+	{ CAP11XX_REG_SENSOR_CONFIG2,		0x07 },
+	{ CAP11XX_REG_SAMPLING_CONFIG,		0x39 },
+	{ CAP11XX_REG_CALIBRATION,		0x00 },
+	{ CAP11XX_REG_INT_ENABLE,		0x3f },
+	{ CAP11XX_REG_REPEAT_RATE,		0x3f },
+	{ CAP11XX_REG_MT_CONFIG,		0x80 },
+	{ CAP11XX_REG_MT_PATTERN_CONFIG,	0x00 },
+	{ CAP11XX_REG_MT_PATTERN,		0x3f },
+	{ CAP11XX_REG_RECALIB_CONFIG,		0x8a },
+	{ CAP11XX_REG_SENSOR_THRESH(0),		0x40 },
+	{ CAP11XX_REG_SENSOR_THRESH(1),		0x40 },
+	{ CAP11XX_REG_SENSOR_THRESH(2),		0x40 },
+	{ CAP11XX_REG_SENSOR_THRESH(3),		0x40 },
+	{ CAP11XX_REG_SENSOR_THRESH(4),		0x40 },
+	{ CAP11XX_REG_SENSOR_THRESH(5),		0x40 },
+	{ CAP11XX_REG_SENSOR_NOISE_THRESH,	0x01 },
+	{ CAP11XX_REG_STANDBY_CHANNEL,		0x00 },
+	{ CAP11XX_REG_STANDBY_CONFIG,		0x39 },
+	{ CAP11XX_REG_STANDBY_SENSITIVITY,	0x02 },
+	{ CAP11XX_REG_STANDBY_THRESH,		0x40 },
+	{ CAP11XX_REG_CONFIG2,			0x40 },
+	{ CAP11XX_REG_SENSOR_CALIB_LSB1,	0x00 },
+	{ CAP11XX_REG_SENSOR_CALIB_LSB2,	0x00 },
+};
+
+static bool cap11xx_volatile_reg(struct device *dev, unsigned int reg)
+{
+	switch (reg) {
+	case CAP11XX_REG_MAIN_CONTROL:
+	case CAP11XX_REG_SENSOR_INPUT:
+	case CAP11XX_REG_SENOR_DELTA(0):
+	case CAP11XX_REG_SENOR_DELTA(1):
+	case CAP11XX_REG_SENOR_DELTA(2):
+	case CAP11XX_REG_SENOR_DELTA(3):
+	case CAP11XX_REG_SENOR_DELTA(4):
+	case CAP11XX_REG_SENOR_DELTA(5):
+	case CAP11XX_REG_PRODUCT_ID:
+	case CAP11XX_REG_MANUFACTURER_ID:
+	case CAP11XX_REG_REVISION:
+		return true;
+	}
+
+	return false;
+}
+
+static const struct regmap_config cap11xx_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+
+	.max_register = CAP11XX_REG_REVISION,
+	.reg_defaults = cap11xx_reg_defaults,
+
+	.num_reg_defaults = ARRAY_SIZE(cap11xx_reg_defaults),
+	.cache_type = REGCACHE_RBTREE,
+	.volatile_reg = cap11xx_volatile_reg,
+};
+
+static irqreturn_t cap11xx_thread_func(int irq_num, void *data)
+{
+	struct cap11xx_priv *priv = data;
+	unsigned int status;
+	int ret, i;
+
+	/*
+	 * Deassert interrupt. This needs to be done before reading the status
+	 * registers, which will not carry valid values otherwise.
+	 */
+	ret = regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL, 1, 0);
+	if (ret < 0)
+		goto out;
+
+	ret = regmap_read(priv->regmap, CAP11XX_REG_SENSOR_INPUT, &status);
+	if (ret < 0)
+		goto out;
+
+	for (i = 0; i < CAP11XX_NUM_CHN; i++)
+		input_report_key(priv->idev, priv->keycodes[i],
+				 status & (1 << i));
+
+	input_sync(priv->idev);
+
+out:
+	return IRQ_HANDLED;
+}
+
+static int cap11xx_set_sleep(struct cap11xx_priv *priv, bool sleep)
+{
+	return regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL,
+				  CAP11XX_REG_MAIN_CONTROL_DLSEEP,
+				  sleep ? CAP11XX_REG_MAIN_CONTROL_DLSEEP : 0);
+}
+
+static int cap11xx_input_open(struct input_dev *idev)
+{
+	struct cap11xx_priv *priv = input_get_drvdata(idev);
+
+	return cap11xx_set_sleep(priv, false);
+}
+
+static void cap11xx_input_close(struct input_dev *idev)
+{
+	struct cap11xx_priv *priv = input_get_drvdata(idev);
+
+	cap11xx_set_sleep(priv, true);
+}
+
+static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
+			     const struct i2c_device_id *id)
+{
+	struct device *dev = &i2c_client->dev;
+	struct cap11xx_priv *priv;
+	struct device_node *node;
+	int i, error, irq, gain = 0;
+	unsigned int val, rev;
+	u32 gain32, keycodes[CAP11XX_NUM_CHN];
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->regmap = devm_regmap_init_i2c(i2c_client, &cap11xx_regmap_config);
+	if (IS_ERR(priv->regmap))
+		return PTR_ERR(priv->regmap);
+
+	error = regmap_read(priv->regmap, CAP11XX_REG_PRODUCT_ID, &val);
+	if (error)
+		return error;
+
+	if (val != CAP11XX_PRODUCT_ID) {
+		dev_err(dev, "Product ID: Got 0x%02x, expected 0x%02x\n",
+			val, CAP11XX_PRODUCT_ID);
+		return -ENODEV;
+	}
+
+	error = regmap_read(priv->regmap, CAP11XX_REG_MANUFACTURER_ID, &val);
+	if (error)
+		return error;
+
+	if (val != CAP11XX_MANUFACTURER_ID) {
+		dev_err(dev, "Manufacturer ID: Got 0x%02x, expected 0x%02x\n",
+			val, CAP11XX_MANUFACTURER_ID);
+		return -ENODEV;
+	}
+
+	error = regmap_read(priv->regmap, CAP11XX_REG_REVISION, &rev);
+	if (error < 0)
+		return error;
+
+	dev_info(dev, "CAP11XX detected, revision 0x%02x\n", rev);
+	i2c_set_clientdata(i2c_client, priv);
+	node = dev->of_node;
+
+	if (!of_property_read_u32(node, "microchip,sensor-gain", &gain32)) {
+		if (is_power_of_2(gain32) && gain32 <= 8)
+			gain = ilog2(gain32);
+		else
+			dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
+	}
+
+	BUILD_BUG_ON(ARRAY_SIZE(keycodes) != ARRAY_SIZE(priv->keycodes));
+
+	/* Provide some useful defaults */
+	for (i = 0; i < ARRAY_SIZE(keycodes); i++)
+		keycodes[i] = KEY_A + i;
+
+	of_property_read_u32_array(node, "linux,keycodes",
+				   keycodes, ARRAY_SIZE(keycodes));
+
+	for (i = 0; i < ARRAY_SIZE(keycodes); i++)
+		priv->keycodes[i] = keycodes[i];
+
+	error = regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL,
+				   CAP11XX_REG_MAIN_CONTROL_GAIN_MASK,
+				   gain << CAP11XX_REG_MAIN_CONTROL_GAIN_SHIFT);
+	if (error)
+		return error;
+
+	/* Disable autorepeat. The Linux input system has its own handling. */
+	error = regmap_write(priv->regmap, CAP11XX_REG_REPEAT_RATE, 0);
+	if (error)
+		return error;
+
+	priv->idev = devm_input_allocate_device(dev);
+	if (!priv->idev)
+		return -ENOMEM;
+
+	priv->idev->name = "CAP11XX capacitive touch sensor";
+	priv->idev->id.bustype = BUS_I2C;
+	priv->idev->evbit[0] = BIT_MASK(EV_KEY);
+
+	if (of_property_read_bool(node, "autorepeat"))
+		__set_bit(EV_REP, priv->idev->evbit);
+
+	for (i = 0; i < CAP11XX_NUM_CHN; i++)
+		__set_bit(priv->keycodes[i], priv->idev->keybit);
+
+	__clear_bit(KEY_RESERVED, priv->idev->keybit);
+
+	priv->idev->keycode = priv->keycodes;
+	priv->idev->keycodesize = sizeof(priv->keycodes[0]);
+	priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
+
+	priv->idev->id.vendor = CAP11XX_MANUFACTURER_ID;
+	priv->idev->id.product = CAP11XX_PRODUCT_ID;
+	priv->idev->id.version = rev;
+
+	priv->idev->open = cap11xx_input_open;
+	priv->idev->close = cap11xx_input_close;
+
+	input_set_drvdata(priv->idev, priv);
+
+	/*
+	 * Put the device in deep sleep mode for now.
+	 * ->open() will bring it back once the it is actually needed.
+	 */
+	cap11xx_set_sleep(priv, true);
+
+	error = input_register_device(priv->idev);
+	if (error)
+		return error;
+
+	irq = irq_of_parse_and_map(node, 0);
+	if (!irq) {
+		dev_err(dev, "Unable to parse or map IRQ\n");
+		return -ENXIO;
+	}
+
+	error = devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func,
+					  IRQF_ONESHOT, dev_name(dev), priv);
+	if (error)
+		return error;
+
+	return 0;
+}
+
+static const struct of_device_id cap11xx_dt_ids[] = {
+	{ .compatible = "microchip,cap1106", },
+	{}
+};
+MODULE_DEVICE_TABLE(of, cap11xx_dt_ids);
+
+static const struct i2c_device_id cap11xx_i2c_ids[] = {
+	{ "cap1106", 0 },
+	{}
+};
+MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids);
+
+static struct i2c_driver cap11xx_i2c_driver = {
+	.driver = {
+		.name	= "cap11xx",
+		.owner	= THIS_MODULE,
+		.of_match_table = cap11xx_dt_ids,
+	},
+	.id_table	= cap11xx_i2c_ids,
+	.probe		= cap11xx_i2c_probe,
+};
+
+module_i2c_driver(cap11xx_i2c_driver);
+
+MODULE_ALIAS("platform:cap11xx");
+MODULE_DESCRIPTION("Microchip CAP11XX driver");
+MODULE_AUTHOR("Daniel Mack <linux@zonque.org>");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1


^ permalink raw reply related

* [PATCH v5 0/3] cap1106: add support for cap11xx variants
From: Matt Ranostay @ 2014-10-10  4:23 UTC (permalink / raw)
  To: dmitry.torokhov, galak, zonque; +Cc: linux-input, devicetree, Matt Ranostay

Changes from v4:

 * Only allocate private structure and keycodes memory once 

Matt Ranostay (3):
  cap11xx: make driver generic for variant support
  cap11xx: Add support for various cap11xx devices
  cap11xx: support for irq-active-high option

 .../bindings/input/{cap1106.txt => cap11xx.txt}    |  12 +-
 drivers/input/keyboard/Kconfig                     |   8 +-
 drivers/input/keyboard/Makefile                    |   2 +-
 drivers/input/keyboard/cap1106.c                   | 341 -------------------
 drivers/input/keyboard/cap11xx.c                   | 368 +++++++++++++++++++++
 5 files changed, 382 insertions(+), 349 deletions(-)
 rename Documentation/devicetree/bindings/input/{cap1106.txt => cap11xx.txt} (78%)
 delete mode 100644 drivers/input/keyboard/cap1106.c
 create mode 100644 drivers/input/keyboard/cap11xx.c

-- 
1.9.1


^ permalink raw reply

* Re: [PATCH v4 2/3] cap11xx: Add support for various cap11xx devices
From: Matt Ranostay @ 2014-10-10  3:54 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Kumar Gala, Daniel Mack, linux-input,
	linux-kernel@vger.kernel.org, Rob Herring,
	devicetree@vger.kernel.org
In-Reply-To: <20141008000956.GN16469@dtor-ws>

Oh good catch! Will resubmitted with v5.

On Tue, Oct 7, 2014 at 5:09 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Hi Matt,
>
> On Mon, Sep 29, 2014 at 09:26:28PM -0700, Matt Ranostay wrote:
>> +     priv->num_channels = cap->num_channels;
>> +     priv->keycodes = devm_kcalloc(dev,
>> +             priv->num_channels, sizeof(u32), GFP_KERNEL);
>> +     if (!priv->keycodes)
>> +             return -ENOMEM;
>
> Instead of allocating keymap separately can we do something like below?
>
> Thanks.
>
> --
> Dmitry
>
>
> Input: cap11xx - add support for various cap11xx devices
>
> From: Matt Ranostay <mranostay@gmail.com>
>
> Several other variants of the cap11xx device exists with a varying
> number of capacitance detection channels. Add support for creating
> the channels dynamically.
>
> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
> Reviewed-by: Daniel Mack <daniel@zonque.org>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  .../devicetree/bindings/input/cap11xx.txt          |    3 +
>  drivers/input/keyboard/cap11xx.c                   |   62 +++++++++++++-------
>  2 files changed, 42 insertions(+), 23 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/input/cap11xx.txt b/Documentation/devicetree/bindings/input/cap11xx.txt
> index 738f5f3..8031aa5 100644
> --- a/Documentation/devicetree/bindings/input/cap11xx.txt
> +++ b/Documentation/devicetree/bindings/input/cap11xx.txt
> @@ -7,9 +7,10 @@ Required properties:
>
>         compatible:             Must be on the following, depending on the model:
>                                         "microchip,cap1106"
> +                                       "microchip,cap1126"
> +                                       "microchip,cap1188"
>
>         reg:                    The I2C slave address of the device.
> -                               Only 0x28 is valid.
>
>         interrupts:             Property describing the interrupt line the
>                                 device's ALERT#/CM_IRQ# pin is connected to.
> diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
> index 0da2e83..87fa209 100644
> --- a/drivers/input/keyboard/cap11xx.c
> +++ b/drivers/input/keyboard/cap11xx.c
> @@ -1,7 +1,6 @@
>  /*
>   * Input driver for Microchip CAP11xx based capacitive touch sensors
>   *
> - *
>   * (c) 2014 Daniel Mack <linux@zonque.org>
>   *
>   * This program is free software; you can redistribute it and/or modify
> @@ -54,8 +53,6 @@
>  #define CAP11XX_REG_MANUFACTURER_ID    0xfe
>  #define CAP11XX_REG_REVISION           0xff
>
> -#define CAP11XX_NUM_CHN 6
> -#define CAP11XX_PRODUCT_ID     0x55
>  #define CAP11XX_MANUFACTURER_ID        0x5d
>
>  struct cap11xx_priv {
> @@ -63,7 +60,24 @@ struct cap11xx_priv {
>         struct input_dev *idev;
>
>         /* config */
> -       unsigned short keycodes[CAP11XX_NUM_CHN];
> +       u32 keycodes[];
> +};
> +
> +struct cap11xx_hw_model {
> +       uint8_t product_id;
> +       unsigned int num_channels;
> +};
> +
> +enum {
> +       CAP1106,
> +       CAP1126,
> +       CAP1188,
> +};
> +
> +static const struct cap11xx_hw_model cap11xx_devices[] = {
> +       [CAP1106] = { .product_id = 0x55, .num_channels = 6 },
> +       [CAP1126] = { .product_id = 0x53, .num_channels = 6 },
> +       [CAP1188] = { .product_id = 0x50, .num_channels = 8 },
>  };
>
>  static const struct reg_default cap11xx_reg_defaults[] = {
> @@ -150,7 +164,7 @@ static irqreturn_t cap11xx_thread_func(int irq_num, void *data)
>         if (ret < 0)
>                 goto out;
>
> -       for (i = 0; i < CAP11XX_NUM_CHN; i++)
> +       for (i = 0; i < priv->idev->keycodemax; i++)
>                 input_report_key(priv->idev, priv->keycodes[i],
>                                  status & (1 << i));
>
> @@ -187,11 +201,16 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
>         struct device *dev = &i2c_client->dev;
>         struct cap11xx_priv *priv;
>         struct device_node *node;
> +       const struct cap11xx_hw_model *cap = &cap11xx_devices[id->driver_data];
>         int i, error, irq, gain = 0;
>         unsigned int val, rev;
> -       u32 gain32, keycodes[CAP11XX_NUM_CHN];
> +       u32 gain32;
> +
> +       BUG_ON(!cap->num_channels);
>
> -       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +       priv = devm_kzalloc(dev,
> +                           sizeof(*priv) + cap->num_channels * sizeof(u32),
> +                           GFP_KERNEL);
>         if (!priv)
>                 return -ENOMEM;
>
> @@ -203,9 +222,9 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
>         if (error)
>                 return error;
>
> -       if (val != CAP11XX_PRODUCT_ID) {
> +       if (val != cap->product_id) {
>                 dev_err(dev, "Product ID: Got 0x%02x, expected 0x%02x\n",
> -                       val, CAP11XX_PRODUCT_ID);
> +                       val, cap->product_id);
>                 return -ENODEV;
>         }
>
> @@ -225,8 +244,8 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
>
>         dev_info(dev, "CAP11XX detected, revision 0x%02x\n", rev);
>         i2c_set_clientdata(i2c_client, priv);
> -       node = dev->of_node;
>
> +       node = dev->of_node;
>         if (!of_property_read_u32(node, "microchip,sensor-gain", &gain32)) {
>                 if (is_power_of_2(gain32) && gain32 <= 8)
>                         gain = ilog2(gain32);
> @@ -234,17 +253,12 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
>                         dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
>         }
>
> -       BUILD_BUG_ON(ARRAY_SIZE(keycodes) != ARRAY_SIZE(priv->keycodes));
> -
>         /* Provide some useful defaults */
> -       for (i = 0; i < ARRAY_SIZE(keycodes); i++)
> -               keycodes[i] = KEY_A + i;
> +       for (i = 0; i < cap->num_channels; i++)
> +               priv->keycodes[i] = KEY_A + i;
>
>         of_property_read_u32_array(node, "linux,keycodes",
> -                                  keycodes, ARRAY_SIZE(keycodes));
> -
> -       for (i = 0; i < ARRAY_SIZE(keycodes); i++)
> -               priv->keycodes[i] = keycodes[i];
> +               priv->keycodes, cap->num_channels);
>
>         error = regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL,
>                                    CAP11XX_REG_MAIN_CONTROL_GAIN_MASK,
> @@ -268,17 +282,17 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
>         if (of_property_read_bool(node, "autorepeat"))
>                 __set_bit(EV_REP, priv->idev->evbit);
>
> -       for (i = 0; i < CAP11XX_NUM_CHN; i++)
> +       for (i = 0; i < cap->num_channels; i++)
>                 __set_bit(priv->keycodes[i], priv->idev->keybit);
>
>         __clear_bit(KEY_RESERVED, priv->idev->keybit);
>
>         priv->idev->keycode = priv->keycodes;
>         priv->idev->keycodesize = sizeof(priv->keycodes[0]);
> -       priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
> +       priv->idev->keycodemax = cap->num_channels;
>
>         priv->idev->id.vendor = CAP11XX_MANUFACTURER_ID;
> -       priv->idev->id.product = CAP11XX_PRODUCT_ID;
> +       priv->idev->id.product = cap->product_id;
>         priv->idev->id.version = rev;
>
>         priv->idev->open = cap11xx_input_open;
> @@ -312,12 +326,16 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
>
>  static const struct of_device_id cap11xx_dt_ids[] = {
>         { .compatible = "microchip,cap1106", },
> +       { .compatible = "microchip,cap1126", },
> +       { .compatible = "microchip,cap1188", },
>         {}
>  };
>  MODULE_DEVICE_TABLE(of, cap11xx_dt_ids);
>
>  static const struct i2c_device_id cap11xx_i2c_ids[] = {
> -       { "cap1106", 0 },
> +       { "cap1106", CAP1106 },
> +       { "cap1126", CAP1126 },
> +       { "cap1188", CAP1188 },
>         {}
>  };
>  MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids);

^ permalink raw reply

* [Dell Inspiron 5547] Cursor jumps to trash or last icon on launch bar
From: Phil M. @ 2014-10-10  3:30 UTC (permalink / raw)
  To: linux-input

[1] One line summary of problem:

    [Dell Inspiron 5547] Cursor jumps to trash or last icon on launch bar

[2.] Full description of the problem/report:

[3.] Keywords:

[4.] Kernel version (from /proc/version):

cat /proc/version
Linux version 3.17.0-031700-generic (apw@gomeisa) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #201410060605 SMP Mon Oct 6 10:07:09 UTC 2014

[5.] Output of Oops..:

No Oops ouput, no Caps Lock flashing.

[6.] A small shell script or example program which triggers the problem (if possible)

Issue only appears, when using touchpad (HW).  Not sure how to trigger using a shell script, even though I am fluent in shell scripting. Any help would be appreciated.

[7.] Environment

lsb_release -rd
Description:	Ubuntu 14.04.1 LTS
Release:	14.04

[7.1.] Software

./ver_linux

If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.
  
Linux tcllp-1 3.17.0-031700-generic #201410060605 SMP Mon Oct 6 10:07:09 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
  
Gnu C                  4.8
Gnu make               3.81
binutils               2.24
util-linux             2.20.1
mount                  support
module-init-tools      15
e2fsprogs              1.42.9
pcmciautils            018
PPP                    2.4.5
Linux C Library        2.19
Dynamic linker (ldd)   2.19
Procps                 3.3.9
Net-tools              1.60
Kbd                    1.15.5
Sh-utils               8.21
wireless-tools         30
Modules Loaded         ctr ccm bnep rfcomm binfmt_misc nls_iso8859_1 arc4 iwlmvm mac80211 snd_hda_codec_hdmi uvcvideo videobuf2_vmalloc intel_rapl videobuf2_memops videobuf2_core v4l2_common videodev media x86_pkg_temp_thermal intel_powerclamp dell_wmi sparse_keymap rtsx_usb_ms coretemp memstick kvm_intel kvm hid_rmi crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel dell_laptop aes_x86_64 lrw gf128mul glue_helper iwlwifi btusb ablk_helper joydev rtc_efi cryptd serio_raw dcdbas cfg80211 bluetooth snd_soc_rt5640 i915 wmi snd_soc_rl6231 snd_hda_codec_realtek dw_dmac dw_dmac_core snd_hda_codec_generic snd_hda_intel snd_soc_core video snd_hda_controller snd_hda_codec i2c_hid snd_compress drm_kms_helper snd_pcm_dmaengine snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi s
 nd_seq drm mei_me mei snd_seq_device hid snd_timer snd soundcore i2c_algo_bit lpc_ich 8250_dw i2c_designware_platform spi_pxa2xx_platform i2c_designware_core soc_button_array mac_hid parport_pc ppdev
  lp parport rtsx_usb_sdmmc rtsx_usb psmouse ahci r8169 libahci mii sdhci_acpi sdhci


[7.2.] Processor information (from /proc/cpuinfo):
cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 69
model name	: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
stepping	: 1
microcode	: 0x17
cpu MHz		: 1735.687
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs		:
bogomips	: 4788.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 69
model name	: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
stepping	: 1
microcode	: 0x17
cpu MHz		: 1732.218
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs		:
bogomips	: 4788.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 69
model name	: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
stepping	: 1
microcode	: 0x17
cpu MHz		: 1728.187
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs		:
bogomips	: 4788.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 69
model name	: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
stepping	: 1
microcode	: 0x17
cpu MHz		: 2041.968
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
apicid		: 3
initial apicid	: 3
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs		:
bogomips	: 4788.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

[7.3.] Module information (from /proc/modules):

cat /proc/modules
ctr 13193 2 - Live 0x0000000000000000
ccm 17856 2 - Live 0x0000000000000000
bnep 19884 2 - Live 0x0000000000000000
rfcomm 75114 8 - Live 0x0000000000000000
binfmt_misc 17508 1 - Live 0x0000000000000000
nls_iso8859_1 12713 1 - Live 0x0000000000000000
arc4 12573 2 - Live 0x0000000000000000
iwlmvm 249097 0 - Live 0x0000000000000000
mac80211 696913 1 iwlmvm, Live 0x0000000000000000
snd_hda_codec_hdmi 52620 1 - Live 0x0000000000000000
uvcvideo 86628 0 - Live 0x0000000000000000
videobuf2_vmalloc 13216 1 uvcvideo, Live 0x0000000000000000
intel_rapl 19196 0 - Live 0x0000000000000000
videobuf2_memops 13362 1 videobuf2_vmalloc, Live 0x0000000000000000
videobuf2_core 59907 1 uvcvideo, Live 0x0000000000000000
v4l2_common 15715 1 videobuf2_core, Live 0x0000000000000000
videodev 163831 3 uvcvideo,videobuf2_core,v4l2_common, Live 0x0000000000000000
media 22008 2 uvcvideo,videodev, Live 0x0000000000000000
x86_pkg_temp_thermal 14312 0 - Live 0x0000000000000000
intel_powerclamp 19099 0 - Live 0x0000000000000000
dell_wmi 12681 0 - Live 0x0000000000000000
sparse_keymap 13890 1 dell_wmi, Live 0x0000000000000000
rtsx_usb_ms 19050 0 - Live 0x0000000000000000
coretemp 13638 0 - Live 0x0000000000000000
memstick 16968 1 rtsx_usb_ms, Live 0x0000000000000000
kvm_intel 149257 0 - Live 0x0000000000000000
kvm 468567 1 kvm_intel, Live 0x0000000000000000
hid_rmi 17944 0 - Live 0x0000000000000000
crct10dif_pclmul 14268 0 - Live 0x0000000000000000
crc32_pclmul 13180 0 - Live 0x0000000000000000
ghash_clmulni_intel 13230 0 - Live 0x0000000000000000
aesni_intel 165469 4 - Live 0x0000000000000000
dell_laptop 14147 0 - Live 0x0000000000000000
aes_x86_64 17131 1 aesni_intel, Live 0x0000000000000000
lrw 13323 1 aesni_intel, Live 0x0000000000000000
gf128mul 14951 1 lrw, Live 0x0000000000000000
glue_helper 14095 1 aesni_intel, Live 0x0000000000000000
iwlwifi 190863 1 iwlmvm, Live 0x0000000000000000
btusb 32408 0 - Live 0x0000000000000000
ablk_helper 13597 1 aesni_intel, Live 0x0000000000000000
joydev 17587 0 - Live 0x0000000000000000
rtc_efi 12760 0 - Live 0x0000000000000000
cryptd 20531 3 ghash_clmulni_intel,aesni_intel,ablk_helper, Live 0x0000000000000000
serio_raw 13483 0 - Live 0x0000000000000000
dcdbas 15017 1 dell_laptop, Live 0x0000000000000000
cfg80211 514757 3 iwlmvm,mac80211,iwlwifi, Live 0x0000000000000000
bluetooth 477455 22 bnep,rfcomm,btusb, Live 0x0000000000000000
snd_soc_rt5640 93123 0 - Live 0x0000000000000000
i915 993210 7 - Live 0x0000000000000000
wmi 19379 1 dell_wmi, Live 0x0000000000000000
snd_soc_rl6231 13037 1 snd_soc_rt5640, Live 0x0000000000000000
snd_hda_codec_realtek 78564 1 - Live 0x0000000000000000
dw_dmac 12835 0 - Live 0x0000000000000000
dw_dmac_core 28566 1 dw_dmac, Live 0x0000000000000000
snd_hda_codec_generic 70087 1 snd_hda_codec_realtek, Live 0x0000000000000000
snd_hda_intel 30783 5 - Live 0x0000000000000000
snd_soc_core 207547 1 snd_soc_rt5640, Live 0x0000000000000000
video 20569 1 i915, Live 0x0000000000000000
snd_hda_controller 32234 1 snd_hda_intel, Live 0x0000000000000000
snd_hda_codec 145035 5 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_hda_controller, Live 0x0000000000000000
i2c_hid 19065 0 - Live 0x0000000000000000
snd_compress 19435 1 snd_soc_core, Live 0x0000000000000000
drm_kms_helper 99872 1 i915, Live 0x0000000000000000
snd_pcm_dmaengine 15229 1 snd_soc_core, Live 0x0000000000000000
snd_hwdep 17709 1 snd_hda_codec, Live 0x0000000000000000
snd_pcm 105052 7 snd_hda_codec_hdmi,snd_soc_rt5640,snd_hda_intel,snd_soc_core,snd_hda_controller,snd_hda_codec,snd_pcm_dmaengine, Live 0x0000000000000000
snd_seq_midi 13564 0 - Live 0x0000000000000000
snd_seq_midi_event 14899 1 snd_seq_midi, Live 0x0000000000000000
snd_rawmidi 31197 1 snd_seq_midi, Live 0x0000000000000000
snd_seq 63540 2 snd_seq_midi,snd_seq_midi_event, Live 0x0000000000000000
drm 318542 6 i915,drm_kms_helper, Live 0x0000000000000000
mei_me 19524 0 - Live 0x0000000000000000
mei 88810 1 mei_me, Live 0x0000000000000000
snd_seq_device 14497 3 snd_seq_midi,snd_rawmidi,snd_seq, Live 0x0000000000000000
hid 110572 2 hid_rmi,i2c_hid, Live 0x0000000000000000
snd_timer 30118 2 snd_pcm,snd_seq, Live 0x0000000000000000
snd 84025 23 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_soc_core,snd_hda_codec,snd_compress,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_seq_device,snd_timer, Live 0x0000000000000000
soundcore 15091 2 snd_hda_codec,snd, Live 0x0000000000000000
i2c_algo_bit 13564 1 i915, Live 0x0000000000000000
lpc_ich 21176 0 - Live 0x0000000000000000
8250_dw 13474 0 - Live 0x0000000000000000
i2c_designware_platform 13025 0 - Live 0x0000000000000000
spi_pxa2xx_platform 23302 0 - Live 0x0000000000000000
i2c_designware_core 14990 1 i2c_designware_platform, Live 0x0000000000000000
soc_button_array 12769 0 - Live 0x0000000000000000
mac_hid 13275 0 - Live 0x0000000000000000
parport_pc 32906 0 - Live 0x0000000000000000
ppdev 17711 0 - Live 0x0000000000000000
lp 17799 0 - Live 0x0000000000000000
parport 42481 3 parport_pc,ppdev,lp, Live 0x0000000000000000
rtsx_usb_sdmmc 28381 0 - Live 0x0000000000000000
rtsx_usb 21330 2 rtsx_usb_ms,rtsx_usb_sdmmc, Live 0x0000000000000000
psmouse 118039 0 - Live 0x0000000000000000
ahci 30167 4 - Live 0x0000000000000000
r8169 77680 0 - Live 0x0000000000000000
libahci 32533 1 ahci, Live 0x0000000000000000
mii 13981 1 r8169, Live 0x0000000000000000
sdhci_acpi 13395 0 - Live 0x0000000000000000
sdhci 44159 1 sdhci_acpi, Live 0x0000000000000000

[7.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)

  cat /proc/ioports
0000-0cf7 : PCI Bus 0000:00
   0000-001f : dma1
   0020-0021 : pic1
   0040-0043 : timer0
   0050-0053 : timer1
   0060-0060 : keyboard
   0062-0062 : PNP0C09:00
     0062-0062 : EC data
   0064-0064 : keyboard
   0066-0066 : PNP0C09:00
     0066-0066 : EC cmd
   0070-0077 : rtc0
   0080-008f : dma page reg
   00a0-00a1 : pic2
   00c0-00df : dma2
   00f0-00ff : fpu
   0680-069f : pnp 00:00
   0800-0bff : INT33C7:00
     0800-0bff : lp-gpio
0cf8-0cff : PCI conf1
0d00-ffff : PCI Bus 0000:00
   164e-164f : pnp 00:00
   1800-1803 : ACPI PM1a_EVT_BLK
   1804-1805 : ACPI PM1a_CNT_BLK
   1808-180b : ACPI PM_TMR
   1810-1815 : ACPI CPU throttle
   1830-1833 : iTCO_wdt
   1850-1850 : ACPI PM2_CNT_BLK
   1854-1857 : pnp 00:02
   1860-187f : iTCO_wdt
   1880-189f : ACPI GPE0_BLK
   3000-3fff : PCI Bus 0000:01
     3000-30ff : 0000:01:00.0
       3000-30ff : r8169
   4000-403f : 0000:00:02.0
   4040-405f : 0000:00:1f.3
   4060-407f : 0000:00:1f.2
     4060-407f : ahci
   4080-4087 : 0000:00:1f.2
     4080-4087 : ahci
   4088-408f : 0000:00:1f.2
     4088-408f : ahci
   4090-4093 : 0000:00:1f.2
     4090-4093 : ahci
   4094-4097 : 0000:00:1f.2
     4094-4097 : ahci
   fd60-fd63 : pnp 00:00
   ffff-ffff : pnp 00:00
     ffff-ffff : pnp 00:00
       ffff-ffff : pnp 00:00
cat /proc/iomem
00000000-00000fff : reserved
00001000-0006efff : System RAM
0006f000-0006ffff : reserved
00070000-00087fff : System RAM
00088000-000bffff : reserved
   000a0000-000bffff : PCI Bus 0000:00
000c0000-000cebff : Video ROM
000cf000-000cffff : Adapter ROM
000f0000-000fffff : System ROM
00100000-94d5ffff : System RAM
   02000000-027a9ab7 : Kernel code
   027a9ab8-02d1e57f : Kernel data
   02e80000-02fc6fff : Kernel bss
94d60000-95d5ffff : reserved
95d60000-9a36efff : System RAM
9a36f000-9a56efff : reserved
9a56f000-9aebefff : reserved
9aebf000-9afbefff : ACPI Non-volatile Storage
9afbf000-9affefff : ACPI Tables
9afff000-9affffff : System RAM
9b000000-9f9fffff : reserved
   9ba00000-9f9fffff : Graphics Stolen Memory
9fa00000-feafffff : PCI Bus 0000:00
   9fa10000-9fa1ffff : pnp 00:05
   9fa21000-9fa21fff : pnp 00:05
   a0000000-afffffff : 0000:00:02.0
   b0000000-b03fffff : 0000:00:02.0
   b0400000-b04fffff : PCI Bus 0000:01
     b0400000-b0403fff : 0000:01:00.0
       b0400000-b0403fff : r8169
   b0500000-b05fffff : PCI Bus 0000:02
     b0500000-b0501fff : 0000:02:00.0
       b0500000-b0501fff : iwlwifi
   b0600000-b06fffff : PCI Bus 0000:01
     b0600000-b0600fff : 0000:01:00.0
       b0600000-b0600fff : r8169
   b0700000-b070ffff : 0000:00:14.0
     b0700000-b070ffff : xhci_hcd
   b0710000-b0713fff : 0000:00:03.0
     b0710000-b0713fff : ICH HD audio
   b0714000-b0717fff : 0000:00:1b.0
     b0714000-b0717fff : ICH HD audio
   b0718000-b071801f : 0000:00:16.0
     b0718000-b071801f : mei_me
   b0719000-b07190ff : 0000:00:1f.3
   b071b000-b071b7ff : 0000:00:1f.2
     b071b000-b071b7ff : ahci
   b071c000-b071c3ff : 0000:00:1d.0
     b071c000-b071c3ff : ehci_hcd
   b071d000-b071dfff : pnp 00:06
   b071e000-b071efff : INT33C3:00
     b071e000-b071efff : INT33C3:00
   b071f000-b071ffff : pnp 00:06
   e0000000-efffffff : PCI MMCONFIG 0000 [bus 00-ff]
     e0000000-efffffff : reserved
       e0000000-efffffff : pnp 00:05
   fe101000-fe112fff : reserved
feb00000-feb0ffff : reserved
fec00000-fec00fff : reserved
   fec00000-fec003ff : IOAPIC 0
fed00000-fee00fff : reserved
   fed00000-fed003ff : HPET 0
     fed00000-fed003ff : PNP0103:00
   fed10000-fed17fff : pnp 00:05
   fed18000-fed18fff : pnp 00:05
   fed19000-fed19fff : pnp 00:05
   fed1c000-fed1ffff : pnp 00:05
     fed1f410-fed1f414 : iTCO_wdt
   fed20000-fed3ffff : pnp 00:05
   fed90000-fed93fff : pnp 00:05
   fee00000-fee00fff : Local APIC
ff000000-ff000fff : pnp 00:05
ff010000-ffffffff : INT0800:00
   ffc00000-ffffffff : reserved
100000000-1df5fffff : System RAM
1df600000-1dfffffff : RAM buffer

[7.5.] PCI information ('lspci -vvv' as root)

sudo lspci -vvv
[sudo] password for pme991:
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)
	Subsystem: Dell Device 063e
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
	Latency: 0
	Capabilities: [e0] Vendor Specific Information: Len=0c <?>

00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b) (prog-if 00 [VGA controller])
	Subsystem: Dell Device 063e
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 47
	Region 0: Memory at b0000000 (64-bit, non-prefetchable) [size=4M]
	Region 2: Memory at a0000000 (64-bit, prefetchable) [size=256M]
	Region 4: I/O ports at 4000 [size=64]
	Expansion ROM at <unassigned> [disabled]
	Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
		Address: fee0f00c  Data: 4172
	Capabilities: [d0] Power Management version 2
		Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [a4] PCI Advanced Features
		AFCap: TP+ FLR+
		AFCtrl: FLR-
		AFStatus: TP-
	Kernel driver in use: i915

00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
	Subsystem: Dell Device 063e
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 49
	Region 0: Memory at b0710000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit-
		Address: fee0f00c  Data: 4192
	Capabilities: [70] Express (v1) Root Complex Integrated Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0
			ExtTag- RBE-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
	Kernel driver in use: snd_hda_intel

00:14.0 USB controller: Intel Corporation Lynx Point-LP USB xHCI HC (rev 04) (prog-if 30 [XHCI])
	Subsystem: Dell Device 063e
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 42
	Region 0: Memory at b0700000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: [70] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0-,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 41c1
	Kernel driver in use: xhci_hcd

00:16.0 Communication controller: Intel Corporation Lynx Point-LP HECI #0 (rev 04)
	Subsystem: Dell Device 063e
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 45
	Region 0: Memory at b0718000 (64-bit, non-prefetchable) [size=32]
	Capabilities: [50] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [8c] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 4142
	Kernel driver in use: mei_me

00:1b.0 Audio device: Intel Corporation Lynx Point-LP HD Audio Controller (rev 04)
	Subsystem: Dell Device 063e
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 46
	Region 0: Memory at b0714000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 4162
	Capabilities: [70] Express (v1) Root Complex Integrated Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0
			ExtTag- RBE-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
	Capabilities: [100 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
		VC1:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable- ID=0 ArbSelect=Fixed TC/VC=00
			Status:	NegoPending- InProgress-
	Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation Lynx Point-LP PCI Express Root Port 3 (rev e4) (prog-if 00 [Normal decode])
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
	I/O behind bridge: 00003000-00003fff
	Memory behind bridge: b0600000-b06fffff
	Prefetchable memory behind bridge: 00000000b0400000-00000000b04fffff
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0
			ExtTag- RBE+
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #3, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <512ns, L1 <16us
			ClockPM- Surprise- LLActRep+ BwNot+
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
		SltCap:	AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
			Slot #2, PowerLimit 10.000W; Interlock- NoCompl+
		SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
			Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
		SltSta:	Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
			Changed: MRL- PresDet- LinkState+
		RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible-
		RootCap: CRSVisible-
		RootSta: PME ReqID 0000, PMEStatus- PMEPending-
		DevCap2: Completion Timeout: Range ABC, TimeoutDis+, LTR+, OBFF Not Supported ARIFwd-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF Disabled ARIFwd-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
		Address: fee0f00c  Data: 4171
	Capabilities: [90] Subsystem: Dell Device 063e
	Capabilities: [a0] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [100 v0] #00
	Capabilities: [200 v1] L1 PM Substates
		L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+
			  PortCommonModeRestoreTime=40us PortTPowerOnTime=10us
	Kernel driver in use: pcieport

00:1c.3 PCI bridge: Intel Corporation Lynx Point-LP PCI Express Root Port 4 (rev e4) (prog-if 00 [Normal decode])
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
	I/O behind bridge: 0000f000-00000fff
	Memory behind bridge: b0500000-b05fffff
	Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0
			ExtTag- RBE+
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #4, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <512ns, L1 <16us
			ClockPM- Surprise- LLActRep+ BwNot+
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
		SltCap:	AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
			Slot #3, PowerLimit 10.000W; Interlock- NoCompl+
		SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
			Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
		SltSta:	Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
			Changed: MRL- PresDet- LinkState+
		RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible-
		RootCap: CRSVisible-
		RootSta: PME ReqID 0000, PMEStatus- PMEPending-
		DevCap2: Completion Timeout: Range ABC, TimeoutDis+, LTR+, OBFF Not Supported ARIFwd-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF Disabled ARIFwd-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
		Address: fee0f00c  Data: 4191
	Capabilities: [90] Subsystem: Dell Device 063e
	Capabilities: [a0] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [100 v0] #00
	Capabilities: [200 v1] L1 PM Substates
		L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+
			  PortCommonModeRestoreTime=40us PortTPowerOnTime=10us
	Kernel driver in use: pcieport

00:1d.0 USB controller: Intel Corporation Lynx Point-LP USB EHCI #1 (rev 04) (prog-if 20 [EHCI])
	Subsystem: Dell Device 063e
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 23
	Region 0: Memory at b071c000 (32-bit, non-prefetchable) [size=1K]
	Capabilities: [50] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [58] Debug port: BAR=1 offset=00a0
	Capabilities: [98] PCI Advanced Features
		AFCap: TP+ FLR+
		AFCtrl: FLR-
		AFStatus: TP-
	Kernel driver in use: ehci-pci

00:1f.0 ISA bridge: Intel Corporation Lynx Point-LP LPC Controller (rev 04)
	Subsystem: Dell Device 063e
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Capabilities: [e0] Vendor Specific Information: Len=0c <?>
	Kernel driver in use: lpc_ich

00:1f.2 SATA controller: Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode] (rev 04) (prog-if 01 [AHCI 1.0])
	Subsystem: Dell Device 063e
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin B routed to IRQ 44
	Region 0: I/O ports at 4088 [size=8]
	Region 1: I/O ports at 4094 [size=4]
	Region 2: I/O ports at 4080 [size=8]
	Region 3: I/O ports at 4090 [size=4]
	Region 4: I/O ports at 4060 [size=32]
	Region 5: Memory at b071b000 (32-bit, non-prefetchable) [size=2K]
	Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
		Address: fee0c00c  Data: 41e1
	Capabilities: [70] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot+,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004
	Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation Lynx Point-LP SMBus Controller (rev 04)
	Subsystem: Dell Device 063e
	Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Interrupt: pin C routed to IRQ 11
	Region 0: Memory at b0719000 (64-bit, non-prefetchable) [size=256]
	Region 4: I/O ports at 4040 [size=32]

01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 07)
	Subsystem: Dell Device 063e
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 43
	Region 0: I/O ports at 3000 [size=256]
	Region 2: Memory at b0600000 (64-bit, non-prefetchable) [size=4K]
	Region 4: Memory at b0400000 (64-bit, prefetchable) [size=16K]
	Capabilities: [40] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 41d1
	Capabilities: [70] Express (v2) Endpoint, MSI 01
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s unlimited, L1 <64us
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 <64us
			ClockPM+ Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Via message/WAKE#
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF Disabled
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
		Vector table: BAR=4 offset=00000000
		PBA: BAR=4 offset=00000800
	Capabilities: [d0] Vital Product Data
		No end tag found
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr+ BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [140 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
	Capabilities: [160 v1] Device Serial Number 01-00-00-00-36-4c-e0-00
	Capabilities: [170 v1] Latency Tolerance Reporting
		Max snoop latency: 0ns
		Max no snoop latency: 0ns
	Kernel driver in use: r8169

02:00.0 Network controller: Intel Corporation Wireless 3160 (rev 83)
	Subsystem: Intel Corporation Dual Band Wireless AC 3160
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 48
	Region 0: Memory at b0500000 (64-bit, non-prefetchable) [size=8K]
	Capabilities: [c8] Power Management version 3
		Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee0400c  Data: 4182
	Capabilities: [40] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <512ns, L1 unlimited
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset+
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr+ NoSnoop+ FLReset-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <4us, L1 <32us
			ClockPM+ Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range B, TimeoutDis+, LTR+, OBFF Via WAKE#
		DevCtl2: Completion Timeout: 16ms to 55ms, TimeoutDis-, LTR+, OBFF Disabled
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP+ BadDLLP- Rollover- Timeout- NonFatalErr+
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-
	Capabilities: [140 v1] Device Serial Number a0-88-69-ff-ff-4d-2c-c7
	Capabilities: [14c v1] Latency Tolerance Reporting
		Max snoop latency: 0ns
		Max no snoop latency: 0ns
	Capabilities: [154 v1] Vendor Specific Information: ID=cafe Rev=1 Len=014 <?>
	Kernel driver in use: iwlwifi

[7.6.] SCSI information (from /proc/scsi/scsi)

cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
   Vendor: ATA      Model: WDC WD10JPVX-75J Rev: 1A01
   Type:   Direct-Access                    ANSI  SCSI revision: 05

[7.7.] Other information that might be relevant to the problem

sudo ls /proc
1     156   2163  2421	2750  38    460   685	asound	     misc
10    157   2166  2428	2755  385   466   7	buddyinfo    modules
100   1584  2172  2429	2756  39    468   704	bus	     mounts
1013  16    2177  2430	2759  396   4692  721	cgroups      mtrr
1056  1621  2193  2435	2779  4     47	  726	cmdline      net
1085  1659  2195  2441	2786  400   4753  739	consoles     pagetypeinfo
11    17    2197  2448	28    4069  48	  74	cpuinfo      partitions
1101  171   22	  2457	29    409   49	  744	crypto	     sched_debug
1106  172   2201  2461	2946  41    4904  749	devices      schedstat
1107  18    2204  2465	3     410   491   75	diskstats    scsi
1139  187   2206  2476	3019  412   4919  762	dma	     self
1151  19    2224  2488	3029  414   4929  765	driver	     slabinfo
1152  1999  2238  25	3047  415   4946  77	execdomains  softirqs
1199  2     2241  2519	3063  42    4949  770	fb	     stat
12    20    2242  2525	31    4200  4956  771	filesystems  swaps
1240  2028  2244  2549	317   423   4957  78	fs	     sys
13    2035  2247  2554	32    424   5	  79	interrupts   sysrq-trigger
1302  2037  2248  2559	323   4246  50	  8	iomem	     sysvipc
1347  2051  2254  2562	33    425   51	  80	ioports      thread-self
1373  2054  2260  2567	3345  43    52	  819	irq	     timer_list
1376  21    2272  2572	3369  4322  53	  866	kallsyms     timer_stats
14    2109  2276  2578	34    433   535   870	kcore	     tty
1468  2114  23	  2594	3451  436   54	  876	keys	     uptime
15    2122  2315  2597	3473  44    55	  877	key-users    version
151   2126  2328  26	3491  4459  56	  881	kmsg	     vmallocinfo
1515  2127  2330  2691	3518  4476  58	  9	kpagecount   vmstat
152   2149  2334  27	3536  45    60	  938	kpageflags   zoneinfo
153   2153  2344  2738	3552  4516  61	  974	loadavg
154   2156  2383  2746	3568  4525  62	  975	locks
155   2157  24	  2747	36    4526  648   99	mdstat
1559  2159  2414  2749	37    46    649   acpi	meminfo

[X.] Other notes, patches, fixes, workarounds:

Link to launchpad bug report.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1375514  





^ permalink raw reply

* Re: HID: wacom: regression - system freezes when resuming from S3 suspend
From: Jonas Jelten @ 2014-10-10  1:27 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Benjamin Tissoires, linux-input
In-Reply-To: <alpine.LNX.2.00.1409250223240.22196@pobox.suse.cz>

On 2014-09-25 02:24, Jiri Kosina wrote:
> On Thu, 25 Sep 2014, Jonas Jelten wrote:
> 
>> I have no idea about the reasons yet, however my kernel indeed panics 10
>> seconds after resume from S3. During the 10 seconds, the on-suspend X
>> screen is visible, but frozen (no mouse/keyboard input) and no sysrqs
>> are possible. After the 10s passed, I see old tty1 framebuffer parts
>> from the init system log, the kernel seems to have paniced as the
>> capslock led starts blinking, but I can't see any backtrace.
> 
> Is there any way you could setup serial console or at least netconsole on 
> that system?
> 
>> I could not test whether "HID: wacom: fix timeout on probe for some
>> wacoms" fixes the panic, as it does not apply for 3.17-rc6.
> 
> Just compiling for-3.18/wacom branch of
> 
> 	git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
> 
> should be enough.
> 
> I still fail to see how this would be fixing any panic, so either there is 
> a very strange race condition somewhere, or this is a different problem 
> that still needs to be solved.
> 
> Thanks,
> 

Hi!

Now running 3.17.0, I managed to get a backtrace via netconsole:


[ 1077.286152] PM: Syncing filesystems ... done.
[ 1077.286888] PM: Preparing system for mem sleep
[ 1077.503113] Freezing user space processes ... (elapsed 0.001 seconds)
done.
[ 1077.504368] Freezing remaining freezable tasks ... (elapsed 0.000
seconds) done.
[ 1077.505359] PM: Entering mem sleep
[ 1077.705575] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 1077.705695] sd 0:0:0:0: [sda] Stopping disk
[ 1077.806294] e1000e: EEE TX LPI TIMER: 00000011
[ 1093.625038] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow
Control: Rx/Tx
[ 1100.434376] usb 2-1.5: **** DPM device timeout ****
[ 1100.435410]  ffff8801fc20f9d8 0000000000000002 ffff8801fc20ffd8
ffff8801fc210000
[ 1100.436468]  0000000000014240 ffffffff81a1a440 ffff8801fc210000
ffffffffa0043022
[ 1100.437521]  ffff880100000000 ffff8801fc20f928 ffff8801fc20f998
0000000000000000
[ 1100.438521] Call Trace:
[ 1100.439512]  [<ffffffff81541b0f>] ? _raw_spin_unlock_irqrestore+0x20/0x33
[ 1100.440516]  [<ffffffffa006836b>] ? ehci_urb_enqueue+0x119/0xbf8
[ehci_hcd]
[ 1100.441522]  [<ffffffff81319d1c>] ? debug_smp_processor_id+0x17/0x19
[ 1100.442590]  [<ffffffff8109384f>] ? wake_up_nohz_cpu+0x28/0x8f
[ 1100.443601]  [<ffffffff8153e941>] schedule+0x6e/0x70
[ 1100.444611]  [<ffffffff81541077>] schedule_timeout+0x15a/0x1c2
[ 1100.445616]  [<ffffffff810bd1cf>] ? ftrace_raw_event_tick_stop+0xa8/0xa8
[ 1100.446627]  [<ffffffff8153f2cc>] wait_for_common+0x111/0x151
[ 1100.447643]  [<ffffffff81096e3f>] ? wake_up_process+0x37/0x37
[ 1100.448658]  [<ffffffff8153f33e>] wait_for_completion_timeout+0x13/0x15
[ 1100.449682]  [<ffffffffa002ed55>] usb_start_wait_urb+0x84/0xce [usbcore]
[ 1100.450708]  [<ffffffffa002ee67>] usb_control_msg+0xc8/0xff [usbcore]
[ 1100.451728]  [<ffffffffa00bee1b>] usbhid_raw_request+0x137/0x154 [usbhid]
[ 1100.452746]  [<ffffffffa0116e2a>]
wacom_set_report.constprop.17+0x53/0x73 [wacom]
[ 1100.453775]  [<ffffffffa0117495>] wacom_query_tablet_data+0x8f/0x23a
[wacom]
[ 1100.454796]  [<ffffffffa0117676>] wacom_resume+0x36/0x4f [wacom]
[ 1100.455876]  [<ffffffffa011769d>] wacom_reset_resume+0xe/0x10 [wacom]
[ 1100.456888]  [<ffffffffa00bfbc8>] hid_reset_resume+0x4c/0x58 [usbhid]
[ 1100.457902]  [<ffffffffa00317f1>]
usb_resume_interface.isra.6+0x71/0xc6 [usbcore]
[ 1100.458921]  [<ffffffffa0031aaa>] usb_resume_both+0xd6/0x106 [usbcore]
[ 1100.459937]  [<ffffffffa00251b8>] ? usb_dev_thaw+0x15/0x15 [usbcore]
[ 1100.460956]  [<ffffffffa0032100>] usb_resume+0x1b/0x64 [usbcore]
[ 1100.461973]  [<ffffffffa00251b8>] ? usb_dev_thaw+0x15/0x15 [usbcore]
[ 1100.462983]  [<ffffffffa00251cb>] usb_dev_resume+0x13/0x15 [usbcore]
[ 1100.463983]  [<ffffffff813dd62e>] dpm_run_callback+0x48/0x106
[ 1100.464976]  [<ffffffff813de058>] device_resume+0x16b/0x1a6
[ 1100.465971]  [<ffffffff813dd4e7>] ? __suspend_report_result+0x25/0x25
[ 1100.466962]  [<ffffffff813de0b0>] async_resume+0x1d/0x43
[ 1100.467946]  [<ffffffff8108ea22>] async_run_entry_fn+0x5f/0x115
[ 1100.468923]  [<ffffffff81088480>] process_one_work+0x1bf/0x35d
[ 1100.469903]  [<ffffffff81088eee>] worker_thread+0x28e/0x382
[ 1100.470872]  [<ffffffff81088c60>] ? rescuer_thread+0x226/0x226
[ 1100.471834]  [<ffffffff8108ca2c>] kthread+0xd2/0xda
[ 1100.472793]  [<ffffffff8108c95a>] ? kthread_create_on_node+0x16f/0x16f
[ 1100.473757]  [<ffffffff815423bc>] ret_from_fork+0x7c/0xb0
[ 1100.474725]  [<ffffffff8108c95a>] ? kthread_create_on_node+0x16f/0x16f
[ 1100.475697] Kernel panic - not syncing: usb 2-1.5: unrecoverable failure
[ 1100.475697]
[ 1100.477626] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G  R
3.17.0-JJ+ #71
[ 1100.478608] Hardware name: LENOVO 4296CTO/4296CTO, BIOS 8DET67WW
(1.37 ) 12/05/2012
[ 1100.479596]  0000000000000000 ffff88021e283e00 ffffffff8153c8c8
ffffffff8183ab5c
[ 1100.480673]  ffff88021e283e78 ffffffff8153954d ffffffff00000018
ffff88021e283e88
[ 1100.481686]  ffff88021e283e28 ffff88021e27ffc0 ffffffffa003b4a5
ffff8800d45ec810
[ 1100.482684] Call Trace:
[ 1100.483655]  <IRQ>  [<ffffffff8153c8c8>] dump_stack+0x4e/0x7a
[ 1100.484639]  [<ffffffff8153954d>] panic+0xcb/0x1f4
[ 1100.485622]  [<ffffffff813dd4e7>] ? __suspend_report_result+0x25/0x25
[ 1100.486597]  [<ffffffff813dd539>] dpm_watchdog_handler+0x52/0x52
[ 1100.487567]  [<ffffffff810bd225>] call_timer_fn+0x46/0x124
[ 1100.488529]  [<ffffffff813dd4e7>] ? __suspend_report_result+0x25/0x25
[ 1100.489496]  [<ffffffff810bda8b>] run_timer_softirq+0x215/0x280
[ 1100.490457]  [<ffffffff810c8b25>] ? clockevents_program_event+0x9d/0xb9
[ 1100.491423]  [<ffffffff81078bae>] __do_softirq+0xf4/0x27d
[ 1100.492389]  [<ffffffff81078ee6>] irq_exit+0x43/0x89
[ 1100.493353]  [<ffffffff815452fe>] smp_apic_timer_interrupt+0x44/0x50
[ 1100.494318]  [<ffffffff8154348d>] apic_timer_interrupt+0x6d/0x80
[ 1100.495287]  <EOI>  [<ffffffff81449730>] ? cpuidle_enter_state+0x8b/0x16b
[ 1100.496264]  [<ffffffff814498b9>] cpuidle_enter+0x17/0x19
[ 1100.497236]  [<ffffffff810a51d6>] cpu_startup_entry+0x1b6/0x2f0
[ 1100.498212]  [<ffffffff81035f4d>] start_secondary+0x1ad/0x1b2
[ 1100.499205] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation
range: 0xffffffff80000000-0xffffffff9fffffff)
[ 1100.500254] drm_kms_helper: panic occurred, switching back to text
console

This looks like the kernel is failing to bring up the wacom usb device
after the suspend.
Probably this is something for linux-kernel@?


Cheers,
Jonas

^ permalink raw reply

* Re: Synaptics, CAP_FORCEPAD, bad behavior
From: Dmitry Torokhov @ 2014-10-10  1:03 UTC (permalink / raw)
  To: Andrew Duggan; +Cc: Nicole Faerber, Christopher Heiny, linux-input
In-Reply-To: <543726A6.3020804@synaptics.com>

On Thu, Oct 09, 2014 at 05:21:58PM -0700, Andrew Duggan wrote:
> On 10/09/2014 10:28 AM, Dmitry Torokhov wrote:
> >On Thu, Oct 09, 2014 at 09:52:46AM -0700, Dmitry Torokhov wrote:
> >>On Thu, Oct 09, 2014 at 11:34:26AM +0200, Nicole Faerber wrote:
> >>>Hi!
> >>>Just installed the just released 3.17 kernel and found a bad behavior of
> >>>the new Synaptics driver on my Thinkpad Yoga which has the new Synaptics
> >>>clickpad enabled touchpad:
> >>>
> >>>psmouse serio1: synaptics: Touchpad model: 1, fw: 8.1, id: 0x1e2b1,
> >>>caps: 0xd002a3/0x940300/0x12f800, board id: 2911, fw id: 2560
> >>>
> >>>The issue is that now a button release is only issued after the finger
> >>>has completely left the touchpad and not when releasing the physical
> >>>button. Is this physical button now called FORCEPAD? Anyway, this is
> >>>pretty annoying. Double clicking become a real pain.
> >>>I did comment out the new
> >>>
> >>>	if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) {
> >>>	...
> >>>
> >>>and everything is back to normal again, i.e. when I do release the pad
> >>>physical button but keep the finger on the pad, the button release event
> >>>is issued properly.
> >>Hmm, the forcepad code should only activate if the devoice do4es not
> >>have physical buttons at all. Let me see what's the diffference in
> >>capabilities between your and mine touchpads...
> >OK, so your extended caps are 0x12f800 while on my forcepad they are
> >0x12e800. The forcepad bit is supposed to be bit 15, so it is set for
> >both our devices, but bit 12 (counting from 0) is different.
> >
> >Andrew, Chris, could you please tell us what bit 12 indicates? In fact,
> >if you could share the updated description for all currently defined
> >capability bits that would be awesome.
> >
> >Thanks!
> >
> Hmm, looks like I got incorrect information about the ForcePad
> capabilities bit and unfortunately there does not seem to be a
> capabilities bit for ForcePad on PS/2. Too bad that wasn't caught
> before 3.17 was released. Bit 12 is for "uniform clickpad" which
> means that the whole clickpad moves when you press it as opposed to
> it being hinged at the top. That makes sense that a ForcePad would
> not have that capability.

Argh, that is unfortunate. Well, I guess we are back to DMI checks.

Thanks.

-- 
Dmitry

Input: synaptics - gate forcepad support by DMI check

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Unfortunately, ForcePad capability is not actually exported over PS/2, so
we have to resort to DMI checks.

Cc: stable@vger.kernel.org
Reported-by: Nicole Faerber <nicole.faerber@kernelconcepts.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/synaptics.c |   22 +++++++++++++++++++++-
 drivers/input/mouse/synaptics.h |    8 ++------
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 6394d9b..9031a0a 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -607,6 +607,8 @@ static void synaptics_parse_agm(const unsigned char buf[],
 	priv->agm_pending = true;
 }
 
+static bool is_forcepad;
+
 static int synaptics_parse_hw_state(const unsigned char buf[],
 				    struct synaptics_data *priv,
 				    struct synaptics_hw_state *hw)
@@ -636,7 +638,7 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
 		hw->left  = (buf[0] & 0x01) ? 1 : 0;
 		hw->right = (buf[0] & 0x02) ? 1 : 0;
 
-		if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) {
+		if (is_forcepad) {
 			/*
 			 * ForcePads, like Clickpads, use middle button
 			 * bits to report primary button clicks.
@@ -1667,11 +1669,29 @@ static const struct dmi_system_id __initconst cr48_dmi_table[] = {
 	{ }
 };
 
+static const struct dmi_system_id forcepad_dmi_table[] __initconst = {
+#if defined(CONFIG_DMI) && defined(CONFIG_X86)
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Folio 1040 G1"),
+		},
+	},
+#endif
+	{ }
+};
+
 void __init synaptics_module_init(void)
 {
 	impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
 	broken_olpc_ec = dmi_check_system(olpc_dmi_table);
 	cr48_profile_sensor = dmi_check_system(cr48_dmi_table);
+
+	/*
+	 * Unfortunately ForcePad capability is not exported over PS/2,
+	 * so we have to resort to checking DMI.
+	 */
+	is_forcepad = dmi_check_system(forcepad_dmi_table);
 }
 
 static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index fb2e076..1bd01f2 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -77,12 +77,9 @@
  *					for noise.
  * 2	0x08	image sensor		image sensor tracks 5 fingers, but only
  *					reports 2.
+ * 2	0x01	uniform clickpad	whole clickpad moves instead of being
+ *					hinged at the top.
  * 2	0x20	report min		query 0x0f gives min coord reported
- * 2	0x80	forcepad		forcepad is a variant of clickpad that
- *					does not have physical buttons but rather
- *					uses pressure above certain threshold to
- *					report primary clicks. Forcepads also have
- *					clickpad bit set.
  */
 #define SYN_CAP_CLICKPAD(ex0c)		((ex0c) & 0x100000) /* 1-button ClickPad */
 #define SYN_CAP_CLICKPAD2BTN(ex0c)	((ex0c) & 0x000100) /* 2-button ClickPad */
@@ -91,7 +88,6 @@
 #define SYN_CAP_ADV_GESTURE(ex0c)	((ex0c) & 0x080000)
 #define SYN_CAP_REDUCED_FILTERING(ex0c)	((ex0c) & 0x000400)
 #define SYN_CAP_IMAGE_SENSOR(ex0c)	((ex0c) & 0x000800)
-#define SYN_CAP_FORCEPAD(ex0c)		((ex0c) & 0x008000)
 
 /* synaptics modes query bits */
 #define SYN_MODE_ABSOLUTE(m)		((m) & (1 << 7))

^ permalink raw reply related

* Re: Synaptics, CAP_FORCEPAD, bad behavior
From: Andrew Duggan @ 2014-10-10  0:21 UTC (permalink / raw)
  To: Dmitry Torokhov, Nicole Faerber, Christopher Heiny; +Cc: linux-input
In-Reply-To: <20141009172832.GB18213@dtor-ws>

On 10/09/2014 10:28 AM, Dmitry Torokhov wrote:
> On Thu, Oct 09, 2014 at 09:52:46AM -0700, Dmitry Torokhov wrote:
>> On Thu, Oct 09, 2014 at 11:34:26AM +0200, Nicole Faerber wrote:
>>> Hi!
>>> Just installed the just released 3.17 kernel and found a bad behavior of
>>> the new Synaptics driver on my Thinkpad Yoga which has the new Synaptics
>>> clickpad enabled touchpad:
>>>
>>> psmouse serio1: synaptics: Touchpad model: 1, fw: 8.1, id: 0x1e2b1,
>>> caps: 0xd002a3/0x940300/0x12f800, board id: 2911, fw id: 2560
>>>
>>> The issue is that now a button release is only issued after the finger
>>> has completely left the touchpad and not when releasing the physical
>>> button. Is this physical button now called FORCEPAD? Anyway, this is
>>> pretty annoying. Double clicking become a real pain.
>>> I did comment out the new
>>>
>>> 	if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) {
>>> 	...
>>>
>>> and everything is back to normal again, i.e. when I do release the pad
>>> physical button but keep the finger on the pad, the button release event
>>> is issued properly.
>> Hmm, the forcepad code should only activate if the devoice do4es not
>> have physical buttons at all. Let me see what's the diffference in
>> capabilities between your and mine touchpads...
> OK, so your extended caps are 0x12f800 while on my forcepad they are
> 0x12e800. The forcepad bit is supposed to be bit 15, so it is set for
> both our devices, but bit 12 (counting from 0) is different.
>
> Andrew, Chris, could you please tell us what bit 12 indicates? In fact,
> if you could share the updated description for all currently defined
> capability bits that would be awesome.
>
> Thanks!
>
Hmm, looks like I got incorrect information about the ForcePad 
capabilities bit and unfortunately there does not seem to be a 
capabilities bit for ForcePad on PS/2. Too bad that wasn't caught before 
3.17 was released. Bit 12 is for "uniform clickpad" which means that the 
whole clickpad moves when you press it as opposed to it being hinged at 
the top. That makes sense that a ForcePad would not have that capability.

Also, it's weird that the firmware ID printed above is not correct. I 
would expect a 7 digit number starting with 1.

Andrew

^ permalink raw reply

* Re: [PATCH RESEND RESEND] Input: evdev - add event-mask API
From: Dmitry Torokhov @ 2014-10-09 22:52 UTC (permalink / raw)
  To: David Herrmann
  Cc: open list:HID CORE LAYER, Peter Hutterer, Benjamin Tissoires
In-Reply-To: <CANq1E4Q2S6vmpN=My8DXSPMti-pNQD24Hb0V9hqD=9TfND_mrg@mail.gmail.com>

Hi David,

On Sun, Sep 28, 2014 at 12:19:39PM +0200, David Herrmann wrote:
> Ping?

Sorry for the delay.

> 
> On Wed, Aug 13, 2014 at 9:16 AM, David Herrmann <dh.herrmann@gmail.com> wrote:
> > Hardware manufacturers group keys in the weirdest way possible. This may
> > cause a power-key to be grouped together with normal keyboard keys and
> > thus be reported on the same kernel interface.
> >
> > However, user-space is often only interested in specific sets of events.
> > For instance, daemons dealing with system-reboot (like systemd-logind)
> > listen for KEY_POWER, but are not interested in any main keyboard keys.
> > Usually, power keys are reported via separate interfaces, however,
> > some i8042 boards report it in the AT matrix. To avoid waking up those
> > system daemons on each key-press, we had two ideas:
> >  - split off KEY_POWER into a separate interface unconditionally
> >  - allow filtering a specific set of events on evdev FDs
> >
> > Splitting of KEY_POWER is a rather weird way to deal with this and may
> > break backwards-compatibility. It is also specific to KEY_POWER and might
> > be required for other stuff, too. Moreover, we might end up with a huge
> > set of input-devices just to have them properly split.
> >
> > Hence, this patchset implements the second idea: An event-mask to specify
> > which events you're interested in. Two ioctls allow setting this mask for
> > each event-type. If not set, all events are reported. The type==0 entry is
> > used same as in EVIOCGBIT to set the actual EV_* mask of filtered events.
> > This way, you have a two-level filter.
> >
> > We are heavily forward-compatible to new event-types and event-codes. So
> > new user-space will be able to run on an old kernel which doesn't know the
> > given event-codes or event-types.
> >
> > Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
> > Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> > ---
> > Hi Dmitry
> >
> > We could really make use of this for SUSPEND/POWER key handling. We keep getting
> > reports from people where those keys are reported as part of the main keyboard.
> > It's really annoying if we have to wake up those processes for *every*
> > key-press.
> >
> > In case you just need time to review it, let me know. Otherwise, I will keep
> > resending it as people ask me for it all the time.
> >
> > Thanks
> > David
> >
> >  drivers/input/evdev.c      | 156 ++++++++++++++++++++++++++++++++++++++++++++-
> >  include/uapi/linux/input.h |  56 ++++++++++++++++
> >  2 files changed, 210 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> > index fd325ec..6386882 100644
> > --- a/drivers/input/evdev.c
> > +++ b/drivers/input/evdev.c
> > @@ -51,10 +51,130 @@ struct evdev_client {
> >         struct list_head node;
> >         int clkid;
> >         bool revoked;
> > +       unsigned long *evmasks[EV_CNT];
> >         unsigned int bufsize;
> >         struct input_event buffer[];
> >  };
> >
> > +static size_t evdev_get_mask_cnt(unsigned int type)
> > +{
> > +       static size_t counts[EV_CNT] = {
> > +               /* EV_SYN==0 is EV_CNT, _not_ SYN_CNT, see EVIOCGBIT */
> > +               [EV_SYN] = EV_CNT,
> > +               [EV_KEY] = KEY_CNT,
> > +               [EV_REL] = REL_CNT,
> > +               [EV_ABS] = ABS_CNT,
> > +               [EV_MSC] = MSC_CNT,
> > +               [EV_SW] = SW_CNT,
> > +               [EV_LED] = LED_CNT,
> > +               [EV_SND] = SND_CNT,
> > +               [EV_FF] = FF_CNT,
> > +       };
> > +
> > +       return (type < EV_CNT) ? counts[type] : 0;
> > +}
> > +
> > +/* must be called with evdev-mutex held */
> > +static int evdev_set_mask(struct evdev_client *client,
> > +                         unsigned int type,
> > +                         const void __user *codes,
> > +                         u32 codes_size)
> > +{
> > +       unsigned long flags, *mask, *oldmask;
> > +       size_t cnt, size;
> > +
> > +       /* unknown masks are simply ignored for forward-compat */
> > +       cnt = evdev_get_mask_cnt(type);
> > +       if (!cnt)
> > +               return 0;
> > +
> > +       /* we allow 'codes_size > size' for forward-compat */
> > +       size = sizeof(unsigned long) * BITS_TO_LONGS(cnt);
> > +
> > +       mask = kzalloc(size, GFP_KERNEL);
> > +       if (!mask)
> > +               return -ENOMEM;
> > +
> > +       if (copy_from_user(mask, codes, min_t(size_t, codes_size, size))) {
> > +               kfree(mask);
> > +               return -EFAULT;
> > +       }
> > +
> > +       spin_lock_irqsave(&client->buffer_lock, flags);
> > +       oldmask = client->evmasks[type];
> > +       client->evmasks[type] = mask;
> > +       spin_unlock_irqrestore(&client->buffer_lock, flags);
> > +
> > +       kfree(oldmask);
> > +
> > +       return 0;
> > +}
> > +
> > +/* must be called with evdev-mutex held */
> > +static int evdev_get_mask(struct evdev_client *client,
> > +                         unsigned int type,
> > +                         void __user *codes,
> > +                         u32 codes_size)
> > +{
> > +       unsigned long *mask;
> > +       size_t cnt, size, min, i;
> > +       u8 __user *out;
> > +
> > +       /* we allow unknown types and 'codes_size > size' for forward-compat */
> > +       cnt = evdev_get_mask_cnt(type);
> > +       size = sizeof(unsigned long) * BITS_TO_LONGS(cnt);
> > +       min = min_t(size_t, codes_size, size);
> > +
> > +       if (cnt > 0) {
> > +               mask = client->evmasks[type];
> > +               if (mask) {
> > +                       if (copy_to_user(codes, mask, min))
> > +                               return -EFAULT;

I do not think this will work on big-endian setups with 64 bit kernel
and 32 bits userspace. We already have bits_to_user(), we shoudl use
them here. And I guess we need bits_from_user() to fetch bits from
userspace into kernel.

I also tried changing verbage on the ioctls, see if you agree with the
changes and if so please incorporate in your next version.

Thanks.

-- 
Dmitry

diff -u b/drivers/input/evdev.c b/drivers/input/evdev.c
--- b/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -71,7 +71,7 @@
 		[EV_FF] = FF_CNT,
 	};
 
-	return (type < EV_CNT) ? counts[type] : 0;
+	return type < EV_CNT ? counts[type] : 0;
 }
 
 /* must be called with evdev-mutex held */
@@ -132,7 +132,7 @@
 				return -EFAULT;
 		} else {
 			/* fake mask with all bits set */
-			out = (u8 __user*)codes;
+			out = (u8 __user *)codes;
 			for (i = 0; i < min; ++i) {
 				if (put_user((u8)0xff,  out + i))
 					return -EFAULT;
diff -u b/include/uapi/linux/input.h b/include/uapi/linux/input.h
--- b/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -161,53 +161,59 @@
 #define EVIOCREVOKE		_IOW('E', 0x91, int)			/* Revoke device access */
 
 /**
- * EVIOCGMASK - Retrieve current event-mask
+ * EVIOCGMASK - Retrieve current event mask
  *
- * This retrieves the current event-mask for a specific event-type. The
- * argument must be of type "struct input_mask" and specifies the event-type to
- * query, the receive buffer and the size of the receive buffer.
- *
- * The event-mask is a per-client mask that specifies which events are forwarded
- * to the client. Each event-code is represented by a single bit in the
- * event-mask. If the bit is set, the event is passed to the client normally.
- * Otherwise, the event is filtered and and will never be queued on the
- * client's receive buffer.
- * Event-masks do not affect global state of an input-device. They only affect
- * the open-file they're applied on. Each open-file (i.e, file-description) can
- * have a different event-mask.
- *
- * The default event-mask for a client has all bits set, i.e. all events are
- * forwarded to the client. If a kernel is queried for an unknown event-type
- * or if the receive buffer is larger than the number of event-codes known to
- * the kernel, the kernel returns all zeroes for those codes.
+ * This ioctl allows user to retrieve the current event mask for specific
+ * event type. The argument must be of type "struct input_mask" and
+ * specifies the event type to query, the address of the receive buffer and
+ * the size of the receive buffer.
+ *
+ * The event mask is a per-client mask that specifies which events are
+ * forwarded to the client. Each event code is represented by a single bit
+ * in the event mask. If the bit is set, the event is passed to the client
+ * normally. Otherwise, the event is filtered and will never be queued on
+ * the client's receive buffer.
+ *
+ * Event masks do not affect global state of the input device. They only
+ * affect the file descriptor they are applied to.
+ *
+ * The default event mask for a client has all bits set, i.e. all events
+ * are forwarded to the client. If kernel is queried for an unknown
+ * event type or if the receive buffer is larger than the number of
+ * event codes known to the kernel, the kernel returns all zeroes for those
+ * codes.
  *
  * At maximum, codes_size bytes are copied.
  *
- * This ioctl may fail with ENODEV in case the file is revoked, EFAULT
- * if the receive-buffer points to invalid memory, or EINVAL if the kernel
- * does not implement the ioctl.
+ * This ioctl may fail with ENODEV in case the descriptor is revoked,
+ * EFAULT if the receive buffer points to invalid memory, or EINVAL if the
+ * kernel does not implement the ioctl.
  */
+
 #define EVIOCGMASK		_IOR('E', 0x92, struct input_mask)	/* Get event-masks */
 
 /**
- * EVIOCSMASK - Set event-mask
+ * EVIOCSMASK - Set event mask
  *
- * This is the counterpart to EVIOCGMASK. Instead of receiving the current
- * event-mask, this changes the client's event-mask for a specific type. See
- * EVIOCGMASK for a description of event-masks and the argument-type.
- *
- * This ioctl provides full forward-compatibility. If the passed event-type is
- * unknown to the kernel, or if the number of codes is bigger than known to the
- * kernel, the ioctl is still accepted and applied. However, any unknown codes
- * are left untouched and stay cleared. That means, the kernel always filters
- * unknown codes regardless of what the client requests.
- * If the new mask doesn't cover all known event-codes, all remaining codes are
- * automatically cleared and thus filtered.
+ * This ioctl is the counterpart to EVIOCGMASK. Instead of receiving the
+ * current event mask, this changes the client's event mask for a specific
+ * type.  See EVIOCGMASK for a description of event-masks and the
+ * argument-type.
+ *
+ * This ioctl provides full forward compatibility. If the passed event type
+ * is unknown to the kernel, or if the number of event codes specified in
+ * the mask is bigger than what is known to the kernel, the ioctl is still
+ * accepted and applied. However, any unknown codes are left untouched and
+ * stay cleared. That means, the kernel always filters unknown codes
+ * regardless of what the client requests.  If the new mask doesn't cover
+ * all known event-codes, all remaining codes are automatically cleared and
+ * thus filtered.
  *
  * This ioctl may fail with ENODEV in case the file is revoked. EFAULT is
- * returned if the receive-buffer points to invalid memory. EINVAL is returned
- * if the kernel does not implement the ioctl.
+ * returned if the receive-buffer points to invalid memory. EINVAL is
+ * returned if the kernel does not implement the ioctl.
  */
+
 #define EVIOCSMASK		_IOW('E', 0x93, struct input_mask)	/* Set event-masks */
 
 #define EVIOCSCLOCKID		_IOW('E', 0xa0, int)			/* Set clockid to be used for timestamps */

^ permalink raw reply

* Re: Synaptics, CAP_FORCEPAD, bad behavior
From: Dmitry Torokhov @ 2014-10-09 17:28 UTC (permalink / raw)
  To: Nicole Faerber, Christopher Heiny, Andrew Duggan; +Cc: linux-input
In-Reply-To: <20141009165246.GA18213@dtor-ws>

On Thu, Oct 09, 2014 at 09:52:46AM -0700, Dmitry Torokhov wrote:
> On Thu, Oct 09, 2014 at 11:34:26AM +0200, Nicole Faerber wrote:
> > Hi!
> > Just installed the just released 3.17 kernel and found a bad behavior of
> > the new Synaptics driver on my Thinkpad Yoga which has the new Synaptics
> > clickpad enabled touchpad:
> > 
> > psmouse serio1: synaptics: Touchpad model: 1, fw: 8.1, id: 0x1e2b1,
> > caps: 0xd002a3/0x940300/0x12f800, board id: 2911, fw id: 2560
> > 
> > The issue is that now a button release is only issued after the finger
> > has completely left the touchpad and not when releasing the physical
> > button. Is this physical button now called FORCEPAD? Anyway, this is
> > pretty annoying. Double clicking become a real pain.
> > I did comment out the new
> > 
> > 	if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) {
> > 	...
> > 
> > and everything is back to normal again, i.e. when I do release the pad
> > physical button but keep the finger on the pad, the button release event
> > is issued properly.
> 
> Hmm, the forcepad code should only activate if the devoice do4es not
> have physical buttons at all. Let me see what's the diffference in
> capabilities between your and mine touchpads...

OK, so your extended caps are 0x12f800 while on my forcepad they are
0x12e800. The forcepad bit is supposed to be bit 15, so it is set for
both our devices, but bit 12 (counting from 0) is different.

Andrew, Chris, could you please tell us what bit 12 indicates? In fact,
if you could share the updated description for all currently defined
capability bits that would be awesome.

Thanks!

-- 
Dmitry

^ permalink raw reply

* Re: Synaptics, CAP_FORCEPAD, bad behavior
From: Dmitry Torokhov @ 2014-10-09 16:52 UTC (permalink / raw)
  To: Nicole Faerber; +Cc: linux-input
In-Reply-To: <543656A2.4080009@kernelconcepts.de>

On Thu, Oct 09, 2014 at 11:34:26AM +0200, Nicole Faerber wrote:
> Hi!
> Just installed the just released 3.17 kernel and found a bad behavior of
> the new Synaptics driver on my Thinkpad Yoga which has the new Synaptics
> clickpad enabled touchpad:
> 
> psmouse serio1: synaptics: Touchpad model: 1, fw: 8.1, id: 0x1e2b1,
> caps: 0xd002a3/0x940300/0x12f800, board id: 2911, fw id: 2560
> 
> The issue is that now a button release is only issued after the finger
> has completely left the touchpad and not when releasing the physical
> button. Is this physical button now called FORCEPAD? Anyway, this is
> pretty annoying. Double clicking become a real pain.
> I did comment out the new
> 
> 	if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) {
> 	...
> 
> and everything is back to normal again, i.e. when I do release the pad
> physical button but keep the finger on the pad, the button release event
> is issued properly.

Hmm, the forcepad code should only activate if the devoice do4es not
have physical buttons at all. Let me see what's the diffference in
capabilities between your and mine touchpads...

Thanks.

-- 
Dmitry

^ permalink raw reply

* [PATCH] input: fix BTN_TOUCH reporting in input_mt_report_pointer_emulation for hovering finger
From: Chung-yih Wang @ 2014-10-09 13:31 UTC (permalink / raw)
  To: linux-input
  Cc: Henrik Rydberg, Dmitry Torokhov, benjamin.tissoires,
	Chung-yih Wang

  From the definition of BTN_TOUCH, BTN_TOOL_<name> and BTN_TOUCH codes are
orthogonal. BTN_TOUCH should be zero if there is no physical contact, e.g.
hovering finger, happened on device. The patch uses touch_count and finger_count
to get the final reporting code for BTN_TOUCH and BTN_TOOL_<name>,
respectively. In addition, as there are some hard-coded pressure thresholds
defined in touch device's driver classes, 'touch_threshold' is introduced into
struct input_dev in order to tell if a finger is considered as a touch one in
input_mt_report_pointer_emulation().

---
 drivers/input/input-mt.c | 15 ++++++++++-----
 include/linux/input.h    |  2 ++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index fbe29fc..47e41d6 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -192,18 +192,21 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
 {
 	struct input_mt *mt = dev->mt;
 	struct input_mt_slot *oldest;
-	int oldid, count, i;
+	int oldid, i;
+	int touch_count, finger_count;
 
 	if (!mt)
 		return;
 
 	oldest = NULL;
 	oldid = mt->trkid;
-	count = 0;
+	touch_count = 0;
+	finger_count = 0;
 
 	for (i = 0; i < mt->num_slots; ++i) {
 		struct input_mt_slot *ps = &mt->slots[i];
 		int id = input_mt_get_value(ps, ABS_MT_TRACKING_ID);
+		int pressure = input_mt_get_value(ps, ABS_MT_PRESSURE);
 
 		if (id < 0)
 			continue;
@@ -211,12 +214,14 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
 			oldest = ps;
 			oldid = id;
 		}
-		count++;
+		finger_count++;
+		if (pressure > dev->touch_threshold)
+			touch_count++;
 	}
 
-	input_event(dev, EV_KEY, BTN_TOUCH, count > 0);
+	input_event(dev, EV_KEY, BTN_TOUCH, touch_count > 0);
 	if (use_count)
-		input_mt_report_finger_count(dev, count);
+		input_mt_report_finger_count(dev, finger_count);
 
 	if (oldest) {
 		int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
diff --git a/include/linux/input.h b/include/linux/input.h
index 82ce323..5b2739d 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -187,6 +187,8 @@ struct input_dev {
 	struct input_value *vals;
 
 	bool devres_managed;
+
+	unsigned int touch_threshold;
 };
 #define to_input_dev(d) container_of(d, struct input_dev, dev)
 
-- 
2.0.0.526.g5318336


^ permalink raw reply related

* Synaptics, CAP_FORCEPAD, bad behavior
From: Nicole Faerber @ 2014-10-09  9:34 UTC (permalink / raw)
  To: linux-input

Hi!
Just installed the just released 3.17 kernel and found a bad behavior of
the new Synaptics driver on my Thinkpad Yoga which has the new Synaptics
clickpad enabled touchpad:

psmouse serio1: synaptics: Touchpad model: 1, fw: 8.1, id: 0x1e2b1,
caps: 0xd002a3/0x940300/0x12f800, board id: 2911, fw id: 2560

The issue is that now a button release is only issued after the finger
has completely left the touchpad and not when releasing the physical
button. Is this physical button now called FORCEPAD? Anyway, this is
pretty annoying. Double clicking become a real pain.
I did comment out the new

	if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) {
	...

and everything is back to normal again, i.e. when I do release the pad
physical button but keep the finger on the pad, the button release event
is issued properly.

Cheers
  nicole

-- 
kernel concepts GmbH      Tel: +49-271-771091-12
Sieghuetter Hauptweg 48
D-57072 Siegen
http://www.kernelconcepts.de

^ permalink raw reply

* Re: [PATCH] Input: Add Microchip AR1021 i2c touchscreen
From: Christian Gmeiner @ 2014-10-09  7:39 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input
In-Reply-To: <20141008175649.GB14423@dtor-ws>

Hi Dmitry,

> On Wed, Oct 08, 2014 at 04:45:18PM +0200, Christian Gmeiner wrote:
>> +static irqreturn_t ar1021_i2c_irq(int irq, void *dev_id)
>> +{
>> +     struct ar1021_i2c *ar1021 = dev_id;
>> +     struct input_dev *input = ar1021->input;
>> +     u8 *data = ar1021->data;
>> +     unsigned int x, y, button;
>> +     int error;
>> +
>> +     error = i2c_master_recv(ar1021->client,
>> +                             ar1021->data, sizeof(ar1021->data));
>> +     if (error < 0)
>
> I think this check should be "if (retval != sizeof(ar1021->data))" to
> avoid using garbage data in case of short read. I'll change it locally
> and apply the patch.

Sounds good to me.

thanks
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner

^ permalink raw reply

* Re: [PATCH v2] HID: wacom: Prevent potential null dereference after disconnect
From: Jason Gerecke @ 2014-10-09  2:08 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jiri Kosina, Benjamin Tissoires, Ping Cheng, Linux Input,
	linux-kernel
In-Reply-To: <20141009002800.GJ15198@dtor-ws>

On Wed, Oct 8, 2014 at 5:28 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, Oct 08, 2014 at 05:24:32PM -0700, Jason Gerecke wrote:
>> On Wed, Oct 8, 2014 at 2:40 PM, Dmitry Torokhov
>> <dmitry.torokhov@gmail.com> wrote:
>> > On Wed, Oct 08, 2014 at 11:25:42AM -0700, Jason Gerecke wrote:
>> >> Repeated connect/disconnect cycles under GNOME can trigger an occasional
>> >> OOPS from within e.g. wacom_led_select_store, presumably due to a timing
>> >> issue where userspace begins setting a value immediately before the
>> >> device disconnects and our shared data is whisked away.
>> >>
>> >> Signed-off-by: Jason Gerecke <killertofu@gmail.com>
>> >> ---
>> >> Changes in v2:
>> >>  * Added in missing escape character
>> >>
>> >>  drivers/hid/wacom_sys.c | 13 ++++++++++++-
>> >>  1 file changed, 12 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
>> >> index 8593047..265429b 100644
>> >> --- a/drivers/hid/wacom_sys.c
>> >> +++ b/drivers/hid/wacom_sys.c
>> >> @@ -641,6 +641,9 @@ static ssize_t wacom_led_select_store(struct device *dev, int set_id,
>> >>       unsigned int id;
>> >>       int err;
>> >>
>> >> +     if (!wacom)
>> >> +             return -ENODEV;
>> >> +
>> >
>> > Strong NAK. If device could disappear before this check it could as well
>> > disappear after your check.
>> >
>> > This patch does not solve anything.
>> >
>>
>> I assume I'll want to either disable interrupts or take a lock
>> depending on if `wacom_remove` is called from within the interrupt
>> context, but I haven't had to deal with concurrency in the kernel
>> before so I'm not entirely sure which option (or which primitive if
>> locking) would be appropriate...
>
> Actually the sysfs core should not allow anyone descend into sysfs
> show/store methods once you return from sysfs_remove*(). So you need to
> make sure that pointer is valid until then.
>
> Thanks.
>
> --
> Dmitry

Hmm. That's odd. The `wacom_remove` function calls
`wacom_destroy_leds` (which is responsible for removing those sysfs
nodes) prior to calling `wacom_remove_shared_data` (which is
responsible for freeing that pointer). I could imagine that a
disconnect which occurred after the sysfs checks were satisfied but
before our function was called would be able to get around that, but I
don't know if the kernel can be interrupted while the sysfs write is
being handled. I'll double-check what the actual state of things is
when the OOPS happens...

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one  /
(That is to say, eight) to the two,     /
But you can’t take seven from three,    /
So you look at the sixty-fours....
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v2] HID: wacom: Prevent potential null dereference after disconnect
From: Dmitry Torokhov @ 2014-10-09  0:28 UTC (permalink / raw)
  To: Jason Gerecke
  Cc: Jiri Kosina, Benjamin Tissoires, Ping Cheng, Linux Input,
	linux-kernel
In-Reply-To: <CANRwn3TFS-jLwgjwautrofmuJ07PASBXMbTWocj3WQxQX3D6tg@mail.gmail.com>

On Wed, Oct 08, 2014 at 05:24:32PM -0700, Jason Gerecke wrote:
> On Wed, Oct 8, 2014 at 2:40 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Wed, Oct 08, 2014 at 11:25:42AM -0700, Jason Gerecke wrote:
> >> Repeated connect/disconnect cycles under GNOME can trigger an occasional
> >> OOPS from within e.g. wacom_led_select_store, presumably due to a timing
> >> issue where userspace begins setting a value immediately before the
> >> device disconnects and our shared data is whisked away.
> >>
> >> Signed-off-by: Jason Gerecke <killertofu@gmail.com>
> >> ---
> >> Changes in v2:
> >>  * Added in missing escape character
> >>
> >>  drivers/hid/wacom_sys.c | 13 ++++++++++++-
> >>  1 file changed, 12 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> >> index 8593047..265429b 100644
> >> --- a/drivers/hid/wacom_sys.c
> >> +++ b/drivers/hid/wacom_sys.c
> >> @@ -641,6 +641,9 @@ static ssize_t wacom_led_select_store(struct device *dev, int set_id,
> >>       unsigned int id;
> >>       int err;
> >>
> >> +     if (!wacom)
> >> +             return -ENODEV;
> >> +
> >
> > Strong NAK. If device could disappear before this check it could as well
> > disappear after your check.
> >
> > This patch does not solve anything.
> >
> 
> I assume I'll want to either disable interrupts or take a lock
> depending on if `wacom_remove` is called from within the interrupt
> context, but I haven't had to deal with concurrency in the kernel
> before so I'm not entirely sure which option (or which primitive if
> locking) would be appropriate...

Actually the sysfs core should not allow anyone descend into sysfs
show/store methods once you return from sysfs_remove*(). So you need to
make sure that pointer is valid until then.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v2] HID: wacom: Prevent potential null dereference after disconnect
From: Jason Gerecke @ 2014-10-09  0:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jiri Kosina, Benjamin Tissoires, Ping Cheng, Linux Input,
	linux-kernel
In-Reply-To: <20141008214045.GF15198@dtor-ws>

On Wed, Oct 8, 2014 at 2:40 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, Oct 08, 2014 at 11:25:42AM -0700, Jason Gerecke wrote:
>> Repeated connect/disconnect cycles under GNOME can trigger an occasional
>> OOPS from within e.g. wacom_led_select_store, presumably due to a timing
>> issue where userspace begins setting a value immediately before the
>> device disconnects and our shared data is whisked away.
>>
>> Signed-off-by: Jason Gerecke <killertofu@gmail.com>
>> ---
>> Changes in v2:
>>  * Added in missing escape character
>>
>>  drivers/hid/wacom_sys.c | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
>> index 8593047..265429b 100644
>> --- a/drivers/hid/wacom_sys.c
>> +++ b/drivers/hid/wacom_sys.c
>> @@ -641,6 +641,9 @@ static ssize_t wacom_led_select_store(struct device *dev, int set_id,
>>       unsigned int id;
>>       int err;
>>
>> +     if (!wacom)
>> +             return -ENODEV;
>> +
>
> Strong NAK. If device could disappear before this check it could as well
> disappear after your check.
>
> This patch does not solve anything.
>

I assume I'll want to either disable interrupts or take a lock
depending on if `wacom_remove` is called from within the interrupt
context, but I haven't had to deal with concurrency in the kernel
before so I'm not entirely sure which option (or which primitive if
locking) would be appropriate...

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one  /
(That is to say, eight) to the two,     /
But you can’t take seven from three,    /
So you look at the sixty-fours....

>>       err = kstrtouint(buf, 10, &id);
>>       if (err)
>>               return err;
>
> Thanks.
>
> --
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] serio: avoid negative serio device numbers
From: Dmitry Torokhov @ 2014-10-08 22:22 UTC (permalink / raw)
  To: Richard Leitner; +Cc: linux-input, linux-kernel, richard.leitner
In-Reply-To: <20141008235427.55d0963f@frodo>

On Wed, Oct 08, 2014 at 11:54:27PM +0200, Richard Leitner wrote:
> From: Richard Leitner <richard.leitner@skidata.com>
> 
> Fix the format string for serio device name generation to avoid negative
> device numbers when the id exceeds the maximum signed integer value.
> 
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>

Applied, thank you.

> ---
>  drivers/input/serio/serio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
> index b29134d..d399b8b 100644
> --- a/drivers/input/serio/serio.c
> +++ b/drivers/input/serio/serio.c
> @@ -524,8 +524,8 @@ static void serio_init_port(struct serio *serio)
>  	spin_lock_init(&serio->lock);
>  	mutex_init(&serio->drv_mutex);
>  	device_initialize(&serio->dev);
> -	dev_set_name(&serio->dev, "serio%ld",
> -			(long)atomic_inc_return(&serio_no) - 1);
> +	dev_set_name(&serio->dev, "serio%lu",
> +		     (unsigned long)atomic_inc_return(&serio_no) - 1);
>  	serio->dev.bus = &serio_bus;
>  	serio->dev.release = serio_release_port;
>  	serio->dev.groups = serio_device_attr_groups;
> -- 
> 2.1.1
> 

-- 
Dmitry

^ permalink raw reply

* [PATCH] serio: avoid negative serio device numbers
From: Richard Leitner @ 2014-10-08 21:54 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, richard.leitner

From: Richard Leitner <richard.leitner@skidata.com>

Fix the format string for serio device name generation to avoid negative
device numbers when the id exceeds the maximum signed integer value.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 drivers/input/serio/serio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index b29134d..d399b8b 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -524,8 +524,8 @@ static void serio_init_port(struct serio *serio)
 	spin_lock_init(&serio->lock);
 	mutex_init(&serio->drv_mutex);
 	device_initialize(&serio->dev);
-	dev_set_name(&serio->dev, "serio%ld",
-			(long)atomic_inc_return(&serio_no) - 1);
+	dev_set_name(&serio->dev, "serio%lu",
+		     (unsigned long)atomic_inc_return(&serio_no) - 1);
 	serio->dev.bus = &serio_bus;
 	serio->dev.release = serio_release_port;
 	serio->dev.groups = serio_device_attr_groups;
-- 
2.1.1


^ permalink raw reply related

* Re: [PATCH] input: avoid negative input device numbers
From: Richard Leitner @ 2014-10-08 21:49 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, richard.leitner
In-Reply-To: <20141008213051.GD15198@dtor-ws>

On Wed, 8 Oct 2014 14:30:51 -0700
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:

> On Wed, Oct 08, 2014 at 02:25:38PM -0700, Dmitry Torokhov wrote:
> > On Wed, Oct 08, 2014 at 10:42:45PM +0200, Richard Leitner wrote:
> > > From: Richard Leitner <richard.leitner@skidata.com>
> > > 
> > > Fix the format string for input device name generation to avoid
> > > negative device numbers when the id exceeds the maximum signed
> > > integer value.
> > 
> > Well, it is going to take us a while to get there :)
> > 
> > Applied, thank you.
> 
> By the way, we have similar issue in serio and gameport code, mind
> sending fixes for them as well?
> 
I'll send a patch for the serio in a few minutes.

The gameport code looks fine to me:

536		dev_set_name(&gameport->dev, "gameport%lu",
537				(unsigned long)atomic_inc_return(&gameport_no) - 1);

regards,
richard

^ permalink raw reply

* Re: [PATCH v2] HID: wacom: Prevent potential null dereference after disconnect
From: Dmitry Torokhov @ 2014-10-08 21:40 UTC (permalink / raw)
  To: Jason Gerecke
  Cc: jkosina, benjamin.tissoires, pinglinux, linux-input, linux-kernel
In-Reply-To: <1412792742-4075-1-git-send-email-killertofu@gmail.com>

On Wed, Oct 08, 2014 at 11:25:42AM -0700, Jason Gerecke wrote:
> Repeated connect/disconnect cycles under GNOME can trigger an occasional
> OOPS from within e.g. wacom_led_select_store, presumably due to a timing
> issue where userspace begins setting a value immediately before the
> device disconnects and our shared data is whisked away.
> 
> Signed-off-by: Jason Gerecke <killertofu@gmail.com>
> ---
> Changes in v2:
>  * Added in missing escape character
> 
>  drivers/hid/wacom_sys.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 8593047..265429b 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -641,6 +641,9 @@ static ssize_t wacom_led_select_store(struct device *dev, int set_id,
>  	unsigned int id;
>  	int err;
>  
> +	if (!wacom)
> +		return -ENODEV;
> +

Strong NAK. If device could disappear before this check it could as well
disappear after your check.

This patch does not solve anything.

>  	err = kstrtouint(buf, 10, &id);
>  	if (err)
>  		return err;

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: avoid negative input device numbers
From: Dmitry Torokhov @ 2014-10-08 21:30 UTC (permalink / raw)
  To: Richard Leitner; +Cc: linux-input, linux-kernel, richard.leitner
In-Reply-To: <20141008212538.GB15198@dtor-ws>

On Wed, Oct 08, 2014 at 02:25:38PM -0700, Dmitry Torokhov wrote:
> On Wed, Oct 08, 2014 at 10:42:45PM +0200, Richard Leitner wrote:
> > From: Richard Leitner <richard.leitner@skidata.com>
> > 
> > Fix the format string for input device name generation to avoid negative
> > device numbers when the id exceeds the maximum signed integer value.
> 
> Well, it is going to take us a while to get there :)
> 
> Applied, thank you.

By the way, we have similar issue in serio and gameport code, mind
sending fixes for them as well?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [RFC] avoid (theoretical) conflicts of input device file names
From: Dmitry Torokhov @ 2014-10-08 21:30 UTC (permalink / raw)
  To: Richard Leitner; +Cc: linux-input, linux-kernel, richard.leitner
In-Reply-To: <20141008224929.290e6403@frodo>

Hi Richard,

On Wed, Oct 08, 2014 at 10:49:29PM +0200, Richard Leitner wrote:
> Hi,
> currently I discovered the possibility that device file numbers of the input
> subsystem could go negative when the signed int "border" is passed. To fix
> this behaviour I sent a patch a few minutes ago.
> 
> But as the subject says there is currently the (theoretical) possibility that
> the same input device file name is given out twice. This can happen if the
> "input_no" variable had an overflow (due to the fact this is at least at 2^32
> I call the issue theoretical). If such a case occurs a -EEXISTS is returned at
> the creation of the file.
> 
> IMHO it would be a good idea to check if the chosen input device file name
> is valid at the point it is created (which is currently input_allocate_device).
> So you can just increment and check it again until there's a valid number/name
> found for it.
> 
> I'm pretty new to the input subsystem, so what do you think about it?
> Any comments/ideas? Would there be a better place to do such checking?

I do not think it is worth checking. Yes, theoretically you can wrap
around, but practically instantiating at least 2^32 devices will take
too long. If ever it becomes a concern my very distant future relatives
will move the counter to 64 or 128 bit and call it a day.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: avoid negative input device numbers
From: Dmitry Torokhov @ 2014-10-08 21:25 UTC (permalink / raw)
  To: Richard Leitner; +Cc: linux-input, linux-kernel, richard.leitner
In-Reply-To: <20141008224245.601a1339@frodo>

On Wed, Oct 08, 2014 at 10:42:45PM +0200, Richard Leitner wrote:
> From: Richard Leitner <richard.leitner@skidata.com>
> 
> Fix the format string for input device name generation to avoid negative
> device numbers when the id exceeds the maximum signed integer value.

Well, it is going to take us a while to get there :)

Applied, thank you.


> 
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> ---
>  drivers/input/input.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 236bc56..6be6982 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -1791,7 +1791,7 @@ struct input_dev *input_allocate_device(void)
>  		INIT_LIST_HEAD(&dev->h_list);
>  		INIT_LIST_HEAD(&dev->node);
>  
> -		dev_set_name(&dev->dev, "input%ld",
> +		dev_set_name(&dev->dev, "input%lu",
>  			     (unsigned long) atomic_inc_return(&input_no) - 1);
>  
>  		__module_get(THIS_MODULE);
> -- 
> 2.1.1
> 

-- 
Dmitry

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox