Commit 50844aaf authored by Charles Keepax's avatar Charles Keepax Committed by DidntRead
Browse files

switch: arizona: Correct handling of external resistance for low values



For external resistance values < 4 ohms we might currently set a high
short circuit impedance than we have to. Correct this by taking the
external resistance into account.

Change-Id: Idbb68a39c5ee763284b8763d218af89353f74e6c
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
parent da5ecd5f
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -3242,11 +3242,14 @@ static int arizona_extcon_probe(struct platform_device *pdev)
	hpdet_short = pdata->hpdet_short_circuit_imp + pdata->hpdet_ext_res;

	if (hpdet_short < ARIZONA_HP_SHORT_IMPEDANCE) {
		hpdet_short = ARIZONA_HP_SHORT_IMPEDANCE - pdata->hpdet_ext_res;

		dev_warn(arizona->dev,
			 "Increasing HP short circuit impedance from %d to %d\n",
			 pdata->hpdet_short_circuit_imp,
			 ARIZONA_HP_SHORT_IMPEDANCE);
		pdata->hpdet_short_circuit_imp = ARIZONA_HP_SHORT_IMPEDANCE;
			 hpdet_short);

		pdata->hpdet_short_circuit_imp = hpdet_short;
	} else if (pdata->hpdet_short_circuit_imp >= HP_LOW_IMPEDANCE_LIMIT) {
		pdata->hpdet_short_circuit_imp = HP_LOW_IMPEDANCE_LIMIT - 1;
	}