From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v1 3/3] regulator: fixed: forward under-voltage events
Date: Tue, 10 Oct 2023 14:55:31 +0200 [thread overview]
Message-ID: <20231010125531.GA3268051@pengutronix.de> (raw)
In-Reply-To: <5e51792a-cc93-4364-a51b-c2b116d89369@sirena.org.uk>
Hi,
On Tue, Oct 10, 2023 at 01:19:36PM +0100, Mark Brown wrote:
> On Tue, Oct 10, 2023 at 10:59:06AM +0200, Oleksij Rempel wrote:
> > Add handler to forward under-voltage events.
> > On systems for more or less complicated regulator chains we need to
> > forward under-voltage events to actual driver which need to react on
> > them.
>
> It isn't clear to me why this would be implemented in one specific
> driver, nor why this would be done unconditionally. Could you provide
> some information on the problem you're trying to solve here?
The hardware I am working with has an under-voltage sensor on the 24V
supply regulator and some backup capacitors to run SoC for 100ms. I want
to forward under-voltage events across a chain of different regulators
to a designated consumer. For instance, to the mmc driver, enabling it
to initiate shutdown before power loss occurs. Additionally, a bit can
be set in the volatile memory of a scratch pad in an RTC clock to record
sudden power loss, which can be checked on the next system start.
> This feels like something that should be a core feature.
Agreed. I am relatively new to the regulator framework and am uncertain
about the optimal location for registering the event forwarding. Could
you advise on this?
> > +static int reg_fixed_regulator_notifier(struct notifier_block *nb,
> > + unsigned long event, void *data)
> > +{
> > + struct fixed_voltage_data *priv =
> > + container_of(nb, struct fixed_voltage_data, nb);
> > + struct regulator_dev *rdev = priv->dev;
> > +
> > + if (event != REGULATOR_EVENT_UNDER_VOLTAGE_WARN &&
> > + event != REGULATOR_EVENT_UNDER_VOLTAGE)
> > + return NOTIFY_OK;
> > +
> > + regulator_notifier_call_chain(rdev, event, NULL);
>
> This would be better written as a switch statement for extensibility,
ack.
> and it's not clear why the filtering?
I started with a conservative approach because I'm not sure about the
possible effects of forwarding all events. If forwarding all events is a
good idea, I can do it.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2023-10-10 12:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 8:59 [PATCH v1 1/3] regulator: dt-bindings: fixed-regulator: Add under-voltage interrupt support Oleksij Rempel
2023-10-10 8:59 ` [PATCH v1 2/3] regulator: fixed: add support for under-voltage IRQ Oleksij Rempel
2023-10-10 8:59 ` [PATCH v1 3/3] regulator: fixed: forward under-voltage events Oleksij Rempel
2023-10-10 12:19 ` Mark Brown
2023-10-10 12:55 ` Oleksij Rempel [this message]
2023-10-10 13:39 ` Oleksij Rempel
2023-10-10 17:19 ` Mark Brown
2023-10-11 7:59 ` Oleksij Rempel
2023-10-11 11:38 ` Mark Brown
2023-10-12 7:08 ` Matti Vaittinen
2023-10-12 11:13 ` Mark Brown
2023-10-21 0:26 ` Sebastian Reichel
2023-10-10 12:20 ` [PATCH v1 1/3] regulator: dt-bindings: fixed-regulator: Add under-voltage interrupt support Mark Brown
2023-10-10 18:13 ` Rob Herring
2023-10-25 17:47 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231010125531.GA3268051@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).