Skip to contentSkip to conversation

da9063: Support for OnKey

PATCH In review Opensource [Steve Twiss] 2 participants 5 messages Mar 10, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover da9063: Support for OnKey

From: Opensource [Steve Twiss] <[email protected]>

This patch series adds support for the DA9063 OnKey.

It has been split into two parts because the OnKey driver requires a minor alteration to the da9063-core.c file and the platform data header file. These parts have been separated out.

- Add a new OnKey driver for DA9063;
- Minor addition "ONKEY" name to OnKey IRQ resource structure;

Thank you,
Steve Twiss, Dialog Semiconductor Ltd.

S Twiss (2):
mfd: da9063: Linkages for ONKEY support in core files
input: misc: da9063: OnKey driver

 drivers/input/misc/Kconfig        |  10 ++
 drivers/input/misc/Makefile       |   1 +
 drivers/input/misc/da9063-onkey.c | 209 ++++++++++++++++++++++++++++++++++++++
 drivers/mfd/da9063-core.c         |   1 +
 include/linux/mfd/da9063/pdata.h  |   1 +
 5 files changed, 222 insertions(+)
 create mode 100644 drivers/input/misc/da9063-onkey.c
Signature · 1 line
end-of-patch for PATCH V1
#1 lore raw

PATCH 1/2 mfd: da9063: Linkages for ONKEY support in core files

From: Opensource [Steve Twiss] <[email protected]>

This change adds the name field "ONKEY" to the properties of the the OnKey IORESOURCE_IRQ resource structure (part of the mfd_cell Onkey resource).

The addition of bool key_power which will be passed to the onkey driver and allow KEY_POWER support to be turned on/off as a driver configuration option.

---
Checks performed with linux-next/next-20140307/scripts/checkpatch.pl
da9063-core.c total: 0 errors, 0 warnings, 189 lines checked
pdata.h total: 0 errors, 0 warnings, 112 lines checked

This change is a dependency for the new DA9063 OnKey driver which forms the remainder of this patch set.
This patch applies against kernel linux-next next-20140307

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/mfd/da9063-core.c        | 1 +
 include/linux/mfd/da9063/pdata.h | 1 +
 2 files changed, 2 insertions(+)
drivers/mfd/da9063-core.c +1 -0
index e70ae31..b410a14 100644
@@ -60,6 +60,7 @@ static struct resource da9063_rtc_resources[] = {
 
 static struct resource da9063_onkey_resources[] = {
 	{
+		.name	= "ONKEY",
 		.start	= DA9063_IRQ_ONKEY,
 		.end	= DA9063_IRQ_ONKEY,
 		.flags	= IORESOURCE_IRQ,
include/linux/mfd/da9063/pdata.h +1 -0
index 95c8742..612383b 100644
@@ -103,6 +103,7 @@ struct da9063;
 struct da9063_pdata {
 	int				(*init)(struct da9063 *da9063);
 	int				irq_base;
+	bool				key_power;
 	unsigned			flags;
 	struct da9063_regulators_pdata	*regulators_pdata;
 	struct led_platform_data	*leds_pdata;
Signature · 1 line
end-of-patch for PATCH V1
#2 lore raw

Re: [PATCH V1 1/2] mfd: da9063: Linkages for ONKEY support in core files

Quoted 47 lines

From: Opensource [Steve Twiss] <[email protected]>

This change adds the name field "ONKEY" to the properties of the the OnKey IORESOURCE_IRQ resource structure (part of the mfd_cell Onkey resource).

The addition of bool key_power which will be passed to the onkey driver and allow KEY_POWER support to be turned on/off as a driver configuration option.

---
Checks performed with linux-next/next-20140307/scripts/checkpatch.pl
da9063-core.c total: 0 errors, 0 warnings, 189 lines checked
pdata.h total: 0 errors, 0 warnings, 112 lines checked

This change is a dependency for the new DA9063 OnKey driver which forms the remainder of this patch set.
This patch applies against kernel linux-next next-20140307

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/mfd/da9063-core.c        | 1 +
 include/linux/mfd/da9063/pdata.h | 1 +
 2 files changed, 2 insertions(+)
drivers/mfd/da9063-core.c +1 -0
index e70ae31..b410a14 100644
@@ -60,6 +60,7 @@ static struct resource da9063_rtc_resources[] = {
 
 static struct resource da9063_onkey_resources[] = {
 	{
+		.name	= "ONKEY",
 		.start	= DA9063_IRQ_ONKEY,
 		.end	= DA9063_IRQ_ONKEY,
 		.flags	= IORESOURCE_IRQ,
include/linux/mfd/da9063/pdata.h +0 -0
index 95c8742..612383b 100644

include/linux/mfd/da9063/pdata.h struct da9063; · line 109

Quoted 7 lines
include/linux/mfd/da9063/pdata.h +1 -0
@@ -103,6 +103,7 @@ struct da9063;
 struct da9063_pdata {
 	int				(*init)(struct da9063 *da9063);
 	int				irq_base;
+	bool				key_power;
 	unsigned			flags;
 	struct da9063_regulators_pdata	*regulators_pdata;
 	struct led_platform_data	*leds_pdata;

I'd like this change to be added by the first patch which makes use of it.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw

RE: [PATCH V1 1/2] mfd: da9063: Linkages for ONKEY support in core files

Quoted 44 lines · Lee Jones

Review

Quoted 43 lines

From: Opensource [Steve Twiss] <[email protected]>

This change adds the name field "ONKEY" to the properties of the the OnKey IORESOURCE_IRQ resource structure (part of the mfd_cell Onkey resource).

The addition of bool key_power which will be passed to the onkey driver and allow KEY_POWER support to be turned on/off as a driver configuration option.

---
Checks performed with linux-next/next-20140307/scripts/checkpatch.pl
da9063-core.c total: 0 errors, 0 warnings, 189 lines checked
pdata.h total: 0 errors, 0 warnings, 112 lines checked

This change is a dependency for the new DA9063 OnKey driver which forms the remainder of this patch set.
This patch applies against kernel linux-next next-20140307

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/mfd/da9063-core.c        | 1 +
 include/linux/mfd/da9063/pdata.h | 1 +
 2 files changed, 2 insertions(+)
drivers/mfd/da9063-core.c +1 -0
index e70ae31..b410a14 100644
@@ -60,6 +60,7 @@ static struct resource da9063_rtc_resources[] = {
 
 static struct resource da9063_onkey_resources[] = {
 	{
+		.name	= "ONKEY",
 		.start	= DA9063_IRQ_ONKEY,
 		.end	= DA9063_IRQ_ONKEY,
 		.flags	= IORESOURCE_IRQ,
(quoted diff) +0 -0

b/include/linux/mfd/da9063/pdata.h

Quoted 15 lines

include/linux/mfd/da9063/pdata.h struct da9063; · line 109

Quoted 11 lines

index 95c8742..612383b 100644

include/linux/mfd/da9063/pdata.h +1 -0
@@ -103,6 +103,7 @@ struct da9063;
 struct da9063_pdata {
 	int				(*init)(struct da9063 *da9063);
 	int				irq_base;
+	bool				key_power;
 	unsigned			flags;
 	struct da9063_regulators_pdata	*regulators_pdata;
 	struct led_platform_data	*leds_pdata;

I'd like this change to be added by the first patch which makes use of it.

No problem,
I'll resent it as PATCH V2...

Regards,
Steve

#4 lore raw

PATCH 2/2 input: misc: da9063: OnKey driver

In reply to Opensource [Steve Twiss]

From: Opensource [Steve Twiss] <[email protected]>

Add the OnKey driver for DA9063.

---
Checks performed with linux-next/next-20140307/scripts/checkpatch.pl

 da9063-onkey.c            total: 0 errors, 0 warnings, 209 lines checked
 Kconfig                   total: 0 errors, 11 warnings, 679 lines checked
 Makefile                  total: 0 errors, 0 warnings, 66 lines checked

Hi Dmitry,

Thank you for your previous response to my RFC.
Here are my changes. I have implemented your suggestions. Please find my explanations below.

Changes made to this driver since previous RFC V1:

- Several alterations to the previous patch have been made according to the comments provided by Dmitry Torokhov in the previous RFC V1 e-mail thread, see here:
http://www.spinics.net/lists/linux-input/msg30171.html

- The use of booleans for boolean data (true/false);
- The addition of an extra input_sync() in between the two calls to

    input_report_key(KEY_SLEEP);

- The removal of call to dev_err() because it was unnecessary;

- A fix for the race condition during driver remove() function:
"nothing stops IRQ from firing again and rescheduling the work item". Also, the addition of a work cancelling function during the error path of the driver probe() after the interrupt has been registered. The error path of the probe() function has been refactored slightly using goto statements to make things clearer.
This fix also required a change to the way the interrupt was
registered: probe() is now using request_threaded_irq() instead of the devm_ equivalent so that an explicit call to free_irq() can be done before any calls to cancel_delayed_work_sync() are made;

- A clarification to the way the da9063_poll_on() function should handle the I2C failure error case.
The key report for KEY_POWER is now only made if there has been a fully a successful update to the DA9063_NONKEY bit in the IRQ mask. Otherwise it will continue to re-poll until the onkey's IRQ mask has been modified successfully.

Dependencies:

This driver makes use of the name field "ONKEY" as part of the function call: platform_get_irq_byname();

This driver is therefore dependent on this change to the name field in the properties of the the OnKey IORESOURCE_IRQ resource structure
(part of the mfd_cell Onkey resource inside da9063-core.c). This
change comes as part of this patch set.

This patch applies against kernel version linux-next next-20140307

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/input/misc/Kconfig        |  10 ++
 drivers/input/misc/Makefile       |   1 +
 drivers/input/misc/da9063-onkey.c | 209 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 220 insertions(+)
 create mode 100644 drivers/input/misc/da9063-onkey.c
drivers/input/misc/Kconfig +10 -0
index 762e6d2..3deb008 100644
@@ -522,6 +522,16 @@ config INPUT_DA9055_ONKEY
 	  To compile this driver as a module, choose M here: the module
 	  will be called da9055_onkey.
 
+config INPUT_DA9063_ONKEY
+	tristate "Dialog DA9063 OnKey"
+	depends on MFD_DA9063
+	help
+	  Support the ONKEY of Dialog DA9063 Power Management IC as an
+	  input device reporting power button statue.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called da9063-onkey.
+
 config INPUT_DM355EVM
 	tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
 	depends on MFD_DM355EVM_MSP
drivers/input/misc/Makefile +1 -0
index cda71fc..f40caa7 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_INPUT_CMA3000_I2C)		+= cma3000_d0x_i2c.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)		+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DA9052_ONKEY)	+= da9052_onkey.o
 obj-$(CONFIG_INPUT_DA9055_ONKEY)	+= da9055_onkey.o
+obj-$(CONFIG_INPUT_DA9063_ONKEY)	+= da9063-onkey.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
 obj-$(CONFIG_INPUT_GP2A)		+= gp2ap002a00f.o
 obj-$(CONFIG_INPUT_GPIO_BEEPER)		+= gpio-beeper.o
drivers/input/misc/da9063-onkey.c new file +209 -0

209 lines not on this page · raw message

Signature · 1 line
end-of-patch for PATCH V1