mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Oleg Keri <okerixx@gmail.com>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Guru Das Srinagesh <linux@gurudas.dev>,
	linux-arm-msm@vger.kernel.org, mfd@lists.linux.dev,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mfd: qcom-pm8008: support PMICs with no interrupt line
Date: Tue, 22 Sep 2026 11:14:59 +0100	[thread overview]
Message-ID: <20260922101459.GB2730113@google.com> (raw)
In-Reply-To: <20260908130745.2545-3-okerixx@gmail.com>

On Tue, 08 Sep 2026, Oleg Keri wrote:

> The interrupt is only needed for the temperature alarm and the two GPIOs.
> Where the pin is not routed the regulators are still perfectly usable, but
> probe fails: client->irq is 0 and request_threaded_irq() rejects it.
> 
> Skip the IRQ chip in that case and register the regulator cell alone. The
> temperature alarm cannot be registered without a domain either, because
> its IORESOURCE_IRQ would be handed to the platform device as a raw number
> rather than being mapped, and the GPIO cell needs the domain for the same
> reason.
> 
> Signed-off-by: Oleg Keri <okerixx@gmail.com>

What on earth is going on here:

https://lore.kernel.org/r/20260907-glymur_camss-v2-5-75f7982dc983@oss.qualcomm.com

> ---
>  drivers/mfd/qcom-pm8008.c | 63 +++++++++++++++++++++++++--------------
>  1 file changed, 40 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
> index 60204cc9a2dc..b51a9657ee56 100644
> --- a/drivers/mfd/qcom-pm8008.c
> +++ b/drivers/mfd/qcom-pm8008.c
> @@ -183,6 +183,10 @@ static const struct mfd_cell pm8008_cells[] = {
>  	MFD_CELL_NAME("pm8008-gpio"),
>  };
>  
> +static const struct mfd_cell pm8008_regulator_cells[] = {
> +	MFD_CELL_NAME("pm8008-regulator"),
> +};
> +
>  static void devm_irq_domain_fwnode_release(void *data)
>  {
>  	struct fwnode_handle *fwnode = data;
> @@ -195,9 +199,12 @@ static int pm8008_probe(struct i2c_client *client)
>  	struct regmap_irq_chip_data *irq_data;
>  	struct device *dev = &client->dev;
>  	struct regmap *regmap, *regmap2;
> +	const struct mfd_cell *cells;
>  	struct fwnode_handle *fwnode;
> +	struct irq_domain *domain;
>  	struct i2c_client *dummy;
>  	struct gpio_desc *reset;
> +	int num_cells;
>  	char *name;
>  	int ret;
>  
> @@ -231,33 +238,43 @@ static int pm8008_probe(struct i2c_client *client)
>  	 */
>  	usleep_range(1000, 2000);
>  
> -	name = devm_kasprintf(dev, GFP_KERNEL, "%pOF-internal", dev->of_node);
> -	if (!name)
> -		return -ENOMEM;
> -
> -	name = strreplace(name, '/', ':');
> -
> -	fwnode = irq_domain_alloc_named_fwnode(name);
> -	if (!fwnode)
> -		return -ENOMEM;
> -
> -	ret = devm_add_action_or_reset(dev, devm_irq_domain_fwnode_release, fwnode);
> -	if (ret)
> -		return ret;
> -
> -	ret = devm_regmap_add_irq_chip_fwnode(dev, fwnode, regmap, client->irq,
> -				IRQF_SHARED, 0, &pm8008_irq_chip, &irq_data);
> -	if (ret) {
> -		dev_err(dev, "failed to add IRQ chip: %d\n", ret);
> -		return ret;
> +	if (client->irq > 0) {
> +		name = devm_kasprintf(dev, GFP_KERNEL, "%pOF-internal", dev->of_node);
> +		if (!name)
> +			return -ENOMEM;
> +
> +		name = strreplace(name, '/', ':');
> +
> +		fwnode = irq_domain_alloc_named_fwnode(name);
> +		if (!fwnode)
> +			return -ENOMEM;
> +
> +		ret = devm_add_action_or_reset(dev, devm_irq_domain_fwnode_release, fwnode);
> +		if (ret)
> +			return ret;
> +
> +		ret = devm_regmap_add_irq_chip_fwnode(dev, fwnode, regmap,
> +						      client->irq, IRQF_SHARED, 0,
> +						      &pm8008_irq_chip, &irq_data);
> +		if (ret) {
> +			dev_err(dev, "failed to add IRQ chip: %d\n", ret);
> +			return ret;
> +		}
> +
> +		domain = regmap_irq_get_domain(irq_data);
> +		cells = pm8008_cells;
> +		num_cells = ARRAY_SIZE(pm8008_cells);
> +	} else {
> +		domain = NULL;
> +		cells = pm8008_regulator_cells;
> +		num_cells = ARRAY_SIZE(pm8008_regulator_cells);
>  	}
>  
>  	/* Needed by GPIO driver. */
> -	dev_set_drvdata(dev, regmap_irq_get_domain(irq_data));
> +	dev_set_drvdata(dev, domain);
>  
> -	return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, pm8008_cells,
> -				ARRAY_SIZE(pm8008_cells), NULL, 0,
> -				regmap_irq_get_domain(irq_data));
> +	return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, cells,
> +				num_cells, NULL, 0, domain);
>  }
>  
>  static const struct of_device_id pm8008_match[] = {
> -- 
> 2.55.0
> 

-- 
Lee Jones

  reply	other threads:[~2026-09-22 10:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 13:07 [PATCH 0/2] " Oleg Keri
2026-09-08 13:07 ` [PATCH 1/2] dt-bindings: mfd: qcom,pm8008: make the interrupt line optional Oleg Keri
2026-09-08 13:07 ` [PATCH 2/2] mfd: qcom-pm8008: support PMICs with no interrupt line Oleg Keri
2026-09-22 10:14   ` Lee Jones [this message]
2026-09-22 11:00     ` Oleg Keri
2026-09-08 13:40 ` [PATCH 0/2] " Oleg Keri
2026-09-10  9:10   ` Jishnu Prakash
2026-09-10  9:19     ` Konrad Dybcio
2026-09-10 12:44     ` Oleg Keri

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=20260922101459.GB2730113@google.com \
    --to=lee@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@gurudas.dev \
    --cc=mfd@lists.linux.dev \
    --cc=okerixx@gmail.com \
    --cc=robh@kernel.org \
    /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

all inboxes | Powered by JetHome®