summaryrefslogtreecommitdiff
path: root/include/linux/max17048_battery.h
blob: 0a03efa3483a2c0deedabd679322c9d32c6e2e64 (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
/*
 * Copyright (C) 2009 Samsung Electronics
 * Copyright (c) 2012-2013, NVIDIA CORPORATION.  All rights reserved.
 * Minkyu Kang <mk7.kang@samsung.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef __MAX17048_BATTERY_H_
#define __MAX17048_BATTERY_H_
#include <linux/smb349-charger.h>

#define MAX17048_DATA_SIZE 64
#define MAX17048_MAX_SOC_STEP 10

struct max17048_battery_model {
	uint8_t rcomp;
	uint8_t soccheck_A;
	uint8_t soccheck_B;
	uint8_t bits;
	uint8_t alert_threshold;
	uint8_t one_percent_alerts;
	uint8_t alert_on_reset;
	uint16_t rcomp_seg;
	uint16_t hibernate;
	uint16_t vreset;
	uint16_t valert;
	uint16_t ocvtest;
	int t_co_hot;
	int t_co_cold;
	uint8_t data_tbl[MAX17048_DATA_SIZE];
};

struct max17048_platform_data {
	struct max17048_battery_model *model_data;

	s32 (*set_current_threshold)(s32 current_threshold, int min_cpu);
	int current_normal;
	int current_threshold_num;
	int current_threshold_soc[MAX17048_MAX_SOC_STEP];
	int current_threshold[MAX17048_MAX_SOC_STEP];

	void (*sysedp_throttle)(unsigned int power);
	int sysedp_throttle_num;
	int sysedp_throttle_soc[MAX17048_MAX_SOC_STEP];
	unsigned int sysedp_throttle_power[MAX17048_MAX_SOC_STEP];
};

void max17048_battery_status(int status, int chrg_type);
int max17048_check_battery(void);
int max17048_check_soc(void);
int max17048_check_vcell(void);
#endif