tT2-4g R32.3.1 LCD0_BKLT_PWM

Maybe you should debug that by looking into the code by yourself.

so I now have /sys/class/backlight now has the link in it, what do I need to do next

Try to control the brightness node in it and see if the signal is changing as your expectation.
Maybe you should read some post from other linux kernel website to get more familiar with the generic kernel.

does 13e10000.host1x:backlight control lcd0_bklt_pwm?

linux tools change values in the 13e10000.host1x:backlight dir, but the actual backlight does not change.

will look at putting printk’s in pwm_bl.c to see if it is touching hardware.

Terry

in pwm_bl.c pb->notify() is returning 0… looks like the notify is not working.
Did commenting out the tegra_pwm_bl_ops_register(&pdev->dev); break the connection with backlight?

Thanks,
Terry

static int pwm_backlight_update_status(struct backlight_device *bl)
{
struct pwm_bl_data *pb = bl_get_data(bl);
int brightness = bl->props.brightness;
int duty_cycle;

    printk("%s(%d) pwr %d blk %d state %d \n ", __FUNCTION__, __LINE__, bl->props.power, bl->props.fb_blank, bl->props.state );
    if (bl->props.power != FB_BLANK_UNBLANK ||
        bl->props.fb_blank != FB_BLANK_UNBLANK ||
        bl->props.state & BL_CORE_FBBLANK)
            brightness = 0;

    printk("%s(%d) brightness %d pb %p\n ", __FUNCTION__, __LINE__ , brightness, pb);
    if (pb->notify)
            brightness = pb->notify(pb->dev, brightness);

why does backlight point to 13e10000 and pwm is 3280000 - 39c0000

why are these numbers not the same?

What needs to be changed?

Terry

drwxr-xr-x 2 root root 0 Jan 6 14:16 ./
drwxr-xr-x 92 root root 0 Jan 6 14:16 …/
lrwxrwxrwx 1 root root 0 Jan 6 14:16 pwmchip0 → …/…/devices/3280000.pwm/pwm/pwmchip0/
lrwxrwxrwx 1 root root 0 Jan 6 14:16 pwmchip1 → …/…/devices/3290000.pwm/pwm/pwmchip1/
lrwxrwxrwx 1 root root 0 Jan 6 14:16 pwmchip2 → …/…/devices/32a0000.pwm/pwm/pwmchip2/
lrwxrwxrwx 1 root root 0 Jan 6 14:16 pwmchip3 → …/…/devices/c340000.pwm/pwm/pwmchip3/
lrwxrwxrwx 1 root root 0 Jan 6 14:16 pwmchip4 → …/…/devices/39c0000.tachometer/pwm/pwmchip4/
tbuckley@BaseSystem_0_3:/sys/class/pwm$ ls /sys/class/backlight/
total 0
drwxr-xr-x 2 root root 0 Jan 6 14:22 ./
drwxr-xr-x 92 root root 0 Jan 6 14:16 …/
lrwxrwxrwx 1 root root 0 Jan 6 14:22 13e10000.host1x:backlight → …/…/devices/13e10000.host1x/13e10000.host1x:backlight/backlight/13e10000.host1x:backlight/
tbuckley@BaseSystem_0_3:/sys/class/pwm$

Did commenting out the tegra_pwm_bl_ops_register(&pdev->dev); break the connection with backlight?

That tegra_pwm_bl_ops_register function doesn’t do anything. That is why method 1,2,3 are all doing the same thing.

method 2,3 → let nvdisplay get initialized first-> tegra_pwm_bl_ops_register runs without crashed-> find board is nvdisplay, do nothing and return.
method 1 → why no just skip it?

why does backlight point to 13e10000 and pwm is 3280000 - 39c0000

That does not matter. 3280000- 39c0000 is the register address of pwmchip. Open tegra186-soc-pwm.dtsi and you will see it.

waynewww,

It looks like pb->notify is always returning 0, so pwm_bl.c is not working, How do I determine if the notify is working?

brightness never works if pb->notify() returns 0. what is pwm_bl.c accessing in the notify code.

pwm_bl_notify uses BACKLIGHT_DEVICE_PRE_BRIGHTNESS_CHANGE. it is not touched in any other modules in my source code? Am I missing something?

source code to process the BACKLIGHT_DEVICE_PRE_BRIGHTNESS_CHANGE seems to be missing in the source code tree.

Help
Terry

The only thing that matters are the pwm_config and pwm_backlight_power_on.

Ask your hardware guy to help check if you really write the correct configuration according to your schematic.

how do I check to see if the pinmux is correct for pwm1 and pwm2.

remember r32.3.1

Need the memory address so I can do a devmem2 on the registers. also need a pointer to the documentation on the registers.

Thanks,

any input on this question WayneWWW?

thanks
Terry

You can check the TX2 TRM from our dlc.

sudo devmem2 0x03280000
[sudo] password for tbuckley:
/dev/mem opened.
Memory mapped at address 0x7f9eb59000.
Value at address 0x3280000 (0x7f9eb59000): 0xDEAD2009

the system crashed and rebooted, any clue what I did wrong?
Thanks,

does

sudo cat /sys/kernel/debug/pwm

tell me the right information?
Terry

pinmux controller are different from pwm controller.

0x3280000 is pwm controller.

0x0c301080 is pinmux reg for LCD0_BKLT_PWM
0x0c3010a8 is for LCD1_BKLT_PWM.

does
sudo cat /sys/kernel/debug/pwm
tell me the right information?

Could you define what kind of "right information " is that?

The source code is already in your side so you should be able to do whatever you want. If you think something is not correct, do any change you would like to apply.

0x0c301080 was 0x1, used devmem2 to set it to 0x401 and xbacklight -set 30 now works.

this looked correct in all cfg files that are distributed with r32.3.1, but it ended up incorrect after the system booted. added devmem2 to rc.local and it is working.

WayneWWW, how do I add a second pwm to control the keyboard lights

Thanks,
Terry

Open the cfg file under Linux_for_Tegra/bootloader/t186ref. There should be some files with *pinumux * inside its file name.

When you run flash.sh, the log will tell you which pinmux is in use. Go to modify that pinmux file.

@WayneWWW, how do I add a second pwm to control the keyboard lights

Hi,

You already learned how to enable one pwm in previous comment. There should be no problem to enable the second one.

Please use your knowledge to enable that.