Add OnKey support for DA9063
Subsystems (5)
v4 cover Add OnKey support for DA9063
From: Steve Twiss <[email protected]>
This patch set adds OnKey driver support for the Dialog Semiconductor DA9063 PMIC.
[PATCH V4 1/3]: kernel driver onkey support
[PATCH V4 2/3]: device tree bindings document
[PATCH V4 3/3]: mfd core support
Thank you,
Steve Twiss, Dialog Semiconductor Ltd.
S Twiss (3):
input: misc: da9063: OnKey driver
devicetree: Add bindings for DA9063 OnKey
mfd: da9063: MFD support for OnKey driver
Documentation/devicetree/bindings/mfd/da9063.txt | 18 ++ drivers/input/misc/Kconfig | 10 + drivers/input/misc/Makefile | 1 + drivers/input/misc/da9063_onkey.c | 227 +++++++++++++++++++++++ drivers/mfd/da9063-core.c | 54 ++++++ include/linux/mfd/da9063/pdata.h | 1 + 6 files changed, 311 insertions(+) create mode 100644 drivers/input/misc/da9063_onkey.c
Signature · 1 line
end-of-patch for PATCH V4
PATCH v4 1/3 input: misc: da9063: OnKey driver
From: Steve Twiss <[email protected]>
Add OnKey driver support for DA9063
---
The changes made here have been taken from the DA9062 OnKey review thread. Please see https://lkml.org/lkml/2015/4/29/406 for more information on this.
Version History
Changes in V4
- No change
Changes in V3
- Move the MFD code changes into a separate patch [PATCH V3 3/3]
- Rename OnKey driver to use underscore: da9063_onkey.c
- Header and MODULE_LICENSE macro update for GPL and filename change
- Remove MAINTAINERS file (no longer needed due to rename of onkey driver)
- Delete input_unregister_device call from platform driver remove function
- Replaced dev_notice() with dev_dbg() for key press notification
Changes in V2
- Remove the circular dependency comment in the main e-mail body linking PATCH V1 1/2 and 2/2
- Alter the copyright header information to match expected GPLv2 text from http://www.gnu.org/licenses/gpl-2.0.html
This patch applies against linux-next and v4.1-rc3
drivers/input/misc/Kconfig | 10 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/da9063_onkey.c | 227 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 drivers/input/misc/da9063_onkey.c
drivers/input/misc/Kconfig +10 -0
@@ -610,6 +610,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
@@ -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_E3X0_BUTTON) += e3x0-button.o obj-$(CONFIG_INPUT_DRV260X_HAPTICS) += drv260x.o
drivers/input/misc/da9063_onkey.c new file +227 -0
227 lines not on this page · raw message
Signature · 1 line
end-of-patch for PATCH V4
PATCH v4 2/3 devicetree: Add bindings for DA9063 OnKey
In reply to S TwissFrom: Steve Twiss <[email protected]>
Add device tree bindings for the DA9063 OnKey driver
---
Version History
Changes in V4
- No change
Changes in V3
- No change
Changes in V2
- Remove the circular dependency comment linking patches in the main e-mail
- Search and replace 'keyword' with 'property' in onkey sub-node description
- Reformat onkey sub-node content to move the description for key-power into a new optional properties sub-section so it has a more promiment position
This patch applies against linux-next and v4.1-rc3
Documentation/devicetree/bindings/mfd/da9063.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Documentation/devicetree/bindings/mfd/da9063.txt +18 -0
@@ -5,6 +5,7 @@ DA9093 consists of a large and varied group of sub-devices (I2C Only): Device Supply Names Description ------ ------------ ----------- da9063-regulator : : LDOs & BUCKs +da9063-onkey : : On Key da9063-rtc : : Real-Time Clock da9063-watchdog : : Watchdog
@@ -51,6 +52,18 @@ Sub-nodes: the DA9063. There are currently no entries in this binding, however compatible = "dlg,da9063-rtc" should be added if a node is created. +- 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 settings for the Watchdog timer associated with the DA9063. There are currently no entries in this binding, however compatible = "dlg,da9063-watchdog" should be added if a node is created.
@@ -73,6 +86,11 @@ Example: compatible = "dlg,da9063-watchdog"; }; + onkey { + compatible = "dlg,da9063-onkey"; + dlg,disable-key-power; + }; + regulators { DA9063_BCORE1: bcore1 { regulator-name = "BCORE1";
Signature · 1 line
end-of-patch for PATCH V4
Re: [PATCH V4 2/3] devicetree: Add bindings for DA9063 OnKey
Quoted 22 lines · S Twiss
From: Steve Twiss <[email protected]>
Add device tree bindings for the DA9063 OnKey driver
Signed-off-by Steve Twiss <[email protected]>---
Version HistoryChanges in V4
- No changeChanges in V3
- No changeChanges in V2
- Remove the circular dependency comment linking patches in the main e-mail
- Search and replace 'keyword' with 'property' in onkey sub-node description
- Reformat onkey sub-node content to move the description for key-power into a new optional properties sub-section so it has a more promiment position
Quoted 5 lines
This patch applies against linux-next and v4.1-rc3
Documentation/devicetree/bindings/mfd/da9063.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
I'll wait to see what Dmitry has to say before applying, but for my own reference:
Quoted 43 lines
Documentation/devicetree/bindings/mfd/da9063.txt +18
-0@@ -5,6 +5,7 @@ DA9093 consists of a large and varied group of sub-devices (I2C Only): Device Supply Names Description ------ ------------ ----------- da9063-regulator : : LDOs & BUCKs +da9063-onkey : : On Key da9063-rtc : : Real-Time Clock da9063-watchdog : : Watchdog@@ -51,6 +52,18 @@ Sub-nodes: the DA9063. There are currently no entries in this binding, however compatible = "dlg,da9063-rtc" should be added if a node is created. +- 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 settings for the Watchdog timer associated with the DA9063. There are currently no entries in this binding, however compatible = "dlg,da9063-watchdog" should be added if a node is created.@@ -73,6 +86,11 @@ Example: compatible = "dlg,da9063-watchdog"; }; + onkey { + compatible = "dlg,da9063-onkey"; + dlg,disable-key-power; + }; + regulators { DA9063_BCORE1: bcore1 { regulator-name = "BCORE1";
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v4 3/3 mfd: da9063: MFD support for OnKey driver
In reply to S TwissFrom: Steve Twiss <[email protected]>
Add MFD support for the DA9063 OnKey driver
The function da9063_clear_fault_log() is added to mitigate the case of a hardware power-cut after a long-long OnKey press. Although there is no software intervention in this case (by definition) such a shutdown would cause persistent information within the DA9063 FAULT_LOG that would be available during the next device restart.
Clearance of this persistent register must be completed after such a hardware power-cut operation has happened so that the FAULT_LOG does not continue with previous values. The clearance function has been added here in the kernel driver because wiping the fault-log cannot be counted on outside the Linux kernel.
---
Version History
Changes in V4
- Additional description of MFD patch changes for FAULT_LOG in relation to the requirements of the OnKey driver. Please see a further explanation of the OnKey's operation in this thread: https://lkml.org/lkml/2015/4/29/406
Changes in V3
- The MFD code was originally in [PATCH V2 1/2]. This is now been moved into this patch [PATCH V3 3/3].
- Whitespace cleanup
This patch applies against linux-next and v4.1-rc3
drivers/mfd/da9063-core.c | 54 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/da9063/pdata.h | 1 + 2 files changed, 55 insertions(+)
drivers/mfd/da9063-core.c +54 -0
@@ -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 ,
@@ -97,6 +98,7 @@ static const struct mfd_cell da9063_devs[] = { .name = DA9063_DRVNAME_ONKEY, .num_resources = ARRAY_SIZE(da9063_onkey_resources), .resources = da9063_onkey_resources, + .of_compatible = "dlg,da9063-onkey", }, { .name = DA9063_DRVNAME_RTC,
@@ -109,12 +111,64 @@ static const struct mfd_cell da9063_devs[] = { }, }; +static int da9063_clear_fault_log (struct da9063 *da9063) +{ +int ret =0 ; +int fault_log =0 ; + + ret =regmap_read (da9063->regmap,DA9063_REG_FAULT_LOG , &fault_log); +if (ret <0 ) { +dev_err (da9063->dev,"Cannot read FAULT_LOG.\n" ); +return -EIO ; + } + +if (fault_log) { +if (fault_log &DA9063_TWD_ERROR ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_TWD_ERROR\n" ); +if (fault_log &DA9063_POR ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_POR\n" ); +if (fault_log &DA9063_VDD_FAULT ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_VDD_FAULT\n" ); +if (fault_log &DA9063_VDD_START ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_VDD_START\n" ); +if (fault_log &DA9063_TEMP_CRIT ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_TEMP_CRIT\n" ); +if (fault_log &DA9063_KEY_RESET ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_KEY_RESET\n" ); +if (fault_log &DA9063_NSHUTDOWN ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_NSHUTDOWN\n" ); +if (fault_log &DA9063_WAIT_SHUT ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_WAIT_SHUT\n" ); + } + + ret =regmap_write (da9063->regmap, +DA9063_REG_FAULT_LOG , + fault_log); +if (ret <0 ) +dev_err (da9063->dev, +"Cannot reset FAULT_LOG values %d\n" , ret); + +return ret; +} +int da9063_device_init (struct da9063 *da9063,unsigned int irq) {struct da9063_pdata *pdata = da9063->dev->platform_data;int model, variant_id, variant_code;int ret; + ret =da9063_clear_fault_log (da9063); +if (ret <0 ) +dev_err (da9063->dev,"Cannot clear fault log\n" ); +if (pdata) { da9063->flags = pdata->flags; da9063->irq_base = pdata->irq_base;
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;
Signature · 1 line
end-of-patch for PATCH V4
Re: [PATCH V4 3/3] mfd: da9063: MFD support for OnKey driver
Quoted 32 lines · S Twiss
From: Steve Twiss <[email protected]>
Add MFD support for the DA9063 OnKey driver
The function
da9063_clear_fault_log()is added to mitigate the case of a hardware power-cut after a long-long OnKey press. Although there is no software intervention in this case (by definition) such a shutdown would cause persistent information within the DA9063FAULT_LOGthat would be available during the next device restart.Clearance of this persistent register must be completed after such a hardware power-cut operation has happened so that the
FAULT_LOGdoes not continue with previous values. The clearance function has been added here in the kernel driver because wiping the fault-log cannot be counted on outside the Linux kernel.Signed-off-by Steve Twiss <[email protected]>---
Version HistoryChanges in V4
- Additional description of MFD patch changes forFAULT_LOGin relation to the requirements of the OnKey driver. Please see a further explanation of the OnKey's operation in this thread: https://lkml.org/lkml/2015/4/29/406Changes in V3
- The MFD code was originally in [PATCH V2 1/2]. This is now been moved into this patch [PATCH V3 3/3].
- Whitespace cleanup
Quoted 6 lines
This patch applies against linux-next and v4.1-rc3
drivers/mfd/da9063-core.c | 54 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/da9063/pdata.h | 1 + 2 files changed, 55 insertions(+)
I'll wait to see what Dmitry has to say before applying, but for my own reference:
Quoted 97 lines
drivers/mfd/da9063-core.c +54
-0@@ -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 ,@@ -97,6 +98,7 @@ static const struct mfd_cell da9063_devs[] = { .name = DA9063_DRVNAME_ONKEY, .num_resources = ARRAY_SIZE(da9063_onkey_resources), .resources = da9063_onkey_resources, + .of_compatible = "dlg,da9063-onkey", }, { .name = DA9063_DRVNAME_RTC,@@ -109,12 +111,64 @@ static const struct mfd_cell da9063_devs[] = { }, }; +static int da9063_clear_fault_log (struct da9063 *da9063) +{ +int ret =0 ; +int fault_log =0 ; + + ret =regmap_read (da9063->regmap,DA9063_REG_FAULT_LOG , &fault_log); +if (ret <0 ) { +dev_err (da9063->dev,"Cannot read FAULT_LOG.\n" ); +return -EIO ; + } + +if (fault_log) { +if (fault_log &DA9063_TWD_ERROR ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_TWD_ERROR\n" ); +if (fault_log &DA9063_POR ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_POR\n" ); +if (fault_log &DA9063_VDD_FAULT ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_VDD_FAULT\n" ); +if (fault_log &DA9063_VDD_START ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_VDD_START\n" ); +if (fault_log &DA9063_TEMP_CRIT ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_TEMP_CRIT\n" ); +if (fault_log &DA9063_KEY_RESET ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_KEY_RESET\n" ); +if (fault_log &DA9063_NSHUTDOWN ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_NSHUTDOWN\n" ); +if (fault_log &DA9063_WAIT_SHUT ) +dev_dbg (da9063->dev, +"Fault log entry detected: DA9063_WAIT_SHUT\n" ); + } + + ret =regmap_write (da9063->regmap, +DA9063_REG_FAULT_LOG , + fault_log); +if (ret <0 ) +dev_err (da9063->dev, +"Cannot reset FAULT_LOG values %d\n" , ret); + +return ret; +} +int da9063_device_init (struct da9063 *da9063,unsigned int irq) {struct da9063_pdata *pdata = da9063->dev->platform_data;int model, variant_id, variant_code;int ret; + ret =da9063_clear_fault_log (da9063); +if (ret <0 ) +dev_err (da9063->dev,"Cannot clear fault log\n" ); +if (pdata) { da9063->flags = pdata->flags; da9063->irq_base = pdata->irq_base;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;
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
RE: [PATCH V4 3/3] mfd: da9063: MFD support for OnKey driver
T24gMTMgTWF5IDIwMTUgMTE6MzUgTGVlIEpvbmVzIHdyb3RlOg0KDQo+ID4gRnJvbTogU3RldmUg VHdpc3MgPHN0d2lzcy5vcGVuc291cmNlQGRpYXNlbWkuY29tPg0KPiA+DQo+ID4gQWRkIE1GRCBz dXBwb3J0IGZvciB0aGUgREE5MDYzIE9uS2V5IGRyaXZlcg0KPiA+DQo+ID4gVGhlIGZ1bmN0aW9u IGRhOTA2M19jbGVhcl9mYXVsdF9sb2coKSBpcyBhZGRlZCB0byBtaXRpZ2F0ZSB0aGUgY2FzZSBv ZiBhDQo+ID4gaGFyZHdhcmUgcG93ZXItY3V0IGFmdGVyIGEgbG9uZy1sb25nIE9uS2V5IHByZXNz LiBBbHRob3VnaCB0aGVyZSBpcyBubw0KPiA+IHNvZnR3YXJlIGludGVydmVudGlvbiBpbiB0aGlz IGNhc2UgKGJ5IGRlZmluaXRpb24pIHN1Y2ggYSBzaHV0ZG93biB3b3VsZA0KPiA+IGN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gb3du IHJlZmVyZW5jZToNCg0KVW5kZXJzdG9vZC4NClRoYW5rIHlvdS4NCg0KPiBBY2tlZC1ieTogTGVl IEpvbmVzIDxsZWUuam9uZXNAbGluYXJvLm9yZz4NCg0KVGhhbmtzIGZvciB0aGlzIEFjay4NCkFu ZCBmb3IgW1BBVENIIFY0IDIvM10gZGV2aWNldHJlZTogQWRkIGJpbmRpbmdzIGZvciBEQTkwNjMg T25LZXkNCg0KUmVnYXJkcywNClN0ZXZlDQoNCg==
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html