linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: sun8i: v3s: add PWM device node
@ 2017-05-24 12:13 Icenowy Zheng
  2017-05-24 12:13 ` [PATCH 2/3] ARM: sun8i: v3s: add PWM pinmux nodes Icenowy Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Icenowy Zheng @ 2017-05-24 12:13 UTC (permalink / raw)
  To: linux-arm-kernel

As we have already the support for the PWM controller on V3s SoC, add
its device node in the SoC's DTSI file.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index a49ebef53c91..bb080c4bd22c 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -255,6 +255,14 @@
 			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		pwm: pwm at 1c21400 {
+			compatible = "allwinner,sun7i-a20-pwm";
+			reg = <0x01c21400 0x400>;
+			clocks = <&osc24M>;
+			#pwm-cells = <3>;
+			status = "disabled";
+		};
+
 		lradc: lradc at 1c22800 {
 			compatible = "allwinner,sun4i-a10-lradc-keys";
 			reg = <0x01c22800 0x400>;
-- 
2.12.2

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

* [PATCH 2/3] ARM: sun8i: v3s: add PWM pinmux nodes
  2017-05-24 12:13 [PATCH 1/3] ARM: sun8i: v3s: add PWM device node Icenowy Zheng
@ 2017-05-24 12:13 ` Icenowy Zheng
  2017-05-29  7:01   ` Maxime Ripard
  2017-05-24 12:13 ` [PATCH 3/3] ARM: sun8i: v3s: add backlight device node for Lichee Pi Zero LCD Icenowy Zheng
  2017-05-29  6:59 ` [PATCH 1/3] ARM: sun8i: v3s: add PWM device node Maxime Ripard
  2 siblings, 1 reply; 8+ messages in thread
From: Icenowy Zheng @ 2017-05-24 12:13 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner V3s have two PWM channels, the first channel can be only at
PB4 pin, and the second channel PB5.

Add their pinmux configurations.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index bb080c4bd22c..db3328a2c89a 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -239,6 +239,16 @@
 				pins = "PC0", "PC1", "PC2", "PC3";
 				function = "spi0";
 			};
+
+			pwm0_pins: pwm0 {
+				pins = "PB4";
+				function = "pwm0";
+			};
+
+			pwm1_pins: pwm1 {
+				pins = "PB5";
+				function = "pwm1";
+			};
 		};
 
 		timer at 01c20c00 {
-- 
2.12.2

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

* [PATCH 3/3] ARM: sun8i: v3s: add backlight device node for Lichee Pi Zero LCD
  2017-05-24 12:13 [PATCH 1/3] ARM: sun8i: v3s: add PWM device node Icenowy Zheng
  2017-05-24 12:13 ` [PATCH 2/3] ARM: sun8i: v3s: add PWM pinmux nodes Icenowy Zheng
@ 2017-05-24 12:13 ` Icenowy Zheng
  2017-05-29  7:41   ` Maxime Ripard
  2017-05-29  6:59 ` [PATCH 1/3] ARM: sun8i: v3s: add PWM device node Maxime Ripard
  2 siblings, 1 reply; 8+ messages in thread
From: Icenowy Zheng @ 2017-05-24 12:13 UTC (permalink / raw)
  To: linux-arm-kernel

The 40-pin LCD connector on Lichee Pi Zero has backlight pins, which is
controlled by the PWM0 controller of the V3s SoC, and the controlling
part is on the board.

Add the PWM and backlight device nodes in the device tree file, but
leave them disabled, as they can only be useful when the LCD is
attached. The LCD device tree overlay files can enable these controllers
and make use of them.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
index 387fc2aa546d..e0721bf725d1 100644
--- a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
+++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
@@ -52,6 +52,14 @@
 		serial0 = &uart0;
 	};
 
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&pwm 0 50000 0>;
+		brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
+		default-brightness-level = <8>;
+		status = "disabled";
+	};
+
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
@@ -86,6 +94,12 @@
 	status = "okay";
 };
 
+&pwm {
+	pinctrl-0 = <&pwm0_pins>;
+	pinctrl-names = "default";
+	status = "disabled";
+};
+
 &uart0 {
 	pinctrl-0 = <&uart0_pins_a>;
 	pinctrl-names = "default";
-- 
2.12.2

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

* [PATCH 1/3] ARM: sun8i: v3s: add PWM device node
  2017-05-24 12:13 [PATCH 1/3] ARM: sun8i: v3s: add PWM device node Icenowy Zheng
  2017-05-24 12:13 ` [PATCH 2/3] ARM: sun8i: v3s: add PWM pinmux nodes Icenowy Zheng
  2017-05-24 12:13 ` [PATCH 3/3] ARM: sun8i: v3s: add backlight device node for Lichee Pi Zero LCD Icenowy Zheng
@ 2017-05-29  6:59 ` Maxime Ripard
  2 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2017-05-29  6:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, May 24, 2017 at 08:13:18PM +0800, Icenowy Zheng wrote:
> As we have already the support for the PWM controller on V3s SoC, add
> its device node in the SoC's DTSI file.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-v3s.dtsi | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
> index a49ebef53c91..bb080c4bd22c 100644
> --- a/arch/arm/boot/dts/sun8i-v3s.dtsi
> +++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
> @@ -255,6 +255,14 @@
>  			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
>  		};
>  
> +		pwm: pwm at 1c21400 {
> +			compatible = "allwinner,sun7i-a20-pwm";

You need to have a v3s compatible here.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170529/9db4ece3/attachment.sig>

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

* [PATCH 2/3] ARM: sun8i: v3s: add PWM pinmux nodes
  2017-05-24 12:13 ` [PATCH 2/3] ARM: sun8i: v3s: add PWM pinmux nodes Icenowy Zheng
@ 2017-05-29  7:01   ` Maxime Ripard
  0 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2017-05-29  7:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, May 24, 2017 at 08:13:19PM +0800, Icenowy Zheng wrote:
> Allwinner V3s have two PWM channels, the first channel can be only at
> PB4 pin, and the second channel PB5.
> 
> Add their pinmux configurations.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-v3s.dtsi | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
> index bb080c4bd22c..db3328a2c89a 100644
> --- a/arch/arm/boot/dts/sun8i-v3s.dtsi
> +++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
> @@ -239,6 +239,16 @@
>  				pins = "PC0", "PC1", "PC2", "PC3";
>  				function = "spi0";
>  			};
> +
> +			pwm0_pins: pwm0 {
> +				pins = "PB4";
> +				function = "pwm0";
> +			};
> +
> +			pwm1_pins: pwm1 {
> +				pins = "PB5";
> +				function = "pwm1";
> +			};

Please order the nodes alphabetically.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170529/a5b35e47/attachment.sig>

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

* [PATCH 3/3] ARM: sun8i: v3s: add backlight device node for Lichee Pi Zero LCD
  2017-05-24 12:13 ` [PATCH 3/3] ARM: sun8i: v3s: add backlight device node for Lichee Pi Zero LCD Icenowy Zheng
@ 2017-05-29  7:41   ` Maxime Ripard
  2017-05-29  8:16     ` Chen-Yu Tsai
  0 siblings, 1 reply; 8+ messages in thread
From: Maxime Ripard @ 2017-05-29  7:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, May 24, 2017 at 08:13:20PM +0800, Icenowy Zheng wrote:
> The 40-pin LCD connector on Lichee Pi Zero has backlight pins, which is
> controlled by the PWM0 controller of the V3s SoC, and the controlling
> part is on the board.
> 
> Add the PWM and backlight device nodes in the device tree file, but
> leave them disabled, as they can only be useful when the LCD is
> attached. The LCD device tree overlay files can enable these controllers
> and make use of them.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
> index 387fc2aa546d..e0721bf725d1 100644
> --- a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
> +++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
> @@ -52,6 +52,14 @@
>  		serial0 = &uart0;
>  	};
>  
> +	backlight: backlight {
> +		compatible = "pwm-backlight";
> +		pwms = <&pwm 0 50000 0>;
> +		brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;

This is unlikely, the perceived brightness by the human eye is not
linear, and is actually much closer to a logarithmic function, which
means you should have use an exponential function here in order to
appear that your brightness increase is linear.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170529/35e1ae47/attachment.sig>

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

* [PATCH 3/3] ARM: sun8i: v3s: add backlight device node for Lichee Pi Zero LCD
  2017-05-29  7:41   ` Maxime Ripard
@ 2017-05-29  8:16     ` Chen-Yu Tsai
  2017-05-29  9:26       ` Maxime Ripard
  0 siblings, 1 reply; 8+ messages in thread
From: Chen-Yu Tsai @ 2017-05-29  8:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 29, 2017 at 3:41 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Wed, May 24, 2017 at 08:13:20PM +0800, Icenowy Zheng wrote:
>> The 40-pin LCD connector on Lichee Pi Zero has backlight pins, which is
>> controlled by the PWM0 controller of the V3s SoC, and the controlling
>> part is on the board.
>>
>> Add the PWM and backlight device nodes in the device tree file, but
>> leave them disabled, as they can only be useful when the LCD is
>> attached. The LCD device tree overlay files can enable these controllers
>> and make use of them.
>>
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
>> index 387fc2aa546d..e0721bf725d1 100644
>> --- a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
>> +++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
>> @@ -52,6 +52,14 @@
>>               serial0 = &uart0;
>>       };
>>
>> +     backlight: backlight {
>> +             compatible = "pwm-backlight";
>> +             pwms = <&pwm 0 50000 0>;
>> +             brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
>
> This is unlikely, the perceived brightness by the human eye is not
> linear, and is actually much closer to a logarithmic function, which
> means you should have use an exponential function here in order to
> appear that your brightness increase is linear.

I think the backlight is a functional part of the panel. It probably
belongs in the panel's overlay.

ChenYu

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

* [PATCH 3/3] ARM: sun8i: v3s: add backlight device node for Lichee Pi Zero LCD
  2017-05-29  8:16     ` Chen-Yu Tsai
@ 2017-05-29  9:26       ` Maxime Ripard
  0 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2017-05-29  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 29, 2017 at 04:16:51PM +0800, Chen-Yu Tsai wrote:
> On Mon, May 29, 2017 at 3:41 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Hi,
> >
> > On Wed, May 24, 2017 at 08:13:20PM +0800, Icenowy Zheng wrote:
> >> The 40-pin LCD connector on Lichee Pi Zero has backlight pins, which is
> >> controlled by the PWM0 controller of the V3s SoC, and the controlling
> >> part is on the board.
> >>
> >> Add the PWM and backlight device nodes in the device tree file, but
> >> leave them disabled, as they can only be useful when the LCD is
> >> attached. The LCD device tree overlay files can enable these controllers
> >> and make use of them.
> >>
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >> ---
> >>  arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts | 14 ++++++++++++++
> >>  1 file changed, 14 insertions(+)
> >>
> >> diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
> >> index 387fc2aa546d..e0721bf725d1 100644
> >> --- a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
> >> +++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
> >> @@ -52,6 +52,14 @@
> >>               serial0 = &uart0;
> >>       };
> >>
> >> +     backlight: backlight {
> >> +             compatible = "pwm-backlight";
> >> +             pwms = <&pwm 0 50000 0>;
> >> +             brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
> >
> > This is unlikely, the perceived brightness by the human eye is not
> > linear, and is actually much closer to a logarithmic function, which
> > means you should have use an exponential function here in order to
> > appear that your brightness increase is linear.
> 
> I think the backlight is a functional part of the panel. It probably
> belongs in the panel's overlay.

Yeah, that's also true.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170529/f4ee98e5/attachment.sig>

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

end of thread, other threads:[~2017-05-29  9:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 12:13 [PATCH 1/3] ARM: sun8i: v3s: add PWM device node Icenowy Zheng
2017-05-24 12:13 ` [PATCH 2/3] ARM: sun8i: v3s: add PWM pinmux nodes Icenowy Zheng
2017-05-29  7:01   ` Maxime Ripard
2017-05-24 12:13 ` [PATCH 3/3] ARM: sun8i: v3s: add backlight device node for Lichee Pi Zero LCD Icenowy Zheng
2017-05-29  7:41   ` Maxime Ripard
2017-05-29  8:16     ` Chen-Yu Tsai
2017-05-29  9:26       ` Maxime Ripard
2017-05-29  6:59 ` [PATCH 1/3] ARM: sun8i: v3s: add PWM device node Maxime Ripard

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).