anatop_regulator probe returns -EINVAL if regulator is set to bypass mode

Mika Båtsman mika.batsman at gmail.com
Thu Jun 16 03:13:03 PDT 2016


Hi Markus,

good to know. I'll prepare a patch.

Thanks,
Mika

On Tue, Jun 14, 2016 at 10:37 AM, Markus Pargmann <mpa at pengutronix.de> wrote:
> Hi Mika,
>
> On 2016 M06 6, Mon 17:24:49 CEST Mika Båtsman wrote:
>> Hi Philipp, hi Markus,
>>
>> there's a problem with anatop regulator driver that relates to
>> functionality you have worked on. The related commits:
>> da0607c8 regulator: anatop: Fail on invalid voltage selector
>> d38018f2 regulator: anatop: Add bypass support to digital LDOs
>>
>>
>> So in case bootloader set the regulator to bypass mode sreg->sel gets set
>> to 0
>>         sreg->sel = (val & rdesc->vsel_mask) >> sreg->vol_bit_shift;
>>         if (sreg->sel == LDO_FET_FULL_ON) {
>>             sreg->sel = 0;
>>             sreg->bypass = true;
>>         }
>>
>> and a little bit later it's causing EINVAL to be returned.
>>         if (!sreg->sel) {
>>             dev_err(&pdev->dev, "Failed to read a valid default voltage
>> selector.\n");
>>             return -EINVAL;
>>         }
>>
>> Resulting in:
>> anatop_regulator 20c8000.anatop:regulator-vddcore at 140: Failed to read a
>> valid default voltage selector.
>> anatop_regulator: probe of 20c8000.anatop:regulator-vddcore at 140 failed with
>> error -22
>> anatop_regulator 20c8000.anatop:regulator-vddsoc at 140: Failed to read a
>> valid default voltage selector.
>> anatop_regulator: probe of 20c8000.anatop:regulator-vddsoc at 140 failed with
>> error -22
>>
>> Is that really the expected behaviour or should sreg->bypass be taken into
>> account before returning EINVAL? Like this:
>>
>>         if (!sreg->bypass && !sreg->sel) {
>
> Thanks for spotting this. This condition seems better. A EINVAL error was not
> intended for the bypass mode.
>
> Best Regards,
>
> Markus
>
>>             dev_err(&pdev->dev, "Failed to read a valid default voltage
>> selector.\n");
>>             return -EINVAL;
>>         }
>>
>>
>> Regards,
>> Mika
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>



More information about the linux-arm-kernel mailing list