All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: gregkh@linuxfoundation.org, david.m.ertman@intel.com,
	ira.weiny@intel.com, lee@kernel.org,
	mika.westerberg@linux.intel.com, heikki.krogerus@linux.intel.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/2] driver core: auxiliary bus: Introduce auxiliary device resource management
Date: Mon, 19 May 2025 14:52:12 +0300	[thread overview]
Message-ID: <aCsbbC4GS3r5MrMf@black.fi.intel.com> (raw)
In-Reply-To: <aCsLoWtIdfR5a2YS@smile.fi.intel.com>

On Mon, May 19, 2025 at 01:44:49PM +0300, Andy Shevchenko wrote:
> On Fri, May 16, 2025 at 10:20:02PM +0300, Raag Jadav wrote:
> > On Thu, May 15, 2025 at 04:06:47PM +0300, Andy Shevchenko wrote:
> > > On Thu, May 15, 2025 at 03:52:38PM +0300, Raag Jadav wrote:
> > > > On Wed, May 14, 2025 at 03:36:49PM +0300, Andy Shevchenko wrote:
> > > > > On Wed, May 14, 2025 at 05:54:31PM +0530, Raag Jadav wrote:
> 
> ...
> 
> > > > > > +int auxiliary_get_irq_optional(struct auxiliary_device *auxdev, unsigned int num)
> > > > > > +{
> > > > > > +	struct resource *r;
> > > > > > +	int ret = -ENXIO;
> > > > > > +
> > > > > > +	r = auxiliary_get_resource(auxdev, IORESOURCE_IRQ, num);
> > > > > > +	if (!r)
> > > > > > +		goto out;
> > > > > > +
> > > > > > +	/*
> > > > > > +	 * The resources may pass trigger flags to the irqs that need to be
> > > > > > +	 * set up. It so happens that the trigger flags for IORESOURCE_BITS
> > > > > > +	 * correspond 1-to-1 to the IRQF_TRIGGER* settings.
> > > > > > +	 */
> > > > > > +	if (r->flags & IORESOURCE_BITS) {
> > > > > > +		struct irq_data *irqd;
> > > > > > +
> > > > > > +		irqd = irq_get_irq_data(r->start);
> > > > > > +		if (!irqd)
> > > > > > +			goto out;
> > > > > > +		irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS);
> > > > > > +	}
> > > > > > +
> > > > > > +	ret = r->start;
> > > > > > +	if (WARN(!ret, "0 is an invalid IRQ number\n"))
> > > > > > +		ret = -EINVAL;
> > > > > > +out:
> > > > > > +	return ret;
> > > > > > +}
> > > > > 
> > > > > Please, do not inherit the issues that the respective platform device API has.
> > > > > And after all, why do you need this? What's wrong with plain fwnode_irq_get()?
> > > > 
> > > > Can you please elaborate? Are we expecting fwnode to be supported by auxiliary
> > > > device?
> > > 
> > > Platform IRQ getter is legacy for the board files, but it has support for fwnode.
> > > Why do you need to inherit all that legacy? What's the point?
> > 
> > This is just to abstract get_resource(IRQ) which has been carved up by the
> > parent device. And since this is an auxiliary child device, I'm not sure if
> > we have a firmware to work with.
> 
> To make get_resource() work, someone has to add those resources to the list.
> The question is, why do we need this for AUX devices? Are you expecting
> several IRQs to be dedicated for several devices (no sharing)? If now, why
> is the fwnode version of IRQ getter not enough?

With PCI type MFDs, MSIX would be a fair possibility, if not now atleast
in the future.

> > Please correct me if I've misunderstood your question.
> 
> For the memory and port resources it might be indeed needed to have a split.
> But then, since it's a lot of the copy from platform code, I would expect
> the common library for both rather than reinventing the wheel. To achieve
> that one might need to abstract away from the certain device container when
> handling resources (no platform_device nor auxiliary_device). Would that
> approach work?

Sure, let me explore this. Thanks for the suggestions.

Raag

  reply	other threads:[~2025-05-19 11:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 12:24 [PATCH v5 0/2] Auxiliary device support for MFD Raag Jadav
2025-05-14 12:24 ` [PATCH v5 1/2] driver core: auxiliary bus: Introduce auxiliary device resource management Raag Jadav
2025-05-14 12:35   ` Greg KH
2025-05-14 15:52     ` Raag Jadav
2025-05-14 12:36   ` Andy Shevchenko
2025-05-15 12:52     ` Raag Jadav
2025-05-15 13:06       ` Andy Shevchenko
2025-05-16 19:20         ` Raag Jadav
2025-05-19 10:44           ` Andy Shevchenko
2025-05-19 11:52             ` Raag Jadav [this message]
2025-05-14 15:27   ` kernel test robot
2025-05-14 15:58   ` kernel test robot
2025-05-14 12:24 ` [PATCH v5 2/2] mfd: core: Support auxiliary device Raag Jadav

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=aCsbbC4GS3r5MrMf@black.fi.intel.com \
    --to=raag.jadav@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=david.m.ertman@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=ira.weiny@intel.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.