[v2] input/keyboard: add ADP5588 QWERTY I2C Keyboard Input device driver
diff mbox

Message ID 20090916050236.GF2756@core.coreip.homeip.net
State Superseded, archived
Headers show

Commit Message

Dmitry Torokhov Sept. 16, 2009, 5:02 a.m. UTC
On Tue, Sep 15, 2009 at 08:49:38PM -0400, Mike Frysinger wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
> 
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> Signed-off-by: Bryan Wu <cooloney@kernel.org>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> ---
> v2
> 	- merge my and Dmitry's clean up fixes
> 

Looks good, I'd also like to add this instead of recalcularing delay
every time:

Comments

Mike Frysinger Sept. 16, 2009, 12:55 p.m. UTC | #1
On Wed, Sep 16, 2009 at 01:02, Dmitry Torokhov wrote:
> On Tue, Sep 15, 2009 at 08:49:38PM -0400, Mike Frysinger wrote:
>> From: Michael Hennerich <michael.hennerich@analog.com>
>>
>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
>> Signed-off-by: Bryan Wu <cooloney@kernel.org>
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
>> ---
>> v2
>>       - merge my and Dmitry's clean up fixes
>>
>
> Looks good, I'd also like to add this instead of recalcularing delay
> every time:

makes sense to me.  you going to merge that, or should i merge & repost as v3 ?
-mike
--
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 Sept. 16, 2009, 4:33 p.m. UTC | #2
On Wed, Sep 16, 2009 at 08:55:13AM -0400, Mike Frysinger wrote:
> On Wed, Sep 16, 2009 at 01:02, Dmitry Torokhov wrote:
> > On Tue, Sep 15, 2009 at 08:49:38PM -0400, Mike Frysinger wrote:
> >> From: Michael Hennerich <michael.hennerich@analog.com>
> >>
> >> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> >> Signed-off-by: Bryan Wu <cooloney@kernel.org>
> >> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> >> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> >> ---
> >> v2
> >>       - merge my and Dmitry's clean up fixes
> >>
> >
> > Looks good, I'd also like to add this instead of recalcularing delay
> > every time:
> 
> makes sense to me.  you going to merge that, or should i merge & repost as v3 ?

If you could merge and test this would be great - I obviously don't have
the hardware.
Mike Frysinger Sept. 21, 2009, 4:45 p.m. UTC | #3
On Wed, Sep 16, 2009 at 01:02, Dmitry Torokhov wrote:
> On Tue, Sep 15, 2009 at 08:49:38PM -0400, Mike Frysinger wrote:
>> From: Michael Hennerich <michael.hennerich@analog.com>
>>
>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
>> Signed-off-by: Bryan Wu <cooloney@kernel.org>
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
>> ---
>> v2
>>       - merge my and Dmitry's clean up fixes
>>
>
> Looks good, I'd also like to add this instead of recalcularing delay
> every time:

this should continue to work fine with cpu scaling right ?
-mike
--
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 Sept. 21, 2009, 4:55 p.m. UTC | #4
On Mon, Sep 21, 2009 at 12:45:02PM -0400, Mike Frysinger wrote:
> On Wed, Sep 16, 2009 at 01:02, Dmitry Torokhov wrote:
> > On Tue, Sep 15, 2009 at 08:49:38PM -0400, Mike Frysinger wrote:
> >> From: Michael Hennerich <michael.hennerich@analog.com>
> >>
> >> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> >> Signed-off-by: Bryan Wu <cooloney@kernel.org>
> >> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> >> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> >> ---
> >> v2
> >>       - merge my and Dmitry's clean up fixes
> >>
> >
> > Looks good, I'd also like to add this instead of recalcularing delay
> > every time:
> 
> this should continue to work fine with cpu scaling right ?

Jiffy value depends only on HZ, not on current cpu frequency so should
be OK I think.

Patch
diff mbox

diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 892a532..d48c808 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -63,7 +63,7 @@  struct adp5588_kpad {
 	struct i2c_client *client;
 	struct input_dev *input;
 	struct delayed_work work;
-	unsigned revid;
+	unsigned long delay;
 	unsigned short keycode[ADP5588_KEYMAPSIZE];
 };
 
@@ -119,9 +119,7 @@  static irqreturn_t adp5588_irq(int irq, void *handle)
 	 * REVID < 4
 	 */
 
-	schedule_delayed_work(&kpad->work,
-			WA_DELAYED_READOUT_REVID(kpad->revid) ?
-			(unsigned long) msecs_to_jiffies(30) : 0);
+	schedule_delayed_work(&kpad->work, kpad->delay);
 
 	return IRQ_HANDLED;
 }
@@ -164,6 +162,7 @@  static int __devinit adp5588_probe(struct i2c_client *client,
 	struct adp5588_kpad *kpad;
 	struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
 	struct input_dev *input;
+	unsigned int revid;
 	int ret, i;
 	int error;
 
@@ -210,7 +209,9 @@  static int __devinit adp5588_probe(struct i2c_client *client,
 		goto err_free_mem;
 	}
 
-	kpad->revid = (u8) ret & ADP5588_DEVICE_ID_MASK;
+	revid = (u8) ret & ADP5588_DEVICE_ID_MASK;
+	if (WA_DELAYED_READOUT_REVID(revid))
+		kpad->delay = msecs_to_jiffies(30);
 
 	input->name = client->name;
 	input->phys = "adp5588-keys/input0";
@@ -221,7 +222,7 @@  static int __devinit adp5588_probe(struct i2c_client *client,
 	input->id.bustype = BUS_I2C;
 	input->id.vendor = 0x0001;
 	input->id.product = 0x0001;
-	input->id.version = kpad->revid;
+	input->id.version = revid;
 
 	input->keycodesize = sizeof(kpad->keycode[0]);
 	input->keycodemax = pdata->keymapsize;
@@ -247,8 +248,8 @@  static int __devinit adp5588_probe(struct i2c_client *client,
 	}
 
 	error = request_irq(client->irq, adp5588_irq,
-		IRQF_TRIGGER_FALLING | IRQF_DISABLED,
-		client->dev.driver->name, kpad);
+			    IRQF_TRIGGER_FALLING | IRQF_DISABLED,
+			    client->dev.driver->name, kpad);
 	if (error) {
 		dev_err(&client->dev, "irq %d busy?\n", client->irq);
 		goto err_unreg_dev;
@@ -261,9 +262,7 @@  static int __devinit adp5588_probe(struct i2c_client *client,
 	device_init_wakeup(&client->dev, 1);
 	i2c_set_clientdata(client, kpad);
 
-	dev_info(&client->dev, "Rev.%d keypad, irq %d\n",
-		kpad->revid, client->irq);
-
+	dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq);
 	return 0;
 
  err_free_irq: