Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH v5 4/8] input: misc: Add driver for AXP20x Power Enable Key
From: Dmitry Torokhov @ 2014-05-19  5:57 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Carlo Caione, linux-arm-kernel, linux-sunxi, hdegoede, emilio,
	wens, sameo, linux-input, linux-doc, lgirdwood, broonie,
	lee.jones, boris.brezillon
In-Reply-To: <20140503010604.GE4090@lukather>

On Fri, May 02, 2014 at 06:06:04PM -0700, Maxime Ripard wrote:
> On Thu, May 01, 2014 at 02:29:30PM +0200, Carlo Caione wrote:
> > This patch add support for the Power Enable Key found on MFD AXP202 and
> > AXP209. Besides the basic support for the button, the driver adds two
> > entries in sysfs to configure the time delay for power on/off.
> > 
> > Signed-off-by: Carlo Caione <carlo@caione.org>
> 
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

How are we merging it? MFD tree?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v5 6/7] Input: pixcir_i2c_ts: Implement wakeup from suspend
From: Dmitry Torokhov @ 2014-05-19  5:55 UTC (permalink / raw)
  To: Roger Quadros
  Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
	linux-kernel, devicetree
In-Reply-To: <1399374372-29123-7-git-send-email-rogerq@ti.com>

On Tue, May 06, 2014 at 02:06:11PM +0300, Roger Quadros wrote:
> Improve the suspend and resume handlers to allow the device
> to wakeup the system from suspend.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 47 ++++++++++++++++++++++++++++---
>  1 file changed, 43 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 0728c04..b0f7680 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -348,21 +348,59 @@ static void pixcir_input_close(struct input_dev *dev)
>  static int pixcir_i2c_ts_suspend(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
> +	struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client);
> +	struct input_dev *input = ts->input;
> +	int ret = 0;
> +
> +	mutex_lock(&input->mutex);
> +
> +	if (device_may_wakeup(&client->dev)) {
> +		if (!input->users) {
> +			ret = pixcir_start(ts);
> +			if (ret) {
> +				dev_err(dev, "Failed to start\n");
> +				goto unlock;
> +			}
> +		}
>  
> -	if (device_may_wakeup(&client->dev))
>  		enable_irq_wake(client->irq);
> +	} else if (input->users) {
> +		ret = pixcir_stop(ts);
> +	}
>  
> -	return 0;
> +unlock:
> +	mutex_unlock(&input->mutex);
> +
> +	return ret;
>  }
>  
>  static int pixcir_i2c_ts_resume(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
> +	struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client);
> +	struct input_dev *input = ts->input;
> +	int ret = 0;
> +
> +	mutex_lock(&input->mutex);
>  
> -	if (device_may_wakeup(&client->dev))
> +	if (device_may_wakeup(&client->dev)) {
>  		disable_irq_wake(client->irq);
>  
> -	return 0;
> +		if (!input->users) {
> +			ret = pixcir_stop(ts);
> +			if (ret) {
> +				dev_err(dev, "Failed to stop\n");
> +				goto unlock;
> +			}
> +		}
> +	} else if (input->users) {
> +		ret = pixcir_start(ts);
> +	}
> +
> +unlock:
> +	mutex_unlock(&input->mutex);
> +
> +	return ret;
>  }
>  #endif
>  
> @@ -469,6 +507,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  	if (error)
>  		return error;
>  
> +	i2c_set_clientdata(client, tsdata);
>  	device_init_wakeup(&client->dev, 1);
>  
>  	return 0;
> -- 
> 1.8.3.2
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v5 3/7] Input: pixcir_i2c_ts: Get rid of pdata->attb_read_val()
From: Dmitry Torokhov @ 2014-05-19  5:55 UTC (permalink / raw)
  To: Roger Quadros
  Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
	linux-kernel, devicetree
In-Reply-To: <1399374372-29123-4-git-send-email-rogerq@ti.com>

