This series adds support for regulator supply.
Changes since v2:
- Rebased on top of Johan Hovold's recent rtc cleanup series[1]
- Addressed Johan Hovold's comments.
[1] https://www.mail-archive.com/linux-kernel at vger.kernel.org/msg748519.html
Lokesh Vutla (2):
rtc: omap: use module_platform_driver
rtc: omap: Support regulator supply for RTC
Tero Kristo (1):
rtc: omap: Update Kconfig for OMAP RTC
Documentation/devicetree/bindings/rtc/rtc-omap.txt | 3 +++
drivers/rtc/Kconfig | 6 ++---
drivers/rtc/rtc-omap.c | 30 +++++++++++++++++++---
3 files changed, 33 insertions(+), 6 deletions(-)
--
1.9.1
module_platform_driver_probe() prevents driver from requesting probe deferral.
So using module_platform_drive() to support probe deferral.
And also removing .owner field which is set by module_platform_driver.
Signed-off-by: Lokesh Vutla <redacted>
---
drivers/rtc/rtc-omap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
From: Johan Hovold <johan@kernel.org> Date: 2014-10-24 07:33:46
On Fri, Oct 24, 2014 at 10:23:43AM +0530, Lokesh Vutla wrote:
module_platform_driver_probe() prevents driver from requesting probe deferral.
So using module_platform_drive() to support probe deferral.
And also removing .owner field which is set by module_platform_driver.
Signed-off-by: Lokesh Vutla <redacted>
From: Felipe Balbi <hidden> Date: 2014-10-24 15:38:17
On Fri, Oct 24, 2014 at 10:23:43AM +0530, Lokesh Vutla wrote:
module_platform_driver_probe() prevents driver from requesting probe deferral.
So using module_platform_drive() to support probe deferral.
And also removing .owner field which is set by module_platform_driver.
Signed-off-by: Lokesh Vutla <redacted>
From: Tero Kristo <redacted>
RTC is present in AM43xx and DRA7xx also. Updating the Kconfig
to depend on ARCH_OMAP or ARCH_DAVINCI
Reviewed-by: Felipe Balbi <redacted>
Signed-off-by: Lokesh Vutla <redacted>
Signed-off-by: Tero Kristo <redacted>
---
drivers/rtc/Kconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
On some Soc's RTC is powered by an external power regulator.
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Signed-off-by: Lokesh Vutla <redacted>
---
Documentation/devicetree/bindings/rtc/rtc-omap.txt | 3 +++
drivers/rtc/rtc-omap.c | 24 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
@@ -15,6 +15,8 @@ Required properties: Optional properties: - ti,system-power-controller: whether the rtc is controlling the system power through pmic_power_en+Optional Properties:+- vrtc-supply: phandle to the regulator device tree node if needed Example:
@@ -516,6 +518,22 @@ static int omap_rtc_probe(struct platform_device *pdev)platform_set_drvdata(pdev,rtc);+rtc->supply=devm_regulator_get_optional(&pdev->dev,"vrtc");+if(IS_ERR(rtc->supply)){+if(PTR_ERR(rtc->supply)==-EPROBE_DEFER)+return-EPROBE_DEFER;++rtc->supply=NULL;+}++if(rtc->supply){+ret=regulator_enable(rtc->supply);+if(ret){+dev_err(&pdev->dev,"regulator enable failed\n");+returnret;+}+}+/* Enable the clock/module so that we can access the registers */pm_runtime_enable(&pdev->dev);pm_runtime_get_sync(&pdev->dev);
From: Johan Hovold <johan@kernel.org> Date: 2014-10-24 07:53:12
On Fri, Oct 24, 2014 at 10:23:45AM +0530, Lokesh Vutla wrote:
quoted hunk
On some Soc's RTC is powered by an external power regulator.
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Signed-off-by: Lokesh Vutla <redacted>
---
Documentation/devicetree/bindings/rtc/rtc-omap.txt | 3 +++
drivers/rtc/rtc-omap.c | 24 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
@@ -15,6 +15,8 @@ Required properties: Optional properties: - ti,system-power-controller: whether the rtc is controlling the system power through pmic_power_en+Optional Properties:
No need to repeat the "Optional Properties" header.
quoted hunk
+- vrtc-supply: phandle to the regulator device tree node if needed
Example:
@@ -516,6 +518,22 @@ static int omap_rtc_probe(struct platform_device *pdev)platform_set_drvdata(pdev,rtc);
Also could you move the regulator allocation before this
platform_set_drvdata when resending? It's not required, but that call
sort of separates the allocations from the device initialisation
currently.
quoted hunk
+ rtc->supply = devm_regulator_get_optional(&pdev->dev, "vrtc");
+ if (IS_ERR(rtc->supply)) {
+ if (PTR_ERR(rtc->supply) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+
+ rtc->supply = NULL;
+ }
+
+ if (rtc->supply) {
+ ret = regulator_enable(rtc->supply);
+ if (ret) {
+ dev_err(&pdev->dev, "regulator enable failed\n");
+ return ret;
+ }
+ }
+
/* Enable the clock/module so that we can access the registers */
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
On Friday 24 October 2014 01:23 PM, Johan Hovold wrote:
On Fri, Oct 24, 2014 at 10:23:45AM +0530, Lokesh Vutla wrote:
quoted
On some Soc's RTC is powered by an external power regulator.
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Signed-off-by: Lokesh Vutla <redacted>
---
Documentation/devicetree/bindings/rtc/rtc-omap.txt | 3 +++
drivers/rtc/rtc-omap.c | 24 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
@@ -15,6 +15,8 @@ Required properties: Optional properties: - ti,system-power-controller: whether the rtc is controlling the system power through pmic_power_en+Optional Properties:
No need to repeat the "Optional Properties" header.
Oops sorry. will remove it.
quoted
+- vrtc-supply: phandle to the regulator device tree node if needed
Example:
@@ -516,6 +518,22 @@ static int omap_rtc_probe(struct platform_device *pdev)platform_set_drvdata(pdev,rtc);
Also could you move the regulator allocation before this
platform_set_drvdata when resending? It's not required, but that call
sort of separates the allocations from the device initialisation
currently.
Okay.
Thanks and regards,
Lokesh
quoted
+ rtc->supply = devm_regulator_get_optional(&pdev->dev, "vrtc");
+ if (IS_ERR(rtc->supply)) {
+ if (PTR_ERR(rtc->supply) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+
+ rtc->supply = NULL;
+ }
+
+ if (rtc->supply) {
+ ret = regulator_enable(rtc->supply);
+ if (ret) {
+ dev_err(&pdev->dev, "regulator enable failed\n");
+ return ret;
+ }
+ }
+
/* Enable the clock/module so that we can access the registers */
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
From: Felipe Balbi <hidden> Date: 2014-10-24 15:40:17
Hi,
On Fri, Oct 24, 2014 at 09:53:12AM +0200, Johan Hovold wrote:
On Fri, Oct 24, 2014 at 10:23:45AM +0530, Lokesh Vutla wrote:
quoted
On some Soc's RTC is powered by an external power regulator.
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Signed-off-by: Lokesh Vutla <redacted>
---
Documentation/devicetree/bindings/rtc/rtc-omap.txt | 3 +++
drivers/rtc/rtc-omap.c | 24 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
@@ -15,6 +15,8 @@ Required properties: Optional properties: - ti,system-power-controller: whether the rtc is controlling the system power through pmic_power_en+Optional Properties:
No need to repeat the "Optional Properties" header.
quoted
+- vrtc-supply: phandle to the regulator device tree node if needed
Example:
@@ -516,6 +518,22 @@ static int omap_rtc_probe(struct platform_device *pdev)platform_set_drvdata(pdev,rtc);
Also could you move the regulator allocation before this
platform_set_drvdata when resending? It's not required, but that call
sort of separates the allocations from the device initialisation
currently.
quoted
+ rtc->supply = devm_regulator_get_optional(&pdev->dev, "vrtc");
+ if (IS_ERR(rtc->supply)) {
+ if (PTR_ERR(rtc->supply) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+
+ rtc->supply = NULL;
+ }
+
+ if (rtc->supply) {
+ ret = regulator_enable(rtc->supply);
+ if (ret) {
+ dev_err(&pdev->dev, "regulator enable failed\n");
+ return ret;
+ }
+ }
+
/* Enable the clock/module so that we can access the registers */
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
On some Soc's RTC is powered by an external power regulator.
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Lokesh Vutla <redacted>
---
Changes since v3:
- Removed extra Optional properties header.
- Moved regulator get before platform_set_drvdatai() as suggested by Johan
Documentation/devicetree/bindings/rtc/rtc-omap.txt | 2 ++
drivers/rtc/rtc-omap.c | 24 ++++++++++++++++++++++
2 files changed, 26 insertions(+)
@@ -15,6 +15,7 @@ Required properties: Optional properties: - ti,system-power-controller: whether the rtc is controlling the system power through pmic_power_en+- vrtc-supply: phandle to the regulator device tree node if needed Example:
@@ -514,6 +516,22 @@ static int omap_rtc_probe(struct platform_device *pdev)if(IS_ERR(rtc->base))returnPTR_ERR(rtc->base);+rtc->supply=devm_regulator_get_optional(&pdev->dev,"vrtc");+if(IS_ERR(rtc->supply)){+if(PTR_ERR(rtc->supply)==-EPROBE_DEFER)+return-EPROBE_DEFER;++rtc->supply=NULL;+}++if(rtc->supply){+ret=regulator_enable(rtc->supply);+if(ret){+dev_err(&pdev->dev,"regulator enable failed\n");+returnret;+}+}+platform_set_drvdata(pdev,rtc);/* Enable the clock/module so that we can access the registers */
From: Felipe Balbi <hidden> Date: 2014-10-24 15:40:42
On Fri, Oct 24, 2014 at 01:37:34PM +0530, Lokesh Vutla wrote:
On some Soc's RTC is powered by an external power regulator.
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Lokesh Vutla <redacted>
oh sorry, there was already a new version:
Reviewed-by: Felipe Balbi <redacted>
quoted hunk
---
Changes since v3:
- Removed extra Optional properties header.
- Moved regulator get before platform_set_drvdatai() as suggested by Johan
Documentation/devicetree/bindings/rtc/rtc-omap.txt | 2 ++
drivers/rtc/rtc-omap.c | 24 ++++++++++++++++++++++
2 files changed, 26 insertions(+)
@@ -15,6 +15,7 @@ Required properties: Optional properties: - ti,system-power-controller: whether the rtc is controlling the system power through pmic_power_en+- vrtc-supply: phandle to the regulator device tree node if needed Example:
@@ -514,6 +516,22 @@ static int omap_rtc_probe(struct platform_device *pdev)if(IS_ERR(rtc->base))returnPTR_ERR(rtc->base);+rtc->supply=devm_regulator_get_optional(&pdev->dev,"vrtc");+if(IS_ERR(rtc->supply)){+if(PTR_ERR(rtc->supply)==-EPROBE_DEFER)+return-EPROBE_DEFER;++rtc->supply=NULL;+}++if(rtc->supply){+ret=regulator_enable(rtc->supply);+if(ret){+dev_err(&pdev->dev,"regulator enable failed\n");+returnret;+}+}+platform_set_drvdata(pdev,rtc);/* Enable the clock/module so that we can access the registers */
On some Soc's RTC is powered by an external power regulator.
SoC ? -> could you rephrase this to indicate "certain SoCs such as
DRA7, RTC is an independent voltage domain of it's own and on
platforms such as DRA7-evm, this may be supplied by individual
regulator on it's own.
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Question ofcourse is what voltage would you like that regulator to be
at? As you are aware, certain LDOs and SMPS can drive varying voltage
and just enable/disable would do just the default voltage of the
SMPS/LDO, right? OR am i missing something here?
@@ -15,6 +15,8 @@ Required properties: Optional properties: - ti,system-power-controller: whether the rtc is controlling the system power through pmic_power_en+Optional Properties:
^^ already commented on..
+- vrtc-supply: phandle to the regulator device tree node if needed
"phandle to supply regulator" ? since it is optional, "if needed" is
redundant?
From: Felipe Balbi <hidden> Date: 2014-10-24 15:43:12
On Fri, Oct 24, 2014 at 08:26:43AM -0500, Nishanth Menon wrote:
On 10/23/2014 11:53 PM, Lokesh Vutla wrote:
quoted
On some Soc's RTC is powered by an external power regulator.
SoC ? -> could you rephrase this to indicate "certain SoCs such as
DRA7, RTC is an independent voltage domain of it's own and on
platforms such as DRA7-evm, this may be supplied by individual
regulator on it's own.
quoted
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Question ofcourse is what voltage would you like that regulator to be
at? As you are aware, certain LDOs and SMPS can drive varying voltage
and just enable/disable would do just the default voltage of the
SMPS/LDO, right? OR am i missing something here?
just pass the correct voltage through DTS as we do for all other
regulators ? It's only tricky when we have a range of acceptable
voltages but for RTC, IIRC, it's always a set voltage (1.0V or 1.8V).
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141024/9f6a78a9/attachment.sig>
On Fri, Oct 24, 2014 at 08:26:43AM -0500, Nishanth Menon wrote:
quoted
On 10/23/2014 11:53 PM, Lokesh Vutla wrote:
quoted
On some Soc's RTC is powered by an external power regulator.
SoC ? -> could you rephrase this to indicate "certain SoCs such as
DRA7, RTC is an independent voltage domain of it's own and on
platforms such as DRA7-evm, this may be supplied by individual
regulator on it's own.
quoted
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Question ofcourse is what voltage would you like that regulator to be
at? As you are aware, certain LDOs and SMPS can drive varying voltage
and just enable/disable would do just the default voltage of the
SMPS/LDO, right? OR am i missing something here?
just pass the correct voltage through DTS as we do for all other
regulators ? It's only tricky when we have a range of acceptable
voltages but for RTC, IIRC, it's always a set voltage (1.0V or 1.8V).
you mean min=max=1.8V board constraint - sure it will work, except I
might expect to see that in the example? OR expect the driver to
explicitly set it.
--
Regards,
Nishanth Menon
On Friday 24 October 2014 06:56 PM, Nishanth Menon wrote:
On 10/23/2014 11:53 PM, Lokesh Vutla wrote:
quoted
On some Soc's RTC is powered by an external power regulator.
SoC ? -> could you rephrase this to indicate "certain SoCs such as
DRA7, RTC is an independent voltage domain of it's own and on
platforms such as DRA7-evm, this may be supplied by individual
regulator on it's own.
Ok. will do it.
quoted
e.g. RTC on DRA7 SoC. Make the OMAP RTC driver support a
power regulator.
Question ofcourse is what voltage would you like that regulator to be
at? As you are aware, certain LDOs and SMPS can drive varying voltage
and just enable/disable would do just the default voltage of the
SMPS/LDO, right? OR am i missing something here?
Yes I agree that enable/disable would just do the default voltage of SMPS/LDO.
If default voltage needs to be changed, driver should explicitly call regulator_set_voltage.
Currently this is missing. Ill update and repost it. Thanks for pointing it out.
@@ -15,6 +15,8 @@ Required properties: Optional properties: - ti,system-power-controller: whether the rtc is controlling the system power through pmic_power_en+Optional Properties:
^^ already commented on..
quoted
+- vrtc-supply: phandle to the regulator device tree node if needed
"phandle to supply regulator" ? since it is optional, "if needed" is
redundant?