summaryrefslogtreecommitdiff
path: root/include/driver/charger/isl923x_public.h
blob: 2ee5f62cdb2ba38261306ec6d2a519b8911d7fd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * Renesas (Intersil) ISL-9237/38 battery charger public header
 */

#ifndef __CROS_EC_DRIVER_CHARGER_ISL923X_PUBLIC_H
#define __CROS_EC_DRIVER_CHARGER_ISL923X_PUBLIC_H

#include "common.h"
#include "stdbool.h"

#define ISL923X_ADDR_FLAGS	(0x09)

extern const struct charger_drv isl923x_drv;

/**
 * Initialize AC & DC prochot threshold
 *
 * @param	chgnum: Index into charger chips
 * @param	AC Prochot threshold current in mA:
 *			multiple of 128 up to 6400 mA
 *			DC Prochot threshold current in mA:
 *			multiple of 128 up to 12800 mA
 *		Bits below 128mA are truncated (ignored).
 * @return enum ec_error_list
 */
int isl923x_set_ac_prochot(int chgnum, uint16_t ma);
int isl923x_set_dc_prochot(int chgnum, uint16_t ma);

/**
 * Set the general comparator output polarity when asserted.
 *
 * @param chgnum: Index into charger chips
 * @param invert: Non-zero to invert polarity, zero to non-invert.
 * @return EC_SUCCESS, error otherwise.
 */
int isl923x_set_comparator_inversion(int chgnum, int invert);

/**
 * Return whether ACOK is high or low.
 *
 * @param chgnum index into chg_chips table.
 * @param acok will be set to true if ACOK is asserted, otherwise false.
 * @return EC_SUCCESS, error otherwise.
 */
enum ec_error_list raa489000_is_acok(int chgnum, bool *acok);

/**
 * Prepare the charger IC for battery ship mode.  Battery ship mode sets the
 * lowest power state for the IC. Battery ship mode can only be entered from
 * battery only mode.
 *
 * @param chgnum index into chg_chips table.
 */
void raa489000_hibernate(int chgnum, bool disable_adc);

/**
 * Enable or Disable the ASGATE in the READY state.
 *
 * @param chgnum: Index into charger chips
 * @param enable: whether to enable ASGATE
 */
int raa489000_enable_asgate(int chgnum, bool enable);

enum ec_error_list isl9238c_hibernate(int chgnum);
enum ec_error_list isl9238c_resume(int chgnum);

#endif /* __CROS_EC_DRIVER_CHARGER_ISL923X_PUBLIC_H */