linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guru Das Srinagesh <gurus@codeaurora.org>
To: Mark Brown <broonie@kernel.org>
Cc: Markus Elfring <Markus.Elfring@web.de>,
	Lee Jones <lee.jones@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Guenter Roeck <linux@roeck-us.net>, Joe Perches <joe@perches.com>,
	Subbaraman Narayanamurthy <subbaram@codeaurora.org>,
	David Collins <collinsd@codeaurora.org>,
	Anirudh Ghayal <aghayal@codeaurora.org>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [RFC PATCH v3 2/3] regmap-irq: Add support for POLARITY_HI and POLARITY_LO config regs
Date: Mon, 15 Mar 2021 13:33:37 -0700	[thread overview]
Message-ID: <20210315203336.GA8977@codeaurora.org> (raw)
In-Reply-To: <20210312121916.GE5348@sirena.org.uk>

On Fri, Mar 12, 2021 at 12:19:16PM +0000, Mark Brown wrote:
> On Wed, Mar 10, 2021 at 04:39:53PM -0800, Guru Das Srinagesh wrote:
> > If an interrupt is already configured as either edge- or
> > level-triggered, setting the corresponding bit for it in the POLARITY_HI
> > register further configures it as rising-edge or level-high triggered
> > (as the case may be), while setting the same bit in POLARITY_LO further
> > configures it as falling-edge or level-low triggered.
> 
> I think you probably need to bring these three fields together into a
> single virtual field and then map the values within that field using
> the existing type stuff.

Sure, how about this scheme then, for patches 2 and 3 in this series?
(Patch 1 will remain the same, pending your review of it.)

Since I do need to write to two extra registers, I'll need two
register_base's and two buffers to hold their data. This can be
generalized to "extra config registers" in the framework as follows:

- Add these two fields to `struct regmap_irq_chip`:

	unsigned int *extra_config_base; /* Points to array of extra regs */
	int num_extra_config_regs;	 /* = ARRAY_SIZE(array above) */

- Add this field to `struct regmap_irq_chip_data`:

	unsigned int **extra_config_buf;
  	/* Will be dynamically allocated to size of:
  	 * [chip->num_extra_config_regs][chip->num_regs]
  	 */

- Add a new function callback in `struct regmap_irq_chip`:

	int (*configure_extra_regs)(void *irq_drv_data, unsigned int
	type)

  This callback will be called at the end of regmap_irq_set_type():
  	
  	if (d->chip->configure_extra_regs)
		d->chip->configure_extra_regs();

  The callback, defined in the client driver, will specifically address
  the changes to regmap_irq_set_type() made in patches 2 and 3 of this
  series, viz. overriding how type_buf is to be handled, plus the
  populating of polarity_*_buf's (rechristened as extra_config_bufs in
  this proposed new scheme).

This new scheme thus makes v2 more generic. I thought I'd discuss this
with you before implementing it as v3 RFC. Could you please let me know
your thoughts?

Thank you.

Guru Das.

  reply	other threads:[~2021-03-15 20:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11  0:39 [RFC PATCH v3 0/3] Add support for Qualcomm MFD PMIC register layout Guru Das Srinagesh
2021-03-11  0:39 ` [RFC PATCH v3 1/3] regmap-irq: Extend sub-irq to support non-fixed reg strides Guru Das Srinagesh
2021-04-12  6:05   ` Matti Vaittinen
2021-04-12 11:08     ` Vaittinen, Matti
2021-04-12 18:08       ` Guru Das Srinagesh
2021-03-11  0:39 ` [RFC PATCH v3 2/3] regmap-irq: Add support for POLARITY_HI and POLARITY_LO config regs Guru Das Srinagesh
2021-03-12 12:19   ` Mark Brown
2021-03-15 20:33     ` Guru Das Srinagesh [this message]
2021-03-15 20:36       ` Guru Das Srinagesh
2021-03-17 20:42       ` Mark Brown
2021-03-20  2:37         ` Guru Das Srinagesh
2021-03-11  0:39 ` [RFC PATCH v3 3/3] regmap-irq: Modify type_buf handling for IRQ_TYPE_LEVEL_* Guru Das Srinagesh
2021-03-18 18:33 ` (subset) [RFC PATCH v3 0/3] Add support for Qualcomm MFD PMIC register layout Mark Brown
2021-03-18 18:36   ` 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=20210315203336.GA8977@codeaurora.org \
    --to=gurus@codeaurora.org \
    --cc=Markus.Elfring@web.de \
    --cc=aghayal@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=collinsd@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --cc=subbaram@codeaurora.org \
    --subject='Re: [RFC PATCH v3 2/3] regmap-irq: Add support for POLARITY_HI and POLARITY_LO config regs' \
    /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).