Matt Spinler | d4cf3a3 | 2016-12-20 10:59:13 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | i2cset -y 4 0x12 0x2E 0x23 b # VDD/VCS 0 |
| 4 | i2cset -y 4 0x13 0x2E 0x23 b # VDN 0 |
| 5 | i2cset -y 5 0x12 0x2E 0x23 b # VDD/VCS 1 |
| 6 | i2cset -y 5 0x13 0x2E 0x23 b # VDN 1 |
| 7 | |
Andrew Geissler | 7e9e9f0 | 2017-07-28 15:55:06 -0500 | [diff] [blame] | 8 | # A side VDDR - set to 1.23V |
| 9 | i2cset -y 4 0x71 0x00 0x01 |
| 10 | i2cset -y 4 0x71 0x21 0x3B 0x01 i |
| 11 | i2cset -y 4 0x71 0x00 0x00 |
| 12 | |
| 13 | # B side VDDR - set to 1.23V |
| 14 | i2cset -y 5 0x71 0x00 0x01 |
| 15 | i2cset -y 5 0x71 0x21 0x3B 0x01 i |
| 16 | i2cset -y 5 0x71 0x00 0x00 |
Andrew Geissler | 7e1ed0c | 2017-07-28 16:07:27 -0500 | [diff] [blame] | 17 | |
| 18 | # VDN A - PGOOD_ON threshold |
| 19 | i2cset -y 4 0x71 0x00 0x00 b # PAGE |
| 20 | i2cset -y 4 0x71 0x5E 0xCD 0x00 i # set to 0.8V |
| 21 | |
| 22 | # VDN B - PGOOD_ON threshold |
| 23 | i2cset -y 5 0x71 0x00 0x00 b # PAGE |
| 24 | i2cset -y 5 0x71 0x5E 0xCD 0x00 i # set to 0.8V |
Andrew Geissler | 2bba0b8 | 2017-08-07 16:26:39 -0500 | [diff] [blame] | 25 | |
| 26 | # unbind ucd driver to permit i2cset |
| 27 | ucd_retries=5 |
| 28 | ucd= |
| 29 | |
| 30 | ucdpath="/sys/bus/i2c/drivers/ucd9000" |
| 31 | if [ -e $ucdpath ] |
| 32 | then |
| 33 | ucd=`ls -1 $ucdpath | grep 64` |
| 34 | if [ -n "$ucd" ] |
| 35 | then |
| 36 | echo $ucd > $ucdpath/unbind |
| 37 | fi |
| 38 | fi |
| 39 | |
| 40 | # Raise AVDD +100mV |
| 41 | i2cset -y 11 0x64 0x00 0x09 i # set PAGE |
| 42 | i2cset -y 11 0x64 0xF5 0x81 i # set margin_config |
| 43 | i2cset -y 11 0x64 0x21 0x85 0x33 i # set VOUT_COMMAND |
| 44 | |
| 45 | # re-bind ucd driver only if we unbound it (i.e. ucd has been set with a value) |
| 46 | if [ -e $ucdpath -a -n "$ucd" ]; then |
| 47 | j=0 |
| 48 | until [ $j -ge $ucd_retries ] || [ -e $ucdpath/$ucd ]; do |
| 49 | j=$((j+1)) |
| 50 | echo $ucd > $ucdpath/bind || ret=$? |
| 51 | if [ $j -gt 1 ]; then |
| 52 | echo "rebinding UCD driver. Retry number $j" |
| 53 | sleep 1 |
| 54 | fi |
| 55 | done |
| 56 | if [ ! -e $ucdpath/$ucd ]; then exit $ret; fi |
| 57 | fi |