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

switch: arizona: Take external resistance into account for short circuit



When checking the minimum value of impedance we can detect we should
take any external resistance into account, as we can detect lower
impedances if there is some external resistance pushing the detected
impedance up.

Change-Id: Ic784807c811ab453a7ca8ef2fb115d1bcd884e87
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
parent 31ef718a
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -3220,6 +3220,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
	struct arizona_extcon_info *info;
	unsigned int reg;
	int jack_irq_fall, jack_irq_rise;
	int hpdet_short;
	int ret, mode, i;
	int debounce_reg, debounce_val, analog_val;

@@ -3238,10 +3239,17 @@ static int arizona_extcon_probe(struct platform_device *pdev)
		}
	}

	if (pdata->hpdet_short_circuit_imp < 1)
	hpdet_short = pdata->hpdet_short_circuit_imp + pdata->hpdet_ext_res;

	if (hpdet_short < ARIZONA_HP_SHORT_IMPEDANCE) {
		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;
	else if	(pdata->hpdet_short_circuit_imp >= HP_LOW_IMPEDANCE_LIMIT)
	} else if (pdata->hpdet_short_circuit_imp >= HP_LOW_IMPEDANCE_LIMIT) {
		pdata->hpdet_short_circuit_imp = HP_LOW_IMPEDANCE_LIMIT - 1;
	}

	/* Set of_node to parent from the SPI device to allow
	 * location regulator supplies */