mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
* [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices
@ 2017-03-18 14:37 Martin Blumenstingl
  2017-03-18 14:37 ` [RFT PATCH 1/1] ARM64: dts: meson-gxbb: convert devices to use pwm-leds Martin Blumenstingl
  2017-03-20  8:43 ` [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices Neil Armstrong
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Blumenstingl @ 2017-03-18 14:37 UTC (permalink / raw)
  To: linus-amlogic

This patch enables brightness support through the pwm-leds driver for
the GXBB devices which use GPIOAO_13 for their system/status LED.

Affected devices are:
- NEXBOX A95X (GXBB, S905 variant)
- Odroid-C2
- the Tronsmart Vega S95 series (Meta, Pro, Telos)
- WeTek Hub
- WeTek Play 2

unfortunately my GXBB board (a Tronsmart Vega S95 Meta clone) is not
working anymore, so I can't test this at all.
if it works on one of the devices then we can probably assume that it
works fine on all other devices as well.


Martin Blumenstingl (1):
  ARM64: dts: meson-gxbb: convert devices to use pwm-leds

 .../boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts    | 18 +++++++++++----
 .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 16 ++++++++++---
 .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi      | 17 ++++++++++----
 .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts      | 19 +++++++++++----
 .../boot/dts/amlogic/meson-gxbb-wetek-play2.dts    | 27 ++++++++++++++++------
 5 files changed, 74 insertions(+), 23 deletions(-)

-- 
2.12.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFT PATCH 1/1] ARM64: dts: meson-gxbb: convert devices to use pwm-leds
  2017-03-18 14:37 [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices Martin Blumenstingl
@ 2017-03-18 14:37 ` Martin Blumenstingl
  2017-03-20  8:43 ` [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices Neil Armstrong
  1 sibling, 0 replies; 4+ messages in thread
From: Martin Blumenstingl @ 2017-03-18 14:37 UTC (permalink / raw)
  To: linus-amlogic

All supported GXBB devices have their system LED connected to GPIOAO_13.
This pin can be driven by the PWM_AO controller (PWM_AO_B). Use the
pwm-leds driver (instead of gpio-leds) for these LEDs instead to enable
dimming (setting the brightness).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 .../boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts    | 18 +++++++++++----
 .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 16 ++++++++++---
 .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi      | 17 ++++++++++----
 .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts      | 19 +++++++++++----
 .../boot/dts/amlogic/meson-gxbb-wetek-play2.dts    | 27 ++++++++++++++++------
 5 files changed, 74 insertions(+), 23 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
index dbfa441f479e..283dad3b0be3 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
@@ -65,12 +65,14 @@
 		reg = <0x0 0x0 0x0 0x40000000>;
 	};
 
-	leds {
-		compatible = "gpio-leds";
+	pwmleds {
+		compatible = "pwm-leds";
+
 		blue {
 			label = "a95x:system-status";
-			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "heartbeat";
+			pwms = <&pwm_AO_ab 1 7812500 0>;
+			max-brightness = <255>;
+			linux,default-trigger = "default-on";
 			default-state = "off";
 		};
 	};
@@ -249,6 +251,14 @@
 	vqmmc-supply = <&vddio_boot>;
 };
 
+&pwm_AO_ab {
+	status = "okay";
+	pinctrl-0 = <&pwm_ao_b_pins>;
+	pinctrl-names = "default";
+	clocks = <&clkc CLKID_FCLK_DIV4>;
+	clock-names = "clkin0";
+};
+
 &pwm_ef {
 	status = "okay";
 	pinctrl-0 = <&pwm_e_pins>;
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index c80d3a913907..7f9de1b236ed 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -76,11 +76,13 @@
 		enable-active-high;
 	};
 
-	leds {
-		compatible = "gpio-leds";
+	pwmleds {
+		compatible = "pwm-leds";
+
 		blue {
 			label = "c2:blue:alive";
-			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
+			pwms = <&pwm_AO_ab 1 7812500 0>;
+			max-brightness = <255>;
 			linux,default-trigger = "heartbeat";
 			default-state = "off";
 		};
@@ -201,6 +203,14 @@
 	status = "okay";
 };
 
+&pwm_AO_ab {
+	status = "okay";
+	pinctrl-0 = <&pwm_ao_b_pins>;
+	pinctrl-names = "default";
+	clocks = <&clkc CLKID_FCLK_DIV4>;
+	clock-names = "clkin0";
+};
+
 /* SD */
 &sd_emmc_b {
 	status = "okay";
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
index aefa66dff72d..6b9608e5a488 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
@@ -53,13 +53,14 @@
 		stdout-path = "serial0:115200n8";
 	};
 
-	leds {
-		compatible = "gpio-leds";
+	pwmleds {
+		compatible = "pwm-leds";
 
 		blue {
 			label = "vega-s95:blue:on";
-			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
-			default-state = "on";
+			pwms = <&pwm_AO_ab 1 7812500 0>;
+			max-brightness = <255>;
+			linux,default-trigger = "default-on";
 			panic-indicator;
 		};
 	};
@@ -229,6 +230,14 @@
 	vmmcq-sumpply = <&vcc_1v8>;
 };
 
+&pwm_AO_ab {
+	status = "okay";
+	pinctrl-0 = <&pwm_ao_b_pins>;
+	pinctrl-names = "default";
+	clocks = <&clkc CLKID_FCLK_DIV4>;
+	clock-names = "clkin0";
+};
+
 &pwm_ef {
 	status = "okay";
 	pinctrl-0 = <&pwm_e_pins>;
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
index f057fb48fee5..1d94e2d4c927 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
@@ -49,13 +49,14 @@
 	compatible = "wetek,hub", "amlogic,meson-gxbb";
 	model = "WeTek Hub";
 
-	leds {
-		compatible = "gpio-leds";
+	pwmleds {
+		compatible = "pwm-leds";
 
 		system {
-			label = "wetek-play:system-status";
-			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
-			default-state = "on";
+			label = "wetek-hub:system-status";
+			pwms = <&pwm_AO_ab 1 7812500 0>;
+			max-brightness = <255>;
+			linux,default-trigger = "default-on";
 			panic-indicator;
 		};
 	};
@@ -90,3 +91,11 @@
 		};
 	};
 };
+
+&pwm_AO_ab {
+	status = "okay";
+	pinctrl-0 = <&pwm_ao_b_pins>;
+	pinctrl-names = "default";
+	clocks = <&clkc CLKID_FCLK_DIV4>;
+	clock-names = "clkin0";
+};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
index 743acb5f5d06..5114d645d733 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
@@ -53,13 +53,6 @@
 	leds {
 		compatible = "gpio-leds";
 
-		system {
-			label = "wetek-play:system-status";
-			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
-			default-state = "on";
-			panic-indicator;
-		};
-
 		wifi {
 			label = "wetek-play:wifi-status";
 			gpios = <&gpio GPIODV_26 GPIO_ACTIVE_HIGH>;
@@ -73,6 +66,18 @@
 		};
 	};
 
+	pwmleds {
+		compatible = "pwm-leds";
+
+		system {
+			label = "wetek-play:system-status";
+			pwms = <&pwm_AO_ab 1 7812500 0>;
+			max-brightness = <255>;
+			linux,default-trigger = "default-on";
+			panic-indicator;
+		};
+	};
+
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;
@@ -118,3 +123,11 @@
 	pinctrl-0 = <&i2c_a_pins>;
 	pinctrl-names = "default";
 };
+
+&pwm_AO_ab {
+	status = "okay";
+	pinctrl-0 = <&pwm_ao_b_pins>;
+	pinctrl-names = "default";
+	clocks = <&clkc CLKID_FCLK_DIV4>;
+	clock-names = "clkin0";
+};
-- 
2.12.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices
  2017-03-18 14:37 [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices Martin Blumenstingl
  2017-03-18 14:37 ` [RFT PATCH 1/1] ARM64: dts: meson-gxbb: convert devices to use pwm-leds Martin Blumenstingl
@ 2017-03-20  8:43 ` Neil Armstrong
  2017-03-20 19:56   ` Martin Blumenstingl
  1 sibling, 1 reply; 4+ messages in thread
From: Neil Armstrong @ 2017-03-20  8:43 UTC (permalink / raw)
  To: linus-amlogic

On 03/18/2017 03:37 PM, Martin Blumenstingl wrote:
> This patch enables brightness support through the pwm-leds driver for
> the GXBB devices which use GPIOAO_13 for their system/status LED.
> 
> Affected devices are:
> - NEXBOX A95X (GXBB, S905 variant)
> - Odroid-C2
> - the Tronsmart Vega S95 series (Meta, Pro, Telos)
> - WeTek Hub
> - WeTek Play 2
> 
> unfortunately my GXBB board (a Tronsmart Vega S95 Meta clone) is not
> working anymore, so I can't test this at all.
> if it works on one of the devices then we can probably assume that it
> works fine on all other devices as well.
> 
> 
> Martin Blumenstingl (1):
>   ARM64: dts: meson-gxbb: convert devices to use pwm-leds
> 
>  .../boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts    | 18 +++++++++++----
>  .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 16 ++++++++++---
>  .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi      | 17 ++++++++++----
>  .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts      | 19 +++++++++++----
>  .../boot/dts/amlogic/meson-gxbb-wetek-play2.dts    | 27 ++++++++++++++++------
>  5 files changed, 74 insertions(+), 23 deletions(-)
> 

Hi Martin,

I'm concerned about how the LED is managed by the firmware.
The system led is usually managed by the firmware and color is changed
when in suspend or poweroff mode.
But I'm not sure of the behavior if the pin mode is set to PWM.

Can you check this ?

Thanks,
Neil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices
  2017-03-20  8:43 ` [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices Neil Armstrong
@ 2017-03-20 19:56   ` Martin Blumenstingl
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Blumenstingl @ 2017-03-20 19:56 UTC (permalink / raw)
  To: linus-amlogic

Hi Neil,

On Mon, Mar 20, 2017 at 9:43 AM, Neil Armstrong <narmstrong@baylibre.com> wrote:
> On 03/18/2017 03:37 PM, Martin Blumenstingl wrote:
>> This patch enables brightness support through the pwm-leds driver for
>> the GXBB devices which use GPIOAO_13 for their system/status LED.
>>
>> Affected devices are:
>> - NEXBOX A95X (GXBB, S905 variant)
>> - Odroid-C2
>> - the Tronsmart Vega S95 series (Meta, Pro, Telos)
>> - WeTek Hub
>> - WeTek Play 2
>>
>> unfortunately my GXBB board (a Tronsmart Vega S95 Meta clone) is not
>> working anymore, so I can't test this at all.
>> if it works on one of the devices then we can probably assume that it
>> works fine on all other devices as well.
>>
>>
>> Martin Blumenstingl (1):
>>   ARM64: dts: meson-gxbb: convert devices to use pwm-leds
>>
>>  .../boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts    | 18 +++++++++++----
>>  .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 16 ++++++++++---
>>  .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi      | 17 ++++++++++----
>>  .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts      | 19 +++++++++++----
>>  .../boot/dts/amlogic/meson-gxbb-wetek-play2.dts    | 27 ++++++++++++++++------
>>  5 files changed, 74 insertions(+), 23 deletions(-)
>>
>
> Hi Martin,
>
> I'm concerned about how the LED is managed by the firmware.
> The system led is usually managed by the firmware and color is changed
> when in suspend or poweroff mode.
> But I'm not sure of the behavior if the pin mode is set to PWM.
>
> Can you check this ?
I have tested this on the Khadas VIM before: it seems to work fine
(the LED changes it's color when the device is powered off, even if a
kernel which used pwm-leds was booted before).
it might depend on the bootloader / firmware though - but I guess the
only way to find out is by testing this.


Regards,
Martin


[0] https://github.com/khadas/linux/commit/94602ef5562978a8d8b5c7770c113074a714dbdb

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-20 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-18 14:37 [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices Martin Blumenstingl
2017-03-18 14:37 ` [RFT PATCH 1/1] ARM64: dts: meson-gxbb: convert devices to use pwm-leds Martin Blumenstingl
2017-03-20  8:43 ` [RFT PATCH 0/1] Meson GXBB: use pwm-leds on supported devices Neil Armstrong
2017-03-20 19:56   ` Martin Blumenstingl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®