diff mbox series

[2/3] power: pmic: rk8xx: bind rk808 RTC

Message ID 1587571901-28343-3-git-send-email-sunil@amarulasolutions.com
State Superseded
Headers show
Series Add support for Rockchip RK808 PMIC RTC device | expand

Commit Message

Suniel Mahesh April 22, 2020, 4:11 p.m. UTC
From: Suniel Mahesh <sunil at 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 at amarulasolutions.com>
---
 drivers/power/pmic/rk8xx.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

Comments

Kever Yang April 28, 2020, 2:05 p.m. UTC | #1
On 2020/4/23 ??12:11, sunil at amarulasolutions.com wrote:
> From: Suniel Mahesh <sunil at 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 at amarulasolutions.com>


Reviewed-by: Kever Yang <kever.yang at rock-chips.com>

Thanks,
- Kever
> ---
>   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;
>   }
Kever Yang May 15, 2020, 8:01 a.m. UTC | #2
Hi Suniel,

 ??? Do you have plan to update this patch set?


Thanks,

- Kever

On 2020/4/23 ??12:11, sunil at amarulasolutions.com wrote:
> From: Suniel Mahesh <sunil at 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 at 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;
>   }
Suniel Mahesh May 15, 2020, 8:54 a.m. UTC | #3
On Fri, May 15, 2020 at 1:31 PM Kever Yang <kever.yang at rock-chips.com>
wrote:

> Hi Suniel,
>
>      Do you have plan to update this patch set?,
>

Hi Kever,
Yes I do have plan to update this patch. Any timeline's you are looking at ?
Please let me know.

Thanks
Suniel

>
>
> Thanks,
>
> - Kever
>
> On 2020/4/23 ??12:11, sunil at amarulasolutions.com wrote:
> > From: Suniel Mahesh <sunil at 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 at 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;
> >   }
>
>
>
diff mbox series

Patch

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;
 }