linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Mark Brown <broonie@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Guenter Roeck <linux@roeck-us.net>,
	"agross@kernel.org" <agross@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	linux-power <linux-power@fi.rohmeurope.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>
Subject: Re: [PATCH v9 05/10] regulator: IRQ based event/error notification helpers
Date: Tue, 11 May 2021 07:54:22 +0300	[thread overview]
Message-ID: <4d980efbec6a63d3241c14c7afdbaf14459d3fb3.camel@gmail.com> (raw)
In-Reply-To: <a22cf56239512f52ae5927f226e79d890d7a1240.1620645507.git.matti.vaittinen@fi.rohmeurope.com>


On Mon, 2021-05-10 at 14:29 +0300, Matti Vaittinen wrote:
> Provide helper function for IC's implementing regulator notifications
> when an IRQ fires. The helper also works for IRQs which can not be
> acked.
> Helper can be set to disable the IRQ at handler and then re-enabling
> it
> on delayed work later. The helper also adds
> regulator_get_error_flags()
> errors in cache for the duration of IRQ disabling.
> 
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> 
> +static irqreturn_t regulator_notifier_isr(int irq, void *data)
> +{

//snip

> +	/*
> +	 * IRQ seems to be for us. Let's fire correct notifiers / store
> error
> +	 * flags
> +	 */
> +	for_each_set_bit(i, &rdev_map, num_rdevs) {
> +		unsigned long evt;
> +		struct regulator_err_state *stat;
> +		struct regulator_dev *rdev;
> +
> +		stat = &rid->states[i];
> +		rdev = stat->rdev;
> +
> +		for_each_set_bit(j, &stat->notifs, BITS_PER_TYPE(stat-
> >notifs)) {
> +			evt =  BIT(j);
> +			pr_dbg("Sending regulator notification EVT
> 0x%lx\r\n",
> +			       stat->notifs, evt);
> +			regulator_notifier_call_chain(rdev, evt, NULL);
> +		}

This construct sends own notification for each of the event flagged by
the driver. My thinking was that sending each event separately ensures
all of them are handled. OTOH, the comment in the even description
states:

> * NOTE: These events can be OR'ed together when passed into handler.

So... Should I actually simplify this and just punt out all the
stat->notifs in one event? That would get rid of this one extra loop.

> +		rdev_flag_err(rdev, stat->errors);
> +	}

Best Regards
	Matti Vaittinen



  reply	other threads:[~2021-05-11  4:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 11:26 [PATCH v9 00/10] Extend regulator notification support Matti Vaittinen
2021-05-10 11:27 ` [PATCH v9 01/10] dt_bindings: Add protection limit properties Matti Vaittinen
2021-05-10 11:28 ` [PATCH v9 02/10] reboot: Add hardware protection power-off Matti Vaittinen
2021-05-12  8:20   ` Petr Mladek
2021-05-12 12:00     ` Vaittinen, Matti
2021-05-13  8:34       ` Petr Mladek
2021-05-17  4:57         ` Matti Vaittinen
2021-05-10 11:29 ` [PATCH v9 03/10] thermal: Use generic HW-protection shutdown API Matti Vaittinen
2021-05-10 11:29 ` [PATCH v9 04/10] regulator: add warning flags Matti Vaittinen
2021-05-10 11:29 ` [PATCH v9 05/10] regulator: IRQ based event/error notification helpers Matti Vaittinen
2021-05-11  4:54   ` Matti Vaittinen [this message]
2021-05-10 11:30 ` [PATCH v9 06/10] regulator: add property parsing and callbacks to set protection limits Matti Vaittinen
2021-05-10 11:30 ` [PATCH v9 07/10] dt-bindings: regulator: bd9576 add FET ON-resistance for OCW Matti Vaittinen
2021-05-10 11:30 ` [PATCH v9 08/10] regulator: bd9576: Support error reporting Matti Vaittinen
2021-05-10 11:31 ` [PATCH v9 09/10] regulator: bd9576: Fix the driver name in id table Matti Vaittinen
2021-05-10 11:31 ` [PATCH v9 10/10] MAINTAINERS: Add reviewer for regulator irq_helpers Matti Vaittinen

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=4d980efbec6a63d3241c14c7afdbaf14459d3fb3.camel@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=agross@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=keescook@chromium.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-power@fi.rohmeurope.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    --subject='Re: [PATCH v9 05/10] regulator: IRQ based event/error notification helpers' \
    /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

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).