Re: [PATCH] iio: fetch and enable regulators unconditionally

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/02/2016 03:48 PM, Crt Mori wrote:
> On 2 September 2016 at 15:40, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:
>> Hi,
>>
>> Thanks for the patch.
>>
>> On 09/02/2016 03:27 PM, Crt Mori wrote:
>>> This patch is inspired by a comment of Jonathan Cameron on patch of
>>> Linus Walleij commit aeb55fff3891834e07a3144159a7298a19696af8 ("iio: st_sensors: fetch and enable regulators unconditionally").
>>>
>>> The explanation for this change is same as in that patch:
>>> "Supplies are *not* optional (optional means that the supply is
>>> optional in the electrical sense, not the software sense) so we need to
>>> get the and enable them at all times.
>>
>> Some supplies are optional. I.e. the part is able to operate (potentially
>> with limited functionality) even if the optional external supply has not
>> been connected to the pin.
>>
>> E.g. many converters have a built-in voltage reference but are able to
>> optionally accept an external reference. The driver needs to know if the
>> external reference is not connected or not to be able to allow or disallow
>> applications to switch the part into external reference mode. This is the
>> case for the ad7266 and ad5761 drivers and using regulator_get_optional() is
>> correct here.
>>
>> Same seems to be true for the ads8688 and the fsl-imx-gcq, judging by how
>> their code is structured.
>>
>> - Lars
> OK, so the voltage reference part can have optional regulator, but if
> it is supply voltage then it cannot.
> 
> What about the IS_ERR_OR_NULL() check? Is that suitable for the
> optional regulators as well?

I think regulator_get_optional() should never return NULL, so replacing them
with just IS_ERR() should be OK. But please check that the driver itself
does not set the regulator explicitly to NULL.

- Lars

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux