Message ID | 20200905133230.1014581-5-j.neuschaefer@gmx.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Netronix embedded controller driver for Kobo and Tolino ebook readers | expand |
On Sat, Sep 05, 2020 at 03:32:24PM +0200, Jonathan Neuschäfer wrote: > The Netronix embedded controller as found in Kobo Aura and Tolino Shine > supports one PWM channel, which is used to control the frontlight > brightness on these devices. > > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> > --- > > v2: > - Add plaintext binding to patch description, for comparison > - Fix pwm-cells property (should be 2, not 1) > - Add dummy regulator to example, because the pwm-backlight binding requires a > power supply > > > For reference, here is the binding in text form: > > > PWM functionality in Netronix Embedded Controller > > Required properties: > - compatible: should be "netronix,ntxec-pwm" > - #pwm-cells: should be 2. > > Available PWM channels: > - 0: The PWM channel controlled by registers 0xa1-0xa7 > > Example: > > embedded-controller@43 { > compatible = "netronix,ntxec"; > ... > > ec_pwm: pwm { > compatible = "netronix,ntxec-pwm"; > #pwm-cells = <1>; > }; > }; > > ... > > backlight { > compatible = "pwm-backlight"; > pwms = <&ec_pwm 0 50000>; > }; > --- > .../bindings/mfd/netronix,ntxec.yaml | 19 +++++++++++ > .../bindings/pwm/netronix,ntxec-pwm.yaml | 33 +++++++++++++++++++ > 2 files changed, 52 insertions(+) > create mode 100644 Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > > diff --git a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > index 596df460f98eb..73c873dda3e70 100644 > --- a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > +++ b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > @@ -31,6 +31,9 @@ properties: > description: > The EC can signal interrupts via a GPIO line > > + pwm: > + $ref: ../pwm/netronix,ntxec-pwm.yaml > + > required: > - compatible > - reg > @@ -53,5 +56,21 @@ examples: > interrupts = <11 IRQ_TYPE_EDGE_FALLING>; > interrupt-controller; > #interrupt-cells = <1>; > + > + ec_pwm: pwm { > + compatible = "netronix,ntxec-pwm"; > + #pwm-cells = <2>; > + }; > }; > }; > + > + backlight { > + compatible = "pwm-backlight"; > + pwms = <&ec_pwm 0 50000>; > + power-supply = <&backlight_regulator>; > + }; > + > + backlight_regulator: regulator-dummy { > + compatible = "regulator-fixed"; > + regulator-name = "backlight"; > + }; > diff --git a/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml b/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > new file mode 100644 > index 0000000000000..0c9d2801b8de1 > --- /dev/null > +++ b/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > @@ -0,0 +1,33 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/pwm/netronix,ntxec-pwm.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: PWM functionality in Netronix embedded controller > + > +maintainers: > + - Jonathan Neuschäfer <j.neuschaefer@gmx.net> > + > +description: | > + See also Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > + > + The Netronix EC contains PWM functionality, which is usually used to drive > + the backlight LED. > + > + The following PWM channels are supported: > + - 0: The PWM channel controlled by registers 0xa1-0xa7 > + > +allOf: > + - $ref: pwm.yaml# > + > +properties: > + compatible: > + const: netronix,ntxec-pwm > + > + "#pwm-cells": > + const: 2 Just move this to the parent and make the parent a pwm provider. There's no need for child nodes for this or the rtc. Rob
Hi, On Mon, 14 Sep 2020 18:54:43 -0600 Rob Herring <robh@kernel.org> wrote: > On Sat, Sep 05, 2020 at 03:32:24PM +0200, Jonathan Neuschäfer wrote: > > The Netronix embedded controller as found in Kobo Aura and Tolino Shine > > supports one PWM channel, which is used to control the frontlight > > brightness on these devices. > > > > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> > > --- > > > > v2: > > - Add plaintext binding to patch description, for comparison > > - Fix pwm-cells property (should be 2, not 1) > > - Add dummy regulator to example, because the pwm-backlight binding requires a > > power supply > > > > > > For reference, here is the binding in text form: > > > > > > PWM functionality in Netronix Embedded Controller > > > > Required properties: > > - compatible: should be "netronix,ntxec-pwm" > > - #pwm-cells: should be 2. > > > > Available PWM channels: > > - 0: The PWM channel controlled by registers 0xa1-0xa7 > > > > Example: > > > > embedded-controller@43 { > > compatible = "netronix,ntxec"; > > ... > > > > ec_pwm: pwm { > > compatible = "netronix,ntxec-pwm"; > > #pwm-cells = <1>; > > }; > > }; > > > > ... > > > > backlight { > > compatible = "pwm-backlight"; > > pwms = <&ec_pwm 0 50000>; > > }; > > --- > > .../bindings/mfd/netronix,ntxec.yaml | 19 +++++++++++ > > .../bindings/pwm/netronix,ntxec-pwm.yaml | 33 +++++++++++++++++++ > > 2 files changed, 52 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > > > > diff --git a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > > index 596df460f98eb..73c873dda3e70 100644 > > --- a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > > +++ b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > > @@ -31,6 +31,9 @@ properties: > > description: > > The EC can signal interrupts via a GPIO line > > > > + pwm: > > + $ref: ../pwm/netronix,ntxec-pwm.yaml > > + > > required: > > - compatible > > - reg > > @@ -53,5 +56,21 @@ examples: > > interrupts = <11 IRQ_TYPE_EDGE_FALLING>; > > interrupt-controller; > > #interrupt-cells = <1>; > > + > > + ec_pwm: pwm { > > + compatible = "netronix,ntxec-pwm"; > > + #pwm-cells = <2>; > > + }; > > }; > > }; > > + > > + backlight { > > + compatible = "pwm-backlight"; > > + pwms = <&ec_pwm 0 50000>; > > + power-supply = <&backlight_regulator>; > > + }; > > + > > + backlight_regulator: regulator-dummy { > > + compatible = "regulator-fixed"; > > + regulator-name = "backlight"; > > + }; > > diff --git a/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml b/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > > new file mode 100644 > > index 0000000000000..0c9d2801b8de1 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > > @@ -0,0 +1,33 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/pwm/netronix,ntxec-pwm.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: PWM functionality in Netronix embedded controller > > + > > +maintainers: > > + - Jonathan Neuschäfer <j.neuschaefer@gmx.net> > > + > > +description: | > > + See also Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > > + > > + The Netronix EC contains PWM functionality, which is usually used to drive > > + the backlight LED. > > + > > + The following PWM channels are supported: > > + - 0: The PWM channel controlled by registers 0xa1-0xa7 > > + > > +allOf: > > + - $ref: pwm.yaml# > > + > > +properties: > > + compatible: > > + const: netronix,ntxec-pwm > > + > > + "#pwm-cells": > > + const: 2 > > Just move this to the parent and make the parent a pwm provider. There's > no need for child nodes for this or the rtc. > hmm, there are apparently devices without rtc. If there is a child node for the rtc, the corresponding devicetrees could disable rtc by not having that node. But maybe using the controller version is also feasible for that task. Regards, Andreas
On Tue, Sep 15, 2020 at 12:24 AM Andreas Kemnade <andreas@kemnade.info> wrote: > > Hi, > > On Mon, 14 Sep 2020 18:54:43 -0600 > Rob Herring <robh@kernel.org> wrote: > > > On Sat, Sep 05, 2020 at 03:32:24PM +0200, Jonathan Neuschäfer wrote: > > > The Netronix embedded controller as found in Kobo Aura and Tolino Shine > > > supports one PWM channel, which is used to control the frontlight > > > brightness on these devices. > > > > > > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> > > > --- > > > > > > v2: > > > - Add plaintext binding to patch description, for comparison > > > - Fix pwm-cells property (should be 2, not 1) > > > - Add dummy regulator to example, because the pwm-backlight binding requires a > > > power supply > > > > > > > > > For reference, here is the binding in text form: > > > > > > > > > PWM functionality in Netronix Embedded Controller > > > > > > Required properties: > > > - compatible: should be "netronix,ntxec-pwm" > > > - #pwm-cells: should be 2. > > > > > > Available PWM channels: > > > - 0: The PWM channel controlled by registers 0xa1-0xa7 > > > > > > Example: > > > > > > embedded-controller@43 { > > > compatible = "netronix,ntxec"; > > > ... > > > > > > ec_pwm: pwm { > > > compatible = "netronix,ntxec-pwm"; > > > #pwm-cells = <1>; > > > }; > > > }; > > > > > > ... > > > > > > backlight { > > > compatible = "pwm-backlight"; > > > pwms = <&ec_pwm 0 50000>; > > > }; > > > --- > > > .../bindings/mfd/netronix,ntxec.yaml | 19 +++++++++++ > > > .../bindings/pwm/netronix,ntxec-pwm.yaml | 33 +++++++++++++++++++ > > > 2 files changed, 52 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > > > > > > diff --git a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > > > index 596df460f98eb..73c873dda3e70 100644 > > > --- a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > > > +++ b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > > > @@ -31,6 +31,9 @@ properties: > > > description: > > > The EC can signal interrupts via a GPIO line > > > > > > + pwm: > > > + $ref: ../pwm/netronix,ntxec-pwm.yaml > > > + > > > required: > > > - compatible > > > - reg > > > @@ -53,5 +56,21 @@ examples: > > > interrupts = <11 IRQ_TYPE_EDGE_FALLING>; > > > interrupt-controller; > > > #interrupt-cells = <1>; > > > + > > > + ec_pwm: pwm { > > > + compatible = "netronix,ntxec-pwm"; > > > + #pwm-cells = <2>; > > > + }; > > > }; > > > }; > > > + > > > + backlight { > > > + compatible = "pwm-backlight"; > > > + pwms = <&ec_pwm 0 50000>; > > > + power-supply = <&backlight_regulator>; > > > + }; > > > + > > > + backlight_regulator: regulator-dummy { > > > + compatible = "regulator-fixed"; > > > + regulator-name = "backlight"; > > > + }; > > > diff --git a/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml b/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > > > new file mode 100644 > > > index 0000000000000..0c9d2801b8de1 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml > > > @@ -0,0 +1,33 @@ > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/pwm/netronix,ntxec-pwm.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: PWM functionality in Netronix embedded controller > > > + > > > +maintainers: > > > + - Jonathan Neuschäfer <j.neuschaefer@gmx.net> > > > + > > > +description: | > > > + See also Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml > > > + > > > + The Netronix EC contains PWM functionality, which is usually used to drive > > > + the backlight LED. > > > + > > > + The following PWM channels are supported: > > > + - 0: The PWM channel controlled by registers 0xa1-0xa7 > > > + > > > +allOf: > > > + - $ref: pwm.yaml# > > > + > > > +properties: > > > + compatible: > > > + const: netronix,ntxec-pwm > > > + > > > + "#pwm-cells": > > > + const: 2 > > > > Just move this to the parent and make the parent a pwm provider. There's > > no need for child nodes for this or the rtc. > > > hmm, there are apparently devices without rtc. If there is a child node > for the rtc, the corresponding devicetrees could disable rtc by not > having that node. > But maybe using the controller version is also feasible for that task. If not probeable, then the compatible string should distinguish that. Rob
On Tue, Sep 15, 2020 at 08:31:55AM -0600, Rob Herring wrote: > On Tue, Sep 15, 2020 at 12:24 AM Andreas Kemnade <andreas@kemnade.info> wrote: > > On Mon, 14 Sep 2020 18:54:43 -0600 Rob Herring <robh@kernel.org> wrote: [...] > > > Just move this to the parent and make the parent a pwm provider. There's > > > no need for child nodes for this or the rtc. > > > > > hmm, there are apparently devices without rtc. If there is a child node > > for the rtc, the corresponding devicetrees could disable rtc by not > > having that node. > > But maybe using the controller version is also feasible for that task. > > If not probeable, then the compatible string should distinguish that. Okay. It's even simpler in some cases: The firmware version reported by the EC should tell us if it's one that is known to have no RTC. That said, I don't have a good overview of the different variants of this device. Thanks, Jonathan Neuschäfer
diff --git a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml index 596df460f98eb..73c873dda3e70 100644 --- a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml +++ b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml @@ -31,6 +31,9 @@ properties: description: The EC can signal interrupts via a GPIO line + pwm: + $ref: ../pwm/netronix,ntxec-pwm.yaml + required: - compatible - reg @@ -53,5 +56,21 @@ examples: interrupts = <11 IRQ_TYPE_EDGE_FALLING>; interrupt-controller; #interrupt-cells = <1>; + + ec_pwm: pwm { + compatible = "netronix,ntxec-pwm"; + #pwm-cells = <2>; + }; }; }; + + backlight { + compatible = "pwm-backlight"; + pwms = <&ec_pwm 0 50000>; + power-supply = <&backlight_regulator>; + }; + + backlight_regulator: regulator-dummy { + compatible = "regulator-fixed"; + regulator-name = "backlight"; + }; diff --git a/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml b/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml new file mode 100644 index 0000000000000..0c9d2801b8de1 --- /dev/null +++ b/Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pwm/netronix,ntxec-pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PWM functionality in Netronix embedded controller + +maintainers: + - Jonathan Neuschäfer <j.neuschaefer@gmx.net> + +description: | + See also Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml + + The Netronix EC contains PWM functionality, which is usually used to drive + the backlight LED. + + The following PWM channels are supported: + - 0: The PWM channel controlled by registers 0xa1-0xa7 + +allOf: + - $ref: pwm.yaml# + +properties: + compatible: + const: netronix,ntxec-pwm + + "#pwm-cells": + const: 2 + +required: + - compatible + - "#pwm-cells"
The Netronix embedded controller as found in Kobo Aura and Tolino Shine supports one PWM channel, which is used to control the frontlight brightness on these devices. Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> --- v2: - Add plaintext binding to patch description, for comparison - Fix pwm-cells property (should be 2, not 1) - Add dummy regulator to example, because the pwm-backlight binding requires a power supply For reference, here is the binding in text form: PWM functionality in Netronix Embedded Controller Required properties: - compatible: should be "netronix,ntxec-pwm" - #pwm-cells: should be 2. Available PWM channels: - 0: The PWM channel controlled by registers 0xa1-0xa7 Example: embedded-controller@43 { compatible = "netronix,ntxec"; ... ec_pwm: pwm { compatible = "netronix,ntxec-pwm"; #pwm-cells = <1>; }; }; ... backlight { compatible = "pwm-backlight"; pwms = <&ec_pwm 0 50000>; }; --- .../bindings/mfd/netronix,ntxec.yaml | 19 +++++++++++ .../bindings/pwm/netronix,ntxec-pwm.yaml | 33 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/netronix,ntxec-pwm.yaml -- 2.28.0