blob: 6c11caae10613788ebdfb3b17ea9eb19109f4502 [file] [log] [blame]
Matt Spinlerd4cf3a32016-12-20 10:59:13 -06001#!/bin/sh
2
3i2cset -y 4 0x12 0x2E 0x23 b # VDD/VCS 0
4i2cset -y 4 0x13 0x2E 0x23 b # VDN 0
5i2cset -y 5 0x12 0x2E 0x23 b # VDD/VCS 1
6i2cset -y 5 0x13 0x2E 0x23 b # VDN 1
7
Andrew Geissler7e9e9f02017-07-28 15:55:06 -05008# A side VDDR - set to 1.23V
9i2cset -y 4 0x71 0x00 0x01
10i2cset -y 4 0x71 0x21 0x3B 0x01 i
11i2cset -y 4 0x71 0x00 0x00
12
13# B side VDDR - set to 1.23V
14i2cset -y 5 0x71 0x00 0x01
15i2cset -y 5 0x71 0x21 0x3B 0x01 i
16i2cset -y 5 0x71 0x00 0x00
Andrew Geissler7e1ed0c2017-07-28 16:07:27 -050017
18# VDN A - PGOOD_ON threshold
19i2cset -y 4 0x71 0x00 0x00 b # PAGE
20i2cset -y 4 0x71 0x5E 0xCD 0x00 i # set to 0.8V
21
22# VDN B - PGOOD_ON threshold
23i2cset -y 5 0x71 0x00 0x00 b # PAGE
24i2cset -y 5 0x71 0x5E 0xCD 0x00 i # set to 0.8V
Andrew Geissler2bba0b82017-08-07 16:26:39 -050025
26# unbind ucd driver to permit i2cset
27ucd_retries=5
28ucd=
29
30ucdpath="/sys/bus/i2c/drivers/ucd9000"
31if [ -e $ucdpath ]
32then
33 ucd=`ls -1 $ucdpath | grep 64`
34 if [ -n "$ucd" ]
35 then
36 echo $ucd > $ucdpath/unbind
37 fi
38fi
39
40# Raise AVDD +100mV
41i2cset -y 11 0x64 0x00 0x09 i # set PAGE
42i2cset -y 11 0x64 0xF5 0x81 i # set margin_config
43i2cset -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)
46if [ -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
57fi