mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Nihal Kumar Gupta <nihal.gupta@oss.qualcomm.com>
Cc: Bryan O'Donoghue <bod@kernel.org>, Vinod Koul <vkoul@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Guru Das Srinagesh <linux@gurudas.dev>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, mfd@lists.linux.dev,
	Suresh Vankadara <svankada@qti.qualcomm.com>,
	Vikram Sharma <vikram.sharma@oss.qualcomm.com>,
	Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>,
	Dhruvin Rajpura <drajpura@qti.qualcomm.com>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: Re: [PATCH v2 5/6] mfd: qcom-pm8008: Add support for PM8010 PMIC
Date: Tue, 22 Sep 2026 10:33:27 +0100	[thread overview]
Message-ID: <20260922093327.GA2308615@google.com> (raw)
In-Reply-To: <20260907-glymur_camss-v2-5-75f7982dc983@oss.qualcomm.com>

On Mon, 07 Sep 2026, Nihal Kumar Gupta wrote:

> From: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
> 
> The PM8010 is a variant of the PM8008 PMIC with a slightly different
> IRQ layout and MFD cells. Introduce per-variant match data (IRQ chip
> descriptor and MFD cells) selected via the new "qcom,pm8010-i2c"
> compatible string, and support probing without an interrupt line by
> falling back to a reduced set of MFD cells when the client has no IRQ
> assigned.
> 
> Signed-off-by: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
> Signed-off-by: Dhruvin Rajpura <drajpura@qti.qualcomm.com>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Signed-off-by: Nihal Kumar Gupta <nihal.gupta@oss.qualcomm.com>

Who are all of these people?

Did they all work on this?  If so, where are their Co-developed-bys?

