Page 1 of 1

Backlight PWM -

PostPosted: Thu Sep 05, 2013 12:05 pm
by Lukas
I want to use/activate a backlight control to wandboard.
There are different files ;) to modify. Where should I start?

Please can anybody provide a brief description on linux(android) backlight control.

linux/drivers/video/backlight/pwm_bl.c: usage,
.../board-wand.c :
Code: Select all
/****************************************************************************
 *                                                                         
 * LCD Backlight Control
 *                                                                         
 ****************************************************************************/
#include <linux/pwm_backlight.h>

static struct platform_pwm_backlight_data wand_pwm_backlight_data = {
   .pwm_id = 2,
   .max_brightness = 248,
   .dft_brightness = 248,
   .pwm_period_ns = 50000,
};

static void wand_init_lcd_backlight(void)
{
   EDM_SET_PAD( PAD_SD4_DAT1__PWM3_PWMO ); // any pin  possible ????
   imx6q_add_mxc_pwm(2);
   imx6q_add_mxc_pwm_backlight(2, &wand_pwm_backlight_data);
}


thanks in advance!
Lukas

Re: Backlight PWM -

PostPosted: Thu Sep 05, 2013 2:43 pm
by Lukas
Android 4.2.2:

There is only this device:
Code: Select all
root@android:/sys/devices/platform/pwm-backlight.2 # ls
modalias
power
subsystem
uevent


no actual values etc.....? :(

Re: Backlight PWM -

PostPosted: Mon Sep 09, 2013 3:42 am
by tungyilin1127
To operate on backlight,
you can try /sys/class/backlight/pwm-backlight.2/brightness

Re: Backlight PWM -

PostPosted: Mon Sep 09, 2013 3:44 am
by tungyilin1127
How do you connect your panel?
Which signals do you use?

Re: Backlight PWM -

PostPosted: Mon Sep 09, 2013 6:39 am
by Lukas
tungyilin1127 wrote:To operate on backlight,
you can try /sys/class/backlight/pwm-backlight.2/brightness

The mentioned device does not exist in used android build. According wandboard_android_defconfig-file (and for other OS) it is disabled.

Even when I set :
Code: Select all
CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_GENERIC is not set
CONFIG_BACKLIGHT_PWM=y


I can't activate sys/class/pwm....

Pin Configuration: I would like to control R_DISP0_CNTRST (or R_DISP0_VDDEN) pin, which is part of connector JP2.

Re: Backlight PWM -

PostPosted: Mon Sep 09, 2013 10:45 am
by tungyilin1127
grep from imx6_android_defconfig

CONFIG_HAVE_PWM=y
CONFIG_IMX_HAVE_PLATFORM_MXC_PWM=y
CONFIG_MXC_PWM=y
# CONFIG_INPUT_PWM_BEEPER is not set
CONFIG_BACKLIGHT_PWM=y
# CONFIG_LEDS_PWM is not set

seems these two are missing.
CONFIG_IMX_HAVE_PLATFORM_MXC_PWM=y
CONFIG_MXC_PWM=y

Re: Backlight PWM -

PostPosted: Tue Sep 10, 2013 6:52 am
by Lukas
@wandboard_android_defconfig
  • CONFIG_HAVE_PWM is missing at all - what is the reason?
  • CONFIG_IMX_HAVE_PLATFORM_MXC_PWM=y is set
  • CONFIG_MXC_PWM is just disabled.

To get an overview of those modules and functionality - is there any documentation available?

thx Lukas

Re: Backlight PWM -

PostPosted: Thu Sep 12, 2013 10:55 am
by Lukas
I was brave and activated
  • CONFIG_HAVE_PWM=y
  • CONFIG_MXC_PWM
it built successfully. Now I'm able to change brightness value at \sys\class\backlight\.... (checked with "cat brightness") from android OS without changing brightness of lcd display.

It seems the PWM module does not receive this value....

Are there any hints where to start?

thx!
Lukas

PS: My goal is to change brightness of future electronics display (FW...) from android OS or for test purpose select an GPIO pin for PWM output.

Re: Backlight PWM -

PostPosted: Fri Sep 13, 2013 6:38 am
by Tapani
It appears that the FWBADAPT expects PWM on EDM pin 76, but on the Wandboard we assumed pin 82 would be used for BL PWM.
The EDM spec is a little fuzzy on that (both pins 76 and 82 are for "Backlight control").

Re: Backlight PWM -

PostPosted: Fri Sep 13, 2013 7:35 am
by Lukas
It works! The signal seems to be routed to PAD_SD4_DAT1__PWM3_PWMO -> B19 -> PIN27 (right!). I measured proportional to brightness slider (android) the voltage on this pin.
Now I try to multiplex the output of pwm to DISP0_VDDEN. But it looks like the pwm function is no supported by this pin (SD4_DAT3__XXXXXX).
I am going to test wheater I get the pwm signal on pin SD4_DAT2 by changing following thing:

board-wand.c
Code: Select all
static void wand_init_lcd_backlight(void)
{
//    EDM_SET_PAD( PAD_SD4_DAT1__PWM3_PWMO );
        EDM_SET_PAD( PAD_SD4_DAT2__PWM4_PWMO );
        imx6q_add_mxc_pwm(2);
        imx6q_add_mxc_pwm_backlight(2, &wand_pwm_backlight_data);
}


I let you know what happens!

Lukas