Re: [PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-15 Thread Simon Glass
Hi Dmitry,

On Thu, Feb 14, 2013 at 9:31 AM, Dmitry Torokhov
 wrote:
> On Wed, Feb 13, 2013 at 10:45:07PM -0800, Simon Glass wrote:
>> >>
>> >> +config KEYBOARD_CROS_EC
>> >> + tristate "ChromeOS EC keyboard"
>> >> + select INPUT_MATRIXKMAP
>> >> + select MFD_CROS_EC
>> >
>> > Is this select safe? I.e. does MFD_CROS_EC depend on anything else?
>>
>> I'll remove it, since it isn't required, and it's true that it does
>> need other things.
>
> Instead of droppign the dependency completely I think it should "depens
> on MFD_CROS_EC"

OK, done.

>
>> >> +
>> >> +static void cros_ec_keyb_close(struct input_dev *dev)
>> >> +{
>> >> + struct cros_ec_keyb *ckdev = input_get_drvdata(dev);
>> >> +
>> >> + blocking_notifier_chain_unregister(>ec->event_notifier,
>> >> +>notifier);
>> >> + blocking_notifier_chain_unregister(>ec->wake_notifier,
>> >> +>wake_notifier);
>> >
>> > Why is this done via a notifier instead of regular resume method?
>>
>> Because we only call the notifer in resume when we were not waking on
>> a keyboard event. We use it to flush the keyboard. It was a late
>> change so there might be a better way, but this driver does not have a
>> resume handler.
>
> Right and the question is why does not it have resume handler and why
> you inventing your own resume infrastructure instead of using the
> standard one.

I will fix that.

>
>> >> +
>> >> +static int cros_ec_keyb_probe(struct platform_device *pdev)
>> >> +{
>> >> + struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
>> >> + struct device *dev = ec->dev;
>> >> + struct cros_ec_keyb *ckdev = NULL;
>> >> + struct input_dev *idev = NULL;
>> >> + struct device_node *np;
>> >> + int err;
>> >> +
>> >> + np = of_find_matching_node(NULL, cros_ec_kbc_of_match);
>> >
>> > And if we don't find it?
>>
>> Added error checking.
>>
>> >
>> >> +
>> >> + ckdev = kzalloc(sizeof(*ckdev), GFP_KERNEL);
>> >> + if (!ckdev) {
>> >> + dev_err(dev, "cannot allocate memory for ckdev\n");
>> >> + return -ENOMEM;
>> >> + }
>> >> + pdev->dev.of_node = np;
>> >
>> > Huh? I'd expect the platform device be fully set up (including DT data)
>> > before the driver is called.
>>
>> This is a child of the mfd driver cros_ec, so I don't think that
>> works. Or maybe I'm just not sure how to plumb it in so it is
>> automatic. Or maybe I just need to add the id to the device info
>> below?
>
> Who creates this device? Whoever does this should set up the
> pdev->dev.of_node. This is not this driver's responsibility.
>
> And then you add the id to the table below and matching is done
> automatically.

OK I see - it comes from mfd and it is easy enough to make it do the
right thing.

Thanks for your comments and patience. I will send a new patch.

Regards,
Simon

>
> Thanks.
>
> --
> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-15 Thread Simon Glass
Hi Dmitry,

On Thu, Feb 14, 2013 at 9:31 AM, Dmitry Torokhov
dmitry.torok...@gmail.com wrote:
 On Wed, Feb 13, 2013 at 10:45:07PM -0800, Simon Glass wrote:
 
  +config KEYBOARD_CROS_EC
  + tristate ChromeOS EC keyboard
  + select INPUT_MATRIXKMAP
  + select MFD_CROS_EC
 
  Is this select safe? I.e. does MFD_CROS_EC depend on anything else?

 I'll remove it, since it isn't required, and it's true that it does
 need other things.

 Instead of droppign the dependency completely I think it should depens
 on MFD_CROS_EC

OK, done.


  +
  +static void cros_ec_keyb_close(struct input_dev *dev)
  +{
  + struct cros_ec_keyb *ckdev = input_get_drvdata(dev);
  +
  + blocking_notifier_chain_unregister(ckdev-ec-event_notifier,
  +ckdev-notifier);
  + blocking_notifier_chain_unregister(ckdev-ec-wake_notifier,
  +ckdev-wake_notifier);
 
  Why is this done via a notifier instead of regular resume method?

 Because we only call the notifer in resume when we were not waking on
 a keyboard event. We use it to flush the keyboard. It was a late
 change so there might be a better way, but this driver does not have a
 resume handler.

 Right and the question is why does not it have resume handler and why
 you inventing your own resume infrastructure instead of using the
 standard one.

I will fix that.


  +
  +static int cros_ec_keyb_probe(struct platform_device *pdev)
  +{
  + struct cros_ec_device *ec = dev_get_drvdata(pdev-dev.parent);
  + struct device *dev = ec-dev;
  + struct cros_ec_keyb *ckdev = NULL;
  + struct input_dev *idev = NULL;
  + struct device_node *np;
  + int err;
  +
  + np = of_find_matching_node(NULL, cros_ec_kbc_of_match);
 
  And if we don't find it?

 Added error checking.

 
  +
  + ckdev = kzalloc(sizeof(*ckdev), GFP_KERNEL);
  + if (!ckdev) {
  + dev_err(dev, cannot allocate memory for ckdev\n);
  + return -ENOMEM;
  + }
  + pdev-dev.of_node = np;
 
  Huh? I'd expect the platform device be fully set up (including DT data)
  before the driver is called.

 This is a child of the mfd driver cros_ec, so I don't think that
 works. Or maybe I'm just not sure how to plumb it in so it is
 automatic. Or maybe I just need to add the id to the device info
 below?

 Who creates this device? Whoever does this should set up the
 pdev-dev.of_node. This is not this driver's responsibility.

 And then you add the id to the table below and matching is done
 automatically.

OK I see - it comes from mfd and it is easy enough to make it do the
right thing.

Thanks for your comments and patience. I will send a new patch.

Regards,
Simon


 Thanks.

 --
 Dmitry
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-14 Thread Dmitry Torokhov
On Wed, Feb 13, 2013 at 10:45:07PM -0800, Simon Glass wrote:
> >>
> >> +config KEYBOARD_CROS_EC
> >> + tristate "ChromeOS EC keyboard"
> >> + select INPUT_MATRIXKMAP
> >> + select MFD_CROS_EC
> >
> > Is this select safe? I.e. does MFD_CROS_EC depend on anything else?
> 
> I'll remove it, since it isn't required, and it's true that it does
> need other things.

Instead of droppign the dependency completely I think it should "depens
on MFD_CROS_EC"

> >> +
> >> +static void cros_ec_keyb_close(struct input_dev *dev)
> >> +{
> >> + struct cros_ec_keyb *ckdev = input_get_drvdata(dev);
> >> +
> >> + blocking_notifier_chain_unregister(>ec->event_notifier,
> >> +>notifier);
> >> + blocking_notifier_chain_unregister(>ec->wake_notifier,
> >> +>wake_notifier);
> >
> > Why is this done via a notifier instead of regular resume method?
> 
> Because we only call the notifer in resume when we were not waking on
> a keyboard event. We use it to flush the keyboard. It was a late
> change so there might be a better way, but this driver does not have a
> resume handler.

Right and the question is why does not it have resume handler and why
you inventing your own resume infrastructure instead of using the
standard one.

> >> +
> >> +static int cros_ec_keyb_probe(struct platform_device *pdev)
> >> +{
> >> + struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
> >> + struct device *dev = ec->dev;
> >> + struct cros_ec_keyb *ckdev = NULL;
> >> + struct input_dev *idev = NULL;
> >> + struct device_node *np;
> >> + int err;
> >> +
> >> + np = of_find_matching_node(NULL, cros_ec_kbc_of_match);
> >
> > And if we don't find it?
> 
> Added error checking.
> 
> >
> >> +
> >> + ckdev = kzalloc(sizeof(*ckdev), GFP_KERNEL);
> >> + if (!ckdev) {
> >> + dev_err(dev, "cannot allocate memory for ckdev\n");
> >> + return -ENOMEM;
> >> + }
> >> + pdev->dev.of_node = np;
> >
> > Huh? I'd expect the platform device be fully set up (including DT data)
> > before the driver is called.
> 
> This is a child of the mfd driver cros_ec, so I don't think that
> works. Or maybe I'm just not sure how to plumb it in so it is
> automatic. Or maybe I just need to add the id to the device info
> below?

Who creates this device? Whoever does this should set up the
pdev->dev.of_node. This is not this driver's responsibility.

And then you add the id to the table below and matching is done
automatically.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-14 Thread Dmitry Torokhov
On Wed, Feb 13, 2013 at 10:45:07PM -0800, Simon Glass wrote:
 
  +config KEYBOARD_CROS_EC
  + tristate ChromeOS EC keyboard
  + select INPUT_MATRIXKMAP
  + select MFD_CROS_EC
 
  Is this select safe? I.e. does MFD_CROS_EC depend on anything else?
 
 I'll remove it, since it isn't required, and it's true that it does
 need other things.

Instead of droppign the dependency completely I think it should depens
on MFD_CROS_EC

  +
  +static void cros_ec_keyb_close(struct input_dev *dev)
  +{
  + struct cros_ec_keyb *ckdev = input_get_drvdata(dev);
  +
  + blocking_notifier_chain_unregister(ckdev-ec-event_notifier,
  +ckdev-notifier);
  + blocking_notifier_chain_unregister(ckdev-ec-wake_notifier,
  +ckdev-wake_notifier);
 
  Why is this done via a notifier instead of regular resume method?
 
 Because we only call the notifer in resume when we were not waking on
 a keyboard event. We use it to flush the keyboard. It was a late
 change so there might be a better way, but this driver does not have a
 resume handler.

Right and the question is why does not it have resume handler and why
you inventing your own resume infrastructure instead of using the
standard one.

  +
  +static int cros_ec_keyb_probe(struct platform_device *pdev)
  +{
  + struct cros_ec_device *ec = dev_get_drvdata(pdev-dev.parent);
  + struct device *dev = ec-dev;
  + struct cros_ec_keyb *ckdev = NULL;
  + struct input_dev *idev = NULL;
  + struct device_node *np;
  + int err;
  +
  + np = of_find_matching_node(NULL, cros_ec_kbc_of_match);
 
  And if we don't find it?
 
 Added error checking.
 
 
  +
  + ckdev = kzalloc(sizeof(*ckdev), GFP_KERNEL);
  + if (!ckdev) {
  + dev_err(dev, cannot allocate memory for ckdev\n);
  + return -ENOMEM;
  + }
  + pdev-dev.of_node = np;
 
  Huh? I'd expect the platform device be fully set up (including DT data)
  before the driver is called.
 
 This is a child of the mfd driver cros_ec, so I don't think that
 works. Or maybe I'm just not sure how to plumb it in so it is
 automatic. Or maybe I just need to add the id to the device info
 below?

Who creates this device? Whoever does this should set up the
pdev-dev.of_node. This is not this driver's responsibility.

And then you add the id to the table below and matching is done
automatically.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-13 Thread Simon Glass
Hi Dmitry,

On Wed, Feb 13, 2013 at 12:02 PM, Dmitry Torokhov
 wrote:
> Hi SImon,
>
> On Tue, Feb 12, 2013 at 06:42:26PM -0800, Simon Glass wrote:
>> Use the key-matrix layer to interpret key scan information from the EC
>> and inject input based on the FDT-supplied key map. This driver registers
>> itself with the ChromeOS EC driver to perform communications.
>>
>> Additional FDT bindings are provided to specify rows/columns and the
>> auto-repeat information.
>>
>> Signed-off-by: Simon Glass 
>> Signed-off-by: Luigi Semenzato 
>> Signed-off-by: Vincent Palatin 
>> ---
>> Changes in v2:
>> - Remove use of __devinit/__devexit
>> - Use function to read matrix-keypad parameters from DT
>> - Remove key autorepeat parameters from DT binding and driver
>> - Use unsigned int for rows/cols

Thanks for all the review comments.

>>
>>  .../devicetree/bindings/input/cros-ec-keyb.txt |  72 
>>  drivers/input/keyboard/Kconfig |  12 +
>>  drivers/input/keyboard/Makefile|   1 +
>>  drivers/input/keyboard/cros_ec_keyb.c  | 394 
>> +
>>  4 files changed, 479 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/input/cros-ec-keyb.txt
>>  create mode 100644 drivers/input/keyboard/cros_ec_keyb.c
>>
>> diff --git a/Documentation/devicetree/bindings/input/cros-ec-keyb.txt 
>> b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
>> new file mode 100644
>> index 000..0f6355c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
>> @@ -0,0 +1,72 @@
>> +ChromeOS EC Keyboard
>> +
>> +Google's ChromeOS EC Keyboard is a simple matrix keyboard implemented on
>> +a separate EC (Embedded Controller) device. It provides a message for 
>> reading
>> +key scans from the EC. These are then converted into keycodes for processing
>> +by the kernel.
>> +
>> +This binding is based on matrix-keymap.txt and extends/modifies it as 
>> follows:
>> +
>> +Required properties:
>> +- compatible: "google,cros-ec-keyb"
>> +
>> +Optional properties:
>> +- google,needs-ghost-filter: True to enable a ghost filter for the matrix
>> +keyboard. This is recommended if the EC does not have its own logic or
>> +hardware for this.
>> +
>> +
>> +Example:
>> +
>> +cros-ec-keyb {
>> + compatible = "google,cros-ec-keyb";
>> + keypad,num-rows = <8>;
>> + keypad,num-columns = <13>;
>> + google,needs-ghost-filter;
>> + /*
>> +  * Keymap entries take the form of 0xRRCC where
>> +  * RR=Row CC=Column =Key Code
>> +  * The values below are for a US keyboard layout and
>> +  * are taken from the Linux driver. Note that the
>> +  * 102ND key is not used for US keyboards.
>> +  */
>> + linux,keymap = <
>> + /* CAPSLCK F1 B  F10 */
>> + 0x0001003a 0x0002003b 0x00030030 0x00040044
>> + /* N   =  R_ALT  ESC */
>> + 0x00060031 0x0008000d 0x000a0064 0x01010001
>> + /* F4  G  F7 H   */
>> + 0x0102003e 0x01030022 0x01040041 0x01060023
>> + /* '   F9 BKSPACEL_CTRL  */
>> + 0x01080028 0x01090043 0x010b000e 0x021d
>> + /* TAB F3 T  F6  */
>> + 0x0201000f 0x0202003d 0x02030014 0x02040040
>> + /* ]   Y  102ND  [   */
>> + 0x0205001b 0x02060015 0x02070056 0x0208001a
>> + /* F8  GRAVE  F2 5   */
>> + 0x02090042 0x03010029 0x0302003c 0x03030006
>> + /* F5  6  -  \   */
>> + 0x0304003f 0x03060007 0x0308000c 0x030b002b
>> + /* R_CTRL  A  D  F   */
>> + 0x0461 0x0401001e 0x04020020 0x04030021
>> + /* S   K  J  ;   */
>> + 0x0404001f 0x04050025 0x04060024 0x04080027
>> + /* L   ENTER  Z  C   */
>> + 0x04090026 0x040b001c 0x0501002c 0x0502002e
>> + /* V   X  ,  M   */
>> + 0x0503002f 0x0504002d 0x05050033 0x05060032
>> + /* L_SHIFT /  .  SPACE   */
>> + 0x0507002a 0x05080035 0x05090034 0x050B0039
>> + /* 1   3  4  2   */
>> + 0x06010002 0x06020004 0x06030005 0x06040003
>> + /* 8   7  0  9   */
>> + 0x06050009 0x06060008 0x0608000b 0x0609000a
>> + /* L_ALT   DOWN   RIGHT  Q   */
>> + 0x060a0038 0x060b006c 0x060c006a 0x07010010
>> + /* E   R  W  I   */
>> + 0x07020012 0x07030013 0x07040011 0x07050017
>> + /* U   R_SHIFTP  O   */
>> + 0x07060016 0x07070036 0x07080019 0x07090018
>> + /* UP  

Re: [PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-13 Thread Dmitry Torokhov
Hi SImon,

On Tue, Feb 12, 2013 at 06:42:26PM -0800, Simon Glass wrote:
> Use the key-matrix layer to interpret key scan information from the EC
> and inject input based on the FDT-supplied key map. This driver registers
> itself with the ChromeOS EC driver to perform communications.
> 
> Additional FDT bindings are provided to specify rows/columns and the
> auto-repeat information.
> 
> Signed-off-by: Simon Glass 
> Signed-off-by: Luigi Semenzato 
> Signed-off-by: Vincent Palatin 
> ---
> Changes in v2:
> - Remove use of __devinit/__devexit
> - Use function to read matrix-keypad parameters from DT
> - Remove key autorepeat parameters from DT binding and driver
> - Use unsigned int for rows/cols
> 
>  .../devicetree/bindings/input/cros-ec-keyb.txt |  72 
>  drivers/input/keyboard/Kconfig |  12 +
>  drivers/input/keyboard/Makefile|   1 +
>  drivers/input/keyboard/cros_ec_keyb.c  | 394 
> +
>  4 files changed, 479 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/cros-ec-keyb.txt
>  create mode 100644 drivers/input/keyboard/cros_ec_keyb.c
> 
> diff --git a/Documentation/devicetree/bindings/input/cros-ec-keyb.txt 
> b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
> new file mode 100644
> index 000..0f6355c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
> @@ -0,0 +1,72 @@
> +ChromeOS EC Keyboard
> +
> +Google's ChromeOS EC Keyboard is a simple matrix keyboard implemented on
> +a separate EC (Embedded Controller) device. It provides a message for reading
> +key scans from the EC. These are then converted into keycodes for processing
> +by the kernel.
> +
> +This binding is based on matrix-keymap.txt and extends/modifies it as 
> follows:
> +
> +Required properties:
> +- compatible: "google,cros-ec-keyb"
> +
> +Optional properties:
> +- google,needs-ghost-filter: True to enable a ghost filter for the matrix
> +keyboard. This is recommended if the EC does not have its own logic or
> +hardware for this.
> +
> +
> +Example:
> +
> +cros-ec-keyb {
> + compatible = "google,cros-ec-keyb";
> + keypad,num-rows = <8>;
> + keypad,num-columns = <13>;
> + google,needs-ghost-filter;
> + /*
> +  * Keymap entries take the form of 0xRRCC where
> +  * RR=Row CC=Column =Key Code
> +  * The values below are for a US keyboard layout and
> +  * are taken from the Linux driver. Note that the
> +  * 102ND key is not used for US keyboards.
> +  */
> + linux,keymap = <
> + /* CAPSLCK F1 B  F10 */
> + 0x0001003a 0x0002003b 0x00030030 0x00040044
> + /* N   =  R_ALT  ESC */
> + 0x00060031 0x0008000d 0x000a0064 0x01010001
> + /* F4  G  F7 H   */
> + 0x0102003e 0x01030022 0x01040041 0x01060023
> + /* '   F9 BKSPACEL_CTRL  */
> + 0x01080028 0x01090043 0x010b000e 0x021d
> + /* TAB F3 T  F6  */
> + 0x0201000f 0x0202003d 0x02030014 0x02040040
> + /* ]   Y  102ND  [   */
> + 0x0205001b 0x02060015 0x02070056 0x0208001a
> + /* F8  GRAVE  F2 5   */
> + 0x02090042 0x03010029 0x0302003c 0x03030006
> + /* F5  6  -  \   */
> + 0x0304003f 0x03060007 0x0308000c 0x030b002b
> + /* R_CTRL  A  D  F   */
> + 0x0461 0x0401001e 0x04020020 0x04030021
> + /* S   K  J  ;   */
> + 0x0404001f 0x04050025 0x04060024 0x04080027
> + /* L   ENTER  Z  C   */
> + 0x04090026 0x040b001c 0x0501002c 0x0502002e
> + /* V   X  ,  M   */
> + 0x0503002f 0x0504002d 0x05050033 0x05060032
> + /* L_SHIFT /  .  SPACE   */
> + 0x0507002a 0x05080035 0x05090034 0x050B0039
> + /* 1   3  4  2   */
> + 0x06010002 0x06020004 0x06030005 0x06040003
> + /* 8   7  0  9   */
> + 0x06050009 0x06060008 0x0608000b 0x0609000a
> + /* L_ALT   DOWN   RIGHT  Q   */
> + 0x060a0038 0x060b006c 0x060c006a 0x07010010
> + /* E   R  W  I   */
> + 0x07020012 0x07030013 0x07040011 0x07050017
> + /* U   R_SHIFTP  O   */
> + 0x07060016 0x07070036 0x07080019 0x07090018
> + /* UP  LEFT*/
> + 0x070b0067 0x070c0069>;
> +};
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 078305e..3a70be7 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ 

Re: [PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-13 Thread Dmitry Torokhov
Hi SImon,

On Tue, Feb 12, 2013 at 06:42:26PM -0800, Simon Glass wrote:
 Use the key-matrix layer to interpret key scan information from the EC
 and inject input based on the FDT-supplied key map. This driver registers
 itself with the ChromeOS EC driver to perform communications.
 
 Additional FDT bindings are provided to specify rows/columns and the
 auto-repeat information.
 
 Signed-off-by: Simon Glass s...@chromium.org
 Signed-off-by: Luigi Semenzato semenz...@chromium.org
 Signed-off-by: Vincent Palatin vpala...@chromium.org
 ---
 Changes in v2:
 - Remove use of __devinit/__devexit
 - Use function to read matrix-keypad parameters from DT
 - Remove key autorepeat parameters from DT binding and driver
 - Use unsigned int for rows/cols
 
  .../devicetree/bindings/input/cros-ec-keyb.txt |  72 
  drivers/input/keyboard/Kconfig |  12 +
  drivers/input/keyboard/Makefile|   1 +
  drivers/input/keyboard/cros_ec_keyb.c  | 394 
 +
  4 files changed, 479 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/input/cros-ec-keyb.txt
  create mode 100644 drivers/input/keyboard/cros_ec_keyb.c
 
 diff --git a/Documentation/devicetree/bindings/input/cros-ec-keyb.txt 
 b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
 new file mode 100644
 index 000..0f6355c
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
 @@ -0,0 +1,72 @@
 +ChromeOS EC Keyboard
 +
 +Google's ChromeOS EC Keyboard is a simple matrix keyboard implemented on
 +a separate EC (Embedded Controller) device. It provides a message for reading
 +key scans from the EC. These are then converted into keycodes for processing
 +by the kernel.
 +
 +This binding is based on matrix-keymap.txt and extends/modifies it as 
 follows:
 +
 +Required properties:
 +- compatible: google,cros-ec-keyb
 +
 +Optional properties:
 +- google,needs-ghost-filter: True to enable a ghost filter for the matrix
 +keyboard. This is recommended if the EC does not have its own logic or
 +hardware for this.
 +
 +
 +Example:
 +
 +cros-ec-keyb {
 + compatible = google,cros-ec-keyb;
 + keypad,num-rows = 8;
 + keypad,num-columns = 13;
 + google,needs-ghost-filter;
 + /*
 +  * Keymap entries take the form of 0xRRCC where
 +  * RR=Row CC=Column =Key Code
 +  * The values below are for a US keyboard layout and
 +  * are taken from the Linux driver. Note that the
 +  * 102ND key is not used for US keyboards.
 +  */
 + linux,keymap = 
 + /* CAPSLCK F1 B  F10 */
 + 0x0001003a 0x0002003b 0x00030030 0x00040044
 + /* N   =  R_ALT  ESC */
 + 0x00060031 0x0008000d 0x000a0064 0x01010001
 + /* F4  G  F7 H   */
 + 0x0102003e 0x01030022 0x01040041 0x01060023
 + /* '   F9 BKSPACEL_CTRL  */
 + 0x01080028 0x01090043 0x010b000e 0x021d
 + /* TAB F3 T  F6  */
 + 0x0201000f 0x0202003d 0x02030014 0x02040040
 + /* ]   Y  102ND  [   */
 + 0x0205001b 0x02060015 0x02070056 0x0208001a
 + /* F8  GRAVE  F2 5   */
 + 0x02090042 0x03010029 0x0302003c 0x03030006
 + /* F5  6  -  \   */
 + 0x0304003f 0x03060007 0x0308000c 0x030b002b
 + /* R_CTRL  A  D  F   */
 + 0x0461 0x0401001e 0x04020020 0x04030021
 + /* S   K  J  ;   */
 + 0x0404001f 0x04050025 0x04060024 0x04080027
 + /* L   ENTER  Z  C   */
 + 0x04090026 0x040b001c 0x0501002c 0x0502002e
 + /* V   X  ,  M   */
 + 0x0503002f 0x0504002d 0x05050033 0x05060032
 + /* L_SHIFT /  .  SPACE   */
 + 0x0507002a 0x05080035 0x05090034 0x050B0039
 + /* 1   3  4  2   */
 + 0x06010002 0x06020004 0x06030005 0x06040003
 + /* 8   7  0  9   */
 + 0x06050009 0x06060008 0x0608000b 0x0609000a
 + /* L_ALT   DOWN   RIGHT  Q   */
 + 0x060a0038 0x060b006c 0x060c006a 0x07010010
 + /* E   R  W  I   */
 + 0x07020012 0x07030013 0x07040011 0x07050017
 + /* U   R_SHIFTP  O   */
 + 0x07060016 0x07070036 0x07080019 0x07090018
 + /* UP  LEFT*/
 + 0x070b0067 0x070c0069;
 +};
 diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
 index 078305e..3a70be7 100644
 --- a/drivers/input/keyboard/Kconfig
 +++ b/drivers/input/keyboard/Kconfig
 @@ -628,4 +628,16 @@ config 

Re: [PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-13 Thread Simon Glass
Hi Dmitry,

On Wed, Feb 13, 2013 at 12:02 PM, Dmitry Torokhov
dmitry.torok...@gmail.com wrote:
 Hi SImon,

 On Tue, Feb 12, 2013 at 06:42:26PM -0800, Simon Glass wrote:
 Use the key-matrix layer to interpret key scan information from the EC
 and inject input based on the FDT-supplied key map. This driver registers
 itself with the ChromeOS EC driver to perform communications.

 Additional FDT bindings are provided to specify rows/columns and the
 auto-repeat information.

 Signed-off-by: Simon Glass s...@chromium.org
 Signed-off-by: Luigi Semenzato semenz...@chromium.org
 Signed-off-by: Vincent Palatin vpala...@chromium.org
 ---
 Changes in v2:
 - Remove use of __devinit/__devexit
 - Use function to read matrix-keypad parameters from DT
 - Remove key autorepeat parameters from DT binding and driver
 - Use unsigned int for rows/cols

Thanks for all the review comments.


  .../devicetree/bindings/input/cros-ec-keyb.txt |  72 
  drivers/input/keyboard/Kconfig |  12 +
  drivers/input/keyboard/Makefile|   1 +
  drivers/input/keyboard/cros_ec_keyb.c  | 394 
 +
  4 files changed, 479 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/input/cros-ec-keyb.txt
  create mode 100644 drivers/input/keyboard/cros_ec_keyb.c

 diff --git a/Documentation/devicetree/bindings/input/cros-ec-keyb.txt 
 b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
 new file mode 100644
 index 000..0f6355c
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
 @@ -0,0 +1,72 @@
 +ChromeOS EC Keyboard
 +
 +Google's ChromeOS EC Keyboard is a simple matrix keyboard implemented on
 +a separate EC (Embedded Controller) device. It provides a message for 
 reading
 +key scans from the EC. These are then converted into keycodes for processing
 +by the kernel.
 +
 +This binding is based on matrix-keymap.txt and extends/modifies it as 
 follows:
 +
 +Required properties:
 +- compatible: google,cros-ec-keyb
 +
 +Optional properties:
 +- google,needs-ghost-filter: True to enable a ghost filter for the matrix
 +keyboard. This is recommended if the EC does not have its own logic or
 +hardware for this.
 +
 +
 +Example:
 +
 +cros-ec-keyb {
 + compatible = google,cros-ec-keyb;
 + keypad,num-rows = 8;
 + keypad,num-columns = 13;
 + google,needs-ghost-filter;
 + /*
 +  * Keymap entries take the form of 0xRRCC where
 +  * RR=Row CC=Column =Key Code
 +  * The values below are for a US keyboard layout and
 +  * are taken from the Linux driver. Note that the
 +  * 102ND key is not used for US keyboards.
 +  */
 + linux,keymap = 
 + /* CAPSLCK F1 B  F10 */
 + 0x0001003a 0x0002003b 0x00030030 0x00040044
 + /* N   =  R_ALT  ESC */
 + 0x00060031 0x0008000d 0x000a0064 0x01010001
 + /* F4  G  F7 H   */
 + 0x0102003e 0x01030022 0x01040041 0x01060023
 + /* '   F9 BKSPACEL_CTRL  */
 + 0x01080028 0x01090043 0x010b000e 0x021d
 + /* TAB F3 T  F6  */
 + 0x0201000f 0x0202003d 0x02030014 0x02040040
 + /* ]   Y  102ND  [   */
 + 0x0205001b 0x02060015 0x02070056 0x0208001a
 + /* F8  GRAVE  F2 5   */
 + 0x02090042 0x03010029 0x0302003c 0x03030006
 + /* F5  6  -  \   */
 + 0x0304003f 0x03060007 0x0308000c 0x030b002b
 + /* R_CTRL  A  D  F   */
 + 0x0461 0x0401001e 0x04020020 0x04030021
 + /* S   K  J  ;   */
 + 0x0404001f 0x04050025 0x04060024 0x04080027
 + /* L   ENTER  Z  C   */
 + 0x04090026 0x040b001c 0x0501002c 0x0502002e
 + /* V   X  ,  M   */
 + 0x0503002f 0x0504002d 0x05050033 0x05060032
 + /* L_SHIFT /  .  SPACE   */
 + 0x0507002a 0x05080035 0x05090034 0x050B0039
 + /* 1   3  4  2   */
 + 0x06010002 0x06020004 0x06030005 0x06040003
 + /* 8   7  0  9   */
 + 0x06050009 0x06060008 0x0608000b 0x0609000a
 + /* L_ALT   DOWN   RIGHT  Q   */
 + 0x060a0038 0x060b006c 0x060c006a 0x07010010
 + /* E   R  W  I   */
 + 0x07020012 0x07030013 0x07040011 0x07050017
 + /* U   R_SHIFTP  O   */
 + 0x07060016 0x07070036 0x07080019 0x07090018
 + /* UP  LEFT*/
 + 0x070b0067 0x070c0069;
 +};
 diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
 index 

[PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-12 Thread Simon Glass
Use the key-matrix layer to interpret key scan information from the EC
and inject input based on the FDT-supplied key map. This driver registers
itself with the ChromeOS EC driver to perform communications.

Additional FDT bindings are provided to specify rows/columns and the
auto-repeat information.

Signed-off-by: Simon Glass 
Signed-off-by: Luigi Semenzato 
Signed-off-by: Vincent Palatin 
---
Changes in v2:
- Remove use of __devinit/__devexit
- Use function to read matrix-keypad parameters from DT
- Remove key autorepeat parameters from DT binding and driver
- Use unsigned int for rows/cols

 .../devicetree/bindings/input/cros-ec-keyb.txt |  72 
 drivers/input/keyboard/Kconfig |  12 +
 drivers/input/keyboard/Makefile|   1 +
 drivers/input/keyboard/cros_ec_keyb.c  | 394 +
 4 files changed, 479 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/cros-ec-keyb.txt
 create mode 100644 drivers/input/keyboard/cros_ec_keyb.c

diff --git a/Documentation/devicetree/bindings/input/cros-ec-keyb.txt 
b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
new file mode 100644
index 000..0f6355c
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
@@ -0,0 +1,72 @@
+ChromeOS EC Keyboard
+
+Google's ChromeOS EC Keyboard is a simple matrix keyboard implemented on
+a separate EC (Embedded Controller) device. It provides a message for reading
+key scans from the EC. These are then converted into keycodes for processing
+by the kernel.
+
+This binding is based on matrix-keymap.txt and extends/modifies it as follows:
+
+Required properties:
+- compatible: "google,cros-ec-keyb"
+
+Optional properties:
+- google,needs-ghost-filter: True to enable a ghost filter for the matrix
+keyboard. This is recommended if the EC does not have its own logic or
+hardware for this.
+
+
+Example:
+
+cros-ec-keyb {
+   compatible = "google,cros-ec-keyb";
+   keypad,num-rows = <8>;
+   keypad,num-columns = <13>;
+   google,needs-ghost-filter;
+   /*
+* Keymap entries take the form of 0xRRCC where
+* RR=Row CC=Column =Key Code
+* The values below are for a US keyboard layout and
+* are taken from the Linux driver. Note that the
+* 102ND key is not used for US keyboards.
+*/
+   linux,keymap = <
+   /* CAPSLCK F1 B  F10 */
+   0x0001003a 0x0002003b 0x00030030 0x00040044
+   /* N   =  R_ALT  ESC */
+   0x00060031 0x0008000d 0x000a0064 0x01010001
+   /* F4  G  F7 H   */
+   0x0102003e 0x01030022 0x01040041 0x01060023
+   /* '   F9 BKSPACEL_CTRL  */
+   0x01080028 0x01090043 0x010b000e 0x021d
+   /* TAB F3 T  F6  */
+   0x0201000f 0x0202003d 0x02030014 0x02040040
+   /* ]   Y  102ND  [   */
+   0x0205001b 0x02060015 0x02070056 0x0208001a
+   /* F8  GRAVE  F2 5   */
+   0x02090042 0x03010029 0x0302003c 0x03030006
+   /* F5  6  -  \   */
+   0x0304003f 0x03060007 0x0308000c 0x030b002b
+   /* R_CTRL  A  D  F   */
+   0x0461 0x0401001e 0x04020020 0x04030021
+   /* S   K  J  ;   */
+   0x0404001f 0x04050025 0x04060024 0x04080027
+   /* L   ENTER  Z  C   */
+   0x04090026 0x040b001c 0x0501002c 0x0502002e
+   /* V   X  ,  M   */
+   0x0503002f 0x0504002d 0x05050033 0x05060032
+   /* L_SHIFT /  .  SPACE   */
+   0x0507002a 0x05080035 0x05090034 0x050B0039
+   /* 1   3  4  2   */
+   0x06010002 0x06020004 0x06030005 0x06040003
+   /* 8   7  0  9   */
+   0x06050009 0x06060008 0x0608000b 0x0609000a
+   /* L_ALT   DOWN   RIGHT  Q   */
+   0x060a0038 0x060b006c 0x060c006a 0x07010010
+   /* E   R  W  I   */
+   0x07020012 0x07030013 0x07040011 0x07050017
+   /* U   R_SHIFTP  O   */
+   0x07060016 0x07070036 0x07080019 0x07090018
+   /* UP  LEFT*/
+   0x070b0067 0x070c0069>;
+};
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 078305e..3a70be7 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -628,4 +628,16 @@ config KEYBOARD_W90P910
  To compile this driver as a module, choose M here: the
  module will be called w90p910_keypad.
 
+config 

[PATCH v2 6/6] Input: Add ChromeOS EC keyboard driver

2013-02-12 Thread Simon Glass
Use the key-matrix layer to interpret key scan information from the EC
and inject input based on the FDT-supplied key map. This driver registers
itself with the ChromeOS EC driver to perform communications.

Additional FDT bindings are provided to specify rows/columns and the
auto-repeat information.

Signed-off-by: Simon Glass s...@chromium.org
Signed-off-by: Luigi Semenzato semenz...@chromium.org
Signed-off-by: Vincent Palatin vpala...@chromium.org
---
Changes in v2:
- Remove use of __devinit/__devexit
- Use function to read matrix-keypad parameters from DT
- Remove key autorepeat parameters from DT binding and driver
- Use unsigned int for rows/cols

 .../devicetree/bindings/input/cros-ec-keyb.txt |  72 
 drivers/input/keyboard/Kconfig |  12 +
 drivers/input/keyboard/Makefile|   1 +
 drivers/input/keyboard/cros_ec_keyb.c  | 394 +
 4 files changed, 479 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/cros-ec-keyb.txt
 create mode 100644 drivers/input/keyboard/cros_ec_keyb.c

diff --git a/Documentation/devicetree/bindings/input/cros-ec-keyb.txt 
b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
new file mode 100644
index 000..0f6355c
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
@@ -0,0 +1,72 @@
+ChromeOS EC Keyboard
+
+Google's ChromeOS EC Keyboard is a simple matrix keyboard implemented on
+a separate EC (Embedded Controller) device. It provides a message for reading
+key scans from the EC. These are then converted into keycodes for processing
+by the kernel.
+
+This binding is based on matrix-keymap.txt and extends/modifies it as follows:
+
+Required properties:
+- compatible: google,cros-ec-keyb
+
+Optional properties:
+- google,needs-ghost-filter: True to enable a ghost filter for the matrix
+keyboard. This is recommended if the EC does not have its own logic or
+hardware for this.
+
+
+Example:
+
+cros-ec-keyb {
+   compatible = google,cros-ec-keyb;
+   keypad,num-rows = 8;
+   keypad,num-columns = 13;
+   google,needs-ghost-filter;
+   /*
+* Keymap entries take the form of 0xRRCC where
+* RR=Row CC=Column =Key Code
+* The values below are for a US keyboard layout and
+* are taken from the Linux driver. Note that the
+* 102ND key is not used for US keyboards.
+*/
+   linux,keymap = 
+   /* CAPSLCK F1 B  F10 */
+   0x0001003a 0x0002003b 0x00030030 0x00040044
+   /* N   =  R_ALT  ESC */
+   0x00060031 0x0008000d 0x000a0064 0x01010001
+   /* F4  G  F7 H   */
+   0x0102003e 0x01030022 0x01040041 0x01060023
+   /* '   F9 BKSPACEL_CTRL  */
+   0x01080028 0x01090043 0x010b000e 0x021d
+   /* TAB F3 T  F6  */
+   0x0201000f 0x0202003d 0x02030014 0x02040040
+   /* ]   Y  102ND  [   */
+   0x0205001b 0x02060015 0x02070056 0x0208001a
+   /* F8  GRAVE  F2 5   */
+   0x02090042 0x03010029 0x0302003c 0x03030006
+   /* F5  6  -  \   */
+   0x0304003f 0x03060007 0x0308000c 0x030b002b
+   /* R_CTRL  A  D  F   */
+   0x0461 0x0401001e 0x04020020 0x04030021
+   /* S   K  J  ;   */
+   0x0404001f 0x04050025 0x04060024 0x04080027
+   /* L   ENTER  Z  C   */
+   0x04090026 0x040b001c 0x0501002c 0x0502002e
+   /* V   X  ,  M   */
+   0x0503002f 0x0504002d 0x05050033 0x05060032
+   /* L_SHIFT /  .  SPACE   */
+   0x0507002a 0x05080035 0x05090034 0x050B0039
+   /* 1   3  4  2   */
+   0x06010002 0x06020004 0x06030005 0x06040003
+   /* 8   7  0  9   */
+   0x06050009 0x06060008 0x0608000b 0x0609000a
+   /* L_ALT   DOWN   RIGHT  Q   */
+   0x060a0038 0x060b006c 0x060c006a 0x07010010
+   /* E   R  W  I   */
+   0x07020012 0x07030013 0x07040011 0x07050017
+   /* U   R_SHIFTP  O   */
+   0x07060016 0x07070036 0x07080019 0x07090018
+   /* UP  LEFT*/
+   0x070b0067 0x070c0069;
+};
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 078305e..3a70be7 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -628,4 +628,16 @@ config KEYBOARD_W90P910
  To compile this driver as a module, choose M here: the