power: qpnp-charger: Change ITERM setting for PM8941 V3
As for PM8941 V3 chip, ITERM setting changed to 80mA base and 40mA step, update the driver to follow it. Change-Id: I27b3c20c953fc0c686298a6bd8925517f6088129 Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
This commit is contained in:
parent
fc61163db5
commit
c31c6d3e1f
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -215,6 +215,7 @@
|
|||
qcom,chg-vadc = <&pm8941_vadc>;
|
||||
qcom,chg-iadc = <&pm8941_iadc>;
|
||||
qcom,chg-adc_tm = <&pm8941_adc_tm>;
|
||||
qcom,pmic-revid = <&pm8941_revid>;
|
||||
qcom,ibat-calibration-enabled;
|
||||
|
||||
pm8941_chg_chgr: qcom,chgr@1000 {
|
||||
|
|
|
@ -230,6 +230,7 @@
|
|||
#define CHG_FLAGS_VCP_WA BIT(0)
|
||||
#define BOOST_FLASH_WA BIT(1)
|
||||
#define POWER_STAGE_WA BIT(2)
|
||||
#define CHG_TERM_CHANGE BIT(3)
|
||||
|
||||
struct qpnp_chg_irq {
|
||||
int irq;
|
||||
|
@ -2969,20 +2970,32 @@ qpnp_chg_ibatsafe_set(struct qpnp_chg_chip *chip, int safe_current)
|
|||
#define QPNP_CHG_ITERM_MIN_MA 100
|
||||
#define QPNP_CHG_ITERM_MAX_MA 250
|
||||
#define QPNP_CHG_ITERM_STEP_MA 50
|
||||
#define QPNP_CHG_ITERM_MIN_MA_V3 80
|
||||
#define QPNP_CHG_ITERM_MAX_MA_V3 200
|
||||
#define QPNP_CHG_ITERM_STEP_MA_V3 40
|
||||
#define QPNP_CHG_ITERM_MASK 0x03
|
||||
static int
|
||||
qpnp_chg_ibatterm_set(struct qpnp_chg_chip *chip, int term_current)
|
||||
{
|
||||
u8 temp;
|
||||
int iterm_min_ma = QPNP_CHG_ITERM_MIN_MA;
|
||||
int iterm_max_ma = QPNP_CHG_ITERM_MAX_MA;
|
||||
int iterm_step_ma = QPNP_CHG_ITERM_STEP_MA;
|
||||
|
||||
if (term_current < QPNP_CHG_ITERM_MIN_MA
|
||||
|| term_current > QPNP_CHG_ITERM_MAX_MA) {
|
||||
if (chip->flags & CHG_TERM_CHANGE) {
|
||||
iterm_min_ma = QPNP_CHG_ITERM_MIN_MA_V3;
|
||||
iterm_max_ma = QPNP_CHG_ITERM_MAX_MA_V3;
|
||||
iterm_step_ma = QPNP_CHG_ITERM_STEP_MA_V3;
|
||||
}
|
||||
|
||||
if (term_current < iterm_min_ma
|
||||
|| term_current > iterm_max_ma) {
|
||||
pr_err("bad mA=%d asked to set\n", term_current);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
temp = (term_current - QPNP_CHG_ITERM_MIN_MA)
|
||||
/ QPNP_CHG_ITERM_STEP_MA;
|
||||
temp = (term_current - iterm_min_ma)
|
||||
/ iterm_step_ma;
|
||||
return qpnp_chg_masked_write(chip,
|
||||
chip->chgr_base + CHGR_IBAT_TERM_CHGR,
|
||||
QPNP_CHG_ITERM_MASK, temp, 1);
|
||||
|
@ -4489,29 +4502,32 @@ qpnp_batt_power_set_property(struct power_supply *psy,
|
|||
static int
|
||||
qpnp_chg_setup_flags(struct qpnp_chg_chip *chip)
|
||||
{
|
||||
struct device_node *revid_dev_node;
|
||||
struct pmic_revid_data *revid_data;
|
||||
|
||||
revid_dev_node = of_parse_phandle(chip->spmi->dev.of_node,
|
||||
"qcom,pmic-revid", 0);
|
||||
if (!revid_dev_node) {
|
||||
pr_err("Missing qcom,pmic-revid property\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
revid_data = get_revid_data(revid_dev_node);
|
||||
if (IS_ERR(revid_data)) {
|
||||
pr_err("Couldnt get revid data rc = %ld\n",
|
||||
PTR_ERR(revid_data));
|
||||
return PTR_ERR(revid_data);
|
||||
}
|
||||
if (chip->revision > 0 && chip->type == SMBB)
|
||||
chip->flags |= CHG_FLAGS_VCP_WA;
|
||||
if (chip->type == SMBB)
|
||||
if (chip->type == SMBB) {
|
||||
chip->flags |= BOOST_FLASH_WA;
|
||||
if (revid_data->rev4 == PM8941_V3P0_REV4) {
|
||||
chip->flags |= CHG_TERM_CHANGE;
|
||||
}
|
||||
}
|
||||
if (chip->type == SMBBP) {
|
||||
struct device_node *revid_dev_node;
|
||||
struct pmic_revid_data *revid_data;
|
||||
|
||||
chip->flags |= BOOST_FLASH_WA;
|
||||
|
||||
revid_dev_node = of_parse_phandle(chip->spmi->dev.of_node,
|
||||
"qcom,pmic-revid", 0);
|
||||
if (!revid_dev_node) {
|
||||
pr_err("Missing qcom,pmic-revid property\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
revid_data = get_revid_data(revid_dev_node);
|
||||
if (IS_ERR(revid_data)) {
|
||||
pr_err("Couldnt get revid data rc = %ld\n",
|
||||
PTR_ERR(revid_data));
|
||||
return PTR_ERR(revid_data);
|
||||
}
|
||||
|
||||
if (revid_data->rev4 < PM8226_V2P1_REV4
|
||||
|| ((revid_data->rev4 == PM8226_V2P1_REV4)
|
||||
&& (revid_data->rev3 <= PM8226_V2P1_REV3))) {
|
||||
|
|
Loading…
Reference in New Issue