Skip to contentSkip to conversation

da9062: Add DA9062 OnKey support using the existing DA9063 OnKey driver

PATCH Superseded S Twiss 2 participants 6 messages Jul 20, 2015 – Jul 23, 2015

Subsystems (6)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

S Twiss

author
#0 lore raw

v2 cover da9062: Add DA9062 OnKey support using the existing DA9063 OnKey driver

From: S Twiss <[email protected]>

This patch set adds OnKey support for the Dialog DA9062 Power Management IC. Changes are made to the existing DA9063 OnKey component so that functionality in this device driver can be re-used to support the DA9062 OnKey.

This following patch set re-uses the existing kernel OnKey driver for chips whose OnKey blocks are functionally similar to the DA9063 OnKey.

The main points for the MFD core and device tree changes are as follows.

- Alteration of the DA9063 OnKey Kconfig needs to be updated to depend on both MFD_DA9063 "or" MFD_DA9062. There is no explicit DA9062 OnKey Kconfig.
- The DA9062 MFD core should add a new OnKey resource as usual and an entry in the mfd_cell to support a component name and of_compatible for "da9062-onkey" and "dlg,da9062-onkey".
- The device tree binding support should include a compatible string for "dlg,da9062-onkey"

The main points for the OnKey changes are as follows:

A generic structure is used (called da906x_chip_config) to hold all generic registers and bitmasks for use with this type of OnKey component.

Functions in the DA9063 OnKey will be refactored to use this compatibility struct and all accesses to generic registers/masks will be made through this table look-up instead of using defines from the register header files directly

Linkage between the DA9062 MFD and the DA9063 OnKey driver is created through the use of an of_match_table entry in the platform_driver structure. A re-work of da9063_onkey_probe() is necessary to use the of_match_node() and dev_get_regmap() functions: this will provide initialisation of the generic registers and masks and allow access to the regmap according to the correct device tree specification.

The addition of a of_device_id table for DA9063 and DA9062 default data is created.

In this patch set the following is provided:
- [PATCH V2 1/3]: MFD changes in DA9062 to support OnKey
- [PATCH V2 2/3]: Update existing DA9063 OnKey to add DA9062 support
- [PATCH V2 3/3]: Device tree bindings for DA9062 OnKey component

This patch applies against linux-next and next-20150708

Thank you,
Steve Twiss, Dialog Semiconductor Ltd.

S Twiss (3):
mfd: da9062: Support for the DA9063 OnKey in the DA9062 core
onkey: da9063: Add DA9062 OnKey capability to DA9063 OnKey driver
devicetree: da9062: Add device tree bindings for DA9062 OnKey

 Documentation/devicetree/bindings/mfd/da9062.txt |  18 ++++
 drivers/input/misc/Kconfig                       |   8 +-
 drivers/input/misc/da9063_onkey.c                | 129 ++++++++++++++++++-----
 drivers/mfd/da9062-core.c                        |  11 ++
 4 files changed, 137 insertions(+), 29 deletions(-)
Signature · 1 line
end-of-patch for PATCH V2
author
#1 lore raw

PATCH v2 1/3 mfd: da9062: Support for the DA9063 OnKey in the DA9062 core

From: S Twiss <[email protected]>

Add MFD core driver support for a OnKey component

- MFD core adds the resource da9062_onkey_resources[] for the OnKey
- An appropriate value has been added into mfd_cell da9062_devs[] to support component .name = "da9062-onkey" and .of_compatible = "dlg,da9062-onkey"

---
Checks performed with linux-next/next-20150708/scripts/checkpatch.pl
da9062-core.c total: 0 errors, 0 warnings, 523 lines checked
Changes in V2:
- No change

This patch applies against linux-next and next-20150708

 drivers/mfd/da9062-core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/mfd/da9062-core.c +11 -0
index 4cf0643..0732977 100644
@@ -118,6 +118,10 @@ static struct resource da9062_wdt_resources[] = {
 	DEFINE_RES_NAMED(DA9062_IRQ_WDG_WARN, 1, "WD_WARN", IORESOURCE_IRQ),
 };
 
