da9062: Add DA9062 RTC support using the existing DA9063 RTC driver
Subsystems (5)
v3 cover da9062: Add DA9062 RTC support using the existing DA9063 RTC driver
From: S Twiss <[email protected]>
This patch set adds RTC support for the Dialog DA9062 Power Management IC. Changes are made to the existing DA9063 RTC component so that functionality in this device driver can be re-used to support the DA9062 RTC.
This following patch set is the proposed method for re-using existing kernel RTC drivers for chips whose RTC blocks are functionally similar to the DA9063 RTC.
There is already a precedence for reuse of this type in the kernel, see linux-mainline/v4.1 drivers/rtc/rtc-pm8xxx.c +34
This patch set will follow that example.
The main points for the MFD core and device tree changes are as follows.
- Alteration of the DA9063 RTC Kconfig needs to be updated to depend on both MFD_DA9063 "or" MFD_DA9062. There is no explicit DA9062 RTC Kconfig.
- The DA9062 MFD core should add a new RTC resource as usual and an entry in the mfd_cell to support a component name and of_compatible for "da9062-rtc" and "dlg,da9062-rtc".
- The device tree binding support should include a compatible string for "dlg,da9062-rtc"
The main points for the RTC changes are as follows:
A generic structure is used (called da9063_compatible_rtc_regmap) to hold all generic registers and bitmasks for use with this type of RTC component.
Functions in the DA9063 RTC 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 RTC driver is created through the use of an of_match_table entry in the platform_driver structure. A re-work of da9063_rtc_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. This method of initialisation for the DA9063 RTC component works well for different chip types, and is only slightly complicated when distinguishing the difference between support for DA9063-AD and DA9063-BB.
In this patch set the following is provided:
- [PATCH V3 1/3]: MFD changes in DA9062 to support RTC
- [PATCH V3 2/3]: Device tree bindings for DA9062 RTC component
- [PATCH V3 3/3]: Update existing DA9063 RTC to add DA9062 support
This patch applies against linux-next and next-20150708
Thank you,
Steve Twiss, Dialog Semiconductor Ltd.
Changes in V2:
- Reorder patches RFC PATCH 3/3 and 2/3 to remove the checkpatch warning
Quoted 1 line
WARNING: DT compatible string "dlg,da9062-rtc" appears un-documented
S Twiss (3):
mfd: da9062: Support for the DA9063 RTC in the DA9062 core
devicetree: da9062: Add device tree bindings for DA9062 RTC
rtc: da9063: Add DA9062 RTC capability to DA9063 RTC driver
Documentation/devicetree/bindings/mfd/da9062.txt | 9 + drivers/mfd/da9062-core.c | 11 + drivers/rtc/Kconfig | 6 +- drivers/rtc/rtc-da9063.c | 391 ++++++++++++++++------- 4 files changed, 302 insertions(+), 115 deletions(-)
Signature · 6 lines
end-of-patch for PATCH V3 -- 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
PATCH v3 1/3 mfd: da9062: Support for the DA9063 RTC in the DA9062 core
From: S Twiss <[email protected]>
Add MFD core driver support for a RTC component
- MFD core adds the RTC resources da9062_rtc_resources[] for the RTC alarm and tick timer IRQ
- An appropriate mfd_cell has been added into da9062_devs[] to support a component .name = "da9062-rtc" and .of_compatible = "dlg,da9062-rtc"
---
Checks performed with linux-next/next-20150708/scripts/checkpatch.pl
da9062-core.c total: 0 errors, 0 warnings, 523 lines checked
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
@@ -118,6 +118,11 @@ static struct resource da9062_wdt_resources[] = { DEFINE_RES_NAMED(DA9062_IRQ_WDG_WARN, 1, "WD_WARN", IORESOURCE_IRQ), }; +static struct resource da9062_rtc_resources[] = { +DEFINE_RES_NAMED (DA9062_IRQ_ALARM ,1 ,"ALARM" ,IORESOURCE_IRQ ), +DEFINE_RES_NAMED (DA9062_IRQ_TICK ,1 ,"TICK" ,IORESOURCE_IRQ ), +}; +static const struct mfd_cell da9062_devs[] = { { .name ="da9062-core" ,
@@ -141,6 +146,12 @@ static const struct mfd_cell da9062_devs[] = { .resources = da9062_thermal_resources, .of_compatible = "dlg,da9062-thermal", }, + { + .name = "da9062-rtc", + .num_resources = ARRAY_SIZE(da9062_rtc_resources), + .resources = da9062_rtc_resources, + .of_compatible = "dlg,da9062-rtc", + }, };static int da9062_clear_fault_log (struct da9062 *chip)
Signature · 1 line
end-of-patch for PATCH V3
Lee Jones
AppliedRe: [PATCH V3 1/3] mfd: da9062: Support for the DA9063 RTC in the DA9062 core
Quoted 11 lines · S Twiss
From: S Twiss <[email protected]>
Add MFD core driver support for a RTC component
- MFD core adds the RTC resources da9062_rtc_resources[] for the RTC alarm and tick timer IRQ
- An appropriatemfd_cellhas been added into da9062_devs[] to support a component .name = "da9062-rtc" and .of_compatible = "dlg,da9062-rtc"Signed-off-by Steve Twiss <[email protected]>
Quoted 8 lines
---
Checks performed withlinux-next/next-20150708/scripts/checkpatch.pl
da9062-core.ctotal: 0 errors, 0 warnings, 523 lines checked
This patch applies against linux-next and next-20150708drivers/mfd/da9062-core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
Applied, thanks.
Quoted 29 lines
drivers/mfd/da9062-core.c +11
-0@@ -118,6 +118,11 @@ static struct resource da9062_wdt_resources[] = { DEFINE_RES_NAMED(DA9062_IRQ_WDG_WARN, 1, "WD_WARN", IORESOURCE_IRQ), }; +static struct resource da9062_rtc_resources[] = { +DEFINE_RES_NAMED (DA9062_IRQ_ALARM ,1 ,"ALARM" ,IORESOURCE_IRQ ), +DEFINE_RES_NAMED (DA9062_IRQ_TICK ,1 ,"TICK" ,IORESOURCE_IRQ ), +}; +static const struct mfd_cell da9062_devs[] = { { .name ="da9062-core" ,@@ -141,6 +146,12 @@ static const struct mfd_cell da9062_devs[] = { .resources = da9062_thermal_resources, .of_compatible = "dlg,da9062-thermal", }, + { + .name = "da9062-rtc", + .num_resources = ARRAY_SIZE(da9062_rtc_resources), + .resources = da9062_rtc_resources, + .of_compatible = "dlg,da9062-rtc", + }, };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
PATCH v3 2/3 devicetree: da9062: Add device tree bindings for DA9062 RTC
In reply to S TwissFrom: S Twiss <[email protected]>
Add device tree bindings for the DA9062 RTC driver component
---
Checks performed with linux-next/next-20150708/scripts/checkpatch.pl
da9062.txt total: 0 errors, 0 warnings, 88 lines checked
This patch applies against linux-next and next-20150708
Documentation/devicetree/bindings/mfd/da9062.txt | 9 +++++++++ 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/mfd/da9062.txt +9 -0
@@ -5,6 +5,7 @@ DA9062 consists of a large and varied group of sub-devices: Device Supply Names Description ------ ------------ ----------- da9062-regulator : : LDOs & BUCKs +da9062-rtc : : Real-Time Clock da9062-watchdog : : Watchdog Timer ======
@@ -41,6 +42,10 @@ Sub-nodes: Documentation/devicetree/bindings/regulator/regulator.txt +- rtc : This node defines settings required for the Real-Time Clock associated + with the DA9062. There are currently no entries in this binding, however + compatible = "dlg,da9062-rtc" should be added if a node is created. + - 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.
@@ -55,6 +60,10 @@ Example: interrupts = <11 IRQ_TYPE_LEVEL_LOW>; interrupt-controller; + rtc { + compatible = "dlg,da9062-rtc"; + }; + watchdog { compatible = "dlg,da9062-watchdog"; };
Signature · 1 line
end-of-patch for PATCH V3
Lee Jones
AppliedRe: [PATCH V3 2/3] devicetree: da9062: Add device tree bindings for DA9062 RTC
Quoted 6 lines · S Twiss
From: S Twiss <[email protected]>
Add device tree bindings for the DA9062 RTC driver component
Signed-off-by Steve Twiss <[email protected]>
Quoted 8 lines
---
Checks performed withlinux-next/next-20150708/scripts/checkpatch.pl
da9062.txt total: 0 errors, 0 warnings, 88 lines checked
This patch applies against linux-next and next-20150708Documentation/devicetree/bindings/mfd/da9062.txt | 9 +++++++++ 1 file changed, 9 insertions(+)
Applied, thanks.
Quoted 34 lines
Documentation/devicetree/bindings/mfd/da9062.txt +9
-0@@ -5,6 +5,7 @@ DA9062 consists of a large and varied group of sub-devices: Device Supply Names Description ------ ------------ ----------- da9062-regulator : : LDOs & BUCKs +da9062-rtc : : Real-Time Clock da9062-watchdog : : Watchdog Timer ======@@ -41,6 +42,10 @@ Sub-nodes: Documentation/devicetree/bindings/regulator/regulator.txt +- rtc : This node defines settings required for the Real-Time Clock associated + with the DA9062. There are currently no entries in this binding, however + compatible = "dlg,da9062-rtc" should be added if a node is created. + - 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.@@ -55,6 +60,10 @@ Example: interrupts = <11 IRQ_TYPE_LEVEL_LOW>; interrupt-controller; + rtc { + compatible = "dlg,da9062-rtc"; + }; + watchdog { compatible = "dlg,da9062-watchdog"; };
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 devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 3/3 rtc: da9063: Add DA9062 RTC capability to DA9063 RTC driver
In reply to S TwissFrom: S Twiss <[email protected]>
Add DA9062 RTC support into the existing DA9063 RTC 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 RTC. The changes are slightly complicated by requiring support for three register sets: DA9063-AD, DA9063-BB and DA9062-AA.
The following alterations have been made to the DA9063 RTC:
- Addition of a da9063_compatible_rtc_regmap structure to hold all generic registers and bitmasks for this type of RTC component.
- A re-write of struct da9063 to use pointers for regmap and compatible registers/masks definitions
- Addition of a of_device_id table for DA9063 and DA9062 defaults
- Refactoring functions to use struct da9063_compatible_rtc accesses to generic registers/masks instead of using defines from registers.h
- Re-work of da9063_rtc_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, 15 warnings, 1600 lines checked
rtc-da9063.c total: 0 errors, 0 warnings, 519 lines checked
Changes in V3:
- Revert MODULE_LICENSE("GPL v2") in the license change
- Remove the need for an else branch and make rtc->config = match->data explicitly assign BB silicon by default.
- Remove extra brackets in if (val & (config->rtc_event_alarm_mask))
Changes in V2:
- Remove the re-try when reading the RTC inside da9063_rtc_read_time()
- Revert the copyright header change
- Remove strncmp in favour of of_device_is_compatible()
- Do not check for NULL struct of_device_id * return from of_match_node()
- Make a check for the existance of pdev->dev.of_node
This patch applies against linux-next and next-20150708
drivers/rtc/Kconfig | 6 +- drivers/rtc/rtc-da9063.c | 391 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 282 insertions(+), 115 deletions(-)
drivers/rtc/Kconfig +3 -3
@@ -945,11 +945,11 @@ config RTC_DRV_DA9055 will be called rtc-da9055 config RTC_DRV_DA9063 - tristate "Dialog Semiconductor DA9063 RTC" - depends on MFD_DA9063 + tristate "Dialog Semiconductor DA9063/DA9062 RTC" + depends on MFD_DA9063 || MFD_DA9062 help If you say yes here you will get support for the RTC subsystem - of the Dialog Semiconductor DA9063. + for the Dialog Semiconductor PMIC chips DA9063 and DA9062. This driver can also be built as a module. If so, the module will be called "rtc-da9063".
drivers/rtc/rtc-da9063.c +279 -112
569 lines not on this page · raw message
Signature · 1 line
end-of-patch for PATCH V3
Alexandre Belloni
AppliedRe: [PATCH V3 3/3] rtc: da9063: Add DA9062 RTC capability to DA9063 RTC driver
Quoted 22 lines · S Twiss
From: S Twiss <[email protected]>
Add DA9062 RTC support into the existing DA9063 RTC 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 RTC. The changes are slightly complicated by requiring support for three register sets: DA9063-AD, DA9063-BB and DA9062-AA.
The following alterations have been made to the DA9063 RTC:
- Addition of a
da9063_compatible_rtc_regmapstructure to hold all generic registers and bitmasks for this type of RTC component.
- A re-write of struct da9063 to use pointers for regmap and compatible registers/masks definitions
- Addition of aof_device_idtable for DA9063 and DA9062 defaults
- Refactoring functions to use structda9063_compatible_rtcaccesses to generic registers/masks instead of using defines fromregisters.h
- Re-work ofda9063_rtc_probe()to useof_match_node()anddev_get_regmap()to provide initialisation of generic registers and masks and access to regmap
Quoted 2 lines
Signed-off-by Steve Twiss <[email protected]>
Applied, thanks.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
RE: [PATCH V3 3/3] rtc: da9063: Add DA9062 RTC capability to DA9063 RTC driver
Quoted 25 lines · On 05 August 2015 02:55 Alexandre Belloni wrote:
Subject: Re: [PATCH V3 3/3] rtc: da9063: Add DA9062 RTC capability to DA9063 RTC driver
Quoted 22 lines · S Twiss
From: S Twiss <[email protected]>
Add DA9062 RTC support into the existing DA9063 RTC 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 RTC. The changes are slightly complicated by requiring support for three register sets: DA9063-AD, DA9063-BB and DA9062-AA.
The following alterations have been made to the DA9063 RTC:
- Addition of a
da9063_compatible_rtc_regmapstructure to hold all generic registers and bitmasks for this type of RTC component.
- A re-write of struct da9063 to use pointers for regmap and compatible registers/masks definitions
- Addition of aof_device_idtable for DA9063 and DA9062 defaults
- Refactoring functions to use structda9063_compatible_rtcaccesses to generic registers/masks instead of using defines fromregisters.h
- Re-work ofda9063_rtc_probe()to useof_match_node()anddev_get_regmap()to provide initialisation of generic registers and masks and access to regmap
Quoted 3 lines
Quoted 2 lines
Signed-off-by Steve Twiss <[email protected]>Applied, thanks.
Thank you.