On Tue, May 06, 2014 at 02:06:08PM +0300, Roger Quadros wrote:
> Get rid of the attb_read_val() platform hook. Instead,
> read the ATTB gpio directly from the driver.
> 
> Fail if valid ATTB gpio is not provided by patform data.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 16 +++++++++++++++-
>  include/linux/input/pixcir_ts.h           |  2 +-
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 96a1b1e..8a7da61 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -24,6 +24,7 @@
>  #include <linux/i2c.h>
>  #include <linux/input.h>
>  #include <linux/input/pixcir_ts.h>
> +#include <linux/gpio.h>
>  
>  struct pixcir_i2c_ts_data {
>  	struct i2c_client *client;
> @@ -87,11 +88,12 @@ static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
>  static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>  {
>  	struct pixcir_i2c_ts_data *tsdata = dev_id;
> +	const struct pixcir_ts_platform_data *pdata = tsdata->chip;
>  
>  	while (tsdata->running) {
>  		pixcir_ts_poscheck(tsdata);
>  
> -		if (tsdata->chip->attb_read_val())
> +		if (gpio_get_value(pdata->gpio_attb))
>  			break;
>  
>  		msleep(20);
> @@ -296,6 +298,11 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  	if (!pdata) {
>  		dev_err(&client->dev, "platform data not defined\n");
>  		return -EINVAL;
> +	} else {
> +		if (!gpio_is_valid(pdata->gpio_attb)) {
> +			dev_err(dev, "Invalid gpio_attb in pdata\n");
> +			return -EINVAL;
> +		}
>  	}
>  
>  	tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL);
> @@ -328,6 +335,13 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  
>  	input_set_drvdata(input, tsdata);
>  
> +	error = devm_gpio_request_one(dev, pdata->gpio_attb,
> +				      GPIOF_DIR_IN, "pixcir_i2c_attb");
> +	if (error) {
> +		dev_err(dev, "Failed to request ATTB gpio\n");
> +		return error;
> +	}
> +
>  	error = devm_request_threaded_irq(dev, client->irq, NULL, pixcir_ts_isr,
>  					  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>  					  client->name, tsdata);
> diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
> index 7942804..160cf35 100644
> --- a/include/linux/input/pixcir_ts.h
> +++ b/include/linux/input/pixcir_ts.h
> @@ -44,9 +44,9 @@ enum pixcir_int_mode {
>  #define PIXCIR_INT_POL_HIGH	(1UL << 2)
>  
>  struct pixcir_ts_platform_data {
> -	int (*attb_read_val)(void);
>  	int x_max;
>  	int y_max;
> +	int gpio_attb;		/* GPIO connected to ATTB line */
>  };
>  
>  #endif
> -- 
> 1.8.3.2
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v5 2/7] Input: pixcir_i2c_ts - initialize interrupt mode and power mode
From: Dmitry Torokhov @ 2014-05-19  5:55 UTC (permalink / raw)
  To: Roger Quadros
  Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
	linux-kernel, devicetree
In-Reply-To: <1399374372-29123-3-git-send-email-rogerq@ti.com>

On Tue, May 06, 2014 at 02:06:07PM +0300, Roger Quadros wrote:
> Introduce helper functions to configure power and interrupt registers.
> Default to IDLE mode on probe as device supports auto wakeup to ACVIE mode
> on detecting finger touch.
> 
> Configure interrupt mode and polarity on start up.  Power down on device
> closure or module removal.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 182 ++++++++++++++++++++++++++++--
>  include/linux/input/pixcir_ts.h           |  42 +++++++
>  2 files changed, 216 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 8a083bd..96a1b1e 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -29,7 +29,7 @@ struct pixcir_i2c_ts_data {
>  	struct i2c_client *client;
>  	struct input_dev *input;
>  	const struct pixcir_ts_platform_data *chip;
> -	bool exiting;
> +	bool running;
>  };
>  
>  static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
> @@ -88,7 +88,7 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>  {
>  	struct pixcir_i2c_ts_data *tsdata = dev_id;
>  
> -	while (!tsdata->exiting) {
> +	while (tsdata->running) {
>  		pixcir_ts_poscheck(tsdata);
>  
>  		if (tsdata->chip->attb_read_val())
> @@ -100,6 +100,164 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> +static int pixcir_set_power_mode(struct pixcir_i2c_ts_data *ts,
> +				 enum pixcir_power_mode mode)
> +{
> +	struct device *dev = &ts->client->dev;
> +	int ret;
> +
> +	ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_POWER_MODE);
> +	if (ret < 0) {
> +		dev_err(dev, "%s: can't read reg 0x%x : %d\n",
> +			__func__, PIXCIR_REG_POWER_MODE, ret);
> +		return ret;
> +	}
> +
> +	ret &= ~PIXCIR_POWER_MODE_MASK;
> +	ret |= mode;
> +
> +	/* Always AUTO_IDLE */
> +	ret |= PIXCIR_POWER_ALLOW_IDLE;
> +
> +	ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_POWER_MODE, ret);
> +	if (ret < 0) {
> +		dev_err(dev, "%s: can't write reg 0x%x : %d\n",
> +			__func__, PIXCIR_REG_POWER_MODE, ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +/*
> + * Set the interrupt mode for the device i.e. ATTB line behaviour
> + *
> + * @polarity : 1 for active high, 0 for active low.
> + */
> +static int pixcir_set_int_mode(struct pixcir_i2c_ts_data *ts,
> +			       enum pixcir_int_mode mode, bool polarity)
> +{
> +	struct device *dev = &ts->client->dev;
> +	int ret;
> +
> +	ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_INT_MODE);
> +	if (ret < 0) {
> +		dev_err(dev, "%s: can't read reg 0x%x : %d\n",
> +			__func__, PIXCIR_REG_INT_MODE, ret);
> +		return ret;
> +	}
> +
> +	ret &= ~PIXCIR_INT_MODE_MASK;
> +	ret |= mode;
> +
> +	if (polarity)
> +		ret |= PIXCIR_INT_POL_HIGH;
> +	else
> +		ret &= ~PIXCIR_INT_POL_HIGH;
> +
> +	ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_INT_MODE, ret);
> +	if (ret < 0) {
> +		dev_err(dev, "%s: can't write reg 0x%x : %d\n",
> +			__func__, PIXCIR_REG_INT_MODE, ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +/*
> + * Enable/disable interrupt generation
> + */
> +static int pixcir_int_enable(struct pixcir_i2c_ts_data *ts, bool enable)
> +{
> +	struct device *dev = &ts->client->dev;
> +	int ret;
> +
> +	ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_INT_MODE);
> +	if (ret < 0) {
> +		dev_err(dev, "%s: can't read reg 0x%x : %d\n",
> +			__func__, PIXCIR_REG_INT_MODE, ret);
> +		return ret;
> +	}
> +
> +	if (enable)
> +		ret |= PIXCIR_INT_ENABLE;
> +	else
> +		ret &= ~PIXCIR_INT_ENABLE;
> +
> +	ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_INT_MODE, ret);
> +	if (ret < 0) {
> +		dev_err(dev, "%s: can't write reg 0x%x : %d\n",
> +			__func__, PIXCIR_REG_INT_MODE, ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int pixcir_start(struct pixcir_i2c_ts_data *ts)
> +{
> +	struct device *dev = &ts->client->dev;
> +	int error;
> +
> +	/* LEVEL_TOUCH interrupt with active low polarity */
> +	error = pixcir_set_int_mode(ts, PIXCIR_INT_LEVEL_TOUCH, 0);
> +	if (error) {
> +		dev_err(dev, "Failed to set interrupt mode: %d\n", error);
> +		return error;
> +	}
> +
> +	ts->running = true;
> +	mb();	/* Update status before IRQ can fire */
> +
> +	/* enable interrupt generation */
> +	error = pixcir_int_enable(ts, true);
> +	if (error) {
> +		dev_err(dev, "Failed to enable interrupt generation: %d\n",
> +			error);
> +		return error;
> +	}
> +
> +	return 0;
> +}
> +
> +static int pixcir_stop(struct pixcir_i2c_ts_data *ts)
> +{
> +	int error;
> +
> +	/* Disable interrupt generation */
> +	error = pixcir_int_enable(ts, false);
> +	if (error) {
> +		dev_err(&ts->client->dev,
> +			"Failed to disable interrupt generation: %d\n",
> +			error);
> +		return error;
> +	}
> +
> +	/* Exit ISR if running, no more report parsing */
> +	ts->running = false;
> +	mb();	/* update status before we synchronize irq */
> +
> +	/* Wait till running ISR is complete */
> +	synchronize_irq(ts->client->irq);
> +
> +	return 0;
> +}
> +
> +static int pixcir_input_open(struct input_dev *dev)
> +{
> +	struct pixcir_i2c_ts_data *ts = input_get_drvdata(dev);
> +
> +	return pixcir_start(ts);
> +}
> +
> +static void pixcir_input_close(struct input_dev *dev)
> +{
> +	struct pixcir_i2c_ts_data *ts = input_get_drvdata(dev);
> +
> +	pixcir_stop(ts);
> +}
> +
>  #ifdef CONFIG_PM_SLEEP
>  static int pixcir_i2c_ts_suspend(struct device *dev)
>  {
> @@ -156,6 +314,8 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  
>  	input->name = client->name;
>  	input->id.bustype = BUS_I2C;
> +	input->open = pixcir_input_open;
> +	input->close = pixcir_input_close;
>  	input->dev.parent = &client->dev;
>  
>  	__set_bit(EV_KEY, input->evbit);
> @@ -176,11 +336,22 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  		return error;
>  	}
>  
> +	/* Always be in IDLE mode to save power, device supports auto wake */
> +	error = pixcir_set_power_mode(tsdata, PIXCIR_POWER_IDLE);
> +	if (error) {
> +		dev_err(dev, "Failed to set IDLE mode\n");
> +		return error;
> +	}
> +
> +	/* Stop device till opened */
> +	error = pixcir_stop(tsdata);
> +	if (error)
> +		return error;
> +
>  	error = input_register_device(input);
>  	if (error)
>  		return error;
>  
> -	i2c_set_clientdata(client, tsdata);
>  	device_init_wakeup(&client->dev, 1);
>  
>  	return 0;
> @@ -188,13 +359,8 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  
>  static int pixcir_i2c_ts_remove(struct i2c_client *client)
>  {
> -	struct pixcir_i2c_ts_data *tsdata = i2c_get_clientdata(client);
> -
>  	device_init_wakeup(&client->dev, 0);
>  
> -	tsdata->exiting = true;
> -	mb();
> -
>  	return 0;
>  }
>  
> diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
> index 7163d91..7942804 100644
> --- a/include/linux/input/pixcir_ts.h
> +++ b/include/linux/input/pixcir_ts.h
> @@ -1,6 +1,48 @@
>  #ifndef	_PIXCIR_I2C_TS_H
>  #define	_PIXCIR_I2C_TS_H
>  
> +/*
> + * Register map
> + */
> +#define PIXCIR_REG_POWER_MODE	51
> +#define PIXCIR_REG_INT_MODE	52
> +
> +/*
> + * Power modes:
> + * active: max scan speed
> + * idle: lower scan speed with automatic transition to active on touch
> + * halt: datasheet says sleep but this is more like halt as the chip
> + *       clocks are cut and it can only be brought out of this mode
> + *	 using the RESET pin.
> + */
> +enum pixcir_power_mode {
> +	PIXCIR_POWER_ACTIVE,
> +	PIXCIR_POWER_IDLE,
> +	PIXCIR_POWER_HALT,
> +};
> +
> +#define PIXCIR_POWER_MODE_MASK	0x03
> +#define PIXCIR_POWER_ALLOW_IDLE (1UL << 2)
> +
> +/*
> + * Interrupt modes:
> + * periodical: interrupt is asserted periodicaly
> + * diff coordinates: interrupt is asserted when coordinates change
> + * level on touch: interrupt level asserted during touch
> + * pulse on touch: interrupt pulse asserted druing touch
> + *
> + */
> +enum pixcir_int_mode {
> +	PIXCIR_INT_PERIODICAL,
> +	PIXCIR_INT_DIFF_COORD,
> +	PIXCIR_INT_LEVEL_TOUCH,
> +	PIXCIR_INT_PULSE_TOUCH,
> +};
> +
> +#define PIXCIR_INT_MODE_MASK	0x03
> +#define PIXCIR_INT_ENABLE	(1UL << 3)
> +#define PIXCIR_INT_POL_HIGH	(1UL << 2)
> +
>  struct pixcir_ts_platform_data {
>  	int (*attb_read_val)(void);
>  	int x_max;
> -- 
> 1.8.3.2
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v5 1/7] Input: pixcir_i2c_ts: Use devres managed resource allocations
From: Dmitry Torokhov @ 2014-05-19  5:54 UTC (permalink / raw)
  To: Roger Quadros
  Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
	linux-kernel, devicetree
In-Reply-To: <1399374372-29123-2-git-send-email-rogerq@ti.com>

On Tue, May 06, 2014 at 02:06:06PM +0300, Roger Quadros wrote:
> Use devm_() and friends for allocating memory, input device
> and IRQ.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 38 ++++++++++++-------------------
>  1 file changed, 15 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 02392d2..8a083bd 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -130,6 +130,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  {
>  	const struct pixcir_ts_platform_data *pdata =
>  			dev_get_platdata(&client->dev);
> +	struct device *dev = &client->dev;
>  	struct pixcir_i2c_ts_data *tsdata;
>  	struct input_dev *input;
>  	int error;
> @@ -139,12 +140,14 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  		return -EINVAL;
>  	}
>  
> -	tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL);
> -	input = input_allocate_device();
> -	if (!tsdata || !input) {
> -		dev_err(&client->dev, "Failed to allocate driver data!\n");
> -		error = -ENOMEM;
> -		goto err_free_mem;
> +	tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL);
> +	if (!tsdata)
> +		return -ENOMEM;
> +
> +	input = devm_input_allocate_device(dev);
> +	if (!input) {
> +		dev_err(&client->dev, "Failed to allocate input device\n");
> +		return -ENOMEM;
>  	}
>  
>  	tsdata->client = client;
> @@ -165,29 +168,22 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  
>  	input_set_drvdata(input, tsdata);
>  
> -	error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr,
> -				     IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> -				     client->name, tsdata);
> +	error = devm_request_threaded_irq(dev, client->irq, NULL, pixcir_ts_isr,
> +					  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +					  client->name, tsdata);
>  	if (error) {
> -		dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
> -		goto err_free_mem;
> +		dev_err(dev, "failed to request irq %d\n", client->irq);
> +		return error;
>  	}
>  
>  	error = input_register_device(input);
>  	if (error)
> -		goto err_free_irq;
> +		return error;
>  
>  	i2c_set_clientdata(client, tsdata);
>  	device_init_wakeup(&client->dev, 1);
>  
>  	return 0;
> -
> -err_free_irq:
> -	free_irq(client->irq, tsdata);
> -err_free_mem:
> -	input_free_device(input);
> -	kfree(tsdata);
> -	return error;
>  }
>  
>  static int pixcir_i2c_ts_remove(struct i2c_client *client)
> @@ -198,10 +194,6 @@ static int pixcir_i2c_ts_remove(struct i2c_client *client)
>  
>  	tsdata->exiting = true;
>  	mb();
> -	free_irq(client->irq, tsdata);
> -
> -	input_unregister_device(tsdata->input);
> -	kfree(tsdata);
>  
>  	return 0;
>  }
> -- 
> 1.8.3.2
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v5 4/7] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol
From: Dmitry Torokhov @ 2014-05-19  5:54 UTC (permalink / raw)
  To: Roger Quadros
  Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
	linux-kernel, devicetree
In-Reply-To: <1399374372-29123-5-git-send-email-rogerq@ti.com>

On Tue, May 06, 2014 at 02:06:09PM +0300, Roger Quadros wrote:
> Switch to using the Type-B Multi-Touch protocol.
> 

Henrik, any chance you could take a look at MT-B support?

> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 125 ++++++++++++++++++++++--------
>  1 file changed, 94 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 8a7da61..1b6e4e5 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -23,9 +23,12 @@
>  #include <linux/slab.h>
>  #include <linux/i2c.h>
>  #include <linux/input.h>
> +#include <linux/input/mt.h>
>  #include <linux/input/pixcir_ts.h>
>  #include <linux/gpio.h>
>  
> +#define PIXCIR_MAX_SLOTS       2
> +
>  struct pixcir_i2c_ts_data {
>  	struct i2c_client *client;
>  	struct input_dev *input;
> @@ -33,12 +36,25 @@ struct pixcir_i2c_ts_data {
>  	bool running;
>  };
>  
> -static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
> +struct pixcir_touch {
> +	int x;
> +	int y;
> +};
> +
> +struct pixcir_report_data {
> +	int num_touches;
> +	struct pixcir_touch touches[PIXCIR_MAX_SLOTS];
> +};
> +
> +static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
> +			    struct pixcir_report_data *report)
>  {
> -	struct pixcir_i2c_ts_data *tsdata = data;
>  	u8 rdbuf[10], wrbuf[1] = { 0 };
> +	u8 *bufptr;
>  	u8 touch;
> -	int ret;
> +	int ret, i;
> +
> +	memset(report, 0, sizeof(struct pixcir_report_data));
>  
>  	ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf));
>  	if (ret != sizeof(wrbuf)) {
> @@ -56,45 +72,85 @@ static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
>  		return;
>  	}
>  
> -	touch = rdbuf[0];
> -	if (touch) {
> -		u16 posx1 = (rdbuf[3] << 8) | rdbuf[2];
> -		u16 posy1 = (rdbuf[5] << 8) | rdbuf[4];
> -		u16 posx2 = (rdbuf[7] << 8) | rdbuf[6];
> -		u16 posy2 = (rdbuf[9] << 8) | rdbuf[8];
> -
> -		input_report_key(tsdata->input, BTN_TOUCH, 1);
> -		input_report_abs(tsdata->input, ABS_X, posx1);
> -		input_report_abs(tsdata->input, ABS_Y, posy1);
> -
> -		input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx1);
> -		input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy1);
> -		input_mt_sync(tsdata->input);
> -
> -		if (touch == 2) {
> -			input_report_abs(tsdata->input,
> -					 ABS_MT_POSITION_X, posx2);
> -			input_report_abs(tsdata->input,
> -					 ABS_MT_POSITION_Y, posy2);
> -			input_mt_sync(tsdata->input);
> -		}
> -	} else {
> -		input_report_key(tsdata->input, BTN_TOUCH, 0);
> +	touch = rdbuf[0] & 0x7;
> +	if (touch > PIXCIR_MAX_SLOTS)
> +		touch = PIXCIR_MAX_SLOTS;
> +
> +	report->num_touches = touch;
> +	bufptr = &rdbuf[2];
> +
> +	for (i = 0; i < touch; i++) {
> +		report->touches[i].x = (bufptr[1] << 8) | bufptr[0];
> +		report->touches[i].y = (bufptr[3] << 8) | bufptr[2];
> +
> +		bufptr = &bufptr[4];
>  	}
> +}
> +
> +static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts,
> +			     struct pixcir_report_data *report)
> +{
> +	struct input_mt_pos pos[PIXCIR_MAX_SLOTS];
> +	int slots[PIXCIR_MAX_SLOTS];
> +	struct pixcir_touch *touch;
> +	int n, i, slot;
> +	struct device *dev = &ts->client->dev;
>  
> -	input_sync(tsdata->input);
> +	n = report->num_touches;
> +	if (n > PIXCIR_MAX_SLOTS)
> +		n = PIXCIR_MAX_SLOTS;
> +
> +	for (i = 0; i < n; i++) {
> +		touch = &report->touches[i];
> +		pos[i].x = touch->x;
> +		pos[i].y = touch->y;
> +	}
> +
> +	input_mt_assign_slots(ts->input, slots, pos, n);
> +
> +	for (i = 0; i < n; i++) {
> +		touch = &report->touches[i];
> +		slot = slots[i];
> +
> +		input_mt_slot(ts->input, slot);
> +		input_mt_report_slot_state(ts->input,
> +					   MT_TOOL_FINGER, true);
> +
> +		input_event(ts->input, EV_ABS, ABS_MT_POSITION_X, touch->x);
> +		input_event(ts->input, EV_ABS, ABS_MT_POSITION_Y, touch->y);
> +
> +		dev_dbg(dev, "%d: slot %d, x %d, y %d\n",
> +			i, slot, touch->x, touch->y);
> +	}
> +
> +	input_mt_sync_frame(ts->input);
> +	input_sync(ts->input);
>  }
>  
>  static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>  {
>  	struct pixcir_i2c_ts_data *tsdata = dev_id;
>  	const struct pixcir_ts_platform_data *pdata = tsdata->chip;
> +	struct pixcir_report_data report;
>  
>  	while (tsdata->running) {
> -		pixcir_ts_poscheck(tsdata);
> -
> -		if (gpio_get_value(pdata->gpio_attb))
> +		/* parse packet */
> +		pixcir_ts_parse(tsdata, &report);
> +
> +		/* report it */
> +		pixcir_ts_report(tsdata, &report);
> +
> +		if (gpio_get_value(pdata->gpio_attb)) {
> +			if (report.num_touches) {
> +				/*
> +				 * Last report with no finger up?
> +				 * Do it now then.
> +				 */
> +				input_mt_sync_frame(tsdata->input);
> +				input_sync(tsdata->input);
> +			}
>  			break;
> +		}
>  
>  		msleep(20);
>  	}
> @@ -333,6 +389,13 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  	input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0);
>  	input_set_abs_params(input, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0);
>  
> +	error = input_mt_init_slots(input, PIXCIR_MAX_SLOTS,
> +				    INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
> +	if (error) {
> +		dev_err(dev, "Error initializing Multi-Touch slots\n");
> +		return error;
> +	}
> +
>  	input_set_drvdata(input, tsdata);
>  
>  	error = devm_gpio_request_one(dev, pdata->gpio_attb,
> -- 
> 1.8.3.2
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v5 7/7] Input: pixcir_i2c_ts: Add device tree support
From: Dmitry Torokhov @ 2014-05-19  5:54 UTC (permalink / raw)
  To: Roger Quadros
  Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
	linux-kernel, devicetree
In-Reply-To: <1399374372-29123-8-git-send-email-rogerq@ti.com>

On Tue, May 06, 2014 at 02:06:12PM +0300, Roger Quadros wrote:
> Provide device tree support and binding information.
> Also provide support for a new chip "pixcir_tangoc".
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  .../bindings/input/touchscreen/pixcir_i2c_ts.txt   | 26 ++++++++
>  .../devicetree/bindings/vendor-prefixes.txt        |  1 +
>  drivers/input/touchscreen/pixcir_i2c_ts.c          | 78 ++++++++++++++++++++++
>  3 files changed, 105 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> new file mode 100644
> index 0000000..0ab9505
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> @@ -0,0 +1,26 @@
> +* Pixcir I2C touchscreen controllers
> +
> +Required properties:
> +- compatible: must be "pixcir,pixcir_ts" or "pixcir,pixcir_tangoc"
> +- reg: I2C address of the chip
> +- interrupts: interrupt to which the chip is connected
> +- attb-gpio: GPIO connected to the ATTB line of the chip
> +- x-size: horizontal resolution of touchscreen
> +- y-size: vertical resolution of touchscreen

There is a patch by Sebastian Reichel trying to unify touchscreen OF
properties, I think it would be nice if we used the same properties
here.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 1/2] ARM: OMAP2+: remove unused omap4-keypad file and code
From: Dmitry Torokhov @ 2014-05-19  5:37 UTC (permalink / raw)
  To: Joachim Eastwood; +Cc: illia.smyrnov, tony, linux-omap, linux-input
In-Reply-To: <1400361851-32274-2-git-send-email-manabian@gmail.com>

On Sat, May 17, 2014 at 11:24:10PM +0200, Joachim Eastwood wrote:
> This has been unused since omap4 board files went away.
> 
> Signed-off-by: Joachim Eastwood <manabian@gmail.com>

Tony, can I merge both through my tree?

> ---
>  arch/arm/mach-omap2/devices.c      | 33 ---------------------------------
>  arch/arm/mach-omap2/omap4-keypad.h |  8 --------
>  2 files changed, 41 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/omap4-keypad.h
> 
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> index e58609b312c7..592ba0a0ecf3 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -18,7 +18,6 @@
>  #include <linux/slab.h>
>  #include <linux/of.h>
>  #include <linux/pinctrl/machine.h>
> -#include <linux/platform_data/omap4-keypad.h>
>  #include <linux/platform_data/mailbox-omap.h>
>  
>  #include <asm/mach-types.h>
> @@ -29,7 +28,6 @@
>  #include "iomap.h"
>  #include "omap_hwmod.h"
>  #include "omap_device.h"
> -#include "omap4-keypad.h"
>  
>  #include "soc.h"
>  #include "common.h"
> @@ -255,37 +253,6 @@ static inline void omap_init_camera(void)
>  #endif
>  }
>  
> -int __init omap4_keyboard_init(struct omap4_keypad_platform_data
> -			*sdp4430_keypad_data, struct omap_board_data *bdata)
> -{
> -	struct platform_device *pdev;
> -	struct omap_hwmod *oh;
> -	struct omap4_keypad_platform_data *keypad_data;
> -	unsigned int id = -1;
> -	char *oh_name = "kbd";
> -	char *name = "omap4-keypad";
> -
> -	oh = omap_hwmod_lookup(oh_name);
> -	if (!oh) {
> -		pr_err("Could not look up %s\n", oh_name);
> -		return -ENODEV;
> -	}
> -
> -	keypad_data = sdp4430_keypad_data;
> -
> -	pdev = omap_device_build(name, id, oh, keypad_data,
> -				 sizeof(struct omap4_keypad_platform_data));
> -
> -	if (IS_ERR(pdev)) {
> -		WARN(1, "Can't build omap_device for %s:%s.\n",
> -						name, oh->name);
> -		return PTR_ERR(pdev);
> -	}
> -	oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
> -
> -	return 0;
> -}
> -
>  #if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE)
>  static inline void __init omap_init_mbox(void)
>  {
> diff --git a/arch/arm/mach-omap2/omap4-keypad.h b/arch/arm/mach-omap2/omap4-keypad.h
> deleted file mode 100644
> index 20de0d5a7e77..000000000000
> --- a/arch/arm/mach-omap2/omap4-keypad.h
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -#ifndef ARCH_ARM_PLAT_OMAP4_KEYPAD_H
> -#define ARCH_ARM_PLAT_OMAP4_KEYPAD_H
> -
> -struct omap_board_data;
> -
> -extern int omap4_keyboard_init(struct omap4_keypad_platform_data *,
> -				struct omap_board_data *);
> -#endif
> -- 
> 1.8.0
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCHv3 1/5] Input: add common DT binding for touchscreens
From: Dmitry Torokhov @ 2014-05-19  5:35 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, linux-input, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree, linux-omap, linux-kernel
In-Reply-To: <20140505230412.GC6261@earth.universe>

On Tue, May 06, 2014 at 01:04:12AM +0200, Sebastian Reichel wrote:
> On Mon, May 05, 2014 at 12:51:39PM -0700, Dmitry Torokhov wrote:
> > On Mon, May 05, 2014 at 12:41:26PM -0700, Tony Lindgren wrote:
> > > * Sebastian Reichel <sre@kernel.org> [140425 16:56]:
> > > > Add common DT binding documentation for touchscreen devices and
> > > > implement input_parse_touchscreen_of_params, which parses the common
> > > > properties and configures the input device accordingly.
> > > > 
> > > > The method currently does not interpret the axis inversion properties,
> > > > since there is no matching flag in the generic linux input device.
> > > > 
> > > > Signed-off-by: Sebastian Reichel <sre@kernel.org>
> > > > ---
> > > >  .../bindings/input/touchscreen/touchscreen.txt     | 27 +++++++++++++++++
> > > >  drivers/input/input.c                              | 34 ++++++++++++++++++++++
> > > >  include/linux/input.h                              |  8 +++++
> > > >  3 files changed, 69 insertions(+)
> > > >  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > new file mode 100644
> > > > index 0000000..d8e0616
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > @@ -0,0 +1,27 @@
> > > > +General Touchscreen Properties:
> > > > +
> > > > +Optional properties for Touchscreens:
> > > > + - touchscreen-size-x		: horizontal resolution of touchscreen
> > > > +				  (in pixels)
> > > > + - touchscreen-size-y		: vertical resolution of touchscreen
> > > > +				  (in pixels)
> > > > + - touchscreen-max-pressure	: maximum reported pressure (arbitrary range
> > > > +				  dependent on the controller)
> > > > + - touchscreen-fuzz-x		: horizontal noise value of the absolute input
> > > > +				  device (in pixels)
> > > > + - touchscreen-fuzz-y		: vertical noise value of the absolute input
> > > > +				  device (in pixels)
> > > > + - touchscreen-fuzz-pressure	: pressure noise value of the absolute input
> > > > +				  device (arbitrary range dependent on the
> > > > +				  controller)
> > 
> > Fuzz seems like linux-specific property, not generic one.
> 
> I don't know about the term "fuzz", but the idea is pretty generic
> IMHO. It's similar to debouncing switches/buttons.

OK, fair enough.

> 
> > > > + - touchscreen-inverted-x	: X axis is inverted (boolean)
> > > > + - touchscreen-inverted-y	: Y axis is inverted (boolean)
> > > 
> > > We probably also need something to swap x and y depending on the
> > > display orientation in addition to the touchscreen-inverted-x and y.
> > > Just swapping x and y is not enough depending if we rotate by 270
> > > degrees instead of 90 degrees.
> > > 
> > > Naturally that part can be added later.
> > 
> > So far we've been relying on upper layers (such as tslib) to perform
> > such transformations rather than re-implementing it in every driver. Are
> > we saying that we need to implement this in input core?
> 
> I would appreciate to add this later to move on with this patchset.
> Having the N900's touchscreen working via DT in 3.16 would be nice
> now that the display is working :)
> 

Please remove the "inverted" bits and move touchscreen OF parsing into a
separate file/module, similarly to support for sparse and matrix keymaps
that we have - it does not really belong to input core.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCHv3 3/5] Input: tsc2005: convert driver to use devm_*
From: Dmitry Torokhov @ 2014-05-19  5:33 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, linux-input, Tony Lindgren, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel
In-Reply-To: <1398470179-20880-4-git-send-email-sre@kernel.org>

On Sat, Apr 26, 2014 at 01:56:17AM +0200, Sebastian Reichel wrote:
> Simplify the driver by using managed resources for memory allocation of
> internal struct, input device allocation and irq request.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Applied, thank you.

> ---
>  drivers/input/touchscreen/tsc2005.c | 30 ++++++++++--------------------
>  1 file changed, 10 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
> index 520e673..9daaddd 100644
> --- a/drivers/input/touchscreen/tsc2005.c
> +++ b/drivers/input/touchscreen/tsc2005.c
> @@ -604,12 +604,10 @@ static int tsc2005_probe(struct spi_device *spi)
>  	if (error)
>  		return error;
>  
> -	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
> -	input_dev = input_allocate_device();
> -	if (!ts || !input_dev) {
> -		error = -ENOMEM;
> -		goto err_free_mem;
> -	}
> +	ts = devm_kzalloc(&spi->dev, sizeof(*ts), GFP_KERNEL);
> +	input_dev = devm_input_allocate_device(&spi->dev);
> +	if (!ts || !input_dev)
> +		return -ENOMEM;
>  
>  	ts->spi = spi;
>  	ts->idev = input_dev;
> @@ -649,12 +647,13 @@ static int tsc2005_probe(struct spi_device *spi)
>  	/* Ensure the touchscreen is off */
>  	tsc2005_stop_scan(ts);
>  
> -	error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread,
> -				     IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> -				     "tsc2005", ts);
> +	error = devm_request_threaded_irq(&spi->dev, spi->irq, NULL,
> +					  tsc2005_irq_thread,
> +					  IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> +					  "tsc2005", ts);
>  	if (error) {
>  		dev_err(&spi->dev, "Failed to request irq, err: %d\n", error);
> -		goto err_free_mem;
> +		return error;
>  	}
>  
>  	spi_set_drvdata(spi, ts);
> @@ -662,7 +661,7 @@ static int tsc2005_probe(struct spi_device *spi)
>  	if (error) {
>  		dev_err(&spi->dev,
>  			"Failed to create sysfs attributes, err: %d\n", error);
> -		goto err_clear_drvdata;
> +		return error;
>  	}
>  
>  	error = input_register_device(ts->idev);
> @@ -677,11 +676,6 @@ static int tsc2005_probe(struct spi_device *spi)
>  
>  err_remove_sysfs:
>  	sysfs_remove_group(&spi->dev.kobj, &tsc2005_attr_group);
> -err_clear_drvdata:
> -	free_irq(spi->irq, ts);
> -err_free_mem:
> -	input_free_device(input_dev);
> -	kfree(ts);
>  	return error;
>  }
>  
> @@ -691,10 +685,6 @@ static int tsc2005_remove(struct spi_device *spi)
>  
>  	sysfs_remove_group(&ts->spi->dev.kobj, &tsc2005_attr_group);
>  
> -	free_irq(ts->spi->irq, ts);
> -	input_unregister_device(ts->idev);
> -	kfree(ts);
> -
>  	return 0;
>  }
>  
> -- 
> 1.9.2
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCHv3 2/5] Input: tsc2005: use dev_err for error messages
From: Dmitry Torokhov @ 2014-05-19  5:33 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, linux-input, Tony Lindgren, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-omap, linux-kernel
In-Reply-To: <1398470179-20880-3-git-send-email-sre@kernel.org>

On Sat, Apr 26, 2014 at 01:56:16AM +0200, Sebastian Reichel wrote:
> Change some dev_dbg() invocations to dev_err() ones, because they
> are supposed to output error messages.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>

Applied, thank you.

> ---
>  drivers/input/touchscreen/tsc2005.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
> index 550adcb..520e673 100644
> --- a/drivers/input/touchscreen/tsc2005.c
> +++ b/drivers/input/touchscreen/tsc2005.c
> @@ -579,7 +579,7 @@ static int tsc2005_probe(struct spi_device *spi)
>  	int error;
>  
>  	if (!pdata) {
> -		dev_dbg(&spi->dev, "no platform data\n");
> +		dev_err(&spi->dev, "no platform data\n");
>  		return -ENODEV;
>  	}
>  
> @@ -591,7 +591,7 @@ static int tsc2005_probe(struct spi_device *spi)
>  	max_p	= pdata->ts_pressure_max   ? : MAX_12BIT;
>  
>  	if (spi->irq <= 0) {
> -		dev_dbg(&spi->dev, "no irq\n");
> +		dev_err(&spi->dev, "no irq\n");
>  		return -ENODEV;
>  	}
>  
> -- 
> 1.9.2
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: rotary encoder: implement quarter period mode
From: Dmitry Torokhov @ 2014-05-19  3:45 UTC (permalink / raw)
  To: Ezequiel García
  Cc: Mark Rutland, Sascha Hauer, linux-input@vger.kernel.org,
	Daniel Mack, devicetree@vger.kernel.org
In-Reply-To: <20140519032659.GA1062@arch.cereza>

On Mon, May 19, 2014 at 12:26:59AM -0300, Ezequiel García wrote:
> On 08 May 02:01 PM, Ezequiel García wrote:
> > On 07 May 11:59 AM, Dmitry Torokhov wrote:
> > > On Wed, May 07, 2014 at 03:45:43PM +0100, Mark Rutland 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@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?
> > > 
> > 
> > Mark: what do you say?
> > 
> > I can fix a few patches if everyone agrees...
> 
> After some thought, it seemed to me we can define a more specific property
> to describe this, instead of a generic "type".
> 
> The difference among these three "modes" is the number of turns needed to make
> a step.
> 
> In the current driver, the default is 4 turns per step, where for the half-period
> mode it's 2 turns per step. Now, we need to support 1 turn per step and hence
> Sascha proposes a new quarter-period mode.
> 
> Given we only need to describe the number of turns per step, I'd say it's
> more accurate and less confusing to deprecate the bool half-period property
> and instead introduce a "rotary-encoder,turns-per-step" integer property.
> 
> How does this sound?

We'd have to "filter out" invalid step settings, but that sounds fine by
me.

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

^ permalink raw reply

* Re: [PATCH] input: rotary encoder: implement quarter period mode
From: Ezequiel García @ 2014-05-19  3:26 UTC (permalink / raw)
  To: Dmitry Torokhov, Mark Rutland
  Cc: Sascha Hauer, linux-input@vger.kernel.org, Daniel Mack,
	devicetree@vger.kernel.org
In-Reply-To: <20140508170133.GA1199@arch.cereza>

On 08 May 02:01 PM, Ezequiel García wrote:
> On 07 May 11:59 AM, Dmitry Torokhov wrote:
> > On Wed, May 07, 2014 at 03:45:43PM +0100, Mark Rutland 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@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?
> > 
> 
> Mark: what do you say?
> 
> I can fix a few patches if everyone agrees...

After some thought, it seemed to me we can define a more specific property
to describe this, instead of a generic "type".

The difference among these three "modes" is the number of turns needed to make
a step.

In the current driver, the default is 4 turns per step, where for the half-period
mode it's 2 turns per step. Now, we need to support 1 turn per step and hence
Sascha proposes a new quarter-period mode.

Given we only need to describe the number of turns per step, I'd say it's
more accurate and less confusing to deprecate the bool half-period property
and instead introduce a "rotary-encoder,turns-per-step" integer property.

How does this sound?
-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar
--
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] Input: ims-pcu - fix uninitialized use of 'error' in ims_pcu_buffers_alloc()
From: Dmitry Torokhov @ 2014-05-18 23:00 UTC (permalink / raw)
  To: Christian Engelmayer; +Cc: linux-input, andrew.smirnov, linux-kernel
In-Reply-To: <1400449278-14513-1-git-send-email-cengelma@gmx.at>

On Sun, May 18, 2014 at 11:41:18PM +0200, Christian Engelmayer wrote:
> In case allocation via usb_alloc_coherent() fails in ims_pcu_buffers_alloc(),
> the function jumps to the exit path without initializing local variable
> 'error' that is used as return value. Detected by Coverity - CID 1016531.
> 
> Signed-off-by: Christian Engelmayer <cengelma@gmx.at>

Applied, thank you.

> ---
> This is an allocation function and all currently coded error scenarios
> result in -ENOMEM. Thus it would be possible to eliminate 'error' at all and
> always return -ENOMEM in the error path.
> 
> Compile tested. Applies against branch next in tree
> git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
> ---
>  drivers/input/misc/ims-pcu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
> index 5a73639..719410f 100644
> --- a/drivers/input/misc/ims-pcu.c
> +++ b/drivers/input/misc/ims-pcu.c
> @@ -1566,6 +1566,7 @@ static int ims_pcu_buffers_alloc(struct ims_pcu *pcu)
>  	if (!pcu->urb_ctrl_buf) {
>  		dev_err(pcu->dev,
>  			"Failed to allocate memory for read buffer\n");
> +		error = -ENOMEM;
>  		goto err_free_urb_out_buf;
>  	}
>  
> -- 
> 1.9.1
> 

-- 
Dmitry

^ permalink raw reply

* [PATCH] Input: ims-pcu - fix uninitialized use of 'error' in ims_pcu_buffers_alloc()
From: Christian Engelmayer @ 2014-05-18 21:41 UTC (permalink / raw)
  To: linux-input
  Cc: dmitry.torokhov, andrew.smirnov, linux-kernel,
	Christian Engelmayer

In case allocation via usb_alloc_coherent() fails in ims_pcu_buffers_alloc(),
the function jumps to the exit path without initializing local variable
'error' that is used as return value. Detected by Coverity - CID 1016531.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
---
This is an allocation function and all currently coded error scenarios
result in -ENOMEM. Thus it would be possible to eliminate 'error' at all and
always return -ENOMEM in the error path.

Compile tested. Applies against branch next in tree
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
---
 drivers/input/misc/ims-pcu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 5a73639..719410f 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1566,6 +1566,7 @@ static int ims_pcu_buffers_alloc(struct ims_pcu *pcu)
 	if (!pcu->urb_ctrl_buf) {
 		dev_err(pcu->dev,
 			"Failed to allocate memory for read buffer\n");
+		error = -ENOMEM;
 		goto err_free_urb_out_buf;
 	}
 
-- 
1.9.1


^ permalink raw reply related

* Re: [PATCH] input: gpio-keys: Move the gpio-keys bindings documentation
From: Dmitry Torokhov @ 2014-05-18 20:42 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ezequiel Garcia, devicetree@vger.kernel.org,
	linux-gpio@vger.kernel.org, Linux Input
In-Reply-To: <CACRpkdZgbnFSUiBeQOn5L4AafaTUPS9jcEESyB9Hg7u7n+51cA@mail.gmail.com>

On Sun, May 18, 2014 at 10:30:26PM +0200, Linus Walleij wrote:
> On Mon, May 12, 2014 at 4:33 PM, Ezequiel Garcia
> <ezequiel.garcia@free-electrons.com> wrote:
> 
> > This is an input driver and belongs to input not gpio.
> >
> > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply

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

Hi Guido,

On Wed, May 07, 2014 at 10:00:42AM -0300, Guido Martínez wrote:
> 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;

I was wondering if we could also move non-DT variant to matrix-keypad
infrastructure and use matrix_keypad_build_keymap and friends to handle
this uniformly.

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

^ permalink raw reply

* Re: [PATCH 3/3] synaptics: Change min/max quirk table to pnp-id matching
From: Dmitry Torokhov @ 2014-05-18 20:35 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Peter Hutterer, Benjamin Tissoires, linux-input, stable
In-Reply-To: <1400266009-5436-4-git-send-email-hdegoede@redhat.com>

On Fri, May 16, 2014 at 08:46:49PM +0200, Hans de Goede wrote:
> Most of the affected models share pnp-ids for the touchpad. So switching
> to pnp-ids give us 2 advantages:
> 1) It shrinks the quirk list
> 2) It will lower the new quirk addition frequency, ie the recently added W540
>    quirk would not have been necessary since it uses the same LEN0034 pnp ids
>    as other models already added before it
> 
> As an added bonus it actually puts the quirk on the actual psmouse, rather then
> on the machine, which is technically more correct.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/input/mouse/synaptics.c | 149 ++++++++++------------------------------
>  1 file changed, 36 insertions(+), 113 deletions(-)
> 
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 395ec9c..c5ec703 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -117,6 +117,31 @@ void synaptics_reset(struct psmouse *psmouse)
>  }
>  
>  #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
> +struct min_max_quirk {
> +	const char * const *pnp_ids;
> +	int x_min, x_max, y_min, y_max;
> +};


Why don't we define this as 1 quirk per PNP id?

struct min_max_quirk {
	const char *pnp_id;
	int x_min, x_max, y_min, y_max;
};

?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: gpio-keys: Move the gpio-keys bindings documentation
From: Linus Walleij @ 2014-05-18 20:30 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: devicetree@vger.kernel.org, linux-gpio@vger.kernel.org,
	Linux Input, Dmitry Torokhov
In-Reply-To: <1399905224-1273-1-git-send-email-ezequiel.garcia@free-electrons.com>

On Mon, May 12, 2014 at 4:33 PM, Ezequiel Garcia
<ezequiel.garcia@free-electrons.com> wrote:

> This is an input driver and belongs to input not gpio.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply

* Re: usbhid: PicoLCD 256x64 USB error -71
From: Kieran Kunhya @ 2014-05-18 19:44 UTC (permalink / raw)
  To: Bruno Prémont; +Cc: linux-input
In-Reply-To: <20140518203718.5422588f@neptune.home>

On 18 May 2014 19:37, Bruno Prémont <bonbons@linux-vserver.org> wrote:
> I successfully tried on:
> - Gigabyte mainboard (GA-A75M-UD2H) (USB2 & USB3 ports) [3.15-rc5, 64bit]
> - Acer Travelmate 66x [3.15-rc2, 32bit]
> - Commell LE-365 [3.14, 32bit]
> - IEI KINO-690S1 [3.14, 64bit]

It works fine on other machines, but not with the ASRock IMB-181D
board from time to time. Sometimes it does start correctly, however.
The behaviour is very confusing since Windows seems to work reliably.

> Did some previous kernel release work?

I have tried a selection of kernels in the 3.0 series.

> Could you provide verbose lsusb output and firmware version for your PicoLCD?

I will provide this information within a few days and also verify the
pins are correct.

Regards,

Kieran Kunhya
--
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: usbhid: PicoLCD 256x64 USB error -71
From: Bruno Prémont @ 2014-05-18 18:37 UTC (permalink / raw)
  To: Kieran Kunhya; +Cc: linux-input
In-Reply-To: <032001cf7156$31a75610$94f60230$@obe.tv>

Hi Kieran,

On Fri, 16 May 2014 "Kieran Kunhya" <kierank@obe.tv> wrote:
> As requested I forward my bug report to the list:
> 
> From time to time on an ASRock IMB-181D motherboard this device fails to be
> added. 
> It seems to work reliably when using Windows 7. 
> The errors in dmesg vary but usually take the form: 
> [  5.328040] usb 3-7: string descriptor 0 read error: -71 
> (snip) 
> [  10.333605] usbhid 3-7:1.0: can't add hid device: -71 
> [  10.333639] usbhid: probe of 3-7:1.0 failed with error -71 
> I can provide a PicoLCD unit if necessary and possibly also fund a
> fix/workaround.
> 
> More information is available here:
> https://bugzilla.kernel.org/show_bug.cgi?id=76341

Hm, picoLCD works for me, but I get -71 error code if I swap both
data pins (but with read failure "device descriptor read/64, error -71").

Here it works with:
  J4, pin 1 = red
  J4, pin 2 = white
  J4, pin 3 = green
  J4, pin 4 = black
  J4, pin 5 = n/a

I successfully tried on:
- Gigabyte mainboard (GA-A75M-UD2H) (USB2 & USB3 ports) [3.15-rc5, 64bit]
- Acer Travelmate 66x [3.15-rc2, 32bit]
- Commell LE-365 [3.14, 32bit]
- IEI KINO-690S1 [3.14, 64bit]


Did some previous kernel release work?
Could you provide verbose lsusb output and firmware version for your PicoLCD?

Thanks,
Bruno
--
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 1/2] Input: Add keycodes for some missing Fn key combinations
From: Dmitry Torokhov @ 2014-05-17 21:32 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Matthew Garrett, linux-input, platform-driver-x86, linux-hotplug,
	Matthew Garrett, linux-kernel
In-Reply-To: <201405172238.30089@pali>

On Sat, May 17, 2014 at 10:38:30PM +0200, Pali Rohár wrote:
> On Saturday 17 May 2014 22:30:54 Dmitry Torokhov wrote:
> > Hi Pali,
> > 
> > On Sat, May 17, 2014 at 04:43:36PM +0200, Pali Rohár wrote:
> > > There are already defined some Fn key combinations, but not
> > > all. This patch adds missing combinations for support in
> > > dell-wmi driver.
> > > 
> > > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > > ---
> > > 
> > >  include/uapi/linux/input.h |    6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/include/uapi/linux/input.h
> > > b/include/uapi/linux/input.h index f484952..3a32799 100644
> > > --- a/include/uapi/linux/input.h
> > > +++ b/include/uapi/linux/input.h
> > > @@ -672,6 +672,12 @@ struct input_keymap_entry {
> > > 
> > >  #define KEY_FN_F		0x1e2
> > >  #define KEY_FN_S		0x1e3
> > >  #define KEY_FN_B		0x1e4
> > > 
> > > +#define KEY_FN_Q		0x1e5
> > > +#define KEY_FN_W		0x1e6
> > > +#define KEY_FN_R		0x1e7
> > > +#define KEY_FN_T		0x1e8
> > > +#define KEY_FN_A		0x1e9
> > > +#define KEY_FN_G		0x1ea
> > 
> > What do they actually do?
> > 
> > Thanks.
> 
> All 10 combinations Fn+Q ... Fn+T, Fn+A ... Fn+G are reported by 
> WMI and I need to assign some keycodes for them in dell-wmi 
> driver. 

If they do not have a well-defined meaning then KEY_UNKNOWN is
appropriate and user later can redefine via EVIOCSKEYCODE to the code
they wish.

> And because More FN_* constants are already defined in 
> input.h I added those which are missing.

I am not sure if adding existing generic KEY_FN_* was a good idea.

> 
> With this patch series I'm able to use above Fn combinations for 
> my own keyboard shortcuts. Before this patch all Fn combinations 
> were one same keycode - which was useless.

Are there not enough key definitions already to accommodate actions you
want? dell-wmi supports changing keymap from usersopace so you should be
able to remap entries you want to the actions you need.

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

^ permalink raw reply

* [PATCH 1/2] ARM: OMAP2+: remove unused omap4-keypad file and code
From: Joachim Eastwood @ 2014-05-17 21:24 UTC (permalink / raw)
  To: illia.smyrnov, dmitry.torokhov, tony
  Cc: linux-omap, linux-input, Joachim Eastwood
In-Reply-To: <1400361851-32274-1-git-send-email-manabian@gmail.com>

This has been unused since omap4 board files went away.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 arch/arm/mach-omap2/devices.c      | 33 ---------------------------------
 arch/arm/mach-omap2/omap4-keypad.h |  8 --------
 2 files changed, 41 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/omap4-keypad.h

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index e58609b312c7..592ba0a0ecf3 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -18,7 +18,6 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/pinctrl/machine.h>
-#include <linux/platform_data/omap4-keypad.h>
 #include <linux/platform_data/mailbox-omap.h>
 
 #include <asm/mach-types.h>
@@ -29,7 +28,6 @@
 #include "iomap.h"
 #include "omap_hwmod.h"
 #include "omap_device.h"
-#include "omap4-keypad.h"
 
 #include "soc.h"
 #include "common.h"
@@ -255,37 +253,6 @@ static inline void omap_init_camera(void)
 #endif
 }
 
-int __init omap4_keyboard_init(struct omap4_keypad_platform_data
-			*sdp4430_keypad_data, struct omap_board_data *bdata)
-{
-	struct platform_device *pdev;
-	struct omap_hwmod *oh;
-	struct omap4_keypad_platform_data *keypad_data;
-	unsigned int id = -1;
-	char *oh_name = "kbd";
-	char *name = "omap4-keypad";
-
-	oh = omap_hwmod_lookup(oh_name);
-	if (!oh) {
-		pr_err("Could not look up %s\n", oh_name);
-		return -ENODEV;
-	}
-
-	keypad_data = sdp4430_keypad_data;
-
-	pdev = omap_device_build(name, id, oh, keypad_data,
-				 sizeof(struct omap4_keypad_platform_data));
-
-	if (IS_ERR(pdev)) {
-		WARN(1, "Can't build omap_device for %s:%s.\n",
-						name, oh->name);
-		return PTR_ERR(pdev);
-	}
-	oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
-
-	return 0;
-}
-
 #if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE)
 static inline void __init omap_init_mbox(void)
 {
diff --git a/arch/arm/mach-omap2/omap4-keypad.h b/arch/arm/mach-omap2/omap4-keypad.h
deleted file mode 100644
index 20de0d5a7e77..000000000000
--- a/arch/arm/mach-omap2/omap4-keypad.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef ARCH_ARM_PLAT_OMAP4_KEYPAD_H
-#define ARCH_ARM_PLAT_OMAP4_KEYPAD_H
-
-struct omap_board_data;
-
-extern int omap4_keyboard_init(struct omap4_keypad_platform_data *,
-				struct omap_board_data *);
-#endif
-- 
1.8.0


^ permalink raw reply related

* [PATCH 0/2] remove unused omap4-keypad files and pdata support
From: Joachim Eastwood @ 2014-05-17 21:24 UTC (permalink / raw)
  To: illia.smyrnov, dmitry.torokhov, tony
  Cc: linux-omap, linux-input, Joachim Eastwood

Hi,

This patch removes unused omap4-keypad init functions from mach-omap2
and makes the driver DT only. Board files for omap4 are long gone and
this has been unused since.

Note: This has only been compile tested!

Joachim Eastwood (2):
  ARM: OMAP2+: remove unused omap4-keypad file and code
  Input: omap-keypad - remove platform data support

 arch/arm/mach-omap2/devices.c              | 33 ------------------------------
 arch/arm/mach-omap2/omap4-keypad.h         |  8 --------
 drivers/input/keyboard/Kconfig             |  2 +-
 drivers/input/keyboard/omap4-keypad.c      | 31 ++++++----------------------
 include/linux/platform_data/omap4-keypad.h | 13 ------------
 5 files changed, 7 insertions(+), 80 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/omap4-keypad.h
 delete mode 100644 include/linux/platform_data/omap4-keypad.h

-- 
1.8.0


^ permalink raw reply

* [PATCH 2/2] Input: omap-keypad - remove platform data support
From: Joachim Eastwood @ 2014-05-17 21:24 UTC (permalink / raw)
  To: illia.smyrnov, dmitry.torokhov, tony
  Cc: linux-omap, linux-input, Joachim Eastwood
In-Reply-To: <1400361851-32274-1-git-send-email-manabian@gmail.com>

This is unused since all users (OMAP4/5) are DT only.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/input/keyboard/Kconfig             |  2 +-
 drivers/input/keyboard/omap4-keypad.c      | 31 ++++++------------------------
 include/linux/platform_data/omap4-keypad.h | 13 -------------
 3 files changed, 7 insertions(+), 39 deletions(-)
 delete mode 100644 include/linux/platform_data/omap4-keypad.h

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 76842d7dc2e3..295cbf4763b1 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -578,7 +578,7 @@ config KEYBOARD_OMAP
 
 config KEYBOARD_OMAP4
 	tristate "TI OMAP4+ keypad support"
-	depends on ARCH_OMAP2PLUS
+	depends on OF || ARCH_OMAP2PLUS
 	select INPUT_MATRIXKMAP
 	help
 	  Say Y here if you want to use the OMAP4+ keypad.
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 0400b3f2b4b9..8b32f44e84ee 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -28,11 +28,10 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 
-#include <linux/platform_data/omap4-keypad.h>
-
 /* OMAP4 registers */
 #define OMAP4_KBD_REVISION		0x00
 #define OMAP4_KBD_SYSCONFIG		0x10
@@ -218,7 +217,6 @@ static void omap4_keypad_close(struct input_dev *input)
 	pm_runtime_put_sync(input->dev.parent);
 }
 
-#ifdef CONFIG_OF
 static int omap4_keypad_parse_dt(struct device *dev,
 				 struct omap4_keypad *keypad_data)
 {
@@ -235,20 +233,10 @@ static int omap4_keypad_parse_dt(struct device *dev,
 
 	return 0;
 }
-#else
-static inline int omap4_keypad_parse_dt(struct device *dev,
-					struct omap4_keypad *keypad_data)
-{
-	return -ENOSYS;
-}
-#endif
 
 static int omap4_keypad_probe(struct platform_device *pdev)
 {
-	const struct omap4_keypad_platform_data *pdata =
-				dev_get_platdata(&pdev->dev);
-	const struct matrix_keymap_data *keymap_data =
-				pdata ? pdata->keymap_data : NULL;
+	const struct matrix_keymap_data *keymap_data = NULL;
 	struct omap4_keypad *keypad_data;
 	struct input_dev *input_dev;
 	struct resource *res;
@@ -277,14 +265,9 @@ static int omap4_keypad_probe(struct platform_device *pdev)
 
 	keypad_data->irq = irq;
 
-	if (pdata) {
-		keypad_data->rows = pdata->rows;
-		keypad_data->cols = pdata->cols;
-	} else {
-		error = omap4_keypad_parse_dt(&pdev->dev, keypad_data);
-		if (error)
-			return error;
-	}
+	error = omap4_keypad_parse_dt(&pdev->dev, keypad_data);
+	if (error)
+		return error;
 
 	res = request_mem_region(res->start, resource_size(res), pdev->name);
 	if (!res) {
@@ -434,13 +417,11 @@ static int omap4_keypad_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id omap_keypad_dt_match[] = {
 	{ .compatible = "ti,omap4-keypad" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, omap_keypad_dt_match);
-#endif
 
 #ifdef CONFIG_PM_SLEEP
 static int omap4_keypad_suspend(struct device *dev)
@@ -482,7 +463,7 @@ static struct platform_driver omap4_keypad_driver = {
 		.name	= "omap4-keypad",
 		.owner	= THIS_MODULE,
 		.pm	= &omap4_keypad_pm_ops,
-		.of_match_table = of_match_ptr(omap_keypad_dt_match),
+		.of_match_table = omap_keypad_dt_match,
 	},
 };
 module_platform_driver(omap4_keypad_driver);
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h
deleted file mode 100644
index 4eef5fb05a17..000000000000
--- a/include/linux/platform_data/omap4-keypad.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __LINUX_INPUT_OMAP4_KEYPAD_H
-#define __LINUX_INPUT_OMAP4_KEYPAD_H
-
-#include <linux/input/matrix_keypad.h>
-
-struct omap4_keypad_platform_data {
-	const struct matrix_keymap_data *keymap_data;
-
-	u8 rows;
-	u8 cols;
-};
-
-#endif /* __LINUX_INPUT_OMAP4_KEYPAD_H */
-- 
1.8.0


^ permalink raw reply related


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