File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
zephyr/program/lotus/lotus/src Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,33 @@ DECLARE_DEFERRED(charger_chips_init_retry);
3737static void board_check_current (void );
3838DECLARE_DEFERRED (board_check_current );
3939
40+ static void board_ina236_init (void )
41+ {
42+ int rv ;
43+
44+ /* TODO(crosbug.com/p/29730): assume 1mA/LSB, revisit later */
45+ rv = ina2xx_write (0 , INA2XX_REG_CALIB , 0x0831 );
46+
47+ if (rv != EC_SUCCESS )
48+ CPRINTS ("ina236 write calib fail" );
49+
50+ rv = ina2xx_write (0 , INA2XX_REG_CONFIG , 0x4007 );
51+
52+ if (rv != EC_SUCCESS )
53+ CPRINTS ("ina236 write config fail" );
54+
55+ rv = ina2xx_write (0 , INA2XX_REG_ALERT , 0x3E80 );
56+
57+ if (rv != EC_SUCCESS )
58+ CPRINTS ("ina236 write alert fail" );
59+
60+ rv = ina2xx_write (0 , INA2XX_REG_MASK , 0x8008 );
61+
62+ if (rv != EC_SUCCESS )
63+ CPRINTS ("ina236 write mask fail" );
64+ }
65+
66+
4067static void charger_chips_init (void )
4168{
4269 int chip ;
@@ -110,6 +137,10 @@ static void charger_chips_init(void)
110137 /* TODO: should we need to talk to PD chip after initial complete ? */
111138 hook_call_deferred (& board_check_current_data , 10 * MSEC );
112139 CPRINTS ("ISL9241 customized initial complete!" );
140+
141+ /* Initial the INA236 */
142+ board_ina236_init ();
143+
113144 return ;
114145
115146init_fail :
You can’t perform that action at this time.
0 commit comments