devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Richard Fitzgerald <rf@opensource.cirrus.com>
Cc: <lee@kernel.org>, <robh+dt@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <linus.walleij@linaro.org>,
	<broonie@kernel.org>, <tglx@linutronix.de>,
	<alsa-devel@alsa-project.org>, <devicetree@vger.kernel.org>,
	<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.cirrus.com>
Subject: Re: [PATCH 09/12] irqchip: cirrus: Add driver for Cirrus Logic CS48L31/32/33 codecs
Date: Thu, 10 Nov 2022 15:13:47 +0000	[thread overview]
Message-ID: <86k042q1uc.wl-maz@kernel.org> (raw)
In-Reply-To: <ef60cbdb-f506-7bd6-a8e1-c92b6963a0f4@opensource.cirrus.com>

On Thu, 10 Nov 2022 13:00:50 +0000,
Richard Fitzgerald <rf@opensource.cirrus.com> wrote:
> 
> On 10/11/2022 12:01, Marc Zyngier wrote:
> > On Thu, 10 Nov 2022 11:22:26 +0000,
> > Richard Fitzgerald <rf@opensource.cirrus.com> wrote:
> >> 
> >> On 10/11/2022 08:02, Marc Zyngier wrote:
> >>> On Wed, 09 Nov 2022 16:53:28 +0000,
> >>> Richard Fitzgerald <rf@opensource.cirrus.com> wrote:
> >>>> 
> >>>> The Cirrus Logic CS48L31/32/33 audio codecs contain a programmable
> >>>> interrupt controller with a variety of interrupt sources, including
> >>>> GPIOs that can be used as interrupt inputs.
> >>>> 
> >>>> This driver provides the handling for the interrupt controller. As the
> >>>> codec is accessed via regmap, the generic regmap_irq functionality
> >>>> is used to do most of the work.
> >>>> 
> >>> 
> >>> I cannot spot a shred of interrupt controller code in there. This
> >> 
> >> It is providing support for handling an interrupt controller so that
> >> other drivers can bind to those interrupts. It's just that regmap
> >> provides a lot of generic implementation for SPI-connected interrupt
> >> controllers so we don't need to open-code all that in the
> >> irqchip driver.
> > 
> > And thus none of that code needs to live in drivers/irqchip.
> > 
> >> 
> >>> belongs IMO to the MFD code.
> >> 
> >> We did once put interrupt support in MFD for an older product line but
> >> the MFD maintainer doesn't like the MFD being a dumping-ground for
> >> random other functionality that have their own subsystems.
> > 
> > I don't like this stuff either. All this code is a glorified set of
> > interrupt handlers and #defines that only hide the lack of a proper DT
> > binding to express the interrupt routing (it feels like looking at
> > board files from 10 years ago).
> > 
> 
> I didn't understand this. The whole purpose of this is to instantiate
> Linux interrupts for the PIC interrupt sources so that other drivers
> that want to use the interrupts from the CS48L32 PIC can use standard
> kernel APIs or DT to bind against them.

There is zero standard APIs in this patch. Does cs48l32_request_irq()
look standard to you? This whole thing makes a mockery of the
interrupt model and of firmware-based interrupt description which we
spent years to build.

> 
> The four handlers registered within the driver are done here simply
> because they don't belong to any particular child driver. Since they
> are a fixed feature of the chip that we know we want to handle we may as
> well just register them.

Again, they have no purpose in an interrupt controller driver.

> If we put them in the MFD with DT definitions it would make a
> circular dependency between MFD and its child, which is not a great
> situation. If it's these handlers that are bothering you, we could move
> them to the audio driver.

And what's left? Nothing.

> 
> > None of that belongs in the irqchip code.
> > 
> 
> I don't really understand here what the criteria is that makes this not
> a irqchip driver but it was ok for madera. We have a PIC and we need to
> handle that and export those interrupts so other drivers can bind
> against them. Is the problem that the PIC is on a SPI bus and irqchip is
> only for memory-mapped PICs? Or is it that we have re-used existing
> library code instead of open-coding it, so you aren't seeing the actual
> handling code?

An irqchip driver uses the irq_chip structure, uses irq domains to
abstract the device-specific interrupt numbering from clients, and
doesn't force the use of an esoteric API on these clients.

What I see here is the exact opposite.

Was it OK for madera? No. A moment of weakness, I presume. Do I want
to repeat the same mistake? Neither.

> As Lee has already objected in the past to having the interrupt
> controller implementation in MFD I don't want to move it there without
> Lee's agreement that it's ok to put the PIC IRQ implementation in MFD
> for CS48L32.

If you were implementing an actual interrupt controller driver, I'd
take it without any question. The fact that this code mandates the use
of its own homegrown API rules it out.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2022-11-10 15:13 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 16:53 [PATCH 00/12] Add support for the Cirrus Logic CS48L32 audio codecs Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 01/12] dt-bindings: mfd: Add Cirrus Logic CS48L32 audio codec Richard Fitzgerald
2022-11-09 21:09   ` Rob Herring
2022-11-14  8:36   ` Krzysztof Kozlowski
2022-11-09 16:53 ` [PATCH 02/12] mfd: cs48l32: Add register definitions for Cirrus Logic CS48L31/32/33 Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 03/12] mfd: cs48l32: Add support for CS48L31/32/33 codecs Richard Fitzgerald
2022-11-11 23:07   ` kernel test robot
2022-11-16 15:43   ` Lee Jones
2022-11-09 16:53 ` [PATCH 04/12] dt-bindings: pinctrl: Add Cirrus Logic CS48L31/32/33 Richard Fitzgerald
2022-11-09 21:09   ` Rob Herring
2022-11-14  8:39   ` Krzysztof Kozlowski
2022-11-09 16:53 ` [PATCH 05/12] pinctrl: cirrus: Add support for CS48L31/32/33 codecs Richard Fitzgerald
2022-11-10 10:02   ` Linus Walleij
2022-11-10 10:55     ` Richard Fitzgerald
2022-11-12 21:01   ` kernel test robot
2022-11-09 16:53 ` [PATCH 06/12] regulator: arizona-micsupp: Don't hardcode use of ARIZONA defines Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 07/12] regulator: arizona-micsupp: Don't use a common regulator name Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 08/12] regulator: arizona-micsupp: Support Cirrus Logic CS48L31/32/33 Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 09/12] irqchip: cirrus: Add driver for Cirrus Logic CS48L31/32/33 codecs Richard Fitzgerald
2022-11-10  8:02   ` Marc Zyngier
2022-11-10 11:22     ` Richard Fitzgerald
2022-11-10 12:01       ` Marc Zyngier
2022-11-10 13:00         ` Richard Fitzgerald
2022-11-10 15:13           ` Marc Zyngier [this message]
2022-11-10 16:31             ` Richard Fitzgerald
2022-11-10 16:55               ` Mark Brown
2022-11-10 18:47               ` Marc Zyngier
2022-11-10 20:36                 ` Mark Brown
2022-11-11  8:00                   ` Marc Zyngier
2022-11-11 11:16                     ` Charles Keepax
2022-11-11 11:49                       ` Mark Brown
2022-11-11 13:01                         ` Charles Keepax
2022-11-11 13:00                       ` Charles Keepax
2022-11-16 16:44                     ` Mark Brown
2022-11-10 13:14         ` Richard Fitzgerald
2022-11-10 15:40           ` Marc Zyngier
2022-11-10 13:01       ` Mark Brown
2022-11-09 16:53 ` [PATCH 10/12] ASoC: wm_adsp: Allow client to hook into pre_run callback Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 11/12] dt-bindings: sound: Add Cirrus Logic CS48L31/32/33 codecs Richard Fitzgerald
2022-11-09 21:09   ` Rob Herring
2022-11-14  8:45   ` Krzysztof Kozlowski
2022-11-14 11:00     ` Richard Fitzgerald
2022-11-14 11:03       ` Krzysztof Kozlowski
2022-11-14 12:34         ` Richard Fitzgerald
2022-11-09 16:53 ` [PATCH 12/12] ASoC: cs48l32: Add codec driver for Cirrus Logic CS48L31/32/33 Richard Fitzgerald
2022-11-10 20:20   ` kernel test robot
2022-11-10 20:53 ` [PATCH 00/12] Add support for the Cirrus Logic CS48L32 audio codecs Mark Brown
2022-11-11 13:50   ` Richard Fitzgerald
2022-11-23 13:11 ` (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=86k042q1uc.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=rf@opensource.cirrus.com \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /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).