* [PATCH] dt-bindings: power: reset: restart-handler: add common schema
@ 2022-09-07 12:36 Krzysztof Kozlowski
2022-09-07 16:32 ` Pali Rohár
0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2022-09-07 12:36 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, linux-pm,
devicetree, linux-kernel
Cc: Pali Rohár, Krzysztof Kozlowski
Add common schema for restart and shutdown handlers, so they all use
same meaning of "priority" field. The Linux drivers already have this
property and some systems want to customize it per-board in DTS.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
See also:
https://lore.kernel.org/all/8fe93da3-f768-16ae-7025-1cfa97a42b27@linaro.org/
https://lore.kernel.org/all/20220831081715.14673-1-pali@kernel.org/
---
.../bindings/power/reset/gpio-restart.yaml | 13 ++------
.../bindings/power/reset/restart-handler.yaml | 30 +++++++++++++++++++
2 files changed, 33 insertions(+), 10 deletions(-)
create mode 100644 Documentation/devicetree/bindings/power/reset/restart-handler.yaml
diff --git a/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml b/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
index a72d5c721516..d3d18e0f5db3 100644
--- a/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
+++ b/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
@@ -25,6 +25,9 @@ description: >
inactive-delay, the GPIO is driven active again. After a delay specified by wait-delay, the
restart handler completes allowing other restart handlers to be attempted.
+allOf:
+ - $ref: restart-handler.yaml#
+
properties:
compatible:
const: gpio-restart
@@ -41,16 +44,6 @@ properties:
in its inactive state.
priority:
- $ref: /schemas/types.yaml#/definitions/uint32
- description: |
- A priority ranging from 0 to 255 (default 129) according to the following guidelines:
-
- 0: Restart handler of last resort, with limited restart capabilities.
- 128: Default restart handler; use if no other restart handler is expected to be available,
- and/or if restart functionality is sufficient to restart the entire system.
- 255: Highest priority restart handler, will preempt all other restart handlers.
- minimum: 0
- maximum: 255
default: 129
active-delay:
diff --git a/Documentation/devicetree/bindings/power/reset/restart-handler.yaml b/Documentation/devicetree/bindings/power/reset/restart-handler.yaml
new file mode 100644
index 000000000000..f5d22ca0cd45
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/restart-handler.yaml
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/restart-handler.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Restart and shutdown handler generic binding
+
+maintainers:
+ - Sebastian Reichel <sre@kernel.org>
+
+description:
+ Restart and shutdown handler device is responsible for powering off the
+ system, e.g. my cutting off the power. System might have several restart
+ handlers, which usually are tried from most precise to last resort.
+
+properties:
+ priority:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: |
+ A priority ranging from 0 to 255 according to the following guidelines::
+ 0: Restart handler of last resort, with limited restart capabilities.
+ 128: Typical, default restart handler; use if no other restart handler
+ is expected to be available, and/or if restart functionality is
+ sufficient to restart the entire system.
+ 255: Highest priority restart handler, will preempt all other restart handlers.
+ minimum: 0
+ maximum: 255
+
+additionalProperties: true
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] dt-bindings: power: reset: restart-handler: add common schema
2022-09-07 12:36 [PATCH] dt-bindings: power: reset: restart-handler: add common schema Krzysztof Kozlowski
@ 2022-09-07 16:32 ` Pali Rohár
2022-09-08 7:28 ` Krzysztof Kozlowski
2022-09-11 12:27 ` Sebastian Reichel
0 siblings, 2 replies; 4+ messages in thread
From: Pali Rohár @ 2022-09-07 16:32 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, linux-pm,
devicetree, linux-kernel
On Wednesday 07 September 2022 14:36:30 Krzysztof Kozlowski wrote:
> Add common schema for restart and shutdown handlers, so they all use
> same meaning of "priority" field. The Linux drivers already have this
> property and some systems want to customize it per-board in DTS.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> ---
>
> See also:
> https://lore.kernel.org/all/8fe93da3-f768-16ae-7025-1cfa97a42b27@linaro.org/
> https://lore.kernel.org/all/20220831081715.14673-1-pali@kernel.org/
> ---
> .../bindings/power/reset/gpio-restart.yaml | 13 ++------
> .../bindings/power/reset/restart-handler.yaml | 30 +++++++++++++++++++
> 2 files changed, 33 insertions(+), 10 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/power/reset/restart-handler.yaml
>
> diff --git a/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml b/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
> index a72d5c721516..d3d18e0f5db3 100644
> --- a/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
> @@ -25,6 +25,9 @@ description: >
> inactive-delay, the GPIO is driven active again. After a delay specified by wait-delay, the
> restart handler completes allowing other restart handlers to be attempted.
>
> +allOf:
> + - $ref: restart-handler.yaml#
> +
> properties:
> compatible:
> const: gpio-restart
> @@ -41,16 +44,6 @@ properties:
> in its inactive state.
>
> priority:
> - $ref: /schemas/types.yaml#/definitions/uint32
> - description: |
> - A priority ranging from 0 to 255 (default 129) according to the following guidelines:
> -
> - 0: Restart handler of last resort, with limited restart capabilities.
> - 128: Default restart handler; use if no other restart handler is expected to be available,
> - and/or if restart functionality is sufficient to restart the entire system.
> - 255: Highest priority restart handler, will preempt all other restart handlers.
> - minimum: 0
> - maximum: 255
> default: 129
>
> active-delay:
> diff --git a/Documentation/devicetree/bindings/power/reset/restart-handler.yaml b/Documentation/devicetree/bindings/power/reset/restart-handler.yaml
> new file mode 100644
> index 000000000000..f5d22ca0cd45
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/reset/restart-handler.yaml
> @@ -0,0 +1,30 @@
> +# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/reset/restart-handler.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Restart and shutdown handler generic binding
> +
> +maintainers:
> + - Sebastian Reichel <sre@kernel.org>
> +
> +description:
> + Restart and shutdown handler device is responsible for powering off the
> + system, e.g. my cutting off the power. System might have several restart
> + handlers, which usually are tried from most precise to last resort.
> +
> +properties:
> + priority:
> + $ref: /schemas/types.yaml#/definitions/uint32
IIRC priority is signed integer number, not unsigned.
> + description: |
> + A priority ranging from 0 to 255 according to the following guidelines::
> + 0: Restart handler of last resort, with limited restart capabilities.
> + 128: Typical, default restart handler; use if no other restart handler
> + is expected to be available, and/or if restart functionality is
> + sufficient to restart the entire system.
> + 255: Highest priority restart handler, will preempt all other restart handlers.
> + minimum: 0
> + maximum: 255
And IIRC also other values (above 255 or below 0) are allowed for tuning
two "highest" or two "last resort" handlers.
This needs to be checked / tested to ensure that new schema is not incorrect.
> +
> +additionalProperties: true
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dt-bindings: power: reset: restart-handler: add common schema
2022-09-07 16:32 ` Pali Rohár
@ 2022-09-08 7:28 ` Krzysztof Kozlowski
2022-09-11 12:27 ` Sebastian Reichel
1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2022-09-08 7:28 UTC (permalink / raw)
To: Pali Rohár
Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, linux-pm,
devicetree, linux-kernel
On 07/09/2022 18:32, Pali Rohár wrote:
> On Wednesday 07 September 2022 14:36:30 Krzysztof Kozlowski wrote:
>> Add common schema for restart and shutdown handlers, so they all use
>> same meaning of "priority" field. The Linux drivers already have this
>> property and some systems want to customize it per-board in DTS.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> ---
>>
>> See also:
>> https://lore.kernel.org/all/8fe93da3-f768-16ae-7025-1cfa97a42b27@linaro.org/
>> https://lore.kernel.org/all/20220831081715.14673-1-pali@kernel.org/
>> ---
>> .../bindings/power/reset/gpio-restart.yaml | 13 ++------
>> .../bindings/power/reset/restart-handler.yaml | 30 +++++++++++++++++++
>> 2 files changed, 33 insertions(+), 10 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/power/reset/restart-handler.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml b/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
>> index a72d5c721516..d3d18e0f5db3 100644
>> --- a/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
>> +++ b/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
>> @@ -25,6 +25,9 @@ description: >
>> inactive-delay, the GPIO is driven active again. After a delay specified by wait-delay, the
>> restart handler completes allowing other restart handlers to be attempted.
>>
>> +allOf:
>> + - $ref: restart-handler.yaml#
>> +
>> properties:
>> compatible:
>> const: gpio-restart
>> @@ -41,16 +44,6 @@ properties:
>> in its inactive state.
>>
>> priority:
>> - $ref: /schemas/types.yaml#/definitions/uint32
>> - description: |
>> - A priority ranging from 0 to 255 (default 129) according to the following guidelines:
>> -
>> - 0: Restart handler of last resort, with limited restart capabilities.
>> - 128: Default restart handler; use if no other restart handler is expected to be available,
>> - and/or if restart functionality is sufficient to restart the entire system.
>> - 255: Highest priority restart handler, will preempt all other restart handlers.
>> - minimum: 0
>> - maximum: 255
>> default: 129
>>
>> active-delay:
>> diff --git a/Documentation/devicetree/bindings/power/reset/restart-handler.yaml b/Documentation/devicetree/bindings/power/reset/restart-handler.yaml
>> new file mode 100644
>> index 000000000000..f5d22ca0cd45
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/power/reset/restart-handler.yaml
>> @@ -0,0 +1,30 @@
>> +# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/power/reset/restart-handler.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Restart and shutdown handler generic binding
>> +
>> +maintainers:
>> + - Sebastian Reichel <sre@kernel.org>
>> +
>> +description:
>> + Restart and shutdown handler device is responsible for powering off the
>> + system, e.g. my cutting off the power. System might have several restart
>> + handlers, which usually are tried from most precise to last resort.
>> +
>> +properties:
>> + priority:
>> + $ref: /schemas/types.yaml#/definitions/uint32
>
> IIRC priority is signed integer number, not unsigned.
Although technically in the kernel it is int, all existing kernel users
assign here unsigned number and existing bindings were unsigned int, so
I don't think there is benefit to change it to signed.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dt-bindings: power: reset: restart-handler: add common schema
2022-09-07 16:32 ` Pali Rohár
2022-09-08 7:28 ` Krzysztof Kozlowski
@ 2022-09-11 12:27 ` Sebastian Reichel
1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Reichel @ 2022-09-11 12:27 UTC (permalink / raw)
To: Pali Rohár
Cc: Krzysztof Kozlowski, Rob Herring, Krzysztof Kozlowski, linux-pm,
devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4551 bytes --]
Hi,
On Wed, Sep 07, 2022 at 06:32:18PM +0200, Pali Rohár wrote:
> On Wednesday 07 September 2022 14:36:30 Krzysztof Kozlowski wrote:
> > Add common schema for restart and shutdown handlers, so they all use
> > same meaning of "priority" field. The Linux drivers already have this
> > property and some systems want to customize it per-board in DTS.
> >
> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> >
> > ---
> >
> > See also:
> > https://lore.kernel.org/all/8fe93da3-f768-16ae-7025-1cfa97a42b27@linaro.org/
> > https://lore.kernel.org/all/20220831081715.14673-1-pali@kernel.org/
> > ---
> > .../bindings/power/reset/gpio-restart.yaml | 13 ++------
> > .../bindings/power/reset/restart-handler.yaml | 30 +++++++++++++++++++
> > 2 files changed, 33 insertions(+), 10 deletions(-)
> > create mode 100644 Documentation/devicetree/bindings/power/reset/restart-handler.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml b/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
> > index a72d5c721516..d3d18e0f5db3 100644
> > --- a/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
> > +++ b/Documentation/devicetree/bindings/power/reset/gpio-restart.yaml
> > @@ -25,6 +25,9 @@ description: >
> > inactive-delay, the GPIO is driven active again. After a delay specified by wait-delay, the
> > restart handler completes allowing other restart handlers to be attempted.
> >
> > +allOf:
> > + - $ref: restart-handler.yaml#
> > +
> > properties:
> > compatible:
> > const: gpio-restart
> > @@ -41,16 +44,6 @@ properties:
> > in its inactive state.
> >
> > priority:
> > - $ref: /schemas/types.yaml#/definitions/uint32
> > - description: |
> > - A priority ranging from 0 to 255 (default 129) according to the following guidelines:
> > -
> > - 0: Restart handler of last resort, with limited restart capabilities.
> > - 128: Default restart handler; use if no other restart handler is expected to be available,
> > - and/or if restart functionality is sufficient to restart the entire system.
> > - 255: Highest priority restart handler, will preempt all other restart handlers.
> > - minimum: 0
> > - maximum: 255
> > default: 129
> >
> > active-delay:
> > diff --git a/Documentation/devicetree/bindings/power/reset/restart-handler.yaml b/Documentation/devicetree/bindings/power/reset/restart-handler.yaml
> > new file mode 100644
> > index 000000000000..f5d22ca0cd45
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/power/reset/restart-handler.yaml
> > @@ -0,0 +1,30 @@
> > +# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/power/reset/restart-handler.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Restart and shutdown handler generic binding
> > +
> > +maintainers:
> > + - Sebastian Reichel <sre@kernel.org>
> > +
> > +description:
> > + Restart and shutdown handler device is responsible for powering off the
> > + system, e.g. my cutting off the power. System might have several restart
> > + handlers, which usually are tried from most precise to last resort.
> > +
> > +properties:
> > + priority:
> > + $ref: /schemas/types.yaml#/definitions/uint32
>
> IIRC priority is signed integer number, not unsigned.
>
> > + description: |
> > + A priority ranging from 0 to 255 according to the following guidelines::
> > + 0: Restart handler of last resort, with limited restart capabilities.
> > + 128: Typical, default restart handler; use if no other restart handler
> > + is expected to be available, and/or if restart functionality is
> > + sufficient to restart the entire system.
> > + 255: Highest priority restart handler, will preempt all other restart handlers.
> > + minimum: 0
> > + maximum: 255
>
> And IIRC also other values (above 255 or below 0) are allowed for tuning
> two "highest" or two "last resort" handlers.
>
> This needs to be checked / tested to ensure that new schema is not incorrect.
priority is blindly copied into the priority field of struct
notifier_block, which is of type int. But that is an implementation
detail. I think the proposal from Krzysztof looks good. But let's
wait a bit to give Rob a chance to review.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-12 10:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-07 12:36 [PATCH] dt-bindings: power: reset: restart-handler: add common schema Krzysztof Kozlowski
2022-09-07 16:32 ` Pali Rohár
2022-09-08 7:28 ` Krzysztof Kozlowski
2022-09-11 12:27 ` Sebastian Reichel
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).