Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH v3 0/3] Input: omap-keypad: Convert to threaded IRQ and cleanup
From: Dmitry Torokhov @ 2013-08-26  6:27 UTC (permalink / raw)
  To: Illia Smyrnov; +Cc: Felipe Balbi, linux-input, linux-kernel, linux-omap
In-Reply-To: <1374681293-5320-1-git-send-email-illia.smyrnov@ti.com>

On Wed, Jul 24, 2013 at 06:54:50PM +0300, Illia Smyrnov wrote:
> Replace unclear hardcoded values with bit field, convert to threaded IRQ and
> clear interrupts when open the keypad.
> 
> Based on top of v3.11-rc2.
> 
> Tested on OMAP4 SDP.
> 
> Illia Smyrnov (3):
>   Input: omap-keypad: Cleanup - use bitfiled instead of hardcoded
>     values
>   Input: omap-keypad: Convert to threaded IRQ
>   Input: omap-keypad: Clear interrupts on open
> 
>  drivers/input/keyboard/omap4-keypad.c |   57 +++++++++++++++++++--------------
>  1 files changed, 33 insertions(+), 24 deletions(-)
> 

Applied, thank you.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v2] Input: cyttsp4 - remove useless NULL test from cyttsp4_watchdog_timer()
From: Ferruh Yigit @ 2013-08-26  6:28 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: javier, dmitry.torokhov, yongjun_wei, linux-input
In-Reply-To: <CAPgLHd-VmhDGxLgx7T7BoTntOhOabG4j07u-fFtB0X3NVwOgyw@mail.gmail.com>

On 08/26/2013 09:00 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Remove useless NULL test from cyttsp4_watchdog_timer().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> v1 -> v2: remove NULL test instead.
>    (was: Input: cyttsp4 - fix potential NULL pointer dereference in cyttsp4_watchdog_timer())
> ---
>   drivers/input/touchscreen/cyttsp4_core.c | 3 ---
>   1 file changed, 3 deletions(-)

Acked-by: Ferruh Yigit <fery@cypress.com>

--
ferruh

^ permalink raw reply

* [PATCH v2] Input: cyttsp4 - remove useless NULL test from cyttsp4_watchdog_timer()
From: Wei Yongjun @ 2013-08-26  6:00 UTC (permalink / raw)
  To: javier, dmitry.torokhov; +Cc: yongjun_wei, linux-input

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Remove useless NULL test from cyttsp4_watchdog_timer().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
v1 -> v2: remove NULL test instead.
  (was: Input: cyttsp4 - fix potential NULL pointer dereference in cyttsp4_watchdog_timer())
---
 drivers/input/touchscreen/cyttsp4_core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index edcf799..22719d0 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -1246,9 +1246,6 @@ static void cyttsp4_watchdog_timer(unsigned long handle)
 
 	dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
 
-	if (!cd)
-		return;
-
 	if (!work_pending(&cd->watchdog_work))
 		schedule_work(&cd->watchdog_work);
 


^ permalink raw reply related

* Re: [PATCH] Input: cyttsp4 - fix potential NULL pointer dereference in cyttsp4_watchdog_timer()
From: Ferruh Yigit @ 2013-08-26  5:54 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Wei Yongjun, javier, yongjun_wei, linux-input
In-Reply-To: <2cac6f3b-3107-4ead-95e3-f4070b894dc6@email.android.com>

On 08/26/2013 08:26 AM, Dmitry Torokhov wrote:
> Wei Yongjun <weiyj.lk@gmail.com> wrote:
>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>
>> The dereference should be moved below the NULL test.
>>
>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> ---
>> drivers/input/touchscreen/cyttsp4_core.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/input/touchscreen/cyttsp4_core.c
>> b/drivers/input/touchscreen/cyttsp4_core.c
>> index 963da05..ffa8e35 100644
>> --- a/drivers/input/touchscreen/cyttsp4_core.c
>> +++ b/drivers/input/touchscreen/cyttsp4_core.c
>> @@ -1244,11 +1244,11 @@ static void cyttsp4_watchdog_timer(unsigned
>> long handle)
>> {
>>      struct cyttsp4 *cd = (struct cyttsp4 *)handle;
>>
>> -    dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
>> -
>>      if (!cd)
>>              return;
>>
> Actually this test does not make any sense and we should rather remove it.
Agreed on removing it. For cases "cd" can be NULL/invalid, watchdog
already stopped:
1- in probe(), when timer set, cd allocated and NULL check done.
2- in probe(), in error path after timer set, watchdog stopped before
"cd" freed
3- in cyttsp4_remove(), watchdog stopped before "cd" freed

>
>> +    dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
>> +
>>      if (!work_pending(&cd->watchdog_work))
>>              schedule_work(&cd->watchdog_work);
>>
> Hi Wei,
> Thanks.
>

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.

^ permalink raw reply

* Re: [PATCH] Input: cyttsp4 - fix potential NULL pointer dereference in cyttsp4_watchdog_timer()
From: Dmitry Torokhov @ 2013-08-26  5:26 UTC (permalink / raw)
  To: Wei Yongjun, javier, fery; +Cc: yongjun_wei, linux-input
In-Reply-To: <CAPgLHd9YkK2-nqympYoKb+OTWfkND+3SJYGw_vCRbN6VpXWZog@mail.gmail.com>

Wei Yongjun <weiyj.lk@gmail.com> wrote:
>From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
>The dereference should be moved below the NULL test.
>
>Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>---
> drivers/input/touchscreen/cyttsp4_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/input/touchscreen/cyttsp4_core.c
>b/drivers/input/touchscreen/cyttsp4_core.c
>index 963da05..ffa8e35 100644
>--- a/drivers/input/touchscreen/cyttsp4_core.c
>+++ b/drivers/input/touchscreen/cyttsp4_core.c
>@@ -1244,11 +1244,11 @@ static void cyttsp4_watchdog_timer(unsigned
>long handle)
> {
> 	struct cyttsp4 *cd = (struct cyttsp4 *)handle;
> 
>-	dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
>-
> 	if (!cd)
> 		return;
> 

Actually this test does not make any sense and we should rather remove it.

>+	dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
>+
> 	if (!work_pending(&cd->watchdog_work))
> 		schedule_work(&cd->watchdog_work);
> 

Hi Wei,
Thanks.

-- 
Dmitry

^ permalink raw reply

* [PATCH] Input: cyttsp4 - fix potential NULL pointer dereference in cyttsp4_watchdog_timer()
From: Wei Yongjun @ 2013-08-26  4:55 UTC (permalink / raw)
  To: javier, dmitry.torokhov, fery; +Cc: yongjun_wei, linux-input

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The dereference should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/input/touchscreen/cyttsp4_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index 963da05..ffa8e35 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -1244,11 +1244,11 @@ static void cyttsp4_watchdog_timer(unsigned long handle)
 {
 	struct cyttsp4 *cd = (struct cyttsp4 *)handle;
 
-	dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
-
 	if (!cd)
 		return;
 
+	dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
+
 	if (!work_pending(&cd->watchdog_work))
 		schedule_work(&cd->watchdog_work);
 


^ permalink raw reply related

* Re: [PATCH 1/2] HID: apple: Add another device ID for the mid-2013 Macbook Air
From: Ian Munsie @ 2013-08-26  1:50 UTC (permalink / raw)
  To: Henrik Rydberg
  Cc: Brad Ford, Linus G Thiel, Dmitry Torokhov, Jiri Kosina,
	linux-input, linux-kernel
In-Reply-To: <20130825071122.GA12567@polaris.bitmath.org>

> Brad, Linus, does the above patch work for you as well as for Ian?

That would work fine for me, but I guess we need confirmation from
someone with the ISO or JIS layouts.

Cheers,
-Ian

-- 
http://sites.google.com/site/DarkStarJunkSpace
--
http://darkstarshout.blogspot.com/
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

^ permalink raw reply

* [PATCH 2/2] iio: ti_am335x_adc: Add continuous sampling support
From: Zubair Lutfullah @ 2013-08-25 22:45 UTC (permalink / raw)
  To: jic23-KWPb1pKIrIJaa/9Udqfwiw, lee.jones-QSEj5FYQhm4dnm+yROfE0A
  Cc: bigeasy-hfZtesqFncYOwBW4kG4KsQ, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
In-Reply-To: <1377470724-15710-1-git-send-email-zubair.lutfullah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Previously the driver had only one-shot reading functionality.
This patch adds triggered buffer support to the driver.

Continuous sampling starts when buffer is enabled.
And samples are pushed to userpace by the trigger which
triggers automatically at every hardware interrupt
of FIFO1 filling with samples upto threshold value.

Userspace responsibility to stop sampling by writing zero
in the buffer enable file.

Patil Rachna (TI) laid the ground work for ADC HW register access.
Russ Dill (TI) fixed bugs in the driver relevant to FIFOs and IRQs.

I fixed channel scanning so multiple ADC channels can be read
simultaneously and pushed to userspace.
Restructured the driver to fit IIO ABI.
And added trigger support.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Signed-off-by: Russ Dill <Russ.Dill-l0cyMroinI0@public.gmane.org>
---
 drivers/iio/adc/ti_am335x_adc.c      |  254 +++++++++++++++++++++++++++++++---
 include/linux/mfd/ti_am335x_tscadc.h |   13 ++
 2 files changed, 246 insertions(+), 21 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index a952538..ae2202b 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -28,12 +28,20 @@
 #include <linux/iio/driver.h>
 
 #include <linux/mfd/ti_am335x_tscadc.h>
+#include <linux/iio/buffer.h>
+#include <linux/iio/trigger.h>
+#include <linux/iio/trigger_consumer.h>
+#include <linux/iio/triggered_buffer.h>
 
 struct tiadc_device {
 	struct ti_tscadc_dev *mfd_tscadc;
 	int channels;
 	u8 channel_line[8];
 	u8 channel_step[8];
+	int irq;
+	int buffer_en_ch_steps;
+	struct iio_trigger *trig;
+	u32 *data;
 };
 
 static unsigned int tiadc_readl(struct tiadc_device *adc, unsigned int reg)
@@ -56,10 +64,11 @@ static u32 get_adc_step_mask(struct tiadc_device *adc_dev)
 	return step_en;
 }
 
-static void tiadc_step_config(struct tiadc_device *adc_dev)
+static void tiadc_step_config(struct iio_dev *indio_dev)
 {
+	struct tiadc_device *adc_dev = iio_priv(indio_dev);
 	unsigned int stepconfig;
-	int i, steps;
+	int i, steps, chan;
 
 	/*
 	 * There are 16 configurable steps and 8 analog input
@@ -72,11 +81,13 @@ static void tiadc_step_config(struct tiadc_device *adc_dev)
 	 */
 
 	steps = TOTAL_STEPS - adc_dev->channels;
-	stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1;
+	if (iio_buffer_enabled(indio_dev))
+		stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1
+					| STEPCONFIG_MODE_SWCNT;
+	else
+		stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1;
 
 	for (i = 0; i < adc_dev->channels; i++) {
-		int chan;
-
 		chan = adc_dev->channel_line[i];
 		tiadc_writel(adc_dev, REG_STEPCONFIG(steps),
 				stepconfig | STEPCONFIG_INP(chan));
@@ -85,7 +96,175 @@ static void tiadc_step_config(struct tiadc_device *adc_dev)
 		adc_dev->channel_step[i] = steps;
 		steps++;
 	}
+}
+
+static irqreturn_t tiadc_irq(int irq, void *private)
+{
+	struct iio_dev *indio_dev = private;
+	struct tiadc_device *adc_dev = iio_priv(indio_dev);
+	unsigned int status, config;
+	status = tiadc_readl(adc_dev, REG_IRQSTATUS);
+
+	/*
+	 * ADC and touchscreen share the IRQ line.
+	 * FIFO0 interrupts are used by TSC. Handle FIFO1 IRQs here only
+	 */
+	if (status & IRQENB_FIFO1OVRRUN) {
+		/* FIFO Overrun. Clear flag. Disable/Enable ADC to recover */
+		config = tiadc_readl(adc_dev, REG_CTRL);
+		config &= ~(CNTRLREG_TSCSSENB);
+		tiadc_writel(adc_dev, REG_CTRL, config);
+		tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN
+				| IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
+		tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
+	} else if (status & IRQENB_FIFO1THRES) {
+		/* Trigger to push FIFO data to iio buffer */
+		tiadc_writel(adc_dev, REG_IRQCLR, IRQENB_FIFO1THRES);
+		iio_trigger_poll(indio_dev->trig, iio_get_time_ns());
+	} else
+		return IRQ_NONE;
+
+	/* If any IRQ flags left, return none. So TSC can handle its IRQs */
+	status = tiadc_readl(adc_dev, REG_IRQSTATUS);
+	if (status == false)
+		return IRQ_HANDLED;
+	else
+		return IRQ_NONE;
+}
+
+static irqreturn_t tiadc_trigger_h(int irq, void *p)
+{
+	struct iio_poll_func *pf = p;
+	struct iio_dev *indio_dev = pf->indio_dev;
+	struct tiadc_device *adc_dev = iio_priv(indio_dev);
+	int i, k, fifo1count, read;
+	u32 *data = adc_dev->data;
+
+	fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
+	for (k = 0; k < fifo1count; k = k + i) {
+		for (i = 0; i < (indio_dev->scan_bytes)/4; i++) {
+			read = tiadc_readl(adc_dev, REG_FIFO1);
+			data[i] = read & FIFOREAD_DATA_MASK;
+		}
+		iio_push_to_buffers(indio_dev, (u8 *) data);
+	}
 
+	tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1THRES);
+	tiadc_writel(adc_dev, REG_IRQENABLE, IRQENB_FIFO1THRES);
+
+	iio_trigger_notify_done(indio_dev->trig);
+
+	return IRQ_HANDLED;
+}
+
+static int tiadc_buffer_preenable(struct iio_dev *indio_dev)
+{
+	struct tiadc_device *adc_dev = iio_priv(indio_dev);
+	int i, fifo1count, read;
+
+	tiadc_writel(adc_dev, REG_IRQCLR, (IRQENB_FIFO1THRES |
+				IRQENB_FIFO1OVRRUN |
+				IRQENB_FIFO1UNDRFLW));
+
+	/* Flush FIFO before starting sampling */
+	fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
+	for (i = 0; i < fifo1count; i++)
+		read = tiadc_readl(adc_dev, REG_FIFO1);
+
+	return iio_sw_buffer_preenable(indio_dev);
+}
+
+static int tiadc_buffer_postenable(struct iio_dev *indio_dev)
+{
+	struct tiadc_device *adc_dev = iio_priv(indio_dev);
+	struct iio_buffer *buffer = indio_dev->buffer;
+	unsigned int enb = 0, stepnum;
+	u8 bit;
+
+	adc_dev->data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
+	if (adc_dev->data == NULL)
+		return -ENOMEM;
+
+	tiadc_step_config(indio_dev);
+	for_each_set_bit(bit, buffer->scan_mask,
+			adc_dev->channels) {
+		struct iio_chan_spec const *chan = indio_dev->channels + bit;
+		/*
+		 * There are a total of 16 steps available
+		 * that are shared between ADC and touchscreen.
+		 * We start configuring from step 16 to 0 incase of
+		 * ADC. Hence the relation between input channel
+		 * and step for ADC would be as below.
+		 */
+		stepnum = chan->channel + 9;
+		enb |= (1 << stepnum);
+	}
+
+	adc_dev->buffer_en_ch_steps = enb;
+	am335x_tsc_se_set(adc_dev->mfd_tscadc, enb);
+	tiadc_writel(adc_dev,  REG_IRQSTATUS, IRQENB_FIFO1THRES
+				| IRQENB_FIFO1OVRRUN | IRQENB_FIFO1UNDRFLW);
+	tiadc_writel(adc_dev,  REG_IRQENABLE, IRQENB_FIFO1THRES
+				| IRQENB_FIFO1OVRRUN);
+
+	return iio_triggered_buffer_postenable(indio_dev);
+}
+
+static int tiadc_buffer_predisable(struct iio_dev *indio_dev)
+{
+	struct tiadc_device *adc_dev = iio_priv(indio_dev);
+	int fifo1count, i, read;
+
+	tiadc_writel(adc_dev, REG_IRQCLR, (IRQENB_FIFO1THRES |
+				IRQENB_FIFO1OVRRUN | IRQENB_FIFO1UNDRFLW));
+	am335x_tsc_se_clr(adc_dev->mfd_tscadc, adc_dev->buffer_en_ch_steps);
+
+	/* Flush FIFO of any leftover data */
+	fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
+	for (i = 0; i < fifo1count; i++)
+		read = tiadc_readl(adc_dev, REG_FIFO1);
+
+	return iio_triggered_buffer_predisable(indio_dev);
+}
+
+static int tiadc_buffer_postdisable(struct iio_dev *indio_dev)
+{
+	struct tiadc_device *adc_dev = iio_priv(indio_dev);
+
+	tiadc_step_config(indio_dev);
+	kfree(adc_dev->data);
+	return 0;
+}
+
+static const struct iio_buffer_setup_ops tiadc_buffer_setup_ops = {
+	.preenable = &tiadc_buffer_preenable,
+	.postenable = &tiadc_buffer_postenable,
+	.predisable = &tiadc_buffer_predisable,
+	.postdisable = &tiadc_buffer_postdisable,
+};
+
+static const struct iio_trigger_ops tiadc_trigger_ops = {
+	.owner = THIS_MODULE,
+};
+
+static struct iio_trigger *tiadc_iio_allocate_trigger(struct iio_dev *indio_dev)
+{
+	struct iio_trigger *trig;
+	int ret;
+
+	trig = iio_trigger_alloc("%s-dev%d", indio_dev->name, indio_dev->id);
+	if (trig == NULL)
+		return NULL;
+
+	trig->dev.parent = indio_dev->dev.parent;
+	trig->ops = &tiadc_trigger_ops;
+	iio_trigger_set_drvdata(trig, indio_dev);
+
+	ret = iio_trigger_register(trig);
+	if (ret)
+		return NULL;
+
+	return trig;
 }
 
 static const char * const chan_name_ain[] = {
@@ -120,6 +299,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
 		chan->channel = adc_dev->channel_line[i];
 		chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
 		chan->datasheet_name = chan_name_ain[chan->channel];
+		chan->scan_index = i;
 		chan->scan_type.sign = 'u';
 		chan->scan_type.realbits = 12;
 		chan->scan_type.storagebits = 32;
@@ -142,11 +322,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
 	int i, map_val;
 	unsigned int fifo1count, read, stepid;
-	u32 step = UINT_MAX;
 	bool found = false;
 	u32 step_en;
 	unsigned long timeout = jiffies + usecs_to_jiffies
 				(IDLE_TIMEOUT * adc_dev->channels);
+
+	if (iio_buffer_enabled(indio_dev))
+		return -EBUSY;
+
 	step_en = get_adc_step_mask(adc_dev);
 	am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en);
 
@@ -168,15 +351,6 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
 	 * Hence we need to flush out this data.
 	 */
 
-	for (i = 0; i < ARRAY_SIZE(adc_dev->channel_step); i++) {
-		if (chan->channel == adc_dev->channel_line[i]) {
-			step = adc_dev->channel_step[i];
-			break;
-		}
-	}
-	if (WARN_ON_ONCE(step == UINT_MAX))
-		return -EINVAL;
-
 	fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
 	for (i = 0; i < fifo1count; i++) {
 		read = tiadc_readl(adc_dev, REG_FIFO1);
@@ -220,7 +394,8 @@ static int tiadc_probe(struct platform_device *pdev)
 					  sizeof(struct tiadc_device));
 	if (indio_dev == NULL) {
 		dev_err(&pdev->dev, "failed to allocate iio device\n");
-		return -ENOMEM;
+		err = -ENOMEM;
+		goto err_ret;
 	}
 	adc_dev = iio_priv(indio_dev);
 
@@ -231,28 +406,56 @@ static int tiadc_probe(struct platform_device *pdev)
 		channels++;
 	}
 	adc_dev->channels = channels;
+	adc_dev->irq = adc_dev->mfd_tscadc->irq;
 
 	indio_dev->dev.parent = &pdev->dev;
 	indio_dev->name = dev_name(&pdev->dev);
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &tiadc_info;
 
-	tiadc_step_config(adc_dev);
+	tiadc_step_config(indio_dev);
+	tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD);
 
 	err = tiadc_channel_init(indio_dev, adc_dev->channels);
 	if (err < 0)
-		return err;
+		goto err_free_device;
+
+	adc_dev->trig = tiadc_iio_allocate_trigger(indio_dev);
+	if (adc_dev->trig == NULL) {
+		err = -ENOMEM;
+		goto err_free_channels;
+	}
+
+	err = request_irq(adc_dev->irq, tiadc_irq, IRQF_SHARED,
+		indio_dev->name, indio_dev);
+	if (err)
+		goto err_free_trigger;
+
+	err = iio_triggered_buffer_setup(indio_dev, NULL,
+			&tiadc_trigger_h, &tiadc_buffer_setup_ops);
+	if (err)
+		goto err_free_irq;
 
 	err = iio_device_register(indio_dev);
 	if (err)
-		goto err_free_channels;
+		goto err_buffer_unregister;
 
 	platform_set_drvdata(pdev, indio_dev);
 
 	return 0;
 
+err_buffer_unregister:
+	iio_buffer_unregister(indio_dev);
+err_free_irq:
+	free_irq(adc_dev->irq, indio_dev);
+err_free_trigger:
+	iio_trigger_unregister(adc_dev->trig);
+	iio_trigger_free(adc_dev->trig);
 err_free_channels:
 	tiadc_channels_remove(indio_dev);
+err_free_device:
+	iio_device_free(indio_dev);
+err_ret:
 	return err;
 }
 
@@ -262,11 +465,14 @@ static int tiadc_remove(struct platform_device *pdev)
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
 	u32 step_en;
 
+	free_irq(adc_dev->irq, indio_dev);
 	iio_device_unregister(indio_dev);
+	iio_buffer_unregister(indio_dev);
 	tiadc_channels_remove(indio_dev);
 
 	step_en = get_adc_step_mask(adc_dev);
 	am335x_tsc_se_clr(adc_dev->mfd_tscadc, step_en);
+	iio_device_free(indio_dev);
 
 	return 0;
 }
@@ -298,10 +504,16 @@ static int tiadc_resume(struct device *dev)
 
 	/* Make sure ADC is powered up */
 	restore = tiadc_readl(adc_dev, REG_CTRL);
-	restore &= ~(CNTRLREG_POWERDOWN);
+	restore &= ~(CNTRLREG_TSCSSENB);
 	tiadc_writel(adc_dev, REG_CTRL, restore);
 
-	tiadc_step_config(adc_dev);
+	tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD);
+	tiadc_step_config(indio_dev);
+
+	/* Make sure ADC is powered up */
+	restore &= ~(CNTRLREG_POWERDOWN);
+	restore |= CNTRLREG_TSCSSENB;
+	tiadc_writel(adc_dev, REG_CTRL, restore);
 
 	return 0;
 }
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index db1791b..a372ebf 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -46,17 +46,25 @@
 /* Step Enable */
 #define STEPENB_MASK		(0x1FFFF << 0)
 #define STEPENB(val)		((val) << 0)
+#define ENB(val)			(1 << (val))
+#define STPENB_STEPENB		STEPENB(0x1FFFF)
+#define STPENB_STEPENB_TC	STEPENB(0x1FFF)
 
 /* IRQ enable */
 #define IRQENB_HW_PEN		BIT(0)
 #define IRQENB_FIFO0THRES	BIT(2)
+#define IRQENB_FIFO0OVRRUN	BIT(3)
+#define IRQENB_FIFO0UNDRFLW	BIT(4)
 #define IRQENB_FIFO1THRES	BIT(5)
+#define IRQENB_FIFO1OVRRUN	BIT(6)
+#define IRQENB_FIFO1UNDRFLW	BIT(7)
 #define IRQENB_PENUP		BIT(9)
 
 /* Step Configuration */
 #define STEPCONFIG_MODE_MASK	(3 << 0)
 #define STEPCONFIG_MODE(val)	((val) << 0)
 #define STEPCONFIG_MODE_HWSYNC	STEPCONFIG_MODE(2)
+#define STEPCONFIG_MODE_SWCNT	STEPCONFIG_MODE(1)
 #define STEPCONFIG_AVG_MASK	(7 << 2)
 #define STEPCONFIG_AVG(val)	((val) << 2)
 #define STEPCONFIG_AVG_16	STEPCONFIG_AVG(4)
@@ -124,6 +132,7 @@
 #define	MAX_CLK_DIV		7
 #define TOTAL_STEPS		16
 #define TOTAL_CHANNELS		8
+#define FIFO1_THRESHOLD		19
 
 /*
 * ADC runs at 3MHz, and it takes
@@ -153,6 +162,10 @@ struct ti_tscadc_dev {
 
 	/* adc device */
 	struct adc_device *adc;
+
+	/* Context save */
+	unsigned int irqstat;
+	unsigned int ctrl;
 };
 
 static inline struct ti_tscadc_dev *ti_tscadc_dev_get(struct platform_device *p)
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 1/2] input: ti_am335x_tsc: Enable shared IRQ for TSC
From: Zubair Lutfullah @ 2013-08-25 22:45 UTC (permalink / raw)
  To: jic23, lee.jones; +Cc: bigeasy, linux-iio, linux-input, linux-kernel, gregkh
In-Reply-To: <1377470724-15710-1-git-send-email-zubair.lutfullah@gmail.com>

Enable shared IRQ to allow ADC to share IRQ line from
parent MFD core. Only FIFO0 IRQs are for TSC and handled
on the TSC side.

Step mask would be updated from cached variable only previously.
In rare cases when both TSC and ADC are used, the cached
variable gets mixed up.
The step mask is written with the required mask every time.

Rachna Patil (TI) laid ground work for shared IRQ.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
---
 drivers/input/touchscreen/ti_am335x_tsc.c |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index e1c5300..4124e580 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -52,6 +52,7 @@ struct titsc {
 	u32			config_inp[4];
 	u32			bit_xp, bit_xn, bit_yp, bit_yn;
 	u32			inp_xp, inp_xn, inp_yp, inp_yn;
+	u32			step_mask;
 };
 
 static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
@@ -196,7 +197,8 @@ static void titsc_step_config(struct titsc *ts_dev)
 
 	/* The steps1 … end and bit 0 for TS_Charge */
 	stepenable = (1 << (end_step + 2)) - 1;
-	am335x_tsc_se_set(ts_dev->mfd_tscadc, stepenable);
+	ts_dev->step_mask = stepenable;
+	am335x_tsc_se_set(ts_dev->mfd_tscadc, ts_dev->step_mask);
 }
 
 static void titsc_read_coordinates(struct titsc *ts_dev,
@@ -260,6 +262,10 @@ static irqreturn_t titsc_irq(int irq, void *dev)
 	unsigned int fsm;
 
 	status = titsc_readl(ts_dev, REG_IRQSTATUS);
+	/*
+	 * ADC and touchscreen share the IRQ line.
+	 * FIFO1 interrupts are used by ADC. Handle FIFO0 IRQs here only
+	 */
 	if (status & IRQENB_FIFO0THRES) {
 
 		titsc_read_coordinates(ts_dev, &x, &y, &z1, &z2);
@@ -315,11 +321,17 @@ static irqreturn_t titsc_irq(int irq, void *dev)
 	}
 
 	if (irqclr) {
-		titsc_writel(ts_dev, REG_IRQSTATUS, irqclr);
-		am335x_tsc_se_update(ts_dev->mfd_tscadc);
-		return IRQ_HANDLED;
+		titsc_writel(ts_dev, REG_IRQSTATUS, (status | irqclr));
+		am335x_tsc_se_set(ts_dev->mfd_tscadc, ts_dev->step_mask);
 	}
-	return IRQ_NONE;
+
+	/* If any IRQ flags left, return none. So ADC can handle its IRQs */
+	status = titsc_readl(ts_dev, REG_IRQSTATUS);
+	if (status == false)
+		return IRQ_HANDLED;
+	else
+		return IRQ_NONE;
+
 }
 
 static int titsc_parse_dt(struct platform_device *pdev,
@@ -389,7 +401,7 @@ static int titsc_probe(struct platform_device *pdev)
 	}
 
 	err = request_irq(ts_dev->irq, titsc_irq,
-			  0, pdev->dev.driver->name, ts_dev);
+			  IRQF_SHARED, pdev->dev.driver->name, ts_dev);
 	if (err) {
 		dev_err(&pdev->dev, "failed to allocate irq.\n");
 		goto err_free_mem;
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH V6 0/2] iio: input: ti_am335x_adc: Add continuous sampling support
From: Zubair Lutfullah @ 2013-08-25 22:45 UTC (permalink / raw)
  To: jic23-KWPb1pKIrIJaa/9Udqfwiw, lee.jones-QSEj5FYQhm4dnm+yROfE0A
  Cc: bigeasy-hfZtesqFncYOwBW4kG4KsQ, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r

This applies to togreg branch in iio.

Round 6 updates
Fixed trigger the way iio list wanted. Driver has its own trigger.
Triggers at every FIFO Threshold IRQ and pushes samples to iio buffer.

Went through the driver and cleaned it up quite a bit.

Squashed patches together instead of having multiple tiny patches.

Zubair Lutfullah (2):
  input: ti_am335x_tsc: Enable shared IRQ for TSC
  iio: ti_am335x_adc: Add continuous sampling support

 drivers/iio/adc/ti_am335x_adc.c           |  254 ++++++++++++++++++++++++++---
 drivers/input/touchscreen/ti_am335x_tsc.c |   24 ++-
 include/linux/mfd/ti_am335x_tscadc.h      |   13 ++
 3 files changed, 264 insertions(+), 27 deletions(-)

-- 
1.7.9.5

^ permalink raw reply

* Re: [PATCH 2/3] Input: wacom - Provide a range for the ABS_MISC axis
From: Jason Gerecke @ 2013-08-25 17:43 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linuxwacom-devel, Linux Input, Ping Cheng
In-Reply-To: <20130824235039.GG4454@core.coreip.homeip.net>

On Sat, Aug 24, 2013 at 4:50 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> Hi Jason,
>
> On Thu, Aug 22, 2013 at 06:15:36PM -0700, Jason Gerecke wrote:
> > Android marks found axes as 'valid' only if they have a minimum
> > and maximum value that aren't equal. Since we don't actually
> > assign any range information for ABS_MISC, Android doesn't bother
> > to mark it such. This prevents userspace from being able to make
> > use of tool serial information.
>
> That should be fixed in Android code. Min/max are filled on best effort
> basis and 0/0 is effectively unknown.
>
> Thanks.
>
> --
> Dmitry

If userspace is written with the assumption that 0/0 == unknown, then
this patch changes nothing since the consumer will expect any value
between INT_MIN and INT_MAX anyway. Furthermore, if some userspace
program strictly interprets 0/0 to mean "will always be equal to 0",
then this patch actually provides it with the correct range. Either
way, setting the values to INT_MIN and INT_MAX does nothing more than
explicitly state the correct range.

I agree that Google should re-visit the function which does this
"valid" filtering, but I don't see a problem with this patch.

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

^ permalink raw reply

* Re: [PATCH] hid: Fix Speedlink VAD Cezanne support for some devices
From: Stefan Kriwanek @ 2013-08-25  8:46 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Dmitry Torokhov, linux-input
In-Reply-To: <alpine.LNX.2.00.1307302258080.18809@pobox.suse.cz>

Some devices of the "Speedlink VAD Cezanne" model need more aggressive fixing than already done.

I made sure through testing that this patch would not interfere with the proper working of a device that is bug-free. (The driver drops EV_REL events with abs(val) >= 256, which are not achievable even on the highest laser resolution hardware setting.) Hence, I believe it is safe to also apply to older kernels (that is, if your policy allows).

The patch applies to any kernel from 3.1 to current 3.11-rc6.


Signed-off-by: Stefan Kriwanek <mail@stefankriwanek.de>

---

--- linux-source-3.5.0/drivers/hid/hid-speedlink.c
+++ linux-source-3.5.0-speedlink/drivers/hid/hid-speedlink.c
@@ -3,7 +3,7 @@
  *  Fixes "jumpy" cursor and removes nonexistent keyboard LEDS from
  *  the HID descriptor.
  *
- *  Copyright (c) 2011 Stefan Kriwanek <mail@stefankriwanek.de>
+ *  Copyright (c) 2011, 2013 Stefan Kriwanek <dev@stefankriwanek.de>
  */
 
 /*
@@ -48,8 +48,13 @@ static int speedlink_event(struct hid_de
 		struct hid_usage *usage, __s32 value)
 {
 	/* No other conditions due to usage_table. */
-	/* Fix "jumpy" cursor (invalid events sent by device). */
-	if (value == 256)
+
+	/* This fixes the "jumpy" cursor occuring due to invalid events sent
+	 * by the device. Some devices only send them with value==+256, others
+	 * don't. However, catching abs(value)>=256 is restrictive enough not
+	 * to interfere with devices that were bug-free (has been tested).
+	 */
+	if (abs(value) >= 256)
 		return 1;
 	/* Drop useless distance 0 events (on button clicks etc.) as well */
 	if (value == 0)


^ permalink raw reply

* Re: [PATCH 1/2] HID: apple: Add another device ID for the mid-2013 Macbook Air
From: Henrik Rydberg @ 2013-08-25  7:11 UTC (permalink / raw)
  To: Ian Munsie
  Cc: Brad Ford, Linus G Thiel, Dmitry Torokhov, Jiri Kosina,
	linux-input, linux-kernel
In-Reply-To: <1377353873-17000-2-git-send-email-darkstarsword@gmail.com>

Hi Ian,

> This patch adds a device ID found for mid-2013 Macbook Air 6,1 from
> lsusb:
> 
> Bus 001 Device 003: ID 05ac:0290 Apple, Inc.
> 
> Since IDs already exist for this generation Macbook air as WELLSPRING8,
> name this one WELLSPRING8A. This only adds an ANSI version since it's
> device ID is only one less than the existing WELLSPRING8 IDs.

This seems to indicate that we got the ANSI/ISO numbers wrong in a
recent patch. IIRC, there was doubt already when the patch was
applied (Linus T CC'd). Most likely the right patch is this:

diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 4ef4d5e..a73f961 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -89,9 +89,9 @@
 #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO   0x025a
 #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS   0x025b
 /* MacbookAir6,2 (unibody, June 2013) */
-#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI   0x0291
-#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO    0x0292
-#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS    0x0293
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI   0x0290
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO    0x0291
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS    0x0292
 
 #define BCM5974_DEVICE(prod) {                                 \
        .match_flags = (USB_DEVICE_ID_MATCH_DEVICE |            \

Brad, Linus, does the above patch work for you as well as for Ian?

Thanks,
Henrik

^ permalink raw reply related

* Re: [PATCH 1/2] HID: apple: Add another device ID for the mid-2013 Macbook Air
From: Henrik Rydberg @ 2013-08-25  6:56 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Ian Munsie, Jiri Kosina, linux-input, linux-kernel
In-Reply-To: <20130824232630.GA4454@core.coreip.homeip.net>

On Sat, Aug 24, 2013 at 04:26:30PM -0700, Dmitry Torokhov wrote:
> Hi Ian,
> 
> On Sun, Aug 25, 2013 at 12:17:52AM +1000, Ian Munsie wrote:
> > This patch adds a device ID found for mid-2013 Macbook Air 6,1 from
> > lsusb:
> > 
> > Bus 001 Device 003: ID 05ac:0290 Apple, Inc.
> > 
> > Since IDs already exist for this generation Macbook air as WELLSPRING8,
> > name this one WELLSPRING8A. This only adds an ANSI version since it's
> > device ID is only one less than the existing WELLSPRING8 IDs.
> > 
> > Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
> 
> Thank you for the patch!
> 
> Jiri, can I take it through my tree for 3.11?

Wait, we probably want to resolve the USB ID inconsistency first. :-)

Thanks,
Henrik

^ permalink raw reply

* Re: [PATCH 1/3] Input: wacom - Support EMR and MFT sensors of Cintiq Companion Hybrid
From: Dmitry Torokhov @ 2013-08-24 23:56 UTC (permalink / raw)
  To: Jason Gerecke; +Cc: linuxwacom-devel, linux-input, pinglinux
In-Reply-To: <1377220537-1474-1-git-send-email-killertofu@gmail.com>

Hi Jason,

On Thu, Aug 22, 2013 at 06:15:35PM -0700, Jason Gerecke wrote:
> Adds support for the sensors integrated in to the Cintiq Companion
> Hybrid. These sensors use by-and-large the same protocol as the
> Cintiq 24HD touch.
> 
> NOTE: The ExpressKeys on the Cintiq Companion Hybrid are wired to
> both the EMR controller and CPU GPIO pins. It may be necessary to
> disable their functionality in this driver if building a custom
> Android kernel for this device (lest two events be sent to userspace
> for every button press).
> 
> Signed-off-by: Jason Gerecke <killertofu@gmail.com>
> ---
>  drivers/input/tablet/wacom_sys.c |  2 +-
>  drivers/input/tablet/wacom_wac.c | 49 +++++++++++++++++++++++++++++++++++++++-
>  drivers/input/tablet/wacom_wac.h |  1 +
>  3 files changed, 50 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index 1ad3e07..8fa7af7 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -548,7 +548,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
>  			/* MT Tablet PC touch */
>  			return wacom_set_device_mode(intf, 3, 4, 4);
>  		}
> -		else if (features->type == WACOM_24HDT) {
> +		else if (features->type == WACOM_24HDT || features->type == ASTERIX) {
>  			return wacom_set_device_mode(intf, 18, 3, 2);
>  		}
>  	} else if (features->device_type == BTN_TOOL_PEN) {
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index 541197b..8ccfe91 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -475,7 +475,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
>  	/* general pen packet */
>  	if ((data[1] & 0xb8) == 0xa0) {
>  		t = (data[6] << 2) | ((data[7] >> 6) & 3);
> -		if (features->type >= INTUOS4S && features->type <= WACOM_24HD) {
> +		if (features->type >= INTUOS4S && features->type <= ASTERIX) {
>  			t = (t << 1) | (data[1] & 1);
>  		}
>  		input_report_abs(input, ABS_PRESSURE, t);
> @@ -619,6 +619,25 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
>  			} else {
>  				input_report_abs(input, ABS_MISC, 0);
>  			}
> +		} else if (features->type == ASTERIX) {
> +			/*
> +			 * Do not send hardware buttons under Android. They
> +			 * are already sent to the system through GPIO (and
> +			 * have different meaning).
> +			 */
> +
> +#if 1

Should this be removed.

> +			input_report_key(input, BTN_1, (data[4] & 0x01));
> +			input_report_key(input, BTN_2, (data[4] & 0x02));
> +			input_report_key(input, BTN_3, (data[4] & 0x04));
> +			input_report_key(input, BTN_4, (data[4] & 0x08));
> +
> +			input_report_key(input, BTN_5, (data[4] & 0x10));  // Right
> +			input_report_key(input, BTN_6, (data[4] & 0x20));  // Up
> +			input_report_key(input, BTN_7, (data[4] & 0x40));  // Left
> +			input_report_key(input, BTN_8, (data[4] & 0x80));  // Down
> +			input_report_key(input, BTN_0, (data[3] & 0x01));  // Center

C-style comments are still preferred in the kernel.

> +#endif
>  		} else if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
>  			int i;
>  
> @@ -1325,6 +1344,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
>  	case WACOM_22HD:
>  	case WACOM_24HD:
>  	case DTK:
> +	case ASTERIX:
>  		sync = wacom_intuos_irq(wacom_wac);
>  		break;
>  
> @@ -1763,6 +1783,24 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
>  					      0, 0);
>  		}
>  		break;
> +
> +	case ASTERIX:
> +		__set_bit(BTN_1, input_dev->keybit);
> +		__set_bit(BTN_2, input_dev->keybit);
> +		__set_bit(BTN_3, input_dev->keybit);
> +		__set_bit(BTN_4, input_dev->keybit);
> +
> +		__set_bit(BTN_5, input_dev->keybit);
> +		__set_bit(BTN_6, input_dev->keybit);
> +		__set_bit(BTN_7, input_dev->keybit);
> +		__set_bit(BTN_8, input_dev->keybit);
> +		__set_bit(BTN_0, input_dev->keybit);
> +
> +		input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
> +		__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
> +
> +		wacom_setup_cintiq(wacom_wac);
> +		break;
>  	}
>  	return 0;
>  }
> @@ -2117,6 +2155,13 @@ static const struct wacom_features wacom_features_0xDF =
>  static const struct wacom_features wacom_features_0x6004 =
>  	{ "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
>  	  0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
> +static const struct wacom_features wacom_features_0x0307 =
> +	{ "Wacom ISDv5 307", WACOM_PKGLEN_INTUOS,  59552,  33848, 2047,
> +	  63, ASTERIX, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
> +	  .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 };
> +static const struct wacom_features wacom_features_0x0309 =
> +	{ "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */
> +	  .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10 };
>  
>  #define USB_DEVICE_WACOM(prod)					\
>  	USB_DEVICE(USB_VENDOR_ID_WACOM, prod),			\
> @@ -2247,6 +2292,8 @@ const struct usb_device_id wacom_ids[] = {
>  	{ USB_DEVICE_WACOM(0xF8) },
>  	{ USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) },
>  	{ USB_DEVICE_WACOM(0xFA) },
> +	{ USB_DEVICE_WACOM(0x0307) },
> +	{ USB_DEVICE_DETAILED(0x0309, USB_CLASS_HID, 0, 0) },
>  	{ USB_DEVICE_LENOVO(0x6004) },
>  	{ }
>  };
> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
> index dfc9e08..f47a5c1 100644
> --- a/drivers/input/tablet/wacom_wac.h
> +++ b/drivers/input/tablet/wacom_wac.h
> @@ -80,6 +80,7 @@ enum {
>  	WACOM_22HD,
>  	DTK,
>  	WACOM_24HD,
> +	ASTERIX,
>  	CINTIQ,
>  	WACOM_BEE,
>  	WACOM_13HD,

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 2/3] Input: wacom - Provide a range for the ABS_MISC axis
From: Dmitry Torokhov @ 2013-08-24 23:50 UTC (permalink / raw)
  To: Jason Gerecke; +Cc: linuxwacom-devel, linux-input, pinglinux
In-Reply-To: <1377220537-1474-2-git-send-email-killertofu@gmail.com>

Hi Jason,

On Thu, Aug 22, 2013 at 06:15:36PM -0700, Jason Gerecke wrote:
> Android marks found axes as 'valid' only if they have a minimum
> and maximum value that aren't equal. Since we don't actually
> assign any range information for ABS_MISC, Android doesn't bother
> to mark it such. This prevents userspace from being able to make
> use of tool serial information.

That should be fixed in Android code. Min/max are filled on best effort
basis and 0/0 is effectively unknown.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: wacom - add support for 0x300 and 0x301
From: Dmitry Torokhov @ 2013-08-24 23:46 UTC (permalink / raw)
  To: Ping Cheng; +Cc: linux-input, Ping Cheng
In-Reply-To: <1377046419-12376-1-git-send-email-pingc@wacom.com>

On Tue, Aug 20, 2013 at 05:53:39PM -0700, Ping Cheng wrote:
> Tested-by: Arjuna Rao Chavala <arjunaraoc@gmail.com>
> Signed-off-by: Ping Cheng <pingc@wacom.com>

Applied, thank you.

> ---
>  drivers/input/tablet/wacom_wac.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index 541197b..5e67cbf 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -2099,7 +2099,7 @@ static const struct wacom_features wacom_features_0xDA =
>  	{ "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN,  14720,  9200, 1023,
>  	  31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
>  	  .touch_max = 2 };
> -static struct wacom_features wacom_features_0xDB =
> +static const struct wacom_features wacom_features_0xDB =
>  	{ "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN,  21648, 13700, 1023,
>  	  31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
>  	  .touch_max = 2 };
> @@ -2114,6 +2114,12 @@ static const struct wacom_features wacom_features_0xDF =
>          { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN,    21648, 13700, 1023,
>  	  31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
>  	  .touch_max = 16 };
> +static const struct wacom_features wacom_features_0x300 =
> +	{ "Wacom Bamboo One S",    WACOM_PKGLEN_BBPEN,    14720,  9225, 1023,
> +	  31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
> +static const struct wacom_features wacom_features_0x301 =
> +	{ "Wacom Bamboo One M",    WACOM_PKGLEN_BBPEN,    21648, 13530, 1023,
> +	  31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
>  static const struct wacom_features wacom_features_0x6004 =
>  	{ "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
>  	  0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
> @@ -2240,6 +2246,8 @@ const struct usb_device_id wacom_ids[] = {
>  	{ USB_DEVICE_WACOM(0x100) },
>  	{ USB_DEVICE_WACOM(0x101) },
>  	{ USB_DEVICE_WACOM(0x10D) },
> +	{ USB_DEVICE_WACOM(0x300) },
> +	{ USB_DEVICE_WACOM(0x301) },
>  	{ USB_DEVICE_WACOM(0x304) },
>  	{ USB_DEVICE_WACOM(0x4001) },
>  	{ USB_DEVICE_WACOM(0x47) },
> -- 
> 1.8.1.2
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: wacom - fix error return code in wacom_probe()
From: Dmitry Torokhov @ 2013-08-24 23:41 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: killertofu, pinglinux, chris, fengguang.wu, yongjun_wei,
	linux-input
In-Reply-To: <CAPgLHd99Hc=EvmNSv6D4X=HYhDsypwHDGjN9eNJktmGZ_qOABQ@mail.gmail.com>

Hi Wei,

On Fri, Aug 23, 2013 at 10:53:00AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Fix to return a negative error code from the urb submit error
> handling case instead of 0, as done elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/input/tablet/wacom_sys.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index aaf23ae..7eeac61 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -1366,7 +1366,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
>  	usb_set_intfdata(intf, wacom);
>  
>  	if (features->quirks & WACOM_QUIRK_MONITOR) {
> -		if (usb_submit_urb(wacom->irq, GFP_KERNEL))
> +		error = usb_submit_urb(wacom->irq, GFP_KERNEL);
> +		if (error)
>  			goto fail5;
>  	}

If I remember correctly usb_submit_urb() uses errno definitions in a
creative way, so returning them verbatim to the upper layers is not teh
beset solution. I will change this to return -EIO instead.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: as5011 - fix error return code in as5011_probe()
From: Dmitry Torokhov @ 2013-08-24 23:40 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: wfp5p, broonie, shubhrajyoti, javier, yongjun_wei, linux-input
In-Reply-To: <CAPgLHd_zTAT7hGkcNCBCzKE5TiXfCYzCysbCDANX2vBDyrpH8A@mail.gmail.com>

On Fri, Aug 23, 2013 at 10:54:55AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Applied, thank you.

> ---
>  drivers/input/joystick/as5011.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c
> index 121cd63..262ebe2 100644
> --- a/drivers/input/joystick/as5011.c
> +++ b/drivers/input/joystick/as5011.c
> @@ -288,6 +288,7 @@ static int as5011_probe(struct i2c_client *client,
>  	if (irq < 0) {
>  		dev_err(&client->dev,
>  			"Failed to get irq number for button gpio\n");
> +		error = irq;
>  		goto err_free_button_gpio;
>  	}
>  
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 1/2] HID: apple: Add another device ID for the mid-2013 Macbook Air
From: Dmitry Torokhov @ 2013-08-24 23:26 UTC (permalink / raw)
  To: Ian Munsie; +Cc: Henrik Rydberg, Jiri Kosina, linux-input, linux-kernel
In-Reply-To: <1377353873-17000-2-git-send-email-darkstarsword@gmail.com>

Hi Ian,

On Sun, Aug 25, 2013 at 12:17:52AM +1000, Ian Munsie wrote:
> This patch adds a device ID found for mid-2013 Macbook Air 6,1 from
> lsusb:
> 
> Bus 001 Device 003: ID 05ac:0290 Apple, Inc.
> 
> Since IDs already exist for this generation Macbook air as WELLSPRING8,
> name this one WELLSPRING8A. This only adds an ANSI version since it's
> device ID is only one less than the existing WELLSPRING8 IDs.
> 
> Signed-off-by: Ian Munsie <darkstarsword@gmail.com>

Thank you for the patch!

Jiri, can I take it through my tree for 3.11?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 3/3] thinkpad_acpi: Wire unused micmute LED to capslock
From: Jason A. Donenfeld @ 2013-08-24 20:29 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh
  Cc: linux-acpi, linux-input, linux-kernel, mjg, rjw, len.brown, dtor
In-Reply-To: <20130823181826.GB27893@khazad-dum.debian.net>

On Fri, Aug 23, 2013 at 8:18 PM, Henrique de Moraes Holschuh
<hmh@hmh.eng.br> wrote:
> NACK.  This we won't do.  It is a LED misuse, and it will get in the way
> when we finally put that LED to its proper use.

Agreed. Please see my response to mjg.

^ permalink raw reply

* [PATCH 1/2] HID: apple: Add another device ID for the mid-2013 Macbook Air
From: Ian Munsie @ 2013-08-24 14:17 UTC (permalink / raw)
  To: Henrik Rydberg, Dmitry Torokhov, Jiri Kosina
  Cc: linux-input, linux-kernel, Ian Munsie
In-Reply-To: <1377353873-17000-1-git-send-email-darkstarsword@gmail.com>

This patch adds a device ID found for mid-2013 Macbook Air 6,1 from
lsusb:

Bus 001 Device 003: ID 05ac:0290 Apple, Inc.

Since IDs already exist for this generation Macbook air as WELLSPRING8,
name this one WELLSPRING8A. This only adds an ANSI version since it's
device ID is only one less than the existing WELLSPRING8 IDs.

Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
---
 drivers/hid/hid-apple.c | 2 ++
 drivers/hid/hid-core.c  | 2 ++
 drivers/hid/hid-ids.h   | 1 +
 3 files changed, 5 insertions(+)

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index c7710b5..9e5e9dd 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -530,6 +530,8 @@ static const struct hid_device_id apple_devices[] = {
 		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8A_ANSI),
+		.driver_data = APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 36668d1..5ebcfac 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1550,6 +1550,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8A_ANSI) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -2195,6 +2196,7 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8A_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ }
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index ffe4c7a..442a877 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -135,6 +135,7 @@
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI  0x0255
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO   0x0256
+#define USB_DEVICE_ID_APPLE_WELLSPRING8A_ANSI	0x0290
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI	0x0291
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO	0x0292
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS	0x0293
-- 
1.8.4.rc3


^ permalink raw reply related

* Add missing device ID for mid-2013 Macbook Air 6,1
From: Ian Munsie @ 2013-08-24 14:17 UTC (permalink / raw)
  To: Henrik Rydberg, Dmitry Torokhov, Jiri Kosina; +Cc: linux-input, linux-kernel

I recently got a new mid-2013 Macbook Air, which seems to use a device ID that
is missing from the kernel. From lsusb:
Bus 001 Device 003: ID 05ac:0290 Apple, Inc.

This generation of Macbook Air already has three IDs listed in the kernel
(0x0291, 0x0292 and 0x0293) as WELLSPRING8, so I've added 0x0290 to that list
as WELLSPRING8A. It looks like these generally come in triplets of consecutive
device IDs, so it's not clear to me why there would be an extra one in this
generation (and only -1 from the existing IDs which doesn't leave room for
additional ISO & JIS layouts if they are numbered consecutively).

With these patches the Fn key now works for me, as does the multitouch
functionality of the touchpad.


^ permalink raw reply

* [PATCH 2/2] Input: bcm5974: Add another device ID for the mid-2013 Macbook Air
From: Ian Munsie @ 2013-08-24 14:17 UTC (permalink / raw)
  To: Henrik Rydberg, Dmitry Torokhov, Jiri Kosina
  Cc: linux-input, linux-kernel, Ian Munsie
In-Reply-To: <1377353873-17000-1-git-send-email-darkstarsword@gmail.com>

This patch adds a device ID found for mid-2013 Macbook Air 6,1 from
lsusb:

Bus 001 Device 003: ID 05ac:0290 Apple, Inc.

Since IDs already exist for this generation Macbook air as WELLSPRING8,
name this one WELLSPRING8A. This only adds an ANSI version since it's
device ID is only one less than the existing WELLSPRING8 IDs.

Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
---
 drivers/input/mouse/bcm5974.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 4ef4d5e..fcd2f3f 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -88,6 +88,8 @@
 #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI	0x0259
 #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO	0x025a
 #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS	0x025b
+/* MacbookAir6,1 (unibody, June 2013) */
+#define USB_DEVICE_ID_APPLE_WELLSPRING8A_ANSI	0x0290
 /* MacbookAir6,2 (unibody, June 2013) */
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI	0x0291
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO	0x0292
@@ -149,6 +151,8 @@ static const struct usb_device_id bcm5974_table[] = {
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
+	/* MacbookAir6,1 */
+	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8A_ANSI),
 	/* MacbookAir6,2 */
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
@@ -424,6 +428,19 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		{ SN_COORD, -150, 6600 },
 		{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
 	},
+	{
+		USB_DEVICE_ID_APPLE_WELLSPRING8A_ANSI,
+		0,
+		0,
+		HAS_INTEGRATED_BUTTON,
+		0, sizeof(struct bt_data),
+		0x83, TYPE3, FINGER_TYPE3, FINGER_TYPE3 + SIZEOF_ALL_FINGERS,
+		{ SN_PRESSURE, 0, 300 },
+		{ SN_WIDTH, 0, 2048 },
+		{ SN_COORD, -4620, 5140 },
+		{ SN_COORD, -150, 6600 },
+		{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
+	},
 	{}
 };
 
-- 
1.8.4.rc3

^ permalink raw reply related

* Re: [PATCH 3/3] thinkpad_acpi: Wire unused micmute LED to capslock
From: Henrique de Moraes Holschuh @ 2013-08-23 18:18 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: linux-acpi, linux-input, linux-kernel, mjg, rjw, len.brown, dtor
In-Reply-To: <1377180132-4933-3-git-send-email-Jason@zx2c4.com>

On Thu, 22 Aug 2013, Jason A. Donenfeld wrote:
> Thinkpads with a micmute LED do not have a capslock LED. The micmute LED
> is currently not used by any piece of Linux kernel land or user land. It
> seems reasonable to hook it up to caps lock, at least by default, so
> users can have some degree of functionality.

NACK.  This we won't do.  It is a LED misuse, and it will get in the way
when we finally put that LED to its proper use.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

^ permalink raw reply


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