On 29/07/2019 22:45, Pavel Machek wrote:
> Hi!
>
>> On Mon, Jul 29, 2019 at 03:55:23PM +0200, Pavel Machek wrote:
>>>> Oh and the new backlight module comes up blanked right now so it
>>>> needs to be manually enabled via sysfs.
>>> Or you can enable ledtrig-backlight and apply this.
>>>
>>> (I know, we need better solution).
>> https://lore.kernel.org/lkml/20190717141514.21171-1-jjhiblot@ti.com/
>>
>> The above patchset is the proper solution. It is a backlight
>> driver, which takes the LED driver as input and exposes a
>> proper backlight device. This makes it possible to reference
>> the backlight in DT:
>>
>> ----------------
>> led-node {
>> blabla;
>> };
>>
>> backlight-node {
>> blabla;
>> led = <&led-node>;
>> };
>>
>> panel-node {
>> backlight = <&backlight-node>;
>> };
>> ----------------
> Hmm, I guess I should try to get it to work.
>
> I came up with this, and ... it does not work. If you see something
> obviously wrong, tell me.
The dts changes look OK to me.
You should be able to use the SYSFS to check if the LED is working as
expected (the backlight driver does not remove sysfs control over the LED)
Also can you check if it is working without a defined brightness-levels
in the DTS. The behavior of the LED may not be linear at all. On my test
board the LED is black until the LED level reaches 240 or so.
JJ
>
> Thanks,
> Pavel
>
> diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts
> index 62af1b8..0195580 100644
> --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts
> +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts
> @@ -202,12 +202,22 @@
> };
> };
>
> + backlight: backlight {
> + compatible = "led-backlight";
> +
> + leds = <&backlight_led>;
> + brightness-levels = <0 4 8 16 32 64 128 255>;
> + default-brightness-level = <6>;
> + };
> +
> lcd0: display {
> compatible = "panel-dsi-cm";
> label = "lcd0";
> vddi-supply = <&lcd_regulator>;
> reset-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* gpio101 */
>
> + backlight = <&backlight>;
> +
> width-mm = <50>;
> height-mm = <89>;
>
> @@ -417,12 +427,11 @@
> ramp-up-us = <1024>;
> ramp-down-us = <8193>;
>
> - led@0 {
> + backlight_led: led@0 {
> reg = <0>;
> led-sources = <2>;
> ti,led-mode = <0>;
> label = ":backlight";
> - linux,default-trigger = "backlight";
> };
>
> led@1 {
>
>