+static struct resource da9062_onkey_resources[] = {
+	DEFINE_RES_NAMED(DA9062_IRQ_ONKEY, 1, "ONKEY", IORESOURCE_IRQ),
+};
+
 static const struct mfd_cell da9062_devs[] = {
 	{
 		.name		= "da9062-core",
@@ -141,6 +145,13 @@ static const struct mfd_cell da9062_devs[] = {
 		.resources	= da9062_thermal_resources,
 		.of_compatible  = "dlg,da9062-thermal",
 	},
+	{
+		.name		= "da9062-onkey",
+		.num_resources	= ARRAY_SIZE(da9062_onkey_resources),
+		.resources	= da9062_onkey_resources,
+		.of_compatible = "dlg,da9062-onkey",
+	},
+
 };
 
 static int da9062_clear_fault_log(struct da9062 *chip)
Signature · 1 line
end-of-patch for PATCH V2
Acked-by on v2 1/3
#2 lore raw

Re: [PATCH V2 1/3] mfd: da9062: Support for the DA9063 OnKey in the DA9062 core

Quoted 17 lines · S Twiss

From: S Twiss <[email protected]>

Add MFD core driver support for a OnKey component

- MFD core adds the resource da9062_onkey_resources[] for the OnKey
- An appropriate value has been added into mfd_cell da9062_devs[] to support component .name = "da9062-onkey" and .of_compatible = "dlg,da9062-onkey"

---
Checks performed with linux-next/next-20150708/scripts/checkpatch.pl
da9062-core.c total: 0 errors, 0 warnings, 523 lines checked
Changes in V2:
- No change

Quoted 5 lines

This patch applies against linux-next and next-20150708

 drivers/mfd/da9062-core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

For my own reference:

Quoted 29 lines
drivers/mfd/da9062-core.c +11 -0
index 4cf0643..0732977 100644
@@ -118,6 +118,10 @@ static struct resource da9062_wdt_resources[] = {
 	DEFINE_RES_NAMED(DA9062_IRQ_WDG_WARN, 1, "WD_WARN", IORESOURCE_IRQ),
 };
 
+static struct resource da9062_onkey_resources[] = {
+	DEFINE_RES_NAMED(DA9062_IRQ_ONKEY, 1, "ONKEY", IORESOURCE_IRQ),
+};
+
 static const struct mfd_cell da9062_devs[] = {
 	{
 		.name		= "da9062-core",
@@ -141,6 +145,13 @@ static const struct mfd_cell da9062_devs[] = {
 		.resources	= da9062_thermal_resources,
 		.of_compatible  = "dlg,da9062-thermal",
 	},
+	{
+		.name		= "da9062-onkey",
+		.num_resources	= ARRAY_SIZE(da9062_onkey_resources),
+		.resources	= da9062_onkey_resources,
+		.of_compatible = "dlg,da9062-onkey",
+	},
+
 };
 
 static int da9062_clear_fault_log(struct da9062 *chip)
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
author
#3 lore raw

PATCH v2 2/3 onkey: da9063: Add DA9062 OnKey capability to DA9063 OnKey driver

In reply to S Twiss

From: S Twiss <[email protected]>

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

---
Checks performed with linux-next/next-20150708/scripts/checkpatch.pl
Kconfig total: 0 errors, 14 warnings, 810 lines checked
da9063_onkey.c total: 0 errors, 2 warnings, 305 lines checked
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(-)
drivers/input/misc/Kconfig +4 -4
index d4f0a81..2610cfa 100644
@@ -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.
drivers/input/misc/da9063_onkey.c +104 -25

217 lines not on this page · raw message

Signature · 1 line
end-of-patch for PATCH V2
author
#4 lore raw

PATCH v2 3/3 devicetree: da9062: Add device tree bindings for DA9062 OnKey

In reply to S Twiss

From: S Twiss <[email protected]>

Add device tree bindings for the DA9062 OnKey driver component

---
Checks performed with linux-next/next-20150708/scripts/checkpatch.pl
da9062.txt total: 0 errors, 0 warnings, 97 lines checked
This patch applies against linux-next and next-20150708

 Documentation/devicetree/bindings/mfd/da9062.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
Documentation/devicetree/bindings/mfd/da9062.txt +18 -0
index 5765ed9..7752093 100644
@@ -5,6 +5,7 @@ DA9062 consists of a large and varied group of sub-devices:
 Device                   Supply Names    Description
 ------                   ------------    -----------
 da9062-regulator        :               : LDOs & BUCKs
+da9062-onkey            :               : On Key
 da9062-watchdog         :               : Watchdog Timer
 
 ======
@@ -41,6 +42,18 @@ Sub-nodes:
   Documentation/devicetree/bindings/regulator/regulator.txt
 
 
+- onkey : This node defines the OnKey settings for controlling the key
+  functionality of the device. The node should contain the compatible property
+  with the value "dlg,da9063-onkey".
+
+  Optional onkey properties:
+
+  - dlg,disable-key-power : Disable power-down using a long key-press. If this
+    entry exists the OnKey driver will remove support for the KEY_POWER key
+    press. If this entry does not exist then by default the key-press
+    triggered power down is enabled and the OnKey will support both KEY_POWER
+    and KEY_SLEEP.
+
 - watchdog: This node defines the settings for the watchdog driver associated
   with the DA9062 PMIC. The compatible = "dlg,da9062-watchdog" should be added
   if a node is created.
@@ -59,6 +72,11 @@ Example:
 			compatible = "dlg,da9062-watchdog";
 		};
 
+		onkey {
+			compatible = "dlg,da9063-onkey";
+			dlg,disable-key-power;
+		};
+
 		regulators {
 			DA9062_BUCK1: buck1 {
 				regulator-name = "BUCK1";
Signature · 1 line
end-of-patch for PATCH V2
#5 lore raw

Re: [PATCH V2 3/3] devicetree: da9062: Add device tree bindings for DA9062 OnKey

Quoted 32 lines · S Twiss

From: S Twiss <[email protected]>

Add device tree bindings for the DA9062 OnKey driver component

---
Checks performed with linux-next/next-20150708/scripts/checkpatch.pl
da9062.txt total: 0 errors, 0 warnings, 97 lines checked
This patch applies against linux-next and next-20150708

 Documentation/devicetree/bindings/mfd/da9062.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
Documentation/devicetree/bindings/mfd/da9062.txt +2 -0
index 5765ed9..7752093 100644
@@ -5,6 +5,7 @@ DA9062 consists of a large and varied group of sub-devices:
 Device                   Supply Names    Description
 ------                   ------------    -----------
 da9062-regulator        :               : LDOs & BUCKs
+da9062-onkey            :               : On Key
 da9062-watchdog         :               : Watchdog Timer
 
 ======
@@ -41,6 +42,18 @@ Sub-nodes:
   Documentation/devicetree/bindings/regulator/regulator.txt
 
 
+- onkey : This node defines the OnKey settings for controlling the key

Documentation/devicetree/bindings/mfd/da9062.txt Sub-nodes: · line 55

Quoted 10 lines
Documentation/devicetree/bindings/mfd/da9062.txt +10 -0
+  functionality of the device. The node should contain the compatible property
+  with the value "dlg,da9063-onkey".
+
+  Optional onkey properties:
+
+  - dlg,disable-key-power : Disable power-down using a long key-press. If this
+    entry exists the OnKey driver will remove support for the KEY_POWER key
+    press. If this entry does not exist then by default the key-press
+    triggered power down is enabled and the OnKey will support both KEY_POWER
+    and KEY_SLEEP.

Child driver specifics should be separated out into other SS' documents, in this case ../input.

Quoted 15 lines
Documentation/devicetree/bindings/mfd/da9062.txt +5 -0
 - watchdog: This node defines the settings for the watchdog driver associated
   with the DA9062 PMIC. The compatible = "dlg,da9062-watchdog" should be added
   if a node is created.
@@ -59,6 +72,11 @@ Example:
 			compatible = "dlg,da9062-watchdog";
 		};
 
+		onkey {
+			compatible = "dlg,da9063-onkey";
+			dlg,disable-key-power;
+		};
+
 		regulators {
 			DA9062_BUCK1: buck1 {
 				regulator-name = "BUCK1";
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