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

Commit b981e1ad authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: rename ALLOW_DETECTION to DPF_DMF"

parents a3276719 1b7ff05f
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -270,22 +270,6 @@ int power_supply_set_low_power_state(struct power_supply *psy, int value)
}
EXPORT_SYMBOL(power_supply_set_low_power_state);

/**
 * power_supply_set_allow_detection - set allow_detection for power_supply
 * @psy:	the power supply to control
 * @value:	value to be passed to the power_supply
 */
int power_supply_set_allow_detection(struct power_supply *psy, int value)
{
	const union power_supply_propval ret = {value, };

	if (psy->set_property)
		return psy->set_property(psy, POWER_SUPPLY_PROP_ALLOW_DETECTION,
								&ret);
	return -ENXIO;
}
EXPORT_SYMBOL(power_supply_set_allow_detection);

/**
 * power_supply_set_dp_dm -
 * @psy:	the power supply to control
+0 −1
Original line number Diff line number Diff line
@@ -233,7 +233,6 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(esr_count),
	POWER_SUPPLY_ATTR(safety_timer_enabled),
	POWER_SUPPLY_ATTR(charge_done),
	POWER_SUPPLY_ATTR(allow_detection),
	POWER_SUPPLY_ATTR(flash_active),
	POWER_SUPPLY_ATTR(force_tlim),
	POWER_SUPPLY_ATTR(dp_dm),
+7 −5
Original line number Diff line number Diff line
@@ -3846,8 +3846,9 @@ static void handle_usb_removal(struct smbchg_chip *chip)
		pr_smb(PR_MISC, "setting usb psy present = %d\n",
				chip->usb_present);
		power_supply_set_present(chip->usb_psy, chip->usb_present);
		pr_smb(PR_MISC, "setting usb psy allow detection 0\n");
		power_supply_set_allow_detection(chip->usb_psy, 0);
		pr_smb(PR_MISC, "setting usb psy dp=r dm=r\n");
		power_supply_set_dp_dm(chip->usb_psy,
				POWER_SUPPLY_DP_DM_DPR_DMR);
		schedule_work(&chip->usb_set_online_work);
		rc = power_supply_set_health_state(chip->usb_psy,
				POWER_SUPPLY_HEALTH_UNKNOWN);
@@ -4641,12 +4642,13 @@ static irqreturn_t usbin_uv_handler(int irq, void *_chip)
		chip->usb_present, reg, aicl_level);

	/*
	 * set usb_psy's allow_detection if this is a new insertion, i.e. it is
	 * set usb_psy's dp=f dm=f if this is a new insertion, i.e. it is
	 * not already src_detected and usbin_uv is seen falling
	 */
	if (!(reg & USBIN_UV_BIT) && !(reg & USBIN_SRC_DET_BIT)) {
		pr_smb(PR_MISC, "setting usb psy allow detection 1\n");
		power_supply_set_allow_detection(chip->usb_psy, 1);
		pr_smb(PR_MISC, "setting usb psy dp=f dm=f\n");
		power_supply_set_dp_dm(chip->usb_psy,
				POWER_SUPPLY_DP_DM_DPF_DMF);
	}

	if ((reg & USBIN_UV_BIT) && (reg & USBIN_SRC_DET_BIT)) {
+9 −7
Original line number Diff line number Diff line
@@ -1849,15 +1849,16 @@ static int smb1351_apsd_complete_handler(struct smb1351_charger *chip,
						type, chip->chg_present);
		if (!chip->battery_missing && !chip->apsd_rerun) {
			if (type == POWER_SUPPLY_TYPE_USB) {
				pr_debug("Setting usb psy allow detection 1 SDP and rerun\n");
				power_supply_set_allow_detection(
							chip->usb_psy, 1);
				pr_debug("Setting usb psy dp=f dm=f SDP and rerun\n");
				power_supply_set_dp_dm(chip->usb_psy,
						POWER_SUPPLY_DP_DM_DPF_DMF);
				chip->apsd_rerun = true;
				rerun_apsd(chip);
				return 0;
			}
			pr_debug("Setting usb psy allow detection 1 DCP and no rerun\n");
			power_supply_set_allow_detection(chip->usb_psy, 1);
			pr_debug("Set usb psy dp=f dm=f DCP and no rerun\n");
			power_supply_set_dp_dm(chip->usb_psy,
					POWER_SUPPLY_DP_DM_DPF_DMF);
		}
		/*
		 * If defined force hvdcp 2p0 property,
@@ -1889,8 +1890,9 @@ static int smb1351_apsd_complete_handler(struct smb1351_charger *chip,
						POWER_SUPPLY_TYPE_UNKNOWN);
		power_supply_set_present(chip->usb_psy,
						chip->chg_present);
		pr_debug("Setting usb psy allow detection 0\n");
		power_supply_set_allow_detection(chip->usb_psy, 0);
		pr_debug("Set usb psy dm=r df=r\n");
		power_supply_set_dp_dm(chip->usb_psy,
				POWER_SUPPLY_DP_DM_DPR_DMR);
	}

	return 0;
+9 −6
Original line number Diff line number Diff line
@@ -2638,8 +2638,9 @@ static int handle_usb_removal(struct smb135x_chg *chip)
				POWER_SUPPLY_TYPE_UNKNOWN);
		pr_debug("setting usb psy present = %d\n", chip->usb_present);
		power_supply_set_present(chip->usb_psy, chip->usb_present);
		pr_debug("setting usb psy allow detection 0\n");
		power_supply_set_allow_detection(chip->usb_psy, 0);
		pr_debug("Setting usb psy dp=r dm=r\n");
		power_supply_set_dp_dm(chip->usb_psy,
				POWER_SUPPLY_DP_DM_DPR_DMR);
	}
	return 0;
}
@@ -2699,15 +2700,17 @@ static int handle_usb_insertion(struct smb135x_chg *chip)

	if (chip->batt_present && !chip->apsd_rerun && chip->usb_psy) {
		if (usb_supply_type == POWER_SUPPLY_TYPE_USB) {
			pr_debug("setting usb psy allow detection 1 SDP and rerun\n");
			power_supply_set_allow_detection(chip->usb_psy, 1);
			pr_debug("Setting usb psy dp=f dm=f SDP and rerun\n");
			power_supply_set_dp_dm(chip->usb_psy,
					POWER_SUPPLY_DP_DM_DPF_DMF);
			chip->apsd_rerun = true;
			rerun_apsd(chip);
			/* rising edge of src detect will happen in few mS */
			return 0;
		} else {
			pr_debug("setting usb psy allow detection 1 DCP and no rerun\n");
			power_supply_set_allow_detection(chip->usb_psy, 1);
			pr_debug("Set usb psy dp=f dm=f DCP and no rerun\n");
			power_supply_set_dp_dm(chip->usb_psy,
					POWER_SUPPLY_DP_DM_DPF_DMF);
		}
	}

Loading