Files
kernel_google_msm-4.9/include/uapi/linux/qg-profile.h
Anirudh Ghayal e6b2f4a17e power: qcom: Add the QPNP QGAUGE (QG) driver
The QG driver adds support for battery gauging and reporting
the battery specific parameters to userspace. The driver comprises
of the below files:

qpnp-qg.c: Core QG driver
qg-soc.c: SOC (state of charge) scaling operations
qg-util.c: Common functions
qg-battery-profile.c: Parsing battery profile from DT
qg-profile-lib.c: Operations on battery profiles
qg-sdam.c: SDAM interface for QG

This commit also adds the below UAPI files,

qg.h: QG data shared between kernel and userspace QG modules
qg-profile.c: Profile data exchange between kernel and userspace.

CRs-Fixed: 2190528
Change-Id: I97f9d051692ed659030136a622e62009da55b462
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2018-02-20 15:34:48 +05:30

67 lines
1.5 KiB
C

#ifndef __QG_PROFILE_H__
#define __QG_PROFILE_H__
#include <linux/ioctl.h>
/**
* enum profile_table - Table index for battery profile data
*/
enum profile_table {
TABLE_SOC_OCV1,
TABLE_SOC_OCV2,
TABLE_FCC1,
TABLE_FCC2,
TABLE_Z1,
TABLE_Z2,
TABLE_Z3,
TABLE_Z4,
TABLE_Z5,
TABLE_Z6,
TABLE_Y1,
TABLE_Y2,
TABLE_Y3,
TABLE_Y4,
TABLE_Y5,
TABLE_Y6,
TABLE_MAX,
};
/**
* struct battery_params - Battery profile data to be exchanged
* @soc: SOC (state of charge) of the battery
* @ocv_uv: OCV (open circuit voltage) of the battery
* @batt_temp: Battery temperature in deci-degree
* @var: 'X' axis param for interpolation
* @table_index:Table index to be used for interpolation
*/
struct battery_params {
int soc;
int ocv_uv;
int fcc_mah;
int slope;
int var;
int batt_temp;
int table_index;
};
/* Profile MIN / MAX values */
#define QG_MIN_SOC 0
#define QG_MAX_SOC 10000
#define QG_MIN_OCV_UV 3000000
#define QG_MAX_OCV_UV 5000000
#define QG_MIN_VAR 0
#define QG_MAX_VAR 65535
#define QG_MIN_FCC_MAH 100
#define QG_MAX_FCC_MAH 16000
#define QG_MIN_SLOPE 1
#define QG_MAX_SLOPE 50000
/* IOCTLs to query battery profile data */
#define BPIOCXSOC _IOWR('B', 0x01, struct battery_params) /* SOC */
#define BPIOCXOCV _IOWR('B', 0x02, struct battery_params) /* OCV */
#define BPIOCXFCC _IOWR('B', 0x03, struct battery_params) /* FCC */
#define BPIOCXSLOPE _IOWR('B', 0x04, struct battery_params) /* Slope */
#define BPIOCXVAR _IOWR('B', 0x05, struct battery_params) /* All-other */
#endif /* __QG_PROFILE_H__ */