* 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 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 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 00/22] atmel_mxt_ts patches, already signed-off
From: Dmitry Torokhov @ 2014-05-19 6:37 UTC (permalink / raw)
To: Nick Dyer
Cc: Yufeng Shen, Daniel Kurtz, Henrik Rydberg, Joonyoung Shim,
Alan Bowens, linux-input, linux-kernel, Peter Meerwald,
Benson Leung, Olof Johansson
In-Reply-To: <533D3AF5.9060001@itdev.co.uk>
Hi NIck,
On Thu, Apr 03, 2014 at 11:41:57AM +0100, Nick Dyer wrote:
> Hi Dmitry-
>
> Nick Dyer <nick.dyer@itdev.co.uk> wrote:
> > Here is a set of patches for atmel_mxt_ts that you've already
> > signed-off. I've rebased them against the most recent mainline and made
> > some very minor changes such as INIT_COMPLETION->reinit_completion.
>
> It would be useful to have some feedback about this patchset if you have time.
>
I applied majority of the patches, but dropped 11 (firmware loader) as
it gives trouble in its current for when driver is compiled in and I
also had to drop 12 and 19 because of reject dues to dropping 11.
Thanks.
--
Dmitry
^ permalink raw reply
* Re: Re: [PATCH v5 4/8] input: misc: Add driver for AXP20x Power Enable Key
From: Carlo Caione @ 2014-05-19 7:18 UTC (permalink / raw)
To: Lee Jones
Cc: Maxime Ripard, Carlo Caione,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Dmitry Torokhov
In-Reply-To: <20140519055745.GL29386-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
On Mon, May 19, 2014 at 7:57 AM, Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 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-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>>
>> Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
>
> Acked-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> How are we merging it? MFD tree?
No idea. Lee, can you help in merging it?
The only thing still left out is the DT to be merged through Maxime
(I need to submit a v6 only for that).
Thanks,
--
Carlo Caione
^ permalink raw reply
* Re: [PATCH v5 4/7] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol
From: Henrik Rydberg @ 2014-05-19 7:04 UTC (permalink / raw)
To: Roger Quadros, dmitry.torokhov
Cc: balbi, dmurphy, mugunthanvnm, nsekhar, linux-input, linux-kernel,
devicetree
In-Reply-To: <1399374372-29123-5-git-send-email-rogerq@ti.com>
Hi Roger,
Thanks for the patch series. I think the patch looks great in general. Please
see some minor comments below.
On 05/06/2014 01:06 PM, Roger Quadros wrote:
> Switch to using the Type-B Multi-Touch protocol.
>
> 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];
> }
> +}
In many places, the '&ptr[index]' form makes a lot of sense, but here, it would
have been clearer to use '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);
I think this construct is alright for this particular patch. If anything, it
points at a need for a better model of interrupted contacts in the core.
> + }
> 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,
>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Thanks,
Henrik
^ permalink raw reply
* Re: [PATCH v5 4/8] input: misc: Add driver for AXP20x Power Enable Key
From: Lee Jones @ 2014-05-19 7:23 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, Carlo Caione, linux-arm-kernel, linux-sunxi,
hdegoede, emilio, wens, sameo, linux-input, linux-doc, lgirdwood,
broonie, boris.brezillon
In-Reply-To: <20140519055745.GL29386@core.coreip.homeip.net>
> > > 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?
Yes, I'm happy to do that.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply
* Re: [PATCH v5 4/7] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol
From: Roger Quadros @ 2014-05-19 7:42 UTC (permalink / raw)
To: Henrik Rydberg, dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w
Cc: balbi-l0cyMroinI0, dmurphy-l0cyMroinI0, mugunthanvnm-l0cyMroinI0,
nsekhar-l0cyMroinI0, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <5379ACF1.6080305-Hk7bIW8heu4wFerOooGFRg@public.gmane.org>
Hi Henrik,
On 05/19/2014 10:04 AM, Henrik Rydberg wrote:
> Hi Roger,
>
> Thanks for the patch series. I think the patch looks great in general. Please
> see some minor comments below.
>
> On 05/06/2014 01:06 PM, Roger Quadros wrote:
>> Switch to using the Type-B Multi-Touch protocol.
>>
>> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
>> ---
>> 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];
>> }
>> +}
>
> In many places, the '&ptr[index]' form makes a lot of sense, but here, it would
> have been clearer to use 'bufptr += 4'.
Agreed. I'll update it.
>
>> +
>> +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);
>
> I think this construct is alright for this particular patch. If anything, it
> points at a need for a better model of interrupted contacts in the core.
OK.
>
>> + }
>> 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,
>>
>
> Reviewed-by: Henrik Rydberg <rydberg-Hk7bIW8heu4wFerOooGFRg@public.gmane.org>
Thanks for the review.
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v5 7/7] Input: pixcir_i2c_ts: Add device tree support
From: Roger Quadros @ 2014-05-19 7:50 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, devicetree
In-Reply-To: <20140519055421.GF29386@core.coreip.homeip.net>
On 05/19/2014 08:54 AM, Dmitry Torokhov wrote:
> 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.
OK, I'll update this patch.
cheers,
-roger
^ permalink raw reply
* [PATCH v6 4/7] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol
From: Roger Quadros @ 2014-05-19 8:24 UTC (permalink / raw)
To: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w
Cc: rydberg-Hk7bIW8heu4wFerOooGFRg, balbi-l0cyMroinI0,
dmurphy-l0cyMroinI0, mugunthanvnm-l0cyMroinI0,
nsekhar-l0cyMroinI0, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Roger Quadros
In-Reply-To: <1399374372-29123-5-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
From: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Switch to using the Type-B Multi-Touch protocol.
Reviewed-by: Henrik Rydberg <rydberg-Hk7bIW8heu4wFerOooGFRg@public.gmane.org>
Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
---
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..627d2f5 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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v6 5/7] Input: pixcir_i2c_ts: support upto 5 fingers and hardware provided tracking IDs
From: Roger Quadros @ 2014-05-19 8:26 UTC (permalink / raw)
To: dmitry.torokhov
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, devicetree, Roger Quadros
In-Reply-To: <1399374372-29123-6-git-send-email-rogerq@ti.com>
From: Roger Quadros <rogerq@ti.com>
Some variants of the Pixcir touch controller support upto 5
simultaneous fingers and hardware tracking IDs. Prepare the driver
for that.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/input/touchscreen/pixcir_i2c_ts.c | 74 ++++++++++++++++++++++++-------
include/linux/input/pixcir_ts.h | 12 +++++
2 files changed, 69 insertions(+), 17 deletions(-)
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 627d2f5..8107965 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -27,18 +27,20 @@
#include <linux/input/pixcir_ts.h>
#include <linux/gpio.h>
-#define PIXCIR_MAX_SLOTS 2
+#define PIXCIR_MAX_SLOTS 5 /* Max fingers supported by driver */
struct pixcir_i2c_ts_data {
struct i2c_client *client;
struct input_dev *input;
- const struct pixcir_ts_platform_data *chip;
+ const struct pixcir_ts_platform_data *pdata;
bool running;
+ int max_fingers; /* Max fingers supported in this instance */
};
struct pixcir_touch {
int x;
int y;
+ int id;
};
struct pixcir_report_data {
@@ -49,13 +51,21 @@ struct pixcir_report_data {
static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
struct pixcir_report_data *report)
{
- u8 rdbuf[10], wrbuf[1] = { 0 };
+ u8 rdbuf[2 + PIXCIR_MAX_SLOTS * 5];
+ u8 wrbuf[1] = { 0 };
u8 *bufptr;
u8 touch;
int ret, i;
+ int readsize;
+ const struct pixcir_i2c_chip_data *chip = &tsdata->pdata->chip;
memset(report, 0, sizeof(struct pixcir_report_data));
+ i = chip->has_hw_ids ? 1 : 0;
+ readsize = 2 + tsdata->max_fingers * (4 + i);
+ if (readsize > sizeof(rdbuf))
+ readsize = sizeof(rdbuf);
+
ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf));
if (ret != sizeof(wrbuf)) {
dev_err(&tsdata->client->dev,
@@ -64,7 +74,7 @@ static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
return;
}
- ret = i2c_master_recv(tsdata->client, rdbuf, sizeof(rdbuf));
+ ret = i2c_master_recv(tsdata->client, rdbuf, readsize);
if (ret != sizeof(rdbuf)) {
dev_err(&tsdata->client->dev,
"%s: i2c_master_recv failed(), ret=%d\n",
@@ -73,8 +83,8 @@ static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
}
touch = rdbuf[0] & 0x7;
- if (touch > PIXCIR_MAX_SLOTS)
- touch = PIXCIR_MAX_SLOTS;
+ if (touch > tsdata->max_fingers)
+ touch = tsdata->max_fingers;
report->num_touches = touch;
bufptr = &rdbuf[2];
@@ -83,7 +93,12 @@ static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
report->touches[i].x = (bufptr[1] << 8) | bufptr[0];
report->touches[i].y = (bufptr[3] << 8) | bufptr[2];
- bufptr = bufptr + 4;
+ if (chip->has_hw_ids) {
+ report->touches[i].id = bufptr[4];
+ bufptr = bufptr + 5;
+ } else {
+ bufptr = bufptr + 4;
+ }
}
}
@@ -95,22 +110,35 @@ static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts,
struct pixcir_touch *touch;
int n, i, slot;
struct device *dev = &ts->client->dev;
+ const struct pixcir_i2c_chip_data *chip = &ts->pdata->chip;
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;
- }
+ if (!chip->has_hw_ids) {
+ 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);
+ input_mt_assign_slots(ts->input, slots, pos, n);
+ }
for (i = 0; i < n; i++) {
touch = &report->touches[i];
- slot = slots[i];
+
+ if (chip->has_hw_ids) {
+ slot = input_mt_get_slot_by_key(ts->input, touch->id);
+ if (slot < 0) {
+ dev_dbg(dev, "no free slot for id 0x%x\n",
+ touch->id);
+ continue;
+ }
+ } else {
+ slot = slots[i];
+ }
input_mt_slot(ts->input, slot);
input_mt_report_slot_state(ts->input,
@@ -130,7 +158,7 @@ static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts,
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;
+ const struct pixcir_ts_platform_data *pdata = tsdata->pdata;
struct pixcir_report_data report;
while (tsdata->running) {
@@ -359,6 +387,11 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
dev_err(dev, "Invalid gpio_attb in pdata\n");
return -EINVAL;
}
+
+ if (pdata->chip.max_fingers <= 0) {
+ dev_err(dev, "Invalid max_fingers in pdata\n");
+ return -EINVAL;
+ }
}
tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL);
@@ -373,7 +406,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
tsdata->client = client;
tsdata->input = input;
- tsdata->chip = pdata;
+ tsdata->pdata = pdata;
input->name = client->name;
input->id.bustype = BUS_I2C;
@@ -389,7 +422,14 @@ 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,
+ tsdata->max_fingers = tsdata->pdata->chip.max_fingers;
+ if (tsdata->max_fingers > PIXCIR_MAX_SLOTS) {
+ tsdata->max_fingers = PIXCIR_MAX_SLOTS;
+ dev_info(dev, "Limiting maximum fingers to %d\n",
+ tsdata->max_fingers);
+ }
+
+ error = input_mt_init_slots(input, tsdata->max_fingers,
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
if (error) {
dev_err(dev, "Error initializing Multi-Touch slots\n");
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 160cf35..7bae83b 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -43,10 +43,22 @@ enum pixcir_int_mode {
#define PIXCIR_INT_ENABLE (1UL << 3)
#define PIXCIR_INT_POL_HIGH (1UL << 2)
+/**
+ * struct pixcir_irc_chip_data - chip related data
+ * @max_fingers: Max number of fingers reported simultaneously by h/w
+ * @has_hw_ids: Hardware supports finger tracking IDs
+ *
+ */
+struct pixcir_i2c_chip_data {
+ u8 max_fingers;
+ bool has_hw_ids;
+};
+
struct pixcir_ts_platform_data {
int x_max;
int y_max;
int gpio_attb; /* GPIO connected to ATTB line */
+ struct pixcir_i2c_chip_data chip;
};
#endif
--
1.8.3.2
^ permalink raw reply related
* [PATCH v6 7/7] Input: pixcir_i2c_ts: Add device tree support
From: Roger Quadros @ 2014-05-19 8:27 UTC (permalink / raw)
To: dmitry.torokhov
Cc: rydberg, balbi, dmurphy, mugunthanvnm, nsekhar, linux-input,
linux-kernel, devicetree, Roger Quadros
In-Reply-To: <1399374372-29123-8-git-send-email-rogerq@ti.com>
From: Roger Quadros <rogerq@ti.com>
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..6e55109
--- /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
+- touchscreen-size-x: horizontal resolution of touchscreen (in pixels)
+- touchscreen-size-y: vertical resolution of touchscreen (in pixels)
+
+Example:
+
+ i2c@00000000 {
+ /* ... */
+
+ pixcir_ts@5c {
+ compatible = "pixcir,pixcir_ts";
+ reg = <0x5c>;
+ interrupts = <2 0>;
+ attb-gpio = <&gpf 2 0 2>;
+ touchscreen-size-x = <800>;
+ touchscreen-size-y = <600>;
+ };
+
+ /* ... */
+ };
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index abc3080..2270ebe 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -94,6 +94,7 @@ panasonic Panasonic Corporation
phytec PHYTEC Messtechnik GmbH
picochip Picochip Ltd
plathome Plat'Home Co., Ltd.
+pixcir PIXCIR MICROELECTRONICS Co., Ltd
powervr PowerVR (deprecated, use img)
qca Qualcomm Atheros, Inc.
qcom Qualcomm Technologies, Inc
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 43794fb..e1eb6c8 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -26,6 +26,9 @@
#include <linux/input/mt.h>
#include <linux/input/pixcir_ts.h>
#include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/of_device.h>
#define PIXCIR_MAX_SLOTS 5 /* Max fingers supported by driver */
@@ -407,16 +410,70 @@ unlock:
static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops,
pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume);
+#ifdef CONFIG_OF
+static const struct of_device_id pixcir_of_match[];
+
+static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
+{
+ struct pixcir_ts_platform_data *pdata;
+ struct device_node *np = dev->of_node;
+
+ const struct of_device_id *match;
+
+ match = of_match_device(of_match_ptr(pixcir_of_match), dev);
+ if (!match)
+ return ERR_PTR(-EINVAL);
+
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return ERR_PTR(-ENOMEM);
+
+ pdata->chip = *(const struct pixcir_i2c_chip_data *)match->data;
+
+ pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0);
+ /* gpio_attb validity is checked in probe */
+
+ if (of_property_read_u32(np, "touchscreen-size-x", &pdata->x_max)) {
+ dev_err(dev, "Failed to get touchscreen-size-x property\n");
+ return ERR_PTR(-EINVAL);
+ }
+ pdata->x_max -= 1;
+
+ if (of_property_read_u32(np, "touchscreen-size-y", &pdata->y_max)) {
+ dev_err(dev, "Failed to get touchscreen-size-y property\n");
+ return ERR_PTR(-EINVAL);
+ }
+ pdata->y_max -= 1;
+
+ dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__,
+ pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb);
+
+ return pdata;
+}
+#else
+static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
+{
+ return ERR_PTR(-EINVAL);
+}
+#endif
+
static int pixcir_i2c_ts_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct pixcir_ts_platform_data *pdata =
dev_get_platdata(&client->dev);
struct device *dev = &client->dev;
+ struct device_node *np = dev->of_node;
struct pixcir_i2c_ts_data *tsdata;
struct input_dev *input;
int error;
+ if (np && !pdata) {
+ pdata = pixcir_parse_dt(dev);
+ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
+ }
+
if (!pdata) {
dev_err(&client->dev, "platform data not defined\n");
return -EINVAL;
@@ -522,15 +579,36 @@ static int pixcir_i2c_ts_remove(struct i2c_client *client)
static const struct i2c_device_id pixcir_i2c_ts_id[] = {
{ "pixcir_ts", 0 },
+ { "pixcir_tangoc", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, pixcir_i2c_ts_id);
+#ifdef CONFIG_OF
+static const struct pixcir_i2c_chip_data pixcir_ts_data = {
+ .max_fingers = 2,
+ /* no hw id support */
+};
+
+static const struct pixcir_i2c_chip_data pixcir_tangoc_data = {
+ .max_fingers = 5,
+ .has_hw_ids = true,
+};
+
+static const struct of_device_id pixcir_of_match[] = {
+ { .compatible = "pixcir,pixcir_ts", .data = &pixcir_ts_data },
+ { .compatible = "pixcir,pixcir_tangoc", .data = &pixcir_tangoc_data },
+ { }
+};
+MODULE_DEVICE_TABLE(of, pixcir_of_match);
+#endif
+
static struct i2c_driver pixcir_i2c_ts_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "pixcir_ts",
.pm = &pixcir_dev_pm_ops,
+ .of_match_table = of_match_ptr(pixcir_of_match),
},
.probe = pixcir_i2c_ts_probe,
.remove = pixcir_i2c_ts_remove,
--
1.8.3.2
^ permalink raw reply related
* Re: [PATCH 3/3] synaptics: Change min/max quirk table to pnp-id matching
From: Hans de Goede @ 2014-05-19 8:51 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Peter Hutterer, Benjamin Tissoires, linux-input, stable
In-Reply-To: <20140518203535.GA13276@core.coreip.homeip.net>
Hi,
On 05/18/2014 10:35 PM, Dmitry Torokhov wrote:
> 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;
> };
>
> ?
1) I thought it would be better to allow multiple ids for one min/max quad,
since there seem to only be a few types of touchpads out there, which are
sometimes referenced to by multiple ids. IE LEN0034 and LEN2004 refer to the
exact same touchpad (exact same firmware and board id). Also this way we avoid
people adding entries with values which are slightly off since determining
the min/max range on a single model will give some noise.
2) This way we can use one helper function for the matching for both the
INPUT_PROP_TOPBUTTONPAD quirks and for the min/max quirks.
Regards,
Hans
^ permalink raw reply
* Re: Re: [PATCH v5 4/8] input: misc: Add driver for AXP20x Power Enable Key
From: Lee Jones @ 2014-05-19 9:15 UTC (permalink / raw)
To: Carlo Caione
Cc: Maxime Ripard, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Dmitry Torokhov
In-Reply-To: <CAOQ7t2bPHnjfpeqQjMsYJs--qpd1_1RvBEFXztTDgnf5yW=Yxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Mon, 19 May 2014, Carlo Caione wrote:
> On Mon, May 19, 2014 at 7:57 AM, Dmitry Torokhov
> <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > 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-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> >>
> >> Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> >
> > Acked-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >
> > How are we merging it? MFD tree?
>
> No idea. Lee, can you help in merging it?
> The only thing still left out is the DT to be merged through Maxime
> (I need to submit a v6 only for that).
Yes.
Weren't you in receipt of my email sent out an hour before this one?
I thought you were re-sending the test though (v6?).
If you can set that, complete with all the Acks, I'd be much obliged.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply
* Re: Re: [PATCH v5 4/8] input: misc: Add driver for AXP20x Power Enable Key
From: Carlo Caione @ 2014-05-19 9:39 UTC (permalink / raw)
To: Lee Jones
Cc: Carlo Caione, Maxime Ripard,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, Dmitry Torokhov,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <20140519091553.GC4978@lee--X1>
On Mon, May 19, 2014 at 11:15 AM, Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On Mon, 19 May 2014, Carlo Caione wrote:
>
>> On Mon, May 19, 2014 at 7:57 AM, Dmitry Torokhov
>> <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> > 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-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>> >>
>> >> Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
>> >
>> > Acked-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> >
>> > How are we merging it? MFD tree?
>>
>> No idea. Lee, can you help in merging it?
>> The only thing still left out is the DT to be merged through Maxime
>> (I need to submit a v6 only for that).
>
> Yes.
>
> Weren't you in receipt of my email sent out an hour before this one?
Yes, but this email was sent before receiving yours :)
> I thought you were re-sending the test though (v6?).
>
> If you can set that, complete with all the Acks, I'd be much obliged.
Ok, no problem. I'll also fix a small compilation-warning spotted by Hans.
Thank you,
--
Carlo Caione
^ permalink raw reply
* Re: [linux-sunxi] Re: [PATCH v5 4/8] input: misc: Add driver for AXP20x Power Enable Key
From: Lee Jones @ 2014-05-19 13:28 UTC (permalink / raw)
To: Carlo Caione
Cc: Maxime Ripard, linux-arm-kernel, hdegoede, emilio, wens, sameo,
linux-input, linux-doc, lgirdwood, broonie, boris.brezillon,
Dmitry Torokhov, linux-sunxi
In-Reply-To: <CAOQ7t2a=V_dO17Xg4VJUTV3W_OFCaE5Wuj15_Fox2jywjH+RPg@mail.gmail.com>
On Mon, 19 May 2014, Carlo Caione wrote:
> On Mon, May 19, 2014 at 11:15 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Mon, 19 May 2014, Carlo Caione wrote:
> >
> >> On Mon, May 19, 2014 at 7:57 AM, Dmitry Torokhov
> >> <dmitry.torokhov@gmail.com> wrote:
> >> > 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?
> >>
> >> No idea. Lee, can you help in merging it?
> >> The only thing still left out is the DT to be merged through Maxime
> >> (I need to submit a v6 only for that).
> >
> > Yes.
> >
> > Weren't you in receipt of my email sent out an hour before this one?
>
> Yes, but this email was sent before receiving yours :)
>
> > I thought you were re-sending the test though (v6?).
> >
> > If you can set that, complete with all the Acks, I'd be much obliged.
>
> Ok, no problem. I'll also fix a small compilation-warning spotted by Hans.
Great thanks, and sorry for all the typos, I was in a rush. :)
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply
* Re: [PATCH] HID: rmi: do not handle touchscreens through hid-rmi
From: Benjamin Tissoires @ 2014-05-19 14:59 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Jiri Kosina, Andrew Duggan, Christopher Heiny, linux-input,
linux-kernel@vger.kernel.org
In-Reply-To: <1398263514-7281-1-git-send-email-benjamin.tissoires@redhat.com>
On Wed, Apr 23, 2014 at 10:31 AM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
> Currently, hid-rmi drives every Synaptics product, but the touchscreens
> on the Windows tablets should be handled through hid-multitouch.
>
> Instead of providing a long list of PIDs, rely on the scan_report
> capability to detect which should go to hid-multitouch, and which
> should not go to hid-rmi.
>
> We introduce a generic HID_GROUP_HAVE_SPECIAL_DRIVER which can be reused
> amoung other drivers if they want to have a catch rule but still
> have multitouch devices handled through hid-multitouch.
>
> related bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=74241
> https://bugzilla.redhat.com/show_bug.cgi?id=1089583
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>
> Hi Jiri,
>
> well, this is the patch we are going to carry in Fedora as we are already
> carrying hid-rmi.
> Still, I am not 100% happy with it, especially the HID_GROUP_HAVE_SPECIAL_DRIVER
> thing.
>
> I would also say we should re-think the way the scanning is called in
> hid_add_device because I am starting using more and more the scanning capability
> to decide if the device should be handled by generic, a special driver or simply
> ignored.
>
> Anyway, this could be decided later. If you prefer me to use a hid-rmi specific
> group like HID_GROUP_RMI instead of HID_GROUP_HAVE_SPECIAL_DRIVER, I can also
> update the patch.
>
Hi Jiri,
looks like this one did not attracted your eye yet. Can you ack / nack it?
Without it, hid-rmi will break all the multitouch screens from
Synaptics, which will be a little bit worrying :)
Cheers,
Benjamin
^ permalink raw reply
* Re: [PATCH 1/2] ARM: OMAP2+: remove unused omap4-keypad file and code
From: Tony Lindgren @ 2014-05-19 16:18 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Joachim Eastwood, illia.smyrnov, linux-omap, linux-input
In-Reply-To: <20140519053710.GD29386@core.coreip.homeip.net>
* Dmitry Torokhov <dmitry.torokhov@gmail.com> [140518 22:38]:
> 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?
Yes I don't have anything touching the omap4_keyboard_init
areas that I can think of:
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply
* Re: [PATCH] HID: core: fix validation of report id 0
From: Kees Cook @ 2014-05-19 19:01 UTC (permalink / raw)
To: LKML; +Cc: Jiri Kosina, Benjamin Tissoires, Simon Wood, linux-input,
Roland Bosa
In-Reply-To: <20140417202209.GA30268@www.outflux.net>
Pinging on this patch... I don't see it in -next yet. I've had more
reports of trouble with logitech devices, and this seems to solve the
problem.
-Kees
On Thu, Apr 17, 2014 at 1:22 PM, Kees Cook <keescook@chromium.org> wrote:
> Some drivers use the first HID report in the list instead of using an
> index. In these cases, validation uses ID 0, which was supposed to mean
> "first known report". This fixes the problem, which was causing at least
> the lgff family of devices to stop working since hid_validate_values
> was being called with ID 0, but the devices used single numbered IDs
> for their reports:
>
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x05, /* Usage (Gamepad), */
> 0xA1, 0x01, /* Collection (Application), */
> 0xA1, 0x02, /* Collection (Logical), */
> 0x85, 0x01, /* Report ID (1), */
> ...
>
> Reported-by: Simon Wood <simon@mungewell.org>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: stable@vger.kernel.org
> ---
> drivers/hid/hid-core.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 9e8064205bc7..07ce28175168 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -839,7 +839,17 @@ struct hid_report *hid_validate_values(struct hid_device *hid,
> * ->numbered being checked, which may not always be the case when
> * drivers go to access report values.
> */
> - report = hid->report_enum[type].report_id_hash[id];
> + if (id == 0) {
> + /*
> + * Validating on id 0 means we should examine the first
> + * report in the list.
> + */
> + report = list_entry(
> + hid->report_enum[type].report_list.next,
> + struct hid_report, list);
> + } else {
> + report = hid->report_enum[type].report_id_hash[id];
> + }
> if (!report) {
> hid_err(hid, "missing %s %u\n", hid_report_names[type], id);
> return NULL;
> --
> 1.7.9.5
>
>
> --
> Kees Cook
> Chrome OS Security
--
Kees Cook
Chrome OS Security
^ permalink raw reply
* bad handling of HID input reports for a Delcom foot pedal
From: Benjamin Tissoires @ 2014-05-19 19:37 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, bmills
Hi Jiri,
Please have a look at: https://bugzilla.kernel.org/show_bug.cgi?id=76461
To me, this device sends garbage and should not send the modifiers
both in a Var input and in an Array input.
I can fix it either by amending the report descriptor of the device
(one byte to change) or by changing hid-input.c for it to send the
events in the array processing no matter what was the previous state
(see below).
I don't know which one to pick because this seems to be a corner case,
so fixing hid-input might not be the place, but I am afraid of
removing part of the reports coming from the device (what if the
modifiers are actually used for something in the report).
Any thoughts on it?
For the record, fixing hid-input would just remove the test in hid_input_field:
if (value[n] >= min && value[n] <= max
- && field->usage[value[n] - min].hid
- && search(field->value, value[n], count))
+ && field->usage[value[n] - min].hid)
hid_process_event(hid, field,
&field->usage[value[n] - min], 1, interrupt);
}
(Sorry, gmail, whitespace damaged and everything)
Cheers,
Benjamin
^ permalink raw reply
* Re: [PATCH] HID: core: fix validation of report id 0
From: Benjamin Tissoires @ 2014-05-19 19:39 UTC (permalink / raw)
To: Kees Cook
Cc: LKML, Jiri Kosina, Benjamin Tissoires, Simon Wood, linux-input,
Roland Bosa
In-Reply-To: <CAGXu5jJLKQiC4zwYJ9dpVvELoYBKZ4OFsqKdQXQW9OyDwsdvmg@mail.gmail.com>
On Mon, May 19, 2014 at 3:01 PM, Kees Cook <keescook@chromium.org> wrote:
> Pinging on this patch... I don't see it in -next yet. I've had more
> reports of trouble with logitech devices, and this seems to solve the
> problem.
>
> -Kees
>
> On Thu, Apr 17, 2014 at 1:22 PM, Kees Cook <keescook@chromium.org> wrote:
>> Some drivers use the first HID report in the list instead of using an
>> index. In these cases, validation uses ID 0, which was supposed to mean
>> "first known report". This fixes the problem, which was causing at least
>> the lgff family of devices to stop working since hid_validate_values
>> was being called with ID 0, but the devices used single numbered IDs
>> for their reports:
>>
>> 0x05, 0x01, /* Usage Page (Desktop), */
>> 0x09, 0x05, /* Usage (Gamepad), */
>> 0xA1, 0x01, /* Collection (Application), */
>> 0xA1, 0x02, /* Collection (Logical), */
>> 0x85, 0x01, /* Report ID (1), */
>> ...
>>
>> Reported-by: Simon Wood <simon@mungewell.org>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> Cc: stable@vger.kernel.org
>> ---
Oops, sorry, I should have commented on it earlier:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cheers,
Benjamin
^ permalink raw reply
* [PATCH v6 0/7] mfd: AXP20x: Add support for AXP202 and AXP209
From: Carlo Caione @ 2014-05-19 19:47 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
lee.jones-QSEj5FYQhm4dnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: Carlo Caione
AXP209 and AXP202 are the PMUs (Power Management Unit) used by A10, A13
and A20 SoCs and developed by X-Powers, a sister company of Allwinner.
AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
as well as 4 configurable GPIOs.
This set of patches introduces the core driver and support for two different
subsystems:
- Regulators
- PEK (Power Enable Key)
Changes since v1:
- Added a new standalone patch for defconfig
- MFD core:
* Removed axp,system-power-controller property
- Bindings documentation:
* Corrected description for dcdc-workmode property
* Removed unused axp20x-pek compatible
- Input misc PEK driver:
* Fixed seconds in lower case
- Regulators subsystem:
* Fixed axp20x_set_suspend_voltage()
* Switched to using multi-bit control for regulators
* When "regulators" node is not found driver doesn't quit
* Driver is now using devm_regulator_register()
* Added module_platform_driver() instead of subsys_initcall()
- DT:
* Added new DTSI for AXP209
* Added support for cubietruck and olinuxino-micro
Changes since v2:
- Added a new patch for multi_v7_defconfig to enable MFD core
and subsystems
- DT:
* Dropped axp,system-power-controller property from DTS
* Moved compatible and interrupt-related properties from the
DTSI file to the DTS board files
- Regulators subsystem:
* Deleted useless struct axp20x_regulators
* Added a warning when out of specs values are used for the
dcdc frequency
- MFD core:
* Fixed coding style
* Removed IDs from device table for i2c
- Bindings documentation:
* Several corrections and fixes
Changes since v3:
- Removed x-powers-axp209.dtsi file
- Rewritten bindings document
- MFD core:
* Fixed casting
* Better comments / documentation
- Input misc PEK driver:
* Timings are now expressed in ms and the sysfs appies the
closest possible value
* No more useless pretty-printing
* Removed devm_request_threaded_irq in favour of
devm_request_any_context_irq
* Moved from input attributes to platform device attributes
- Regulators subsystem:
* Removed suspend mode (axp20x_set_suspend_voltage)
* Added regulators input supply
- DT:
* DTs doesn't include anymore the dtsi
* Added input supplies for regulators
Changes since v4:
- Removed regulator patches already applied / acked by Mark Brown
- Input misc PEK driver:
* Don't print anymore the "us" unit
* Added cleanup for attributes when unbindind the device
* Fixed error code returned when device_create_file() fails
- DT:
* Enable all the regulators on at boot-time
* Removed min and max microvolts for all the regulators but DCDC2
* Moved the axp_ipsout regulator outside the MFD node
- MFD core:
* The supply regulators are now specified in the MFD driver using
regulator_bulk_register_supply_alias() and the .parent_supplies
in the MFD cell
Changes since v5:
- Added ACKs
- Fixed compilation warning (reported by Hans De Goede)
- Vendor-prefixes are now sorted
- Removed DT patch
Carlo Caione (7):
mfd: AXP20x: Add mfd driver for AXP20x PMIC
dt-bindings: add vendor-prefix for X-Powers
mfd: AXP20x: Add bindings documentation
input: misc: Add driver for AXP20x Power Enable Key
input: misc: Add ABI docs for AXP20x PEK
ARM: sunxi: Add AXP20x support in defconfig
ARM: sunxi: Add AXP20x support multi_v7_defconfig
.../ABI/testing/sysfs-driver-input-axp-pek | 11 +
Documentation/devicetree/bindings/mfd/axp20x.txt | 93 +++++++
.../devicetree/bindings/vendor-prefixes.txt | 1 +
arch/arm/configs/multi_v7_defconfig | 3 +
arch/arm/configs/sunxi_defconfig | 4 +
drivers/input/misc/Kconfig | 11 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/axp20x-pek.c | 281 +++++++++++++++++++++
drivers/mfd/Kconfig | 12 +
drivers/mfd/Makefile | 1 +
drivers/mfd/axp20x.c | 258 +++++++++++++++++++
include/linux/mfd/axp20x.h | 180 +++++++++++++
12 files changed, 856 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek
create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
create mode 100644 drivers/input/misc/axp20x-pek.c
create mode 100644 drivers/mfd/axp20x.c
create mode 100644 include/linux/mfd/axp20x.h
--
1.9.1
^ permalink raw reply
* [PATCH v6 1/7] mfd: AXP20x: Add mfd driver for AXP20x PMIC
From: Carlo Caione @ 2014-05-19 19:47 UTC (permalink / raw)
To: linux-arm-kernel, linux-sunxi, maxime.ripard, hdegoede, emilio,
wens, sameo, dmitry.torokhov, linux-input, linux-doc, lgirdwood,
broonie, lee.jones, boris.brezillon
Cc: Carlo Caione
In-Reply-To: <1400528868-5971-1-git-send-email-carlo@caione.org>
This patch introduces the preliminary support for PMICs X-Powers AXP202
and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
of Allwinner.
The core enables support for two subsystems:
- PEK (Power Enable Key)
- Regulators
Signed-off-by: Carlo Caione <carlo@caione.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/mfd/Kconfig | 12 +++
drivers/mfd/Makefile | 1 +
drivers/mfd/axp20x.c | 258 +++++++++++++++++++++++++++++++++++++++++++++
include/linux/mfd/axp20x.h | 180 +++++++++++++++++++++++++++++++
4 files changed, 451 insertions(+)
create mode 100644 drivers/mfd/axp20x.c
create mode 100644 include/linux/mfd/axp20x.h
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 3383412..6c2a920 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -67,6 +67,18 @@ config MFD_BCM590XX
help
Support for the BCM590xx PMUs from Broadcom
+config MFD_AXP20X
+ bool "X-Powers AXP20X"
+ select MFD_CORE
+ select REGMAP_I2C
+ select REGMAP_IRQ
+ depends on I2C=y
+ help
+ If you say Y here you get support for the X-Powers AXP202 and AXP209.
+ This driver include only the core APIs. You have to select individual
+ components like regulators or the PEK (Power Enable Key) under the
+ corresponding menus.
+
config MFD_CROS_EC
tristate "ChromeOS Embedded Controller"
select MFD_CORE
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 2851275..1efecf2 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -102,6 +102,7 @@ obj-$(CONFIG_PMIC_DA9052) += da9052-irq.o
obj-$(CONFIG_PMIC_DA9052) += da9052-core.o
obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
+obj-$(CONFIG_MFD_AXP20X) += axp20x.o
obj-$(CONFIG_MFD_LP3943) += lp3943.o
obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
new file mode 100644
index 0000000..5734f8c
--- /dev/null
+++ b/drivers/mfd/axp20x.c
@@ -0,0 +1,258 @@
+/*
+ * axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209
+ *
+ * AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
+ * converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as 4 configurable GPIOs.
+ *
+ * Author: Carlo Caione <carlo@caione.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/regulator/consumer.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/mfd/core.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+
+#define AXP20X_OFF 0x80
+
+static const struct regmap_range axp20x_writeable_ranges[] = {
+ regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
+ regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
+};
+
+static const struct regmap_range axp20x_volatile_ranges[] = {
+ regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
+};
+
+static const struct regmap_access_table axp20x_writeable_table = {
+ .yes_ranges = axp20x_writeable_ranges,
+ .n_yes_ranges = ARRAY_SIZE(axp20x_writeable_ranges),
+};
+
+static const struct regmap_access_table axp20x_volatile_table = {
+ .yes_ranges = axp20x_volatile_ranges,
+ .n_yes_ranges = ARRAY_SIZE(axp20x_volatile_ranges),
+};
+
+static struct resource axp20x_pek_resources[] = {
+ {
+ .name = "PEK_DBR",
+ .start = AXP20X_IRQ_PEK_RIS_EDGE,
+ .end = AXP20X_IRQ_PEK_RIS_EDGE,
+ .flags = IORESOURCE_IRQ,
+ }, {
+ .name = "PEK_DBF",
+ .start = AXP20X_IRQ_PEK_FAL_EDGE,
+ .end = AXP20X_IRQ_PEK_FAL_EDGE,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static const struct regmap_config axp20x_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .wr_table = &axp20x_writeable_table,
+ .volatile_table = &axp20x_volatile_table,
+ .max_register = AXP20X_FG_RES,
+ .cache_type = REGCACHE_RBTREE,
+};
+
+#define AXP20X_IRQ(_irq, _off, _mask) \
+ [AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
+
+static const struct regmap_irq axp20x_regmap_irqs[] = {
+ AXP20X_IRQ(ACIN_OVER_V, 0, 7),
+ AXP20X_IRQ(ACIN_PLUGIN, 0, 6),
+ AXP20X_IRQ(ACIN_REMOVAL, 0, 5),
+ AXP20X_IRQ(VBUS_OVER_V, 0, 4),
+ AXP20X_IRQ(VBUS_PLUGIN, 0, 3),
+ AXP20X_IRQ(VBUS_REMOVAL, 0, 2),
+ AXP20X_IRQ(VBUS_V_LOW, 0, 1),
+ AXP20X_IRQ(BATT_PLUGIN, 1, 7),
+ AXP20X_IRQ(BATT_REMOVAL, 1, 6),
+ AXP20X_IRQ(BATT_ENT_ACT_MODE, 1, 5),
+ AXP20X_IRQ(BATT_EXIT_ACT_MODE, 1, 4),
+ AXP20X_IRQ(CHARG, 1, 3),
+ AXP20X_IRQ(CHARG_DONE, 1, 2),
+ AXP20X_IRQ(BATT_TEMP_HIGH, 1, 1),
+ AXP20X_IRQ(BATT_TEMP_LOW, 1, 0),
+ AXP20X_IRQ(DIE_TEMP_HIGH, 2, 7),
+ AXP20X_IRQ(CHARG_I_LOW, 2, 6),
+ AXP20X_IRQ(DCDC1_V_LONG, 2, 5),
+ AXP20X_IRQ(DCDC2_V_LONG, 2, 4),
+ AXP20X_IRQ(DCDC3_V_LONG, 2, 3),
+ AXP20X_IRQ(PEK_SHORT, 2, 1),
+ AXP20X_IRQ(PEK_LONG, 2, 0),
+ AXP20X_IRQ(N_OE_PWR_ON, 3, 7),
+ AXP20X_IRQ(N_OE_PWR_OFF, 3, 6),
+ AXP20X_IRQ(VBUS_VALID, 3, 5),
+ AXP20X_IRQ(VBUS_NOT_VALID, 3, 4),
+ AXP20X_IRQ(VBUS_SESS_VALID, 3, 3),
+ AXP20X_IRQ(VBUS_SESS_END, 3, 2),
+ AXP20X_IRQ(LOW_PWR_LVL1, 3, 1),
+ AXP20X_IRQ(LOW_PWR_LVL2, 3, 0),
+ AXP20X_IRQ(TIMER, 4, 7),
+ AXP20X_IRQ(PEK_RIS_EDGE, 4, 6),
+ AXP20X_IRQ(PEK_FAL_EDGE, 4, 5),
+ AXP20X_IRQ(GPIO3_INPUT, 4, 3),
+ AXP20X_IRQ(GPIO2_INPUT, 4, 2),
+ AXP20X_IRQ(GPIO1_INPUT, 4, 1),
+ AXP20X_IRQ(GPIO0_INPUT, 4, 0),
+};
+
+static const struct of_device_id axp20x_of_match[] = {
+ { .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
+ { .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
+ { },
+};
+MODULE_DEVICE_TABLE(of, axp20x_of_match);
+
+/*
+ * This is useless for OF-enabled devices, but it is needed by I2C subsystem
+ */
+static const struct i2c_device_id axp20x_i2c_id[] = {
+ { },
+};
+MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
+
+static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
+ .name = "axp20x_irq_chip",
+ .status_base = AXP20X_IRQ1_STATE,
+ .ack_base = AXP20X_IRQ1_STATE,
+ .mask_base = AXP20X_IRQ1_EN,
+ .num_regs = 5,
+ .irqs = axp20x_regmap_irqs,
+ .num_irqs = ARRAY_SIZE(axp20x_regmap_irqs),
+ .mask_invert = true,
+ .init_ack_masked = true,
+};
+
+static const char * axp20x_supplies[] = {
+ "acin",
+ "vin2",
+ "vin3",
+ "ldo24in",
+ "ldo3in",
+ "ldo5in",
+};
+
+static struct mfd_cell axp20x_cells[] = {
+ {
+ .name = "axp20x-pek",
+ .num_resources = ARRAY_SIZE(axp20x_pek_resources),
+ .resources = axp20x_pek_resources,
+ }, {
+ .name = "axp20x-regulator",
+ .parent_supplies = axp20x_supplies,
+ .num_parent_supplies = ARRAY_SIZE(axp20x_supplies),
+ },
+};
+
+static struct axp20x_dev *axp20x_pm_power_off;
+static void axp20x_power_off(void)
+{
+ regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL,
+ AXP20X_OFF);
+}
+
+static int axp20x_i2c_probe(struct i2c_client *i2c,
+ const struct i2c_device_id *id)
+{
+ struct axp20x_dev *axp20x;
+ const struct of_device_id *of_id;
+ int ret;
+
+ axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
+ if (!axp20x)
+ return -ENOMEM;
+
+ of_id = of_match_device(axp20x_of_match, &i2c->dev);
+ if (!of_id) {
+ dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
+ return -ENODEV;
+ }
+ axp20x->variant = (long) of_id->data;
+
+ axp20x->i2c_client = i2c;
+ axp20x->dev = &i2c->dev;
+ dev_set_drvdata(axp20x->dev, axp20x);
+
+ axp20x->regmap = devm_regmap_init_i2c(i2c, &axp20x_regmap_config);
+ if (IS_ERR(axp20x->regmap)) {
+ ret = PTR_ERR(axp20x->regmap);
+ dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
+ return ret;
+ }
+
+ ret = regmap_add_irq_chip(axp20x->regmap, i2c->irq,
+ IRQF_ONESHOT | IRQF_SHARED, -1,
+ &axp20x_regmap_irq_chip,
+ &axp20x->regmap_irqc);
+ if (ret) {
+ dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret);
+ return ret;
+ }
+
+ ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells,
+ ARRAY_SIZE(axp20x_cells), NULL, 0, NULL);
+
+ if (ret) {
+ dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret);
+ regmap_del_irq_chip(i2c->irq, axp20x->regmap_irqc);
+ return ret;
+ }
+
+ if (!pm_power_off) {
+ axp20x_pm_power_off = axp20x;
+ pm_power_off = axp20x_power_off;
+ }
+
+ dev_info(&i2c->dev, "AXP20X driver loaded\n");
+
+ return 0;
+}
+
+static int axp20x_i2c_remove(struct i2c_client *i2c)
+{
+ struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
+
+ if (axp20x == axp20x_pm_power_off) {
+ axp20x_pm_power_off = NULL;
+ pm_power_off = NULL;
+ }
+
+ mfd_remove_devices(axp20x->dev);
+ regmap_del_irq_chip(axp20x->i2c_client->irq, axp20x->regmap_irqc);
+
+ return 0;
+}
+
+static struct i2c_driver axp20x_i2c_driver = {
+ .driver = {
+ .name = "axp20x",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(axp20x_of_match),
+ },
+ .probe = axp20x_i2c_probe,
+ .remove = axp20x_i2c_remove,
+ .id_table = axp20x_i2c_id,
+};
+
+module_i2c_driver(axp20x_i2c_driver);
+
+MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
+MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
new file mode 100644
index 0000000..d0e31a2
--- /dev/null
+++ b/include/linux/mfd/axp20x.h
@@ -0,0 +1,180 @@
+/*
+ * Functions and registers to access AXP20X power management chip.
+ *
+ * Copyright (C) 2013, Carlo Caione <carlo@caione.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_MFD_AXP20X_H
+#define __LINUX_MFD_AXP20X_H
+
+enum {
+ AXP202_ID = 0,
+ AXP209_ID,
+};
+
+#define AXP20X_DATACACHE(m) (0x04 + (m))
+
+/* Power supply */
+#define AXP20X_PWR_INPUT_STATUS 0x00
+#define AXP20X_PWR_OP_MODE 0x01
+#define AXP20X_USB_OTG_STATUS 0x02
+#define AXP20X_PWR_OUT_CTRL 0x12
+#define AXP20X_DCDC2_V_OUT 0x23
+#define AXP20X_DCDC2_LDO3_V_SCAL 0x25
+#define AXP20X_DCDC3_V_OUT 0x27
+#define AXP20X_LDO24_V_OUT 0x28
+#define AXP20X_LDO3_V_OUT 0x29
+#define AXP20X_VBUS_IPSOUT_MGMT 0x30
+#define AXP20X_V_OFF 0x31
+#define AXP20X_OFF_CTRL 0x32
+#define AXP20X_CHRG_CTRL1 0x33
+#define AXP20X_CHRG_CTRL2 0x34
+#define AXP20X_CHRG_BAK_CTRL 0x35
+#define AXP20X_PEK_KEY 0x36
+#define AXP20X_DCDC_FREQ 0x37
+#define AXP20X_V_LTF_CHRG 0x38
+#define AXP20X_V_HTF_CHRG 0x39
+#define AXP20X_APS_WARN_L1 0x3a
+#define AXP20X_APS_WARN_L2 0x3b
+#define AXP20X_V_LTF_DISCHRG 0x3c
+#define AXP20X_V_HTF_DISCHRG 0x3d
+
+/* Interrupt */
+#define AXP20X_IRQ1_EN 0x40
+#define AXP20X_IRQ2_EN 0x41
+#define AXP20X_IRQ3_EN 0x42
+#define AXP20X_IRQ4_EN 0x43
+#define AXP20X_IRQ5_EN 0x44
+#define AXP20X_IRQ1_STATE 0x48
+#define AXP20X_IRQ2_STATE 0x49
+#define AXP20X_IRQ3_STATE 0x4a
+#define AXP20X_IRQ4_STATE 0x4b
+#define AXP20X_IRQ5_STATE 0x4c
+
+/* ADC */
+#define AXP20X_ACIN_V_ADC_H 0x56
+#define AXP20X_ACIN_V_ADC_L 0x57
+#define AXP20X_ACIN_I_ADC_H 0x58
+#define AXP20X_ACIN_I_ADC_L 0x59
+#define AXP20X_VBUS_V_ADC_H 0x5a
+#define AXP20X_VBUS_V_ADC_L 0x5b
+#define AXP20X_VBUS_I_ADC_H 0x5c
+#define AXP20X_VBUS_I_ADC_L 0x5d
+#define AXP20X_TEMP_ADC_H 0x5e
+#define AXP20X_TEMP_ADC_L 0x5f
+#define AXP20X_TS_IN_H 0x62
+#define AXP20X_TS_IN_L 0x63
+#define AXP20X_GPIO0_V_ADC_H 0x64
+#define AXP20X_GPIO0_V_ADC_L 0x65
+#define AXP20X_GPIO1_V_ADC_H 0x66
+#define AXP20X_GPIO1_V_ADC_L 0x67
+#define AXP20X_PWR_BATT_H 0x70
+#define AXP20X_PWR_BATT_M 0x71
+#define AXP20X_PWR_BATT_L 0x72
+#define AXP20X_BATT_V_H 0x78
+#define AXP20X_BATT_V_L 0x79
+#define AXP20X_BATT_CHRG_I_H 0x7a
+#define AXP20X_BATT_CHRG_I_L 0x7b
+#define AXP20X_BATT_DISCHRG_I_H 0x7c
+#define AXP20X_BATT_DISCHRG_I_L 0x7d
+#define AXP20X_IPSOUT_V_HIGH_H 0x7e
+#define AXP20X_IPSOUT_V_HIGH_L 0x7f
+
+/* Power supply */
+#define AXP20X_DCDC_MODE 0x80
+#define AXP20X_ADC_EN1 0x82
+#define AXP20X_ADC_EN2 0x83
+#define AXP20X_ADC_RATE 0x84
+#define AXP20X_GPIO10_IN_RANGE 0x85
+#define AXP20X_GPIO1_ADC_IRQ_RIS 0x86
+#define AXP20X_GPIO1_ADC_IRQ_FAL 0x87
+#define AXP20X_TIMER_CTRL 0x8a
+#define AXP20X_VBUS_MON 0x8b
+#define AXP20X_OVER_TMP 0x8f
+
+/* GPIO */
+#define AXP20X_GPIO0_CTRL 0x90
+#define AXP20X_LDO5_V_OUT 0x91
+#define AXP20X_GPIO1_CTRL 0x92
+#define AXP20X_GPIO2_CTRL 0x93
+#define AXP20X_GPIO20_SS 0x94
+#define AXP20X_GPIO3_CTRL 0x95
+
+/* Battery */
+#define AXP20X_CHRG_CC_31_24 0xb0
+#define AXP20X_CHRG_CC_23_16 0xb1
+#define AXP20X_CHRG_CC_15_8 0xb2
+#define AXP20X_CHRG_CC_7_0 0xb3
+#define AXP20X_DISCHRG_CC_31_24 0xb4
+#define AXP20X_DISCHRG_CC_23_16 0xb5
+#define AXP20X_DISCHRG_CC_15_8 0xb6
+#define AXP20X_DISCHRG_CC_7_0 0xb7
+#define AXP20X_CC_CTRL 0xb8
+#define AXP20X_FG_RES 0xb9
+
+/* Regulators IDs */
+enum {
+ AXP20X_LDO1 = 0,
+ AXP20X_LDO2,
+ AXP20X_LDO3,
+ AXP20X_LDO4,
+ AXP20X_LDO5,
+ AXP20X_DCDC2,
+ AXP20X_DCDC3,
+ AXP20X_REG_ID_MAX,
+};
+
+/* IRQs */
+enum {
+ AXP20X_IRQ_ACIN_OVER_V = 1,
+ AXP20X_IRQ_ACIN_PLUGIN,
+ AXP20X_IRQ_ACIN_REMOVAL,
+ AXP20X_IRQ_VBUS_OVER_V,
+ AXP20X_IRQ_VBUS_PLUGIN,
+ AXP20X_IRQ_VBUS_REMOVAL,
+ AXP20X_IRQ_VBUS_V_LOW,
+ AXP20X_IRQ_BATT_PLUGIN,
+ AXP20X_IRQ_BATT_REMOVAL,
+ AXP20X_IRQ_BATT_ENT_ACT_MODE,
+ AXP20X_IRQ_BATT_EXIT_ACT_MODE,
+ AXP20X_IRQ_CHARG,
+ AXP20X_IRQ_CHARG_DONE,
+ AXP20X_IRQ_BATT_TEMP_HIGH,
+ AXP20X_IRQ_BATT_TEMP_LOW,
+ AXP20X_IRQ_DIE_TEMP_HIGH,
+ AXP20X_IRQ_CHARG_I_LOW,
+ AXP20X_IRQ_DCDC1_V_LONG,
+ AXP20X_IRQ_DCDC2_V_LONG,
+ AXP20X_IRQ_DCDC3_V_LONG,
+ AXP20X_IRQ_PEK_SHORT = 22,
+ AXP20X_IRQ_PEK_LONG,
+ AXP20X_IRQ_N_OE_PWR_ON,
+ AXP20X_IRQ_N_OE_PWR_OFF,
+ AXP20X_IRQ_VBUS_VALID,
+ AXP20X_IRQ_VBUS_NOT_VALID,
+ AXP20X_IRQ_VBUS_SESS_VALID,
+ AXP20X_IRQ_VBUS_SESS_END,
+ AXP20X_IRQ_LOW_PWR_LVL1,
+ AXP20X_IRQ_LOW_PWR_LVL2,
+ AXP20X_IRQ_TIMER,
+ AXP20X_IRQ_PEK_RIS_EDGE,
+ AXP20X_IRQ_PEK_FAL_EDGE,
+ AXP20X_IRQ_GPIO3_INPUT,
+ AXP20X_IRQ_GPIO2_INPUT,
+ AXP20X_IRQ_GPIO1_INPUT,
+ AXP20X_IRQ_GPIO0_INPUT,
+};
+
+struct axp20x_dev {
+ struct device *dev;
+ struct i2c_client *i2c_client;
+ struct regmap *regmap;
+ struct regmap_irq_chip_data *regmap_irqc;
+ long variant;
+};
+
+#endif /* __LINUX_MFD_AXP20X_H */
--
1.9.1
^ permalink raw reply related
* [PATCH v6 2/7] dt-bindings: add vendor-prefix for X-Powers
From: Carlo Caione @ 2014-05-19 19:47 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
lee.jones-QSEj5FYQhm4dnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: Carlo Caione
In-Reply-To: <1400528868-5971-1-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index abc3080..9d27ced 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -132,6 +132,7 @@ voipac Voipac Technologies s.r.o.
winbond Winbond Electronics corp.
wlf Wolfson Microelectronics
wm Wondermedia Technologies, Inc.
+x-powers X-Powers
xes Extreme Engineering Solutions (X-ES)
xlnx Xilinx
zyxel ZyXEL Communications Corp.
--
1.9.1
^ permalink raw reply related
* [PATCH v6 3/7] mfd: AXP20x: Add bindings documentation
From: Carlo Caione @ 2014-05-19 19:47 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
lee.jones-QSEj5FYQhm4dnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: Carlo Caione
In-Reply-To: <1400528868-5971-1-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Bindings documentation for the AXP20x driver. In this file also
sub-nodes are documented.
Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
Documentation/devicetree/bindings/mfd/axp20x.txt | 93 ++++++++++++++++++++++++
1 file changed, 93 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
new file mode 100644
index 0000000..cc9e01b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -0,0 +1,93 @@
+AXP202/AXP209 device tree bindings
+
+The axp20x family current members :-
+axp202 (X-Powers)
+axp209 (X-Powers)
+
+Required properties:
+- compatible: "x-powers,axp202" or "x-powers,axp209"
+- reg: The I2C slave address for the AXP chip
+- interrupt-parent: The parent interrupt controller
+- interrupts: Interrupt specifiers for interrupt sources
+- interrupt-controller: axp20x has its own internal IRQs
+- #interrupt-cells: Should be set to 1
+- acin-supply: The input supply for LDO1
+- vin2-supply: The input supply for DCDC2
+- vin3-supply: The input supply for DCDC3
+- ldo24in-supply: The input supply for LDO2, LDO4
+- ldo3in-supply: The input supply for LDO3
+- ldo5in-supply: The input supply for LDO5
+
+- regulators: A node that houses a sub-node for each regulator. The regulators are
+ bound using their name as listed here: dcdc2, dcdc3, ldo1, ldo2,
+ ldo3, ldo4, ldo5. The bindings details of individual regulator
+ device can be found in:
+ Documentation/devicetree/bindings/regulator/regulator.txt with
+ the exception of x-powers,dcdc-freq
+- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
+ (range: 750-1875). Default: 1.5MHz
+
+Optional properties for DCDCs:
+- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
+ Default: AUTO mode
+
+Example:
+
+axp209: pmic@34 {
+ compatible = "x-powers,axp209";
+ reg = <0x34>;
+ interrupt-parent = <&nmi_intc>;
+ interrupts = <0 8>;
+
+ interrupt-controller;
+ #interrupt-cells = <1>;
+
+ acin-supply = <&axp_ipsout_reg>;
+ vin2-supply = <&axp_ipsout_reg>;
+ vin3-supply = <&axp_ipsout_reg>;
+ ldo24in-supply = <&axp_ipsout_reg>;
+ ldo3in-supply = <&axp_ipsout_reg>;
+ ldo5in-supply = <&axp_ipsout_reg>;
+
+ regulators {
+ x-powers,dcdc-freq = <1500>;
+
+ axp_vcore_reg: dcdc2 {
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <2275000>;
+ regulator-always-on;
+ };
+
+ axp_ddr_reg: dcdc3 {
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <3500000>;
+ regulator-always-on;
+ };
+
+ axp_rtc_reg: ldo1 {
+ regulator-always-on;
+ };
+
+ axp_analog_reg: ldo2 {
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-always-on;
+ };
+
+ axp_pll_reg: ldo3 {
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <3500000>;
+ };
+
+ axp_hdmi_reg: ldo4 {
+ regulator-min-microvolt = <1250000>;
+ regulator-max-microvolt = <3300000>;
+ };
+
+ axp_mic_reg: ldo5 {
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <3300000>;
+ };
+ };
+};
+
--
1.9.1
^ permalink raw reply related
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