diff mbox series

[v3,5/6] mfd: twl4030-power: accept standard property for power controller

Message ID 20231203222903.343711-6-andreas@kemnade.info (mailing list archive)
State New, archived
Headers show
Series mfd: twl: system-power-controller | expand

Commit Message

Andreas Kemnade Dec. 3, 2023, 10:29 p.m. UTC
Instead of only accepting the ti specific properties accept also
the standard property. For uniformity, search in the parent node
for the tag. The code for powering of is also isolated from the
rest in this file. So it is a pure Linux design decision to put it
here.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/mfd/twl4030-power.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Lee Jones Dec. 7, 2023, 5:13 p.m. UTC | #1
On Sun, 03 Dec 2023, Andreas Kemnade wrote:

> Instead of only accepting the ti specific properties accept also
> the standard property. For uniformity, search in the parent node

Search 'in' the parent node or 'from' the parent node?

Where is the property?

> for the tag. The code for powering of is also isolated from the

Should this be "off"?

> rest in this file. So it is a pure Linux design decision to put it
> here.
> 
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>  drivers/mfd/twl4030-power.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> index e35b0f788c504..3ef892e63b88f 100644
> --- a/drivers/mfd/twl4030-power.c
> +++ b/drivers/mfd/twl4030-power.c
> @@ -686,6 +686,9 @@ static bool twl4030_power_use_poweroff(const struct twl4030_power_data *pdata,
>  	if (of_property_read_bool(node, "ti,use_poweroff"))
>  		return true;
>  
> +	if (of_device_is_system_power_controller(node->parent))
> +		return true;
> +
>  	return false;
>  }
>  
> -- 
> 2.39.2
>
Andreas Kemnade Dec. 7, 2023, 11:13 p.m. UTC | #2
On Thu, 7 Dec 2023 17:13:41 +0000
Lee Jones <lee@kernel.org> wrote:

> On Sun, 03 Dec 2023, Andreas Kemnade wrote:
> 
> > Instead of only accepting the ti specific properties accept also
> > the standard property. For uniformity, search in the parent node  
> 
> Search 'in' the parent node or 'from' the parent node?
> 
> Where is the property?
> 
The idea was to have the device tree property at the same place for all
twl family devices. So no distinction for these devices needed
in the bindings. It is in the main node.

I guess today this twl4030-power subnode would not be accepted nowadays
and the compatible would be some kind of flag in the parent.

> > for the tag. The code for powering of is also isolated from the  
> 
> Should this be "off"?
> 
yes, of course.

Regards,
Andreas
diff mbox series

Patch

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index e35b0f788c504..3ef892e63b88f 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -686,6 +686,9 @@  static bool twl4030_power_use_poweroff(const struct twl4030_power_data *pdata,
 	if (of_property_read_bool(node, "ti,use_poweroff"))
 		return true;
 
+	if (of_device_is_system_power_controller(node->parent))
+		return true;
+
 	return false;
 }