Loading drivers/power/qpnp-smbcharger.c +21 −13 Original line number Diff line number Diff line Loading @@ -869,17 +869,38 @@ static inline enum power_supply_type get_usb_supply_type(int type) return usb_type_enum[type]; } static bool is_src_detect_high(struct smbchg_chip *chip) { int rc; u8 reg; rc = smbchg_read(chip, ®, chip->usb_chgpth_base + RT_STS, 1); if (rc < 0) { dev_err(chip->dev, "Couldn't read usb rt status rc = %d\n", rc); return false; } return reg &= USBIN_SRC_DET_BIT; } static void read_usb_type(struct smbchg_chip *chip, char **usb_type_name, enum power_supply_type *usb_supply_type) { int rc, type; u8 reg; if (!is_src_detect_high(chip)) { pr_smb(PR_MISC, "src det low\n"); *usb_type_name = "Absent"; *usb_supply_type = POWER_SUPPLY_TYPE_UNKNOWN; return; } rc = smbchg_read(chip, ®, chip->misc_base + IDEV_STS, 1); if (rc < 0) { dev_err(chip->dev, "Couldn't read status 5 rc = %d\n", rc); *usb_type_name = "Other"; *usb_supply_type = POWER_SUPPLY_TYPE_UNKNOWN; return; } type = get_type(reg); *usb_type_name = get_usb_type_name(type); Loading Loading @@ -4598,19 +4619,6 @@ static void handle_usb_removal(struct smbchg_chip *chip) restore_from_hvdcp_detection(chip); } static bool is_src_detect_high(struct smbchg_chip *chip) { int rc; u8 reg; rc = smbchg_read(chip, ®, chip->usb_chgpth_base + RT_STS, 1); if (rc < 0) { dev_err(chip->dev, "Couldn't read usb rt status rc = %d\n", rc); return false; } return reg &= USBIN_SRC_DET_BIT; } static bool is_usbin_uv_high(struct smbchg_chip *chip) { int rc; Loading Loading
drivers/power/qpnp-smbcharger.c +21 −13 Original line number Diff line number Diff line Loading @@ -869,17 +869,38 @@ static inline enum power_supply_type get_usb_supply_type(int type) return usb_type_enum[type]; } static bool is_src_detect_high(struct smbchg_chip *chip) { int rc; u8 reg; rc = smbchg_read(chip, ®, chip->usb_chgpth_base + RT_STS, 1); if (rc < 0) { dev_err(chip->dev, "Couldn't read usb rt status rc = %d\n", rc); return false; } return reg &= USBIN_SRC_DET_BIT; } static void read_usb_type(struct smbchg_chip *chip, char **usb_type_name, enum power_supply_type *usb_supply_type) { int rc, type; u8 reg; if (!is_src_detect_high(chip)) { pr_smb(PR_MISC, "src det low\n"); *usb_type_name = "Absent"; *usb_supply_type = POWER_SUPPLY_TYPE_UNKNOWN; return; } rc = smbchg_read(chip, ®, chip->misc_base + IDEV_STS, 1); if (rc < 0) { dev_err(chip->dev, "Couldn't read status 5 rc = %d\n", rc); *usb_type_name = "Other"; *usb_supply_type = POWER_SUPPLY_TYPE_UNKNOWN; return; } type = get_type(reg); *usb_type_name = get_usb_type_name(type); Loading Loading @@ -4598,19 +4619,6 @@ static void handle_usb_removal(struct smbchg_chip *chip) restore_from_hvdcp_detection(chip); } static bool is_src_detect_high(struct smbchg_chip *chip) { int rc; u8 reg; rc = smbchg_read(chip, ®, chip->usb_chgpth_base + RT_STS, 1); if (rc < 0) { dev_err(chip->dev, "Couldn't read usb rt status rc = %d\n", rc); return false; } return reg &= USBIN_SRC_DET_BIT; } static bool is_usbin_uv_high(struct smbchg_chip *chip) { int rc; Loading