diff mbox series

[v2,7/8] arm64: dts: mediatek: cherry: Enable keyboard PWM backlight

Message ID 20220721145017.918102-8-angelogioacchino.delregno@collabora.com (mailing list archive)
State New, archived
Headers show
Series MT8195 Acer Tomato - devicetrees Part 2 | expand

Commit Message

AngeloGioacchino Del Regno July 21, 2022, 2:50 p.m. UTC
Add a pwm-leds node to enable the PWM controlled keyboard backlight.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Chen-Yu Tsai July 25, 2022, 9:57 a.m. UTC | #1
n Thu, Jul 21, 2022 at 10:53 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Add a pwm-leds node to enable the PWM controlled keyboard backlight.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> index ca9955a97f8f..9086a440a995 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> @@ -4,6 +4,7 @@
>   */
>
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/leds/common.h>
>  #include "mt8195.dtsi"
>  #include "mt6359.dtsi"
>
> @@ -31,6 +32,18 @@ dmic_codec: dmic-codec {
>                 wakeup-delay-ms = <50>;
>         };
>
> +       led-controller {
> +               compatible = "pwm-leds";
> +
> +               keyboard_backlight: keyboard-backlight {
> +                       default-state = "off";
> +                       function = LED_FUNCTION_KBD_BACKLIGHT;
> +                       label = "cros_ec::kbd_backlight";
> +                       max-brightness = <1023>;
> +                       pwms = <&cros_ec_pwm 3>;
> +               };
> +       };
> +

This didn't work for me. However using "google,cros-kbd-led-backlight"
under the EC did. That might be a better option.

ChenYu

>         memory@40000000 {
>                 device_type = "memory";
>                 reg = <0 0x40000000 0 0x80000000>;
> --
> 2.35.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
AngeloGioacchino Del Regno July 25, 2022, 10:04 a.m. UTC | #2
Il 25/07/22 11:57, Chen-Yu Tsai ha scritto:
> n Thu, Jul 21, 2022 at 10:53 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Add a pwm-leds node to enable the PWM controlled keyboard backlight.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>> index ca9955a97f8f..9086a440a995 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>> @@ -4,6 +4,7 @@
>>    */
>>
>>   #include <dt-bindings/gpio/gpio.h>
>> +#include <dt-bindings/leds/common.h>
>>   #include "mt8195.dtsi"
>>   #include "mt6359.dtsi"
>>
>> @@ -31,6 +32,18 @@ dmic_codec: dmic-codec {
>>                  wakeup-delay-ms = <50>;
>>          };
>>
>> +       led-controller {
>> +               compatible = "pwm-leds";
>> +
>> +               keyboard_backlight: keyboard-backlight {
>> +                       default-state = "off";
>> +                       function = LED_FUNCTION_KBD_BACKLIGHT;
>> +                       label = "cros_ec::kbd_backlight";
>> +                       max-brightness = <1023>;
>> +                       pwms = <&cros_ec_pwm 3>;
>> +               };
>> +       };
>> +
> 
> This didn't work for me. However using "google,cros-kbd-led-backlight"
> under the EC did. That might be a better option.

Strange. But okay if there's a better option I'll check that out for v3.

Cheers!
Angelo

> 
> ChenYu
> 
>>          memory@40000000 {
>>                  device_type = "memory";
>>                  reg = <0 0x40000000 0 0x80000000>;
>> --
>> 2.35.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Chen-Yu Tsai July 25, 2022, 10:06 a.m. UTC | #3
On Mon, Jul 25, 2022 at 6:04 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Il 25/07/22 11:57, Chen-Yu Tsai ha scritto:
> > n Thu, Jul 21, 2022 at 10:53 PM AngeloGioacchino Del Regno
> > <angelogioacchino.delregno@collabora.com> wrote:
> >>
> >> Add a pwm-leds node to enable the PWM controlled keyboard backlight.
> >>
> >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >> ---
> >>   arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 13 +++++++++++++
> >>   1 file changed, 13 insertions(+)
> >>
> >> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >> index ca9955a97f8f..9086a440a995 100644
> >> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >> @@ -4,6 +4,7 @@
> >>    */
> >>
> >>   #include <dt-bindings/gpio/gpio.h>
> >> +#include <dt-bindings/leds/common.h>
> >>   #include "mt8195.dtsi"
> >>   #include "mt6359.dtsi"
> >>
> >> @@ -31,6 +32,18 @@ dmic_codec: dmic-codec {
> >>                  wakeup-delay-ms = <50>;
> >>          };
> >>
> >> +       led-controller {
> >> +               compatible = "pwm-leds";
> >> +
> >> +               keyboard_backlight: keyboard-backlight {
> >> +                       default-state = "off";
> >> +                       function = LED_FUNCTION_KBD_BACKLIGHT;
> >> +                       label = "cros_ec::kbd_backlight";
> >> +                       max-brightness = <1023>;
> >> +                       pwms = <&cros_ec_pwm 3>;
> >> +               };
> >> +       };
> >> +
> >
> > This didn't work for me. However using "google,cros-kbd-led-backlight"
> > under the EC did. That might be a better option.
>
> Strange. But okay if there's a better option I'll check that out for v3.

It might be an EC firmware version issue. My devices are all running
test images, and don't automatically update the EC firmware.

For reference, mine is at:

RO:    tomato_v2.0.10686-234e646fd8
        tomato_14268.0.0
RW:    tomato_v2.0.10686-234e646fd8
        tomato_14268.0.0
Build:    tomato_v2.0.10686-234e646fd8 tomato_14268.0.0
        2021-10-07 09:00:32
        @chromeos-ci-legacy-us-central2-d-x32-34-us9d

ChenYu

> Cheers!
> Angelo
>
> >
> > ChenYu
> >
> >>          memory@40000000 {
> >>                  device_type = "memory";
> >>                  reg = <0 0x40000000 0 0x80000000>;
> >> --
> >> 2.35.1
> >>
> >>
> >> _______________________________________________
> >> linux-arm-kernel mailing list
> >> linux-arm-kernel@lists.infradead.org
> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
AngeloGioacchino Del Regno July 25, 2022, 10:14 a.m. UTC | #4
Il 25/07/22 12:06, Chen-Yu Tsai ha scritto:
> On Mon, Jul 25, 2022 at 6:04 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Il 25/07/22 11:57, Chen-Yu Tsai ha scritto:
>>> n Thu, Jul 21, 2022 at 10:53 PM AngeloGioacchino Del Regno
>>> <angelogioacchino.delregno@collabora.com> wrote:
>>>>
>>>> Add a pwm-leds node to enable the PWM controlled keyboard backlight.
>>>>
>>>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>>> ---
>>>>    arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 13 +++++++++++++
>>>>    1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>> index ca9955a97f8f..9086a440a995 100644
>>>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>> @@ -4,6 +4,7 @@
>>>>     */
>>>>
>>>>    #include <dt-bindings/gpio/gpio.h>
>>>> +#include <dt-bindings/leds/common.h>
>>>>    #include "mt8195.dtsi"
>>>>    #include "mt6359.dtsi"
>>>>
>>>> @@ -31,6 +32,18 @@ dmic_codec: dmic-codec {
>>>>                   wakeup-delay-ms = <50>;
>>>>           };
>>>>
>>>> +       led-controller {
>>>> +               compatible = "pwm-leds";
>>>> +
>>>> +               keyboard_backlight: keyboard-backlight {
>>>> +                       default-state = "off";
>>>> +                       function = LED_FUNCTION_KBD_BACKLIGHT;
>>>> +                       label = "cros_ec::kbd_backlight";
>>>> +                       max-brightness = <1023>;
>>>> +                       pwms = <&cros_ec_pwm 3>;
>>>> +               };
>>>> +       };
>>>> +
>>>
>>> This didn't work for me. However using "google,cros-kbd-led-backlight"
>>> under the EC did. That might be a better option.
>>
>> Strange. But okay if there's a better option I'll check that out for v3.
> 
> It might be an EC firmware version issue. My devices are all running
> test images, and don't automatically update the EC firmware.
> 
> For reference, mine is at:
> 
> RO:    tomato_v2.0.10686-234e646fd8
>          tomato_14268.0.0
> RW:    tomato_v2.0.10686-234e646fd8
>          tomato_14268.0.0
> Build:    tomato_v2.0.10686-234e646fd8 tomato_14268.0.0
>          2021-10-07 09:00:32
>          @chromeos-ci-legacy-us-central2-d-x32-34-us9d
> 

It's surely about the firmware, because I can confirm that I didn't
have a working KB kacklight before upgrading... I remember debugging
that and I couldn't figure out why it wasn't working...

After an upgrade, it magically worked, so that's it.

RO version:    tomato_v2.0.11883-9f0d374060

RO cros fwid:  tomato_14454.14.0

RW version:    tomato_v2.0.11893-d27ab0e96d

RW cros fwid:  tomato_14454.23.0



That's the FW that I have here on my machine... :-)

I'll anyway check out the binding that you suggested, as if that works
in any condition that's simply better!


> ChenYu
> 
>> Cheers!
>> Angelo
>>
>>>
>>> ChenYu
>>>
>>>>           memory@40000000 {
>>>>                   device_type = "memory";
>>>>                   reg = <0 0x40000000 0 0x80000000>;
>>>> --
>>>> 2.35.1
>>>>
>>>>
>>>> _______________________________________________
>>>> linux-arm-kernel mailing list
>>>> linux-arm-kernel@lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
index ca9955a97f8f..9086a440a995 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
@@ -4,6 +4,7 @@ 
  */
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 #include "mt8195.dtsi"
 #include "mt6359.dtsi"
 
@@ -31,6 +32,18 @@  dmic_codec: dmic-codec {
 		wakeup-delay-ms = <50>;
 	};
 
+	led-controller {
+		compatible = "pwm-leds";
+
+		keyboard_backlight: keyboard-backlight {
+			default-state = "off";
+			function = LED_FUNCTION_KBD_BACKLIGHT;
+			label = "cros_ec::kbd_backlight";
+			max-brightness = <1023>;
+			pwms = <&cros_ec_pwm 3>;
+		};
+	};
+
 	memory@40000000 {
 		device_type = "memory";
 		reg = <0 0x40000000 0 0x80000000>;