diff options
-rw-r--r-- | drivers/power/ab8500_charger.c | 22 | ||||
-rw-r--r-- | include/linux/mfd/abx500/ab8500.h | 19 |
2 files changed, 35 insertions, 6 deletions
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index a632b94e38b9..871bf5a7c42a 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c | |||
@@ -2671,13 +2671,23 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) | |||
2671 | } | 2671 | } |
2672 | } | 2672 | } |
2673 | 2673 | ||
2674 | /* VBUS OVV set to 6.3V and enable automatic current limitiation */ | 2674 | if (is_ab9540_2p0(di->parent) || is_ab8505_2p0(di->parent)) |
2675 | ret = abx500_set_register_interruptible(di->dev, | 2675 | ret = abx500_mask_and_set_register_interruptible(di->dev, |
2676 | AB8500_CHARGER, | 2676 | AB8500_CHARGER, |
2677 | AB8500_USBCH_CTRL2_REG, | 2677 | AB8500_USBCH_CTRL2_REG, |
2678 | VBUS_OVV_SELECT_6P3V | VBUS_AUTO_IN_CURR_LIM_ENA); | 2678 | VBUS_AUTO_IN_CURR_LIM_ENA, |
2679 | VBUS_AUTO_IN_CURR_LIM_ENA); | ||
2680 | else | ||
2681 | /* | ||
2682 | * VBUS OVV set to 6.3V and enable automatic current limitation | ||
2683 | */ | ||
2684 | ret = abx500_set_register_interruptible(di->dev, | ||
2685 | AB8500_CHARGER, | ||
2686 | AB8500_USBCH_CTRL2_REG, | ||
2687 | VBUS_OVV_SELECT_6P3V | VBUS_AUTO_IN_CURR_LIM_ENA); | ||
2679 | if (ret) { | 2688 | if (ret) { |
2680 | dev_err(di->dev, "failed to set VBUS OVV\n"); | 2689 | dev_err(di->dev, |
2690 | "failed to set automatic current limitation\n"); | ||
2681 | goto out; | 2691 | goto out; |
2682 | } | 2692 | } |
2683 | 2693 | ||
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 9dd9b99099df..b9a6a847ff61 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h | |||
@@ -346,4 +346,23 @@ static inline int is_ab8500_2p0(struct ab8500 *ab) | |||
346 | return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0)); | 346 | return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0)); |
347 | } | 347 | } |
348 | 348 | ||
349 | static inline int is_ab8505_1p0_or_earlier(struct ab8500 *ab) | ||
350 | { | ||
351 | return (is_ab8505(ab) && (ab->chip_id <= AB8500_CUT1P0)); | ||
352 | } | ||
353 | |||
354 | static inline int is_ab8505_2p0(struct ab8500 *ab) | ||
355 | { | ||
356 | return (is_ab8505(ab) && (ab->chip_id == AB8500_CUT2P0)); | ||
357 | } | ||
358 | |||
359 | static inline int is_ab9540_1p0_or_earlier(struct ab8500 *ab) | ||
360 | { | ||
361 | return (is_ab9540(ab) && (ab->chip_id <= AB8500_CUT1P0)); | ||
362 | } | ||
363 | |||
364 | static inline int is_ab9540_2p0(struct ab8500 *ab) | ||
365 | { | ||
366 | return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT2P0)); | ||
367 | } | ||
349 | #endif /* MFD_AB8500_H */ | 368 | #endif /* MFD_AB8500_H */ |