msm8916-mainline/linux

j5x regulator-l17 voltage set too high

rbrijder opened this issue · 2 comments

In this repo, j5 and j5x share a file where the regulator voltages are set. However, according to downstream, for regulator-l17, j5x requires voltage <2850000>, while j5 requires voltage <3000000>. Indeed, in downstream msm8916-regulator.dtsi sets the voltage to <2850000>, which is overwritten in msm8916-sec-j5nlte-eur-r05.dtsi for j5 but not in the corresponding file for j5x. Too high voltage could damage the device (in this case, it seems the proximity sensor of the device).

The l17 regulator has a voltage range assigned on j5x, as you can see in msm8916-regulator.dtsi (note that this file exists twice, once in the qcom folder and once in the samsung/msm8916 folder):

		regulator-min-microvolt = <2850000>;
		regulator-max-microvolt = <3100000>;

Indeed by default the lowest voltage <2850000> will be used. However, now you need to look at all drivers making use of the regulator, because they might request a higher voltage.

The driver for the proximity sensor happens to contain a line that requests the 3.0V:

	if(!regulator_get_voltage(data->vdd))
		regulator_set_voltage(data->vdd, 3000000, 3300000);

(although I'm not sure if the !regulator_get_voltage(data->vdd) condition is actually triggered).

I think many sensors have a fairly flexible supply voltage, e.g. the similar CM36651 can work with anything between 2.5 V to 3.6 V. So all in all I think this works just fine the way it is. What do you think?

I suppose you could check the exact voltage used at runtime on downstream to be sure but I think there is no strict need to exactly follow downstream in this case.

note that this file exists twice, once in the qcom folder and once in the samsung/msm8916 folder):

		regulator-min-microvolt = <2850000>;
		regulator-max-microvolt = <3100000>;

Ah, I was looking at the file in the qcom folder msm8916-regulator.dtsi, which has

		regulator-min-microvolt = <2850000>;
		regulator-max-microvolt = <2850000>;

but the you mention (in the samsung/msm8916 folder) seems the one that is actually included.

So all in all I think this works just fine the way it is. What do you think?

I am not knowledgeable at all, but given the leeway in voltages you mention and the code for the proximity sensor, I am quite reassured the current value is OK. Thanks!