Jack Wu | 9ccfcf3 | 2021-10-14 12:00:47 +0800 | [diff] [blame] | 1 | /* 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 | |
| 13 | struct 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 Liu | 5fc4e08 | 2022-02-15 16:50:17 +0800 | [diff] [blame] | 25 | struct delayed_work mode_rerun_work; |
Jack Wu | 9ccfcf3 | 2021-10-14 12:00:47 +0800 | [diff] [blame] | 26 | |
| 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 Liu | 5fc4e08 | 2022-02-15 16:50:17 +0800 | [diff] [blame] | 36 | int irq_int; |
| 37 | bool irq_disabled; |
Jack Wu | 9ccfcf3 | 2021-10-14 12:00:47 +0800 | [diff] [blame] | 38 | |
| 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 Lin | dc19b98 | 2022-04-21 16:57:05 +0800 | [diff] [blame] | 58 | /* 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 Lin | dc19b98 | 2022-04-21 16:57:05 +0800 | [diff] [blame] | 63 | struct delayed_work otg_fccm_worker; |
| 64 | struct wakeup_source *otg_fccm_wake_lock; |
| 65 | |
Jack Wu | 9ccfcf3 | 2021-10-14 12:00:47 +0800 | [diff] [blame] | 66 | /* debug interface, register to read or write */ |
| 67 | u32 debug_reg_address; |
| 68 | |
| 69 | /* thermal BCL */ |
| 70 | #if IS_ENABLED(CONFIG_GOOGLE_BCL) |
Jack Wu | 9ccfcf3 | 2021-10-14 12:00:47 +0800 | [diff] [blame] | 71 | struct bcl_device *bcl_dev; |
George Lee | 8f1c905 | 2022-01-04 15:08:55 -0800 | [diff] [blame] | 72 | struct delayed_work init_bcl; |
Jack Wu | 9ccfcf3 | 2021-10-14 12:00:47 +0800 | [diff] [blame] | 73 | #endif |
| 74 | |
| 75 | int chg_term_voltage; |
| 76 | int chg_term_volt_debounce; |
| 77 | }; |
| 78 | #endif |