This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Timer based PWM for LCD contrast/brightness

Other Parts Discussed in Thread: AM5718

Hello,

I want to manage LCD's contrast & brightness by PWM. To launch PWM I use Timer6 & Timer8 pins of AM5718 (Timers module of CPU).

Is there driver applicable for that? May be I can somehow configure timers from userspace to enable PWM mode of timer?

Thank you.

  • Hi,

    For AM57xx devices there is a backlight driver, see am57xx-evm-common.dtsi:
    backlight {
    compatible = "pwm-backlight";
    pwms = <&ehrpwm1 0 50000 0>;

    /* Anything lower than 241 is no longer visible */
    brightness-levels = <0 243 245 247 249 251 252 253 255>;

    default-brightness-level = <8>;
    };

    The pwm-backlight driver is located in drivers/video/pwm-bl.c. The respective ehrpwm driver is located in drivers/pwm/pwm-tiehrpwm.c.

    Hope this helps.

    Best Regards,
    Yordan
  • Hi Yordan,

    Thank you for response, but in my case I use Timers module, not PWMSS.

    I use T2 & P4 pins, as I know those pins can't be used with PWMSS module.

  • Hello,

    I just want to remind that the question is actual yet, because I can't find solution by myself.

    Thank you.

  • Hi,

    Sorry for the delay,

    You're correct. You need to use Timer6 (device ball T2) & Timer8 (device ball P4).

    To enable TIMER6 or TIMER8 PWM, you could adopt the script, provided in the bellow thread (by Mark):
    e2e.ti.com/.../1292478

    The registers referred in the script are the same (values should be modified to match your use case), you should change the base addresses to match the base addresses of TIMER6 & TIMER8.

    Also you need to do the appropriate pinmux settings in dts & add status = okay for TIMER6 & TIMER8.

    Best Regards,
    Yordan