|
|
Line 1: |
Line 1: |
− | {{DISPLAYTITLE:How to add EDID for LVDS panel}} | + | {{DISPLAYTITLE:How to control panel brightness and backlight}} |
| | | |
− | == Prerequisites == | + | === Brightness === |
− | * PTN3460 Programming Guide
| |
− | * EDID config (128 bytes)
| |
− | * i2c-tools installed
| |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
− | sudo apt update
| + | # valid range : 0x0FFF (dark) ~ 0x0000 (brightest) # highest 4 bits must be zero |
− | sudo apt install i2c-tools
| + | # notice: keep highest 4 bits zero or brightness will be dark whatever lower 12 bits set |
− | </syntaxhighlight>
| |
− | | |
− | == Step-by-step procedures ==
| |
− | (use EDID 6 and panel G070VW01V0 as example) | |
− | === On Ubuntu ===
| |
− | create the setup script from EDID config
| |
− | <syntaxhighlight lang="bash">
| |
− | EDIDNEW=6
| |
− | EDIDBIN=g070vw01v0.bin
| |
− | SCRIPT=~/set_edid_${EDIDNEW}.sh
| |
− | | |
− | REG81=$(printf "0x%02x" 0) # Please refer to the PTN3460 Programming Guide to set correct value
| |
− | REG84=$(printf "0x%02x" $((2*EDIDNEW + 1)))
| |
− | REG85=$(printf "0x%02x" $EDIDNEW)
| |
− | echo -e "REG81:$REG81\nREG84:$REG84\nREG85:$REG85\n"
| |
− | | |
− | cat << EOT > $SCRIPT
| |
− | #!/bin/bash
| |
− | i2cset -f -y 2 0x20 0x85 $REG85 b
| |
− | | |
− | $(
| |
− | xxd -c 16 -ps $EDIDBIN |
| |
− | sed "s/../0x& /g; s/ *$//" |
| |
− | for ADDR in `seq 0x00 0x10 0x70`; do
| |
− | read
| |
− | echo i2cset -f -y 2 0x20 `printf "0x%02x" $ADDR` $REPLY i
| |
− | done
| |
− | )
| |
− | | |
− | i2cset -f -y 2 0x20 0x81 $REG81 b
| |
− | i2cset -f -y 2 0x20 0x84 $REG84 b
| |
− | i2cset -f -y 2 0x20 0xe8 0x01 0x78 0x45 0x56 i
| |
− | EOT
| |
− | | |
− | chmod +x $SCRIPT
| |
− | </syntaxhighlight>
| |
− | | |
− | run the script and reboot
| |
− | <syntaxhighlight lang="bash">
| |
− | sudo $SCRIPT
| |
− | sudo reboot
| |
− | </syntaxhighlight>
| |
| | | |
− | === On U-Boot ===
| + | # use hexadecimal without leading "0x" (default:7FF) |
− | Press any key to stop auto boot, and set matched device tree overlay (dtbo)
| + | BRIGHTNESS=6FF |
− | * Multi-display (HDMI + LVDS)
| + | sudo i2cset -f -y 2 0x20 0x90 $(( $((16#$BRIGHTNESS)) / 256 )) $(( $((16#$BRIGHTNESS)) % 256 )) i |
− | : The LVDS is always major display that has nothing to do with the specified order.
| |
− | <syntaxhighlight lang="bash">
| |
− | setenv DISPLAY hdmi.dtbo lvds6.dtbo
| |
− | saveenv
| |
− | reset
| |
− | </syntaxhighlight>
| |
| | | |
− | * LVDS only
| + | # keep setting |
− | <syntaxhighlight lang="bash">
| + | sudo i2cset -f -y 2 0x20 0xe8 0x01 0x78 0x45 0x56 i && sudo reboot |
− | setenv DISPLAY lvds6.dtbo
| |
− | saveenv
| |
− | reset
| |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | == Appendix == | + | === Backlight === |
− | === How to fetch and store EDID config === | |
− | (use the pre-set EDID 2, panel G070VW01V0, as example)
| |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
− | EDID=2
| |
− | EDIDBIN=g070vw01v0.bin
| |
− |
| |
− | sudo i2cset -f -y 2 0x20 0x85 $EDID b
| |
| | | |
− | for DA in $(seq 0 0x10 0x70); do
| |
− | sudo i2cget -f -y 2 0x20 $DA i 0x10
| |
− | done | xxd -r -p > $EDIDBIN
| |
| </syntaxhighlight> | | </syntaxhighlight> |
# valid range : 0x0FFF (dark) ~ 0x0000 (brightest) # highest 4 bits must be zero
# notice: keep highest 4 bits zero or brightness will be dark whatever lower 12 bits set
# use hexadecimal without leading "0x" (default:7FF)
BRIGHTNESS=6FF
sudo i2cset -f -y 2 0x20 0x90 $(( $((16#$BRIGHTNESS)) / 256 )) $(( $((16#$BRIGHTNESS)) % 256 )) i
# keep setting
sudo i2cset -f -y 2 0x20 0xe8 0x01 0x78 0x45 0x56 i && sudo reboot