Backlight HAL driver or how to control backlight of the VU7+

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

joerg wrote:
Wed Mar 10, 2021 8:37 pm
You can find it in the Odroid Settings.
As I saw now, you would need to put pwm_d-backlight there, if you are on N2. But it points to pin35. There is a conflict with the default setting in GpioShutdownService App wpi 24. You must then select another pin for shutdown.
Thanks for your help.
I changed pin24 of shutdownservice app as i need it. Using 21 now.

After reboot, it's always not working

Image

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

Image

Image

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

You can, maybe you must, delete the other pwm overlays and reboot. It seems to be a conflict as it is now.
Then for test you can connect the gray wire not to pin 35, but to GND and to 3.3V to see if the hardware connection to works generally and the backlight goes off and on.
And after rebooting you can connect with adb and do a logcat|grep light to see if Android HAL is connecting to driver.

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

Here is logcat

Code: Select all

:/ # logcat|grep light
03-10 13:48:04.848     0     0 I         : [    0.000000@0] Kernel command line: rootfstype=ramfs init=/init console=ttyS0,115200n8 no_console_suspend earlyprintk=aml-uart,0xff803000 quiet ramoops.pstore_en=1 ramoops.record_size=0x8000 ramoops.console_size=0x4000 max_freq_a73=2208 max_freq_a53=1908 modeline=1024,600,49000,37347,60,1024,1029,1042,1312,600,602,605,622,0,1,1 customwidth=1024 customheight=600 disable_vu7=false touch_invert_x=false touch_invert_y=false zoom_rate=100 test_mt_vid=0000 test_mt_pid=0000 backlight_pwm=yes suspend_hdmiphy=1 prevent_sleep=1 usb-xhci.tablesize=2 boot_device=mmcblk0 androidboot.selinux=permissive androidboot.firstboot= jtag=disable androidboot.hardware=odroidn2 otg_device=1 buildvariant=eng colorattribute=444,8bit disablehpd=false logo=osd0,loaded,0x3d800000 cvbsmode=576cvbs hdmimode=custombuilt voutmode=hdmi cvbscable= osd_reverse=0 video_reverse=0 gpiopower= enable_wol=0 backlight_pwm=yes otg_device=1 buildvariant=userdebug
03-10 13:48:04.853     0     0 W         : [    0.763456@5] backlight supply power not found, using dummy regulator
03-10 13:48:04.862     0     0 I [    2.387051@2] init: Parsing file /vendor/etc/init/android.hardware.light@2.0-service.rc...
03-10 13:48:14.887  3345  3345 I SystemServerTiming: OnBootPhase_550_com.android.server.twilight.TwilightService
03-10 13:48:14.887  3345  3345 D SystemServerTiming: OnBootPhase_550_com.android.server.twilight.TwilightService took to complete: 0ms
03-10 13:48:15.060  3345  3345 I SystemServerTiming: OnBootPhase_600_com.android.server.lights.LightsService
03-10 13:48:15.061  3345  3345 D SystemServerTiming: OnBootPhase_600_com.android.server.lights.LightsService took to complete: 0ms
03-10 13:48:15.096  3345  3345 I SystemServerTiming: OnBootPhase_600_com.android.server.twilight.TwilightService
03-10 13:48:15.096  3345  3345 D SystemServerTiming: OnBootPhase_600_com.android.server.twilight.TwilightService took to complete: 0ms
03-10 13:48:15.162  3345  3345 I SystemServerTiming: ssm.onStartUser-0_com.android.server.lights.LightsService
03-10 13:48:15.163  3345  3345 D SystemServerTiming: ssm.onStartUser-0_com.android.server.lights.LightsService took to complete: 0ms
03-10 13:48:15.182  3345  3345 I SystemServerTiming: ssm.onStartUser-0_com.android.server.twilight.TwilightService
03-10 13:48:15.182  3345  3345 D SystemServerTiming: ssm.onStartUser-0_com.android.server.twilight.TwilightService took to complete: 0ms
03-10 13:48:24.147  3345  3365 I ActivityManagerTiming: OnBootPhase_1000_com.android.server.lights.LightsService
03-10 13:48:24.147  3345  3365 D ActivityManagerTiming: OnBootPhase_1000_com.android.server.lights.LightsService took to complete: 0ms
03-10 13:48:24.176  3345  3365 I ActivityManagerTiming: OnBootPhase_1000_com.android.server.twilight.TwilightService
03-10 13:48:24.178  3345  3365 D TwilightService: startListening
03-10 13:48:24.217  3345  3365 D ActivityManagerTiming: OnBootPhase_1000_com.android.server.twilight.TwilightService took to complete: 40ms
03-10 13:48:24.641  3345  3371 I SystemServerTimingAsync: ssm.onUnlockingUser-0_com.android.server.lights.LightsService
03-10 13:48:24.641  3345  3371 D SystemServerTimingAsync: ssm.onUnlockingUser-0_com.android.server.lights.LightsService took to complete: 0ms
03-10 13:48:24.678  3345  3371 I SystemServerTimingAsync: ssm.onUnlockingUser-0_com.android.server.twilight.TwilightService
03-10 13:48:24.678  3345  3371 D SystemServerTimingAsync: ssm.onUnlockingUser-0_com.android.server.twilight.TwilightService took to complete: 0ms
03-10 13:48:24.800  3345  3371 I SystemServerTimingAsync: ssm.onUnlockedUser-0_com.android.server.lights.LightsService
03-10 13:48:24.800  3345  3371 D SystemServerTimingAsync: ssm.onUnlockedUser-0_com.android.server.lights.LightsService took to complete: 0ms
03-10 13:48:24.802  3345  3371 I SystemServerTimingAsync: ssm.onUnlockedUser-0_com.android.server.twilight.TwilightService
03-10 13:48:24.802  3345  3371 D SystemServerTimingAsync: ssm.onUnlockedUser-0_com.android.server.twilight.TwilightService took to complete: 0ms
03-10 13:49:07.710  3089  3089 D lights.odroid: set_light_buttons: Not implemented.
03-10 13:49:18.140  3089  3089 D lights.odroid: set_light_buttons: Not implemented.
03-10 13:49:46.226  6853  6853 W LayerDrawable:         at com.android.settings.widget.HighlightablePreferenceGroupAdapter.onBindViewHolder(HighlightablePreferenceGroupAdapter.java:110)
03-10 13:49:46.226  6853  6853 W LayerDrawable:         at com.android.settings.widget.HighlightablePreferenceGroupAdapter.onBindViewHolder(HighlightablePreferenceGroupAdapter.java:43)
03-10 13:50:17.219  3089  3089 D lights.odroid: set_light_buttons: Not implemented.
03-10 13:50:22.956  3089  3089 D lights.odroid: set_light_buttons: Not implemented.
When connecting to ground or 3.3v, backlight is working. The Android slider does just not work.
I have removed others pwm overlays, rebooted but not luck

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

This indicates that the driver is started: lights.odroid.
I need to try it by myself with N2+ and LOS18, to get an idea why it's not working. Stay connected ... it only can take hours ... ;)
These users thanked the author joerg for the post:
zyssai (Wed Mar 10, 2021 10:06 pm)

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

joerg wrote:
Wed Mar 10, 2021 10:03 pm
This indicates that the driver is started: lights.odroid.
I need to try it by myself with N2+ and LOS18, to get an idea why it's not working. Stay connected ... it only can take hours ... ;)
Really appreciate your help ;)

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

I am not yet sure. It seems that the lights driver doesn't export the pwm0 correct.

Code: Select all

odroidn2:/sys/class/pwm/pwmchip4 # ls
device  export  npwm  power  subsystem  uevent  unexport
After enabling at commandline in adb:

Code: Select all

echo 0 > export
ls                                          
device  export  npwm  power  pwm0  subsystem  uevent  unexport
Then can be given commands as on wiki page:

Code: Select all

echo 1000000 > period
echo 1 > enable
echo 500000 > duty_cycle 
I see with oscilloscope pwm at pin 33.

But why it is not working with the lights driver?

I tried with this in/vendor/etc/init/hw/init.odroidn2.rc, but no success.

Code: Select all

    #for pwm backlight control
    chmod 666 /sys/class/pwm/pwmchip4/export
