meson-gx: add pwm_AO_ab
Subsystems (4)
Martin Blumenstingl
reviewercover meson-gx: add pwm_AO_ab
This adds support for the PWM controller in the AO domain. pinctrl support for GXBB already exists (in both, pinctrl-meson-gxbb.c and meson-gxbb.dtsi). This patch adds at least the pwm_ao_b pin for GXL and GXM - these are not documented in Amlogic's kernel, so I had to borrow the magic numbers from the Khadas VIM kernel (released under the GPL): [0]
The bits for pwm_AO_a_pins are unknown at the time of writing, but these can still be added later.
I have successfully tested this on my GXL S905X based Khadas VIM board with the following .dts snippets (the PWM LED can simply be dimmed through sysfs):
&pwm_AO_ab {
status = "okay";
pinctrl-0 = <&pwm_ao_b_pins>;
pinctrl-names = "default";
clocks = <&clkc CLKID_FCLK_DIV4>;
clock-names = "clkin0";
};
pwmleds {
compatible = "pwm-leds";
power {
label = "vim:red:power";
pwms = <&pwm_AO_ab 1 7812500 0>;
max-brightness = <255>;
};
};(if anyone is interested in more of my Khadas VIM patches - these are still work-in-progress, which is why I have not sent them yet - can take a look at this: [1])
NOTE: The .dts changes from this series are based on top of my SAR ADC patches.
[0] https://github.com/khadas/linux/blob/94602ef5562978a8d8b5c7770c113074a714dbdb/drivers/amlogic/led/led_trigger_breathe.c#L75
[1] https://github.com/xdarklight/linux/commits/meson-gx-integration-4.11-20170122
Martin Blumenstingl (3):
ARM64: dts: meson-gx: add the missing pwm_AO_ab node
pinctrl: meson: meson-gxl: add the pwm_ao_b pin
ARM64: dts: meson-gxl: add the pwm_ao_b pin
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 7 +++++++ arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 7 +++++++ drivers/pinctrl/meson/pinctrl-meson-gxl.c | 8 ++++++++ 3 files changed, 22 insertions(+)
Signature · 1 line
2.11.0
Martin Blumenstingl
reviewerPATCH 1/3 ARM64: dts: meson-gx: add the missing pwm_AO_ab node
All Meson GX SoCs (GXBB, GXL and GXM) have a PWM controller within the AO domain. When one of the board's LEDs is connected to one of the AO PWM pins then this can be used to dim that LED (when the leds-pwm driver is used).
Add the pwm_AO_ab to allow such devices to use the leds-pwm driver.
--- arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gx.dtsi +7 -0
@@ -340,6 +340,13 @@ status = "disabled"; }; + pwm_AO_ab: pwm at 550 { + compatible = "amlogic,meson-gx-pwm", "amlogic,meson-gxbb-pwm"; + reg = <0x0 0x00550 0x0 0x10>; + #pwm-cells = <3>; + status = "disabled"; + }; + ir: ir at 580 { compatible = "amlogic,meson-gxbb-ir"; reg = <0x0 0x00580 0x0 0x40>;
Signature · 1 line
2.11.0
Martin Blumenstingl
reviewerPATCH 2/3 pinctrl: meson: meson-gxl: add the pwm_ao_b pin
In reply to Martin BlumenstinglThis adds support for the pwm_ao_b pin. Unfortunately the registers for the pwm_ao pins are not documented at all. The source for the pwm_ao_b pin from this patch is the Khadas VIM GPL kernel source, which sets bit 3 and unsets bits 4 and 31 to enable the PWM LEDs.
--- drivers/pinctrl/meson/pinctrl-meson-gxl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pinctrl/meson/pinctrl-meson-gxl.c +8 -0
@@ -222,6 +222,8 @@ static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) };static const unsigned int remote_input_ao_pins[] = {PIN (GPIOAO_7 ,0 ) }; +static const unsigned int pwm_ao_b_pins[] = {PIN (GPIOAO_9 ,0 ) }; +static struct meson_pmx_group meson_gxl_periphs_groups[] = {GPIO_GROUP (GPIOZ_0 ,EE_OFF ),GPIO_GROUP (GPIOZ_1 ,EE_OFF ),
@@ -418,6 +420,7 @@ static struct meson_pmx_group meson_gxl_aobus_groups[] = {GROUP (uart_cts_ao_b,0 ,8 ),GROUP (uart_rts_ao_b,0 ,7 ),GROUP (remote_input_ao,0 ,0 ), + GROUP(pwm_ao_b, 0, 3), }; static const char * const gpio_periphs_groups[] = {
@@ -523,6 +526,10 @@ static const char * const remote_input_ao_groups[] = { "remote_input_ao", }; +static const char *const pwm_ao_b_groups[] = { +"pwm_ao_b" , +}; +static struct meson_pmx_func meson_gxl_periphs_functions[] = {FUNCTION (gpio_periphs),FUNCTION (emmc),
@@ -544,6 +551,7 @@ static struct meson_pmx_func meson_gxl_aobus_functions[] = {FUNCTION (uart_ao),FUNCTION (uart_ao_b ),FUNCTION (remote_input_ao ), + FUNCTION(pwm_ao_b), };static struct meson_bank meson_gxl_periphs_banks[] = {
Signature · 1 line
2.11.0
Kevin Hilman
maintainerPATCH 2/3 pinctrl: meson: meson-gxl: add the pwm_ao_b pin
Quoted 15 lines · Martin Blumenstingl
This adds support for the
pwm_ao_bpin. Unfortunately the registers for thepwm_aopins are not documented at all. The source for thepwm_ao_bpin from this patch is the Khadas VIM GPL kernel source, which sets bit 3 and unsets bits 4 and 31 to enable the PWM LEDs.Signed-off-by Martin Blumenstingl <[email protected]>--- drivers/pinctrl/meson/pinctrl-meson-gxl.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/pinctrl/meson/pinctrl-meson-gxl.c +0
-0
drivers/pinctrl/meson/pinctrl-meson-gxl.c static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) }; · line 226
Quoted 5 lines
drivers/pinctrl/meson/pinctrl-meson-gxl.c +2
-0@@ -222,6 +222,8 @@ static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) };static const unsigned int remote_input_ao_pins[] = {PIN (GPIOAO_7 ,0 ) }; +static const unsigned int pwm_ao_b_pins[] = {PIN (GPIOAO_9 ,0 ) }; +
Hmm, the S905 public data sheet[1] shows this as GPIOAO_13.
drivers/pinctrl/meson/pinctrl-meson-gxl.c static struct meson_pmx_group meson_gxl_aobus_groups[] = { · line 424
Quoted 9 lines
drivers/pinctrl/meson/pinctrl-meson-gxl.c +1
-0static struct meson_pmx_group meson_gxl_periphs_groups[] = {GPIO_GROUP (GPIOZ_0 ,EE_OFF ),GPIO_GROUP (GPIOZ_1 ,EE_OFF ),@@ -418,6 +420,7 @@ static struct meson_pmx_group meson_gxl_aobus_groups[] = {GROUP (uart_cts_ao_b,0 ,8 ),GROUP (uart_rts_ao_b,0 ,7 ),GROUP (remote_input_ao,0 ,0 ), + GROUP(pwm_ao_b, 0, 3), };
but it does show as ao_reg[3].
Kevin
[1] http://dn.odroid.com/S905/DataSheet/S905_Public_Datasheet_V1.1.4.pdf
Kevin Hilman
maintainerPATCH 2/3 pinctrl: meson: meson-gxl: add the pwm_ao_b pin
Quoted 18 lines · Kevin Hilman
Quoted 16 lines · Martin Blumenstingl
This adds support for the
pwm_ao_bpin. Unfortunately the registers for thepwm_aopins are not documented at all. The source for thepwm_ao_bpin from this patch is the Khadas VIM GPL kernel source, which sets bit 3 and unsets bits 4 and 31 to enable the PWM LEDs.Signed-off-by Martin Blumenstingl <[email protected]>--- drivers/pinctrl/meson/pinctrl-meson-gxl.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/pinctrl/meson/pinctrl-meson-gxl.c +0
-0@@ -222,6 +222,8 @@ static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) };
Quoted 7 lines
drivers/pinctrl/meson/pinctrl-meson-gxl.c static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) }; · line 226
Quoted 4 lines
drivers/pinctrl/meson/pinctrl-meson-gxl.c +2
-0static const unsigned int remote_input_ao_pins[] = {PIN (GPIOAO_7 ,0 ) }; +static const unsigned int pwm_ao_b_pins[] = {PIN (GPIOAO_9 ,0 ) }; +Hmm, the S905 public data sheet[1] shows this as
GPIOAO_13.
gack, nevermind. I see now this is for GXL, not GXBB. Ignore my comments.
Linus, feel free to apply with:
PATCH 2/3 pinctrl: meson: meson-gxl: add the pwm_ao_b pin
In reply to Martin BlumenstinglQuoted 6 lines · Martin Blumenstingl
This adds support for the
pwm_ao_bpin. Unfortunately the registers for thepwm_aopins are not documented at all. The source for thepwm_ao_bpin from this patch is the Khadas VIM GPL kernel source, which sets bit 3 and unsets bits 4 and 31 to enable the PWM LEDs.Signed-off-by Martin Blumenstingl <[email protected]>
This patch applied to the pin control tree with Kevin's ACK.
Yours,
Linus Walleij
Martin Blumenstingl
reviewerPATCH 3/3 ARM64: dts: meson-gxl: add the pwm_ao_b pin
In reply to Martin BlumenstinglThis adds the pwm_ao_b pin to allow boards which have an LED connected to GPIOAO_9 to use the leds-pwm driver (by activating the pwm_AO_ab node and passing the pwm_ao_b_pin pinctrl-reference).
--- arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +7 -0
@@ -117,6 +117,13 @@ function = "remote_input_ao"; }; }; + + pwm_ao_b_pins: pwm_ao_b { + mux { + groups = "pwm_ao_b"; + function = "pwm_ao_b"; + }; + }; }; };
Signature · 1 line
2.11.0
Kevin Hilman
maintainercover meson-gx: add pwm_AO_ab
In reply to Martin BlumenstinglQuoted 1 line · Martin Blumenstingl
This adds support for the PWM controller in the AO domain.
Patches 1,3 applied to Amlogic v4.11/dt64 branch.
Kevin
Quoted 49 lines
pinctrl support for GXBB already exists (in both,
pinctrl-meson-gxbb.candmeson-gxbb.dtsi). This patch adds at least thepwm_ao_bpin for GXL and GXM - these are not documented in Amlogic's kernel, so I had to borrow the magic numbers from the Khadas VIM kernel (released under the GPL): [0]The bits for
pwm_AO_a_pinsare unknown at the time of writing, but these can still be added later.I have successfully tested this on my GXL S905X based Khadas VIM board with the following .dts snippets (the PWM LED can simply be dimmed through sysfs):
&pwm_AO_ab { status = "okay"; pinctrl-0 = <&pwm_ao_b_pins>; pinctrl-names = "default"; clocks = <&clkc CLKID_FCLK_DIV4>; clock-names = "clkin0"; }; pwmleds { compatible = "pwm-leds"; power { label = "vim:red:power"; pwms = <&pwm_AO_ab 1 7812500 0>; max-brightness = <255>; }; };(if anyone is interested in more of my Khadas VIM patches - these are still work-in-progress, which is why I have not sent them yet - can take a look at this: [1])
NOTE: The .dts changes from this series are based on top of my SAR ADC patches.
[0] https://github.com/khadas/linux/blob/94602ef5562978a8d8b5c7770c113074a714dbdb/drivers/amlogic/led/led_trigger_breathe.c#L75
[1] https://github.com/xdarklight/linux/commits/meson-gx-integration-4.11-20170122Martin Blumenstingl (3):
ARM64: dts: meson-gx: add the missingpwm_AO_abnode
pinctrl: meson: meson-gxl: add thepwm_ao_bpin
ARM64: dts: meson-gxl: add thepwm_ao_bpinarch/arm64/boot/dts/amlogic/meson-gx.dtsi | 7 +++++++ arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 7 +++++++ drivers/pinctrl/meson/pinctrl-meson-gxl.c | 8 ++++++++ 3 files changed, 22 insertions(+)