#define IRQ_CHECK_PERIOD (3 * HZ)
#define IRQ_CHECK_THRESHOLD 4
+/* By default, 80mA */
+static unsigned end_of_charge_current = 80000;
+module_param(end_of_charge_current, uint, 0);
+MODULE_PARM_DESC(end_of_charge_current,
+ "Stop charging when the charger current goes below this threshold");
+
static bool allow_usb = 1;
module_param(allow_usb, bool, 0644);
MODULE_PARM_DESC(allow_usb, "Allow USB charge drawing default current");
bci->ac_current = 1200000; /* ~1.2A */
bci->usb_current = 560000; /* ~560mA */
- if ((ret = twl4030bci_get_charging_current(bci, &bci->charge_current)))
- goto fail_read_charge_params;
- if ((ret = twl4030bci_get_eoc_current(bci, &bci->eoc_current)))
- goto fail_read_charge_params;
+ /*
+ * Make sure to set sane charging settings
+ *
+ * charge_current:
+ * ~500mA (doesn't really get used, overridden by ac_current or
+ * usb_current as soon as a charger is plugged in).
+ *
+ * end_of_charge_current:
+ * defaults to ~400mA (can be set with the eoc_current option)
+ * This is as high as it can be set in the TWL4030. Seems to be a
+ * fairly sane value. Certainly more sane then the default 80mA.
+ */
+ if ((ret = update_charge_parameters(bci,
+ 500000, end_of_charge_current)))
+ goto fail_set_charge_params;
bci->irq_had_charger = -1;
bci->irq_check_count_time = jiffies;
led_trigger_unregister_simple(bci->charging_any_trig);
platform_set_drvdata(pdev, NULL);
-fail_read_charge_params:
+fail_set_charge_params:
kfree(bci);
return ret;