Loading drivers/power/qpnp-charger.c +24 −14 Original line number Diff line number Diff line Loading @@ -652,24 +652,23 @@ qpnp_chg_is_batfet_closed(struct qpnp_chg_chip *chip) return (batfet_closed_rt_sts & BAT_FET_ON_IRQ) ? 1 : 0; } #define USB_VALID_BIT BIT(7) static int qpnp_chg_is_usb_chg_plugged_in(struct qpnp_chg_chip *chip) { u8 usbin_valid_rt_sts; u8 usb_chgpth_rt_sts; int rc; rc = qpnp_chg_read(chip, &usbin_valid_rt_sts, chip->usb_chgpth_base + CHGR_STATUS , 1); rc = qpnp_chg_read(chip, &usb_chgpth_rt_sts, INT_RT_STS(chip->usb_chgpth_base), 1); if (rc) { pr_err("spmi read failed: addr=%03X, rc=%d\n", chip->usb_chgpth_base + CHGR_STATUS, rc); INT_RT_STS(chip->usb_chgpth_base), rc); return rc; } pr_debug("chgr usb sts 0x%x\n", usbin_valid_rt_sts); pr_debug("chgr usb sts 0x%x\n", usb_chgpth_rt_sts); return (usbin_valid_rt_sts & USB_VALID_BIT) ? 1 : 0; return (usb_chgpth_rt_sts & USBIN_VALID_IRQ) ? 1 : 0; } static bool Loading @@ -689,8 +688,8 @@ qpnp_chg_is_ibat_loop_active(struct qpnp_chg_chip *chip) } #define USB_VALID_MASK 0xC0 #define USB_VALID_IN_MASK BIT(7) #define USB_COARSE_DET 0x10 #define USB_VALID_UVP_VALUE 0x00 #define USB_VALID_OVP_VALUE 0x40 static int qpnp_chg_check_usb_coarse_det(struct qpnp_chg_chip *chip) Loading @@ -710,7 +709,8 @@ qpnp_chg_check_usb_coarse_det(struct qpnp_chg_chip *chip) static int qpnp_chg_check_usbin_health(struct qpnp_chg_chip *chip) { u8 usbin_chg_rt_sts, usbin_health = 0; u8 usbin_chg_rt_sts, usb_chgpth_rt_sts; u8 usbin_health = 0; int rc; rc = qpnp_chg_read(chip, &usbin_chg_rt_sts, Loading @@ -722,13 +722,23 @@ qpnp_chg_check_usbin_health(struct qpnp_chg_chip *chip) return rc; } pr_debug("chgr usb sts 0x%x\n", usbin_chg_rt_sts); rc = qpnp_chg_read(chip, &usb_chgpth_rt_sts, INT_RT_STS(chip->usb_chgpth_base) , 1); if (rc) { pr_err("spmi read failed: addr=%03X, rc=%d\n", INT_RT_STS(chip->usb_chgpth_base), rc); return rc; } pr_debug("chgr usb sts 0x%x, chgpth rt sts 0x%x\n", usbin_chg_rt_sts, usb_chgpth_rt_sts); if ((usbin_chg_rt_sts & USB_COARSE_DET) == USB_COARSE_DET) { if ((usbin_chg_rt_sts & USB_VALID_MASK) == USB_VALID_OVP_VALUE) { usbin_health = USBIN_OVP; pr_err("Over voltage charger inserted\n"); } else if ((usbin_chg_rt_sts & USB_VALID_BIT) != 0) { } else if ((usb_chgpth_rt_sts & USBIN_VALID_IRQ) != 0) { usbin_health = USBIN_OK; pr_debug("Valid charger inserted\n"); } Loading Loading
drivers/power/qpnp-charger.c +24 −14 Original line number Diff line number Diff line Loading @@ -652,24 +652,23 @@ qpnp_chg_is_batfet_closed(struct qpnp_chg_chip *chip) return (batfet_closed_rt_sts & BAT_FET_ON_IRQ) ? 1 : 0; } #define USB_VALID_BIT BIT(7) static int qpnp_chg_is_usb_chg_plugged_in(struct qpnp_chg_chip *chip) { u8 usbin_valid_rt_sts; u8 usb_chgpth_rt_sts; int rc; rc = qpnp_chg_read(chip, &usbin_valid_rt_sts, chip->usb_chgpth_base + CHGR_STATUS , 1); rc = qpnp_chg_read(chip, &usb_chgpth_rt_sts, INT_RT_STS(chip->usb_chgpth_base), 1); if (rc) { pr_err("spmi read failed: addr=%03X, rc=%d\n", chip->usb_chgpth_base + CHGR_STATUS, rc); INT_RT_STS(chip->usb_chgpth_base), rc); return rc; } pr_debug("chgr usb sts 0x%x\n", usbin_valid_rt_sts); pr_debug("chgr usb sts 0x%x\n", usb_chgpth_rt_sts); return (usbin_valid_rt_sts & USB_VALID_BIT) ? 1 : 0; return (usb_chgpth_rt_sts & USBIN_VALID_IRQ) ? 1 : 0; } static bool Loading @@ -689,8 +688,8 @@ qpnp_chg_is_ibat_loop_active(struct qpnp_chg_chip *chip) } #define USB_VALID_MASK 0xC0 #define USB_VALID_IN_MASK BIT(7) #define USB_COARSE_DET 0x10 #define USB_VALID_UVP_VALUE 0x00 #define USB_VALID_OVP_VALUE 0x40 static int qpnp_chg_check_usb_coarse_det(struct qpnp_chg_chip *chip) Loading @@ -710,7 +709,8 @@ qpnp_chg_check_usb_coarse_det(struct qpnp_chg_chip *chip) static int qpnp_chg_check_usbin_health(struct qpnp_chg_chip *chip) { u8 usbin_chg_rt_sts, usbin_health = 0; u8 usbin_chg_rt_sts, usb_chgpth_rt_sts; u8 usbin_health = 0; int rc; rc = qpnp_chg_read(chip, &usbin_chg_rt_sts, Loading @@ -722,13 +722,23 @@ qpnp_chg_check_usbin_health(struct qpnp_chg_chip *chip) return rc; } pr_debug("chgr usb sts 0x%x\n", usbin_chg_rt_sts); rc = qpnp_chg_read(chip, &usb_chgpth_rt_sts, INT_RT_STS(chip->usb_chgpth_base) , 1); if (rc) { pr_err("spmi read failed: addr=%03X, rc=%d\n", INT_RT_STS(chip->usb_chgpth_base), rc); return rc; } pr_debug("chgr usb sts 0x%x, chgpth rt sts 0x%x\n", usbin_chg_rt_sts, usb_chgpth_rt_sts); if ((usbin_chg_rt_sts & USB_COARSE_DET) == USB_COARSE_DET) { if ((usbin_chg_rt_sts & USB_VALID_MASK) == USB_VALID_OVP_VALUE) { usbin_health = USBIN_OVP; pr_err("Over voltage charger inserted\n"); } else if ((usbin_chg_rt_sts & USB_VALID_BIT) != 0) { } else if ((usb_chgpth_rt_sts & USBIN_VALID_IRQ) != 0) { usbin_health = USBIN_OK; pr_debug("Valid charger inserted\n"); } Loading