power: pm8921-charger: add enable/disable api

Add api to enable/disable battery charging. This api will help
start/stop current flowing in the battery for charging purposes, but
it does not affect the current the device draws from a charger source.

CRs-Fixed: 300786
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
diff --git a/drivers/power/pm8921-charger.c b/drivers/power/pm8921-charger.c
index e250d54..dbd8ba6 100644
--- a/drivers/power/pm8921-charger.c
+++ b/drivers/power/pm8921-charger.c
@@ -766,6 +766,22 @@
 }
 EXPORT_SYMBOL_GPL(pm8921_charger_vbus_draw);
 
+int pm8921_charger_enable(bool enable)
+{
+	int rc;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	enable = !!enable;
+	rc = pm_chg_auto_enable(the_chip, enable);
+	if (rc)
+		pr_err("Failed rc=%d\n", rc);
+	return rc;
+}
+EXPORT_SYMBOL(pm8921_charger_enable);
+
 static void handle_usb_insertion_removal(struct pm8921_chg_chip *chip)
 {
 	int usb_present;
@@ -1040,6 +1056,13 @@
 	return IRQ_HANDLED;
 }
 
+/**
+ * set_disable_status_param -
+ *
+ * Internal function to disable battery charging and also disable drawing
+ * any current from the source. The device is forced to run on a battery
+ * after this.
+ */
 static int set_disable_status_param(const char *val, struct kernel_param *kp)
 {
 	int ret;