Configuring pin as PWM for LCD backlight

@danielt, @bamse, @architt, @Loic
I’m using Debian kernel 4.14 and TPS61165 driver for controlling the the LCD backlight. I’m facing issue in configuring the gpio pin as PWM pin for LCD panel.
The driver is getting initiated successfully, but there is no effect/change in the brightness even after changing the brightness entries in driver and sysfs.

So, I would require help on configuring the GPIO pin as PWM and on changing the duty cycle for brightness control.

Thanks in Advance.

Hi Naveena,

Can you describe what you’ve hooked up to the CTRL pin of the TPS61165 and how you have configured the relevant GPIO pin?


Hi @bamse,
I have configured the GPIO 5 in device tree as below:

    pinctrl-names = "default";
    pinctrl-0 = <&ls_exp_gpio_f>;

    ls_exp_gpio_f: pm8994_gpio5 {
     pinconf {
                    pins = "gpio5";
                    function = PMIC_GPIO_FUNC_NORMAL;
                    qcom,dtest = <1>;
                    power-source = <PM8994_GPIO_S4>; // 1.8V
                    qcom,drive-strength = <3>;

     backlight {
                    compatible = "ti,tps61165_bl";
                    rfa_en = <1>;
                    en_gpio_num = <&pm8994_gpios 5 GPIO_ACTIVE_HIGH>;

How to configure the pin as PWM to control the backlight?


AFAIU, TPS61165 can work in ‘EasyScale one-wire’ mode, which allows to control dimming via a simple gpio. This seems to be what the tps61165_bl driver is doing. So you don’t have to configure the pin in PWM mode but to keep in GPIO mode and let the driver manage it.

I suggest keeping pinconf with ‘output-low’ (initial shutdown state) and removing ‘qcom,dtest’ property.

Then probe the pin and check that there is some activity at init.

Also check I/O level compatibility. I understand control pin I/O level should be the same as VIN, which shoudl be 3V (min). DB820C I/O level is 1.8V by default (not sure we can change that via power-source here), so you may need a level shifter.

I made the pinconf as ‘output-low’ and removed the ‘qcom,dtest’ and booted the board.
The backlight was switched off. When probed, no voltage passed to the control pin.
But when the pinconf was kept as ‘output-high’, the voltage to the control pin was 3.3V.

The driver is getting initiated successfully but there is no effect/change in the brightness even after changing the brightness entries in driver and sysfs.

[ 12.496868] tps611xx_bl soc:backlight: [tps61165]based on EasyScale is initialized

root@root:/sys/class/backlight/tps611xx_bl# ls
actual_brightness  brightness  enable          power      type
bl_power           device      max_brightness  subsystem  uevent

I would like to know how to control the backlight brightness by using GPIO. Should anything else be configured to control dimming?


well, I’m not sure wich driver you are using since there is no tps611xx_bl driver upstream, but if you’re trying to use, the way the gpio is retrieved is probably wrong, you can’t specify a global gpio number in the devicetree since it’s allocated at runtime.

I would suggest to rename en_gpio_num in the devicetree with enable-gpios:

enable-gpios = <&pm8994_gpios 5 GPIO_ACTIVE_HIGH>;

And then adapt the driver tps611xx_backlight_parse_dt function to correctly retrieve the gpio with something like:

struct gpiod_desc *enable_gpio_desc;
enable_gpio_desc = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
pchip->en_gpio = desc_to_gpio(enable_gpio_desc);

Where is the 3.3v coming from? How exactly do you have the CTRL pin connected to the gpio?

Your configuration of gpio5 being output-high and “enable gpio” seems to match the fact that your backlight turns on and stays on, and output-low means it’s off.

What you’re looking for is to have a PWM signal from the LPG block act as control signal for the GPIO pin, rather than a normal software controlled GPIO. The typical way to do this is to have the LPG output its signal on a dtest line and have the GPIO be wired up to the same line.

There are some restrictions in how this can be routed and I’m not able to find my notes on the subject at this time. But does perhaps the fact that you have a qcom,dtest in your gpio5 node indicate that you have found this somewhere with an lpg node as well?


A level shifter is used to shift the voltage from default 1.8V to 3.3V. So the voltage to the control pin, when probed is 3.3V.

The PMIC gpio is connected to the connector pin of LCD panel which goes to the control pin of the TPS61165.

I’ll try updating the driver and update the status.


I couldn’t find way to have LPG out it signal on dtest line. Configuring this part is the problem I’m facing currently.

I took PM8916 as reference for the dtest. I’m not pretty sure with the dtest line.
I would like to know how to make LPG out through dtest line and wiring it up with GPIO5?


Any hint to move forward…?