@@ -196,6 +196,42 @@ static int pm800_get_current_limit(struct
regulator_dev *rdev)
return info->max_ua;
}
+/*
+ * 88pm860 device supports dual-phase mode on BUCK1, where BUCK1A and
BUCK1B can
+ * be used together to supply 6A current. Note that, independently,
they can
+ * source 3A each.
+ *
+ * So, this function checks for max_uA for BUCK1 (only), and if it is
more than
+ * 3A, then enable dual-phase mode.
+ */
+static int pm800_set_current_limit(struct regulator_dev *rdev,
+ int min_uA, int max_uA)
+{
+ struct pm800_regulators *pm800_data =
dev_get_drvdata(rdev_get_dev(rdev)->parent);
+ struct pm80x_chip *chip = pm800_data->chip;
+ int ret;
+
+ /* Currently only supported on 88pm860 device */
+ if (chip->type != CHIP_PM860)
+ return 0;
+
+ if (rdev->desc->id == PM800_ID_BUCK1) {
+ /* If max_uA is greater that 3A, enable dual-phase on
BUCK1 */
+ if (max_uA > 3000000) {
+ ret =
regmap_update_bits(chip->subchip->regmap_power,
+ PM860_BUCK1_MISC,
+ BUCK1_DUAL_PHASE_SEL,
+ BUCK1_DUAL_PHASE_SEL);
+ if (ret) {
+ dev_err(chip->dev, "failed to access
registers\n");
+ return ret;
+ }
+ }