> ---
>  drivers/mfd/qcom-pm8008.c | 140 ++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 112 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
> index 60204cc9a2dc60cc1fe1b64030f5d803100e7874..28532cef7908ef3409a3dfc0779aae3b1a3885b9 100644
> --- a/drivers/mfd/qcom-pm8008.c
> +++ b/drivers/mfd/qcom-pm8008.c
> @@ -34,6 +34,7 @@ enum {
>  	PM8008_GPIO1,
>  	PM8008_GPIO2,
>  	PM8008_NUM_PERIPHS,
> +	PM8010_NUM_PERIPHS = 2,
>  };
>  
>  #define PM8008_PERIPH_0_BASE	0x900
> @@ -55,6 +56,10 @@ enum {
>  #define PM8008_IRQ_GPIO1	6
>  #define PM8008_IRQ_GPIO2	7
>  
> +#define PM8010_IRQ_MISC_MBG_FAULT	0
> +/* 1-3 are unused */

This is not required.

> +#define PM8010_IRQ_MISC_LDO_OCP	4
> +
>  enum {
>  	SET_TYPE_INDEX,
>  	POLARITY_HI_INDEX,
> @@ -88,6 +93,12 @@ static const struct regmap_irq pm8008_irqs[] = {
>  	_IRQ(PM8008_IRQ_GPIO2,	      PM8008_GPIO2,	BIT(0), IRQ_TYPE_SENSE_MASK),
>  };
>  
> +static const struct regmap_irq pm8010_irqs[] = {
> +	_IRQ(PM8010_IRQ_MISC_MBG_FAULT, PM8008_MISC, BIT(0), IRQ_TYPE_EDGE_RISING),
> +	_IRQ(PM8010_IRQ_MISC_LDO_OCP, PM8008_MISC, BIT(4), IRQ_TYPE_EDGE_RISING),
> +	_IRQ(PM8008_IRQ_TEMP_ALARM, PM8008_TEMP_ALARM, BIT(0), IRQ_TYPE_SENSE_MASK),
> +};
> +
>  static const unsigned int pm8008_periph_base[] = {
>  	PM8008_PERIPH_0_BASE,
>  	PM8008_PERIPH_1_BASE,
> @@ -158,6 +169,25 @@ static const struct regmap_irq_chip pm8008_irq_chip = {
>  	.get_irq_reg		= pm8008_get_irq_reg,
>  };
>  
> +static const struct regmap_irq_chip pm8010_irq_chip = {
> +	.name			= "pm8010",
> +	.main_status		= I2C_INTR_STATUS_BASE,
> +	.num_main_regs		= 1,
> +	.irqs			= pm8010_irqs,
> +	.num_irqs		= ARRAY_SIZE(pm8010_irqs),
> +	.num_regs		= PM8010_NUM_PERIPHS,
> +	.status_base		= INT_LATCHED_STS_OFFSET,
> +	.mask_base		= INT_EN_CLR_OFFSET,
> +	.unmask_base		= INT_EN_SET_OFFSET,
> +	.mask_unmask_non_inverted = true,
> +	.ack_base		= INT_LATCHED_CLR_OFFSET,
> +	.config_base		= pm8008_config_regs,
> +	.num_config_bases	= ARRAY_SIZE(pm8008_config_regs),
> +	.num_config_regs	= PM8010_NUM_PERIPHS,
> +	.set_type_config	= pm8008_set_type_config,
> +	.get_irq_reg		= pm8008_get_irq_reg,
> +};
> +
>  static const struct regmap_config qcom_mfd_regmap_cfg = {
>  	.name		= "primary",
>  	.reg_bits	= 16,
> @@ -179,10 +209,32 @@ static const struct resource pm8008_temp_res[] = {
>  
>  static const struct mfd_cell pm8008_cells[] = {
>  	MFD_CELL_NAME("pm8008-regulator"),
> -	MFD_CELL_RES("qpnp-temp-alarm", pm8008_temp_res),
> +	MFD_CELL_RES("spmi-temp-alarm", pm8008_temp_res),

Why is this cell being renamed from 'qpnp-temp-alarm' to 'spmi-temp-alarm'?
There is no mention of this change in the commit log, and if intentional, it
should be submitted in its own separate patch.

>  	MFD_CELL_NAME("pm8008-gpio"),
>  };
>  
> +static const struct mfd_cell pm8010_cells[] = {
> +	MFD_CELL_NAME("pm8010-regulator"),
> +	MFD_CELL_RES("spmi-temp-alarm", pm8008_temp_res),
> +	MFD_CELL_NAME("pm8008-gpio"),
> +};
> +
> +static const struct mfd_cell pm8008_no_irq_cells[] = {
> +	MFD_CELL_NAME("pm8008-regulator"),
> +};
> +
> +static const struct mfd_cell pm8010_no_irq_cells[] = {
> +	MFD_CELL_NAME("pm8010-regulator"),
> +};
> +
> +struct pm8008_match_data {
> +	const struct regmap_irq_chip *irq_chip_desc;
> +	const struct mfd_cell *mfd_cells;
> +	const struct mfd_cell *no_irq_mfd_cells;
> +	int num_mfd_cells;
> +	int no_irq_num_mfd_cells;
> +};
> +
>  static void devm_irq_domain_fwnode_release(void *data)
>  {
>  	struct fwnode_handle *fwnode = data;
> @@ -192,15 +244,22 @@ static void devm_irq_domain_fwnode_release(void *data)
>  
>  static int pm8008_probe(struct i2c_client *client)
>  {
> -	struct regmap_irq_chip_data *irq_data;
> +	struct regmap_irq_chip_data *irq_data = NULL;
> +	const struct pm8008_match_data *data;
>  	struct device *dev = &client->dev;
>  	struct regmap *regmap, *regmap2;
>  	struct fwnode_handle *fwnode;
> +	const struct mfd_cell *cells;
>  	struct i2c_client *dummy;
>  	struct gpio_desc *reset;
> +	int num_cells;
>  	char *name;
>  	int ret;
>  
> +	data = device_get_match_data(dev);
> +	if (!data)
> +		return dev_err_probe(dev, -ENODATA, "Missing driver match data\n");
> +
>  	dummy = devm_i2c_new_dummy_device(dev, client->adapter, client->addr + 1);
>  	if (IS_ERR(dummy)) {
>  		ret = PTR_ERR(dummy);
> @@ -231,37 +290,62 @@ 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) {

Turn this massive if clause into a function.

> +		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, data->irq_chip_desc,
> +						       &irq_data);
> +		if (ret) {
> +			dev_err(dev, "failed to add IRQ chip: %d\n", ret);
> +			return ret;
> +		}
> +
> +		/* Needed by GPIO driver. */
> +		dev_set_drvdata(dev, regmap_irq_get_domain(irq_data));
> +		cells = data->mfd_cells;
> +		num_cells = data->num_mfd_cells;
> +	} else {
> +		cells = data->no_irq_mfd_cells;
> +		num_cells = data->no_irq_num_mfd_cells;
>  	}
>  
> -	/* Needed by GPIO driver. */
> -	dev_set_drvdata(dev, regmap_irq_get_domain(irq_data));
> -
> -	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,
> +				    regmap_irq_get_domain(irq_data));
>  }
>  
> +static const struct pm8008_match_data pm8008_data = {
> +	.irq_chip_desc = &pm8008_irq_chip,
> +	.mfd_cells = pm8008_cells,
> +	.no_irq_mfd_cells = pm8008_no_irq_cells,
> +	.num_mfd_cells = ARRAY_SIZE(pm8008_cells),
> +	.no_irq_num_mfd_cells = ARRAY_SIZE(pm8008_no_irq_cells),
> +};
> +
> +static const struct pm8008_match_data pm8010_data = {
> +	.irq_chip_desc = &pm8010_irq_chip,
> +	.mfd_cells = pm8010_cells,
> +	.no_irq_mfd_cells = pm8010_no_irq_cells,
> +	.num_mfd_cells = ARRAY_SIZE(pm8010_cells),
> +	.no_irq_num_mfd_cells = ARRAY_SIZE(pm8010_no_irq_cells),
> +};
> +
>  static const struct of_device_id pm8008_match[] = {
> -	{ .compatible = "qcom,pm8008", },
> +	{ .compatible = "qcom,pm8008", .data = &pm8008_data },
> +	{ .compatible = "qcom,pm8010-i2c", .data = &pm8010_data },

We do not allow data from one registration mechanism (MFD) to be piped through
another (OF).  Please pass through an enum identifier instead and select the
cells and IRQ chip in a 'switch()' statement?  Also, why does this compatible
carry an '-i2c' suffix when the existing device is just "qcom,pm8008"?

>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, pm8008_match);
> 
> -- 
> 2.34.1
> 

-- 
Lee Jones

  reply	other threads:[~2026-09-22  9:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  8:13 [PATCH v2 0/6] Add CAMSS support for Qualcomm Glymur Nihal Kumar Gupta
2026-09-07  8:13 ` [PATCH v2 1/6] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add Glymur compatible Nihal Kumar Gupta
2026-09-07 10:56   ` Pankaj Patil
2026-09-07 11:04     ` Nihal Kumar Gupta
2026-09-23 11:52   ` Krzysztof Kozlowski
2026-09-07  8:13 ` [PATCH v2 2/6] dt-bindings: media: qcom,glymur-camss: Add Glymur CAMSS Nihal Kumar Gupta
2026-09-07  9:29   ` Bryan O'Donoghue
2026-09-07 10:42     ` Nihal Kumar Gupta
2026-09-07 11:05       ` Bryan O'Donoghue
2026-09-09 10:45   ` Bryan O'Donoghue
2026-09-23 11:53   ` Krzysztof Kozlowski
2026-09-07  8:13 ` [PATCH v2 3/6] dt-bindings: mfd: pm8008: Add PM8010 I2C support Nihal Kumar Gupta
2026-09-07  8:13 ` [PATCH v2 4/6] media: qcom: camss: Add Glymur compatible Nihal Kumar Gupta
2026-09-07  8:13 ` [PATCH v2 5/6] mfd: qcom-pm8008: Add support for PM8010 PMIC Nihal Kumar Gupta
2026-09-22  9:33   ` Lee Jones [this message]
2026-09-22 10:13     ` Konrad Dybcio
2026-09-23 10:17     ` Jishnu Prakash
2026-09-22 10:15   ` Lee Jones
2026-09-07  8:13 ` [PATCH v2 6/6] regulator: qcom-pm8008-regulator: " Nihal Kumar Gupta
2026-09-08 15:43 ` [PATCH v2 0/6] Add CAMSS support for Qualcomm Glymur 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=20260922093327.GA2308615@google.com \
    --to=lee@kernel.org \
    --cc=bod@kernel.org \
    --cc=broonie@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=drajpura@qti.qualcomm.com \
    --cc=jishnu.prakash@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux@gurudas.dev \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mani@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=neil.armstrong@linaro.org \
    --cc=nihal.gupta@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=svankada@qti.qualcomm.com \
    --cc=vikram.sharma@oss.qualcomm.com \
    --cc=vkoul@kernel.org \
    --cc=vladimir.zapolskiy@linaro.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®