Skip to contentSkip to conversation

input: misc: da9063: OnKey driver

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

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

PATCH v2 1/1 input: misc: da9063: OnKey driver

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

Add the OnKey driver for DA9063

Plus some minor dependencies:
- Addition of "ONKEY" name to OnKey IRQ resource structure;
- Bool key_power platform data 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
 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 Lee,

I have added the minor changes as part of the main DA9063 OnKey patch as requested.

The majority of this patch is DA9063 OnKey driver.

The other changes to the files drivers/mfd/da9063-core.c and include/linux/mfd/da9063/pdata.h are dependencies required to support the OnKey driver. The changes are made up of the following:

- An addition of a name field "ONKEY" to the properties of the the OnKey IORESOURCE_IRQ resource structure (part of the mfd_cell Onkey resource).
- A bool key_power variable which will be passed to the onkey driver and which will allow KEY_POWER support to be turned on/off as a driver configuration option.

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.

These patches apply against kernel 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 +++++++++++++++++++++++++++++++++++++
 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
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

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 V2
Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines

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

Add the OnKey driver for DA9063

Plus some minor dependencies:
- Addition of "ONKEY" name to OnKey IRQ resource structure;
- Bool key_power platform data driver configuration option.

Quoted 8 lines

---

 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 +

For the MFD parts:

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html