summaryrefslogtreecommitdiff
path: root/max77759_charger.h
blob: dfbe846b729cef960c0cb441a461fd06b2a3195a (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
71
72
73
74
75
76
77
78
79
80
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright 2021 Google, LLC
 *
 */

#include <soc/google/bcl.h>
#include "gs101_usecase.h"

#ifndef MAX77759_CHARGER_H_
#define MAX77759_CHARGER_H_

struct max77759_chgr_data {
	struct device *dev;

	struct power_supply *psy;
	struct power_supply *wcin_psy;
	struct power_supply *chgin_psy;

	struct power_supply *wlc_psy;
	struct regmap *regmap;

	struct gvotable_election *mode_votable;
	struct max77759_usecase_data uc_data;
	struct delayed_work mode_rerun_work;

	struct gvotable_election *dc_icl_votable;
	struct gvotable_election *dc_suspend_votable;

	bool charge_done;
	bool chgin_input_suspend;
	bool wcin_input_suspend;
	bool thm2_sts;

	int irq_gpio;
	int irq_int;
	bool irq_disabled;

	struct i2c_client *fg_i2c_client;
	struct i2c_client *pmic_i2c_client;

	struct dentry *de;

	atomic_t insel_cnt;
	bool insel_clear;	/* when set, irq clears CHGINSEL_MASK */

	atomic_t early_topoff_cnt;

	struct mutex io_lock;
	bool resume_complete;
	bool init_complete;
	struct wakeup_source *usecase_wake_lock;

	int fship_dtls;
	bool online;
	bool wden;

	/* Force to change FCCM mode during OTG at high battery voltage */
	bool otg_changed;
	bool otg_fccm_reset;
	int otg_fccm_vbatt_lowerbd;
	int otg_fccm_vbatt_upperbd;
	struct delayed_work otg_fccm_worker;
	struct wakeup_source *otg_fccm_wake_lock;

	/* debug interface, register to read or write */
	u32 debug_reg_address;

	struct gvotable_election *aicl_active_el;

	/* thermal BCL */
#if IS_ENABLED(CONFIG_GOOGLE_BCL)
	struct bcl_device *bcl_dev;
	struct delayed_work init_bcl;
#endif

	int chg_term_voltage;
	int chg_term_volt_debounce;
};
#endif