blob: 3f163d629da6de0533f541551c8e61f232b88496 [file] [log] [blame]
Jack Wu9ccfcf32021-10-14 12:00:47 +08001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright 2021 Google, LLC
4 *
5 */
6
7#include <soc/google/bcl.h>
8#include "gs101_usecase.h"
9
10#ifndef MAX77759_CHARGER_H_
11#define MAX77759_CHARGER_H_
12
13struct max77759_chgr_data {
14 struct device *dev;
15
16 struct power_supply *psy;
17 struct power_supply *wcin_psy;
18 struct power_supply *chgin_psy;
19
20 struct power_supply *wlc_psy;
21 struct regmap *regmap;
22
23 struct gvotable_election *mode_votable;
24 struct max77759_usecase_data uc_data;
Wasb Liu5fc4e082022-02-15 16:50:17 +080025 struct delayed_work mode_rerun_work;
Jack Wu9ccfcf32021-10-14 12:00:47 +080026
27 struct gvotable_election *dc_icl_votable;
28 struct gvotable_election *dc_suspend_votable;
29
30 bool charge_done;
31 bool chgin_input_suspend;
32 bool wcin_input_suspend;
33 bool thm2_sts;
34
35 int irq_gpio;
Wasb Liu5fc4e082022-02-15 16:50:17 +080036 int irq_int;
37 bool irq_disabled;
Jack Wu9ccfcf32021-10-14 12:00:47 +080038
39 struct i2c_client *fg_i2c_client;
40 struct i2c_client *pmic_i2c_client;
41
42 struct dentry *de;
43
44 atomic_t insel_cnt;
45 bool insel_clear; /* when set, irq clears CHGINSEL_MASK */
46
47 atomic_t early_topoff_cnt;
48
49 struct mutex io_lock;
50 bool resume_complete;
51 bool init_complete;
52 struct wakeup_source *usecase_wake_lock;
53
54 int fship_dtls;
55 bool online;
56 bool wden;
57
Ted Lindc19b982022-04-21 16:57:05 +080058 /* Force to change FCCM mode during OTG at high battery voltage */
59 bool otg_changed;
60 bool otg_fccm_reset;
61 int otg_fccm_vbatt_lowerbd;
62 int otg_fccm_vbatt_upperbd;
Ted Lindc19b982022-04-21 16:57:05 +080063 struct delayed_work otg_fccm_worker;
64 struct wakeup_source *otg_fccm_wake_lock;
65
Jack Wu9ccfcf32021-10-14 12:00:47 +080066 /* debug interface, register to read or write */
67 u32 debug_reg_address;
68
69 /* thermal BCL */
70#if IS_ENABLED(CONFIG_GOOGLE_BCL)
Jack Wu9ccfcf32021-10-14 12:00:47 +080071 struct bcl_device *bcl_dev;
George Lee8f1c9052022-01-04 15:08:55 -080072 struct delayed_work init_bcl;
Jack Wu9ccfcf32021-10-14 12:00:47 +080073#endif
74
75 int chg_term_voltage;
76 int chg_term_volt_debounce;
77};
78#endif