* Re: [PATCH 26/51] Input: atmel_mxt_ts - Move input device init into separate function
From: Dmitry Torokhov @ 2013-07-07 5:34 UTC (permalink / raw)
To: Nick Dyer
Cc: Daniel Kurtz, Henrik Rydberg, Joonyoung Shim, Alan Bowens,
linux-input, linux-kernel, Peter Meerwald, Benson Leung,
Olof Johansson
In-Reply-To: <1372337366-9286-27-git-send-email-nick.dyer@itdev.co.uk>
On Thu, Jun 27, 2013 at 01:49:01PM +0100, Nick Dyer wrote:
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
So before we allocated input device before requesting IRQ, now we fo it
afterwards so there is moment where the interrupt is requested and not
disabled and input device is not allocated yet. Is it possible for
interrupt to happen at that moment?
Thanks.
> ---
> drivers/input/touchscreen/atmel_mxt_ts.c | 129 +++++++++++++++++-------------
> 1 file changed, 75 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 8632133..030ebc5 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -1728,73 +1728,39 @@ static int mxt_handle_pdata(struct mxt_data *data)
> return 0;
> }
>
> -static int mxt_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int mxt_initialize_t9_input_device(struct mxt_data *data)
> {
> - struct mxt_data *data;
> + struct device *dev = &data->client->dev;
> + const struct mxt_platform_data *pdata = data->pdata;
> struct input_dev *input_dev;
> int error;
> unsigned int num_mt_slots;
> unsigned int mt_flags = 0;
> int i;
>
> - data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL);
> input_dev = input_allocate_device();
> - if (!data || !input_dev) {
> - dev_err(&client->dev, "Failed to allocate memory\n");
> - error = -ENOMEM;
> - goto err_free_mem;
> + if (!input_dev) {
> + dev_err(dev, "Failed to allocate memory\n");
> + return -ENOMEM;
> }
>
> input_dev->name = "Atmel maXTouch Touchscreen";
> - snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0",
> - client->adapter->nr, client->addr);
> -
> input_dev->phys = data->phys;
> -
> input_dev->id.bustype = BUS_I2C;
> - input_dev->dev.parent = &client->dev;
> + input_dev->dev.parent = dev;
> input_dev->open = mxt_input_open;
> input_dev->close = mxt_input_close;
>
> - data->client = client;
> - data->input_dev = input_dev;
> - data->irq = client->irq;
> - i2c_set_clientdata(client, data);
> -
> - error = mxt_handle_pdata(data);
> - if (error)
> - goto err_free_mem;
> -
> - init_completion(&data->bl_completion);
> - init_completion(&data->reset_completion);
> - init_completion(&data->crc_completion);
> -
> - error = request_threaded_irq(data->irq, NULL, mxt_interrupt,
> - data->pdata->irqflags | IRQF_ONESHOT,
> - client->name, data);
> - if (error) {
> - dev_err(&client->dev, "Failed to register interrupt\n");
> - goto err_free_pdata;
> - }
> -
> - disable_irq(client->irq);
> -
> - error = mxt_initialize(data);
> - if (error)
> - goto err_free_irq;
> -
> __set_bit(EV_ABS, input_dev->evbit);
> - __set_bit(EV_KEY, input_dev->evbit);
> - __set_bit(BTN_TOUCH, input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
>
> - if (data->pdata->t19_num_keys) {
> + if (pdata->t19_num_keys) {
> __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit);
>
> - for (i = 0; i < data->pdata->t19_num_keys; i++)
> - if (data->pdata->t19_keymap[i] != KEY_RESERVED)
> + for (i = 0; i < pdata->t19_num_keys; i++)
> + if (pdata->t19_keymap[i] != KEY_RESERVED)
> input_set_capability(input_dev, EV_KEY,
> - data->pdata->t19_keymap[i]);
> + pdata->t19_keymap[i]);
>
> mt_flags |= INPUT_MT_POINTER;
>
> @@ -1819,8 +1785,11 @@ static int mxt_probe(struct i2c_client *client,
> /* For multi touch */
> num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1;
> error = input_mt_init_slots(input_dev, num_mt_slots, mt_flags);
> - if (error)
> - goto err_free_object;
> + if (error) {
> + dev_err(dev, "Error %d initialising slots\n", error);
> + goto err_free_mem;
> + }
> +
> input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
> 0, MXT_MAX_AREA, 0, 0);
> input_set_abs_params(input_dev, ABS_MT_POSITION_X,
> @@ -1834,11 +1803,64 @@ static int mxt_probe(struct i2c_client *client,
>
> error = input_register_device(input_dev);
> if (error) {
> - dev_err(&client->dev, "Error %d registering input device\n",
> - error);
> - goto err_free_object;
> + dev_err(dev, "Error %d registering input device\n", error);
> + goto err_free_mem;
> }
>
> + data->input_dev = input_dev;
> +
> + return 0;
> +
> +err_free_mem:
> + input_free_device(input_dev);
> + return error;
> +}
> +
> +static int mxt_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + struct mxt_data *data;
> + int error;
> +
> + data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL);
> + if (!data) {
> + dev_err(&client->dev, "Failed to allocate memory\n");
> + return -ENOMEM;
> + }
> +
> + snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0",
> + client->adapter->nr, client->addr);
> +
> + data->client = client;
> + data->irq = client->irq;
> + i2c_set_clientdata(client, data);
> +
> + error = mxt_handle_pdata(data);
> + if (error)
> + goto err_free_mem;
> +
> + init_completion(&data->bl_completion);
> + init_completion(&data->reset_completion);
> + init_completion(&data->crc_completion);
> +
> + error = request_threaded_irq(data->irq, NULL, mxt_interrupt,
> + data->pdata->irqflags | IRQF_ONESHOT,
> + client->name, data);
> + if (error) {
> + dev_err(&client->dev, "Failed to register interrupt\n");
> + goto err_free_pdata;
> + }
> +
> + disable_irq(data->irq);
> +
> + error = mxt_initialize(data);
> + if (error)
> + goto err_free_irq;
> +
> + error = mxt_initialize_t9_input_device(data);
> + if (error)
> + goto err_free_object;
> +
> error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group);
> if (error) {
> dev_err(&client->dev, "Failure %d creating sysfs group\n",
> @@ -1849,8 +1871,8 @@ static int mxt_probe(struct i2c_client *client,
> return 0;
>
> err_unregister_device:
> - input_unregister_device(input_dev);
> - input_dev = NULL;
> + input_unregister_device(data->input_dev);
> + data->input_dev = NULL;
> err_free_object:
> kfree(data->object_table);
> err_free_irq:
> @@ -1859,7 +1881,6 @@ err_free_pdata:
> if (!dev_get_platdata(&data->client->dev))
> kfree(data->pdata);
> err_free_mem:
> - input_free_device(input_dev);
> kfree(data);
> return error;
> }
> --
> 1.7.10.4
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH 22/51] Input: atmel_mxt_ts - Add shutdown function
From: Dmitry Torokhov @ 2013-07-07 5:29 UTC (permalink / raw)
To: Nick Dyer
Cc: Daniel Kurtz, Henrik Rydberg, Joonyoung Shim, Alan Bowens,
linux-input, linux-kernel, Peter Meerwald, Benson Leung,
Olof Johansson
In-Reply-To: <1372337366-9286-23-git-send-email-nick.dyer@itdev.co.uk>
Hi Nick,
On Thu, Jun 27, 2013 at 01:48:57PM +0100, Nick Dyer wrote:
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
> Acked-by: Benson Leung <bleung@chromium.org>
Why is this needed?
Thanks.
> ---
> drivers/input/touchscreen/atmel_mxt_ts.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index ee1e866..76f1c20 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -1897,6 +1897,13 @@ static int mxt_resume(struct device *dev)
>
> static SIMPLE_DEV_PM_OPS(mxt_pm_ops, mxt_suspend, mxt_resume);
>
> +static void mxt_shutdown(struct i2c_client *client)
> +{
> + struct mxt_data *data = i2c_get_clientdata(client);
> +
> + disable_irq(data->irq);
> +}
> +
> static const struct i2c_device_id mxt_id[] = {
> { "qt602240_ts", 0 },
> { "atmel_mxt_ts", 0 },
> @@ -1914,6 +1921,7 @@ static struct i2c_driver mxt_driver = {
> },
> .probe = mxt_probe,
> .remove = mxt_remove,
> + .shutdown = mxt_shutdown,
> .id_table = mxt_id,
> };
>
> --
> 1.7.10.4
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH] Input: cyttsp4 - use 16bit address for I2C/SPI communication
From: Dmitry Torokhov @ 2013-07-07 5:08 UTC (permalink / raw)
To: Ferruh Yigit
Cc: Dan Carpenter, ttdrivers, Javier Martinez Canillas, linux-input
In-Reply-To: <1372883780-29851-1-git-send-email-fery@cypress.com>
On Wed, Jul 03, 2013 at 11:36:20PM +0300, Ferruh Yigit wrote:
> In TSG4, register map is 512bytes long and to access all of it,
> one bit from address byte is used (which bit to use differs for
> I2C and SPI);
>
> Since common code used for TSG3 and TSG4 for I2C, this parameter
> wrongly used as u8. TSG3 does not access beyond 255 bytes
> but TSG4 may.
>
> Signed-off-by: Ferruh Yigit <fery@cypress.com>
> Tested-on: TMA3XX DVB && TMA4XX DVB
Applied, thank you.
> ---
> drivers/input/touchscreen/cyttsp4_core.h | 12 +++++-----
> drivers/input/touchscreen/cyttsp4_spi.c | 20 ++++++++---------
> drivers/input/touchscreen/cyttsp_core.h | 8 +++----
> drivers/input/touchscreen/cyttsp_i2c_common.c | 30 ++++++++++++++++++-------
> drivers/input/touchscreen/cyttsp_spi.c | 6 ++---
> 5 files changed, 44 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/input/touchscreen/cyttsp4_core.h b/drivers/input/touchscreen/cyttsp4_core.h
> index 86a2543..8e0d4d4 100644
> --- a/drivers/input/touchscreen/cyttsp4_core.h
> +++ b/drivers/input/touchscreen/cyttsp4_core.h
> @@ -369,9 +369,9 @@ struct cyttsp4 {
>
> struct cyttsp4_bus_ops {
> u16 bustype;
> - int (*write)(struct device *dev, u8 *xfer_buf, u8 addr, u8 length,
> + int (*write)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
> const void *values);
> - int (*read)(struct device *dev, u8 *xfer_buf, u8 addr, u8 length,
> + int (*read)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
> void *values);
> };
>
> @@ -448,13 +448,13 @@ enum cyttsp4_event_id {
> /* y-axis, 0:origin is on top side of panel, 1: bottom */
> #define CY_PCFG_ORIGIN_Y_MASK 0x80
>
> -static inline int cyttsp4_adap_read(struct cyttsp4 *ts, u8 addr, int size,
> +static inline int cyttsp4_adap_read(struct cyttsp4 *ts, u16 addr, int size,
> void *buf)
> {
> return ts->bus_ops->read(ts->dev, ts->xfer_buf, addr, size, buf);
> }
>
> -static inline int cyttsp4_adap_write(struct cyttsp4 *ts, u8 addr, int size,
> +static inline int cyttsp4_adap_write(struct cyttsp4 *ts, u16 addr, int size,
> const void *buf)
> {
> return ts->bus_ops->write(ts->dev, ts->xfer_buf, addr, size, buf);
> @@ -463,9 +463,9 @@ static inline int cyttsp4_adap_write(struct cyttsp4 *ts, u8 addr, int size,
> extern struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
> struct device *dev, u16 irq, size_t xfer_buf_size);
> extern int cyttsp4_remove(struct cyttsp4 *ts);
> -int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u8 addr,
> +int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
> u8 length, const void *values);
> -int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u8 addr,
> +int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
> u8 length, void *values);
> extern const struct dev_pm_ops cyttsp4_pm_ops;
>
> diff --git a/drivers/input/touchscreen/cyttsp4_spi.c b/drivers/input/touchscreen/cyttsp4_spi.c
> index f8f891b..a71e114 100644
> --- a/drivers/input/touchscreen/cyttsp4_spi.c
> +++ b/drivers/input/touchscreen/cyttsp4_spi.c
> @@ -44,7 +44,7 @@
> #define CY_SPI_DATA_BUF_SIZE (CY_SPI_CMD_BYTES + CY_SPI_DATA_SIZE)
>
> static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> - u8 op, u8 reg, u8 *buf, int length)
> + u8 op, u16 reg, u8 *buf, int length)
> {
> struct spi_device *spi = to_spi_device(dev);
> struct spi_message msg;
> @@ -63,14 +63,12 @@ static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> memset(wr_buf, 0, CY_SPI_DATA_BUF_SIZE);
> memset(rd_buf, 0, CY_SPI_CMD_BYTES);
>
> - if (reg > 255)
> - wr_buf[0] = op + CY_SPI_A8_BIT;
> - else
> - wr_buf[0] = op;
> - if (op == CY_SPI_WR_OP)
> - wr_buf[1] = reg % 256;
> - if (op == CY_SPI_WR_OP && length > 0)
> - memcpy(wr_buf + CY_SPI_CMD_BYTES, buf, length);
> + wr_buf[0] = op + (((reg >> 8) & 0x1) ? CY_SPI_A8_BIT : 0);
> + if (op == CY_SPI_WR_OP) {
> + wr_buf[1] = reg & 0xFF;
> + if (length > 0)
> + memcpy(wr_buf + CY_SPI_CMD_BYTES, buf, length);
> + }
>
> memset(xfer, 0, sizeof(xfer));
> spi_message_init(&msg);
> @@ -130,7 +128,7 @@ static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> }
>
> static int cyttsp_spi_read_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, void *data)
> + u16 addr, u8 length, void *data)
> {
> int rc;
>
> @@ -143,7 +141,7 @@ static int cyttsp_spi_read_block_data(struct device *dev, u8 *xfer_buf,
> }
>
> static int cyttsp_spi_write_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, const void *data)
> + u16 addr, u8 length, const void *data)
> {
> return cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_WR_OP, addr, (void *)data,
> length);
> diff --git a/drivers/input/touchscreen/cyttsp_core.h b/drivers/input/touchscreen/cyttsp_core.h
> index 0cf564a..0707411 100644
> --- a/drivers/input/touchscreen/cyttsp_core.h
> +++ b/drivers/input/touchscreen/cyttsp_core.h
> @@ -112,9 +112,9 @@ struct cyttsp;
>
> struct cyttsp_bus_ops {
> u16 bustype;
> - int (*write)(struct device *dev, u8 *xfer_buf, u8 addr, u8 length,
> + int (*write)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
> const void *values);
> - int (*read)(struct device *dev, u8 *xfer_buf, u8 addr, u8 length,
> + int (*read)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
> void *values);
> };
>
> @@ -145,9 +145,9 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
> struct device *dev, int irq, size_t xfer_buf_size);
> void cyttsp_remove(struct cyttsp *ts);
>
> -int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u8 addr,
> +int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
> u8 length, const void *values);
> -int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u8 addr,
> +int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
> u8 length, void *values);
> extern const struct dev_pm_ops cyttsp_pm_ops;
>
> diff --git a/drivers/input/touchscreen/cyttsp_i2c_common.c b/drivers/input/touchscreen/cyttsp_i2c_common.c
> index 07c553f..1d7b6f1 100644
> --- a/drivers/input/touchscreen/cyttsp_i2c_common.c
> +++ b/drivers/input/touchscreen/cyttsp_i2c_common.c
> @@ -32,18 +32,20 @@
> #include <linux/types.h>
>
> int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, void *values)
> + u16 addr, u8 length, void *values)
> {
> struct i2c_client *client = to_i2c_client(dev);
> + u8 client_addr = client->addr | ((addr >> 8) & 0x1);
> + u8 addr_lo = addr & 0xFF;
> struct i2c_msg msgs[] = {
> {
> - .addr = client->addr,
> + .addr = client_addr,
> .flags = 0,
> .len = 1,
> - .buf = &addr,
> + .buf = &addr_lo,
> },
> {
> - .addr = client->addr,
> + .addr = client_addr,
> .flags = I2C_M_RD,
> .len = length,
> .buf = values,
> @@ -60,17 +62,29 @@ int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf,
> EXPORT_SYMBOL_GPL(cyttsp_i2c_read_block_data);
>
> int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, const void *values)
> + u16 addr, u8 length, const void *values)
> {
> struct i2c_client *client = to_i2c_client(dev);
> + u8 client_addr = client->addr | ((addr >> 8) & 0x1);
> + u8 addr_lo = addr & 0xFF;
> + struct i2c_msg msgs[] = {
> + {
> + .addr = client_addr,
> + .flags = 0,
> + .len = length + 1,
> + .buf = xfer_buf,
> + },
> + };
> int retval;
>
> - xfer_buf[0] = addr;
> + xfer_buf[0] = addr_lo;
> memcpy(&xfer_buf[1], values, length);
>
> - retval = i2c_master_send(client, xfer_buf, length + 1);
> + retval = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
> + if (retval < 0)
> + return retval;
>
> - return retval < 0 ? retval : 0;
> + return retval != ARRAY_SIZE(msgs) ? -EIO : 0;
> }
> EXPORT_SYMBOL_GPL(cyttsp_i2c_write_block_data);
>
> diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c
> index 1df6253..4728bcb 100644
> --- a/drivers/input/touchscreen/cyttsp_spi.c
> +++ b/drivers/input/touchscreen/cyttsp_spi.c
> @@ -41,7 +41,7 @@
> #define CY_SPI_BITS_PER_WORD 8
>
> static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> - u8 op, u8 reg, u8 *buf, int length)
> + u8 op, u16 reg, u8 *buf, int length)
> {
> struct spi_device *spi = to_spi_device(dev);
> struct spi_message msg;
> @@ -126,14 +126,14 @@ static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> }
>
> static int cyttsp_spi_read_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, void *data)
> + u16 addr, u8 length, void *data)
> {
> return cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_RD_OP, addr, data,
> length);
> }
>
> static int cyttsp_spi_write_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, const void *data)
> + u16 addr, u8 length, const void *data)
> {
> return cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_WR_OP, addr, (void *)data,
> length);
> --
> 1.7.9.5
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH RESEND] elantech: fix for newer hardware versions (v7)
From: Dmitry Torokhov @ 2013-07-07 4:59 UTC (permalink / raw)
To: Matteo Delfino; +Cc: linux-input, Alessandro Rubini
In-Reply-To: <51D7C6E6.8010904@gmail.com>
On Sat, Jul 06, 2013 at 09:27:34AM +0200, Matteo Delfino wrote:
> * Fix version recognition in elantech_set_properties
>
> The new hardware reports itself as v7 but the packets'
> structure is unaltered.
>
> * Fix packet type recognition in elantech_packet_check_v4
>
> The bitmask used for v6 is too wide, only the last three bits of
> the third byte in a packet (packet[3] & 0x03) are actually used to
> distinguish between packet types.
> Starting from v7, additional information (to be interpreted) is
> stored in the remaining bits (packets[3] & 0x1c).
> In addition, the value stored in (packet[0] & 0x0c) is no longer
> a constant but contains additional information yet to be deciphered.
> This change should be backwards compatible with v6 hardware.
>
> Additional-author: Giovanni Frigione <gio.frigione@gmail.com>
> Signed-off-by: Matteo Delfino <kendatsuba@gmail.com>
Applied, thank you.
> ---
> drivers/input/mouse/elantech.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index e2a9867..1c792c9 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -677,18 +677,18 @@ static int elantech_packet_check_v3(struct psmouse *psmouse)
> static int elantech_packet_check_v4(struct psmouse *psmouse)
> {
> unsigned char *packet = psmouse->packet;
> + unsigned char packet_type = packet[3] & 0x03;
>
> - if ((packet[0] & 0x0c) == 0x04 &&
> - (packet[3] & 0x1f) == 0x11)
> + switch (packet_type) {
> + case 0:
> + return PACKET_V4_STATUS;
> +
> + case 1:
> return PACKET_V4_HEAD;
>
> - if ((packet[0] & 0x0c) == 0x04 &&
> - (packet[3] & 0x1f) == 0x12)
> + case 2:
> return PACKET_V4_MOTION;
> -
> - if ((packet[0] & 0x0c) == 0x04 &&
> - (packet[3] & 0x1f) == 0x10)
> - return PACKET_V4_STATUS;
> + }
>
> return PACKET_UNKNOWN;
> }
> @@ -1226,6 +1226,7 @@ static int elantech_set_properties(struct elantech_data *etd)
> etd->hw_version = 3;
> break;
> case 6:
> + case 7:
> etd->hw_version = 4;
> break;
> default:
> --
> 1.7.10.4
--
Dmitry
^ permalink raw reply
* [PATCH RESEND] elantech: fix for newer hardware versions (v7)
From: Matteo Delfino @ 2013-07-06 7:27 UTC (permalink / raw)
To: linux-input; +Cc: Dmitry Torokhov, Alessandro Rubini
* Fix version recognition in elantech_set_properties
The new hardware reports itself as v7 but the packets'
structure is unaltered.
* Fix packet type recognition in elantech_packet_check_v4
The bitmask used for v6 is too wide, only the last three bits of
the third byte in a packet (packet[3] & 0x03) are actually used to
distinguish between packet types.
Starting from v7, additional information (to be interpreted) is
stored in the remaining bits (packets[3] & 0x1c).
In addition, the value stored in (packet[0] & 0x0c) is no longer
a constant but contains additional information yet to be deciphered.
This change should be backwards compatible with v6 hardware.
Additional-author: Giovanni Frigione <gio.frigione@gmail.com>
Signed-off-by: Matteo Delfino <kendatsuba@gmail.com>
---
drivers/input/mouse/elantech.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index e2a9867..1c792c9 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -677,18 +677,18 @@ static int elantech_packet_check_v3(struct psmouse *psmouse)
static int elantech_packet_check_v4(struct psmouse *psmouse)
{
unsigned char *packet = psmouse->packet;
+ unsigned char packet_type = packet[3] & 0x03;
- if ((packet[0] & 0x0c) == 0x04 &&
- (packet[3] & 0x1f) == 0x11)
+ switch (packet_type) {
+ case 0:
+ return PACKET_V4_STATUS;
+
+ case 1:
return PACKET_V4_HEAD;
- if ((packet[0] & 0x0c) == 0x04 &&
- (packet[3] & 0x1f) == 0x12)
+ case 2:
return PACKET_V4_MOTION;
-
- if ((packet[0] & 0x0c) == 0x04 &&
- (packet[3] & 0x1f) == 0x10)
- return PACKET_V4_STATUS;
+ }
return PACKET_UNKNOWN;
}
@@ -1226,6 +1226,7 @@ static int elantech_set_properties(struct elantech_data *etd)
etd->hw_version = 3;
break;
case 6:
+ case 7:
etd->hw_version = 4;
break;
default:
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] elantech: fix for newer hardware versions (v7)
From: Matteo Delfino @ 2013-07-06 7:20 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Alessandro Rubini
In-Reply-To: <20130706043029.GA8212@core.coreip.homeip.net>
Hi Dmitry,
On 07/06/2013 06:30 AM, Dmitry Torokhov wrote:
> Thank you for the patch, unfortunately your mailer line-wrapped it and
> it can't be applied. Could you please resend it using MUA that does not
> perform line-wrapping?
>
Of course, sorry about that.
> Also, now that you only use (packet[3] & 0x03) to determine packet type,
> could you turn series of 'if' statements in elantech_packet_check_v4()
> into a 'switch'?
Sure, i will.
Best regards,
Matteo
^ permalink raw reply
* [PATCH 1/3] input: mc13783: Prepare driver to support MC13892 and OF
From: Alexander Shiyan @ 2013-07-06 4:57 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-input, Sascha Hauer, Grant Likely, Rob Herring,
Dmitry Torokhov, Shawn Guo, Alexander Shiyan
This patch is a preparation mc13xxx powerbutton driver to support
MC13892 and support the probe through the DT.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/mach-imx/mach-mx31moboard.c | 9 +-
drivers/input/misc/mc13783-pwrbutton.c | 361 ++++++++++++++-------------------
include/linux/mfd/mc13xxx.h | 28 +--
3 files changed, 173 insertions(+), 225 deletions(-)
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 6f424ec..2a8aa43 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -276,9 +276,12 @@ static struct mc13xxx_leds_platform_data moboard_leds = {
};
static struct mc13xxx_buttons_platform_data moboard_buttons = {
- .b1on_flags = MC13783_BUTTON_DBNC_750MS | MC13783_BUTTON_ENABLE |
- MC13783_BUTTON_POL_INVERT,
- .b1on_key = KEY_POWER,
+ .buttons[0] = {
+ .keycode = KEY_POWER,
+ .flags = MC13XXX_BUTTON_ENABLE |
+ MC13XXX_BUTTON_DBNC_750MS |
+ MC13XXX_BUTTON_POL_INVERT,
+ },
};
static struct mc13xxx_codec_platform_data moboard_codec = {
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index d0277a7..33613ca 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -24,248 +24,191 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/input.h>
-#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/mc13783.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-
-struct mc13783_pwrb {
- struct input_dev *pwr;
- struct mc13xxx *mc13783;
-#define MC13783_PWRB_B1_POL_INVERT (1 << 0)
-#define MC13783_PWRB_B2_POL_INVERT (1 << 1)
-#define MC13783_PWRB_B3_POL_INVERT (1 << 2)
- int flags;
- unsigned short keymap[3];
+
+struct mc13xxx_button_def {
+ unsigned int irq;
+ unsigned int sense_bit;
};
-#define MC13783_REG_INTERRUPT_SENSE_1 5
-#define MC13783_IRQSENSE1_ONOFD1S (1 << 3)
-#define MC13783_IRQSENSE1_ONOFD2S (1 << 4)
-#define MC13783_IRQSENSE1_ONOFD3S (1 << 5)
+struct mc13xxx_pwrb_devtype {
+ struct mc13xxx_button_def btn_def[MAX13XXX_NUM_BUTTONS];
+};
-#define MC13783_REG_POWER_CONTROL_2 15
-#define MC13783_POWER_CONTROL_2_ON1BDBNC 4
-#define MC13783_POWER_CONTROL_2_ON2BDBNC 6
-#define MC13783_POWER_CONTROL_2_ON3BDBNC 8
-#define MC13783_POWER_CONTROL_2_ON1BRSTEN (1 << 1)
-#define MC13783_POWER_CONTROL_2_ON2BRSTEN (1 << 2)
-#define MC13783_POWER_CONTROL_2_ON3BRSTEN (1 << 3)
+struct mc13xxx_pwrb {
+ struct mc13xxx_pwrb_devtype *devtype;
+ unsigned int enabled;
+ unsigned int inverted;
+ u16 btn_code[MAX13XXX_NUM_BUTTONS];
+ struct input_dev *input;
+ struct mc13xxx *mc13xxx;
+};
-static irqreturn_t button_irq(int irq, void *_priv)
-{
- struct mc13783_pwrb *priv = _priv;
- int val;
-
- mc13xxx_irq_ack(priv->mc13783, irq);
- mc13xxx_reg_read(priv->mc13783, MC13783_REG_INTERRUPT_SENSE_1, &val);
-
- switch (irq) {
- case MC13783_IRQ_ONOFD1:
- val = val & MC13783_IRQSENSE1_ONOFD1S ? 1 : 0;
- if (priv->flags & MC13783_PWRB_B1_POL_INVERT)
- val ^= 1;
- input_report_key(priv->pwr, priv->keymap[0], val);
- break;
-
- case MC13783_IRQ_ONOFD2:
- val = val & MC13783_IRQSENSE1_ONOFD2S ? 1 : 0;
- if (priv->flags & MC13783_PWRB_B2_POL_INVERT)
- val ^= 1;
- input_report_key(priv->pwr, priv->keymap[1], val);
- break;
-
- case MC13783_IRQ_ONOFD3:
- val = val & MC13783_IRQSENSE1_ONOFD3S ? 1 : 0;
- if (priv->flags & MC13783_PWRB_B3_POL_INVERT)
- val ^= 1;
- input_report_key(priv->pwr, priv->keymap[2], val);
- break;
- }
+#define MC13XXX_REG_INTERRUPT_SENSE_1 5
+#define MC13XXX_REG_POWER_CONTROL_2 15
- input_sync(priv->pwr);
+static irqreturn_t mc13xxx_pwrbutton_irq(int irq, void *data)
+{
+ struct mc13xxx_pwrb *priv = data;
+ unsigned int i, val;
+
+ mc13xxx_irq_ack(priv->mc13xxx, irq);
+ mc13xxx_reg_read(priv->mc13xxx, MC13XXX_REG_INTERRUPT_SENSE_1, &val);
+
+ for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++)
+ if (irq == priv->devtype->btn_def[i].irq) {
+ val = !!(val & priv->devtype->btn_def[i].sense_bit);
+ if (priv->inverted & BIT(i))
+ val = !val;
+ input_report_key(priv->input, priv->btn_code[i], val);
+ input_sync(priv->input);
+ break;
+ }
return IRQ_HANDLED;
}
-static int mc13783_pwrbutton_probe(struct platform_device *pdev)
+static int mc13xxx_pwrbutton_open(struct input_dev *dev)
{
- const struct mc13xxx_buttons_platform_data *pdata;
- struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
- struct input_dev *pwr;
- struct mc13783_pwrb *priv;
- int err = 0;
- int reg = 0;
-
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- dev_err(&pdev->dev, "missing platform data\n");
- return -ENODEV;
- }
-
- pwr = input_allocate_device();
- if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
- return -ENOMEM;
- }
-
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv) {
- err = -ENOMEM;
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
- goto free_input_dev;
- }
-
- reg |= (pdata->b1on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
- reg |= (pdata->b2on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
- reg |= (pdata->b3on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
-
- priv->pwr = pwr;
- priv->mc13783 = mc13783;
-
- mc13xxx_lock(mc13783);
-
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[0] = pdata->b1on_key;
- if (pdata->b1on_key != KEY_RESERVED)
- __set_bit(pdata->b1on_key, pwr->keybit);
-
- if (pdata->b1on_flags & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B1_POL_INVERT;
-
- if (pdata->b1on_flags & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
-
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1,
- button_irq, "b1on", priv);
- if (err) {
- dev_dbg(&pdev->dev, "Can't request irq\n");
- goto free_priv;
+ struct mc13xxx_pwrb *priv = input_get_drvdata(dev);
+ int i, ret = 0;
+
+ mc13xxx_lock(priv->mc13xxx);
+
+ for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++)
+ if (priv->enabled & BIT(i)) {
+ ret = mc13xxx_irq_request(priv->mc13xxx,
+ priv->devtype->btn_def[i].irq,
+ mc13xxx_pwrbutton_irq, NULL,
+ priv);
+ if (!ret)
+ continue;
+
+ dev_err(&dev->dev, "Can't request IRQ: %i\n", ret);
+
+ while (--i >= 0)
+ if (priv->enabled & BIT(i))
+ mc13xxx_irq_free(priv->mc13xxx,
+ priv->devtype->btn_def[i].irq,
+ priv);
+ break;
}
- }
-
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[1] = pdata->b2on_key;
- if (pdata->b2on_key != KEY_RESERVED)
- __set_bit(pdata->b2on_key, pwr->keybit);
- if (pdata->b2on_flags & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B2_POL_INVERT;
+ mc13xxx_unlock(priv->mc13xxx);
- if (pdata->b2on_flags & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
-
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2,
- button_irq, "b2on", priv);
- if (err) {
- dev_dbg(&pdev->dev, "Can't request irq\n");
- goto free_irq_b1;
- }
- }
-
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[2] = pdata->b3on_key;
- if (pdata->b3on_key != KEY_RESERVED)
- __set_bit(pdata->b3on_key, pwr->keybit);
+ return ret;
+}
- if (pdata->b3on_flags & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B3_POL_INVERT;
+static void mc13xxx_pwrbutton_close(struct input_dev *dev)
+{
+ struct mc13xxx_pwrb *priv = input_get_drvdata(dev);
+ int i;
+
+ mc13xxx_lock(priv->mc13xxx);
+ for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++)
+ if (priv->enabled & BIT(i))
+ mc13xxx_irq_free(priv->mc13xxx,
+ priv->devtype->btn_def[i].irq, priv);
+ mc13xxx_unlock(priv->mc13xxx);
+}
- if (pdata->b3on_flags & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
+static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
+{
+ struct mc13xxx_buttons_platform_data *pdata =
+ dev_get_platdata(&pdev->dev);
+ struct mc13xxx *mc13xxx = dev_get_drvdata(pdev->dev.parent);
+ struct mc13xxx_pwrb_devtype *devtype =
+ (struct mc13xxx_pwrb_devtype *)pdev->id_entry->driver_data;
+ struct mc13xxx_pwrb *priv;
+ int i, reg = 0, ret = -EINVAL;
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3,
- button_irq, "b3on", priv);
- if (err) {
- dev_dbg(&pdev->dev, "Can't request irq: %d\n", err);
- goto free_irq_b2;
- }
+ if (!pdata) {
+ dev_err(&pdev->dev, "Missing platform data\n");
+ return -ENODEV;
}
- mc13xxx_reg_rmw(mc13783, MC13783_REG_POWER_CONTROL_2, 0x3FE, reg);
-
- mc13xxx_unlock(mc13783);
-
- pwr->name = "mc13783_pwrbutton";
- pwr->phys = "mc13783_pwrbutton/input0";
- pwr->dev.parent = &pdev->dev;
-
- pwr->keycode = priv->keymap;
- pwr->keycodemax = ARRAY_SIZE(priv->keymap);
- pwr->keycodesize = sizeof(priv->keymap[0]);
- __set_bit(EV_KEY, pwr->evbit);
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
- err = input_register_device(pwr);
- if (err) {
- dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
- goto free_irq;
- }
+ priv->input = devm_input_allocate_device(&pdev->dev);
+ if (!priv->input)
+ return -ENOMEM;
+ priv->mc13xxx = mc13xxx;
+ priv->devtype = devtype;
platform_set_drvdata(pdev, priv);
- return 0;
-
-free_irq:
- mc13xxx_lock(mc13783);
-
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD3, priv);
-
-free_irq_b2:
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD2, priv);
-
-free_irq_b1:
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD1, priv);
-
-free_priv:
- mc13xxx_unlock(mc13783);
- kfree(priv);
-
-free_input_dev:
- input_free_device(pwr);
+ for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++) {
+ u16 code, invert, reset, debounce;
+
+ if (!(pdata->buttons[i].flags & MC13XXX_BUTTON_ENABLE))
+ continue;
+ code = pdata->buttons[i].keycode;
+ invert = !!(pdata->buttons[i].flags &
+ MC13XXX_BUTTON_POL_INVERT);
+ reset = !!(pdata->buttons[i].flags &
+ MC13XXX_BUTTON_RESET_EN);
+ debounce = pdata->buttons[i].flags;
+
+ priv->btn_code[i] = code;
+ if (code != KEY_RESERVED)
+ __set_bit(code, priv->input->keybit);
+
+ priv->enabled |= BIT(i);
+ priv->inverted |= invert << i;
+ reg |= reset << (i + 1);
+ reg |= (debounce & 0x03) << (4 + i * 2);
+ }
- return err;
+ mc13xxx_lock(mc13xxx);
+ mc13xxx_reg_rmw(mc13xxx, MC13XXX_REG_POWER_CONTROL_2, 0x3fe, reg);
+ mc13xxx_unlock(mc13xxx);
+
+ priv->input->name = "mc13xxx_pwrbutton";
+ priv->input->phys = "mc13xxx_pwrbutton/input0";
+ priv->input->id.bustype = BUS_HOST;
+ priv->input->id.vendor = 0x0001;
+ priv->input->id.product = 0x0001;
+ priv->input->id.version = 0x0100;
+ priv->input->keycode = priv->btn_code;
+ priv->input->keycodemax = ARRAY_SIZE(priv->btn_code);
+ priv->input->keycodesize = sizeof(priv->btn_code[0]);
+ priv->input->open = mc13xxx_pwrbutton_open;
+ priv->input->close = mc13xxx_pwrbutton_close;
+ __set_bit(EV_KEY, priv->input->evbit);
+
+ input_set_drvdata(priv->input, priv);
+
+ ret = input_register_device(priv->input);
+ if (ret)
+ dev_err(&pdev->dev, "Can't register input device: %i\n", ret);
+
+ return ret;
}
-static int mc13783_pwrbutton_remove(struct platform_device *pdev)
-{
- struct mc13783_pwrb *priv = platform_get_drvdata(pdev);
- const struct mc13xxx_buttons_platform_data *pdata;
-
- pdata = dev_get_platdata(&pdev->dev);
-
- mc13xxx_lock(priv->mc13783);
-
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD3, priv);
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD2, priv);
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD1, priv);
-
- mc13xxx_unlock(priv->mc13783);
-
- input_unregister_device(priv->pwr);
- kfree(priv);
+static const struct mc13xxx_pwrb_devtype mc13783_pwrb_devtype = {
+ .btn_def[0] = { MC13783_IRQ_ONOFD1, BIT(3) },
+ .btn_def[1] = { MC13783_IRQ_ONOFD2, BIT(4) },
+ .btn_def[2] = { MC13783_IRQ_ONOFD3, BIT(5) }
+};
- return 0;
-}
+static const struct platform_device_id mc13xxx_pwrbutton_id_table[] = {
+ { "mc13783-pwrbutton", (kernel_ulong_t)&mc13783_pwrb_devtype },
+ { }
+};
+MODULE_DEVICE_TABLE(platform, mc13xxx_pwrbutton_id_table);
-static struct platform_driver mc13783_pwrbutton_driver = {
- .probe = mc13783_pwrbutton_probe,
- .remove = mc13783_pwrbutton_remove,
- .driver = {
- .name = "mc13783-pwrbutton",
+static struct platform_driver mc13xxx_pwrbutton_driver = {
+ .driver = {
+ .name = "mc13xxx-pwrbutton",
.owner = THIS_MODULE,
},
+ .id_table = mc13xxx_pwrbutton_id_table,
};
+module_platform_driver_probe(mc13xxx_pwrbutton_driver, mc13xxx_pwrbutton_probe);
-module_platform_driver(mc13783_pwrbutton_driver);
-
-MODULE_ALIAS("platform:mc13783-pwrbutton");
MODULE_DESCRIPTION("MC13783 Power Button");
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Philippe Retornaz");
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 41ed592..b895538 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -142,20 +142,22 @@ struct mc13xxx_leds_platform_data {
u32 led_control[MAX_LED_CONTROL_REGS];
};
+#define MAX13XXX_NUM_BUTTONS 3
+
+struct mc13xxx_button {
+ u16 keycode;
+ unsigned int flags;
+#define MC13XXX_BUTTON_DBNC_0MS 0
+#define MC13XXX_BUTTON_DBNC_30MS 1
+#define MC13XXX_BUTTON_DBNC_150MS 2
+#define MC13XXX_BUTTON_DBNC_750MS 3
+#define MC13XXX_BUTTON_ENABLE (1 << 2)
+#define MC13XXX_BUTTON_POL_INVERT (1 << 3)
+#define MC13XXX_BUTTON_RESET_EN (1 << 4)
+};
+
struct mc13xxx_buttons_platform_data {
-#define MC13783_BUTTON_DBNC_0MS 0
-#define MC13783_BUTTON_DBNC_30MS 1
-#define MC13783_BUTTON_DBNC_150MS 2
-#define MC13783_BUTTON_DBNC_750MS 3
-#define MC13783_BUTTON_ENABLE (1 << 2)
-#define MC13783_BUTTON_POL_INVERT (1 << 3)
-#define MC13783_BUTTON_RESET_EN (1 << 4)
- int b1on_flags;
- unsigned short b1on_key;
- int b2on_flags;
- unsigned short b2on_key;
- int b3on_flags;
- unsigned short b3on_key;
+ struct mc13xxx_button buttons[MAX13XXX_NUM_BUTTONS];
};
struct mc13xxx_ts_platform_data {
--
1.8.1.5
^ permalink raw reply related
* [PATCH 3/3] input: mc13783: Add DT probe support
From: Alexander Shiyan @ 2013-07-06 4:58 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-input, Sascha Hauer, Grant Likely, Rob Herring,
Dmitry Torokhov, Shawn Guo, Alexander Shiyan
In-Reply-To: <1373086680-31444-1-git-send-email-shc_work@mail.ru>
Patch adds DT support for MC13783/MC13892 PMICs.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
Documentation/devicetree/bindings/mfd/mc13xxx.txt | 12 +++++
drivers/input/misc/mc13783-pwrbutton.c | 59 ++++++++++++++++++-----
2 files changed, 58 insertions(+), 13 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
index abd9e3c..967bed6 100644
--- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt
+++ b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
@@ -10,6 +10,11 @@ Optional properties:
- fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
Sub-nodes:
+- buttons : Contain power button nodes. Each button should be declared as
+ "btn<num>" and contain code in "linux,code" property. Optional properties:
+ active-high : Change active button level from 0 to 1.
+ enable-reset: Performs hadware reset through PMIC.
+ debounce : Debounce value which will be taken from PMIC datasheet.
- regulators : Contain the regulator nodes. The regulators are bound using
their names as listed below with their registers and bits for enabling.
@@ -89,6 +94,13 @@ ecspi@70010000 { /* ECSPI1 */
interrupt-parent = <&gpio0>;
interrupts = <8>;
+ buttons {
+ btn1 {
+ linux,code = <0x1f>;
+ debounce = <1>;
+ };
+ };
+
regulators {
sw1_reg: mc13892__sw1 {
regulator-min-microvolt = <600000>;
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 855d576..05bb570 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -24,6 +24,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/input.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/mfd/mc13783.h>
#include <linux/mfd/mc13892.h>
@@ -121,21 +122,28 @@ static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
struct mc13xxx *mc13xxx = dev_get_drvdata(pdev->dev.parent);
struct mc13xxx_pwrb_devtype *devtype =
(struct mc13xxx_pwrb_devtype *)pdev->id_entry->driver_data;
+ struct device_node *parent, *child;
struct mc13xxx_pwrb *priv;
int i, reg = 0, ret = -EINVAL;
- if (!pdata) {
+ of_node_get(pdev->dev.parent->of_node);
+ parent = of_find_node_by_name(pdev->dev.parent->of_node, "buttons");
+ if (!pdata && !parent) {
dev_err(&pdev->dev, "Missing platform data\n");
return -ENODEV;
}
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
+ if (!priv) {
+ ret = -ENOMEM;
+ goto out_node_put;
+ }
priv->input = devm_input_allocate_device(&pdev->dev);
- if (!priv->input)
- return -ENOMEM;
+ if (!priv->input) {
+ ret = -ENOMEM;
+ goto out_node_put;
+ }
priv->mc13xxx = mc13xxx;
priv->devtype = devtype;
@@ -143,15 +151,36 @@ static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++) {
u16 code, invert, reset, debounce;
+ const __be32 *prop;
+ char childname[5];
- if (!(pdata->buttons[i].flags & MC13XXX_BUTTON_ENABLE))
- continue;
- code = pdata->buttons[i].keycode;
- invert = !!(pdata->buttons[i].flags &
- MC13XXX_BUTTON_POL_INVERT);
- reset = !!(pdata->buttons[i].flags &
- MC13XXX_BUTTON_RESET_EN);
- debounce = pdata->buttons[i].flags;
+ if (parent) {
+ sprintf(childname, "btn%i", i + 1);
+ child = of_get_child_by_name(parent, childname);
+ if (!child)
+ continue;
+ prop = of_get_property(child, "linux,code", NULL);
+ if (prop)
+ code = be32_to_cpu(*prop) & 0xffff;
+ else {
+ dev_err(&pdev->dev,
+ "Button %i: Missing key code\n", i + 1);
+ continue;
+ }
+ invert = !!of_get_property(child, "active-high", NULL);
+ reset = !!of_get_property(child, "enable-reset", NULL);
+ prop = of_get_property(child, "debounce", NULL);
+ debounce = prop ? be32_to_cpu(*prop) : 0;
+ } else {
+ if (!(pdata->buttons[i].flags & MC13XXX_BUTTON_ENABLE))
+ continue;
+ code = pdata->buttons[i].keycode;
+ invert = !!(pdata->buttons[i].flags &
+ MC13XXX_BUTTON_POL_INVERT);
+ reset = !!(pdata->buttons[i].flags &
+ MC13XXX_BUTTON_RESET_EN);
+ debounce = pdata->buttons[i].flags;
+ }
priv->btn_code[i] = code;
if (code != KEY_RESERVED)
@@ -186,6 +215,10 @@ static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
if (ret)
dev_err(&pdev->dev, "Can't register input device: %i\n", ret);
+out_node_put:
+ if (parent)
+ of_node_put(parent);
+
return ret;
}
--
1.8.1.5
^ permalink raw reply related
* [PATCH 2/3] input: mc13783: Add MC13892 support
From: Alexander Shiyan @ 2013-07-06 4:57 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Alexander Shiyan, Dmitry Torokhov, Rob Herring, Sascha Hauer,
linux-input, Grant Likely, Shawn Guo
In-Reply-To: <1373086680-31444-1-git-send-email-shc_work@mail.ru>
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/input/misc/Kconfig | 6 +++---
drivers/input/misc/mc13783-pwrbutton.c | 10 +++++++++-
include/linux/mfd/mc13892.h | 4 ++++
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 0b541cd..0d83653 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -167,10 +167,10 @@ config INPUT_MAX8997_HAPTIC
module will be called max8997-haptic.
config INPUT_MC13783_PWRBUTTON
- tristate "MC13783 ON buttons"
- depends on MFD_MC13783
+ tristate "MC13783/MC13892 ON buttons"
+ depends on MFD_MC13XXX
help
- Support the ON buttons of MC13783 PMIC as an input device
+ Support the ON buttons of MC13783/MC13892 PMIC as an input device
reporting power button status.
To compile this driver as a module, choose M here: the module
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 33613ca..855d576 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -26,6 +26,7 @@
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/mfd/mc13783.h>
+#include <linux/mfd/mc13892.h>
struct mc13xxx_button_def {
unsigned int irq;
@@ -194,8 +195,15 @@ static const struct mc13xxx_pwrb_devtype mc13783_pwrb_devtype = {
.btn_def[2] = { MC13783_IRQ_ONOFD3, BIT(5) }
};
+static const struct mc13xxx_pwrb_devtype mc13892_pwrb_devtype = {
+ .btn_def[0] = { MC13892_IRQ_ONOFD1, BIT(3) },
+ .btn_def[1] = { MC13892_IRQ_ONOFD2, BIT(4) },
+ .btn_def[2] = { MC13892_IRQ_ONOFD3, BIT(2) }
+};
+
static const struct platform_device_id mc13xxx_pwrbutton_id_table[] = {
{ "mc13783-pwrbutton", (kernel_ulong_t)&mc13783_pwrb_devtype },
+ { "mc13892-pwrbutton", (kernel_ulong_t)&mc13892_pwrb_devtype },
{ }
};
MODULE_DEVICE_TABLE(platform, mc13xxx_pwrbutton_id_table);
@@ -209,6 +217,6 @@ static struct platform_driver mc13xxx_pwrbutton_driver = {
};
module_platform_driver_probe(mc13xxx_pwrbutton_driver, mc13xxx_pwrbutton_probe);
-MODULE_DESCRIPTION("MC13783 Power Button");
+MODULE_DESCRIPTION("MC13XXX Power Button");
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Philippe Retornaz");
diff --git a/include/linux/mfd/mc13892.h b/include/linux/mfd/mc13892.h
index a00f2be..bdc3baf 100644
--- a/include/linux/mfd/mc13892.h
+++ b/include/linux/mfd/mc13892.h
@@ -36,4 +36,8 @@
#define MC13892_PWGT2SPI 22
#define MC13892_VCOINCELL 23
+#define MC13892_IRQ_ONOFD3 26
+#define MC13892_IRQ_ONOFD1 27
+#define MC13892_IRQ_ONOFD2 28
+
#endif
--
1.8.1.5
^ permalink raw reply related
* Re: [PATCH] elantech: fix for newer hardware versions (v7)
From: Dmitry Torokhov @ 2013-07-06 4:30 UTC (permalink / raw)
To: Matteo Delfino; +Cc: linux-input, Alessandro Rubini
In-Reply-To: <51D74638.1020305@gmail.com>
Hi Matteo,
On Sat, Jul 06, 2013 at 12:18:32AM +0200, Matteo Delfino wrote:
> * Fix version recognition in elantech_set_properties
>
> The new hardware reports itself as v7 but the packets'
> structure is unaltered.
>
> * Fix packet type recognition in elantech_packet_check_v4
>
> The bitmask used for v6 is too wide, only the last three bits of
> the third byte in a packet (packet[3] & 0x03) are actually used to
> distinguish between packet types.
> Starting from v7, additional information (to be interpreted) is
> stored in the remaining bits (packets[3] & 0x1c).
> In addition, the value stored in (packet[0] & 0x0c) is no longer
> a constant but contains additional information yet to be deciphered.
> This change should be backwards compatible with v6 hardware.
>
> Additional-author: Giovanni Frigione <gio.frigione@gmail.com>
> Signed-off-by: Matteo Delfino <kendatsuba@gmail.com>
Thank you for the patch, unfortunately your mailer line-wrapped it and
it can't be applied. Could you please resend it using MUA that does not
perform line-wrapping?
Also, now that you only use (packet[3] & 0x03) to determine packet type,
could you turn series of 'if' statements in elantech_packet_check_v4()
into a 'switch'?
Thanks!
--
Dmitry
^ permalink raw reply
* [PATCH] elantech: fix for newer hardware versions (v7)
From: Matteo Delfino @ 2013-07-05 22:18 UTC (permalink / raw)
To: linux-input; +Cc: Alessandro Rubini, Dmitry Torokhov
* Fix version recognition in elantech_set_properties
The new hardware reports itself as v7 but the packets'
structure is unaltered.
* Fix packet type recognition in elantech_packet_check_v4
The bitmask used for v6 is too wide, only the last three bits of
the third byte in a packet (packet[3] & 0x03) are actually used to
distinguish between packet types.
Starting from v7, additional information (to be interpreted) is
stored in the remaining bits (packets[3] & 0x1c).
In addition, the value stored in (packet[0] & 0x0c) is no longer
a constant but contains additional information yet to be deciphered.
This change should be backwards compatible with v6 hardware.
Additional-author: Giovanni Frigione <gio.frigione@gmail.com>
Signed-off-by: Matteo Delfino <kendatsuba@gmail.com>
---
drivers/input/mouse/elantech.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index e2a9867..4d54773 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -677,17 +677,15 @@ static int elantech_packet_check_v3(struct psmouse
*psmouse)
static int elantech_packet_check_v4(struct psmouse *psmouse)
{
unsigned char *packet = psmouse->packet;
+ unsigned char packet_type = packet[3] & 0x03;
- if ((packet[0] & 0x0c) == 0x04 &&
- (packet[3] & 0x1f) == 0x11)
+ if (packet_type == 0x01)
return PACKET_V4_HEAD;
- if ((packet[0] & 0x0c) == 0x04 &&
- (packet[3] & 0x1f) == 0x12)
+ if (packet_type == 0x02)
return PACKET_V4_MOTION;
- if ((packet[0] & 0x0c) == 0x04 &&
- (packet[3] & 0x1f) == 0x10)
+ if (packet_type == 0x00)
return PACKET_V4_STATUS;
return PACKET_UNKNOWN;
@@ -1226,6 +1224,7 @@ static int elantech_set_properties(struct
elantech_data *etd)
etd->hw_version = 3;
break;
case 6:
+ case 7:
etd->hw_version = 4;
break;
default:
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] input: don't call input_dev_release_keys() in resume
From: Oskar Andero @ 2013-07-05 7:46 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
Makarov, Aleksej
In-Reply-To: <20130404163313.GA12302@core.coreip.homeip.net>
Hi Dmitry,
On 18:33 Thu 04 Apr , Dmitry Torokhov wrote:
> Hi Oskar,
>
> On Thu, Mar 07, 2013 at 03:01:22PM +0100, oskar.andero@sonymobile.com wrote:
> > From: Aleksej Makarov <aleksej.makarov@sonymobile.com>
> >
> > When waking up the platform by pressing a specific key, sending a
> > release on that key makes it impossible to react on the event in
> > user-space.
> >
>
> No, we can not simply not release keys after resume from suspend, as
> this leads to keys being stuck. Consider you are holding an 'I' key on
> your external USB keyboard and close your laptop's lid. Then you release
> the key and leave. Later you come back, open the lid waking the laptop
> and observe endless stream of 'I' in your open terminal.
>
> Maybe we should release the keys during suspend time? I am not sure how
> Android infrastructure will react to this though...
I finally got the time to try this out. Releasing the keys in suspend
also solves our problem. Would such patch work for the USB keyboard
case you described? Theoretically, I think it should, right?
So, basically:
static int input_dev_suspend(struct device *dev)
{
struct input_dev *input_dev = to_input_dev(dev);
- mutex_lock(&input_dev->mutex);
-
- if (input_dev->users)
- input_dev_toggle(input_dev, false);
-
- mutex_unlock(&input_dev->mutex);
+ input_reset_device(input_dev);
return 0;
}
static int input_dev_resume(struct device *dev)
{
- struct input_dev *input_dev = to_input_dev(dev);
-
- input_reset_device(input_dev);
-
return 0;
}
Should I send the patch?
-Oskar
^ permalink raw reply
* RE: One USB mouse problem with runtime power management enabled
From: Chen Peter-B29397 @ 2013-07-05 6:46 UTC (permalink / raw)
To: Alan Stern
Cc: Jiri Kosina, linux-input@vger.kernel.org,
linux-usb@vger.kernel.org
In-Reply-To: <Pine.LNX.4.44L0.1307041038540.21341-100000@netrider.rowland.org>
> >
> > Have you opened the mouse by apps (like evtest)?, for USB mouse,
> > the usbhid->intf->needs_remote_wakeup is only set at .open/.close
> > API. That means if you have not opened mouse, the runtime pm status
> > for mouse will changed to RPM_ACTIVE (choose_wakeup ->
> pm_runtime_resume)
> > If you have opened the mouse, the runtime pm status is RPM_SUSPENDED.
>
> Ah, okay, I will try that.
>
> > > That's right. The PM core should realize that the usbhid interface
> > > is resumed, so it shouldn't try to suspend the root hub.
> >
> > You mean runtime pm core? I find the runtime pm core doesn't know
> > the device has already resumed by system resume. For this case,
> > the pm_runtime_set_active(dev) has returned -EBUSY at usb_resume,
> > (I am still checking why, should be related to parent-
> >power.disable_depth),
> > so the usbhid is still RPM_SUSPENDED.
>
> It sounds like this is the real problem. Under normal conditions, the
> runtime PM core won't allow pm_runtime_set_active() to succeed if the
> device's parent is suspended.
>
> In your case, the parent was the root hub, right? So the root hub goes
> back into autosuspend too quickly.
>
> > > The runtime PM status should be correct -- it should indicate that
> the
> > > device is active after a system resume.
> >
> > Then, who should take the responsibility to put the device to
> autosuspend
> > if the device has auto-suspended before the system suspend, we can
> > see the ../power/control is still "auto".
>
> This happens automatically, when the PM core calls pm_runtime_put()
> from device_complete() in drivers/base/power/main.c. This has changed
> since 3.5 -- in fact, that's probably the explanation for your problem.
> Back in 3.5, the pm_runtime_put() call was in device_resume() rather
> than device_complete(). It was moved in 3.7.
>
It works after cherry-pick yours [1] and Ulf Hansson's patch [2] (only your patch should
also work), besides, it needs to set controller active after system resume, or the
child (roothub) can't set itself as active.
( [1]PM: Prevent runtime suspend during system resume
[2] PM / Runtime: Asyncronous idle|suspend devices at system resume)
Thanks,
Peter
^ permalink raw reply
* [git pull] Input updates for 3.11-rc0
From: Dmitry Torokhov @ 2013-07-04 21:23 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-input
[-- Attachment #1: Type: text/plain, Size: 14417 bytes --]
Hi Linus,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus
to receive first round of updates for the input subsystem.
You will get a new touchsreen driver for Cypress 4th generation devices,
a driver for a special controller implementing PS/2 protocol in OLPC
devices, and a driver for power key for SiRFprimaII PWRC.
HID and bcm5497 now support for the 2013 MacBook Air.
EVIOCGKEY and the rest of evdev ioctls now flush events of matching type
from the client's event queue so that clients can be sure any events
received after issuing EVIOCG* ioctl are new events.
And a host of cleanups and improvements in other drivers.
Changelog:
---------
Alan Cox (1):
Input: tps6507x-ts - remove bogus unreachable code
Andy Shevchenko (1):
Input: egalax_ts - move to devm_* functions
Binghua Duan (1):
Input: sirfsoc_pwrc - add onkey input driver for CSR SiRFprimaII PWRC
Chao Xie (2):
Input: pxa27x-keypad - use matrix_keymap for matrix keys
Input: pxa27x-keypad - add device tree support
Dan Carpenter (3):
Input: cyttsp4 - silence shift wrap warning
Input: cyttsp4 - silence NULL dereference warning
Input: cyttsp4 - leak on error path in probe()
Daniel Drake (1):
Input: add OLPC AP-SP driver
Daniel Tang (1):
Input: add TI-Nspire keypad support
David Herrmann (1):
Input: evdev - flush queues during EVIOCGKEY-like ioctls
Dmitry Torokhov (8):
Input: pxa27x-keypad - convert to using SIMPLE_DEV_PM_OPS
Input: pxa27x-keypad - make platform data const
Input: tps6507x-ts - use bool for booleans
Input: tps6507x-ts - remove vref from platform data
Input: tps6507x-ts - convert to polled input device infrastructure
HID: apple: Add support for the 2013 Macbook Air
Input: bcm5974 - add support for the 2013 MacBook Air
Input: tps6507x-ts - select INPUT_POLLDEV
Ferruh Yigit (5):
Input: cyttsp - I2C driver split into two modules
Input: cyttsp4 - add core driver for Cypress TMA4XX touchscreen devices
Input: cyttsp4 - I2C driver for Cypress TMA4XX touchscreen devices
Input: cyttsp4 - SPI driver for Cypress TMA4XX touchscreen devices
Input: cyttsp4 - kfree xfer_buf on error path in probe()
Jingoo Han (2):
Input: misc - use platform_{get,set}_drvdata()
Input: touchscreen - use platform_{get,set}_drvdata()
Lars-Peter Clausen (7):
Input: ep93xx_keypad - pass correct pointer to free_irq()
Input: pxa27x_keypad - pass correct pointer to free_irq()
Input: twl4030_keypad - pass correct pointer to free_irq()
Input: w90p910_keypad - pass correct pointer to free_irq()
Input: ixp4xx-beeper - pass correct pointer to free_irq()
Input: pmic8xxx-pwrkey - pass correct pointer to free_irq()
Input: navpoint - pass correct pointer to free_irq()
Manish Badarkhe (1):
ARM: davinci: da850-evm: remove vref from touchscreen platform data
Mathieu J. Poirier (1):
Input: sysrq - request graceful shutdown for key reset
Peter Hutterer (1):
Input: MT - Specify that ABS_MT_SLOT must have a minimum of 0
Sachin Kamat (47):
Input: ab8500-ponkey - remove redundant platform_set_drvdata()
Input: bfin_rotary - remove redundant platform_set_drvdata()
Input: gpio_tilt_polled - remove redundant platform_set_drvdata()
Input: max8925_onkey - remove redundant platform_set_drvdata()
Input: mc13783-pwrbutton - remove redundant platform_set_drvdata()
Input: pm8xxx-vibrator - remove redundant platform_set_drvdata()
Input: pmic8xxx-pwrkey - remove redundant platform_set_drvdata()
Input: pwm-beeper - remove redundant platform_set_drvdata()
Input: rotary_encoder - remove redundant platform_set_drvdata()
Input: 88pm860x-ts - remove redundant platform_set_drvdata()
Input: atmel-wm97xx - remove redundant platform_set_drvdata()
Input: da9052_tsi - remove redundant platform_set_drvdata()
Input: intel-mid-touch - remove redundant platform_set_drvdata()
Input: jornada720_ts - remove redundant platform_set_drvdata()
Input: mc13783_ts - remove redundant platform_set_drvdata()
Input: ti_am335x_tsc - remove redundant platform_set_drvdata()
Input: tnetv107x-ts - remove redundant platform_set_drvdata()
Input: altera_ps2 - remove redundant platform_set_drvdata()
Input: at32psif - remove redundant platform_set_drvdata()
Input: q40kbd - remove redundant platform_set_drvdata()
Input: amimouse - remove redundant platform_set_drvdata()
Input: gpio_mouse - remove redundant platform_set_drvdata()
Input: w90p910_ts - remove redundant platform_set_drvdata()
Input: amikbd - remove redundant platform_set_drvdata()
Input: ep93xx_keypad - remove redundant platform_set_drvdata()
Input: bf54x-keys - remove redundant platform_set_drvdata()
Input: davinci_keyscan - remove redundant platform_set_drvdata()
Input: gpio_keys - remove redundant platform_set_drvdata()
Input: gpio_keys_polled - remove redundant platform_set_drvdata()
Input: jornada680_kbd - remove redundant platform_set_drvdata()
Input: jornada720_kbd - remove redundant platform_set_drvdata()
Input: matrix_keypad - remove redundant platform_set_drvdata()
Input: omap4-keypad - remove redundant platform_set_drvdata()
Input: opencores-kbd - remove redundant platform_set_drvdata()
Input: pmic8xxx-keypad - remove redundant platform_set_drvdata()
Input: pxa27x_keypad - remove redundant platform_set_drvdata()
Input: pxa930_rotary - remove redundant platform_set_drvdata()
Input: samsung-keypad - remove redundant platform_set_drvdata()
Input: sh_keysc - remove redundant platform_set_drvdata()
Input: spear-keyboard - remove redundant platform_set_drvdata()
Input: tnetv107x-keypad - remove redundant platform_set_drvdata()
Input: twl4030_keypad - remove redundant platform_set_drvdata()
Input: w90p910_keypad - remove redundant platform_set_drvdata()
Input: ixp4xx-beeper - remove redundant platform_set_drvdata()
Input: m68kspkr - remove redundant platform_set_drvdata()
Input: pcspkr - remove redundant platform_set_drvdata()
Input: xilinx_ps2 - remove redundant platform_set_drvdata()
Tatsunosuke Tobita (1):
Input: wacom_i2c - implement hovering capability
Thomas Abraham (1):
Input: samsung-keypad - let device core setup the default pin configuration
Wei Yongjun (2):
Input: atmel_tsadcc - fix error handing with missing platform data
Input: nspire-keypad - remove redundant dev_err call in nspire_keypad_probe()
Diffstat:
--------
.../devicetree/bindings/input/pxa27x-keypad.txt | 60 +
.../devicetree/bindings/input/samsung-keypad.txt | 24 +-
.../devicetree/bindings/input/ti,nspire-keypad.txt | 60 +
.../devicetree/bindings/serio/olpc,ap-sp.txt | 13 +
Documentation/input/multi-touch-protocol.txt | 2 +
arch/arm/mach-davinci/board-da850-evm.c | 1 -
arch/arm/mach-mmp/aspenite.c | 10 +-
arch/arm/mach-mmp/teton_bga.c | 8 +-
arch/arm/mach-pxa/em-x270.c | 20 +-
arch/arm/mach-pxa/ezx.c | 60 +-
arch/arm/mach-pxa/littleton.c | 10 +-
arch/arm/mach-pxa/mainstone.c | 10 +-
arch/arm/mach-pxa/mioa701.c | 11 +-
arch/arm/mach-pxa/palmld.c | 10 +-
arch/arm/mach-pxa/palmt5.c | 10 +-
arch/arm/mach-pxa/palmtreo.c | 23 +-
arch/arm/mach-pxa/palmtx.c | 10 +-
arch/arm/mach-pxa/palmz72.c | 10 +-
arch/arm/mach-pxa/tavorevb.c | 10 +-
arch/arm/mach-pxa/z2.c | 10 +-
arch/arm/mach-pxa/zylonite.c | 10 +-
drivers/hid/hid-apple.c | 6 +
drivers/hid/hid-core.c | 6 +
drivers/hid/hid-ids.h | 3 +
drivers/input/evdev.c | 133 +-
drivers/input/keyboard/Kconfig | 11 +
drivers/input/keyboard/Makefile | 1 +
drivers/input/keyboard/amikbd.c | 1 -
drivers/input/keyboard/bf54x-keys.c | 2 -
drivers/input/keyboard/davinci_keyscan.c | 2 -
drivers/input/keyboard/ep93xx_keypad.c | 7 +-
drivers/input/keyboard/gpio_keys.c | 1 -
drivers/input/keyboard/gpio_keys_polled.c | 2 -
drivers/input/keyboard/jornada680_kbd.c | 2 -
drivers/input/keyboard/jornada720_kbd.c | 2 -
drivers/input/keyboard/matrix_keypad.c | 2 -
drivers/input/keyboard/nspire-keypad.c | 283 +++
drivers/input/keyboard/omap4-keypad.c | 2 -
drivers/input/keyboard/opencores-kbd.c | 2 -
drivers/input/keyboard/pmic8xxx-keypad.c | 2 -
drivers/input/keyboard/pxa27x_keypad.c | 312 ++-
drivers/input/keyboard/pxa930_rotary.c | 1 -
drivers/input/keyboard/samsung-keypad.c | 54 +-
drivers/input/keyboard/sh_keysc.c | 2 -
drivers/input/keyboard/spear-keyboard.c | 1 -
drivers/input/keyboard/tnetv107x-keypad.c | 2 -
drivers/input/keyboard/twl4030_keypad.c | 3 +-
drivers/input/keyboard/w90p910_keypad.c | 5 +-
drivers/input/misc/Kconfig | 10 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/ab8500-ponkey.c | 2 -
drivers/input/misc/bfin_rotary.c | 1 -
drivers/input/misc/gpio_tilt_polled.c | 2 -
drivers/input/misc/ixp4xx-beeper.c | 5 +-
drivers/input/misc/m68kspkr.c | 1 -
drivers/input/misc/max8925_onkey.c | 2 -
drivers/input/misc/mc13783-pwrbutton.c | 1 -
drivers/input/misc/pcspkr.c | 1 -
drivers/input/misc/pm8xxx-vibrator.c | 2 -
drivers/input/misc/pmic8xxx-pwrkey.c | 4 +-
drivers/input/misc/pwm-beeper.c | 1 -
drivers/input/misc/rotary_encoder.c | 2 -
drivers/input/misc/sgi_btns.c | 7 +-
drivers/input/misc/sirfsoc-onkey.c | 165 ++
drivers/input/misc/sparcspkr.c | 14 +-
drivers/input/mouse/amimouse.c | 1 -
drivers/input/mouse/bcm5974.c | 36 +-
drivers/input/mouse/gpio_mouse.c | 3 -
drivers/input/mouse/navpoint.c | 2 +-
drivers/input/serio/Kconfig | 10 +
drivers/input/serio/Makefile | 1 +
drivers/input/serio/altera_ps2.c | 1 -
drivers/input/serio/at32psif.c | 2 -
drivers/input/serio/olpc_apsp.c | 287 +++
drivers/input/serio/q40kbd.c | 1 -
drivers/input/serio/xilinx_ps2.c | 2 -
drivers/input/touchscreen/88pm860x-ts.c | 3 +-
drivers/input/touchscreen/Kconfig | 31 +
drivers/input/touchscreen/Makefile | 5 +-
drivers/input/touchscreen/atmel-wm97xx.c | 2 -
drivers/input/touchscreen/atmel_tsadcc.c | 10 +-
drivers/input/touchscreen/cyttsp4_core.c | 2166 ++++++++++++++++++++
drivers/input/touchscreen/cyttsp4_core.h | 472 +++++
drivers/input/touchscreen/cyttsp4_i2c.c | 90 +
drivers/input/touchscreen/cyttsp4_spi.c | 205 ++
drivers/input/touchscreen/cyttsp_core.c | 6 +-
drivers/input/touchscreen/cyttsp_core.h | 11 +-
drivers/input/touchscreen/cyttsp_i2c.c | 50 +-
drivers/input/touchscreen/cyttsp_i2c_common.c | 79 +
drivers/input/touchscreen/cyttsp_spi.c | 38 +-
drivers/input/touchscreen/da9052_tsi.c | 2 -
drivers/input/touchscreen/egalax_ts.c | 53 +-
drivers/input/touchscreen/intel-mid-touch.c | 2 -
drivers/input/touchscreen/jornada720_ts.c | 2 -
drivers/input/touchscreen/mc13783_ts.c | 2 -
drivers/input/touchscreen/ti_am335x_tsc.c | 1 -
drivers/input/touchscreen/tnetv107x-ts.c | 2 -
drivers/input/touchscreen/tps6507x-ts.c | 158 +-
drivers/input/touchscreen/w90p910_ts.c | 2 -
drivers/input/touchscreen/wacom_i2c.c | 14 +-
drivers/tty/sysrq.c | 19 +-
include/linux/input/tps6507x-ts.h | 1 -
include/linux/mfd/tps6507x.h | 1 -
include/linux/platform_data/cyttsp4.h | 76 +
include/linux/platform_data/keypad-pxa27x.h | 3 +-
105 files changed, 4793 insertions(+), 512 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/pxa27x-keypad.txt
create mode 100644 Documentation/devicetree/bindings/input/ti,nspire-keypad.txt
create mode 100644 Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
create mode 100644 drivers/input/keyboard/nspire-keypad.c
create mode 100644 drivers/input/misc/sirfsoc-onkey.c
create mode 100644 drivers/input/serio/olpc_apsp.c
create mode 100644 drivers/input/touchscreen/cyttsp4_core.c
create mode 100644 drivers/input/touchscreen/cyttsp4_core.h
create mode 100644 drivers/input/touchscreen/cyttsp4_i2c.c
create mode 100644 drivers/input/touchscreen/cyttsp4_spi.c
create mode 100644 drivers/input/touchscreen/cyttsp_i2c_common.c
create mode 100644 include/linux/platform_data/cyttsp4.h
--
Dmitry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: One USB mouse problem with runtime power management enabled
From: Alan Stern @ 2013-07-04 14:55 UTC (permalink / raw)
To: Peter Chen; +Cc: Jiri Kosina, linux-input, linux-usb
In-Reply-To: <20130704102224.GA32551@nchen-desktop>
On Thu, 4 Jul 2013, Peter Chen wrote:
> > I tried doing the same thing on a slightly modified 3.10 kernel. It
> > worked okay. But my mouse was attached to a UHCI controller rather
> > than EHCI, which may make a difference.
> >
> > Have you tried running this test with 3.10?
> >
>
> Have you opened the mouse by apps (like evtest)?, for USB mouse,
> the usbhid->intf->needs_remote_wakeup is only set at .open/.close
> API. That means if you have not opened mouse, the runtime pm status
> for mouse will changed to RPM_ACTIVE (choose_wakeup -> pm_runtime_resume)
> If you have opened the mouse, the runtime pm status is RPM_SUSPENDED.
Ah, okay, I will try that.
> > That's right. The PM core should realize that the usbhid interface
> > is resumed, so it shouldn't try to suspend the root hub.
>
> You mean runtime pm core? I find the runtime pm core doesn't know
> the device has already resumed by system resume. For this case,
> the pm_runtime_set_active(dev) has returned -EBUSY at usb_resume,
> (I am still checking why, should be related to parent->power.disable_depth),
> so the usbhid is still RPM_SUSPENDED.
It sounds like this is the real problem. Under normal conditions, the
runtime PM core won't allow pm_runtime_set_active() to succeed if the
device's parent is suspended.
In your case, the parent was the root hub, right? So the root hub goes
back into autosuspend too quickly.
> > The runtime PM status should be correct -- it should indicate that the
> > device is active after a system resume.
>
> Then, who should take the responsibility to put the device to autosuspend
> if the device has auto-suspended before the system suspend, we can
> see the ../power/control is still "auto".
This happens automatically, when the PM core calls pm_runtime_put()
from device_complete() in drivers/base/power/main.c. This has changed
since 3.5 -- in fact, that's probably the explanation for your problem.
Back in 3.5, the pm_runtime_put() call was in device_resume() rather
than device_complete(). It was moved in 3.7.
Alan Stern
^ permalink raw reply
* Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable
From: Sekhar Nori @ 2013-07-04 14:27 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Lee Jones, Samuel Ortiz, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi, linux-kernel,
linux-omap, linux-iio, linux-input
In-Reply-To: <51D57DBC.3050503@linutronix.de>
On 7/4/2013 7:20 PM, Sebastian Andrzej Siewior wrote:
> On 07/04/2013 03:39 PM, Sekhar Nori wrote:
>> Yes, I noticed that after sending the mail. To me it does not make sense
>> to make changes to accept something as platform data only to remove
>> platform data itself later.
>
> The patches were made earlier and it was easier that way to take
> everything and simple remove the platform part later.
Okay, then. If the maintainers do not have objection, I am fine too!
Regards,
Sekhar
^ permalink raw reply
* Re: [PATCH 14/22] arm/am33xx: add TSC/ADC mfd device support
From: Sebastian Andrzej Siewior @ 2013-07-04 13:51 UTC (permalink / raw)
To: Sekhar Nori
Cc: Lee Jones, Samuel Ortiz, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Pantelis Antoniou,
Sebastian Andrzej Siewior
In-Reply-To: <51D57D4F.30905-l0cyMroinI0@public.gmane.org>
On 07/04/2013 03:49 PM, Sekhar Nori wrote:
>> diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
>> index 1460d9b..4ad7797 100644
>> --- a/arch/arm/boot/dts/am33xx.dtsi
>> +++ b/arch/arm/boot/dts/am33xx.dtsi
>> @@ -404,6 +404,24 @@
>> ti,hwmods = "wkup_m3";
>> };
>>
>> + tscadc: tscadc@44e0d000 {
>> + compatible = "ti,am3359-tscadc";
>> + reg = <0x44e0d000 0x1000>;
>> + interrupt-parent = <&intc>;
>
> interrupt-parent can be dropped since it will be inherited from parent.
That is true. I prepare a patch for that after the merge window.
>
> Thanks,
> Sekhar
Sebastian
^ permalink raw reply
* Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable
From: Sebastian Andrzej Siewior @ 2013-07-04 13:50 UTC (permalink / raw)
To: Sekhar Nori
Cc: Lee Jones, Samuel Ortiz, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi, linux-kernel,
linux-omap, linux-iio, linux-input
In-Reply-To: <51D57AF9.2020001@ti.com>
On 07/04/2013 03:39 PM, Sekhar Nori wrote:
> Yes, I noticed that after sending the mail. To me it does not make sense
> to make changes to accept something as platform data only to remove
> platform data itself later.
The patches were made earlier and it was easier that way to take
everything and simple remove the platform part later.
> May be reorder the series to move this to after platform data removal -
> that way any platform data related changes in the patch will have to go
> away.
>
> Thanks,
> Sekhar
Sebastian
^ permalink raw reply
* Re: [PATCH 14/22] arm/am33xx: add TSC/ADC mfd device support
From: Sekhar Nori @ 2013-07-04 13:49 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Lee Jones, Samuel Ortiz, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Pantelis Antoniou,
Sebastian Andrzej Siewior
In-Reply-To: <1370950268-7224-15-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
On 6/11/2013 5:01 PM, Sebastian Andrzej Siewior wrote:
> From: "Patil, Rachna" <rachna-l0cyMroinI0@public.gmane.org>
>
> Add support for core multifunctional device along
> with its clients touchscreen and ADC.
>
> [ panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org : make sure status is
> set to 'disabled' in dtsi file. ]
>
> Signed-off-by: Pantelis Antoniou <panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
> Signed-off-by: Patil, Rachna <rachna-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
> [bigeasy: add 'status = "okay"']
> Signed-off-by: Sebastian Andrzej Siewior <sebastian-E0PNVn5OA6ohrxcnuTQ+TQ@public.gmane.org>
> ---
> arch/arm/boot/dts/am335x-evm.dts | 14 ++++++++++++++
> arch/arm/boot/dts/am33xx.dtsi | 18 ++++++++++++++++++
> 2 files changed, 32 insertions(+)
> diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
> index 1460d9b..4ad7797 100644
> --- a/arch/arm/boot/dts/am33xx.dtsi
> +++ b/arch/arm/boot/dts/am33xx.dtsi
> @@ -404,6 +404,24 @@
> ti,hwmods = "wkup_m3";
> };
>
> + tscadc: tscadc@44e0d000 {
> + compatible = "ti,am3359-tscadc";
> + reg = <0x44e0d000 0x1000>;
> + interrupt-parent = <&intc>;
interrupt-parent can be dropped since it will be inherited from parent.
Thanks,
Sekhar
^ permalink raw reply
* Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable
From: Sekhar Nori @ 2013-07-04 13:39 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Lee Jones, Samuel Ortiz, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <51D55D80.6080803-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
On 7/4/2013 5:03 PM, Sebastian Andrzej Siewior wrote:
> On 07/04/2013 01:14 PM, Sekhar Nori wrote:
>>
>> On 6/11/2013 5:00 PM, Sebastian Andrzej Siewior wrote:
>>> From: "Patil, Rachna" <rachna-l0cyMroinI0@public.gmane.org>
>>>
>>> The current driver expected touchscreen input
>>> wires(XP,XN,YP,YN) to be connected in a particular order.
>>> Making changes to accept this as platform data
>>
>> The platform data part of this driver will never get used since it is
>> used on DT-only platforms (and future platforms will all be DT-only).
>> You should get rid of it as it will save you some code.
>
> If you follow the series you will notice that the platform bits are
> removed later. Should I have overlooked something please say so.
Yes, I noticed that after sending the mail. To me it does not make sense
to make changes to accept something as platform data only to remove
platform data itself later.
May be reorder the series to move this to after platform data removal -
that way any platform data related changes in the patch will have to go
away.
Thanks,
Sekhar
^ permalink raw reply
* Re: [PATCH] Input: cyttsp4 - use 16bit address for I2C/SPI communication
From: Javier Martinez Canillas @ 2013-07-04 12:25 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Dan Carpenter, Dmitry Torokhov, ttdrivers, linux-input
In-Reply-To: <1372883780-29851-1-git-send-email-fery@cypress.com>
On Wed, Jul 3, 2013 at 10:36 PM, Ferruh Yigit <fery@cypress.com> wrote:
> In TSG4, register map is 512bytes long and to access all of it,
> one bit from address byte is used (which bit to use differs for
> I2C and SPI);
>
> Since common code used for TSG3 and TSG4 for I2C, this parameter
> wrongly used as u8. TSG3 does not access beyond 255 bytes
> but TSG4 may.
>
> Signed-off-by: Ferruh Yigit <fery@cypress.com>
> Tested-on: TMA3XX DVB && TMA4XX DVB
> ---
> drivers/input/touchscreen/cyttsp4_core.h | 12 +++++-----
> drivers/input/touchscreen/cyttsp4_spi.c | 20 ++++++++---------
> drivers/input/touchscreen/cyttsp_core.h | 8 +++----
> drivers/input/touchscreen/cyttsp_i2c_common.c | 30 ++++++++++++++++++-------
> drivers/input/touchscreen/cyttsp_spi.c | 6 ++---
> 5 files changed, 44 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/input/touchscreen/cyttsp4_core.h b/drivers/input/touchscreen/cyttsp4_core.h
> index 86a2543..8e0d4d4 100644
> --- a/drivers/input/touchscreen/cyttsp4_core.h
> +++ b/drivers/input/touchscreen/cyttsp4_core.h
> @@ -369,9 +369,9 @@ struct cyttsp4 {
>
> struct cyttsp4_bus_ops {
> u16 bustype;
> - int (*write)(struct device *dev, u8 *xfer_buf, u8 addr, u8 length,
> + int (*write)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
> const void *values);
> - int (*read)(struct device *dev, u8 *xfer_buf, u8 addr, u8 length,
> + int (*read)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
> void *values);
> };
>
> @@ -448,13 +448,13 @@ enum cyttsp4_event_id {
> /* y-axis, 0:origin is on top side of panel, 1: bottom */
> #define CY_PCFG_ORIGIN_Y_MASK 0x80
>
> -static inline int cyttsp4_adap_read(struct cyttsp4 *ts, u8 addr, int size,
> +static inline int cyttsp4_adap_read(struct cyttsp4 *ts, u16 addr, int size,
> void *buf)
> {
> return ts->bus_ops->read(ts->dev, ts->xfer_buf, addr, size, buf);
> }
>
> -static inline int cyttsp4_adap_write(struct cyttsp4 *ts, u8 addr, int size,
> +static inline int cyttsp4_adap_write(struct cyttsp4 *ts, u16 addr, int size,
> const void *buf)
> {
> return ts->bus_ops->write(ts->dev, ts->xfer_buf, addr, size, buf);
> @@ -463,9 +463,9 @@ static inline int cyttsp4_adap_write(struct cyttsp4 *ts, u8 addr, int size,
> extern struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
> struct device *dev, u16 irq, size_t xfer_buf_size);
> extern int cyttsp4_remove(struct cyttsp4 *ts);
> -int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u8 addr,
> +int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
> u8 length, const void *values);
> -int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u8 addr,
> +int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
> u8 length, void *values);
> extern const struct dev_pm_ops cyttsp4_pm_ops;
>
> diff --git a/drivers/input/touchscreen/cyttsp4_spi.c b/drivers/input/touchscreen/cyttsp4_spi.c
> index f8f891b..a71e114 100644
> --- a/drivers/input/touchscreen/cyttsp4_spi.c
> +++ b/drivers/input/touchscreen/cyttsp4_spi.c
> @@ -44,7 +44,7 @@
> #define CY_SPI_DATA_BUF_SIZE (CY_SPI_CMD_BYTES + CY_SPI_DATA_SIZE)
>
> static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> - u8 op, u8 reg, u8 *buf, int length)
> + u8 op, u16 reg, u8 *buf, int length)
> {
> struct spi_device *spi = to_spi_device(dev);
> struct spi_message msg;
> @@ -63,14 +63,12 @@ static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> memset(wr_buf, 0, CY_SPI_DATA_BUF_SIZE);
> memset(rd_buf, 0, CY_SPI_CMD_BYTES);
>
> - if (reg > 255)
> - wr_buf[0] = op + CY_SPI_A8_BIT;
> - else
> - wr_buf[0] = op;
> - if (op == CY_SPI_WR_OP)
> - wr_buf[1] = reg % 256;
> - if (op == CY_SPI_WR_OP && length > 0)
> - memcpy(wr_buf + CY_SPI_CMD_BYTES, buf, length);
> + wr_buf[0] = op + (((reg >> 8) & 0x1) ? CY_SPI_A8_BIT : 0);
> + if (op == CY_SPI_WR_OP) {
> + wr_buf[1] = reg & 0xFF;
> + if (length > 0)
> + memcpy(wr_buf + CY_SPI_CMD_BYTES, buf, length);
> + }
>
> memset(xfer, 0, sizeof(xfer));
> spi_message_init(&msg);
> @@ -130,7 +128,7 @@ static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> }
>
> static int cyttsp_spi_read_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, void *data)
> + u16 addr, u8 length, void *data)
> {
> int rc;
>
> @@ -143,7 +141,7 @@ static int cyttsp_spi_read_block_data(struct device *dev, u8 *xfer_buf,
> }
>
> static int cyttsp_spi_write_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, const void *data)
> + u16 addr, u8 length, const void *data)
> {
> return cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_WR_OP, addr, (void *)data,
> length);
> diff --git a/drivers/input/touchscreen/cyttsp_core.h b/drivers/input/touchscreen/cyttsp_core.h
> index 0cf564a..0707411 100644
> --- a/drivers/input/touchscreen/cyttsp_core.h
> +++ b/drivers/input/touchscreen/cyttsp_core.h
> @@ -112,9 +112,9 @@ struct cyttsp;
>
> struct cyttsp_bus_ops {
> u16 bustype;
> - int (*write)(struct device *dev, u8 *xfer_buf, u8 addr, u8 length,
> + int (*write)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
> const void *values);
> - int (*read)(struct device *dev, u8 *xfer_buf, u8 addr, u8 length,
> + int (*read)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
> void *values);
> };
>
> @@ -145,9 +145,9 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
> struct device *dev, int irq, size_t xfer_buf_size);
> void cyttsp_remove(struct cyttsp *ts);
>
> -int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u8 addr,
> +int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
> u8 length, const void *values);
> -int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u8 addr,
> +int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
> u8 length, void *values);
> extern const struct dev_pm_ops cyttsp_pm_ops;
>
> diff --git a/drivers/input/touchscreen/cyttsp_i2c_common.c b/drivers/input/touchscreen/cyttsp_i2c_common.c
> index 07c553f..1d7b6f1 100644
> --- a/drivers/input/touchscreen/cyttsp_i2c_common.c
> +++ b/drivers/input/touchscreen/cyttsp_i2c_common.c
> @@ -32,18 +32,20 @@
> #include <linux/types.h>
>
> int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, void *values)
> + u16 addr, u8 length, void *values)
> {
> struct i2c_client *client = to_i2c_client(dev);
> + u8 client_addr = client->addr | ((addr >> 8) & 0x1);
> + u8 addr_lo = addr & 0xFF;
> struct i2c_msg msgs[] = {
> {
> - .addr = client->addr,
> + .addr = client_addr,
> .flags = 0,
> .len = 1,
> - .buf = &addr,
> + .buf = &addr_lo,
> },
> {
> - .addr = client->addr,
> + .addr = client_addr,
> .flags = I2C_M_RD,
> .len = length,
> .buf = values,
> @@ -60,17 +62,29 @@ int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf,
> EXPORT_SYMBOL_GPL(cyttsp_i2c_read_block_data);
>
> int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, const void *values)
> + u16 addr, u8 length, const void *values)
> {
> struct i2c_client *client = to_i2c_client(dev);
> + u8 client_addr = client->addr | ((addr >> 8) & 0x1);
> + u8 addr_lo = addr & 0xFF;
> + struct i2c_msg msgs[] = {
> + {
> + .addr = client_addr,
> + .flags = 0,
> + .len = length + 1,
> + .buf = xfer_buf,
> + },
> + };
> int retval;
>
> - xfer_buf[0] = addr;
> + xfer_buf[0] = addr_lo;
> memcpy(&xfer_buf[1], values, length);
>
> - retval = i2c_master_send(client, xfer_buf, length + 1);
> + retval = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
> + if (retval < 0)
> + return retval;
>
> - return retval < 0 ? retval : 0;
> + return retval != ARRAY_SIZE(msgs) ? -EIO : 0;
> }
> EXPORT_SYMBOL_GPL(cyttsp_i2c_write_block_data);
>
> diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c
> index 1df6253..4728bcb 100644
> --- a/drivers/input/touchscreen/cyttsp_spi.c
> +++ b/drivers/input/touchscreen/cyttsp_spi.c
> @@ -41,7 +41,7 @@
> #define CY_SPI_BITS_PER_WORD 8
>
> static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> - u8 op, u8 reg, u8 *buf, int length)
> + u8 op, u16 reg, u8 *buf, int length)
> {
> struct spi_device *spi = to_spi_device(dev);
> struct spi_message msg;
> @@ -126,14 +126,14 @@ static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
> }
>
> static int cyttsp_spi_read_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, void *data)
> + u16 addr, u8 length, void *data)
> {
> return cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_RD_OP, addr, data,
> length);
> }
>
> static int cyttsp_spi_write_block_data(struct device *dev, u8 *xfer_buf,
> - u8 addr, u8 length, const void *data)
> + u16 addr, u8 length, const void *data)
> {
> return cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_WR_OP, addr, (void *)data,
> length);
> --
> 1.7.9.5
>
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
^ permalink raw reply
* Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable
From: Sebastian Andrzej Siewior @ 2013-07-04 11:33 UTC (permalink / raw)
To: Sekhar Nori
Cc: Lee Jones, Samuel Ortiz, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <51D5592F.6050208-l0cyMroinI0@public.gmane.org>
On 07/04/2013 01:14 PM, Sekhar Nori wrote:
>
> On 6/11/2013 5:00 PM, Sebastian Andrzej Siewior wrote:
>> From: "Patil, Rachna" <rachna-l0cyMroinI0@public.gmane.org>
>>
>> The current driver expected touchscreen input
>> wires(XP,XN,YP,YN) to be connected in a particular order.
>> Making changes to accept this as platform data
>
> The platform data part of this driver will never get used since it is
> used on DT-only platforms (and future platforms will all be DT-only).
> You should get rid of it as it will save you some code.
If you follow the series you will notice that the platform bits are
removed later. Should I have overlooked something please say so.
>
> Thanks,
> Sekhar
>
Sebastian
^ permalink raw reply
* Re: [PATCH 01/22] mfd/ti_am335x_tscadc: remove regmap
From: Sebastian Andrzej Siewior @ 2013-07-04 11:15 UTC (permalink / raw)
To: Mark Brown
Cc: Samuel Ortiz, Lee Jones, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20130704104511.GU27646-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
On 07/04/2013 12:45 PM, Mark Brown wrote:
> On Thu, Jul 04, 2013 at 11:02:41AM +0200, Sebastian Andrzej Siewior
> wrote:
>
>> The driver here does not use atomic updates but read followed by
>> write so your locking here is futile. So the API/regmap alone
>> does not make
>
> Doesn't that sound like the driver ought to be using a r/m/w
> primitive though?
It does this in the init phase before the child devices are created so
no harm is done. I just wanted to say that regmap alone does not help
as long as the use simply replaces all reads & writes with regmap reads
& writes.
>
>> it right. And look: the MFD part uses regmap. Its children (IIO
>> & input) do not use it. After I told this Samuel he said that it
>> is okay.
>
> Again I think the point here was that they probably ought to do
> so.
It didn't sound that way.
> But I guess if you're saying there's no problem that's fine...
Thank you.
Samuel, is it okay if I repost the patch? It can wait till past -rc1 if
you are willing to take it.
Sebastian
^ permalink raw reply
* Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable
From: Sekhar Nori @ 2013-07-04 11:14 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Lee Jones, Samuel Ortiz, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1370950268-7224-5-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
On 6/11/2013 5:00 PM, Sebastian Andrzej Siewior wrote:
> From: "Patil, Rachna" <rachna-l0cyMroinI0@public.gmane.org>
>
> The current driver expected touchscreen input
> wires(XP,XN,YP,YN) to be connected in a particular order.
> Making changes to accept this as platform data
The platform data part of this driver will never get used since it is
used on DT-only platforms (and future platforms will all be DT-only).
You should get rid of it as it will save you some code.
Thanks,
Sekhar
^ permalink raw reply
* Re: [PATCH 01/22] mfd/ti_am335x_tscadc: remove regmap
From: Mark Brown @ 2013-07-04 10:45 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Samuel Ortiz, Lee Jones, Benoît Cousson, Tony Lindgren,
Jonathan Cameron, Dmitry Torokhov, Felipe Balbi, linux-kernel,
linux-omap, linux-iio, linux-input
In-Reply-To: <51D53A31.3080704@linutronix.de>
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
On Thu, Jul 04, 2013 at 11:02:41AM +0200, Sebastian Andrzej Siewior wrote:
> The driver here does not use atomic updates but read followed by write
> so your locking here is futile. So the API/regmap alone does not make
Doesn't that sound like the driver ought to be using a r/m/w primitive
though?
> it right. And look: the MFD part uses regmap. Its children (IIO &
> input) do not use it. After I told this Samuel he said that it is okay.
Again I think the point here was that they probably ought to do so.
But I guess if you're saying there's no problem that's fine...
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox