qpnp-qnovo: Remove dependency on adapter current limit

Currently enabling of Qnovo isn't allowed unless a charger with
minimum 1A current limit is detected. This is not required.

Allow enabling of Qnovo regardless of the charger current limit.

Change-Id: I1726423d3bc31725c162f09b907683d6e63ac6b5
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
Abhijeet Dharmapurikar 2017-01-04 19:18:32 -08:00
parent 55e8426a19
commit 2d7e48a4b3

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2016 The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 and
@ -99,8 +99,6 @@
#define VADC_LSB_NA 1220700 #define VADC_LSB_NA 1220700
#define GAIN_LSB_FACTOR 976560 #define GAIN_LSB_FACTOR 976560
#define MIN_EN_UA 1000000
#define USER_VOTER "user_voter" #define USER_VOTER "user_voter"
#define OK_TO_QNOVO_VOTER "ok_to_qnovo_voter" #define OK_TO_QNOVO_VOTER "ok_to_qnovo_voter"
@ -119,9 +117,7 @@ enum {
struct chg_props { struct chg_props {
bool charging; bool charging;
bool usb_online; bool usb_online;
int usb_input_uA;
bool dc_online; bool dc_online;
int dc_input_uA;
}; };
struct chg_status { struct chg_status {
@ -1092,7 +1088,6 @@ static void get_chg_props(struct qnovo *chip, struct chg_props *cp)
} }
cp->usb_online = false; cp->usb_online = false;
cp->usb_input_uA = 0;
if (!chip->usb_psy) if (!chip->usb_psy)
chip->usb_psy = power_supply_get_by_name("usb"); chip->usb_psy = power_supply_get_by_name("usb");
if (chip->usb_psy) { if (chip->usb_psy) {
@ -1102,17 +1097,9 @@ static void get_chg_props(struct qnovo *chip, struct chg_props *cp)
pr_err("Couldn't read usb online rc = %d\n", rc); pr_err("Couldn't read usb online rc = %d\n", rc);
else else
cp->usb_online = (bool)pval.intval; cp->usb_online = (bool)pval.intval;
rc = power_supply_get_property(chip->usb_psy,
POWER_SUPPLY_PROP_CURRENT_MAX, &pval);
if (rc < 0)
pr_err("Couldn't read usb current max rc = %d\n", rc);
else
cp->usb_input_uA = pval.intval;
} }
cp->dc_online = false; cp->dc_online = false;
cp->dc_input_uA = 0;
if (!chip->dc_psy) if (!chip->dc_psy)
chip->dc_psy = power_supply_get_by_name("dc"); chip->dc_psy = power_supply_get_by_name("dc");
if (chip->dc_psy) { if (chip->dc_psy) {
@ -1122,13 +1109,6 @@ static void get_chg_props(struct qnovo *chip, struct chg_props *cp)
pr_err("Couldn't read dc online rc = %d\n", rc); pr_err("Couldn't read dc online rc = %d\n", rc);
else else
cp->dc_online = (bool)pval.intval; cp->dc_online = (bool)pval.intval;
rc = power_supply_get_property(chip->dc_psy,
POWER_SUPPLY_PROP_CURRENT_MAX, &pval);
if (rc < 0)
pr_err("Couldn't read dc current max rc = %d\n", rc);
else
cp->dc_input_uA = pval.intval;
} }
} }
@ -1138,8 +1118,7 @@ static void get_chg_status(struct qnovo *chip, const struct chg_props *cp,
cs->ok_to_qnovo = false; cs->ok_to_qnovo = false;
if (cp->charging && if (cp->charging &&
((cp->usb_online && cp->usb_input_uA >= MIN_EN_UA) (cp->usb_online || cp->dc_online))
|| (cp->dc_online && cp->dc_input_uA >= MIN_EN_UA)))
cs->ok_to_qnovo = true; cs->ok_to_qnovo = true;
} }