Re: [PATCH 1/4] ARM:dts:sun7i: Add keypad clk node

2015-09-15 Thread Maxime Ripard
On Wed, Sep 16, 2015 at 12:05:54AM +1000, yassinjaf...@gmail.com wrote:
> From: Yassin Jaffer 
> 
> This patch add support to the keypad clock on sun7i
> 
> Signed-off-by: Yassin Jaffer 

Applied, thanks!

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH RESEND v2] HID: Add new Microsoft Type Cover 3 product ID

2015-09-15 Thread Bastien Nocera
On Tue, 2015-09-15 at 12:48 -0400, Donavan Lance wrote:

> Patch resent again since it got mangled again. I've tested emailing
> this one multiple times and so should be fine, but I'll refrain from
> sending out this patch again. Apologies for spamming the list with
> this
> patch.

Are you using Evolution to send the patches?

If so, once you've opened the draft mail with your patch, select the
whole body of the mail, and select "Preformatted" from the style drop
-down (the one left of the "left justify" formatting button in the
toolbar).

I've mangled a few patches with the new version of Evolution as well...

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RESEND v2] HID: Add new Microsoft Type Cover 3 product ID

2015-09-15 Thread Donavan Lance
On Tue, 2015-09-15 at 12:44 -0400, Donavan Lance wrote:
> Adds support for Microsoft Type Cover 3 with 0x07e2 product ID.
> 
> Signed-off-by: Donavan Lance 
> ---
>  drivers/hid/hid-core.c  | 2 ++
>  drivers/hid/hid-ids.h   | 1 +
>  drivers/hid/hid-microsoft.c | 2 ++
>  drivers/hid/usbhid/hid-quirks.c | 1 +
>  4 files changed, 6 insertions(+)
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 70a11ac..31ce45d 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -725,6 +725,7 @@ static void hid_scan_collection(struct hid_parser
> *parser, unsigned type)
>  
>   if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
>   (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 ||
> +  hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2 ||
>hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP ||
>hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
>hid->product == USB_DEVICE_ID_MS_POWER_COVER) &&
> @@ -1928,6 +1929,7 @@ static const struct hid_device_id
> hid_have_special_driver[] = {
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_OFFICE_KB) },
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3) },
> + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2) },
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) },
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_3) },
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_POWER_COVER) },
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index f769208..01bb2fa 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -679,6 +679,7 @@
>  #define USB_DEVICE_ID_MS_TOUCH_COVER_2   0x07a7
>  #define USB_DEVICE_ID_MS_TYPE_COVER_20x07a9
>  #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_30x07dc
> +#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2  0x07e2
>  #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd
>  #define USB_DEVICE_ID_MS_TYPE_COVER_30x07de
>  #define USB_DEVICE_ID_MS_POWER_COVER 0x07da
> diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid
> -microsoft.c
> index 9aa3515..77a2cf3 100644
> --- a/drivers/hid/hid-microsoft.c
> +++ b/drivers/hid/hid-microsoft.c
> @@ -278,6 +278,8 @@ static const struct hid_device_id ms_devices[] =
> {
>   .driver_data = MS_DUPLICATE_USAGES },
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3),
>   .driver_data = MS_HIDINPUT },
> + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2),
> + .driver_data = MS_HIDINPUT },
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP),
>   .driver_data = MS_HIDINPUT },
>   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_3),
> diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid
> -quirks.c
> index 1dff8f0..5ef80c8 100644
> --- a/drivers/hid/usbhid/hid-quirks.c
> +++ b/drivers/hid/usbhid/hid-quirks.c
> @@ -91,6 +91,7 @@ static const struct hid_blacklist {
>   { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2,
> HID_QUIRK_NO_INIT_REPORTS },
>   { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2,
> HID_QUIRK_NO_INIT_REPORTS },
>   { USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3, HID_QUIRK_NO_INIT_REPORTS },
> + { USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2, HID_QUIRK_NO_INIT_REPORTS },
>   { USB_VENDOR_ID_MICROSOFT,
> USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP, HID_QUIRK_NO_INIT_REPORTS },
>   { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3,
> HID_QUIRK_NO_INIT_REPORTS },
>   { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER,
> HID_QUIRK_NO_INIT_REPORTS },

Patch resent again since it got mangled again. I've tested emailing
this one multiple times and so should be fine, but I'll refrain from
sending out this patch again. Apologies for spamming the list with this
patch.

Donavan Lance
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v2] HID: Add new Microsoft Type Cover 3 product ID

2015-09-15 Thread Donavan Lance
Adds support for Microsoft Type Cover 3 with 0x07e2 product ID.

Signed-off-by: Donavan Lance 
---
 drivers/hid/hid-core.c  | 2 ++
 drivers/hid/hid-ids.h   | 1 +
 drivers/hid/hid-microsoft.c | 2 ++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 4 files changed, 6 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 70a11ac..31ce45d 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -725,6 +725,7 @@ static void hid_scan_collection(struct hid_parser *parser, 
unsigned type)
 
if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
(hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 ||
+hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2 ||
 hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP ||
 hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
 hid->product == USB_DEVICE_ID_MS_POWER_COVER) &&
@@ -1928,6 +1929,7 @@ static const struct hid_device_id 
hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_MS_TYPE_COVER_PRO_3) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_MS_TYPE_COVER_3) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) 
},
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index f769208..01bb2fa 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -679,6 +679,7 @@
 #define USB_DEVICE_ID_MS_TOUCH_COVER_2   0x07a7
 #define USB_DEVICE_ID_MS_TYPE_COVER_20x07a9
 #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_30x07dc
+#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2  0x07e2
 #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd
 #define USB_DEVICE_ID_MS_TYPE_COVER_30x07de
 #define USB_DEVICE_ID_MS_POWER_COVER 0x07da
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 9aa3515..77a2cf3 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -278,6 +278,8 @@ static const struct hid_device_id ms_devices[] = {
.driver_data = MS_DUPLICATE_USAGES },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_MS_TYPE_COVER_PRO_3),
.driver_data = MS_HIDINPUT },
+   { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2),
+   .driver_data = MS_HIDINPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP),
.driver_data = MS_HIDINPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, 
USB_DEVICE_ID_MS_TYPE_COVER_3),
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 1dff8f0..5ef80c8 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -91,6 +91,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2, 
HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2, 
HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3, 
HID_QUIRK_NO_INIT_REPORTS },
+   { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2, 
HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP, 
HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, 
HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, 
HID_QUIRK_NO_INIT_REPORTS },
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] input: touchscreen: ti_am335x_tsc: Fix HWPEN interrupt handling

2015-09-15 Thread Dave Gerlach
Remove write to REG_IRQCLR and REG_IRQWAKEUP in interrupt handler for
IRQENB_HW_PEN as the resume handler should and does clear REG_IRQWAKEUP.
IRQENB_HW_PEN bit is set in irqclr so that all interrupts get cleared
later so let IRQENB_HW_PEN be cleared by that.

Without this patch wakeup events from TSC_ADC do not work because pending
interrupts in TSC_ADC were causing HW_PEN interrupt, needed for wake from
suspend modes, to get disabled immediately by IRQ handler after being
enabled and preventing wake from happening.

Signed-off-by: Dave Gerlach 
---
 drivers/input/touchscreen/ti_am335x_tsc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c 
b/drivers/input/touchscreen/ti_am335x_tsc.c
index 191a1b8..a21a07c 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -273,8 +273,6 @@ static irqreturn_t titsc_irq(int irq, void *dev)
status = titsc_readl(ts_dev, REG_RAWIRQSTATUS);
if (status & IRQENB_HW_PEN) {
ts_dev->pen_down = true;
-   titsc_writel(ts_dev, REG_IRQWAKEUP, 0x00);
-   titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN);
irqclr |= IRQENB_HW_PEN;
}
 
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] ARM: dts: set up trigger type for edt-ft5x06 interrupts

2015-09-15 Thread Tony Lindgren
* Felipe Balbi  [150914 14:28]:
> On Sat, Sep 12, 2015 at 10:45:51AM -0700, Dmitry Torokhov wrote:
> > Now that the driver respects IRQ trigger settings from device tree, let's
> > fix them up in individual DTSes (note that the driver is still compatible
> > with older DTSes).
> > 
> > Signed-off-by: Dmitry Torokhov 
> > ---
> >  arch/arm/boot/dts/am437x-sk-evm.dts   | 2 +-
> >  arch/arm/boot/dts/imx28-tx28.dts  | 3 ++-
> >  arch/arm/boot/dts/imx53-tx53-x03x.dts | 3 ++-
> >  arch/arm/boot/dts/imx6qdl-tx6.dtsi| 3 ++-
> >  4 files changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts 
> > b/arch/arm/boot/dts/am437x-sk-evm.dts
> > index c17097d..d83fdcd 100644
> > --- a/arch/arm/boot/dts/am437x-sk-evm.dts
> > +++ b/arch/arm/boot/dts/am437x-sk-evm.dts
> > @@ -471,7 +471,7 @@
> >  
> > reg = <0x38>;
> > interrupt-parent = <&gpio0>;
> > -   interrupts = <31 0>;
> > +   interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
> 
> for AM437x SK:
> 
> Acked-by: Felipe Balbi 
> 
> Seems like there are no changes considering driver was always using
> IRQF_TRIGGER_FALLING.

Should not cause merge conflicts AFAIK:

Acked-by: Tony Lindgren 
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] devicetree: bindings:Allwinner sun4i keypad

2015-09-15 Thread Maxime Ripard
On Wed, Sep 16, 2015 at 12:05:57AM +1000, yassinjaf...@gmail.com wrote:
> From: Yassin Jaffer 
> 
> Signed-off-by: Yassin Jaffer 
> ---
>  .../devicetree/bindings/input/sun4i-keypad.txt | 56 
> ++
>  1 file changed, 56 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/sun4i-keypad.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/sun4i-keypad.txt 
> b/Documentation/devicetree/bindings/input/sun4i-keypad.txt
> new file mode 100644
> index 000..60ed0f2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/sun4i-keypad.txt
> @@ -0,0 +1,56 @@
> +Allwinner sun4i keypad
> +
> +
> +Required properties:
> + - compatible: "allwinner,sun4i-a10-keypad"
> + - reg: mmio address range of the chip
> + - interrupts: interrupt to which the chip is connected
> + - clocks : shall reference keypad controller clocks.
> + - clock-names : keypad controller internal clock names. Shall contain :
> +* "apb" : APB gating clock
> +* "keypad" : keypad controller clock
> +
> +Required Board Specific Properties:
> +- pinctrl-names: The definition can be found at
> +pinctrl/pinctrl-bindings.txt.
> +
> +- pinctrl-0: The definition can be found at
> +pinctrl/pinctrl-bindings.txt.
> +
> +- linux,keymap: The definition can be found at
> +bindings/input/matrix-keymap.txt.
> +
> +Optional properties:
> + - scan-cycle: device specific scan cycle
> + - debounce-cycle: device specific debounce cycle
> + - autorepeat: If specified device will autorepeat

Are those properties generic? I couldn't find them defined anywhere.

In which units are those properties?

> +
> +Example:
> +
> +#include 
> +
> + kp: kp@01c23000 {
> + compatible = "allwinner,sun4i-a10-keypad";
> + reg = <0x01c23000 0x400>;
> + interrupts = ;
> + clocks = <&apb0_gates 10>, <&keypad_clk>;
> + clock-names = "apb", "keypad";
> + pinctrl-names = "default";
> + pinctrl-0 = <&keypad_rows>, <&keypad_cols>;
> + linux,keymap = <0x0067  /* KEY_UP */
> + 0x0001006c  /* KEY_DOWN */
> + 0x00020072  /* KEY_VOLUMEDOWN */
> + 0x00030066  /* KEY_HOME */
> + 0x016a  /* KEY_RIGHT */
> + 0x01010069  /* KEY_LEFT */
> + 0x0102001c  /* KEY_ENTER */
> + 0x01030073  /* KEY_VOLUMEUP */
> + 0x0240  /* KEY_F6 */
> + 0x02010042  /* KEY_F8 */
> + 0x02020043  /* KEY_F9 */
> + 0x02030044  /* KEY_F10 */
> + 0x033b  /* KEY_F1 */
> + 0x0301003c  /* KEY_F2 */
> + 0x0302003d  /* KEY_F3 */
> + 0x03030074>;/* KEY_POWER */

You don't seem to use the header you just told us to include.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


RE: [PATCH v5 3/9] Input: goodix - reset device at init

2015-09-15 Thread Tirdea, Irina


> -Original Message-
> From: Aleksei Mamlin [mailto:mamli...@gmail.com]
> Sent: 15 September, 2015 12:48
> To: Tirdea, Irina
> Cc: Dmitry Torokhov; Bastien Nocera; linux-input@vger.kernel.org; Mark 
> Rutland; Purdila, Octavian; linux-ker...@vger.kernel.org;
> devicet...@vger.kernel.org
> Subject: Re: [PATCH v5 3/9] Input: goodix - reset device at init
> 
> On Mon,  7 Sep 2015 17:36:17 +0300
> Irina Tirdea  wrote:
> 
> > After power on, it is recommended that the driver resets the device.
> > The reset procedure timing is described in the datasheet and is used
> > at device init (before writing device configuration) and
> > for power management. It is a sequence of setting the interrupt
> > and reset pins high/low at specific timing intervals. This procedure
> > also includes setting the slave address to the one specified in the
> > ACPI/device tree.
> >
> > This is based on Goodix datasheets for GT911 and GT9271 and on Goodix
> > driver gt9xx.c for Android (publicly available in Android kernel
> > trees for various devices).
> >
> > For reset the driver needs to control the interrupt and
> > reset gpio pins (configured through ACPI/device tree). For devices
> > that do not have the gpio pins declared, the functionality depending
> > on these pins will not be available, but the device can still be used
> > with basic functionality.
> >
> > Signed-off-by: Octavian Purdila 
> > Signed-off-by: Irina Tirdea 
> > ---
> >  .../bindings/input/touchscreen/goodix.txt  |   5 +
> >  drivers/input/touchscreen/goodix.c | 136 
> > +
> >  2 files changed, 141 insertions(+)
> >

> > +/**
> > + * goodix_reset - Reset device during power on
> > + *
> > + * @ts: goodix_ts_data pointer
> > + */
> > +static int goodix_reset(struct goodix_ts_data *ts)
> > +{
> > +   int error;
> > +
> > +   /* begin select I2C slave addr */
> > +   error = gpiod_direction_output(ts->gpiod_rst, 0);
> > +   if (error)
> > +   return error;
> > +   msleep(20); /* T2: > 10ms */
> > +   /* HIGH: 0x28/0x29, LOW: 0xBA/0xBB */
> > +   error = gpiod_direction_output(ts->gpiod_int, ts->client->addr == 0x14);
> > +   if (error)
> > +   return error;
> > +   usleep_range(100, 2000);/* T3: > 100us */
> > +   error = gpiod_direction_output(ts->gpiod_rst, 1);
> > +   if (error)
> > +   return error;
> > +   usleep_range(6000, 1);  /* T4: > 5ms */
> > +   /* end select I2C slave addr */
> > +   error = gpiod_direction_input(ts->gpiod_rst);
> > +   if (error)
> > +   return error;
> > +   return goodix_int_sync(ts);
> > +}
> > +

> >  /**
> >   * goodix_read_config - Read the embedded configuration of the panel
> >   *
> > @@ -419,6 +542,19 @@ static int goodix_ts_probe(struct i2c_client *client,
> >
> > ts->cfg_len = goodix_get_cfg_len(id_info);
> >
> > +   error = goodix_get_gpio_config(ts, id);
> > +   if (error)
> > +   return error;
> > +
> > +   if (ts->gpiod_int && ts->gpiod_rst) {
> > +   /* reset the controller */
> > +   error = goodix_reset(ts);
> > +   if (error) {
> > +   dev_err(&client->dev, "Controller reset failed.\n");
> > +   return error;
> > +   }
> > +   }
> > +
> 
> On devices with devicetree, such as ARM tablets, we can set I2C address via 
> DT, so driver should reset controller and set right address.
> If we don't do this we get "I2C communication failure: -6".
>

This is exactly what this patch tries to do. The address set in ACPI or DT will 
be available
in ts->client->addr. The reset code checks for the address set by ACPI/DT and 
configures
the device to use that address.
 
> Also, most of touchscreen drivers tries to reset controllers before start 
> communicating, so we need do the same.

Good catch! goodix_reset should be called before goodix_i2c_test. I'll send a 
new version with this fix.

Thanks,
Irina

> 
> > goodix_read_config(ts);
> >
> > error = goodix_request_input_dev(ts, version_info, id_info);
> > --
> > 1.9.1
> >
> 
> 
> --
> Thanks and regards,
> Aleksei Mamlin
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 1/9] Input: goodix - sort includes alphabetically

2015-09-15 Thread Irina Tirdea
Signed-off-by: Irina Tirdea 
Acked-by: Bastien Nocera 
---
 drivers/input/touchscreen/goodix.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index e36162b..6ae28c5 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -14,18 +14,18 @@
  * Software Foundation; version 2 of the License.
  */
 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 
 struct goodix_ts_data {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 2/9] Input: goodix - use actual config length for each device type

2015-09-15 Thread Irina Tirdea
Each of the Goodix devices supported by this driver has a fixed size for
the configuration information registers. The size varies depending on the
device and is specified in the datasheet.

Use the proper configuration length as specified in the datasheet for
each device model, so we do not read more than the actual size of the
configuration registers.

Signed-off-by: Irina Tirdea 
Acked-by: Bastien Nocera 
---
 drivers/input/touchscreen/goodix.c | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index 6ae28c5..7be6eab 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -36,6 +36,7 @@ struct goodix_ts_data {
unsigned int max_touch_num;
unsigned int int_trigger_type;
bool rotated_screen;
+   int cfg_len;
 };
 
 #define GOODIX_MAX_HEIGHT  4096
@@ -45,6 +46,8 @@ struct goodix_ts_data {
 #define GOODIX_MAX_CONTACTS10
 
 #define GOODIX_CONFIG_MAX_LENGTH   240
+#define GOODIX_CONFIG_911_LENGTH   186
+#define GOODIX_CONFIG_967_LENGTH   228
 
 /* Register defines */
 #define GOODIX_READ_COOR_ADDR  0x814E
@@ -115,6 +118,23 @@ static int goodix_i2c_read(struct i2c_client *client,
return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0);
 }
 
+static int goodix_get_cfg_len(u16 id)
+{
+   switch (id) {
+   case 911:
+   case 9271:
+   case 9110:
+   case 927:
+   case 928:
+   return GOODIX_CONFIG_911_LENGTH;
+   case 912:
+   case 967:
+   return GOODIX_CONFIG_967_LENGTH;
+   default:
+   return GOODIX_CONFIG_MAX_LENGTH;
+   }
+}
+
 static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
 {
int touch_num;
@@ -230,8 +250,7 @@ static void goodix_read_config(struct goodix_ts_data *ts)
int error;
 
error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA,
-   config,
-   GOODIX_CONFIG_MAX_LENGTH);
+   config, ts->cfg_len);
if (error) {
dev_warn(&ts->client->dev,
 "Error reading config (%d), using defaults\n",
@@ -398,6 +417,8 @@ static int goodix_ts_probe(struct i2c_client *client,
return error;
}
 
+   ts->cfg_len = goodix_get_cfg_len(id_info);
+
goodix_read_config(ts);
 
error = goodix_request_input_dev(ts, version_info, id_info);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 3/9] Input: goodix - reset device at init

2015-09-15 Thread Irina Tirdea
After power on, it is recommended that the driver resets the device.
The reset procedure timing is described in the datasheet and is used
at device init (before writing device configuration) and
for power management. It is a sequence of setting the interrupt
and reset pins high/low at specific timing intervals. This procedure
also includes setting the slave address to the one specified in the
ACPI/device tree.

This is based on Goodix datasheets for GT911 and GT9271 and on Goodix
driver gt9xx.c for Android (publicly available in Android kernel
trees for various devices).

For reset the driver needs to control the interrupt and
reset gpio pins (configured through ACPI/device tree). For devices
that do not have the gpio pins declared, the functionality depending
on these pins will not be available, but the device can still be used
with basic functionality.

Signed-off-by: Octavian Purdila 
Signed-off-by: Irina Tirdea 
---
 .../bindings/input/touchscreen/goodix.txt  |   5 +
 drivers/input/touchscreen/goodix.c | 136 +
 2 files changed, 141 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt 
b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
index 8ba98ee..c0715f8 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -12,6 +12,8 @@ Required properties:
  - reg : I2C address of the chip. Should be 0x5d or 0x14
  - interrupt-parent: Interrupt controller to which the chip is connected
  - interrupts  : Interrupt to which the chip is connected
+ - gpios   : GPIOS the chip is connected to: first one is the
+ interrupt gpio and second one the reset gpio.
 
 Example:
 
@@ -23,6 +25,9 @@ Example:
reg = <0x5d>;
interrupt-parent = <&gpio>;
interrupts = <0 0>;
+
+   gpios = <&gpio1 0 0>, /* INT */
+   <&gpio1 1 0>; /* RST */
};
 
/* ... */
diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index 7be6eab..9c58583 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,8 @@ struct goodix_ts_data {
unsigned int int_trigger_type;
bool rotated_screen;
int cfg_len;
+   struct gpio_desc *gpiod_int;
+   struct gpio_desc *gpiod_rst;
 };
 
 #define GOODIX_MAX_HEIGHT  4096
@@ -89,6 +92,30 @@ static const struct dmi_system_id rotated_screen[] = {
{}
 };
 
+/*
+ * ACPI table specifies gpio pins in this order: first rst pin and
+ * then interrupt pin.
+ */
+static const struct dmi_system_id goodix_rst_pin_first[] = {
+#if defined(CONFIG_DMI) && defined(CONFIG_X86)
+   {
+   .ident = "WinBook TW100",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "TW100")
+   }
+   },
+   {
+   .ident = "WinBook TW700",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "TW700")
+   },
+   },
+#endif
+   {}
+};
+
 /**
  * goodix_i2c_read - read data from a register of the i2c slave device.
  *
@@ -237,6 +264,102 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void 
*dev_id)
return IRQ_HANDLED;
 }
 
+static int goodix_int_sync(struct goodix_ts_data *ts)
+{
+   int error;
+
+   error = gpiod_direction_output(ts->gpiod_int, 0);
+   if (error)
+   return error;
+   msleep(50); /* T5: 50ms */
+
+   return gpiod_direction_input(ts->gpiod_int);
+}
+
+/**
+ * goodix_reset - Reset device during power on
+ *
+ * @ts: goodix_ts_data pointer
+ */
+static int goodix_reset(struct goodix_ts_data *ts)
+{
+   int error;
+
+   /* begin select I2C slave addr */
+   error = gpiod_direction_output(ts->gpiod_rst, 0);
+   if (error)
+   return error;
+   msleep(20); /* T2: > 10ms */
+   /* HIGH: 0x28/0x29, LOW: 0xBA/0xBB */
+   error = gpiod_direction_output(ts->gpiod_int, ts->client->addr == 0x14);
+   if (error)
+   return error;
+   usleep_range(100, 2000);/* T3: > 100us */
+   error = gpiod_direction_output(ts->gpiod_rst, 1);
+   if (error)
+   return error;
+   usleep_range(6000, 1);  /* T4: > 5ms */
+   /* end select I2C slave addr */
+   error = gpiod_direction_input(ts->gpiod_rst);
+   if (error)
+   return error;
+   return goodix_int_sync(ts);
+}
+
+/

[PATCH v6 0/9] Goodix touchscreen enhancements

2015-09-15 Thread Irina Tirdea
Add several enhancements to the Goodix touchscreen driver.
This version includes a couple of fixes.

Thanks,
Irina

Changes in v6:
 - skip runtime power manangent calls in open/close if the device
ACPI/DT configuration does not declare interrupt and reset gpio pins.
 - reset the device before starting i2c communication
 - add Bastien's ack to the first 2 patches

Changes in v5:
 - add some more style cleanup (reorder includes, use error instead
of ret for return values)
 - add runtime power management patch

Changes in v4:
 - use dmi quirk to determine the order of irq and reset pins
 - use actual config length depending on device
 - add sysfs interface to dump config
 - initialize esd timeout from ACPI/DT propery

Changes in v3:
 - dropped the first 3 patches that got merged
 - handle -EPROBE_DEFER and -ENOENT for gpio pins
 - skip functionality depending on the gpio pins if the pins are not
properly initialized from ACPI/DT (reset, write config, power management,
ESD)
 - dropped #ifdef CONFIG_PM_SLEEP and annotated with __maybe_unused instead
 - use sysfs property to set ESD timeout instead of ACPI/DT property
 - use request_firmware_nowait to read configuration firmware and use defaults
if firmware is not found
 - use ACPI IDs to determine the order of the GPIO pins in the ACPI tables
(interrupt pin first or reset pin first)

Changes in v2:
 - use request_firmware instead of ACPI/DT property for config
 - dropped "input: goodix: add ACPI IDs for GT911 and GT9271" patch
 - add ACPI DSDT excerpt in commit message where necessary
 - add comments for suspend/resume sleep values
 - dropped the checkpatch fixes that did not make sense
 - added Bastien's ack to the first patch

Irina Tirdea (9):
  Input: goodix - sort includes alphabetically
  Input: goodix - use actual config length for each device type
  Input: goodix - reset device at init
  Input: goodix - write configuration data to device
  Input: goodix - add power management support
  Input: goodix - use goodix_i2c_write_u8 instead of i2c_master_send
  Input: goodix - add support for ESD
  Input: goodix - add sysfs interface to dump config
  Input: goodix - add runtime power management support

 .../bindings/input/touchscreen/goodix.txt  |  11 +
 drivers/input/touchscreen/goodix.c | 721 +++--
 2 files changed, 690 insertions(+), 42 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 4/9] Input: goodix - write configuration data to device

2015-09-15 Thread Irina Tirdea
Goodix devices can be configured by writing custom data to the device at
init. The configuration data is read with request_firmware from
"goodix__cfg.bin", where  is the product id read from the device
(e.g.: goodix_911_cfg.bin for Goodix GT911, goodix_9271_cfg.bin for
GT9271).

The configuration information has a specific format described in the Goodix
datasheet. It includes X/Y resolution, maximum supported touch points,
interrupt flags, various sesitivity factors and settings for advanced
features (like gesture recognition).

Before writing the firmware, it is necessary to reset the device. If
the device ACPI/DT information does not declare gpio pins (needed for
reset), writing the firmware will not be available for these devices.

This is based on Goodix datasheets for GT911 and GT9271 and on Goodix
driver gt9xx.c for Android (publicly available in Android kernel
trees for various devices).

Signed-off-by: Octavian Purdila 
Signed-off-by: Irina Tirdea 
---
 drivers/input/touchscreen/goodix.c | 225 -
 1 file changed, 194 insertions(+), 31 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index 9c58583..d6abd82 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,6 +41,9 @@ struct goodix_ts_data {
int cfg_len;
struct gpio_desc *gpiod_int;
struct gpio_desc *gpiod_rst;
+   u16 id;
+   u16 version;
+   char *cfg_name;
 };
 
 #define GOODIX_MAX_HEIGHT  4096
@@ -145,6 +149,39 @@ static int goodix_i2c_read(struct i2c_client *client,
return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0);
 }
 
+/**
+ * goodix_i2c_write - write data to a register of the i2c slave device.
+ *
+ * @client: i2c device.
+ * @reg: the register to write to.
+ * @buf: raw data buffer to write.
+ * @len: length of the buffer to write
+ */
+static int goodix_i2c_write(struct i2c_client *client, u16 reg, const u8 *buf,
+   unsigned len)
+{
+   u8 *addr_buf;
+   struct i2c_msg msg;
+   int ret;
+
+   addr_buf = kmalloc(len + 2, GFP_KERNEL);
+   if (!addr_buf)
+   return -ENOMEM;
+
+   addr_buf[0] = reg >> 8;
+   addr_buf[1] = reg & 0xFF;
+   memcpy(&addr_buf[2], buf, len);
+
+   msg.flags = 0;
+   msg.addr = client->addr;
+   msg.buf = addr_buf;
+   msg.len = len + 2;
+
+   ret = i2c_transfer(client->adapter, &msg, 1);
+   kfree(addr_buf);
+   return ret < 0 ? ret : (ret != 1 ? -EIO : 0);
+}
+
 static int goodix_get_cfg_len(u16 id)
 {
switch (id) {
@@ -264,6 +301,73 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void 
*dev_id)
return IRQ_HANDLED;
 }
 
+/**
+ * goodix_check_cfg - Checks if config fw is valid
+ *
+ * @ts: goodix_ts_data pointer
+ * @cfg: firmware config data
+ */
+static int goodix_check_cfg(struct goodix_ts_data *ts,
+   const struct firmware *cfg)
+{
+   int i, raw_cfg_len;
+   u8 check_sum = 0;
+
+   if (cfg->size > GOODIX_CONFIG_MAX_LENGTH) {
+   dev_err(&ts->client->dev,
+   "The length of the config fw is not correct");
+   return -EINVAL;
+   }
+
+   raw_cfg_len = cfg->size - 2;
+   for (i = 0; i < raw_cfg_len; i++)
+   check_sum += cfg->data[i];
+   check_sum = (~check_sum) + 1;
+   if (check_sum != cfg->data[raw_cfg_len]) {
+   dev_err(&ts->client->dev,
+   "The checksum of the config fw is not correct");
+   return -EINVAL;
+   }
+
+   if (cfg->data[raw_cfg_len + 1] != 1) {
+   dev_err(&ts->client->dev,
+   "Config fw must have Config_Fresh register set");
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+/**
+ * goodix_send_cfg - Write fw config to device
+ *
+ * @ts: goodix_ts_data pointer
+ * @cfg: config firmware to write to device
+ */
+static int goodix_send_cfg(struct goodix_ts_data *ts,
+  const struct firmware *cfg)
+{
+   int error;
+
+   error = goodix_check_cfg(ts, cfg);
+   if (error)
+   return error;
+
+   error = goodix_i2c_write(ts->client, GOODIX_REG_CONFIG_DATA, cfg->data,
+cfg->size);
+   if (error) {
+   dev_err(&ts->client->dev, "Failed to write config data: %d",
+   error);
+   return error;
+   }
+   dev_dbg(&ts->client->dev, "Config sent successfully.");
+
+   /* Let the firmware reconfigure itself, so sleep for 10ms */
+   usleep_range(1, 11000);
+
+   return 0;
+}
+
 static int goodix_int_sync(struct goodix_ts_data *ts)
 {
int error;
@@ -406,30 +510,29 @@ static void goodix_read_config(struct goodix_ts_data *ts)
 /**
  * g

[PATCH v6 7/9] Input: goodix - add support for ESD

2015-09-15 Thread Irina Tirdea
Add ESD (Electrostatic Discharge) protection mechanism.

The driver enables ESD protection in HW and checks a register
to determine if ESD occurred. If ESD is signalled by the HW,
the driver will reset the device.

The ESD poll time (in ms) can be set through the sysfs property
esd_timeout. If it is set to 0, ESD protection is disabled.
Recommended value is 2000 ms. The initial value for ESD timeout
can be set through esd-recovery-timeout-ms ACPI/DT property.
If there is no such property defined, ESD protection is disabled.
For ACPI 5.1, the property can be specified using _DSD properties:
 Device (STAC)
 {
 Name (_HID, "GDIX1001")
 ...

 Name (_DSD,  Package ()
 {
 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
 Package ()
 {
 Package (2) { "esd-recovery-timeout-ms", Package(1) { 2000 }},
 ...
 }
 })
 }

The ESD protection mechanism is only available if the gpio pins
are properly initialized from ACPI/DT.

This is based on Goodix datasheets for GT911 and GT9271 and on Goodix
driver gt9xx.c for Android (publicly available in Android kernel
trees for various devices).

Signed-off-by: Irina Tirdea 
---
 .../bindings/input/touchscreen/goodix.txt  |   6 +
 drivers/input/touchscreen/goodix.c | 174 -
 2 files changed, 173 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt 
b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
index c0715f8..5891ad1 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -14,6 +14,12 @@ Required properties:
  - interrupts  : Interrupt to which the chip is connected
  - gpios   : GPIOS the chip is connected to: first one is the
  interrupt gpio and second one the reset gpio.
+Optional properties:
+
+ - esd-recovery-timeout-ms : ESD poll time (in milli seconds) for the driver to
+check if ESD occurred and in that case reset the
+device. ESD is disabled if this property is not set
+or is set to 0.
 
 Example:
 
diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index ee87d38..a5dd1bd 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -45,8 +45,12 @@ struct goodix_ts_data {
u16 version;
char *cfg_name;
unsigned long irq_flags;
+   atomic_t esd_timeout;
+   struct delayed_work esd_work;
 };
 
+#define GOODIX_DEVICE_ESD_TIMEOUT_PROPERTY "esd-recovery-timeout-ms"
+
 #define GOODIX_MAX_HEIGHT  4096
 #define GOODIX_MAX_WIDTH   4096
 #define GOODIX_INT_TRIGGER 1
@@ -60,6 +64,8 @@ struct goodix_ts_data {
 /* Register defines */
 #define GOODIX_REG_COMMAND 0x8040
 #define GOODIX_CMD_SCREEN_OFF  0x05
+#define GOODIX_CMD_ESD_ENABLED 0xAA
+#define GOODIX_REG_ESD_CHECK   0x8041
 
 #define GOODIX_READ_COOR_ADDR  0x814E
 #define GOODIX_REG_CONFIG_DATA 0x8047
@@ -426,6 +432,117 @@ static int goodix_reset(struct goodix_ts_data *ts)
return goodix_int_sync(ts);
 }
 
+static void goodix_disable_esd(struct goodix_ts_data *ts)
+{
+   if (!atomic_read(&ts->esd_timeout))
+   return;
+   cancel_delayed_work_sync(&ts->esd_work);
+}
+
+static int goodix_enable_esd(struct goodix_ts_data *ts)
+{
+   int error, esd_timeout;
+
+   esd_timeout = atomic_read(&ts->esd_timeout);
+   if (!esd_timeout)
+   return 0;
+
+   error = goodix_i2c_write_u8(ts->client, GOODIX_REG_ESD_CHECK,
+   GOODIX_CMD_ESD_ENABLED);
+   if (error) {
+   dev_err(&ts->client->dev, "Failed to enable ESD: %d\n", error);
+   return error;
+   }
+
+   schedule_delayed_work(&ts->esd_work, round_jiffies_relative(
+ msecs_to_jiffies(esd_timeout)));
+   return 0;
+}
+
+static void goodix_esd_work(struct work_struct *work)
+{
+   struct goodix_ts_data *ts = container_of(work, struct goodix_ts_data,
+esd_work.work);
+   int retries = 3, error;
+   u8 esd_data[2];
+   const struct firmware *cfg = NULL;
+
+   while (--retries) {
+   error = goodix_i2c_read(ts->client, GOODIX_REG_COMMAND,
+   esd_data, sizeof(esd_data));
+   if (error)
+   continue;
+   if (esd_data[0] != GOODIX_CMD_ESD_ENABLED &&
+   esd_data[1] == GOODIX_CMD_ESD_ENABLED) {
+   /* feed the watchdog */
+   goodix_i2c_write_u8(ts->client,
+   GOODIX_REG_COMMAND,
+  

[PATCH v6 9/9] Input: goodix - add runtime power management support

2015-09-15 Thread Irina Tirdea
Add support for runtime power management so that the device is
turned off when not used (when the userspace holds no open
handles of the input device). The device uses autosuspend with a
default delay of 2 seconds, so the device will suspend if no
handles to it are open for 2 seconds.

The runtime management support is only available if the gpio pins
are properly initialized from ACPI/DT.

Signed-off-by: Irina Tirdea 
---
 drivers/input/touchscreen/goodix.c | 63 +++---
 1 file changed, 59 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index 641a9e3..a0b6067 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -75,6 +76,8 @@ struct goodix_ts_data {
 #define MAX_CONTACTS_LOC   5
 #define TRIGGER_LOC6
 
+#define GOODIX_AUTOSUSPEND_DELAY_MS2000
+
 static const unsigned long goodix_irq_flags[] = {
IRQ_TYPE_EDGE_RISING,
IRQ_TYPE_EDGE_FALLING,
@@ -566,6 +569,33 @@ static const struct attribute_group goodix_attr_group = {
.attrs = goodix_attrs,
 };
 
+static int goodix_open(struct input_dev *input_dev)
+{
+   struct goodix_ts_data *ts = input_get_drvdata(input_dev);
+   int error;
+
+   if (!ts->gpiod_int || !ts->gpiod_rst)
+   return 0;
+
+   error = pm_runtime_get_sync(&ts->client->dev);
+   if (error < 0) {
+   pm_runtime_put_noidle(&ts->client->dev);
+   return error;
+   }
+   return 0;
+}
+
+static void goodix_close(struct input_dev *input_dev)
+{
+   struct goodix_ts_data *ts = input_get_drvdata(input_dev);
+
+   if (!ts->gpiod_int || !ts->gpiod_rst)
+   return;
+
+   pm_runtime_mark_last_busy(&ts->client->dev);
+   pm_runtime_put_autosuspend(&ts->client->dev);
+}
+
 /**
  * goodix_get_gpio_config - Get GPIO config from ACPI/DT
  *
@@ -751,6 +781,9 @@ static int goodix_request_input_dev(struct goodix_ts_data 
*ts)
ts->input_dev->id.vendor = 0x0416;
ts->input_dev->id.product = ts->id;
ts->input_dev->id.version = ts->version;
+   ts->input_dev->open = goodix_open;
+   ts->input_dev->close = goodix_close;
+   input_set_drvdata(ts->input_dev, ts);
 
error = input_register_device(ts->input_dev);
if (error) {
@@ -798,7 +831,8 @@ static int goodix_configure_dev(struct goodix_ts_data *ts)
  * @ts: our goodix_ts_data pointer
  *
  * request_firmware_wait callback that finishes
- * initialization of the device.
+ * initialization of the device. This will only be called
+ * when ts->gpiod_int and ts->gpiod_rst are properly initialized.
  */
 static void goodix_config_cb(const struct firmware *cfg, void *ctx)
 {
@@ -811,7 +845,21 @@ static void goodix_config_cb(const struct firmware *cfg, 
void *ctx)
if (error)
goto err_release_cfg;
}
-   goodix_configure_dev(ts);
+   error = goodix_configure_dev(ts);
+   if (error)
+   goto err_release_cfg;
+
+   error = pm_runtime_set_active(&ts->client->dev);
+   if (error) {
+   dev_err(&ts->client->dev, "failed to set active: %d\n", error);
+   goto err_release_cfg;
+   }
+   /* input_dev is a child of client->dev, ignore it for runtime pm */
+   pm_suspend_ignore_children(&ts->client->dev, true);
+   pm_runtime_enable(&ts->client->dev);
+   pm_runtime_set_autosuspend_delay(&ts->client->dev,
+GOODIX_AUTOSUSPEND_DELAY_MS);
+   pm_runtime_use_autosuspend(&ts->client->dev);
 
 err_release_cfg:
release_firmware(cfg);
@@ -919,8 +967,12 @@ static int goodix_ts_remove(struct i2c_client *client)
 {
struct goodix_ts_data *ts = i2c_get_clientdata(client);
 
-   if (ts->gpiod_int && ts->gpiod_rst)
+   if (ts->gpiod_int && ts->gpiod_rst) {
+   pm_runtime_disable(&client->dev);
+   pm_runtime_set_suspended(&client->dev);
+   pm_runtime_put_noidle(&client->dev);
sysfs_remove_group(&client->dev.kobj, &goodix_attr_group);
+   }
goodix_disable_esd(ts);
kfree(ts->cfg_name);
return 0;
@@ -994,7 +1046,10 @@ static int __maybe_unused goodix_resume(struct device 
*dev)
return goodix_enable_esd(ts);
 }
 
-static SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume);
+static const struct dev_pm_ops goodix_pm_ops = {
+   SET_SYSTEM_SLEEP_PM_OPS(goodix_suspend, goodix_resume)
+   SET_RUNTIME_PM_OPS(goodix_suspend, goodix_resume, NULL)
+};
 
 static const struct i2c_device_id goodix_ts_id[] = {
{ "GDIX1001:00", 0 },
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/m

[PATCH v6 8/9] Input: goodix - add sysfs interface to dump config

2015-09-15 Thread Irina Tirdea
Goodix devices have a configuration information register area that
specify various parameters for the device. The configuration information
has a specific format described in the Goodix datasheet. It includes X/Y
resolution, maximum supported touch points, interrupt flags, various
sesitivity factors and settings for advanced features (like gesture
recognition).

Export a sysfs interface that would allow reading the configuration
information. The default device configuration can be used as a starting
point for creating a valid configuration firmware used by the device at
init time to update its configuration.

This sysfs interface will be exported only if the gpio pins are properly
initialized from ACPI/DT.

Signed-off-by: Irina Tirdea 
---
 drivers/input/touchscreen/goodix.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index a5dd1bd..641a9e3 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -530,12 +530,35 @@ static ssize_t goodix_esd_timeout_store(struct device 
*dev,
return count;
 }
 
+static ssize_t goodix_dump_config_show(struct device *dev,
+  struct device_attribute *attr, char *buf)
+{
+   struct goodix_ts_data *ts = dev_get_drvdata(dev);
+   u8 config[GOODIX_CONFIG_MAX_LENGTH];
+   int error, count = 0, i;
+
+   error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA,
+   config, ts->cfg_len);
+   if (error) {
+   dev_warn(&ts->client->dev,
+"Error reading config (%d)\n",  error);
+   return error;
+   }
+
+   for (i = 0; i < ts->cfg_len; i++)
+   count += scnprintf(buf + count, PAGE_SIZE - count, "%02x ",
+  config[i]);
+   return count;
+}
+
 /* ESD timeout in ms. Default disabled (0). Recommended 2000 ms. */
 static DEVICE_ATTR(esd_timeout, S_IRUGO | S_IWUSR, goodix_esd_timeout_show,
   goodix_esd_timeout_store);
+static DEVICE_ATTR(dump_config, S_IRUGO, goodix_dump_config_show, NULL);
 
 static struct attribute *goodix_attrs[] = {
&dev_attr_esd_timeout.attr,
+   &dev_attr_dump_config.attr,
NULL
 };
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 6/9] Input: goodix - use goodix_i2c_write_u8 instead of i2c_master_send

2015-09-15 Thread Irina Tirdea
Use goodix_i2c_write_u8 instead of i2c_master_send to simplify code.

Signed-off-by: Irina Tirdea 
---
 drivers/input/touchscreen/goodix.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index 1993b6c..ee87d38 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -295,16 +295,11 @@ static void goodix_process_events(struct goodix_ts_data 
*ts)
  */
 static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id)
 {
-   static const u8 end_cmd[] = {
-   GOODIX_READ_COOR_ADDR >> 8,
-   GOODIX_READ_COOR_ADDR & 0xff,
-   0
-   };
struct goodix_ts_data *ts = dev_id;
 
goodix_process_events(ts);
 
-   if (i2c_master_send(ts->client, end_cmd, sizeof(end_cmd)) < 0)
+   if (goodix_i2c_write_u8(ts->client, GOODIX_READ_COOR_ADDR, 0) < 0)
dev_err(&ts->client->dev, "I2C write end_cmd error\n");
 
return IRQ_HANDLED;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 5/9] Input: goodix - add power management support

2015-09-15 Thread Irina Tirdea
Implement suspend/resume for goodix driver.

The suspend and resume process uses the gpio pins.
If the device ACPI/DT information does not declare gpio pins,
suspend/resume will not be available for these devices.

This is based on Goodix datasheets for GT911 and GT9271
and on Goodix driver gt9xx.c for Android (publicly available
in Android kernel trees for various devices).

Signed-off-by: Octavian Purdila 
Signed-off-by: Irina Tirdea 
---
 drivers/input/touchscreen/goodix.c | 94 --
 1 file changed, 89 insertions(+), 5 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c 
b/drivers/input/touchscreen/goodix.c
index d6abd82..1993b6c 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -44,6 +44,7 @@ struct goodix_ts_data {
u16 id;
u16 version;
char *cfg_name;
+   unsigned long irq_flags;
 };
 
 #define GOODIX_MAX_HEIGHT  4096
@@ -57,6 +58,9 @@ struct goodix_ts_data {
 #define GOODIX_CONFIG_967_LENGTH   228
 
 /* Register defines */
+#define GOODIX_REG_COMMAND 0x8040
+#define GOODIX_CMD_SCREEN_OFF  0x05
+
 #define GOODIX_READ_COOR_ADDR  0x814E
 #define GOODIX_REG_CONFIG_DATA 0x8047
 #define GOODIX_REG_ID  0x8140
@@ -182,6 +186,11 @@ static int goodix_i2c_write(struct i2c_client *client, u16 
reg, const u8 *buf,
return ret < 0 ? ret : (ret != 1 ? -EIO : 0);
 }
 
+static int goodix_i2c_write_u8(struct i2c_client *client, u16 reg, u8 value)
+{
+   return goodix_i2c_write(client, reg, &value, sizeof(value));
+}
+
 static int goodix_get_cfg_len(u16 id)
 {
switch (id) {
@@ -301,6 +310,18 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void 
*dev_id)
return IRQ_HANDLED;
 }
 
+static void goodix_free_irq(struct goodix_ts_data *ts)
+{
+   devm_free_irq(&ts->client->dev, ts->client->irq, ts);
+}
+
+static int goodix_request_irq(struct goodix_ts_data *ts)
+{
+   return devm_request_threaded_irq(&ts->client->dev, ts->client->irq,
+NULL, goodix_ts_irq_handler,
+ts->irq_flags, ts->client->name, ts);
+}
+
 /**
  * goodix_check_cfg - Checks if config fw is valid
  *
@@ -617,7 +638,6 @@ static int goodix_request_input_dev(struct goodix_ts_data 
*ts)
 static int goodix_configure_dev(struct goodix_ts_data *ts)
 {
int error;
-   unsigned long irq_flags;
 
goodix_read_config(ts);
 
@@ -625,10 +645,8 @@ static int goodix_configure_dev(struct goodix_ts_data *ts)
if (error)
return error;
 
-   irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT;
-   error = devm_request_threaded_irq(&ts->client->dev, ts->client->irq,
- NULL, goodix_ts_irq_handler,
- irq_flags, ts->client->name, ts);
+   ts->irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT;
+   error = goodix_request_irq(ts);
if (error) {
dev_err(&ts->client->dev, "request IRQ failed: %d\n", error);
return error;
@@ -736,6 +754,71 @@ static int goodix_ts_probe(struct i2c_client *client,
return goodix_configure_dev(ts);
 }
 
+static int __maybe_unused goodix_suspend(struct device *dev)
+{
+   struct i2c_client *client = to_i2c_client(dev);
+   struct goodix_ts_data *ts = i2c_get_clientdata(client);
+   int error;
+
+   /* We need gpio pins to suspend/resume */
+   if (!ts->gpiod_int || !ts->gpiod_rst)
+   return 0;
+
+   /* Free IRQ as IRQ pin is used as output in the suspend sequence */
+   goodix_free_irq(ts);
+   /* Output LOW on the INT pin for 5 ms */
+   error = gpiod_direction_output(ts->gpiod_int, 0);
+   if (error) {
+   goodix_request_irq(ts);
+   return error;
+   }
+   usleep_range(5000, 6000);
+
+   error = goodix_i2c_write_u8(ts->client, GOODIX_REG_COMMAND,
+   GOODIX_CMD_SCREEN_OFF);
+   if (error) {
+   dev_err(&ts->client->dev, "Screen off command failed\n");
+   gpiod_direction_input(ts->gpiod_int);
+   goodix_request_irq(ts);
+   return -EAGAIN;
+   }
+
+   /*
+* The datasheet specifies that the interval between sending screen-off
+* command and wake-up should be longer than 58 ms. To avoid waking up
+* sooner, delay 58ms here.
+*/
+   msleep(58);
+   return 0;
+}
+
+static int __maybe_unused goodix_resume(struct device *dev)
+{
+   struct i2c_client *client = to_i2c_client(dev);
+   struct goodix_ts_data *ts = i2c_get_clientdata(client);
+   int error;
+
+   if (!ts->gpiod_int || !ts->gpiod_rst)
+   return 0;
+
+   /*
+* Exit sleep mode by outputting HIGH level to INT pin
+* for 2ms~5ms.
+  

[PATCH 3/4] input: Add new sun4i-keypad driver

2015-09-15 Thread yassinjaffer
From: Yassin Jaffer 

Allwinnner SUN4i Keypad controller is used to interface a SoC
with a matrix-typekeypad device.
The keypad controller supports multiple row and column lines.
A key can be placed at each intersection of a unique
row and a unique column.
The keypad controller can sense a key-press and key-release and report the
event using a interrupt to the cpu.
This patch adds a driver support to this.
The keypad controller driver does not give proper information
if more that two keys are selected.

Signed-off-by: Yassin Jaffer 
---
 drivers/input/keyboard/Kconfig|  11 ++
 drivers/input/keyboard/Makefile   |   1 +
 drivers/input/keyboard/sun4i-keypad.c | 361 ++
 3 files changed, 373 insertions(+)
 create mode 100644 drivers/input/keyboard/sun4i-keypad.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 2e80107..4f2f3f8 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -590,6 +590,17 @@ config KEYBOARD_SUN4I_LRADC
  To compile this driver as a module, choose M here: the
  module will be called sun4i-lradc-keys.
 
+config KEYBOARD_SUN4I_KEYPAD
+   tristate "Allwinner sun4i keypad support"
+   depends on ARCH_SUNXI
+   select INPUT_MATRIXKMAP
+   help
+ This selects support for the Allwinner keypad
+ on Allwinner sunxi SoCs.
+
+ To compile this driver as a module, choose M here: the
+ module will be called sun4i-keypad.
+
 config KEYBOARD_DAVINCI
tristate "TI DaVinci Key Scan"
depends on ARCH_DAVINCI_DM365
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 1d416dd..d9f54b4 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -57,6 +57,7 @@ obj-$(CONFIG_KEYBOARD_STMPE)  += stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)+= stowaway.o
 obj-$(CONFIG_KEYBOARD_ST_KEYSCAN)  += st-keyscan.o
 obj-$(CONFIG_KEYBOARD_SUN4I_LRADC) += sun4i-lradc-keys.o
+obj-$(CONFIG_KEYBOARD_SUN4I_KEYPAD)+= sun4i-keypad.o
 obj-$(CONFIG_KEYBOARD_SUNKBD)  += sunkbd.o
 obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o
 obj-$(CONFIG_KEYBOARD_TEGRA)   += tegra-kbc.o
diff --git a/drivers/input/keyboard/sun4i-keypad.c 
b/drivers/input/keyboard/sun4i-keypad.c
new file mode 100644
index 000..995f9665
--- /dev/null
+++ b/drivers/input/keyboard/sun4i-keypad.c
@@ -0,0 +1,361 @@
+/*
+ * Allwinner sun4i keypad Controller driver
+ *
+ * Copyright (C) 2015 Yassin Jaffer 
+ *
+ * Parts of this software are based on (derived from):
+ * Copyright (C) 2013-2015 lim...@allwinnertech.com,
+ *  qys
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Keypad Controller registers
+ */
+#define KP_CTL 0x00  /* Keypad Control register */
+#define KP_TIMING  0x04  /* Keypad Timing register */
+#define KP_INT_CFG 0x08  /* Keypad interrupt Config register */
+#define KP_INT_STA 0x0c  /* Keypad interrupt Status register */
+
+#define KP_IN_OFFSET   0x10 /* Keypad Input Data register 0 */
+#define KP_INX_OFFSET(reg_n)   (KP_IN_OFFSET + 4 * (reg_n))
+
+/* KP_CTL bits */
+#define ENABLE(x)  ((x) << 0)
+#define COLMASK(x) ((~x & 0xff) << 8)
+#define ROWMASK(x) ((~x & 0xff) << 16)
+
+/* KP_TIMING bits */
+#define SCAN_CYCLE(x)  ((x) << 0)
+#define DBC_CYCLE(x)   ((x) << 16)
+
+/* KP_INT_CFG bits */
+#define KP_IRQ_FEDGE   BIT(0)
+#defineKP_IRQ_REDGEBIT(1)
+
+/* KP_INT_STA bits */
+#define KP_STA_FEDGE   BIT(0)
+#defineKP_STA_REDGEBIT(1)
+
+#define KP_MAX_ROWS8
+#define KP_MAX_COLS8
+#define N_ROWS_REG 2
+#define KP_ROW_SHIFT   3
+#define KP_BIT_SHIFT32
+
+#define MAX_MATRIX_KEY_NUM (KP_MAX_ROWS * KP_MAX_COLS)
+
+#define KP_BASE_CLK100
+#define MIN_CYCLE  0x10
+#define MIN_SCAN_CYCLE 0x100
+#define MIN_DBC_CYCLE  0x200
+
+/*
+ * keypad Controller structure: stores sunxi keypad controller information
+ *
+ * @dev:   parent device
+ * @input: pointer to input device object
+ * @apb_clk:   keypad Controller APB clock
+ * @clk:   keypad Controller mod

[PATCH 2/4] ARM: dts: sun7i: Add keypad node to Allwinner A20 SoC

2015-09-15 Thread yassinjaffer
From: Yassin Jaffer 

Add Keypad controller node definition to the A20 SoC.

Signed-off-by: Yassin Jaffer 
---
 arch/arm/boot/dts/sun7i-a20.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 333604a..35cc8d0 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -1198,6 +1198,15 @@
status = "disabled";
};
 
+   kp: kp@01c23000 {
+   compatible = "allwinner,sun4i-a10-keypad";
+   reg = <0x01c23000 0x400>;
+   interrupts = ;
+   clocks = <&apb0_gates 10>, <&keypad_clk>;
+   clock-names = "apb", "keypad";
+   status = "disabled";
+   };
+
sid: eeprom@01c23800 {
compatible = "allwinner,sun7i-a20-sid";
reg = <0x01c23800 0x200>;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] devicetree: bindings:Allwinner sun4i keypad

2015-09-15 Thread yassinjaffer
From: Yassin Jaffer 

Signed-off-by: Yassin Jaffer 
---
 .../devicetree/bindings/input/sun4i-keypad.txt | 56 ++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/sun4i-keypad.txt

diff --git a/Documentation/devicetree/bindings/input/sun4i-keypad.txt 
b/Documentation/devicetree/bindings/input/sun4i-keypad.txt
new file mode 100644
index 000..60ed0f2
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/sun4i-keypad.txt
@@ -0,0 +1,56 @@
+Allwinner sun4i keypad
+
+
+Required properties:
+ - compatible: "allwinner,sun4i-a10-keypad"
+ - reg: mmio address range of the chip
+ - interrupts: interrupt to which the chip is connected
+ - clocks : shall reference keypad controller clocks.
+ - clock-names : keypad controller internal clock names. Shall contain :
+* "apb" : APB gating clock
+* "keypad" : keypad controller clock
+
+Required Board Specific Properties:
+- pinctrl-names: The definition can be found at
+pinctrl/pinctrl-bindings.txt.
+
+- pinctrl-0: The definition can be found at
+pinctrl/pinctrl-bindings.txt.
+
+- linux,keymap: The definition can be found at
+bindings/input/matrix-keymap.txt.
+
+Optional properties:
+ - scan-cycle: device specific scan cycle
+ - debounce-cycle: device specific debounce cycle
+ - autorepeat: If specified device will autorepeat
+
+Example:
+
+#include 
+
+   kp: kp@01c23000 {
+   compatible = "allwinner,sun4i-a10-keypad";
+   reg = <0x01c23000 0x400>;
+   interrupts = ;
+   clocks = <&apb0_gates 10>, <&keypad_clk>;
+   clock-names = "apb", "keypad";
+   pinctrl-names = "default";
+   pinctrl-0 = <&keypad_rows>, <&keypad_cols>;
+   linux,keymap = <0x0067  /* KEY_UP */
+   0x0001006c  /* KEY_DOWN */
+   0x00020072  /* KEY_VOLUMEDOWN */
+   0x00030066  /* KEY_HOME */
+   0x016a  /* KEY_RIGHT */
+   0x01010069  /* KEY_LEFT */
+   0x0102001c  /* KEY_ENTER */
+   0x01030073  /* KEY_VOLUMEUP */
+   0x0240  /* KEY_F6 */
+   0x02010042  /* KEY_F8 */
+   0x02020043  /* KEY_F9 */
+   0x02030044  /* KEY_F10 */
+   0x033b  /* KEY_F1 */
+   0x0301003c  /* KEY_F2 */
+   0x0302003d  /* KEY_F3 */
+   0x03030074>;/* KEY_POWER */
+   };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] ARM:dts:sun7i: Add keypad clk node

2015-09-15 Thread yassinjaffer
From: Yassin Jaffer 

This patch add support to the keypad clock on sun7i

Signed-off-by: Yassin Jaffer 
---
 arch/arm/boot/dts/sun7i-a20.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 2bebaa2..333604a 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -465,6 +465,14 @@
clock-output-names = "ir1";
};
 
+   keypad_clk: clk@01c200c4 {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun4i-a10-mod0-clk";
+   reg = <0x01c200c4 0x4>;
+   clocks = <&osc24M>;
+   clock-output-names = "keypad";
+   };
+
usb_clk: clk@01c200cc {
#clock-cells = <1>;
#reset-cells = <1>;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


NEW SUN4i KEYPAD DRIVER

2015-09-15 Thread yassinjaffer
This series adds support for the sun4i keypad Controller
I've tested the driver in a A20 custom board (4x4) only
Allwinner keypad controller does not seem to handle more
than two key press

Please test and report bugs. Thank you in advance

[PATCH 1/4] ARM:dts:sun7i: Add keypad clk node
[PATCH 2/4] ARM: dts: sun7i: Add keypad node to Allwinner A20 SoC
[PATCH 3/4] input: Add new sun4i-keypad driver
[PATCH 4/4] devicetree: bindings:Allwinner sun4i keypad
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] devicetree: bindings: use input-event-codes.h for evdev codes

2015-09-15 Thread Ian Campbell
On Sat, 2015-09-12 at 15:26 +0200, Hans de Goede wrote:
> Add a symlink to uapi/linux/input-event-codes.h, and include that instead
> of (re)defining all the evdev type and code values in
> dt-bindings/input/input.h. This way we do not need to keep all the
> event codes synced manually.
> 
> Signed-off-by: Hans de Goede 
> ---
>  include/dt-bindings/input/input-event-codes.h |   1 +
>  include/dt-bindings/input/input.h | 510 +---
> --
>  2 files changed, 2 insertions(+), 509 deletions(-)
>  create mode 12 include/dt-bindings/input/input-event-codes.h
> 
> diff --git a/include/dt-bindings/input/input-event-codes.h b/include/dt
> -bindings/input/input-event-codes.h
> new file mode 12
> index 000..693bbcd
> --- /dev/null
> +++ b/include/dt-bindings/input/input-event-codes.h
> @@ -0,0 +1 @@
> +../../uapi/linux/input-event-codes.h
> \ No newline at end of file

Hrm, I think this is going to cause trouble for the split DT repository at
https://git.kernel.org/cgit/linux/kernel/git/devicetree/devicetree-rebasing.git/

Since ../../ == include in both trees I think I can make it work by
including include/uapi/linux in the conversion, either wholesale (easiest)
or partially (potentially cleaner).

Any opinions on that?

In principal I ought to regenerate the tree from scratch such that
include/uapi/linux was "always" there and has history but I think we can
live with it just appearing at some point in time wen the conversion script
was updated?

AIUI these values are required to only be used with properties whose names
are of the form "linux,*", otherwise there would be strong complaints about
include Linux uapi stuff into a generic device-tree binding.

Ian.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] input: Add Qualcomm PM8941 power key driver

2015-09-15 Thread Ivan T. Ivanov

On Fri, 2015-01-23 at 16:19 -0800, Bjorn Andersson wrote:
> From: Courtney Cavin ca...@sonymobile.com>
> 
> Signed-off-by: Courtney Cavin ca...@sonymobile.com>
> Signed-off-by: Bjorn Andersson anders...@sonymobile.com>
> 



> 
> +config INPUT_PM8941_PWRKEY
> +   tristate "Qualcomm PM8941 power key support"
> +   depends on MFD_SPMI_PMIC
> +   help
> +   Say Y here if you want support for the power key 
> usually found
> +   on boards using a Qualcomm PM8941 compatible PMIC.
> +

Hi Bjorn, Courtney, 

Do you plan to extend this driver to support RESIN_N PMIC input?
 
It looks like the same downstream "qcom,qpnp-power-on" handle
this functionality for recent PMIC versions.

What will be the best way to add this new functionality, extend
this driver, write new one...?

Regards,
Ivan


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Input: cyapa: remove variable overwriting

2015-09-15 Thread Sudip Mukherjee
Even if rotat_align is true or false the final value of
cyapa->electrodes_rx is always cyapa->electrodes_y. remove the variable
overwriting and in the process remove the variable rotat_align which is
not required any more.

Signed-off-by: Sudip Mukherjee 
---
 drivers/input/mouse/cyapa_gen6.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c
index 5f19107..f0c614b 100644
--- a/drivers/input/mouse/cyapa_gen6.c
+++ b/drivers/input/mouse/cyapa_gen6.c
@@ -196,7 +196,6 @@ static int cyapa_gen6_read_sys_info(struct cyapa *cyapa)
u8 resp_data[PIP_READ_SYS_INFO_RESP_LENGTH];
int resp_len;
u16 product_family;
-   u8 rotat_align;
int error;
 
/* Get App System Information to determine Gen5 or Gen6. */
@@ -241,14 +240,7 @@ static int cyapa_gen6_read_sys_info(struct cyapa *cyapa)
memcpy(&cyapa->product_id[13], &resp_data[62], 2);
cyapa->product_id[15] = '\0';
 
-   rotat_align = resp_data[68];
-   if (rotat_align) {
-   cyapa->electrodes_rx = cyapa->electrodes_y;
-   cyapa->electrodes_rx = cyapa->electrodes_y;
-   } else {
-   cyapa->electrodes_rx = cyapa->electrodes_x;
-   cyapa->electrodes_rx = cyapa->electrodes_y;
-   }
+   cyapa->electrodes_rx = cyapa->electrodes_y;
cyapa->aligned_electrodes_rx = (cyapa->electrodes_rx + 3) & ~3u;
 
if (!cyapa->electrodes_x || !cyapa->electrodes_y ||
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/9] Input: goodix - reset device at init

2015-09-15 Thread Aleksei Mamlin
On Mon,  7 Sep 2015 17:36:17 +0300
Irina Tirdea  wrote:

> After power on, it is recommended that the driver resets the device.
> The reset procedure timing is described in the datasheet and is used
> at device init (before writing device configuration) and
> for power management. It is a sequence of setting the interrupt
> and reset pins high/low at specific timing intervals. This procedure
> also includes setting the slave address to the one specified in the
> ACPI/device tree.
> 
> This is based on Goodix datasheets for GT911 and GT9271 and on Goodix
> driver gt9xx.c for Android (publicly available in Android kernel
> trees for various devices).
> 
> For reset the driver needs to control the interrupt and
> reset gpio pins (configured through ACPI/device tree). For devices
> that do not have the gpio pins declared, the functionality depending
> on these pins will not be available, but the device can still be used
> with basic functionality.
> 
> Signed-off-by: Octavian Purdila 
> Signed-off-by: Irina Tirdea 
> ---
>  .../bindings/input/touchscreen/goodix.txt  |   5 +
>  drivers/input/touchscreen/goodix.c | 136 
> +
>  2 files changed, 141 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt 
> b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
> index 8ba98ee..c0715f8 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
> @@ -12,6 +12,8 @@ Required properties:
>   - reg   : I2C address of the chip. Should be 0x5d or 
> 0x14
>   - interrupt-parent  : Interrupt controller to which the chip is connected
>   - interrupts: Interrupt to which the chip is connected
> + - gpios : GPIOS the chip is connected to: first one is the
> +   interrupt gpio and second one the reset gpio.
>  
>  Example:
>  
> @@ -23,6 +25,9 @@ Example:
>   reg = <0x5d>;
>   interrupt-parent = <&gpio>;
>   interrupts = <0 0>;
> +
> + gpios = <&gpio1 0 0>, /* INT */
> + <&gpio1 1 0>; /* RST */
>   };
>  
>   /* ... */
> diff --git a/drivers/input/touchscreen/goodix.c 
> b/drivers/input/touchscreen/goodix.c
> index 7be6eab..8edfc06 100644
> --- a/drivers/input/touchscreen/goodix.c
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -17,6 +17,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -37,6 +38,8 @@ struct goodix_ts_data {
>   unsigned int int_trigger_type;
>   bool rotated_screen;
>   int cfg_len;
> + struct gpio_desc *gpiod_int;
> + struct gpio_desc *gpiod_rst;
>  };
>  
>  #define GOODIX_MAX_HEIGHT4096
> @@ -89,6 +92,30 @@ static const struct dmi_system_id rotated_screen[] = {
>   {}
>  };
>  
> +/*
> + * ACPI table specifies gpio pins in this order: first rst pin and
> + * then interrupt pin.
> + */
> +static const struct dmi_system_id goodix_rst_pin_first[] = {
> +#if defined(CONFIG_DMI) && defined(CONFIG_X86)
> + {
> + .ident = "WinBook TW100",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "TW100")
> + }
> + },
> + {
> + .ident = "WinBook TW700",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "TW700")
> + },
> + },
> +#endif
> + {}
> +};
> +
>  /**
>   * goodix_i2c_read - read data from a register of the i2c slave device.
>   *
> @@ -237,6 +264,102 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void 
> *dev_id)
>   return IRQ_HANDLED;
>  }
>  
> +static int goodix_int_sync(struct goodix_ts_data *ts)
> +{
> + int error;
> +
> + error = gpiod_direction_output(ts->gpiod_int, 0);
> + if (error)
> + return error;
> + msleep(50); /* T5: 50ms */
> +
> + return gpiod_direction_input(ts->gpiod_int);
> +}
> +
> +/**
> + * goodix_reset - Reset device during power on
> + *
> + * @ts: goodix_ts_data pointer
> + */
> +static int goodix_reset(struct goodix_ts_data *ts)
> +{
> + int error;
> +
> + /* begin select I2C slave addr */
> + error = gpiod_direction_output(ts->gpiod_rst, 0);
> + if (error)
> + return error;
> + msleep(20); /* T2: > 10ms */
> + /* HIGH: 0x28/0x29, LOW: 0xBA/0xBB */
> + error = gpiod_direction_output(ts->gpiod_int, ts->client->addr == 0x14);
> + if (error)
> + return error;
> + usleep_range(100, 2000);/* T3: > 100us */
> + error = gpiod_direction_output(ts->gpiod_rst, 1);
> + if (error)
> + return error;

RE: [PATCH V3 2/3] onkey: da9063: Add DA9062 OnKey capability to DA9063 OnKey driver

2015-09-15 Thread Opensource [Steve Twiss]
This is a resend of my previous e-mail sent just a couple of minutes ago -- 
this one removes the copyright footer that was added by our IT department

On 23 July 2015 17:18, Steve Twiss wrote:

> Subject: [PATCH V3 2/3] onkey: da9063: Add DA9062 OnKey capability to DA9063 
> OnKey driver
> 
> From: S Twiss 
> 
> Add DA9062 OnKey support into the existing DA9063 OnKey driver
> component by
> using generic access tables for common register and bit mask definitions.
> 
> The following change will add generic register and bit mask support to the
> DA9063 OnKey.
> 
> The following alterations have been made to the DA9063 OnKey:
> 
> - Addition of a da906x_chip_config structure to hold all
>   generic registers and bitmasks for this type of OnKey component.
> - Addition of an struct of_device_id table for DA9063 and DA9062
>   defaults
> - Refactoring functions to use struct da9063_onkey accesses to generic
>   registers/masks instead of using defines from registers.h
> - Re-work of da9063_onkey_probe() to use of_match_node() and
>   dev_get_regmap() to provide initialisation of generic registers and
>   masks and access to regmap
> 
> Signed-off-by: Steve Twiss 

Hi Dmitry,

One of my patches for the DA9062 OnKey (a modification to the DA9063 OnKey 
driver)
was sent a while ago but was waiting for the DA9062 MFD parts to make it into 
mainline.
Some previous conversations between you and Lee are here:

- https://lkml.org/lkml/2015/7/28/51
- https://lkml.org/lkml/2015/7/28/850

The MFD part and device tree part for the DA9062 OnKey are in the mainline 
v4.3-rc1
kernel now. Can I ask if there any barriers in the way for moving the DA9063 
OnKey
patch forward now please?

Regards,
Stephen

> ---
> Changes in V3:
>  - No change
> Changes in V2:
>  - Altered Kconfig to use the line "Dialog DA9062/63 OnKey"
>  - Rename of da9063_compatible_onkey_regmap to da906x_chip_config
>  - char *name changed to const char *name
>  - Rename struct da9063_compatible_onkey {} back to struct da9063_onkey
> 
> This patch applies against linux-next and next-20150708
> 
> 
>  drivers/input/misc/Kconfig|   8 +--
>  drivers/input/misc/da9063_onkey.c | 129
> ++
>  2 files changed, 108 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index d4f0a81..2610cfa 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -611,11 +611,11 @@ config INPUT_DA9055_ONKEY
> will be called da9055_onkey.
> 
>  config INPUT_DA9063_ONKEY
> - tristate "Dialog DA9063 OnKey"
> - depends on MFD_DA9063
> + tristate "Dialog DA9062/63 OnKey"
> + depends on MFD_DA9063 || MFD_DA9062
>   help
> -   Support the ONKEY of Dialog DA9063 Power Management IC as an
> -   input device reporting power button statue.
> +   Support the ONKEY of Dialog DA9063 and DA9062 Power
> Management ICs
> +   as an input device capable for reporting the power button status.
> 
> To compile this driver as a module, choose M here: the module
> will be called da9063_onkey.
> diff --git a/drivers/input/misc/da9063_onkey.c
> b/drivers/input/misc/da9063_onkey.c
> index f577585..8eb697d 100644
> --- a/drivers/input/misc/da9063_onkey.c
> +++ b/drivers/input/misc/da9063_onkey.c
> @@ -1,5 +1,5 @@
>  /*
> - * OnKey device driver for DA9063
> + * OnKey device driver for DA9063 and DA9062 PMICs
>   * Copyright (C) 2015  Dialog Semiconductor Ltd.
>   *
>   * This program is free software; you can redistribute it and/or
> @@ -24,36 +24,96 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +
> +struct da906x_chip_config {
> + /* REGS */
> + int onkey_status;
> + int onkey_pwr_signalling;
> + int onkey_fault_log;
> + int onkey_shutdown;
> + /* MASKS */
> + int onkey_nonkey_mask;
> + int onkey_nonkey_lock_mask;
> + int onkey_key_reset_mask;
> + int onkey_shutdown_mask;
> + /* NAMES */
> + const char *name;
> +};
> 
>  struct da9063_onkey {
> - struct da9063 *hw;
>   struct delayed_work work;
>   struct input_dev *input;
>   struct device *dev;
> + struct regmap *regmap;
> + const struct da906x_chip_config *config;
> + char phys[32];
>   bool key_power;
>  };
> 
> +static const struct da906x_chip_config da9063_regs = {
> + /* REGS */
> + .onkey_status = DA9063_REG_STATUS_A,
> + .onkey_pwr_signalling = DA9063_REG_CONTROL_B,
> + .onkey_fault_log = DA9063_REG_FAULT_LOG,
> + .onkey_shutdown = DA9063_REG_CONTROL_F,
> + /* MASKS */
> + .onkey_nonkey_mask = DA9063_NONKEY,
> + .onkey_nonkey_lock_mask = DA9063_NONKEY_LOCK,
> + .onkey_key_reset_mask = DA9063_KEY_RESET,
> + .onkey_shutdown_mask = DA9063_SHUTDOWN,
> + /* NAMES */
> + .name = DA9063_DRVNAME_ONKEY,
> +};
> +
> +static const struct da906x_chip_config da9062_regs = {
> + /* REGS */
> + .onkey_status = DA9062AA_STATUS_A,
>

RE: [PATCH V3 2/3] onkey: da9063: Add DA9062 OnKey capability to DA9063 OnKey driver

2015-09-15 Thread Stephen Twiss
On 23 July 2015 17:18, Steve Twiss wrote:

> Subject: [PATCH V3 2/3] onkey: da9063: Add DA9062 OnKey capability to DA9063 
> OnKey driver
>
> From: S Twiss 
>
> Add DA9062 OnKey support into the existing DA9063 OnKey driver
> component by
> using generic access tables for common register and bit mask definitions.
>
> The following change will add generic register and bit mask support to the
> DA9063 OnKey.
>
> The following alterations have been made to the DA9063 OnKey:
>
> - Addition of a da906x_chip_config structure to hold all
>   generic registers and bitmasks for this type of OnKey component.
> - Addition of an struct of_device_id table for DA9063 and DA9062
>   defaults
> - Refactoring functions to use struct da9063_onkey accesses to generic
>   registers/masks instead of using defines from registers.h
> - Re-work of da9063_onkey_probe() to use of_match_node() and
>   dev_get_regmap() to provide initialisation of generic registers and
>   masks and access to regmap
>
> Signed-off-by: Steve Twiss 

Hi Dmitry,

One of my patches for the DA9062 OnKey (a modification to the DA9063 OnKey 
driver)
was sent a while ago but was waiting for the DA9062 MFD parts to make it into 
mainline.
Some previous conversations between you and Lee are here:

- https://lkml.org/lkml/2015/7/28/51
- https://lkml.org/lkml/2015/7/28/850

The MFD part and device tree part for the DA9062 OnKey are in the mainline 
v4.3-rc1
kernel now. Can I ask if there any barriers in the way for moving the DA9063 
OnKey
patch forward now please?

Regards,
Stephen

> ---
> Changes in V3:
>  - No change
> Changes in V2:
>  - Altered Kconfig to use the line "Dialog DA9062/63 OnKey"
>  - Rename of da9063_compatible_onkey_regmap to da906x_chip_config
>  - char *name changed to const char *name
>  - Rename struct da9063_compatible_onkey {} back to struct da9063_onkey
>
> This patch applies against linux-next and next-20150708
>
>
>  drivers/input/misc/Kconfig|   8 +--
>  drivers/input/misc/da9063_onkey.c | 129
> ++
>  2 files changed, 108 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index d4f0a81..2610cfa 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -611,11 +611,11 @@ config INPUT_DA9055_ONKEY
> will be called da9055_onkey.
>
>  config INPUT_DA9063_ONKEY
> - tristate "Dialog DA9063 OnKey"
> - depends on MFD_DA9063
> + tristate "Dialog DA9062/63 OnKey"
> + depends on MFD_DA9063 || MFD_DA9062
>   help
> -   Support the ONKEY of Dialog DA9063 Power Management IC as an
> -   input device reporting power button statue.
> +   Support the ONKEY of Dialog DA9063 and DA9062 Power
> Management ICs
> +   as an input device capable for reporting the power button status.
>
> To compile this driver as a module, choose M here: the module
> will be called da9063_onkey.
> diff --git a/drivers/input/misc/da9063_onkey.c
> b/drivers/input/misc/da9063_onkey.c
> index f577585..8eb697d 100644
> --- a/drivers/input/misc/da9063_onkey.c
> +++ b/drivers/input/misc/da9063_onkey.c
> @@ -1,5 +1,5 @@
>  /*
> - * OnKey device driver for DA9063
> + * OnKey device driver for DA9063 and DA9062 PMICs
>   * Copyright (C) 2015  Dialog Semiconductor Ltd.
>   *
>   * This program is free software; you can redistribute it and/or
> @@ -24,36 +24,96 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +
> +struct da906x_chip_config {
> + /* REGS */
> + int onkey_status;
> + int onkey_pwr_signalling;
> + int onkey_fault_log;
> + int onkey_shutdown;
> + /* MASKS */
> + int onkey_nonkey_mask;
> + int onkey_nonkey_lock_mask;
> + int onkey_key_reset_mask;
> + int onkey_shutdown_mask;
> + /* NAMES */
> + const char *name;
> +};
>
>  struct da9063_onkey {
> - struct da9063 *hw;
>   struct delayed_work work;
>   struct input_dev *input;
>   struct device *dev;
> + struct regmap *regmap;
> + const struct da906x_chip_config *config;
> + char phys[32];
>   bool key_power;
>  };
>
> +static const struct da906x_chip_config da9063_regs = {
> + /* REGS */
> + .onkey_status = DA9063_REG_STATUS_A,
> + .onkey_pwr_signalling = DA9063_REG_CONTROL_B,
> + .onkey_fault_log = DA9063_REG_FAULT_LOG,
> + .onkey_shutdown = DA9063_REG_CONTROL_F,
> + /* MASKS */
> + .onkey_nonkey_mask = DA9063_NONKEY,
> + .onkey_nonkey_lock_mask = DA9063_NONKEY_LOCK,
> + .onkey_key_reset_mask = DA9063_KEY_RESET,
> + .onkey_shutdown_mask = DA9063_SHUTDOWN,
> + /* NAMES */
> + .name = DA9063_DRVNAME_ONKEY,
> +};
> +
> +static const struct da906x_chip_config da9062_regs = {
> + /* REGS */
> + .onkey_status = DA9062AA_STATUS_A,
> + .onkey_pwr_signalling = DA9062AA_CONTROL_B,
> + .onkey_fault_log = DA9062AA_FAULT_LOG,
> + .onkey_shutdown = DA9062AA_CONTROL_F,
> + /* MASKS */
>