diff mbox

[v2,1/6] input: misc: AD714x: The interrupt status registers should be read in row.

Message ID 1305189911-24769-1-git-send-email-michael.hennerich@analog.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hennerich, Michael May 12, 2011, 8:45 a.m. UTC
From: Michael Hennerich <michael.hennerich@analog.com>

The interrupt status registers should be read in row to avoid invalid data.

Implement read sequence function for both bus options.
Always use it for reading the interrupt status registers.
Read sequence saves 50% of bus transactions compared to single register reads.
So use it also for the result registers, which are also located in row.
Update copyright notice.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
 drivers/input/misc/ad714x-i2c.c |   30 ++++++++++++++++++++++++++++--
 drivers/input/misc/ad714x-spi.c |   14 ++++++++++++--
 drivers/input/misc/ad714x.c     |   35 +++++++++++++++++------------------
 drivers/input/misc/ad714x.h     |    7 +++++--
 4 files changed, 62 insertions(+), 24 deletions(-)

Comments

Hennerich, Michael May 17, 2011, 11:01 a.m. UTC | #1
Hi Dmitry,

I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
But how about these ones?

[PATCH v2 1/6] input: misc: AD714x: The interrupt status registers should be read in row.
[PATCH v2 6/6] input: misc: AD714x: Fix endianness issues.

Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret Seif



--
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
Dmitry Torokhov May 18, 2011, 7:14 a.m. UTC | #2
On Tue, May 17, 2011 at 12:01:27PM +0100, Hennerich, Michael wrote:
> Hi Dmitry,
> 
> I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
> But how about these ones?
> 
> [PATCH v2 1/6] input: misc: AD714x: The interrupt status registers should be read in row.
> [PATCH v2 6/6] input: misc: AD714x: Fix endianness issues.
> 

Hi Michael,

Still pondering these two, give me a couple of days please...

Thanks.
Hennerich, Michael May 18, 2011, 7:10 p.m. UTC | #3
Dmitry Torokhov wrote on 2011-05-18:
> On Tue, May 17, 2011 at 12:01:27PM +0100, Hennerich, Michael wrote:
>> Hi Dmitry,
>>
>> I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
>> But how about these ones?
>>
>> [PATCH v2 1/6] input: misc: AD714x: The interrupt status registers
>> should be read in row. [PATCH v2 6/6] input: misc: AD714x: Fix
>> endianness issues.
>>
>
> Hi Michael,
>
> Still pondering these two, give me a couple of days please...
>
> Thanks.
>

Hi Dmitry,

No Problem - let me know in case you need some further clarification.
Both patches are tested on several platforms and addresses real issues.

BTW - are you going to merge the adp5589 driver anytime soon?
Are there open issues you like to get addressed first?


Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret Seif


--
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
Dmitry Torokhov May 19, 2011, 8 a.m. UTC | #4
On Wed, May 18, 2011 at 08:10:09PM +0100, Hennerich, Michael wrote:
> Dmitry Torokhov wrote on 2011-05-18:
> > On Tue, May 17, 2011 at 12:01:27PM +0100, Hennerich, Michael wrote:
> >> Hi Dmitry,
> >>
> >> I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
> >> But how about these ones?
> >>
> >> [PATCH v2 1/6] input: misc: AD714x: The interrupt status registers
> >> should be read in row. [PATCH v2 6/6] input: misc: AD714x: Fix
> >> endianness issues.
> >>
> >
> > Hi Michael,
> >
> > Still pondering these two, give me a couple of days please...
> >
> > Thanks.
> >
> 
> Hi Dmitry,
> 
> No Problem - let me know in case you need some further clarification.
> Both patches are tested on several platforms and addresses real issues.
> 
> BTW - are you going to merge the adp5589 driver anytime soon?
> Are there open issues you like to get addressed first?
> 

Oh, thanks for reminding me of it, I queued it for .40.

Thanks.
Hennerich, Michael July 13, 2011, 11:10 a.m. UTC | #5
Dmitry Torokhov wrote on 2011-05-19:
> On Wed, May 18, 2011 at 08:10:09PM +0100, Hennerich, Michael wrote:
>> Dmitry Torokhov wrote on 2011-05-18:
>>> On Tue, May 17, 2011 at 12:01:27PM +0100, Hennerich, Michael wrote:
>>>> Hi Dmitry,
>>>>
>>>> I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
>>>> But how about these ones?
>>>>
>>>> [PATCH v2 1/6] input: misc: AD714x: The interrupt status
>>>> registers should be read in row. [PATCH v2 6/6] input: misc:
>>>> AD714x: Fix endianness issues.
>>>>
>>>
>>> Hi Michael,
>>>
>>> Still pondering these two, give me a couple of days please...
>>>
>>> Thanks.
>>>
>>
>> Hi Dmitry,
>>
>> No Problem - let me know in case you need some further clarification.
>> Both patches are tested on several platforms and addresses real issues.
>>
>> BTW - are you going to merge the adp5589 driver anytime soon?
>> Are there open issues you like to get addressed first?
>>
>
> Oh, thanks for reminding me of it, I queued it for .40.
>
> Thanks.
>

Hi Dmitry,

Still pondering these two?

[PATCH v2 1/6] input: misc: AD714x:
        The interrupt status registers should be read in row.
[PATCH v2 6/6] input: misc: AD714x: Fix endianness issues.

Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret Seif



--
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
Hennerich, Michael Aug. 3, 2011, 8:40 a.m. UTC | #6
Hennerich, Michael wrote on 2011-07-13:
> Dmitry Torokhov wrote on 2011-05-19:
>> On Wed, May 18, 2011 at 08:10:09PM +0100, Hennerich, Michael wrote:
>>> Dmitry Torokhov wrote on 2011-05-18:
>>>> On Tue, May 17, 2011 at 12:01:27PM +0100, Hennerich, Michael wrote:
>>>>> Hi Dmitry,
>>>>>
>>>>> I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
>>>>> But how about these ones?
>>>>>
>>>>> [PATCH v2 1/6] input: misc: AD714x: The interrupt status
>>>>> registers should be read in row. [PATCH v2 6/6] input: misc:
>>>>> AD714x: Fix endianness issues.
>>>>>
>>>>
>>>> Hi Michael,
>>>>
>>>> Still pondering these two, give me a couple of days please...
>>>>
>>>> Thanks.
>>>>
>>>
>>> Hi Dmitry,
>>>
>>> No Problem - let me know in case you need some further clarification.
>>> Both patches are tested on several platforms and addresses real issues.
>>>
>>> BTW - are you going to merge the adp5589 driver anytime soon?
>>> Are there open issues you like to get addressed first?
>>>
>>
>> Oh, thanks for reminding me of it, I queued it for .40.
>>
>> Thanks.
>>
>
> Hi Dmitry,
>
> Still pondering these two?
>
> [PATCH v2 1/6] input: misc: AD714x:
>       The interrupt status registers should be read in row.
> [PATCH v2 6/6] input: misc: AD714x: Fix endianness issues.
>
> Greetings,
> Michael
>

Hi Dmitry,

Are you going to apply these two missing patches?


Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret Seif



--
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
Dmitry Torokhov Aug. 4, 2011, 7:54 a.m. UTC | #7
On Wed, Aug 03, 2011 at 09:40:22AM +0100, Hennerich, Michael wrote:
> Hennerich, Michael wrote on 2011-07-13:
> > Dmitry Torokhov wrote on 2011-05-19:
> >> On Wed, May 18, 2011 at 08:10:09PM +0100, Hennerich, Michael wrote:
> >>> Dmitry Torokhov wrote on 2011-05-18:
> >>>> On Tue, May 17, 2011 at 12:01:27PM +0100, Hennerich, Michael wrote:
> >>>>> Hi Dmitry,
> >>>>>
> >>>>> I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
> >>>>> But how about these ones?
> >>>>>
> >>>>> [PATCH v2 1/6] input: misc: AD714x: The interrupt status
> >>>>> registers should be read in row. [PATCH v2 6/6] input: misc:
> >>>>> AD714x: Fix endianness issues.
> >>>>>
> >>>>
> >>>> Hi Michael,
> >>>>
> >>>> Still pondering these two, give me a couple of days please...
> >>>>
> >>>> Thanks.
> >>>>
> >>>
> >>> Hi Dmitry,
> >>>
> >>> No Problem - let me know in case you need some further clarification.
> >>> Both patches are tested on several platforms and addresses real issues.
> >>>
> >>> BTW - are you going to merge the adp5589 driver anytime soon?
> >>> Are there open issues you like to get addressed first?
> >>>
> >>
> >> Oh, thanks for reminding me of it, I queued it for .40.
> >>
> >> Thanks.
> >>
> >
> > Hi Dmitry,
> >
> > Still pondering these two?
> >
> > [PATCH v2 1/6] input: misc: AD714x:
> >       The interrupt status registers should be read in row.
> > [PATCH v2 6/6] input: misc: AD714x: Fix endianness issues.
> >
> > Greetings,
> > Michael
> >
> 
> Hi Dmitry,
> 
> Are you going to apply these two missing patches?
> 

Hi Michael,

Yes, should be in the next pull (not todays one).

Thanks.
Hennerich, Michael Aug. 12, 2011, 8:58 a.m. UTC | #8
On 08/04/2011 09:54 AM, Dmitry Torokhov wrote:
> On Wed, Aug 03, 2011 at 09:40:22AM +0100, Hennerich, Michael wrote:
>> Hennerich, Michael wrote on 2011-07-13:
>>> Dmitry Torokhov wrote on 2011-05-19:
>>>> On Wed, May 18, 2011 at 08:10:09PM +0100, Hennerich, Michael wrote:
>>>>> Dmitry Torokhov wrote on 2011-05-18:
>>>>>> On Tue, May 17, 2011 at 12:01:27PM +0100, Hennerich, Michael wrote:
>>>>>>> Hi Dmitry,
>>>>>>>
>>>>>>> I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
>>>>>>> But how about these ones?
>>>>>>>
>>>>>>> [PATCH v2 1/6] input: misc: AD714x: The interrupt status
>>>>>>> registers should be read in row. [PATCH v2 6/6] input: misc:
>>>>>>> AD714x: Fix endianness issues.
>>>>>>>
>>>>>> Hi Michael,
>>>>>>
>>>>>> Still pondering these two, give me a couple of days please...
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>> Hi Dmitry,
>>>>>
>>>>> No Problem - let me know in case you need some further clarification.
>>>>> Both patches are tested on several platforms and addresses real issues.
>>>>>
>>>>> BTW - are you going to merge the adp5589 driver anytime soon?
>>>>> Are there open issues you like to get addressed first?
>>>>>
>>>> Oh, thanks for reminding me of it, I queued it for .40.
>>>>
>>>> Thanks.
>>>>
>>> Hi Dmitry,
>>>
>>> Still pondering these two?
>>>
>>> [PATCH v2 1/6] input: misc: AD714x:
>>>        The interrupt status registers should be read in row.
>>> [PATCH v2 6/6] input: misc: AD714x: Fix endianness issues.
>>>
>>> Greetings,
>>> Michael
>>>
>> Hi Dmitry,
>>
>> Are you going to apply these two missing patches?
>>
> Hi Michael,
>
> Yes, should be in the next pull (not todays one).
>
> Thanks.
>
Hi Dmitry,

