summaryrefslogtreecommitdiff
path: root/driver/charger/bq25703.h
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2018-06-30 07:47:51 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-07-19 20:12:52 -0700
commitee00a00061937817e3e4f5f95d117f92e4e1721f (patch)
tree3387fdf4f4a0267fa4cd543b6ceb258e53b62592 /driver/charger/bq25703.h
parent76d6f012d342e9a60f7e53c85fb15e82aac6518b (diff)
downloadchrome-ec-ee00a00061937817e3e4f5f95d117f92e4e1721f.tar.gz
bq25703: Fix charge ramp issue
Follow the below charge ramp sequence for BQ25703. 1. Set InputVoltage register (0x0A) value to slightly below the adaptor voltage with full load specification. 2. Disable external ILIM_HIZ by setting ChargerOption2 (0x32) bit 7 to 0. 3. Enable ICO test by setting ChargeOption3 (0x34h) bit 11 to 1. 4. Set IIN_HOST (0x0F) register value to the maximum amount of input current limit the user would like to sink on VBUS. 5. Wait for approximately 2sec, and check the ChargeStatus register (0x20) bit 14 for ICO completion. 6. Read ADC_IIN register (0x2B) after ICO is done and write this value back to IIN_HOST (0x0F) BUG=b:80279932 BRANCH=none TEST=Manually tested on BIP. Used USB Charging Voltage Current Panel Meter. Current showed on the display is same as input current read by charger command. CDP: charger rating with 5A,1.5A are ramped to 2.4A,1.5A respectively. DCP: charger rating with 5A,2A,1A are ramped to 2.4A,2.2A,1A respectively. SDP: USB3.0 -> ramped to 850mA USB2.0 (Manually modified max current to 900mA) -> ramped to 750mA Change-Id: I15e01ae033aa25890c81a4836dae809be31d313d Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1123679 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'driver/charger/bq25703.h')
-rw-r--r--driver/charger/bq25703.h52
1 files changed, 34 insertions, 18 deletions
diff --git a/driver/charger/bq25703.h b/driver/charger/bq25703.h
index db7e50df52..db2c246658 100644
--- a/driver/charger/bq25703.h
+++ b/driver/charger/bq25703.h
@@ -11,24 +11,58 @@
/* I2C Interface */
#define BQ25703_I2C_ADDR1 0xD6
+/*
+ * BC1.2 minimum voltage threshold for BQ25703.
+ * BC1.2 charging port output voltage range is 4.75V to 5.25V,
+ * BQ25703 Input Voltage Accuracy is -2% to +2% (-95mV to +95mV)
+ * 4750mV - 95mV => 4655mV - 3200 (offset reg 0x0A) => 1455mv
+ * 1455mv & 0x1FC0 = 1408 (data for register 0x0A)
+ */
+#define BQ25703_BC12_MIN_VOLTAGE_MV 1408
+
/* Registers */
+
+/* ChargeOption0 Register */
#define BQ25703_REG_CHARGE_OPTION_0 0x00
+#define BQ25703_CHARGE_OPTION_0_LOW_POWER_MODE (1 << 15)
+#define BQ25703_CHARGE_OPTION_0_EN_LEARN (1 << 5)
+#define BQ25703_CHARGE_OPTION_0_CHRG_INHIBIT (1 << 0)
+
#define BQ25703_REG_CHARGE_CURRENT 0x02
#define BQ25703_REG_MAX_CHARGE_VOLTAGE 0x04
#define BQ25703_REG_CHARGE_OPTION_1 0x30
+
+/* ChargeOption2 Register */
#define BQ25703_REG_CHARGE_OPTION_2 0x32
+#define BQ25703_CHARGE_OPTION_2_EN_EXTILIM (1 << 7)
+
+/* ChargeOption3 Register */
#define BQ25703_REG_CHARGE_OPTION_3 0x34
+#define BQ25703_CHARGE_OPTION_3_EN_ICO_MODE (1 << 11)
+
#define BQ25703_REG_PROCHOT_OPTION_0 0x36
#define BQ25703_REG_PROCHOT_OPTION_1 0x38
+
+/* ADCOption Register */
#define BQ25703_REG_ADC_OPTION 0x3A
+#define BQ25703_ADC_OPTION_ADC_START (1 << 14)
+#define BQ25703_ADC_OPTION_EN_ADC_IIN (1 << 4)
+
+/* ChargeStatus Register */
#define BQ25703_REG_CHARGER_STATUS 0x20
+#define BQ25703_CHARGE_STATUS_ICO_DONE (1 << 14)
+
#define BQ25703_REG_PROCHOT_STATUS 0x22
#define BQ25703_REG_IIN_DPM 0x25
#define BQ25703_REG_ADC_PSYS 0x26
#define BQ25703_REG_ADC_VBUS 0x27
#define BQ25703_REG_ADC_IBAT 0x28
#define BQ25703_REG_ADC_CMPIN 0x2A
+
+/* ADCIIN Register */
#define BQ25703_REG_ADC_IIN 0x2B
+#define BQ25703_ADC_IIN_STEP_MA 50
+
#define BQ25703_REG_ADC_VSYS_VBAT 0x2C
#define BQ25703_REG_OTG_VOLTAGE 0x06
#define BQ25703_REG_OTG_CURRENT 0x08
@@ -38,22 +72,4 @@
#define BQ25703_REG_MANUFACTURER_ID 0x2E
#define BQ25703_REG_DEVICE_ADDRESS 0x2F
-/* ChargeOption0 Register */
-#define BQ25703_CHARGE_OPTION_0_LOW_POWER_MODE (1 << 15)
-#define BQ25703_CHARGE_OPTION_0_EN_LEARN (1 << 5)
-#define BQ25703_CHARGE_OPTION_0_CHRG_INHIBIT (1 << 0)
-
-/* ChargeOption3 Register */
-#define BQ25703_CHARGE_OPTION_3_EN_ICO_MODE (1 << 11)
-
-/* ChargeStatus Register */
-#define BQ25703_CHARGE_STATUS_ICO_DONE (1 << 14)
-
-/* ADCOption Register */
-#define BQ25703_ADC_OPTION_ADC_START (1 << 14)
-#define BQ25703_ADC_OPTION_EN_ADC_IIN (1 << 4)
-
-/* ADCIIN Register */
-#define BQ25703_ADC_IIN_STEP_MA 50
-
#endif /* __CROS_EC_BQ25703_H */