Re: [PATCH v3 5/5] hwmon: Add support for Amphenol ChipCap 2

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

 



On Thu, Dec 07, 2023 at 09:34:58PM +0100, Javier Carrasco wrote:
> On 07.12.23 21:05, Mark Brown wrote:

> > This is very buggy.  A consumer should only disable a regulator if it
> > itself enabled that regulator (or it *requires* an exclusive regulator
> > which isn't a good fit here), and there's no guarantee that disabling a
> > regulator will actually result in a power off.  Either the board might
> > not physically or through constraints permit the state to change or
> > another user may have enabled the regulator.  The driver needs to keep
> > track of if it enabled the regulator and only disable it as many times
> > as it enabled it.

> The idea is actually that if alarms are required, an exclusive regulator
> will be necessary to trigger power cycles and enter the command mode.

There is a specific API for exclusive regulators which the driver is not
using, and it's unconditionally doing the disable/enable cycle here.

> In summary there would be two options: either a regulator is defined and
> can be controlled to trigger the command mode or no regulator was
> defined for this device and therefore no command mode is available i.e.
> interrupts cannot be configured. That would be the case for example when
> the supply is always on.

The driver needs to be explicitly configured for this and have separate
code paths for normal operation and operation where the supply can be
bounced like this.  In neither code path should the supply be optional.
Right now we don't have a mechanism for discovering optionally exclusive
and enable/disablable supplies which is what the device needs, we could
potentially add that since this does seem like a viable use case and we
already have enough information in the DT to say if the supply matches
the constraints.  Probably the two properties queryable separately.  If
that API were added then the driver would do a normal regulator_get()
then check if it has the capabilities it needs and either keep the
supply on all the time (or possibly just during measurements?) or enable
the alarm functionality.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux