* [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming @ 2023-05-16 13:22 Sean Nyekjaer 2023-05-16 13:22 ` [PATCH v2 2/3] mfd: stpmic1: add pmic poweroff via sys-off handler Sean Nyekjaer ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Sean Nyekjaer @ 2023-05-16 13:22 UTC (permalink / raw) To: robh+dt, Lee Jones; +Cc: devicetree, Sean Nyekjaer, linux-kernel Fixup main control register and bits naming so the match the naming from the datasheet. https://www.st.com/resource/en/datasheet/stpmic1.pdf Signed-off-by: Sean Nyekjaer <sean@geanix.com> --- Changes since v1: - None drivers/mfd/stpmic1.c | 4 ++-- include/linux/mfd/stpmic1.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c index 8db1530d9bac..4c9b18d9dec8 100644 --- a/drivers/mfd/stpmic1.c +++ b/drivers/mfd/stpmic1.c @@ -19,7 +19,7 @@ static const struct regmap_range stpmic1_readable_ranges[] = { regmap_reg_range(TURN_ON_SR, VERSION_SR), - regmap_reg_range(SWOFF_PWRCTRL_CR, LDO6_STDBY_CR), + regmap_reg_range(MAIN_CR, LDO6_STDBY_CR), regmap_reg_range(BST_SW_CR, BST_SW_CR), regmap_reg_range(INT_PENDING_R1, INT_PENDING_R4), regmap_reg_range(INT_CLEAR_R1, INT_CLEAR_R4), @@ -30,7 +30,7 @@ static const struct regmap_range stpmic1_readable_ranges[] = { }; static const struct regmap_range stpmic1_writeable_ranges[] = { - regmap_reg_range(SWOFF_PWRCTRL_CR, LDO6_STDBY_CR), + regmap_reg_range(MAIN_CR, LDO6_STDBY_CR), regmap_reg_range(BST_SW_CR, BST_SW_CR), regmap_reg_range(INT_CLEAR_R1, INT_CLEAR_R4), regmap_reg_range(INT_SET_MASK_R1, INT_SET_MASK_R4), diff --git a/include/linux/mfd/stpmic1.h b/include/linux/mfd/stpmic1.h index fa3f99f7e9a1..dc00bac24f5a 100644 --- a/include/linux/mfd/stpmic1.h +++ b/include/linux/mfd/stpmic1.h @@ -15,7 +15,7 @@ #define RREQ_STATE_SR 0x5 #define VERSION_SR 0x6 -#define SWOFF_PWRCTRL_CR 0x10 +#define MAIN_CR 0x10 #define PADS_PULL_CR 0x11 #define BUCKS_PD_CR 0x12 #define LDO14_PD_CR 0x13 @@ -148,14 +148,14 @@ #define LDO_BYPASS_MASK BIT(7) /* Main PMIC Control Register - * SWOFF_PWRCTRL_CR + * MAIN_CR * Address : 0x10 */ -#define ICC_EVENT_ENABLED BIT(4) +#define OCP_OFF_DBG BIT(4) #define PWRCTRL_POLARITY_HIGH BIT(3) -#define PWRCTRL_PIN_VALID BIT(2) -#define RESTART_REQUEST_ENABLED BIT(1) -#define SOFTWARE_SWITCH_OFF_ENABLED BIT(0) +#define PWRCTRL_ENABLE BIT(2) +#define RESTART_REQUEST_ENABLE BIT(1) +#define SOFTWARE_SWITCH_OFF BIT(0) /* Main PMIC PADS Control Register * PADS_PULL_CR -- 2.40.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/3] mfd: stpmic1: add pmic poweroff via sys-off handler 2023-05-16 13:22 [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming Sean Nyekjaer @ 2023-05-16 13:22 ` Sean Nyekjaer 2023-05-25 11:46 ` Lee Jones 2023-05-16 13:22 ` [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property Sean Nyekjaer 2023-05-25 11:46 ` [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming Lee Jones 2 siblings, 1 reply; 16+ messages in thread From: Sean Nyekjaer @ 2023-05-16 13:22 UTC (permalink / raw) To: robh+dt, Lee Jones; +Cc: devicetree, Sean Nyekjaer, linux-kernel Use devm_register_sys_off_handler() that allows to register multiple power-off handlers. This can be enabled by adding "st,pmic-poweroff" to device-tree. Signed-off-by: Sean Nyekjaer <sean@geanix.com> --- Changes since v1: - Removed superfluous function drivers/mfd/stpmic1.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c index 4c9b18d9dec8..5b82cd37d57a 100644 --- a/drivers/mfd/stpmic1.c +++ b/drivers/mfd/stpmic1.c @@ -7,6 +7,7 @@ #include <linux/mfd/core.h> #include <linux/mfd/stpmic1.h> #include <linux/module.h> +#include <linux/reboot.h> #include <linux/of.h> #include <linux/of_irq.h> #include <linux/of_platform.h> @@ -117,6 +118,16 @@ static const struct regmap_irq_chip stpmic1_regmap_irq_chip = { .num_irqs = ARRAY_SIZE(stpmic1_irqs), }; +static int stpmic1_power_off(struct sys_off_data *data) +{ + struct stpmic1 *ddata = data->cb_data; + + regmap_update_bits(ddata->regmap, MAIN_CR, + SOFTWARE_SWITCH_OFF, SOFTWARE_SWITCH_OFF); + + return NOTIFY_DONE; +} + static int stpmic1_probe(struct i2c_client *i2c) { struct stpmic1 *ddata; @@ -159,6 +170,18 @@ static int stpmic1_probe(struct i2c_client *i2c) return ret; } + if (of_property_read_bool(i2c->dev.of_node, "st,pmic-poweroff")) { + ret = devm_register_sys_off_handler(ddata->dev, + SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_DEFAULT, + stpmic1_power_off, + ddata); + if (ret) { + dev_err(ddata->dev, "failed to register sys-off handler: %d\n", ret); + return ret; + } + } + return devm_of_platform_populate(dev); } -- 2.40.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/3] mfd: stpmic1: add pmic poweroff via sys-off handler 2023-05-16 13:22 ` [PATCH v2 2/3] mfd: stpmic1: add pmic poweroff via sys-off handler Sean Nyekjaer @ 2023-05-25 11:46 ` Lee Jones 0 siblings, 0 replies; 16+ messages in thread From: Lee Jones @ 2023-05-25 11:46 UTC (permalink / raw) To: Sean Nyekjaer; +Cc: robh+dt, devicetree, linux-kernel On Tue, 16 May 2023, Sean Nyekjaer wrote: > Use devm_register_sys_off_handler() that allows to register multiple > power-off handlers. > > This can be enabled by adding "st,pmic-poweroff" to device-tree. > > Signed-off-by: Sean Nyekjaer <sean@geanix.com> > --- > Changes since v1: > - Removed superfluous function > > drivers/mfd/stpmic1.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) Reviewed-by: Lee Jones <lee@kernel.org> -- Lee Jones [李琼斯] ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-16 13:22 [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming Sean Nyekjaer 2023-05-16 13:22 ` [PATCH v2 2/3] mfd: stpmic1: add pmic poweroff via sys-off handler Sean Nyekjaer @ 2023-05-16 13:22 ` Sean Nyekjaer 2023-05-16 18:06 ` Conor Dooley 2023-05-25 11:46 ` [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming Lee Jones 2 siblings, 1 reply; 16+ messages in thread From: Sean Nyekjaer @ 2023-05-16 13:22 UTC (permalink / raw) To: robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet Cc: devicetree, Sean Nyekjaer, linux-kernel Document the new optional "fsl,pmic-poweroff" property. Signed-off-by: Sean Nyekjaer <sean@geanix.com> --- Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml index 9573e4af949e..5183a7c660d2 100644 --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml @@ -26,6 +26,14 @@ properties: interrupt-controller: true + st,pmic-poweroff: + $ref: /schemas/types.yaml#/definitions/flag + description: | + if present, configure the PMIC to shutdown all power rails when + power off sequence have finished. + Use this option if the SoC should be powered off by external power management + IC (PMIC). + onkey: type: object -- 2.40.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-16 13:22 ` [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property Sean Nyekjaer @ 2023-05-16 18:06 ` Conor Dooley 2023-05-23 9:55 ` Sean Nyekjær 0 siblings, 1 reply; 16+ messages in thread From: Conor Dooley @ 2023-05-16 18:06 UTC (permalink / raw) To: Sean Nyekjaer Cc: robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1667 bytes --] Hey Sean, On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: > Document the new optional "fsl,pmic-poweroff" property. > > Signed-off-by: Sean Nyekjaer <sean@geanix.com> > --- > Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > index 9573e4af949e..5183a7c660d2 100644 > --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > @@ -26,6 +26,14 @@ properties: > > interrupt-controller: true > > + st,pmic-poweroff: > + $ref: /schemas/types.yaml#/definitions/flag > + description: | > + if present, configure the PMIC to shutdown all power rails when > + power off sequence have finished. > + Use this option if the SoC should be powered off by external power management > + IC (PMIC). Just reading this description, this is sounding quite like a "software behaviour" type of property, which are not permitted, rather than describing some element of the hardware. Clearly you are trying to solve an actual problem though, so try re-phrasing the description (and property name) to focus on what exact hardware configuration it is that you are trying to special-case. Krzysztof suggested that the samsung,s2mps11-acokb-ground property in samsung,s2mps11.yaml is addressing a similar problem, so that could be good to look at. Also, the dt-binding patch should go before the patch adding the property to the driver. Thanks, Conor. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-16 18:06 ` Conor Dooley @ 2023-05-23 9:55 ` Sean Nyekjær 2023-05-23 17:29 ` Conor Dooley 0 siblings, 1 reply; 16+ messages in thread From: Sean Nyekjær @ 2023-05-23 9:55 UTC (permalink / raw) To: Conor Dooley Cc: robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel Hey Conor, > On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: > > Hey Sean, > > On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: >> Document the new optional "fsl,pmic-poweroff" property. >> >> Signed-off-by: Sean Nyekjaer <sean@geanix.com> >> --- >> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >> index 9573e4af949e..5183a7c660d2 100644 >> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >> @@ -26,6 +26,14 @@ properties: >> >> interrupt-controller: true >> >> + st,pmic-poweroff: >> + $ref: /schemas/types.yaml#/definitions/flag >> + description: | >> + if present, configure the PMIC to shutdown all power rails when >> + power off sequence have finished. >> + Use this option if the SoC should be powered off by external power management >> + IC (PMIC). > > Just reading this description, this is sounding quite like a "software > behaviour" type of property, which are not permitted, rather than > describing some element of the hardware. Clearly you are trying to solve > an actual problem though, so try re-phrasing the description (and > property name) to focus on what exact hardware configuration it is that > you are trying to special-case. > Krzysztof suggested that the samsung,s2mps11-acokb-ground property in > samsung,s2mps11.yaml is addressing a similar problem, so that could be > good to look at. Better wording? Indicates that the power management IC (PMIC) is used to power off the board. So as the last step in the power off sequence set the SWOFF bit in the main control register (MAIN_CR) register, to shutdown all power rails. > > Also, the dt-binding patch should go before the patch adding the > property to the driver. > I will switch them around. > Thanks, > Conor. /Sean ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-23 9:55 ` Sean Nyekjær @ 2023-05-23 17:29 ` Conor Dooley 2023-05-24 8:16 ` Sean Nyekjær 0 siblings, 1 reply; 16+ messages in thread From: Conor Dooley @ 2023-05-23 17:29 UTC (permalink / raw) To: Sean Nyekjær Cc: robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel [-- Attachment #1: Type: text/plain, Size: 2685 bytes --] On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: > > On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: > > On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: > >> Document the new optional "fsl,pmic-poweroff" property. > >> > >> Signed-off-by: Sean Nyekjaer <sean@geanix.com> > >> --- > >> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >> index 9573e4af949e..5183a7c660d2 100644 > >> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >> @@ -26,6 +26,14 @@ properties: > >> > >> interrupt-controller: true > >> > >> + st,pmic-poweroff: > >> + $ref: /schemas/types.yaml#/definitions/flag > >> + description: | > >> + if present, configure the PMIC to shutdown all power rails when > >> + power off sequence have finished. > >> + Use this option if the SoC should be powered off by external power management > >> + IC (PMIC). > > > > Just reading this description, this is sounding quite like a "software > > behaviour" type of property, which are not permitted, rather than > > describing some element of the hardware. Clearly you are trying to solve > > an actual problem though, so try re-phrasing the description (and > > property name) to focus on what exact hardware configuration it is that > > you are trying to special-case. > > Krzysztof suggested that the samsung,s2mps11-acokb-ground property in > > samsung,s2mps11.yaml is addressing a similar problem, so that could be > > good to look at. > > Better wording? > Indicates that the power management IC (PMIC) is used to power off the board. > So as the last step in the power off sequence set the SWOFF bit in the > main control register (MAIN_CR) register, to shutdown all power rails. The description for the property that Krzysztof mentioned is samsung,s2mps11-acokb-ground: description: | Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes low, the rising ACOKB will trigger power off. In other words, I am asking what (abnormal?) scenario there is that means you need the property, rather than what setting the property does. Or am I totally off, and this is the only way this PMIC works? Cheers, Conor. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-23 17:29 ` Conor Dooley @ 2023-05-24 8:16 ` Sean Nyekjær 2023-05-24 10:08 ` Conor Dooley 0 siblings, 1 reply; 16+ messages in thread From: Sean Nyekjær @ 2023-05-24 8:16 UTC (permalink / raw) To: Conor Dooley Cc: robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel Hi Conor, > On 23 May 2023, at 19.29, Conor Dooley <conor@kernel.org> wrote: > > On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: >>> On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: >>> On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: >>>> Document the new optional "fsl,pmic-poweroff" property. >>>> >>>> Signed-off-by: Sean Nyekjaer <sean@geanix.com> >>>> --- >>>> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ >>>> 1 file changed, 8 insertions(+) >>>> >>>> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>> index 9573e4af949e..5183a7c660d2 100644 >>>> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>> @@ -26,6 +26,14 @@ properties: >>>> >>>> interrupt-controller: true >>>> >>>> + st,pmic-poweroff: >>>> + $ref: /schemas/types.yaml#/definitions/flag >>>> + description: | >>>> + if present, configure the PMIC to shutdown all power rails when >>>> + power off sequence have finished. >>>> + Use this option if the SoC should be powered off by external power management >>>> + IC (PMIC). >>> >>> Just reading this description, this is sounding quite like a "software >>> behaviour" type of property, which are not permitted, rather than >>> describing some element of the hardware. Clearly you are trying to solve >>> an actual problem though, so try re-phrasing the description (and >>> property name) to focus on what exact hardware configuration it is that >>> you are trying to special-case. >>> Krzysztof suggested that the samsung,s2mps11-acokb-ground property in >>> samsung,s2mps11.yaml is addressing a similar problem, so that could be >>> good to look at. >> >> Better wording? >> Indicates that the power management IC (PMIC) is used to power off the board. >> So as the last step in the power off sequence set the SWOFF bit in the >> main control register (MAIN_CR) register, to shutdown all power rails. > > The description for the property that Krzysztof mentioned is > samsung,s2mps11-acokb-ground: > description: | > Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so > the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the > power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes > low, the rising ACOKB will trigger power off. > > In other words, I am asking what (abnormal?) scenario there is that means > you need the property, rather than what setting the property does. > Or am I totally off, and this is the only way this PMIC works? Indicates that the power management IC (PMIC) turn-off condition is met by setting the SWOFF bit in the main control register (MAIN_CR) register. Turn-off condition can still be reached by the PONKEY input. ? I must admit I’m somewhat lost here :) /Sean ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-24 8:16 ` Sean Nyekjær @ 2023-05-24 10:08 ` Conor Dooley 2023-05-24 10:30 ` Sean Nyekjaer 0 siblings, 1 reply; 16+ messages in thread From: Conor Dooley @ 2023-05-24 10:08 UTC (permalink / raw) To: Sean Nyekjær Cc: Conor Dooley, robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel [-- Attachment #1: Type: text/plain, Size: 4050 bytes --] On Wed, May 24, 2023 at 10:16:13AM +0200, Sean Nyekjær wrote: > Hi Conor, > > > On 23 May 2023, at 19.29, Conor Dooley <conor@kernel.org> wrote: > > > > On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: > >>> On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: > >>> On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: > >>>> Document the new optional "fsl,pmic-poweroff" property. > >>>> > >>>> Signed-off-by: Sean Nyekjaer <sean@geanix.com> > >>>> --- > >>>> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ > >>>> 1 file changed, 8 insertions(+) > >>>> > >>>> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >>>> index 9573e4af949e..5183a7c660d2 100644 > >>>> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >>>> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >>>> @@ -26,6 +26,14 @@ properties: > >>>> > >>>> interrupt-controller: true > >>>> > >>>> + st,pmic-poweroff: > >>>> + $ref: /schemas/types.yaml#/definitions/flag > >>>> + description: | > >>>> + if present, configure the PMIC to shutdown all power rails when > >>>> + power off sequence have finished. > >>>> + Use this option if the SoC should be powered off by external power management > >>>> + IC (PMIC). > >>> > >>> Just reading this description, this is sounding quite like a "software > >>> behaviour" type of property, which are not permitted, rather than > >>> describing some element of the hardware. Clearly you are trying to solve > >>> an actual problem though, so try re-phrasing the description (and > >>> property name) to focus on what exact hardware configuration it is that > >>> you are trying to special-case. > >>> Krzysztof suggested that the samsung,s2mps11-acokb-ground property in > >>> samsung,s2mps11.yaml is addressing a similar problem, so that could be > >>> good to look at. > >> > >> Better wording? > >> Indicates that the power management IC (PMIC) is used to power off the board. > >> So as the last step in the power off sequence set the SWOFF bit in the > >> main control register (MAIN_CR) register, to shutdown all power rails. > > > > The description for the property that Krzysztof mentioned is > > samsung,s2mps11-acokb-ground: > > description: | > > Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so > > the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the > > power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes > > low, the rising ACOKB will trigger power off. > > > > In other words, I am asking what (abnormal?) scenario there is that means > > you need the property, rather than what setting the property does. > > Or am I totally off, and this is the only way this PMIC works? > > Indicates that the power management IC (PMIC) turn-off condition is met > by setting the SWOFF bit in the main control register (MAIN_CR) register. > Turn-off condition can still be reached by the PONKEY input. > > ? > > I must admit I’m somewhat lost here :) Sorry about that. I'm trying to understand what is different about your hardware that it needs the property rather than what adding the property does. If you look at the samsung one, it describes both the configuration of the hardware ("ACOKB pin of S2MPS11 PMIC is connected to the ground") and how that is different from normal ("Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes low, the rising ACOKB will trigger power off.") Looking at your datasheet, you don't have such a pin though - just the sw poweroff bit & the PONKEY stuff. My angle is just that I am trying to figure out why you need this property when it has not been needed before. Or why you would not always want to "shutdown all power rails when power-off sequence have finished". I'm sorry if these are silly questions. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-24 10:08 ` Conor Dooley @ 2023-05-24 10:30 ` Sean Nyekjaer 2023-05-24 19:57 ` Conor Dooley 2023-06-01 7:12 ` Krzysztof Kozlowski 0 siblings, 2 replies; 16+ messages in thread From: Sean Nyekjaer @ 2023-05-24 10:30 UTC (permalink / raw) To: Conor Dooley Cc: Conor Dooley, robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel > On 24 May 2023, at 12.08, Conor Dooley <conor.dooley@microchip.com> wrote: > > On Wed, May 24, 2023 at 10:16:13AM +0200, Sean Nyekjær wrote: >> Hi Conor, >> >>> On 23 May 2023, at 19.29, Conor Dooley <conor@kernel.org> wrote: >>> >>> On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: >>>>> On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: >>>>> On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: >>>>>> Document the new optional "fsl,pmic-poweroff" property. >>>>>> >>>>>> Signed-off-by: Sean Nyekjaer <sean@geanix.com> >>>>>> --- >>>>>> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ >>>>>> 1 file changed, 8 insertions(+) >>>>>> >>>>>> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>> index 9573e4af949e..5183a7c660d2 100644 >>>>>> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>> @@ -26,6 +26,14 @@ properties: >>>>>> >>>>>> interrupt-controller: true >>>>>> >>>>>> + st,pmic-poweroff: >>>>>> + $ref: /schemas/types.yaml#/definitions/flag >>>>>> + description: | >>>>>> + if present, configure the PMIC to shutdown all power rails when >>>>>> + power off sequence have finished. >>>>>> + Use this option if the SoC should be powered off by external power management >>>>>> + IC (PMIC). >>>>> >>>>> Just reading this description, this is sounding quite like a "software >>>>> behaviour" type of property, which are not permitted, rather than >>>>> describing some element of the hardware. Clearly you are trying to solve >>>>> an actual problem though, so try re-phrasing the description (and >>>>> property name) to focus on what exact hardware configuration it is that >>>>> you are trying to special-case. >>>>> Krzysztof suggested that the samsung,s2mps11-acokb-ground property in >>>>> samsung,s2mps11.yaml is addressing a similar problem, so that could be >>>>> good to look at. >>>> >>>> Better wording? >>>> Indicates that the power management IC (PMIC) is used to power off the board. >>>> So as the last step in the power off sequence set the SWOFF bit in the >>>> main control register (MAIN_CR) register, to shutdown all power rails. >>> >>> The description for the property that Krzysztof mentioned is >>> samsung,s2mps11-acokb-ground: >>> description: | >>> Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so >>> the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the >>> power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes >>> low, the rising ACOKB will trigger power off. >>> >>> In other words, I am asking what (abnormal?) scenario there is that means >>> you need the property, rather than what setting the property does. >>> Or am I totally off, and this is the only way this PMIC works? >> >> Indicates that the power management IC (PMIC) turn-off condition is met >> by setting the SWOFF bit in the main control register (MAIN_CR) register. >> Turn-off condition can still be reached by the PONKEY input. >> >> ? >> >> I must admit I’m somewhat lost here :) > > Sorry about that. I'm trying to understand what is different about your > hardware that it needs the property rather than what adding the property > does. If you look at the samsung one, it describes both the > configuration of the hardware ("ACOKB pin of S2MPS11 PMIC is connected to > the ground") and how that is different from normal ("Usually the ACOKB is > pulled up to VBATT so when PWRHOLD pin goes low, the rising ACOKB will > trigger power off.") > > Looking at your datasheet, you don't have such a pin though - just the > sw poweroff bit & the PONKEY stuff. My angle is just that I am trying > to figure out why you need this property when it has not been needed > before. Or why you would not always want to "shutdown all power rails > when power-off sequence have finished". I'm sorry if these are silly > questions. > No silly questions, maybe they trick me to come up with the correct answer :D Basically without this, you won’t be able to power off the system other than hitting the PONKEY. So it’s a new feature that wasn’t supported before. Maybe this feature should not be optional? If st,pmic-poweroff == true: System will power off as the last step in the power off sequence. If st,pmic-powerof == false: System will reboot in the last step in the power off sequence. I thought of this, as an always on system failsafe. /Sean ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-24 10:30 ` Sean Nyekjaer @ 2023-05-24 19:57 ` Conor Dooley 2023-06-01 7:12 ` Krzysztof Kozlowski 1 sibling, 0 replies; 16+ messages in thread From: Conor Dooley @ 2023-05-24 19:57 UTC (permalink / raw) To: Sean Nyekjaer Cc: Conor Dooley, robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel [-- Attachment #1: Type: text/plain, Size: 4091 bytes --] Hey Sean, Lee, On Wed, May 24, 2023 at 12:30:59PM +0200, Sean Nyekjaer wrote: > > On 24 May 2023, at 12.08, Conor Dooley <conor.dooley@microchip.com> wrote: > > On Wed, May 24, 2023 at 10:16:13AM +0200, Sean Nyekjær wrote: > >>> On 23 May 2023, at 19.29, Conor Dooley <conor@kernel.org> wrote: > >>> On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: > >>>>> On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: > >>>>> On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: > >>>>>> + st,pmic-poweroff: > >>>>>> + $ref: /schemas/types.yaml#/definitions/flag > >>>>>> + description: | > >>>>>> + if present, configure the PMIC to shutdown all power rails when > >>>>>> + power off sequence have finished. > >>>>>> + Use this option if the SoC should be powered off by external power management > >>>>>> + IC (PMIC). > >>>>> > >>>>> Just reading this description, this is sounding quite like a "software > >>>>> behaviour" type of property, which are not permitted, rather than > >>>>> describing some element of the hardware. Clearly you are trying to solve > >>>>> an actual problem though, so try re-phrasing the description (and > >>>>> property name) to focus on what exact hardware configuration it is that > >>>>> you are trying to special-case. > >>>>> Krzysztof suggested that the samsung,s2mps11-acokb-ground property in > >>>>> samsung,s2mps11.yaml is addressing a similar problem, so that could be > >>>>> good to look at. > >>> The description for the property that Krzysztof mentioned is > >>> samsung,s2mps11-acokb-ground: > >>> description: | > >>> Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so > >>> the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the > >>> power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes > >>> low, the rising ACOKB will trigger power off. > >>> > >>> In other words, I am asking what (abnormal?) scenario there is that means > >>> you need the property, rather than what setting the property does. > >>> Or am I totally off, and this is the only way this PMIC works? > >> > >> Indicates that the power management IC (PMIC) turn-off condition is met > >> by setting the SWOFF bit in the main control register (MAIN_CR) register. > >> Turn-off condition can still be reached by the PONKEY input. > >> > >> ? > >> > >> I must admit I’m somewhat lost here :) > > > > Sorry about that. I'm trying to understand what is different about your > > hardware that it needs the property rather than what adding the property > > does. If you look at the samsung one, it describes both the > > configuration of the hardware ("ACOKB pin of S2MPS11 PMIC is connected to > > the ground") and how that is different from normal ("Usually the ACOKB is > > pulled up to VBATT so when PWRHOLD pin goes low, the rising ACOKB will > > trigger power off.") > > > > Looking at your datasheet, you don't have such a pin though - just the > > sw poweroff bit & the PONKEY stuff. My angle is just that I am trying > > to figure out why you need this property when it has not been needed > > before. Or why you would not always want to "shutdown all power rails > > when power-off sequence have finished". I'm sorry if these are silly > > questions. > > > > No silly questions, maybe they trick me to come up with the correct answer :D > > Basically without this, you won’t be able to power off the system > other than hitting the PONKEY. > So it’s a new feature that wasn’t supported before. > Maybe this feature should not be optional? Yeah, I suppose that is the rabbit-hole that the silly questions lead down. I don't know the answer to that though. Maybe Lee does? > If st,pmic-poweroff == true: > System will power off as the last step in the power off sequence. > If st,pmic-powerof == false: > System will reboot in the last step in the power off sequence. > > I thought of this, as an always on system failsafe. > > /Sean [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-05-24 10:30 ` Sean Nyekjaer 2023-05-24 19:57 ` Conor Dooley @ 2023-06-01 7:12 ` Krzysztof Kozlowski 2023-06-01 14:05 ` Sean Nyekjaer 1 sibling, 1 reply; 16+ messages in thread From: Krzysztof Kozlowski @ 2023-06-01 7:12 UTC (permalink / raw) To: Sean Nyekjaer, Conor Dooley Cc: Conor Dooley, robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel On 24/05/2023 12:30, Sean Nyekjaer wrote: > > >> On 24 May 2023, at 12.08, Conor Dooley <conor.dooley@microchip.com> wrote: >> >> On Wed, May 24, 2023 at 10:16:13AM +0200, Sean Nyekjær wrote: >>> Hi Conor, >>> >>>> On 23 May 2023, at 19.29, Conor Dooley <conor@kernel.org> wrote: >>>> >>>> On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: >>>>>> On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: >>>>>> On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: >>>>>>> Document the new optional "fsl,pmic-poweroff" property. >>>>>>> >>>>>>> Signed-off-by: Sean Nyekjaer <sean@geanix.com> >>>>>>> --- >>>>>>> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ >>>>>>> 1 file changed, 8 insertions(+) >>>>>>> >>>>>>> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>> index 9573e4af949e..5183a7c660d2 100644 >>>>>>> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>> @@ -26,6 +26,14 @@ properties: >>>>>>> >>>>>>> interrupt-controller: true >>>>>>> >>>>>>> + st,pmic-poweroff: >>>>>>> + $ref: /schemas/types.yaml#/definitions/flag >>>>>>> + description: | >>>>>>> + if present, configure the PMIC to shutdown all power rails when >>>>>>> + power off sequence have finished. >>>>>>> + Use this option if the SoC should be powered off by external power management >>>>>>> + IC (PMIC). >>>>>> >>>>>> Just reading this description, this is sounding quite like a "software >>>>>> behaviour" type of property, which are not permitted, rather than >>>>>> describing some element of the hardware. Clearly you are trying to solve >>>>>> an actual problem though, so try re-phrasing the description (and >>>>>> property name) to focus on what exact hardware configuration it is that >>>>>> you are trying to special-case. >>>>>> Krzysztof suggested that the samsung,s2mps11-acokb-ground property in >>>>>> samsung,s2mps11.yaml is addressing a similar problem, so that could be >>>>>> good to look at. >>>>> >>>>> Better wording? >>>>> Indicates that the power management IC (PMIC) is used to power off the board. >>>>> So as the last step in the power off sequence set the SWOFF bit in the >>>>> main control register (MAIN_CR) register, to shutdown all power rails. >>>> >>>> The description for the property that Krzysztof mentioned is >>>> samsung,s2mps11-acokb-ground: >>>> description: | >>>> Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so >>>> the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the >>>> power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes >>>> low, the rising ACOKB will trigger power off. >>>> >>>> In other words, I am asking what (abnormal?) scenario there is that means >>>> you need the property, rather than what setting the property does. >>>> Or am I totally off, and this is the only way this PMIC works? >>> >>> Indicates that the power management IC (PMIC) turn-off condition is met >>> by setting the SWOFF bit in the main control register (MAIN_CR) register. >>> Turn-off condition can still be reached by the PONKEY input. >>> >>> ? >>> >>> I must admit I’m somewhat lost here :) >> >> Sorry about that. I'm trying to understand what is different about your >> hardware that it needs the property rather than what adding the property >> does. If you look at the samsung one, it describes both the >> configuration of the hardware ("ACOKB pin of S2MPS11 PMIC is connected to >> the ground") and how that is different from normal ("Usually the ACOKB is >> pulled up to VBATT so when PWRHOLD pin goes low, the rising ACOKB will >> trigger power off.") >> >> Looking at your datasheet, you don't have such a pin though - just the >> sw poweroff bit & the PONKEY stuff. My angle is just that I am trying >> to figure out why you need this property when it has not been needed >> before. Or why you would not always want to "shutdown all power rails >> when power-off sequence have finished". I'm sorry if these are silly >> questions. >> > > No silly questions, maybe they trick me to come up with the correct answer :D > > Basically without this, you won’t be able to power off the system > other than hitting the PONKEY. > So it’s a new feature that wasn’t supported before. > Maybe this feature should not be optional? You are still describing what driver should do with registers. What you are missing is describing real cause for this. It's exactly the same case as was with s2mps11. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-06-01 7:12 ` Krzysztof Kozlowski @ 2023-06-01 14:05 ` Sean Nyekjaer 2023-06-01 15:25 ` Krzysztof Kozlowski 0 siblings, 1 reply; 16+ messages in thread From: Sean Nyekjaer @ 2023-06-01 14:05 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Conor Dooley, Conor Dooley, robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel Hi Krzysztof, > On 1 Jun 2023, at 09.12, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > On 24/05/2023 12:30, Sean Nyekjaer wrote: >> >> >>> On 24 May 2023, at 12.08, Conor Dooley <conor.dooley@microchip.com> wrote: >>> >>> On Wed, May 24, 2023 at 10:16:13AM +0200, Sean Nyekjær wrote: >>>> Hi Conor, >>>> >>>>> On 23 May 2023, at 19.29, Conor Dooley <conor@kernel.org> wrote: >>>>> >>>>> On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: >>>>>>> On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: >>>>>>> On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: >>>>>>>> Document the new optional "fsl,pmic-poweroff" property. >>>>>>>> >>>>>>>> Signed-off-by: Sean Nyekjaer <sean@geanix.com> >>>>>>>> --- >>>>>>>> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ >>>>>>>> 1 file changed, 8 insertions(+) >>>>>>>> >>>>>>>> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>>> index 9573e4af949e..5183a7c660d2 100644 >>>>>>>> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>>> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>>> @@ -26,6 +26,14 @@ properties: >>>>>>>> >>>>>>>> interrupt-controller: true >>>>>>>> >>>>>>>> + st,pmic-poweroff: >>>>>>>> + $ref: /schemas/types.yaml#/definitions/flag >>>>>>>> + description: | >>>>>>>> + if present, configure the PMIC to shutdown all power rails when >>>>>>>> + power off sequence have finished. >>>>>>>> + Use this option if the SoC should be powered off by external power management >>>>>>>> + IC (PMIC). >>>>>>> >>>>>>> Just reading this description, this is sounding quite like a "software >>>>>>> behaviour" type of property, which are not permitted, rather than >>>>>>> describing some element of the hardware. Clearly you are trying to solve >>>>>>> an actual problem though, so try re-phrasing the description (and >>>>>>> property name) to focus on what exact hardware configuration it is that >>>>>>> you are trying to special-case. >>>>>>> Krzysztof suggested that the samsung,s2mps11-acokb-ground property in >>>>>>> samsung,s2mps11.yaml is addressing a similar problem, so that could be >>>>>>> good to look at. >>>>>> >>>>>> Better wording? >>>>>> Indicates that the power management IC (PMIC) is used to power off the board. >>>>>> So as the last step in the power off sequence set the SWOFF bit in the >>>>>> main control register (MAIN_CR) register, to shutdown all power rails. >>>>> >>>>> The description for the property that Krzysztof mentioned is >>>>> samsung,s2mps11-acokb-ground: >>>>> description: | >>>>> Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so >>>>> the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the >>>>> power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes >>>>> low, the rising ACOKB will trigger power off. >>>>> >>>>> In other words, I am asking what (abnormal?) scenario there is that means >>>>> you need the property, rather than what setting the property does. >>>>> Or am I totally off, and this is the only way this PMIC works? >>>> >>>> Indicates that the power management IC (PMIC) turn-off condition is met >>>> by setting the SWOFF bit in the main control register (MAIN_CR) register. >>>> Turn-off condition can still be reached by the PONKEY input. >>>> >>>> ? >>>> >>>> I must admit I’m somewhat lost here :) >>> >>> Sorry about that. I'm trying to understand what is different about your >>> hardware that it needs the property rather than what adding the property >>> does. If you look at the samsung one, it describes both the >>> configuration of the hardware ("ACOKB pin of S2MPS11 PMIC is connected to >>> the ground") and how that is different from normal ("Usually the ACOKB is >>> pulled up to VBATT so when PWRHOLD pin goes low, the rising ACOKB will >>> trigger power off.") >>> >>> Looking at your datasheet, you don't have such a pin though - just the >>> sw poweroff bit & the PONKEY stuff. My angle is just that I am trying >>> to figure out why you need this property when it has not been needed >>> before. Or why you would not always want to "shutdown all power rails >>> when power-off sequence have finished". I'm sorry if these are silly >>> questions. >>> >> >> No silly questions, maybe they trick me to come up with the correct answer :D >> >> Basically without this, you won’t be able to power off the system >> other than hitting the PONKEY. >> So it’s a new feature that wasn’t supported before. >> Maybe this feature should not be optional? > > You are still describing what driver should do with registers. What you > are missing is describing real cause for this. It's exactly the same > case as was with s2mps11. I didn’t mention anything with registers in the patch: if present, configure the PMIC to shutdown all power rails when power off sequence have finished. Use this option if the SoC should be powered off by external power management IC (PMIC). ^^ That’s is exactly what is happening if the option is enabled. Do you have a suggestion wording? What do you think about removing this option and make it default behaviour? /Sean > > Best regards, > Krzysztof > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-06-01 14:05 ` Sean Nyekjaer @ 2023-06-01 15:25 ` Krzysztof Kozlowski 2023-06-01 20:03 ` Conor Dooley 0 siblings, 1 reply; 16+ messages in thread From: Krzysztof Kozlowski @ 2023-06-01 15:25 UTC (permalink / raw) To: Sean Nyekjaer Cc: Conor Dooley, Conor Dooley, robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel On 01/06/2023 16:05, Sean Nyekjaer wrote: > Hi Krzysztof, > >> On 1 Jun 2023, at 09.12, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: >> >> On 24/05/2023 12:30, Sean Nyekjaer wrote: >>> >>> >>>> On 24 May 2023, at 12.08, Conor Dooley <conor.dooley@microchip.com> wrote: >>>> >>>> On Wed, May 24, 2023 at 10:16:13AM +0200, Sean Nyekjær wrote: >>>>> Hi Conor, >>>>> >>>>>> On 23 May 2023, at 19.29, Conor Dooley <conor@kernel.org> wrote: >>>>>> >>>>>> On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: >>>>>>>> On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: >>>>>>>> On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: >>>>>>>>> Document the new optional "fsl,pmic-poweroff" property. >>>>>>>>> >>>>>>>>> Signed-off-by: Sean Nyekjaer <sean@geanix.com> >>>>>>>>> --- >>>>>>>>> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ >>>>>>>>> 1 file changed, 8 insertions(+) >>>>>>>>> >>>>>>>>> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>>>> index 9573e4af949e..5183a7c660d2 100644 >>>>>>>>> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>>>> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml >>>>>>>>> @@ -26,6 +26,14 @@ properties: >>>>>>>>> >>>>>>>>> interrupt-controller: true >>>>>>>>> >>>>>>>>> + st,pmic-poweroff: >>>>>>>>> + $ref: /schemas/types.yaml#/definitions/flag >>>>>>>>> + description: | >>>>>>>>> + if present, configure the PMIC to shutdown all power rails when >>>>>>>>> + power off sequence have finished. >>>>>>>>> + Use this option if the SoC should be powered off by external power management >>>>>>>>> + IC (PMIC). >>>>>>>> >>>>>>>> Just reading this description, this is sounding quite like a "software >>>>>>>> behaviour" type of property, which are not permitted, rather than >>>>>>>> describing some element of the hardware. Clearly you are trying to solve >>>>>>>> an actual problem though, so try re-phrasing the description (and >>>>>>>> property name) to focus on what exact hardware configuration it is that >>>>>>>> you are trying to special-case. >>>>>>>> Krzysztof suggested that the samsung,s2mps11-acokb-ground property in >>>>>>>> samsung,s2mps11.yaml is addressing a similar problem, so that could be >>>>>>>> good to look at. >>>>>>> >>>>>>> Better wording? >>>>>>> Indicates that the power management IC (PMIC) is used to power off the board. >>>>>>> So as the last step in the power off sequence set the SWOFF bit in the >>>>>>> main control register (MAIN_CR) register, to shutdown all power rails. >>>>>> >>>>>> The description for the property that Krzysztof mentioned is >>>>>> samsung,s2mps11-acokb-ground: >>>>>> description: | >>>>>> Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so >>>>>> the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the >>>>>> power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes >>>>>> low, the rising ACOKB will trigger power off. >>>>>> >>>>>> In other words, I am asking what (abnormal?) scenario there is that means >>>>>> you need the property, rather than what setting the property does. >>>>>> Or am I totally off, and this is the only way this PMIC works? >>>>> >>>>> Indicates that the power management IC (PMIC) turn-off condition is met >>>>> by setting the SWOFF bit in the main control register (MAIN_CR) register. >>>>> Turn-off condition can still be reached by the PONKEY input. >>>>> >>>>> ? >>>>> >>>>> I must admit I’m somewhat lost here :) >>>> >>>> Sorry about that. I'm trying to understand what is different about your >>>> hardware that it needs the property rather than what adding the property >>>> does. If you look at the samsung one, it describes both the >>>> configuration of the hardware ("ACOKB pin of S2MPS11 PMIC is connected to >>>> the ground") and how that is different from normal ("Usually the ACOKB is >>>> pulled up to VBATT so when PWRHOLD pin goes low, the rising ACOKB will >>>> trigger power off.") >>>> >>>> Looking at your datasheet, you don't have such a pin though - just the >>>> sw poweroff bit & the PONKEY stuff. My angle is just that I am trying >>>> to figure out why you need this property when it has not been needed >>>> before. Or why you would not always want to "shutdown all power rails >>>> when power-off sequence have finished". I'm sorry if these are silly >>>> questions. >>>> >>> >>> No silly questions, maybe they trick me to come up with the correct answer :D >>> >>> Basically without this, you won’t be able to power off the system >>> other than hitting the PONKEY. >>> So it’s a new feature that wasn’t supported before. >>> Maybe this feature should not be optional? >> >> You are still describing what driver should do with registers. What you >> are missing is describing real cause for this. It's exactly the same >> case as was with s2mps11. > > I didn’t mention anything with registers in the patch: > > if present, configure the PMIC to shutdown all power rails when > power off sequence have finished. > Use this option if the SoC should be powered off by external power management > IC (PMIC). > > ^^ That’s is exactly what is happening if the option is enabled. > > Do you have a suggestion wording? > What do you think about removing this option and make it default behaviour? Again - you write what the driver should do ("configure the PMIC") when something in Linux happens ("power off sequence have finished"). Exactly the same case as s2mps11. Look how it was worded there. You need to find the real cause, why such actions are required on which board. Otherwise it does not warrant DT property and just perform it always. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property 2023-06-01 15:25 ` Krzysztof Kozlowski @ 2023-06-01 20:03 ` Conor Dooley 0 siblings, 0 replies; 16+ messages in thread From: Conor Dooley @ 2023-06-01 20:03 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Sean Nyekjaer, Conor Dooley, robh+dt, Lee Jones, Krzysztof Kozlowski, Conor Dooley, pascal Paillet, devicetree, linux-kernel [-- Attachment #1: Type: text/plain, Size: 6831 bytes --] Not trimming any of this in case Lee wants to chime in and needs the context... On Thu, Jun 01, 2023 at 05:25:21PM +0200, Krzysztof Kozlowski wrote: > On 01/06/2023 16:05, Sean Nyekjaer wrote: > >> On 1 Jun 2023, at 09.12, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > >> On 24/05/2023 12:30, Sean Nyekjaer wrote: > >>>> On 24 May 2023, at 12.08, Conor Dooley <conor.dooley@microchip.com> wrote: > >>>> On Wed, May 24, 2023 at 10:16:13AM +0200, Sean Nyekjær wrote: > >>>>>> On 23 May 2023, at 19.29, Conor Dooley <conor@kernel.org> wrote: > >>>>>> On Tue, May 23, 2023 at 11:55:50AM +0200, Sean Nyekjær wrote: > >>>>>>>> On 16 May 2023, at 20.06, Conor Dooley <conor@kernel.org> wrote: > >>>>>>>> On Tue, May 16, 2023 at 03:22:24PM +0200, Sean Nyekjaer wrote: > >>>>>>>>> Document the new optional "fsl,pmic-poweroff" property. > >>>>>>>>> > >>>>>>>>> Signed-off-by: Sean Nyekjaer <sean@geanix.com> > >>>>>>>>> --- > >>>>>>>>> Documentation/devicetree/bindings/mfd/st,stpmic1.yaml | 8 ++++++++ > >>>>>>>>> 1 file changed, 8 insertions(+) > >>>>>>>>> > >>>>>>>>> diff --git a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >>>>>>>>> index 9573e4af949e..5183a7c660d2 100644 > >>>>>>>>> --- a/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >>>>>>>>> +++ b/Documentation/devicetree/bindings/mfd/st,stpmic1.yaml > >>>>>>>>> @@ -26,6 +26,14 @@ properties: > >>>>>>>>> > >>>>>>>>> interrupt-controller: true > >>>>>>>>> > >>>>>>>>> + st,pmic-poweroff: > >>>>>>>>> + $ref: /schemas/types.yaml#/definitions/flag > >>>>>>>>> + description: | > >>>>>>>>> + if present, configure the PMIC to shutdown all power rails when > >>>>>>>>> + power off sequence have finished. > >>>>>>>>> + Use this option if the SoC should be powered off by external power management > >>>>>>>>> + IC (PMIC). > >>>>>>>> > >>>>>>>> Just reading this description, this is sounding quite like a "software > >>>>>>>> behaviour" type of property, which are not permitted, rather than > >>>>>>>> describing some element of the hardware. Clearly you are trying to solve > >>>>>>>> an actual problem though, so try re-phrasing the description (and > >>>>>>>> property name) to focus on what exact hardware configuration it is that > >>>>>>>> you are trying to special-case. > >>>>>>>> Krzysztof suggested that the samsung,s2mps11-acokb-ground property in > >>>>>>>> samsung,s2mps11.yaml is addressing a similar problem, so that could be > >>>>>>>> good to look at. > >>>>>>> > >>>>>>> Better wording? > >>>>>>> Indicates that the power management IC (PMIC) is used to power off the board. > >>>>>>> So as the last step in the power off sequence set the SWOFF bit in the > >>>>>>> main control register (MAIN_CR) register, to shutdown all power rails. > >>>>>> > >>>>>> The description for the property that Krzysztof mentioned is > >>>>>> samsung,s2mps11-acokb-ground: > >>>>>> description: | > >>>>>> Indicates that ACOKB pin of S2MPS11 PMIC is connected to the ground so > >>>>>> the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the > >>>>>> power. Usually the ACOKB is pulled up to VBATT so when PWRHOLD pin goes > >>>>>> low, the rising ACOKB will trigger power off. > >>>>>> > >>>>>> In other words, I am asking what (abnormal?) scenario there is that means > >>>>>> you need the property, rather than what setting the property does. > >>>>>> Or am I totally off, and this is the only way this PMIC works? > >>>>> > >>>>> Indicates that the power management IC (PMIC) turn-off condition is met > >>>>> by setting the SWOFF bit in the main control register (MAIN_CR) register. > >>>>> Turn-off condition can still be reached by the PONKEY input. > >>>>> > >>>>> ? > >>>>> > >>>>> I must admit I’m somewhat lost here :) > >>>> > >>>> Sorry about that. I'm trying to understand what is different about your > >>>> hardware that it needs the property rather than what adding the property > >>>> does. If you look at the samsung one, it describes both the > >>>> configuration of the hardware ("ACOKB pin of S2MPS11 PMIC is connected to > >>>> the ground") and how that is different from normal ("Usually the ACOKB is > >>>> pulled up to VBATT so when PWRHOLD pin goes low, the rising ACOKB will > >>>> trigger power off.") > >>>> > >>>> Looking at your datasheet, you don't have such a pin though - just the > >>>> sw poweroff bit & the PONKEY stuff. My angle is just that I am trying > >>>> to figure out why you need this property when it has not been needed > >>>> before. Or why you would not always want to "shutdown all power rails > >>>> when power-off sequence have finished". I'm sorry if these are silly > >>>> questions. > >>>> > >>> > >>> No silly questions, maybe they trick me to come up with the correct answer :D > >>> > >>> Basically without this, you won’t be able to power off the system > >>> other than hitting the PONKEY. > >>> So it’s a new feature that wasn’t supported before. > >>> Maybe this feature should not be optional? [1] > >> > >> You are still describing what driver should do with registers. What you > >> are missing is describing real cause for this. It's exactly the same > >> case as was with s2mps11. > > > > I didn’t mention anything with registers in the patch: > > > > if present, configure the PMIC to shutdown all power rails when > > power off sequence have finished. > > Use this option if the SoC should be powered off by external power management > > IC (PMIC). > > > > ^^ That’s is exactly what is happening if the option is enabled. > > > > Do you have a suggestion wording? > > What do you think about removing this option and make it default behaviour? > > Again - you write what the driver should do ("configure the PMIC") when > something in Linux happens ("power off sequence have finished"). Exactly > the same case as s2mps11. Look how it was worded there. You need to find > the real cause, why such actions are required on which board. > > Otherwise it does not warrant DT property and just perform it always. Yeah, Sean asked that a few messages back up [1] & having looked at the datasheet I am kinda struggling to see why you would not just always want to do this. There does not seem to be an equivalent pin in this PMIC as your Samsung one, so this patch isn't working around some flaw in a board design, but rather seems to be looking to implement the actual functionality. I vote for do it always, obviously unless Less disagrees, and if that causes problems we can revisit the dt property with more understanding of whatever use case breaks if this is done unilaterally. Cheers, Conor. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming 2023-05-16 13:22 [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming Sean Nyekjaer 2023-05-16 13:22 ` [PATCH v2 2/3] mfd: stpmic1: add pmic poweroff via sys-off handler Sean Nyekjaer 2023-05-16 13:22 ` [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property Sean Nyekjaer @ 2023-05-25 11:46 ` Lee Jones 2 siblings, 0 replies; 16+ messages in thread From: Lee Jones @ 2023-05-25 11:46 UTC (permalink / raw) To: Sean Nyekjaer; +Cc: robh+dt, devicetree, linux-kernel On Tue, 16 May 2023, Sean Nyekjaer wrote: > Fixup main control register and bits naming so the match the naming from > the datasheet. > > https://www.st.com/resource/en/datasheet/stpmic1.pdf > > Signed-off-by: Sean Nyekjaer <sean@geanix.com> > --- > Changes since v1: > - None > > drivers/mfd/stpmic1.c | 4 ++-- > include/linux/mfd/stpmic1.h | 12 ++++++------ > 2 files changed, 8 insertions(+), 8 deletions(-) Reviewed-by: Lee Jones <lee@kernel.org> -- Lee Jones [李琼斯] ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-06-01 20:03 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-05-16 13:22 [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming Sean Nyekjaer 2023-05-16 13:22 ` [PATCH v2 2/3] mfd: stpmic1: add pmic poweroff via sys-off handler Sean Nyekjaer 2023-05-25 11:46 ` Lee Jones 2023-05-16 13:22 ` [PATCH v2 3/3] dt-bindings: mfd: stpmic1: add fsl,pmic-poweroff property Sean Nyekjaer 2023-05-16 18:06 ` Conor Dooley 2023-05-23 9:55 ` Sean Nyekjær 2023-05-23 17:29 ` Conor Dooley 2023-05-24 8:16 ` Sean Nyekjær 2023-05-24 10:08 ` Conor Dooley 2023-05-24 10:30 ` Sean Nyekjaer 2023-05-24 19:57 ` Conor Dooley 2023-06-01 7:12 ` Krzysztof Kozlowski 2023-06-01 14:05 ` Sean Nyekjaer 2023-06-01 15:25 ` Krzysztof Kozlowski 2023-06-01 20:03 ` Conor Dooley 2023-05-25 11:46 ` [PATCH v2 1/3] mfd: stpmic1: fixup main control register and bits naming Lee Jones
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).