xref: /OK3568_Linux_fs/kernel/include/linux/power/bq2415x_charger.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * bq2415x charger driver
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 2011-2013  Pali Rohár <pali@kernel.org>
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #ifndef BQ2415X_CHARGER_H
9*4882a593Smuzhiyun #define BQ2415X_CHARGER_H
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun /*
12*4882a593Smuzhiyun  * This is platform data for bq2415x chip. It contains default board
13*4882a593Smuzhiyun  * voltages and currents which can be also later configured via sysfs. If
14*4882a593Smuzhiyun  * value is -1 then default chip value (specified in datasheet) will be
15*4882a593Smuzhiyun  * used.
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * Value resistor_sense is needed for configuring charge and
18*4882a593Smuzhiyun  * termination current. If it is less or equal to zero, configuring charge
19*4882a593Smuzhiyun  * and termination current will not be possible.
20*4882a593Smuzhiyun  *
21*4882a593Smuzhiyun  * For automode support is needed to provide name of power supply device
22*4882a593Smuzhiyun  * in value notify_device. Device driver must immediately report property
23*4882a593Smuzhiyun  * POWER_SUPPLY_PROP_CURRENT_MAX when current changed.
24*4882a593Smuzhiyun  */
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun /* Supported modes with maximal current limit */
27*4882a593Smuzhiyun enum bq2415x_mode {
28*4882a593Smuzhiyun 	BQ2415X_MODE_OFF,		/* offline mode (charger disabled) */
29*4882a593Smuzhiyun 	BQ2415X_MODE_NONE,		/* unknown charger (100mA) */
30*4882a593Smuzhiyun 	BQ2415X_MODE_HOST_CHARGER,	/* usb host/hub charger (500mA) */
31*4882a593Smuzhiyun 	BQ2415X_MODE_DEDICATED_CHARGER, /* dedicated charger (unlimited) */
32*4882a593Smuzhiyun 	BQ2415X_MODE_BOOST,		/* boost mode (charging disabled) */
33*4882a593Smuzhiyun };
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun struct bq2415x_platform_data {
36*4882a593Smuzhiyun 	int current_limit;		/* mA */
37*4882a593Smuzhiyun 	int weak_battery_voltage;	/* mV */
38*4882a593Smuzhiyun 	int battery_regulation_voltage;	/* mV */
39*4882a593Smuzhiyun 	int charge_current;		/* mA */
40*4882a593Smuzhiyun 	int termination_current;	/* mA */
41*4882a593Smuzhiyun 	int resistor_sense;		/* m ohm */
42*4882a593Smuzhiyun 	const char *notify_device;	/* name */
43*4882a593Smuzhiyun };
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #endif
46