public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Puranjay Mohan <puranjay12@gmail.com>
Cc: gregkh@linuxfoundation.org, rafael@kernel.org,
	heikki.krogerus@linux.intel.com, kuba@kernel.org,
	saravanak@google.com, linux-kernel@vger.kernel.org,
	lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 1/2] device property: Add fwnode_irq_get_byname()
Date: Wed, 10 Nov 2021 10:53:04 +0200	[thread overview]
Message-ID: <YYuIcPLx0uoUZ88B@smile.fi.intel.com> (raw)
In-Reply-To: <20211109200840.135019-2-puranjay12@gmail.com>

On Wed, Nov 10, 2021 at 01:38:39AM +0530, Puranjay Mohan wrote:
> The fwnode framework did not have means to obtain the IRQ number from
> the name of a node.
> Add that now, in form of the fwnode_irq_get_byname() function.

...

> +int fwnode_irq_get_byname(struct fwnode_handle *fwnode, const char *name)
> +{
> +	int index;
> +
> +	if (unlikely(!name))
> +		return -EINVAL;

> +	index = fwnode_property_match_string(fwnode, "interrupt-names", name);
> +	if (index < 0)
> +		return index;

It won't work like this. The ACPI table quite likely won't have this in them.
Also it doesn't cover the GPIO interrupts in ACPI case.

> +	return fwnode_irq_get(fwnode, index);

Neither this covers GPIO IRQs.

> +}
> +EXPORT_SYMBOL(fwnode_irq_get_byname);

So, first you need to provide a design for this how ACPI cases can be handled.

Imagine these cases (at least) for _CRS method in ACPI:
  1/ Single GSI

	Interrupt()

  2/ Single GPIO IRQ

	GpioInt()

  3/ Both in different orders
    a)
	Interrupt()
	GpioInt()

    b)
	GpioInt()
	Interrupt()

  4/ Mixed (complicated cases)

	Interrupt()
	Interrupt()
	GpioInt()
	Interrupt()
	GpioInt()

Obvious question, what does the index mean in all these cases?

Next one is, how can we quirk out the platforms with the old ACPI tables
where no properties are provided? For GPIO there is struct acpi_gpio_params
which goes deep into ACPI glue layer.

Luckily, the GPIO IRQ case has already available APIs for indexing and naming
match: acpi_dev_gpio_irq_get_by().

Hence, the main task is to define index in cases like 4 and see what can be
done for the GSI cases.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2021-11-10  8:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 20:08 [PATCH v2 0/2] device property: Adding fwnode_irq_get_byname() Puranjay Mohan
2021-11-09 20:08 ` [PATCH v2 1/2] device property: Add fwnode_irq_get_byname() Puranjay Mohan
2021-11-10  8:53   ` Andy Shevchenko [this message]
2021-11-10 17:04     ` Puranjay Mohan
2021-11-10 17:27       ` Andy Shevchenko
2021-11-09 20:08 ` [PATCH v2 2/2] iio: accel: adxl355: use fwnode_irq_get_byname() Puranjay Mohan
2022-02-01 16:25   ` Andy Shevchenko
2022-02-27 12:41     ` Jonathan Cameron
2022-04-10 17:13       ` Jonathan Cameron
2022-04-11 10:17         ` Andy Shevchenko
2021-11-09 22:42 ` [PATCH v2 0/2] device property: Adding fwnode_irq_get_byname() Saravana Kannan
2021-11-10  8:32   ` Andy Shevchenko
2021-11-10  8:32 ` Andy Shevchenko

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=YYuIcPLx0uoUZ88B@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=puranjay12@gmail.com \
    --cc=rafael@kernel.org \
    --cc=saravanak@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox