backlight control on pocketbeagle2

being challenged today
trying to get a pwm backlight working
i have an oscilloscope on the pwm pin, but no pwm signal
/sys/class/backlight/backlight-tft-gamepup exists and the brightness is set to max brightness
here is the device tree part related to the pwm,
all pins listed are not being used elsewhere
any help would be appreciated.

Debian Trixie IOT Image 2026-07-24

6.18.40-arm64-k3-r48

	gamepup_tft_backlight_pwm_pin: gamepup-tft-backlight-pwm-pin {
		pinctrl-single,pins = <
			0x01e8 0x010008 /* P1.36A B17: EHRPWM2_A output */ 
			0x00e0 0x200007 /* P1.36 V20: alternate AM62x pad disabled */
		>;
	};

	gamepup_tft_backlight: backlight-tft-gamepup {
		compatible = "pwm-backlight";
		brightness-levels = <0 4 8 16 32 64 96 128 160 192 224 255>;
		default-brightness-level = <11>;
		pinctrl-names = "default";
		pinctrl-0 = <&gamepup_tft_backlight_pwm_pin>;    
		pwms = <&epwm2 1 50000 0>; // EHRPWM2_A    
	};

	display@0 {
		compatible = "adafruit,yx240qv29";
		reg = <0>;
		spi-max-frequency = <24000000>;
		pinctrl-names = "default";
		pinctrl-0 = <&gamepup_tft_control_pins>;
		dc-gpios = <&main_gpio1 2 0>;    // GPIO1_2, ok
		reset-gpios = <&main_gpio0 52 0>;  //GPIO0_52, ok
		backlight = <&gamepup_tft_backlight>;
		rotation = <0>;
	};  

edit:

also have this, not sure if it’s needed

&epwm2 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <>;
};

Google seem to suggest you move the pinctrl-* to the &epwm2 stanza
instead of keeping them in the backlight one.

I don’t know if that’ll make a difference. I suggest you peek the PINMUX registers
to confirm their configuration.

that didn’t help, guess i’ll be digging a little deeper into this.

Good luck!

I’m sure we would all love you see the solution once you crack it…

by removing the “pwms = “ for the buzzer, the tft backlight started working

what i don’t understand is that other dts files define both EHRPWM2_A and EHRPWM2_B pins as pwm, so how can the frequency and duty cycle for each be controlled independently ?

P1.33 A17: EHRPWM2_B, buzzer
pwms = <&epwm2 1 250000 0>;

P1.36A B17: EHRPWM2_A, tft backlight
pwms = <&epwm2 1 100000 0>; // EHRPWM2_A    

You would probably have to study the pwm driver more closely to divine that answer.

got both SPI displays to work, had to sacrifice the gamepup buzzer to get the backlight of the second display to work.

still trying to figure out how to force fb0 or fb1 to be used as default on each boot.

edit:

per some link on TI site, both EHRPWM2_A and EHRPWM2_B can be used for pwm but they must use the same frequency. however with the following configuration, the buzzer does not work. the by-path link at “/dev/input/by-path/” does not exist for the buzzer.

&epwm2 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&gamepup_tft_backlight_pwm_pin>, <&gamepup_buzzer_pwm_pin>;
};

gamepup_tft_backlight: backlight-tft-gamepup {
	compatible = "pwm-backlight";
	brightness-levels = <0 4 8 16 32 64 96 128 160 192 224 255>;
	default-brightness-level = <11>;
    pwms = <&epwm2 0 250000 0>; // EHRPWM2_A    
};

gamepup-buzzer {
	compatible = "pwm-beeper";
	pinctrl-names = "default";
	//pinctrl-0 = <&gamepup_buzzer_pwm_pin>;  // EHRPWM2_B
	pwms = <&epwm2 0 250000 0>;
};

this should be

gamepup-buzzer {
	compatible = "pwm-beeper";
	pinctrl-names = "default";
	//pinctrl-0 = <&gamepup_buzzer_pwm_pin>;  // EHRPWM2_B
	pwms = <&epwm2 1 250000 0>;
};

You’re on the right track here - One EHRPWM IP share a single period register so you can change duty cycle independently but NOT frequency.

The problem is that pwm-beeper tries to adjust the period to get different frequencies so the PWM driver rejects it.

Unfortunately short of using a different pin I don’t think there’s a neat way to keep both beeper and PWM backlight.

that might explain why the original pocketbeagle used the PRU for the buzzer (if memory serves)