Need to ask @voodik, why this is not working.
If this is in the lights driver:

Code: Select all

char backlight_control[64] = "/sys/class/gpio/export";
char backlight_gpio491[64] = "/sys/class/gpio/gpio491/direction";
char backlight_export[64] = "/sys/class/pwm/pwmchip4/export";
char backlight_unexport[64] = "/sys/class/pwm/pwmchip4/unexport";
char backlight_en[64] = "/sys/class/pwm/pwmchip4/pwm0/enable";
char backlight_period[64] = "/sys/class/pwm/pwmchip4/pwm0/period";
char backlight_duty_cycle[64] = "/sys/class/pwm/pwmchip4/pwm0/duty_cycle";
This is from Pie sources.

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

It exceed my skills, i let you Ask @voodik if you can :?:

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

@zyssai, I have found a workaround to make it work.

You need Magisk installed.
You open an adb shell.
In shell you cd to /data/adb/post-fs-data.d/ and there you create a script backlight_pwm.sh:

Code: Select all

odroidn2:/ # cd /data/adb/post-fs-data.d
odroidn2:/data/adb/post-fs-data.d # nano backlight_pwm.sh
You put this inside:

Code: Select all

#!/system/bin/sh
echo 0 > /sys/class/pwm/pwmchip4/export
chmod 666 /sys/class/pwm/pwmchip4/pwm0/enable
chmod 666 /sys/class/pwm/pwmchip4/pwm0/period
chmod 666 /sys/class/pwm/pwmchip4/pwm0/duty_cycle
echo 1000000 > /sys/class/pwm/pwmchip4/pwm0/period
echo 500000 > /sys/class/pwm/pwmchip4/pwm0/duty_cycle
echo 1 > /sys/class/pwm/pwmchip4/pwm0/enable
This commandos should the lights driver do, but it doesn't. They are for initializing the pwm0. Magisk starts this script at boot time.
Then this script must be executable:

Code: Select all

odroidn2:/data/adb/post-fs-data.d # chmod 755 backlight_pwm.sh
In Overlays I have only i2c0 pwm_cd.
After reboot there should be pwm at pin 33.
But be careful, with minimum brightness the screen becomes black.
These users thanked the author joerg for the post:
voodik (Thu Mar 11, 2021 10:34 pm)

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

joerg wrote:
Thu Mar 11, 2021 3:51 am
...
Awesome, it works perfectly !!
Thanks for your help!
At minimum brightness, it is not fully dark, i can see the display ;)

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

Maybe your eyes are younger than mine ...
These users thanked the author joerg for the post:
odroid (Thu Mar 11, 2021 9:26 am)

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

Hi!

I need to make this project one time again.
Do I need exactly 100ohm resistance? I don't have one anymore.

Thanks

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

150, 220, 470 are also o.k. Also a wire would work. But it must not be a high value resistor like 10k, 100k. I used a resistor, because this way I can connect easily a dupont connector.
These users thanked the author joerg for the post:
zyssai (Sun May 23, 2021 3:15 am)

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

joerg wrote:
Sun May 23, 2021 2:36 am
150, 220, 470 are also o.k. Also a wire would work. But it must not be a high value resistor like 10k, 100k. I used a resistor, because this way I can connect easily a dupont connector.
Thanks you, i think I have those values ;)

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

Hi,

I've just updated to LineageOS 19, and now VU7A+ brightness is not working anymore.
I have made the workaround posted here, but it does nothing.
Anyone managed to get it working?

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

Hi @zyssai, yes I can confirm that lights service is not working as expected on LOS19 of N2. Giving the commandos by hand from my workaround makes the pwm working. I can measure different voltages. But the Android lights service does not set the pwm value. I see in logcat that the service is started and there is coming every now an then message 05-06 08:05:13.300 3171 3171 D lights.odroid: set_light_buttons: Not implemented.. But there should also come messages light_level = as it is in the source code in the function set_light_backlight (which is implemented) like LOGD("light_level = %d", light_level);. But I don't know if @voodik has modified the source code or not. As the sources of @voodiks LOS is closed, I can not dive deeper into this. You would need to ask @voodik for help.
These users thanked the author joerg for the post:
zyssai (Sat May 07, 2022 1:53 am)

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

joerg wrote:
Fri May 06, 2022 5:19 pm
Hi @zyssai, yes I can confirm that lights service is not working as expected on LOS19 of N2. Giving the commandos by hand from my workaround makes the pwm working. I can measure different voltages. But the Android lights service does not set the pwm value. I see in logcat that the service is started and there is coming every now an then message 05-06 08:05:13.300 3171 3171 D lights.odroid: set_light_buttons: Not implemented.. But there should also come messages light_level = as it is in the source code in the function set_light_backlight (which is implemented) like LOGD("light_level = %d", light_level);. But I don't know if @voodik has modified the source code or not. As the sources of @voodiks LOS is closed, I can not dive deeper into this. You would need to ask @voodik for help.
Thanks, this is not a real problem since we are soon in summer, brightness is always at top.
I hope it will be fixed for next winter as I always drive at morning :lol:
I will ask voodik, have a nice day.

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

Hi joerg.

I have no news about VU7A+ brightness control for LOS19.1.
Do you know if VU7C screen have brightness control with LOS18.x or 19.x? I will need to order one.

Thanks!

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

I just tried VU7C on N2 with LOS19.0. But no brightness control.
I see that the driver is started after I added display_vu7c pwm_backlight to overlays:

Code: Select all

06-22 11:58:02.561  3194  3194 D lights.odroid: light_level = 197
06-22 11:58:03.790  3194  3194 D lights.odroid: light_level = 16
06-22 11:58:04.175  3194  3194 D lights.odroid: light_level = 9
06-22 11:58:04.662  3194  3194 D lights.odroid: light_level = 2
After I put backlight_pwm=yes into env.ini, the display went dark after reboot.
I wonder which gpio is used by the VU7C for pwm brightness.

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

Thanks, so if it went dark, there is probably a way to make it work, that's a good news.

So you seems to own a VU7C, perhaps you can help me because I have some questions about it before I buy one, if you can take a look, thanks in advance.

User avatar
odroid
Site Admin
Posts: 39564
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2687 times
Been thanked: 1483 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by odroid »

According to the Vu7C schematics, the LCD backlit PWM is connected to the 40pin GPIO header pin #12.
https://wiki.odroid.com/accessory/displ ... eries/vu7c
These users thanked the author odroid for the post:
zyssai (Thu Jun 23, 2022 3:34 pm)

User avatar
zyssai
Posts: 417
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
Vu7a+
Has thanked: 156 times
Been thanked: 57 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by zyssai »

Hi joerg.

Did you managed to get brightness control working on LOS19 with VU7C?

Thanks

User avatar
joerg
Posts: 1646
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 136 times
Been thanked: 289 times
Contact:

Re: Backlight HAL driver or how to control backlight of the VU7+

Post by joerg »

No, sorry, you would need to ask @voodik for help. I have no sources of LOS19 for N2.
These users thanked the author joerg for the post:
zyssai (Fri Aug 26, 2022 4:22 pm)

Post Reply

Return to “Android”

Who is online

Users browsing this forum: No registered users and 1 guest