Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH 10/13] Input: egalax_ts - Make of_device_id array const
From: Jingoo Han @ 2014-05-07  9:23 UTC (permalink / raw)
  To: 'Dmitry Torokhov'
  Cc: 'Dmitry Torokhov', linux-input, 'Jingoo Han',
	'Zhang Jiejing'
In-Reply-To: <022e01cf69d4$62d1e5e0$2875b1a0$%han@samsung.com>

Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/input/touchscreen/egalax_ts.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
index e6bcb13..c805784 100644
--- a/drivers/input/touchscreen/egalax_ts.c
+++ b/drivers/input/touchscreen/egalax_ts.c
@@ -262,7 +262,7 @@ static int egalax_ts_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume);
 
-static struct of_device_id egalax_ts_dt_ids[] = {
+static const struct of_device_id egalax_ts_dt_ids[] = {
 	{ .compatible = "eeti,egalax_ts" },
 	{ /* sentinel */ }
 };
-- 
1.7.10.4



^ permalink raw reply related

* PATCH 11/13] Input: lpc32xx_ts - Make of_device_id array const
From: Jingoo Han @ 2014-05-07  9:24 UTC (permalink / raw)
  To: 'Dmitry Torokhov'
  Cc: 'Dmitry Torokhov', linux-input, 'Jingoo Han',
	'Roland Stigge'
In-Reply-To: <022e01cf69d4$62d1e5e0$2875b1a0$%han@samsung.com>

Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/input/touchscreen/lpc32xx_ts.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c
index 2058253..bb47d34 100644
--- a/drivers/input/touchscreen/lpc32xx_ts.c
+++ b/drivers/input/touchscreen/lpc32xx_ts.c
@@ -384,7 +384,7 @@ static const struct dev_pm_ops lpc32xx_ts_pm_ops = {
 #endif
 
 #ifdef CONFIG_OF
-static struct of_device_id lpc32xx_tsc_of_match[] = {
+static const struct of_device_id lpc32xx_tsc_of_match[] = {
 	{ .compatible = "nxp,lpc3220-tsc", },
 	{ },
 };
-- 
1.7.10.4



^ permalink raw reply related

* [PATCH 12/13] Input: mms114 - Make of_device_id array const
From: Jingoo Han @ 2014-05-07  9:25 UTC (permalink / raw)
  To: 'Dmitry Torokhov'
  Cc: 'Dmitry Torokhov', linux-input, 'Jingoo Han',
	'Joonyoung Shim'
In-Reply-To: <022e01cf69d4$62d1e5e0$2875b1a0$%han@samsung.com>

Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/input/touchscreen/mms114.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index 8a598c0..9d83413 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -570,7 +570,7 @@ static const struct i2c_device_id mms114_id[] = {
 MODULE_DEVICE_TABLE(i2c, mms114_id);
 
 #ifdef CONFIG_OF
-static struct of_device_id mms114_dt_match[] = {
+static const struct of_device_id mms114_dt_match[] = {
 	{ .compatible = "melfas,mms114" },
 	{ }
 };
-- 
1.7.10.4



^ permalink raw reply related

* [PATCH 13/13] Input: zforce - Make of_device_id array const
From: Jingoo Han @ 2014-05-07  9:26 UTC (permalink / raw)
  To: 'Dmitry Torokhov'
  Cc: 'Dmitry Torokhov', linux-input, 'Jingoo Han',
	'Heiko Stübner'
In-Reply-To: <022e01cf69d4$62d1e5e0$2875b1a0$%han@samsung.com>

Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/input/touchscreen/zforce_ts.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index 01d30ce..feea85b 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -880,7 +880,7 @@ static struct i2c_device_id zforce_idtable[] = {
 MODULE_DEVICE_TABLE(i2c, zforce_idtable);
 
 #ifdef CONFIG_OF
-static struct of_device_id zforce_dt_idtable[] = {
+static const struct of_device_id zforce_dt_idtable[] = {
 	{ .compatible = "neonode,zforce" },
 	{},
 };
-- 
1.7.10.4



^ permalink raw reply related

* Re: [PATCH 09/13] Input: auo-pixcir-ts - Make of_device_id array const
From: Heiko Stübner @ 2014-05-07  9:30 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Dmitry Torokhov', 'Dmitry Torokhov', linux-input
In-Reply-To: <023601cf69d5$d2f7f610$78e7e230$%han@samsung.com>

Am Mittwoch, 7. Mai 2014, 18:22:10 schrieb Jingoo Han:
> Make of_device_id array const, because all OF functions
> handle it as const.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>

> ---
>  drivers/input/touchscreen/auo-pixcir-ts.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c
> b/drivers/input/touchscreen/auo-pixcir-ts.c index d3f9f6b..7f3c947 100644
> --- a/drivers/input/touchscreen/auo-pixcir-ts.c
> +++ b/drivers/input/touchscreen/auo-pixcir-ts.c
> @@ -679,7 +679,7 @@ static const struct i2c_device_id auo_pixcir_idtable[] =
> { MODULE_DEVICE_TABLE(i2c, auo_pixcir_idtable);
> 
>  #ifdef CONFIG_OF
> -static struct of_device_id auo_pixcir_ts_dt_idtable[] = {
> +static const struct of_device_id auo_pixcir_ts_dt_idtable[] = {
>  	{ .compatible = "auo,auo_pixcir_ts" },
>  	{},
>  };


^ permalink raw reply

* Re: [PATCH 13/13] Input: zforce - Make of_device_id array const
From: Heiko Stübner @ 2014-05-07  9:30 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Dmitry Torokhov', 'Dmitry Torokhov', linux-input
In-Reply-To: <023a01cf69d6$6b46beb0$41d43c10$%han@samsung.com>

Am Mittwoch, 7. Mai 2014, 18:26:25 schrieb Jingoo Han:
> Make of_device_id array const, because all OF functions
> handle it as const.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>

> ---
>  drivers/input/touchscreen/zforce_ts.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/zforce_ts.c
> b/drivers/input/touchscreen/zforce_ts.c index 01d30ce..feea85b 100644
> --- a/drivers/input/touchscreen/zforce_ts.c
> +++ b/drivers/input/touchscreen/zforce_ts.c
> @@ -880,7 +880,7 @@ static struct i2c_device_id zforce_idtable[] = {
>  MODULE_DEVICE_TABLE(i2c, zforce_idtable);
> 
>  #ifdef CONFIG_OF
> -static struct of_device_id zforce_dt_idtable[] = {
> +static const struct of_device_id zforce_dt_idtable[] = {
>  	{ .compatible = "neonode,zforce" },
>  	{},
>  };


^ permalink raw reply

* Re: PATCH 11/13] Input: lpc32xx_ts - Make of_device_id array const
From: Roland Stigge @ 2014-05-07  9:36 UTC (permalink / raw)
  To: Jingoo Han, 'Dmitry Torokhov'
  Cc: 'Dmitry Torokhov', linux-input
In-Reply-To: <023801cf69d6$36ce6ed0$a46b4c70$%han@samsung.com>

On 05/07/2014 11:24 AM, Jingoo Han wrote:
> Make of_device_id array const, because all OF functions
> handle it as const.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/input/touchscreen/lpc32xx_ts.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c
> index 2058253..bb47d34 100644
> --- a/drivers/input/touchscreen/lpc32xx_ts.c
> +++ b/drivers/input/touchscreen/lpc32xx_ts.c
> @@ -384,7 +384,7 @@ static const struct dev_pm_ops lpc32xx_ts_pm_ops = {
>  #endif
>  
>  #ifdef CONFIG_OF
> -static struct of_device_id lpc32xx_tsc_of_match[] = {
> +static const struct of_device_id lpc32xx_tsc_of_match[] = {
>  	{ .compatible = "nxp,lpc3220-tsc", },
>  	{ },
>  };
> 

Acked-by: Roland Stigge <stigge@antcom.de>

^ permalink raw reply

* [RFC/PATCH 0/3] add adp5589 dt support
From: Guido Martínez @ 2014-05-07 13:00 UTC (permalink / raw)
  To: robh+dt
  Cc: devicetree, Ezequiel García, dmitry.torokhov, linux-input,
	LKML, Guido Martínez

This patchset enables adp5589 keypad configuration via dt. Until now,
this was only done via platform data.

The adp5589 has many functions besides matrix keypad decoding. For now,
we only support keypad related functionality: including scan time and
pull resistors configuration.

  Patch 1 adds the functionality to the driver. There is a minor change
in old code to properly detect the device type if we're using DT.

  Patch 2 adds a DT include file to specify the chip lines for the pull
configuration with symbolic names.

  Patch 3 adds the binding documentation

Guido Martínez (3):
  drivers: input: keyboard: adp5589: add DT support
  DT: input: adp5589: add adp5589 include file
  DT: input: adp5589: add binding documentation

 .../devicetree/bindings/input/adp5589.txt          |  63 +++++++
 drivers/input/keyboard/adp5589-keys.c              | 207 ++++++++++++++++++++-
 include/dt-bindings/input/adp5589.h                |   7 +
 3 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/input/adp5589.txt
 create mode 100644 include/dt-bindings/input/adp5589.h

-- 
2.0.0.rc0

^ permalink raw reply

* [RFC/PATCH 1/3] drivers: input: keyboard: adp5589: add DT support
From: Guido Martínez @ 2014-05-07 13:00 UTC (permalink / raw)
  To: robh+dt
  Cc: devicetree, Ezequiel García, dmitry.torokhov, linux-input,
	LKML, Guido Martínez
In-Reply-To: <1399467644-27222-1-git-send-email-guido@vanguardiasur.com.ar>

Add DT support for the Analog ADP5589 matrix keypad decoding functions.

Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar>
---
 drivers/input/keyboard/adp5589-keys.c | 207 +++++++++++++++++++++++++++++++++-
 1 file changed, 206 insertions(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 6329549..2b232c0 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -18,7 +18,10 @@
 #include <linux/i2c.h>
 #include <linux/gpio.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/err.h>
 
+#include <linux/input/matrix_keypad.h>
 #include <linux/input/adp5589.h>
 
 /* ADP5589/ADP5585 Common Registers */
@@ -246,6 +249,14 @@ struct adp5589_kpad {
 #endif
 };
 
+static struct of_device_id adp5589_of_match[] = {
+	{
+		.compatible = "adi,adp5589",
+		.data = (void *)ADP5589
+	},
+	{ },
+};
+
 /*
  *  ADP5589 / ADP5585 derivative / variant handling
  */
@@ -858,6 +869,188 @@ static void adp5589_report_switch_state(struct adp5589_kpad *kpad)
 	input_sync(kpad->input);
 }
 
+#ifdef CONFIG_OF
+static int adp5589_key(int row, int col)
+{
+	return col + row * 11;
+}
+
+static int adp5589_dt_read_keymap(struct device *dev,
+				  struct adp5589_kpad_platform_data *pdata,
+				  const struct device_node *node)
+{
+	int i;
+	const u32 *dt_keymap;
+	unsigned short *keymap;
+	int keymap_len;
+
+	dt_keymap = of_get_property(node, "linux,keymap", &keymap_len);
+	if (!dt_keymap) {
+		dev_err(dev, "missing dt keymap\n");
+		return -ENODEV;
+	}
+
+	if (keymap_len % sizeof(u32)) {
+		dev_err(dev, "malformed keymap (len=%i)\n", keymap_len);
+		return -EINVAL;
+	}
+
+	keymap_len /= sizeof(u32);
+
+	keymap = devm_kzalloc(dev, ADP5589_KEYMAPSIZE * sizeof(u32),
+			      GFP_KERNEL);
+	if (!keymap)
+		return -ENOMEM;
+
+	for (i = 0; i < keymap_len; i++) {
+		u32 val;
+		u16 key;
+		u8 row, col;
+
+		val = be32_to_cpup(&dt_keymap[i]);
+
+		row = KEY_ROW(val);
+		col = KEY_COL(val);
+		key = KEY_VAL(val);
+
+		if (row > ADP5589_MAX_ROW_NUM) {
+			dev_err(dev, "invalid row number (%i)\n", row);
+			return -EINVAL;
+		}
+
+		if (col > ADP5589_MAX_COL_NUM) {
+			dev_err(dev, "invalid column number (%i)\n", col);
+			return -EINVAL;
+		}
+
+		pdata->keypad_en_mask |= ADP_ROW(row);
+		pdata->keypad_en_mask |= ADP_COL(col);
+
+		keymap[adp5589_key(row, col)] = key;
+	}
+
+	pdata->keymap = keymap;
+	pdata->keymapsize = ADP5589_KEYMAPSIZE;
+
+	return 0;
+}
+
+static int adp5589_dt_read_pulls(struct device *dev,
+				 struct adp5589_kpad_platform_data *pdata,
+				 const struct device_node *node)
+{
+	unsigned i;
+
+	pdata->pull_dis_mask = 0;
+	pdata->pullup_en_300k = 0;
+	pdata->pullup_en_100k = 0;
+	pdata->pulldown_en_300k = 0;
+
+	of_property_read_u32(node, "adp5589,pulldown-300k",
+			&pdata->pulldown_en_300k);
+
+	of_property_read_u32(node, "adp5589,pullup-300k",
+			&pdata->pullup_en_300k);
+
+	of_property_read_u32(node, "adp5589,pullup-100k",
+			&pdata->pullup_en_100k);
+
+	of_property_read_u32(node, "adp5589,pull-disable",
+			&pdata->pull_dis_mask);
+
+	/* Check for misconfiguration */
+	for (i = 1; i != 0; i <<= 1) {
+		int s = 0;
+
+		if (pdata->pulldown_en_300k & i)
+			s++;
+		if (pdata->pullup_en_300k & i)
+			s++;
+		if (pdata->pullup_en_100k & i)
+			s++;
+		if (pdata->pull_dis_mask & i)
+			s++;
+
+		if (s > 1) {
+			dev_err(dev, "misconfigured pull resistors\n");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
+static int adp5589_ms_to_cycle_time(unsigned t)
+{
+	if (t >= 40)
+		return ADP5589_SCAN_CYCLE_40ms;
+	else if (t >= 30)
+		return ADP5589_SCAN_CYCLE_30ms;
+	else if (t >= 20)
+		return ADP5589_SCAN_CYCLE_20ms;
+	else
+		return ADP5589_SCAN_CYCLE_10ms;
+}
+
+static int adp5589_dt_fill(struct device *dev,
+			   struct adp5589_kpad_platform_data *pdata,
+			   const struct device_node *node)
+{
+	int error;
+	u32 t;
+
+	error = adp5589_dt_read_keymap(dev, pdata, node);
+	if (error)
+		return error;
+
+	error = adp5589_dt_read_pulls(dev, pdata, node);
+	if (error)
+		return error;
+
+	if (!of_property_read_u32(node, "adp5589,scan-cycle-time-ms", &t))
+		pdata->scan_cycle_time = adp5589_ms_to_cycle_time(t);
+
+	pdata->repeat = !of_property_read_bool(node, "linux,no-autorepeat");
+
+	return 0;
+}
+
+static struct adp5589_kpad_platform_data *
+adp5589_get_dt_data(struct device *dev, int *dev_type)
+{
+	struct device_node *node;
+	const struct of_device_id *match;
+	struct adp5589_kpad_platform_data *pdata;
+	int error;
+
+	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+
+	if (!pdata)
+		return ERR_PTR(-ENOMEM);
+
+	node = dev->of_node;
+	if (!node) {
+		dev_err(dev, "dt node does not exist\n");
+		return ERR_PTR(-ENODEV);
+	}
+
+	error = adp5589_dt_fill(dev, pdata, node);
+	if (error)
+		return ERR_PTR(error);
+
+	*dev_type = (uintptr_t)match->data;
+	dev->platform_data = pdata;
+
+	return pdata;
+}
+#else
+static struct adp5589_kpad_platform_data *
+adp5589_get_dt_data(struct device *dev, int *dev_type)
+{
+	return ERR_PTR(-ENODEV);
+}
+#endif
+
 static int adp5589_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
@@ -868,6 +1061,7 @@ static int adp5589_probe(struct i2c_client *client,
 	unsigned int revid;
 	int ret, i;
 	int error;
+	int dev_type = 0;
 
 	if (!i2c_check_functionality(client->adapter,
 				     I2C_FUNC_SMBUS_BYTE_DATA)) {
@@ -876,6 +1070,16 @@ static int adp5589_probe(struct i2c_client *client,
 	}
 
 	if (!pdata) {
+		/* Try with device tree */
+		pdata = adp5589_get_dt_data(&client->dev, &dev_type);
+
+		if (IS_ERR(pdata))
+			pdata = NULL;
+	} else {
+		dev_type = id->driver_data;
+	}
+
+	if (!pdata) {
 		dev_err(&client->dev, "no platform data?\n");
 		return -EINVAL;
 	}
@@ -884,7 +1088,7 @@ static int adp5589_probe(struct i2c_client *client,
 	if (!kpad)
 		return -ENOMEM;
 
-	switch (id->driver_data) {
+	switch (dev_type) {
 	case ADP5585_02:
 		kpad->adp5585_support_row5 = true;
 	case ADP5585_01:
@@ -1101,6 +1305,7 @@ static struct i2c_driver adp5589_driver = {
 		.name = KBUILD_MODNAME,
 		.owner = THIS_MODULE,
 		.pm = &adp5589_dev_pm_ops,
+		.of_match_table = adp5589_of_match,
 	},
 	.probe = adp5589_probe,
 	.remove = adp5589_remove,
-- 
2.0.0.rc0

^ permalink raw reply related

* [RFC/PATCH 2/3] DT: input: adp5589: add adp5589 include file
From: Guido Martínez @ 2014-05-07 13:00 UTC (permalink / raw)
  To: robh+dt
  Cc: devicetree, Ezequiel García, dmitry.torokhov, linux-input,
	LKML, Guido Martínez
In-Reply-To: <1399467644-27222-1-git-send-email-guido@vanguardiasur.com.ar>

Add include file with macros ADP_COL and ADP_ROW, used to specify pull
configuration for the adp5589.

Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar>
---
 include/dt-bindings/input/adp5589.h | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 include/dt-bindings/input/adp5589.h

diff --git a/include/dt-bindings/input/adp5589.h b/include/dt-bindings/input/adp5589.h
new file mode 100644
index 0000000..5285003
--- /dev/null
+++ b/include/dt-bindings/input/adp5589.h
@@ -0,0 +1,7 @@
+#ifndef _DT_BINDINGS_INPUT_ADP5589_H
+#define _DT_BINDINGS_INPUT_ADP5589_H
+
+#define ADP_ROW(x)	(1 << (x))
+#define ADP_COL(x)	(1 << (8+(x)))
+
+#endif
-- 
2.0.0.rc0

^ permalink raw reply related

* [RFC/PATCH 3/3] DT: input: adp5589: add binding documentation
From: Guido Martínez @ 2014-05-07 13:00 UTC (permalink / raw)
  To: robh+dt
  Cc: devicetree, Ezequiel García, dmitry.torokhov, linux-input,
	LKML, Guido Martínez
In-Reply-To: <1399467644-27222-1-git-send-email-guido@vanguardiasur.com.ar>

Add documentation for the adp5589 DT binding.

Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar>
---
 .../devicetree/bindings/input/adp5589.txt          | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/adp5589.txt

diff --git a/Documentation/devicetree/bindings/input/adp5589.txt b/Documentation/devicetree/bindings/input/adp5589.txt
new file mode 100644
index 0000000..d4c295d
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/adp5589.txt
@@ -0,0 +1,63 @@
+Binding for the Analog Devices ADP5589 matrix decoder. The ADP5589 is a
+complex chip with many functions including matrix keypad decoding, reset
+event generator and gpio expansion. DT support is limited to keypad
+decoding.
+
+Required properties:
+
+- compatible: Should be "adi,adp5589"
+
+- linux,keymap: An array of packed cells each describing a mapping from
+a key to a linux keycode, as described in [1]. The macro MATRIX_KEY can
+be used to construct each mapping.
+
+Optional properties:
+
+- adp5589,scan-cycle-time-ms: The time between keymap polls in ms.
+Supported valued are 10, 20, 30 and 40. Other values are silently
+rounded down to the nearest supported value. Default: 10ms.
+
+- linux,no-autorepeat: Disable key auto repeat.
+
+- adp5589,pulldown-300k
+- adp5589,pullup-300k
+- adp5589,pullup-100k
+- adp5589,pull-disable: Set pull up/down/disable for the chip lines.
+Each is an OR'd value constructed with the macros ADP_COL and ADP_ROW.
+You can also use ~0 to specify all lines. It is an error for any two of
+these values have bits in common, and the driver will not load if so.
+
+Example node:
+
+&i2c0 {
+	keyboard {
+		compatible = "adi,adp5589";
+		reg = <0x34>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&kb_pins>;
+
+		interrupt-parent = <&gpio1>;
+		interrupts = <19 GPIO_ACTIVE_HIGH>;
+
+		adp5589,scan-cycle-time-ms = <40>;
+
+		/* pull up all lines with a 300k resistor */
+		adp5589,pullup-300k = < (~0) >;
+
+		linux,no-autorepeat;
+		linux,keymap = <
+			MATRIX_KEY(0, 0, KEY_0)
+			MATRIX_KEY(0, 1, KEY_1)
+			MATRIX_KEY(0, 2, KEY_2)
+
+			MATRIX_KEY(1, 0, KEY_F1)
+			MATRIX_KEY(1, 1, KEY_F2)
+			MATRIX_KEY(1, 2, KEY_F3)
+		>;
+	}
+}
+
+-------
+
+[1] Documentation/devicetree/bindings/input/matrix-keymap.txt
-- 
2.0.0.rc0

--
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 related

* Re: [PATCH] input: rotary encoder: implement quarter period mode
From: Mark Rutland @ 2014-05-07 14:45 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Daniel Mack,
	devicetree@vger.kernel.org
In-Reply-To: <1387377798-22344-1-git-send-email-s.hauer@pengutronix.de>

Hi,

On Wed, Dec 18, 2013 at 02:43:18PM +0000, Sascha Hauer wrote:
> Some rotary encoders have a stable state in all output state
> combinations. Add support for this type of encoder.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Daniel Mack <daniel@zonque.org>
> Cc: linux-input@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> ---
>  .../devicetree/bindings/input/rotary-encoder.txt   |  1 +
>  Documentation/input/rotary-encoder.txt             |  9 +++++--
>  drivers/input/misc/rotary_encoder.c                | 30 ++++++++++++++++++++--
>  include/linux/rotary_encoder.h                     |  1 +
>  4 files changed, 37 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> index 3315495..cbdb29b 100644
> --- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
> +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> @@ -15,6 +15,7 @@ Optional properties:
>  - rotary-encoder,rollover: Automatic rollove when the rotary value becomes
>    greater than the specified steps or smaller than 0. For absolute axis only.
>  - rotary-encoder,half-period: Makes the driver work on half-period mode.
> +- rotary-encoder,quarter-period: Makes the driver work on quarter-period mode.

The new property looks as sane to me as the half-period property, so for
the binding addition:

Acked-by: Mark Rutland <mark.rutland@arm.com>

As a general nitpick it would be nicer if the binding didn't refer to
the driver and had a description of {half,quarter} period modes inline,
but that might be a bit tricky and shouldn't block this.

Cheers,
Mark.

^ permalink raw reply

* Re: [PATCH] input: rotary encoder: implement quarter period mode
From: Ezequiel García @ 2014-05-07 14:51 UTC (permalink / raw)
  To: Mark Rutland, Dmitry Torokhov
  Cc: Sascha Hauer, linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Daniel Mack, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Guido Martínez
In-Reply-To: <20140507144543.GE27177-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>

On 7 May 2014 11:45, Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org> wrote:
> On Wed, Dec 18, 2013 at 02:43:18PM +0000, Sascha Hauer wrote:
>> Some rotary encoders have a stable state in all output state
>> combinations. Add support for this type of encoder.
>>
>> Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>> Cc: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Cc: Daniel Mack <daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
>> Cc: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> ---
>>  .../devicetree/bindings/input/rotary-encoder.txt   |  1 +
>>  Documentation/input/rotary-encoder.txt             |  9 +++++--
>>  drivers/input/misc/rotary_encoder.c                | 30 ++++++++++++++++++++--
>>  include/linux/rotary_encoder.h                     |  1 +
>>  4 files changed, 37 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
>> index 3315495..cbdb29b 100644
>> --- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
>> +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
>> @@ -15,6 +15,7 @@ Optional properties:
>>  - rotary-encoder,rollover: Automatic rollove when the rotary value becomes
>>    greater than the specified steps or smaller than 0. For absolute axis only.
>>  - rotary-encoder,half-period: Makes the driver work on half-period mode.
>> +- rotary-encoder,quarter-period: Makes the driver work on quarter-period mode.
>
> The new property looks as sane to me as the half-period property, so for
> the binding addition:
>
> Acked-by: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
>

Thanks!

> As a general nitpick it would be nicer if the binding didn't refer to
> the driver and had a description of {half,quarter} period modes inline,
> but that might be a bit tricky and shouldn't block this.
>

I can submit a follow-up patch to clean the binding. It shouldn't be
too hard to re-phrase
the properties so it's clear it's a hardware property.

Dmitry, Do you think you can merge this for v3.16? I've posted a
completely equivalent
patch a while ago [1], which was acked by Daniel, but it was never
merged. Sascha's patch
looks fine as well:

Acked-by: Ezequiel Garcia <ezequiel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org>

[1] https://lkml.org/lkml/2013/10/4/167
-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] input: rotary encoder: implement quarter period mode
From: Dmitry Torokhov @ 2014-05-07 18:59 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Sascha Hauer, linux-input@vger.kernel.org, Daniel Mack,
	devicetree@vger.kernel.org, Ezequiel García
In-Reply-To: <20140507144543.GE27177@e106331-lin.cambridge.arm.com>

On Wed, May 07, 2014 at 03:45:43PM +0100, Mark Rutland wrote:
> Hi,
> 
> On Wed, Dec 18, 2013 at 02:43:18PM +0000, Sascha Hauer wrote:
> > Some rotary encoders have a stable state in all output state
> > combinations. Add support for this type of encoder.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: Daniel Mack <daniel@zonque.org>
> > Cc: linux-input@vger.kernel.org
> > Cc: devicetree@vger.kernel.org
> > ---
> >  .../devicetree/bindings/input/rotary-encoder.txt   |  1 +
> >  Documentation/input/rotary-encoder.txt             |  9 +++++--
> >  drivers/input/misc/rotary_encoder.c                | 30 ++++++++++++++++++++--
> >  include/linux/rotary_encoder.h                     |  1 +
> >  4 files changed, 37 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> > index 3315495..cbdb29b 100644
> > --- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
> > +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> > @@ -15,6 +15,7 @@ Optional properties:
> >  - rotary-encoder,rollover: Automatic rollove when the rotary value becomes
> >    greater than the specified steps or smaller than 0. For absolute axis only.
> >  - rotary-encoder,half-period: Makes the driver work on half-period mode.
> > +- rotary-encoder,quarter-period: Makes the driver work on quarter-period mode.
> 
> The new property looks as sane to me as the half-period property, so for
> the binding addition:

Actually, maybe we should deprecate rotary-encoder,half-period and
instead add rotary-encoder,type property?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: Re: [PATCH v5 8/8] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
From: Maxime Ripard @ 2014-05-08  2:53 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel, Hans De Goede, Emilio Lopez, wens Tsai,
	sameo-VuQAYsv1563Yd54FQh9/CA, Dmitry Torokhov,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Liam Girdwood, Mark Brown,
	Lee Jones, boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <CAOQ7t2bg5jkeruVnO+9cXMxxh+SL+ANGz3R0ssSMwrHewRKyYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 6236 bytes --]

On Tue, May 06, 2014 at 09:38:23AM +0200, Carlo Caione wrote:
> On Tue, May 6, 2014 at 12:51 AM, Maxime Ripard
> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> > On Sat, May 03, 2014 at 02:21:06PM +0200, Carlo Caione wrote:
> >> On Sat, May 3, 2014 at 3:09 AM, Maxime Ripard
> >> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> >> > Hi,
> >> >
> >> > On Thu, May 01, 2014 at 02:29:34PM +0200, Carlo Caione wrote:
> >> >> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> >> >> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> >> >> ---
> >> >>  arch/arm/boot/dts/sun4i-a10-a1000.dts           | 58 ++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 58 ++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 64 ++++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 58 ++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 65 +++++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 64 ++++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 58 ++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 59 ++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 59 ++++++++++++++++++++++
> >> >>  arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 59 ++++++++++++++++++++++
> >> >>  10 files changed, 602 insertions(+)
> >> >>
> >> >> diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
> >> >> index fa746aea..57d3fb4 100644
> >> >> --- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
> >> >> +++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
> >> >> @@ -88,6 +88,56 @@
> >> >>                       pinctrl-names = "default";
> >> >>                       pinctrl-0 = <&i2c0_pins_a>;
> >> >>                       status = "okay";
> >> >> +
> >> >> +                     axp209: pmic@34 {
> >> >> +                             compatible = "x-powers,axp209";
> >> >> +                             reg = <0x34>;
> >> >> +                             interrupts = <0>;
> >> >> +
> >> >> +                             interrupt-controller;
> >> >> +                             #interrupt-cells = <1>;
> >> >> +
> >> >> +                             acin-supply = <&reg_axp_ipsout>;
> >> >> +                             vin2-supply = <&reg_axp_ipsout>;
> >> >> +                             vin3-supply = <&reg_axp_ipsout>;
> >> >> +                             ldo24in-supply = <&reg_axp_ipsout>;
> >> >> +                             ldo3in-supply = <&reg_axp_ipsout>;
> >> >> +                             ldo5in-supply = <&reg_axp_ipsout>;
> >> >> +
> >> >> +                             regulators {
> >> >> +                                     x-powers,dcdc-freq = <1500>;
> >> >> +
> >> >> +                                     axp_vcore_reg: dcdc2 {
> >> >> +                                             regulator-min-microvolt = <700000>;
> >> >> +                                             regulator-max-microvolt = <2275000>;
> >> >> +                                             regulator-always-on;
> >> >> +                                     };
> >> >> +
> >> >> +                                     axp_ddr_reg: dcdc3 {
> >> >> +                                             regulator-always-on;
> >> >> +                                     };
> >> >> +
> >> >> +                                     axp_rtc_reg: ldo1 {
> >> >> +                                             regulator-always-on;
> >> >> +                                     };
> >> >> +
> >> >> +                                     axp_analog_reg: ldo2 {
> >> >> +                                             regulator-always-on;
> >> >> +                                     };
> >> >> +
> >> >> +                                     axp_pll_reg: ldo3 {
> >> >> +                                             regulator-always-on;
> >> >> +                                     };
> >> >> +
> >> >> +                                     axp_hdmi_reg: ldo4 {
> >> >> +                                             regulator-always-on;
> >> >> +                                     };
> >> >> +
> >> >> +                                     axp_mic_reg: ldo5 {
> >> >> +                                             regulator-always-on;
> >> >
> >> > Do all these regulators need to be always on? It makes sense for the
> >> > pll and vcore, but I don't get why the mic and hdmi regulators need
> >> > this.
> >>
> >> I did this way because I don't have the schematics for all the board
> >> so I thought it was safer to leave all the regulators enabled
> >
> > Well, we have the schematics for most of these boards (at least all
> > the cubie and olinuxinos).
> >
> > As far as the other boards are concerned, if we don't have that
> > information, I'd say leave them alone until someone has access to
> > these informations.
> 
> What do you mean exactly with "leave them alone". The problem is that
> if the regulator is not explicitly marked as always-on, it is disabled
> at boot time, so I think that the most safe thing to do is leave them
> on to avoid turning off something at boot time that could be
> important.

What I mean is that no information is still better than wrong
informations. If you don't have the schematics, then don't do anything
on this boards. Hopefully, someone with more infos on this will know
what to do.

Moreover, I have the feeling that you just copy pasted all the
informations on this patch. The first example I'm seeing is the
cubieboard, for which we do have the schematics, and this patch says
that ldo4 is used for HDMI, and that is required to stays always on,
while LDO4 doesn't seem to be used at all, and that HDMI takes
directly its input source from DC-5V.

I guess you need some more refining on this patch.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* [PATCH] Input: Introduce the use of managed version of kzalloc
From: Himangi Saraogi @ 2014-05-08  4:00 UTC (permalink / raw)
  To: support.opensource, dmitry.torokhov, linux-input, linux-kernel
  Cc: julia.lawall

This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. This data is the third argument to da9052_request_irq in the
two cases below.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
As a follow up patch I would like to know if it would be desirable to 
modify request_threaded_irq to devm_request_threaded_irq in the helper
function da9052_request_irq :
int da9052_request_irq(struct da9052 *da9052, int irq, char *name,
			   irq_handler_t handler, void *data)
{
	irq = da9052_map_irq(da9052, irq);
	if (irq < 0)
		return irq;

	return request_threaded_irq(irq, NULL, handler,
				     IRQF_TRIGGER_LOW | IRQF_ONESHOT,
				     name, data);
}

 drivers/input/misc/da9052_onkey.c      | 4 +---
 drivers/input/touchscreen/da9052_tsi.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c
index 184c8f2..6fc8243 100644
--- a/drivers/input/misc/da9052_onkey.c
+++ b/drivers/input/misc/da9052_onkey.c
@@ -84,7 +84,7 @@ static int da9052_onkey_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	onkey = kzalloc(sizeof(*onkey), GFP_KERNEL);
+	onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL);
 	input_dev = input_allocate_device();
 	if (!onkey || !input_dev) {
 		dev_err(&pdev->dev, "Failed to allocate memory\n");
@@ -126,7 +126,6 @@ err_free_irq:
 	cancel_delayed_work_sync(&onkey->work);
 err_free_mem:
 	input_free_device(input_dev);
-	kfree(onkey);
 
 	return error;
 }
@@ -139,7 +138,6 @@ static int da9052_onkey_remove(struct platform_device *pdev)
 	cancel_delayed_work_sync(&onkey->work);
 
 	input_unregister_device(onkey->input);
-	kfree(onkey);
 
 	return 0;
 }
diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c
index ab64d58..dff6a2e 100644
--- a/drivers/input/touchscreen/da9052_tsi.c
+++ b/drivers/input/touchscreen/da9052_tsi.c
@@ -238,7 +238,7 @@ static int da9052_ts_probe(struct platform_device *pdev)
 	if (!da9052)
 		return -EINVAL;
 
-	tsi = kzalloc(sizeof(struct da9052_tsi), GFP_KERNEL);
+	tsi = devm_kzalloc(&pdev->dev, sizeof(struct da9052_tsi), GFP_KERNEL);
 	input_dev = input_allocate_device();
 	if (!tsi || !input_dev) {
 		error = -ENOMEM;
@@ -311,7 +311,6 @@ err_free_datardy_irq:
 err_free_pendwn_irq:
 	da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);
 err_free_mem:
-	kfree(tsi);
 	input_free_device(input_dev);
 
 	return error;
@@ -327,7 +326,6 @@ static int  da9052_ts_remove(struct platform_device *pdev)
 	da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);
 
 	input_unregister_device(tsi->dev);
-	kfree(tsi);
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related

* Re: Re: [PATCH v5 8/8] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
From: Carlo Caione @ 2014-05-08  8:17 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Carlo Caione, linux-arm-kernel, Hans De Goede, Emilio Lopez,
	wens Tsai, sameo-VuQAYsv1563Yd54FQh9/CA, Dmitry Torokhov,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Liam Girdwood, Mark Brown,
	Lee Jones, boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <20140508025337.GI7047@lukather>

On Thu, May 8, 2014 at 4:53 AM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:

<snip>

> What I mean is that no information is still better than wrong
> informations. If you don't have the schematics, then don't do anything
> on this boards. Hopefully, someone with more infos on this will know
> what to do.

I partially agree here. Not specifying the voltage range for the
regulators but only keeping them always-on from a practical point of
view means that we do nothing with those regulators (see also
https://www.mail-archive.com/linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg09532.html
)

> Moreover, I have the feeling that you just copy pasted all the
> informations on this patch. The first example I'm seeing is the
> cubieboard, for which we do have the schematics, and this patch says
> that ldo4 is used for HDMI, and that is required to stays always on,
> while LDO4 doesn't seem to be used at all, and that HDMI takes
> directly its input source from DC-5V.

The names for the regulators are taken from the original Allwinner
driver and (of course) they can have nothing to do with the function
they have in the board. I agree that this could be misleading so I'll
change them with more general names. Concerning LDO4 that is always
on, it was off until this v4, but I changed it back to have one common
DT representation among all the boards.

> I guess you need some more refining on this patch.

Ok, I'll submit a v6 only for this patch.

Thanks,

-- 
Carlo Caione

^ permalink raw reply

* [PATCH] HID: i2c-hid: hid report descriptor retrieval changes
From: Archana Patni @ 2014-05-08 13:26 UTC (permalink / raw)
  To: jkosina
  Cc: jic23, linux-input, mika.westerberg, srinivas.pandruvada,
	Archana Patni, Archana Patni, Subramony Sesha

Reading the partial HID Descriptor is causing a firmware lockup in some
sensor hubs. Instead of a partial read, this patch implements the
i2c hid fetch using a fixed descriptor size (30 bytes) followed by a
verification of the BCDVersion (V01.00), and value stored in
wHIDDescLength (30 Bytes) for V1.00 descriptors.

As per i2c hid spec, this is the preferred model.

>From hid-over-i2c-protocol-spec-v1-0:

  There are a variety of ways a HOST may choose to retrieve
  the HID Descriptor from the DEVICE. The following is a preferred
  implementation but should not be considered the only implementation.
  A HOST may read the entire HID Descriptor in a single read by
  issuing a read for 30 Bytes to get the entire HID Descriptor
  from the DEVICE.However, the HOST is responsible for validating that

  1. The BCDVersion is V01.00 (later revisions may have different
     descriptor lengths), and

  2. The value stored in wHIDDescLength is 30 (Bytes) for V1.00
     descriptors.

Reported-by: Joe Tijerina <joe.tijerina@st.com>
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/hid/i2c-hid/i2c-hid.c |   45 ++++++++++++-----------------------------
 1 file changed, 13 insertions(+), 32 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index b50860d..21aafc8 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -807,34 +807,18 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
 	unsigned int dsize;
 	int ret;
 
-	/* Fetch the length of HID description, retrieve the 4 first bytes:
-	 * bytes 0-1 -> length
-	 * bytes 2-3 -> bcdVersion (has to be 1.00) */
-	ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer, 4);
-
-	i2c_hid_dbg(ihid, "%s, ihid->hdesc_buffer: %4ph\n", __func__,
-			ihid->hdesc_buffer);
-
+	/* i2c hid fetch using a fixed descriptor size (30 bytes) */
+	i2c_hid_dbg(ihid, "Fetching the HID descriptor\n");
+	ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer,
+				sizeof(struct i2c_hid_desc));
 	if (ret) {
-		dev_err(&client->dev,
-			"unable to fetch the size of HID descriptor (ret=%d)\n",
-			ret);
-		return -ENODEV;
-	}
-
-	dsize = le16_to_cpu(hdesc->wHIDDescLength);
-	/*
-	 * the size of the HID descriptor should at least contain
-	 * its size and the bcdVersion (4 bytes), and should not be greater
-	 * than sizeof(struct i2c_hid_desc) as we directly fill this struct
-	 * through i2c_hid_command.
-	 */
-	if (dsize < 4 || dsize > sizeof(struct i2c_hid_desc)) {
-		dev_err(&client->dev, "weird size of HID descriptor (%u)\n",
-			dsize);
+		dev_err(&client->dev, "hid_descr_cmd failed\n");
 		return -ENODEV;
 	}
 
+	/* Validate the length of HID descriptor, the 4 first bytes:
+	 * bytes 0-1 -> length
+	 * bytes 2-3 -> bcdVersion (has to be 1.00) */
 	/* check bcdVersion == 1.0 */
 	if (le16_to_cpu(hdesc->bcdVersion) != 0x0100) {
 		dev_err(&client->dev,
@@ -843,17 +827,14 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
 		return -ENODEV;
 	}
 
-	i2c_hid_dbg(ihid, "Fetching the HID descriptor\n");
-
-	ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer,
-				dsize);
-	if (ret) {
-		dev_err(&client->dev, "hid_descr_cmd Fail\n");
+	/* Descriptor length should be 30 bytes as per the specification */
+	dsize = le16_to_cpu(hdesc->wHIDDescLength);
+	if (dsize != sizeof(struct i2c_hid_desc)) {
+		dev_err(&client->dev, "weird size of HID descriptor (%u)\n",
+			dsize);
 		return -ENODEV;
 	}
-
 	i2c_hid_dbg(ihid, "HID Descriptor: %*ph\n", dsize, ihid->hdesc_buffer);
-
 	return 0;
 }
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH] HID: i2c-hid: Support batch read of input events from fifo
From: Archana Patni @ 2014-05-08 13:32 UTC (permalink / raw)
  To: jkosina
  Cc: jic23, linux-input, mika.westerberg, srinivas.pandruvada,
	Archana Patni, Archana Patni, Subramony Sesha

Some i2c_hid devices like a sensor hub have built-in fifos which
can accumulate input events in their buffers and trigger an interrupt
at end of a user defined event like fifo full or a timeout. The current
implementation reads one event at a time in the IRQ handler leading to
several hundred interrupts being necessary to flush the fifo.

This patch changes the threaded IRQ handler to keep input events until
there are no input events left to read. In the normal case, this will
invoke one additional call to fetch an input event to check for no pending
events and terminate the loop.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
---
 drivers/hid/i2c-hid/i2c-hid.c |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 21aafc8..3f09a50 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -52,6 +52,7 @@
 static bool debug;
 module_param(debug, bool, 0444);
 MODULE_PARM_DESC(debug, "print a lot of debug information");
+#define MAX_INPUT_EVENT_READ 100
 
 #define i2c_hid_dbg(ihid, fmt, arg...)					  \
 do {									  \
@@ -366,7 +367,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
 	return 0;
 }
 
-static void i2c_hid_get_input(struct i2c_hid *ihid)
+static int i2c_hid_get_input(struct i2c_hid *ihid)
 {
 	int ret, ret_size;
 	int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
@@ -374,11 +375,11 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
 	ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
 	if (ret != size) {
 		if (ret < 0)
-			return;
+			return ret;
 
 		dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n",
 			__func__, ret, size);
-		return;
+		return -EIO;
 	}
 
 	ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8;
@@ -387,13 +388,13 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
 		/* host or device initiated RESET completed */
 		if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags))
 			wake_up(&ihid->wait);
-		return;
+		return 0;
 	}
 
 	if (ret_size > size) {
 		dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
 			__func__, size, ret_size);
-		return;
+		return -EIO;
 	}
 
 	i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
@@ -402,17 +403,22 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
 		hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2,
 				ret_size - 2, 1);
 
-	return;
+	return 1;
 }
 
 static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
 {
 	struct i2c_hid *ihid = dev_id;
+	int ret;
+	int count = 0;
 
 	if (test_bit(I2C_HID_READ_PENDING, &ihid->flags))
 		return IRQ_HANDLED;
+	do {
+		count++;
+		ret = i2c_hid_get_input(ihid);
 
-	i2c_hid_get_input(ihid);
+	} while (count < MAX_INPUT_EVENT_READ && ret > 0);
 
 	return IRQ_HANDLED;
 }
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH] input: Request a shared interrupt for AMBA KMI devices.
From: Mark Brown @ 2014-05-08 12:44 UTC (permalink / raw)
  To: Russell King, Dmitry Torokhov
  Cc: linux-input, linaro-kernel, Liviu Dudau, Mark Brown

From: Liviu Dudau <Liviu.Dudau@arm.com>

Recent ARM boards have the KMI devices share one interrupt line rather
than having dedicated IRQs. Update the driver to take that into account.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
---
 drivers/input/serio/ambakmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c
index 762b08432de0..8b748d99b934 100644
--- a/drivers/input/serio/ambakmi.c
+++ b/drivers/input/serio/ambakmi.c
@@ -79,7 +79,8 @@ static int amba_kmi_open(struct serio *io)
 	writeb(divisor, KMICLKDIV);
 	writeb(KMICR_EN, KMICR);
 
-	ret = request_irq(kmi->irq, amba_kmi_int, 0, "kmi-pl050", kmi);
+	ret = request_irq(kmi->irq, amba_kmi_int, IRQF_SHARED, "kmi-pl050",
+			  kmi);
 	if (ret) {
 		printk(KERN_ERR "kmi: failed to claim IRQ%d\n", kmi->irq);
 		writeb(0, KMICR);
-- 
2.0.0.rc2


^ permalink raw reply related

* Re: [PATCH] HID: i2c-hid: hid report descriptor retrieval changes
From: Benjamin Tissoires @ 2014-05-08 14:16 UTC (permalink / raw)
  To: Archana Patni
  Cc: Jiri Kosina, jic23, linux-input, Mika Westerberg,
	Pandruvada, Srinivas, Archana Patni, Subramony Sesha
In-Reply-To: <1399555579-10747-1-git-send-email-archana.patni@linux.intel.com>

On Thu, May 8, 2014 at 9:26 AM, Archana Patni
<archana.patni@linux.intel.com> wrote:
> Reading the partial HID Descriptor is causing a firmware lockup in some
> sensor hubs. Instead of a partial read, this patch implements the
> i2c hid fetch using a fixed descriptor size (30 bytes) followed by a
> verification of the BCDVersion (V01.00), and value stored in
> wHIDDescLength (30 Bytes) for V1.00 descriptors.
>
> As per i2c hid spec, this is the preferred model.
>
> From hid-over-i2c-protocol-spec-v1-0:
>
>   There are a variety of ways a HOST may choose to retrieve
>   the HID Descriptor from the DEVICE. The following is a preferred
>   implementation but should not be considered the only implementation.
>   A HOST may read the entire HID Descriptor in a single read by
>   issuing a read for 30 Bytes to get the entire HID Descriptor
>   from the DEVICE.However, the HOST is responsible for validating that
>
>   1. The BCDVersion is V01.00 (later revisions may have different
>      descriptor lengths), and
>
>   2. The value stored in wHIDDescLength is 30 (Bytes) for V1.00
>      descriptors.
>
> Reported-by: Joe Tijerina <joe.tijerina@st.com>
> Signed-off-by: Archana Patni <archana.patni@intel.com>
> Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---

This one is Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

^ permalink raw reply

* Re: [PATCH] HID: i2c-hid: Support batch read of input events from fifo
From: Benjamin Tissoires @ 2014-05-08 14:28 UTC (permalink / raw)
  To: Archana Patni
  Cc: Jiri Kosina, jic23, linux-input, Mika Westerberg,
	Pandruvada, Srinivas, Archana Patni, Subramony Sesha
In-Reply-To: <1399555929-10870-1-git-send-email-archana.patni@linux.intel.com>

On Thu, May 8, 2014 at 9:32 AM, Archana Patni
<archana.patni@linux.intel.com> wrote:
> Some i2c_hid devices like a sensor hub have built-in fifos which
> can accumulate input events in their buffers and trigger an interrupt
> at end of a user defined event like fifo full or a timeout. The current
> implementation reads one event at a time in the IRQ handler leading to
> several hundred interrupts being necessary to flush the fifo.
>
> This patch changes the threaded IRQ handler to keep input events until
> there are no input events left to read. In the normal case, this will
> invoke one additional call to fetch an input event to check for no pending
> events and terminate the loop.

I must say, I don't like this patch.
It seems to me that it will solve your problem but will break other
devices. Nothing in the spec says what happens if the host tries to
read while the interrupt line is *not* asserted. I can easily imagine
several scenarios where the device would hang until the next available
data, or will just fail.

So the proper way according to the spec is to check the status of the
interrupt line. This line is the responsibility of the device to be
asserted and we should rely on it to know if we can read again.

However, a quick check on the interrupt API did not provide me the
function I would like, so I guess this is something to be work on.

I can not ack this one until we can be sure not breaking other stuff.

So: NACK.

Cheers,
Benjamin

>
> Signed-off-by: Archana Patni <archana.patni@intel.com>
> Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
> Reviewed-by: Mika Westerberg <mika.westerberg@intel.com>
> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
> ---
>  drivers/hid/i2c-hid/i2c-hid.c |   20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
> index 21aafc8..3f09a50 100644
> --- a/drivers/hid/i2c-hid/i2c-hid.c
> +++ b/drivers/hid/i2c-hid/i2c-hid.c
> @@ -52,6 +52,7 @@
>  static bool debug;
>  module_param(debug, bool, 0444);
>  MODULE_PARM_DESC(debug, "print a lot of debug information");
> +#define MAX_INPUT_EVENT_READ 100
>
>  #define i2c_hid_dbg(ihid, fmt, arg...)                                   \
>  do {                                                                     \
> @@ -366,7 +367,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
>         return 0;
>  }
>
> -static void i2c_hid_get_input(struct i2c_hid *ihid)
> +static int i2c_hid_get_input(struct i2c_hid *ihid)
>  {
>         int ret, ret_size;
>         int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
> @@ -374,11 +375,11 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>         ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
>         if (ret != size) {
>                 if (ret < 0)
> -                       return;
> +                       return ret;
>
>                 dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n",
>                         __func__, ret, size);
> -               return;
> +               return -EIO;
>         }
>
>         ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8;
> @@ -387,13 +388,13 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>                 /* host or device initiated RESET completed */
>                 if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags))
>                         wake_up(&ihid->wait);
> -               return;
> +               return 0;
>         }
>
>         if (ret_size > size) {
>                 dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
>                         __func__, size, ret_size);
> -               return;
> +               return -EIO;
>         }
>
>         i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
> @@ -402,17 +403,22 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
>                 hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2,
>                                 ret_size - 2, 1);
>
> -       return;
> +       return 1;
>  }
>
>  static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
>  {
>         struct i2c_hid *ihid = dev_id;
> +       int ret;
> +       int count = 0;
>
>         if (test_bit(I2C_HID_READ_PENDING, &ihid->flags))
>                 return IRQ_HANDLED;
> +       do {
> +               count++;
> +               ret = i2c_hid_get_input(ihid);
>
> -       i2c_hid_get_input(ihid);
> +       } while (count < MAX_INPUT_EVENT_READ && ret > 0);
>
>         return IRQ_HANDLED;
>  }
> --
> 1.7.9.5
>
> --
> 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

* Fw:
From: Andrew Haines @ 2014-05-08 14:35 UTC (permalink / raw)
  To: linux-input

Hey there! 
http://banatechnologies.com/-hi.friend?xubosjr=6919042&vepibu=462364



^ permalink raw reply

* [PATCH 00/22] Random ARM randconfig fixes in drivers
From: Arnd Bergmann @ 2014-05-08 14:46 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, Arnd Bergmann, bhelgaas, dwmw2, dmitry.torokhov,
	balbi, gregkh, plagnioj, jic23, josh.wu, kishon, linus.walleij,
	broonie, mturquette, nicolas.ferre, ohad, linux, tony, vinod.koul,
	wim, wsa, dmaengine, linux-i2c, linux-ide, linux-iio, linux-input,
	linux-mtd, linux-pci, linux-samsung-soc, linux-sh, linux-watchdog,
	netdev

These are a bunch of fixes I had to do to get all randconfig
configurations on ARM working. Most of these are really old
bugs, but there are also some new ones. I don't think any of
them require a backport to linux-stable.

I have checked that they are all still required on yesterday's
linux-next kernel. Please apply on the appropriate trees unless
there are objections.

Patch numbers are per subsystem, which I thought is less confusing
than numbering them 1-22 when they are all totall independent.

Arnd Bergmann (22):
  mdio_bus: fix devm_mdiobus_alloc_size export
  phy: kona2: use 'select GENERIC_PHY' in Kconfig
  phy: exynos: fix SATA phy license typo
  dmaengine: omap: hide filter_fn for built-in drivers
  dmaengine: sa11x0: remove broken #ifdef
  mtd/onenand: fix build warning for dma type
  mtd: orion-nand: fix build error with ARMv4
  clk/versatile: export symbols for impd1
  bus/omap_l3: avoid sync initcall for modules
  bus/arm-cci: add dependency on OF && CPU_V7
  watchdog: iop_wdt only builds for mach-iop13xx
  mpilib: use 'static inline' for mpi-inline.h
  ata: pata_at91 only works on sam9
  i2c/nuc900: fix ancient build error
  iio: always select ANON_INODES
  iio:adc: at91 requires the input subsystem
  pci: rcar host needs OF
  input: fix ps2/serio module dependency
  input: atmel-wm97xx: only build for AVR32
  misc: atmel_pwm: only build for supported platforms
  remoteproc: da8xx: don't select CMA on no-MMU
  regulator: arizona-ldo1: add missing #include

 drivers/ata/Kconfig               | 2 +-
 drivers/bus/Kconfig               | 2 +-
 drivers/bus/omap_l3_noc.c         | 4 ++++
 drivers/bus/omap_l3_smx.c         | 4 ++++
 drivers/clk/versatile/clk-icst.c  | 1 +
 drivers/clk/versatile/clk-impd1.c | 2 ++
 drivers/dma/sa11x0-dma.c          | 4 ----
 drivers/i2c/busses/i2c-nuc900.c   | 2 +-
 drivers/iio/Kconfig               | 1 +
 drivers/iio/adc/Kconfig           | 1 +
 drivers/input/keyboard/Kconfig    | 2 +-
 drivers/input/mouse/Kconfig       | 2 +-
 drivers/input/touchscreen/Kconfig | 2 +-
 drivers/misc/Kconfig              | 3 ++-
 drivers/mtd/nand/orion_nand.c     | 5 +++++
 drivers/mtd/onenand/samsung.c     | 8 ++++----
 drivers/net/phy/mdio_bus.c        | 2 +-
 drivers/pci/host/Kconfig          | 2 +-
 drivers/phy/Kconfig               | 2 +-
 drivers/phy/phy-exynos5250-sata.c | 2 +-
 drivers/regulator/arizona-ldo1.c  | 1 +
 drivers/remoteproc/Kconfig        | 2 +-
 drivers/watchdog/Kconfig          | 2 +-
 include/linux/omap-dma.h          | 2 +-
 lib/mpi/mpi-inline.h              | 2 +-
 lib/mpi/mpi-internal.h            | 8 --------
 26 files changed, 39 insertions(+), 31 deletions(-)

-- 
1.8.3.2

Cc: bhelgaas@google.com
Cc: dwmw2@infradead.org
Cc: dmitry.torokhov@gmail.com
Cc: balbi@ti.com
Cc: gregkh@linuxfoundation.org
Cc: plagnioj@jcrosoft.com
Cc: jic23@kernel.org
Cc: josh.wu@atmel.com
Cc: kishon@ti.com
Cc: linus.walleij@linaro.org
Cc: broonie@kernel.org
Cc: mturquette@linaro.org
Cc: nicolas.ferre@atmel.com
Cc: ohad@wizery.com
Cc: linux@arm.linux.org.uk
Cc: tony@atomide.com
Cc: vinod.koul@intel.com
Cc: wim@iguana.be
Cc: wsa@the-dreams.de
Cc: dmaengine@vger.kernel.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: linux-iio@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: linux-mtd@lists.infradead.org
Cc: linux-pci@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: linux-watchdog@vger.kernel.org
Cc: netdev@vger.kernel.org

^ permalink raw reply

* Fw: (7)
From: Andrew Haines @ 2014-05-08 14:52 UTC (permalink / raw)
  To: linux-input

Hello! 
http://ambiaudio.com/-hello.friend?syfiguco=8382909&mecudonu=810041



^ 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