RE: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-10 Thread Flavio Suligoi
Hi Rob,

> On Mon, Apr 8, 2019 at 2:22 AM Flavio Suligoi  wrote:
> >
> > HI,
> >
> > > On 06/04/2019 01:07:13-0500, Rob Herring wrote:
> > > > On Wed, Apr 03, 2019 at 04:52:44PM +0200, Flavio Suligoi wrote:
> > > > > Some RTC devices have a battery-low automatic detection circuit.
> > > > > The battery-low event is usually reported with:
> > > > >
> > > > > - a bit change in a RTC status register
> > > > > - a hw signaling (generally using an interrupt generation),
> changing
> > > > >   the hw level of a specific pin;
> > > > >
> > > > > The new property "battery-low-hw-alarm" enable the RTC to generate
> the
> > > > > hw signaling in case of battery-low event.
> > > > >
> > > > > Signed-off-by: Flavio Suligoi 
> > > > > ---
> > > > >  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
> > > > >  1 file changed, 3 insertions(+)
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt
> > > b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > > index a97fc6a..f93a44d 100644
> > > > > --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > > +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > > @@ -31,6 +31,9 @@ below.
> > > > >  expressed in femto Farad (fF).
> > > > >  The default value shall be listed (if
> > > optional),
> > > > >  and likewise all valid values.
> > > > > +- battery-low-hw-alarm :Enable the "battery-low" output pin.
> This
> > > function
> > > > > +is available on the following
> devices:
> > > > > +- pcf2127 - pin used for alarm: INTn
> > > >
> > > > Boolean? If there's cases where which pin is selectable, then we'd
> need
> > > > this to take a value. Not sure how likely that is?
> > > >
> > >
> > > Indeed, there is at least the pcf85363 that has two possible pins for
> > > that interrupt. How would you select the pin then? a zero based index?
> a
> > > string?
> 
> I prefer an index.

Ok, so we can call this property as:

low-voltage-alarm

and we can select the pin using a zero-base index,
also for future developments.

> 
> > I think the string could be clearer for the final user and would give
> > more freedom for future changes.
> > For example, we can call this property, instead of "battery-low-alarm"
> or
> > "low-voltage-alarm", simply: "alarm-pin_1" and then the string argument
> > can describe the function used; for example:
> >
> > alarm-pin_1 = "backup-supply-low-voltage-alarm";
> > alarm-pin_2 = "..";
> 
> How many pins and functions then? And how does this relate to any
> interrupts?

If we use index, we don't use strings any more.


Re: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-08 Thread Rob Herring
On Mon, Apr 8, 2019 at 2:22 AM Flavio Suligoi  wrote:
>
> HI,
>
> > On 06/04/2019 01:07:13-0500, Rob Herring wrote:
> > > On Wed, Apr 03, 2019 at 04:52:44PM +0200, Flavio Suligoi wrote:
> > > > Some RTC devices have a battery-low automatic detection circuit.
> > > > The battery-low event is usually reported with:
> > > >
> > > > - a bit change in a RTC status register
> > > > - a hw signaling (generally using an interrupt generation), changing
> > > >   the hw level of a specific pin;
> > > >
> > > > The new property "battery-low-hw-alarm" enable the RTC to generate the
> > > > hw signaling in case of battery-low event.
> > > >
> > > > Signed-off-by: Flavio Suligoi 
> > > > ---
> > > >  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt
> > b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > index a97fc6a..f93a44d 100644
> > > > --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > @@ -31,6 +31,9 @@ below.
> > > >  expressed in femto Farad (fF).
> > > >  The default value shall be listed (if
> > optional),
> > > >  and likewise all valid values.
> > > > +- battery-low-hw-alarm :Enable the "battery-low" output pin. This
> > function
> > > > +is available on the following devices:
> > > > +- pcf2127 - pin used for alarm: INTn
> > >
> > > Boolean? If there's cases where which pin is selectable, then we'd need
> > > this to take a value. Not sure how likely that is?
> > >
> >
> > Indeed, there is at least the pcf85363 that has two possible pins for
> > that interrupt. How would you select the pin then? a zero based index? a
> > string?

I prefer an index.

> I think the string could be clearer for the final user and would give
> more freedom for future changes.
> For example, we can call this property, instead of "battery-low-alarm" or
> "low-voltage-alarm", simply: "alarm-pin_1" and then the string argument
> can describe the function used; for example:
>
> alarm-pin_1 = "backup-supply-low-voltage-alarm";
> alarm-pin_2 = "..";

How many pins and functions then? And how does this relate to any interrupts?

Rob


RE: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-08 Thread Flavio Suligoi
HI,

> On 06/04/2019 01:07:13-0500, Rob Herring wrote:
> > On Wed, Apr 03, 2019 at 04:52:44PM +0200, Flavio Suligoi wrote:
> > > Some RTC devices have a battery-low automatic detection circuit.
> > > The battery-low event is usually reported with:
> > >
> > > - a bit change in a RTC status register
> > > - a hw signaling (generally using an interrupt generation), changing
> > >   the hw level of a specific pin;
> > >
> > > The new property "battery-low-hw-alarm" enable the RTC to generate the
> > > hw signaling in case of battery-low event.
> > >
> > > Signed-off-by: Flavio Suligoi 
> > > ---
> > >  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt
> b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > index a97fc6a..f93a44d 100644
> > > --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> > > +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > @@ -31,6 +31,9 @@ below.
> > >  expressed in femto Farad (fF).
> > >  The default value shall be listed (if
> optional),
> > >  and likewise all valid values.
> > > +- battery-low-hw-alarm :Enable the "battery-low" output pin. This
> function
> > > +is available on the following devices:
> > > +- pcf2127 - pin used for alarm: INTn
> >
> > Boolean? If there's cases where which pin is selectable, then we'd need
> > this to take a value. Not sure how likely that is?
> >
> 
> Indeed, there is at least the pcf85363 that has two possible pins for
> that interrupt. How would you select the pin then? a zero based index? a
> string?

I think the string could be clearer for the final user and would give
more freedom for future changes.
For example, we can call this property, instead of "battery-low-alarm" or 
"low-voltage-alarm", simply: "alarm-pin_1" and then the string argument 
can describe the function used; for example:

alarm-pin_1 = "backup-supply-low-voltage-alarm";
alarm-pin_2 = "..";

Flavio Suligoi


Re: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-06 Thread Alexandre Belloni
On 06/04/2019 01:07:13-0500, Rob Herring wrote:
> On Wed, Apr 03, 2019 at 04:52:44PM +0200, Flavio Suligoi wrote:
> > Some RTC devices have a battery-low automatic detection circuit.
> > The battery-low event is usually reported with:
> > 
> > - a bit change in a RTC status register
> > - a hw signaling (generally using an interrupt generation), changing
> >   the hw level of a specific pin;
> > 
> > The new property "battery-low-hw-alarm" enable the RTC to generate the
> > hw signaling in case of battery-low event.
> > 
> > Signed-off-by: Flavio Suligoi 
> > ---
> >  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt 
> > b/Documentation/devicetree/bindings/rtc/rtc.txt
> > index a97fc6a..f93a44d 100644
> > --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> > +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> > @@ -31,6 +31,9 @@ below.
> >  expressed in femto Farad (fF).
> >  The default value shall be listed (if 
> > optional),
> >  and likewise all valid values.
> > +- battery-low-hw-alarm :Enable the "battery-low" output pin. This 
> > function
> > +is available on the following devices:
> > +- pcf2127 - pin used for alarm: INTn
> 
> Boolean? If there's cases where which pin is selectable, then we'd need 
> this to take a value. Not sure how likely that is?
> 

Indeed, there is at least the pcf85363 that has two possible pins for
that interrupt. How would you select the pin then? a zero based index? a
string?

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Re: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-06 Thread Rob Herring
On Wed, Apr 03, 2019 at 04:52:44PM +0200, Flavio Suligoi wrote:
> Some RTC devices have a battery-low automatic detection circuit.
> The battery-low event is usually reported with:
> 
> - a bit change in a RTC status register
> - a hw signaling (generally using an interrupt generation), changing
>   the hw level of a specific pin;
> 
> The new property "battery-low-hw-alarm" enable the RTC to generate the
> hw signaling in case of battery-low event.
> 
> Signed-off-by: Flavio Suligoi 
> ---
>  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt 
> b/Documentation/devicetree/bindings/rtc/rtc.txt
> index a97fc6a..f93a44d 100644
> --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> @@ -31,6 +31,9 @@ below.
>  expressed in femto Farad (fF).
>  The default value shall be listed (if optional),
>  and likewise all valid values.
> +- battery-low-hw-alarm :Enable the "battery-low" output pin. This 
> function
> +is available on the following devices:
> +- pcf2127 - pin used for alarm: INTn

Boolean? If there's cases where which pin is selectable, then we'd need 
this to take a value. Not sure how likely that is?

Rob



RE: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-03 Thread Flavio Suligoi
Hi,


> On 03/04/2019 15:06:17+, Flavio Suligoi wrote:
> > Hi Alexandre,
> >
> > > Hi,
> > >
> > > On 03/04/2019 16:52:44+0200, Flavio Suligoi wrote:
> > > > Some RTC devices have a battery-low automatic detection circuit.
> > > > The battery-low event is usually reported with:
> > > >
> > > > - a bit change in a RTC status register
> > > > - a hw signaling (generally using an interrupt generation), changing
> > > >   the hw level of a specific pin;
> > > >
> > > > The new property "battery-low-hw-alarm" enable the RTC to generate
> the
> > > > hw signaling in case of battery-low event.
> > > >
> > > > Signed-off-by: Flavio Suligoi 
> > > > ---
> > > >  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt
> > > b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > index a97fc6a..f93a44d 100644
> > > > --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > > @@ -31,6 +31,9 @@ below.
> > > >  expressed in femto Farad (fF).
> > > >  The default value shall be listed (if
> > > optional),
> > > >  and likewise all valid values.
> > > > +- battery-low-hw-alarm :Enable the "battery-low" output pin.
> This
> > > function
> > >
> > > I would name that voltage-low-alarm as not all the secondary voltages
> > > are batteries.
> >
> > You have right. So we can also name the property a: "voltage-low-hw-
> alarm".
> > I prefer to have the word "hw" in the property name, since the "sw"
> voltage
> > low alarm is already present is some RTC drivers.
> > In this way, with the word "hw", is more clear that we are speaking
> about
> > an hw pin signaling.
> >
> 
> Well, the device tree always describes the hardware so there is no point
> in specifying hw.

Right, so I rename the property in "voltage-low-alarm"

> 
> 
> --
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Flavio Suligoi


Re: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-03 Thread Alexandre Belloni
On 03/04/2019 15:06:17+, Flavio Suligoi wrote:
> Hi Alexandre,
> 
> > Hi,
> > 
> > On 03/04/2019 16:52:44+0200, Flavio Suligoi wrote:
> > > Some RTC devices have a battery-low automatic detection circuit.
> > > The battery-low event is usually reported with:
> > >
> > > - a bit change in a RTC status register
> > > - a hw signaling (generally using an interrupt generation), changing
> > >   the hw level of a specific pin;
> > >
> > > The new property "battery-low-hw-alarm" enable the RTC to generate the
> > > hw signaling in case of battery-low event.
> > >
> > > Signed-off-by: Flavio Suligoi 
> > > ---
> > >  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt
> > b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > index a97fc6a..f93a44d 100644
> > > --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> > > +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> > > @@ -31,6 +31,9 @@ below.
> > >  expressed in femto Farad (fF).
> > >  The default value shall be listed (if
> > optional),
> > >  and likewise all valid values.
> > > +- battery-low-hw-alarm :Enable the "battery-low" output pin. This
> > function
> > 
> > I would name that voltage-low-alarm as not all the secondary voltages
> > are batteries.
> 
> You have right. So we can also name the property a: "voltage-low-hw-alarm". 
> I prefer to have the word "hw" in the property name, since the "sw" voltage
> low alarm is already present is some RTC drivers. 
> In this way, with the word "hw", is more clear that we are speaking about
> an hw pin signaling.
> 

Well, the device tree always describes the hardware so there is no point
in specifying hw.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


RE: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-03 Thread Flavio Suligoi
Hi Alexandre,

> Hi,
> 
> On 03/04/2019 16:52:44+0200, Flavio Suligoi wrote:
> > Some RTC devices have a battery-low automatic detection circuit.
> > The battery-low event is usually reported with:
> >
> > - a bit change in a RTC status register
> > - a hw signaling (generally using an interrupt generation), changing
> >   the hw level of a specific pin;
> >
> > The new property "battery-low-hw-alarm" enable the RTC to generate the
> > hw signaling in case of battery-low event.
> >
> > Signed-off-by: Flavio Suligoi 
> > ---
> >  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt
> b/Documentation/devicetree/bindings/rtc/rtc.txt
> > index a97fc6a..f93a44d 100644
> > --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> > +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> > @@ -31,6 +31,9 @@ below.
> >  expressed in femto Farad (fF).
> >  The default value shall be listed (if
> optional),
> >  and likewise all valid values.
> > +- battery-low-hw-alarm :Enable the "battery-low" output pin. This
> function
> 
> I would name that voltage-low-alarm as not all the secondary voltages
> are batteries.

You have right. So we can also name the property a: "voltage-low-hw-alarm". 
I prefer to have the word "hw" in the property name, since the "sw" voltage
low alarm is already present is some RTC drivers. 
In this way, with the word "hw", is more clear that we are speaking about
an hw pin signaling.

> 
> > +is available on the following devices:
> > +- pcf2127 - pin used for alarm: INTn
> >
> >  Trivial RTCs
> >  
> > --
> > 2.7.4
> >
> 
> --
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com


Thanks,

Flavio Suligoi



Re: [PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-03 Thread Alexandre Belloni
Hi,

On 03/04/2019 16:52:44+0200, Flavio Suligoi wrote:
> Some RTC devices have a battery-low automatic detection circuit.
> The battery-low event is usually reported with:
> 
> - a bit change in a RTC status register
> - a hw signaling (generally using an interrupt generation), changing
>   the hw level of a specific pin;
> 
> The new property "battery-low-hw-alarm" enable the RTC to generate the
> hw signaling in case of battery-low event.
> 
> Signed-off-by: Flavio Suligoi 
> ---
>  Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt 
> b/Documentation/devicetree/bindings/rtc/rtc.txt
> index a97fc6a..f93a44d 100644
> --- a/Documentation/devicetree/bindings/rtc/rtc.txt
> +++ b/Documentation/devicetree/bindings/rtc/rtc.txt
> @@ -31,6 +31,9 @@ below.
>  expressed in femto Farad (fF).
>  The default value shall be listed (if optional),
>  and likewise all valid values.
> +- battery-low-hw-alarm :Enable the "battery-low" output pin. This 
> function

I would name that voltage-low-alarm as not all the secondary voltages
are batteries.

> +is available on the following devices:
> +- pcf2127 - pin used for alarm: INTn
>  
>  Trivial RTCs
>  
> -- 
> 2.7.4
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


[PATCH 1/2] dt-bindings: rtc: add battery-low-hw-alarm property

2019-04-03 Thread Flavio Suligoi
Some RTC devices have a battery-low automatic detection circuit.
The battery-low event is usually reported with:

- a bit change in a RTC status register
- a hw signaling (generally using an interrupt generation), changing
  the hw level of a specific pin;

The new property "battery-low-hw-alarm" enable the RTC to generate the
hw signaling in case of battery-low event.

Signed-off-by: Flavio Suligoi 
---
 Documentation/devicetree/bindings/rtc/rtc.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/rtc.txt 
b/Documentation/devicetree/bindings/rtc/rtc.txt
index a97fc6a..f93a44d 100644
--- a/Documentation/devicetree/bindings/rtc/rtc.txt
+++ b/Documentation/devicetree/bindings/rtc/rtc.txt
@@ -31,6 +31,9 @@ below.
 expressed in femto Farad (fF).
 The default value shall be listed (if optional),
 and likewise all valid values.
+- battery-low-hw-alarm :Enable the "battery-low" output pin. This function
+is available on the following devices:
+- pcf2127 - pin used for alarm: INTn
 
 Trivial RTCs
 
-- 
2.7.4