Re: [PATCH] drivers/regulator: Notify sysfs about status changes

From: Naresh Solanki
Date: Thu Nov 09 2023 - 10:12:15 EST


Hi Mark,


On Thu, 9 Nov 2023 at 17:01, Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> On Thu, Nov 09, 2023 at 04:08:06PM +0530, Naresh Solanki wrote:
> > On Thu, 2 Nov 2023 at 22:20, Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> > > Ah, right. Everything except for the enable and disable there looks
> > > like it should be OK since they should normally just not happen but the
> > > enables and disables might get a bit frequent with runtime PM - not
> > > *super* frequent like voltage scaling but enough that people could have
> > > an issue with it.
>
> > I aim for a straightforward implementation.
> > Using attributes such as status or state seems ideal for receiving
> > notifications.
> > In my case, the application focuses on status changes—whether it's on, off,
> > or encountering an error.
> > These changes are driven by events originating from the regulator.
> > So below change is what I see fit well.
> >
> > status_events = REGULATOR_EVENT_DISABLE;
> > status_events |= REGULATOR_EVENT_ENABLE;
> > status_events |= REGULATOR_EVENT_FAIL;
> > status_events |= REGULATOR_EVENT_FORCE_DISABLE;
> > status_events |= REGULATOR_EVENT_ABORT_DISABLE;
>
> In terms of the implementation for delivering uevents this looks fine,
> my concern here is that for some systems the enable and disable events
> might happen more often than is really a good fir for delivering via
> uevents, if a device like say a SD card is getting powered up and down
> via runtime PM that might happen relatively often and then the system
> would get a lot of uevents which it would most likely end up ignoring.
> That could have a noticable impact on power or performance.

May be in that case should we consider adding a kernel parameter or
some property in sysfs attribute to allow getting events ?

Regards,
Naresh