Hmmm... Are you sure?
I can't find it.
Dmitry Torokhov Aug. 21, 2011, 8:09 p.m. UTC | #9
On Fri, Aug 12, 2011 at 10:58:27AM +0200, Michael Hennerich wrote:
> On 08/04/2011 09:54 AM, Dmitry Torokhov wrote:
> >On Wed, Aug 03, 2011 at 09:40:22AM +0100, Hennerich, Michael wrote:
> >>Hennerich, Michael wrote on 2011-07-13:
> >>>Dmitry Torokhov wrote on 2011-05-19:
> >>>>On Wed, May 18, 2011 at 08:10:09PM +0100, Hennerich, Michael wrote:
> >>>>>Dmitry Torokhov wrote on 2011-05-18:
> >>>>>>On Tue, May 17, 2011 at 12:01:27PM +0100, Hennerich, Michael wrote:
> >>>>>>>Hi Dmitry,
> >>>>>>>
> >>>>>>>I noticed you added patches 2/6, 3/6, 4/6 and 5/6 to your next tree.
> >>>>>>>But how about these ones?
> >>>>>>>
> >>>>>>>[PATCH v2 1/6] input: misc: AD714x: The interrupt status
> >>>>>>>registers should be read in row. [PATCH v2 6/6] input: misc:
> >>>>>>>AD714x: Fix endianness issues.
> >>>>>>>
> >>>>>>Hi Michael,
> >>>>>>
> >>>>>>Still pondering these two, give me a couple of days please...
> >>>>>>
> >>>>>>Thanks.
> >>>>>>
> >>>>>Hi Dmitry,
> >>>>>
> >>>>>No Problem - let me know in case you need some further clarification.
> >>>>>Both patches are tested on several platforms and addresses real issues.
> >>>>>
> >>>>>BTW - are you going to merge the adp5589 driver anytime soon?
> >>>>>Are there open issues you like to get addressed first?
> >>>>>
> >>>>Oh, thanks for reminding me of it, I queued it for .40.
> >>>>
> >>>>Thanks.
> >>>>
> >>>Hi Dmitry,
> >>>
> >>>Still pondering these two?
> >>>
> >>>[PATCH v2 1/6] input: misc: AD714x:
> >>>       The interrupt status registers should be read in row.
> >>>[PATCH v2 6/6] input: misc: AD714x: Fix endianness issues.
> >>>
> >>>Greetings,
> >>>Michael
> >>>
> >>Hi Dmitry,
> >>
> >>Are you going to apply these two missing patches?
> >>
> >Hi Michael,
> >
> >Yes, should be in the next pull (not todays one).
> >
> >Thanks.
> >
> Hi Dmitry,
> 
> Hmmm... Are you sure?
> I can't find it.

Hi Michael,

No, I haven't applied it yet, sorry. I was looking through the code and
realized that spi_write requires use of DMA-safe buffers. Also, if we
are concerned with performance we should not use spi_write_then_read,
but rather use the same buffer we'll be using for spi_write and avoid
locking and extra copying.

I'll be sending updated version out shortly and if I did not mess up and
it still works fro you then I swear I'll apply it ;)

Thanks.
diff mbox

Patch

diff --git a/drivers/input/misc/ad714x-i2c.c b/drivers/input/misc/ad714x-i2c.c
index e21deb1..fb6564e 100644
--- a/drivers/input/misc/ad714x-i2c.c
+++ b/drivers/input/misc/ad714x-i2c.c
@@ -1,7 +1,7 @@ 
 /*
  * AD714X CapTouch Programmable Controller driver (I2C bus)
  *
- * Copyright 2009 Analog Devices Inc.
+ * Copyright 2009-2011 Analog Devices Inc.
  *
  * Licensed under the GPL-2 or later.
  */
@@ -77,13 +77,39 @@  static int ad714x_i2c_read(struct device *dev, unsigned short reg,
 	return ret;
 }
 
+static int ad714x_i2c_read_seq(struct device *dev, unsigned short reg,
+				unsigned short *data, unsigned len)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	int ret = 0, i;
+	u8 *_reg = (u8 *)&reg;
+
+	u8 tx[2] = {
+		_reg[1],
+		_reg[0]
+	};
+
+	ret = i2c_master_send(client, tx, 2);
+	if (ret >= 0)
+		ret = i2c_master_recv(client, (u8 *)data, len * 2);
+
+	if (unlikely(ret < 0))
+		dev_err(&client->dev, "I2C read error\n");
+	else
+		for (i = 0; i < len; i++)
+			data[i] = be16_to_cpu(data[i]);
+
+	return ret;
+}
+
 static int __devinit ad714x_i2c_probe(struct i2c_client *client,
 					const struct i2c_device_id *id)
 {
 	struct ad714x_chip *chip;
 
 	chip = ad714x_probe(&client->dev, BUS_I2C, client->irq,
-			    ad714x_i2c_read, ad714x_i2c_write);
+			    ad714x_i2c_read, ad714x_i2c_read_seq,
+			    ad714x_i2c_write);
 	if (IS_ERR(chip))
 		return PTR_ERR(chip);
 
diff --git a/drivers/input/misc/ad714x-spi.c b/drivers/input/misc/ad714x-spi.c
index 4120dd5..d352aa5 100644
--- a/drivers/input/misc/ad714x-spi.c
+++ b/drivers/input/misc/ad714x-spi.c
@@ -1,7 +1,7 @@ 
 /*
  * AD714X CapTouch Programmable Controller driver (SPI bus)
  *
- * Copyright 2009 Analog Devices Inc.
+ * Copyright 2009-2011 Analog Devices Inc.
  *
  * Licensed under the GPL-2 or later.
  */
@@ -39,6 +39,15 @@  static int ad714x_spi_read(struct device *dev, unsigned short reg,
 	return spi_write_then_read(spi, (u8 *)&tx, 2, (u8 *)data, 2);
 }
 
+static int ad714x_spi_read_seq(struct device *dev, unsigned short reg,
+		unsigned short *data, unsigned len)
+{
+	struct spi_device *spi = to_spi_device(dev);
+	unsigned short tx = AD714x_SPI_CMD_PREFIX | AD714x_SPI_READ | reg;
+
+	return spi_write_then_read(spi, (u8 *)&tx, 2, (u8 *)data, len * 2);
+}
+
 static int ad714x_spi_write(struct device *dev, unsigned short reg,
 		unsigned short data)
 {
@@ -56,7 +65,8 @@  static int __devinit ad714x_spi_probe(struct spi_device *spi)
 	struct ad714x_chip *chip;
 
 	chip = ad714x_probe(&spi->dev, BUS_SPI, spi->irq,
-			    ad714x_spi_read, ad714x_spi_write);
+			    ad714x_spi_read, ad714x_spi_read_seq,
+			    ad714x_spi_write);
 	if (IS_ERR(chip))
 		return PTR_ERR(chip);
 
diff --git a/drivers/input/misc/ad714x.c b/drivers/input/misc/ad714x.c
index c431d09..eb352fb 100644
--- a/drivers/input/misc/ad714x.c
+++ b/drivers/input/misc/ad714x.c
@@ -1,7 +1,7 @@ 
 /*
  * AD714X CapTouch Programmable Controller driver supporting AD7142/3/7/8/7A
  *
- * Copyright 2009 Analog Devices Inc.
+ * Copyright 2009-2011 Analog Devices Inc.
  *
  * Licensed under the GPL-2 or later.
  */
@@ -131,8 +131,8 @@  struct ad714x_driver_data {
  * of spi/i2c device
  */
 struct ad714x_chip {
-	unsigned short h_state;
 	unsigned short l_state;
+	unsigned short h_state;
 	unsigned short c_state;
 	unsigned short adc_reg[STAGE_NUM];
 	unsigned short amb_reg[STAGE_NUM];
@@ -144,6 +144,7 @@  struct ad714x_chip {
 	int irq;
 	struct device *dev;
 	ad714x_read_t read;
+	ad714x_read_seq_t read_seq;
 	ad714x_write_t write;
 
 	struct mutex mutex;
@@ -279,9 +280,11 @@  static void ad714x_slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
 	struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
 	int i;
 
+	ad714x->read_seq(ad714x->dev, CDC_RESULT_S0 + hw->start_stage,
+			&ad714x->adc_reg[hw->start_stage],
+			hw->end_stage - hw->start_stage + 1);
+
 	for (i = hw->start_stage; i <= hw->end_stage; i++) {
-		ad714x->read(ad714x->dev, CDC_RESULT_S0 + i,
-			&ad714x->adc_reg[i]);
 		ad714x->read(ad714x->dev,
 				STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
 				&ad714x->amb_reg[i]);
@@ -451,9 +454,11 @@  static void ad714x_wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
 	struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
 	int i;
 
+	ad714x->read_seq(ad714x->dev, CDC_RESULT_S0 + hw->start_stage,
+			&ad714x->adc_reg[hw->start_stage],
+			hw->end_stage - hw->start_stage + 1);
+
 	for (i = hw->start_stage; i <= hw->end_stage; i++) {
-		ad714x->read(ad714x->dev, CDC_RESULT_S0 + i,
-			&ad714x->adc_reg[i]);
 		ad714x->read(ad714x->dev,
 				STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
 				&ad714x->amb_reg[i]);
@@ -1025,9 +1030,7 @@  static void ad714x_hw_init(struct ad714x_chip *ad714x)
 	ad714x->write(ad714x->dev, AD714X_STG_CAL_EN_REG, 0xFFF);
 
 	/* clear all interrupts */
-	ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &data);
-	ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &data);
-	ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &data);
+	ad714x->read_seq(ad714x->dev, STG_LOW_INT_STA_REG, &ad714x->l_state, 3);
 }
 
 static irqreturn_t ad714x_interrupt_thread(int irq, void *data)
@@ -1037,9 +1040,7 @@  static irqreturn_t ad714x_interrupt_thread(int irq, void *data)
 
 	mutex_lock(&ad714x->mutex);
 
-	ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &ad714x->l_state);
-	ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &ad714x->h_state);
-	ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &ad714x->c_state);
+	ad714x->read_seq(ad714x->dev, STG_LOW_INT_STA_REG, &ad714x->l_state, 3);
 
 	for (i = 0; i < ad714x->hw->button_num; i++)
 		ad714x_button_state_machine(ad714x, i);
@@ -1057,7 +1058,8 @@  static irqreturn_t ad714x_interrupt_thread(int irq, void *data)
 
 #define MAX_DEVICE_NUM 8
 struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
-				 ad714x_read_t read, ad714x_write_t write)
+				 ad714x_read_t read, ad714x_read_seq_t read_seq,
+				 ad714x_write_t write)
 {
 	int i, alloc_idx;
 	int error;
@@ -1110,6 +1112,7 @@  struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
 	drv_mem += sizeof(*bt_drv) * ad714x->hw->button_num;
 
 	ad714x->read = read;
+	ad714x->read_seq = read_seq;
 	ad714x->write = write;
 	ad714x->irq = irq;
 	ad714x->dev = dev;
@@ -1316,8 +1319,6 @@  EXPORT_SYMBOL(ad714x_disable);
 
 int ad714x_enable(struct ad714x_chip *ad714x)
 {
-	unsigned short data;
-
 	dev_dbg(ad714x->dev, "%s enter\n", __func__);
 
 	mutex_lock(&ad714x->mutex);
@@ -1331,9 +1332,7 @@  int ad714x_enable(struct ad714x_chip *ad714x)
 	 * otherwise we will get no chance to enter falling-edge irq again
 	 */
 
-	ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &data);
-	ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &data);
-	ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &data);
+	ad714x->read_seq(ad714x->dev, STG_LOW_INT_STA_REG, &ad714x->l_state, 3);
 
 	mutex_unlock(&ad714x->mutex);
 
diff --git a/drivers/input/misc/ad714x.h b/drivers/input/misc/ad714x.h
index 45c54fb..58d5e4e 100644
--- a/drivers/input/misc/ad714x.h
+++ b/drivers/input/misc/ad714x.h
@@ -1,7 +1,7 @@ 
 /*
  * AD714X CapTouch Programmable Controller driver (bus interfaces)
  *
- * Copyright 2009 Analog Devices Inc.
+ * Copyright 2009-2011 Analog Devices Inc.
  *
  * Licensed under the GPL-2 or later.
  */
@@ -15,12 +15,15 @@  struct device;
 struct ad714x_chip;
 
 typedef int (*ad714x_read_t)(struct device *, unsigned short, unsigned short *);
+typedef int (*ad714x_read_seq_t)(struct device *, unsigned short,
+				 unsigned short *, unsigned len);
 typedef int (*ad714x_write_t)(struct device *, unsigned short, unsigned short);
 
 int ad714x_disable(struct ad714x_chip *ad714x);
 int ad714x_enable(struct ad714x_chip *ad714x);
 struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
-				 ad714x_read_t read, ad714x_write_t write);
+				 ad714x_read_t read, ad714x_read_seq_t read_seq,
+				 ad714x_write_t write);
 void ad714x_remove(struct ad714x_chip *ad714x);
 
 #endif