RE: [patch/rfc 2.6.28-rc2] input: twl4030_keypad driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday, January 29, 2009 5:58 PM, David Brownell wrote:
> On Thursday 29 January 2009, hartleys wrote:
> > > +/* Boards have uniqe mappings of {col, row} --> keycode.
> > > + * Column and row are 4 bits, but range only from 0..7;
> > > + * a PERSISTENT_KEY is "always on" and never reported.
> > > + */
> > > +#define KEY_PERSISTENT               0x00800000 #define KEY(col, 
> > > +row, keycode)       (((col) << 28) | ((row) << 24) |
> > (keycode))
> > 
> > The same KEY macro is defined in:
> > 
> > arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
> > arch/arm/plat-omap/include/mach/keypad.h
> 
> I copied it from the OMAP version as part of removing needless OMAP
> dependencies from this driver.

Makes sense.
 
> > I also have a keypad driver for the ep93xx that uses the same macro.
> > 
> > Shouldn't/couldn't this be generalized and added to the 
> > include/linux/input.h file?  Allowing 4-bits for row/col gives a 
> > maximum key matrix of 16x16 keys which should be enough for just
> > about anything.
> 
> Makes sense.  But that's not what this patch is about, and I also
> think the KEY prefix is probably too generic.
 
Understand.  Just noticed the common macro and wondered if something should be done to generalize it.

> I'd support an overall cleanup patch that fixes all those things at once.

How's this for a starting point?  I'm willing to create a cleanup patch for all the mach-omap1, mach-omap2, and mach-pxa users.  

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>

---

diff --git a/include/linux/input.h b/include/linux/input.h
index 1249a0c..0879493 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -598,6 +598,14 @@ struct input_absinfo {
 #define KEY_CNT			(KEY_MAX+1)
 
 /*
+ * Macro to pack the row/col of a key on a matrix keypad and it's associated
+ * KEY_* code into into an array.  4 bits are used for both the row and column
+ * allowing for up to a 16x16 keypad.  The row (_r) and column (_c) are
+ * interchangable depending on a keypad drivers usage.
+ */
+#define MATRIX_KEY(_r, _c, _v)	(((_r) << 28) | ((_c) << 24) | (_v))
+
+/*
  * Relative axes
  */
  
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux