Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 716a4631 authored by Kavya Nunna's avatar Kavya Nunna
Browse files

power: qpnp-smbcharger: Add support for float charger detection



PMI8996 charger does not detect FLOAT adapter. To support it,
FLOAT detection is done by the USB driver and notified to PMIC
by reporting  -ETIMEDOUT through the CURRENT_MAX power-supply
property. Charger then configures the charge current to 1500mA.

Change-Id: I6abd4668b41988d98465f00402aa2be558054cdd
Signed-off-by: default avatarKavya Nunna <knunna@codeaurora.org>
parent 22dc337a
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -5747,6 +5747,16 @@ static void update_typec_otg_status(struct smbchg_chip *chip, int mode,
static int smbchg_set_sdp_current(struct smbchg_chip *chip, int current_ma)
{
	if (chip->usb_supply_type == POWER_SUPPLY_TYPE_USB) {
		if (current_ma == -ETIMEDOUT) {
			/* float charger */
			current_ma = CURRENT_1500_MA;
			pr_smb(PR_MISC,
				"Update usb_type to FLOAT current=%dmA\n",
								current_ma);
			chip->usb_psy_d.type = POWER_SUPPLY_TYPE_USB_FLOAT;
		} else {
			current_ma = current_ma / 1000;
		}
		/* Override if type-c charger used */
		if (chip->typec_current_ma > 500 &&
				current_ma < chip->typec_current_ma) {
@@ -5807,7 +5817,7 @@ static int smbchg_usb_set_property(struct power_supply *psy,
		break;
	case POWER_SUPPLY_PROP_CURRENT_MAX:
	case POWER_SUPPLY_PROP_SDP_CURRENT_MAX:
		smbchg_set_sdp_current(chip, val->intval / 1000);
		smbchg_set_sdp_current(chip, val->intval);
	default:
		return -EINVAL;
	}