From: sunil at amarulasolutions.com <sunil@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/3] power: pmic: rk8xx: bind rk808 RTC
Date: Wed, 22 Apr 2020 21:41:40 +0530 [thread overview]
Message-ID: <1587571901-28343-3-git-send-email-sunil@amarulasolutions.com> (raw)
In-Reply-To: <1587571901-28343-1-git-send-email-sunil@amarulasolutions.com>
From: Suniel Mahesh <sunil@amarulasolutions.com>
RK808 PMIC is a multi functional device with an RTC. In order to access
RTC, bind to its parent device i.e. RK808 PMIC.
Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
---
drivers/power/pmic/rk8xx.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
index 52e6d9d..8d6b64e 100644
--- a/drivers/power/pmic/rk8xx.c
+++ b/drivers/power/pmic/rk8xx.c
@@ -24,6 +24,11 @@ static const struct pmic_child_info pmic_children_info[] = {
{ },
};
+static const struct pmic_child_info rtc_info[] = {
+ { .prefix = "rk808-rtc", .driver = "rk808_rtc"},
+ { },
+};
+
static int rk8xx_reg_count(struct udevice *dev)
{
return RK808_NUM_OF_REGS;
@@ -59,7 +64,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
#if CONFIG_IS_ENABLED(PMIC_CHILDREN)
static int rk8xx_bind(struct udevice *dev)
{
- ofnode regulators_node;
+ ofnode regulators_node, rtc_node;
int children;
regulators_node = dev_read_subnode(dev, "regulators");
@@ -75,6 +80,18 @@ static int rk8xx_bind(struct udevice *dev)
if (!children)
debug("%s: %s - no child found\n", __func__, dev->name);
+ rtc_node = dev_read_subnode(dev, "rtc");
+ if (!ofnode_valid(rtc_node)) {
+ debug("%s: %s rtc subnode not found!\n", __func__, dev->name);
+ return -ENXIO;
+ }
+
+ debug("%s: '%s' - found rtc subnode\n", __func__, dev->name);
+
+ children = pmic_bind_children(dev, rtc_node, rtc_info);
+ if (!children)
+ debug("%s: %s - no child found\n", __func__, dev->name);
+
/* Always return success for this device */
return 0;
}
--
2.7.4
next prev parent reply other threads:[~2020-04-22 16:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 16:11 [PATCH 0/3] Add support for Rockchip RK808 PMIC RTC device sunil at amarulasolutions.com
2020-04-22 16:11 ` [PATCH 1/3] arm: dts: rockchip: rk3399-roc-pc: Add RTC child node for RK808 PMIC sunil at amarulasolutions.com
2020-04-28 14:05 ` Kever Yang
2020-04-22 16:11 ` sunil at amarulasolutions.com [this message]
2020-04-28 14:05 ` [PATCH 2/3] power: pmic: rk8xx: bind rk808 RTC Kever Yang
2020-05-15 8:01 ` Kever Yang
2020-05-15 8:54 ` Suniel Mahesh
2020-04-22 16:11 ` [PATCH 3/3] rtc: Add base support for the RK808 PMIC RTC sunil at amarulasolutions.com
2020-04-28 14:09 ` Kever Yang
2020-04-28 15:57 ` [PATCH v2 0/4] Add support for Rockchip RK808 PMIC RTC device sunil at amarulasolutions.com
2020-04-28 15:57 ` [PATCH v2 1/4] arm: dts: rockchip: rk3399-roc-pc: Add RTC child node for RK808 PMIC sunil at amarulasolutions.com
2020-04-28 15:57 ` [PATCH v2 2/4] power: pmic: rk8xx: bind rk808 RTC sunil at amarulasolutions.com
2020-04-28 15:57 ` [PATCH v2 3/4] rtc: rk8xx: Add base support for the RK808 PMIC RTC sunil at amarulasolutions.com
2020-04-28 15:57 ` [PATCH v2 4/4] configs: roc-rk3399-pc: Enable DM for RTC and commands sunil at amarulasolutions.com
2020-04-28 16:14 ` [PATCH v3 0/4] Add support for Rockchip RK808 PMIC RTC device sunil at amarulasolutions.com
2020-04-28 16:14 ` [PATCH v3 1/4] arm: dts: rockchip: rk3399-roc-pc: Add RTC child node for RK808 PMIC sunil at amarulasolutions.com
2020-04-28 16:14 ` [PATCH v3 2/4] power: pmic: rk8xx: bind rk808 RTC sunil at amarulasolutions.com
2020-04-28 16:14 ` [PATCH v3 3/4] rtc: rk8xx: Add base support for the RK808 PMIC RTC sunil at amarulasolutions.com
2020-04-29 2:39 ` Kever Yang
2020-04-29 3:27 ` elaine.zhang
2020-04-28 16:14 ` [PATCH v3 4/4] configs: roc-rk3399-pc: Enable DM for RTC and commands sunil at amarulasolutions.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1587571901-28343-3-git-send-email-sunil@amarulasolutions.com \
--to=sunil@amarulasolutions.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox