lkml.org 
[lkml]   [2021]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v3 2/3] regmap-irq: Add support for POLARITY_HI and POLARITY_LO config regs
On Mon, Mar 15, 2021 at 01:33:36PM -0700, Guru Das Srinagesh wrote:
> 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?

Typo. I meant:

This new scheme thus makes *v3* more generic. I thought I'd discuss this
with you before implementing it as *v4* RFC.

Guru Das.

\
 
 \ /
  Last update: 2021-03-15 21:37    [W:0.102 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site