power: pm8921-charger: implement CURRENT_NOW property

The pm8921 bms driver can provide instantaneous current. Use the
current now property of the power_supply class to expose this
feature.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
diff --git a/drivers/power/pm8921-charger.c b/drivers/power/pm8921-charger.c
index 0e46b0b..d2cba64 100644
--- a/drivers/power/pm8921-charger.c
+++ b/drivers/power/pm8921-charger.c
@@ -517,6 +517,7 @@
 	POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
 };
 
 static int get_prop_battery_mvolts(struct pm8921_chg_chip *chip)
@@ -545,6 +546,19 @@
 	return percent_soc;
 }
 
+static int get_prop_batt_current(struct pm8921_chg_chip *chip)
+{
+	int result_ma, rc;
+
+	rc = pm8921_bms_get_battery_current(&result_ma);
+	if (rc) {
+		pr_err("unable to get batt current rc = %d\n", rc);
+		return rc;
+	} else {
+		return result_ma;
+	}
+}
+
 static int get_prop_batt_health(struct pm8921_chg_chip *chip)
 {
 	int temp;
@@ -638,6 +652,9 @@
 	case POWER_SUPPLY_PROP_CAPACITY:
 		val->intval = get_prop_batt_capacity(chip);
 		break;
+	case POWER_SUPPLY_PROP_CURRENT_NOW:
+		val->intval = get_prop_batt_current(chip);
+		break;
 	default:
 		return -EINVAL;
 	}