[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZjktIrsZS-T7cm-A@surfacebook.localdomain>
Date: Mon, 6 May 2024 22:18:58 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Johan Hovold <johan+linaro@...nel.org>
Cc: Lee Jones <lee@...nel.org>, Mark Brown <broonie@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Das Srinagesh <quic_gurus@...cinc.com>,
Satya Priya <quic_c_skakit@...cinc.com>,
Stephen Boyd <swboyd@...omium.org>, linux-arm-msm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org
Subject: Re: [PATCH 11/13] mfd: pm8008: rework driver
Mon, May 06, 2024 at 05:08:28PM +0200, Johan Hovold kirjoitti:
> Rework the pm8008 driver to match the new binding which no longer
> describes internal details like interrupts and register offsets
> (including which of the two consecutive I2C addresses the registers
> belong two).
>
> Instead make the interrupt controller implementation internal and pass
> interrupts to the subdrivers using MFD cell resources.
>
> Note that subdrivers may either get their resources, like register block
> offsets, from the parent MFD or this can be included in the subdrivers
> directly.
>
> In the current implementation, the temperature alarm driver is generic
> enough to just get its base address and alarm interrupt from the parent
> driver, which already uses this information to implement the interrupt
> controller.
>
> The regulator driver, however, needs additional information like parent
> supplies and regulator characteristics so in that case it is easier to
> just augment its table with the regulator register base addresses.
>
> Similarly, the current GPIO driver already holds the number of pins and
> that lookup table can therefore also be extended with register offsets.
>
> Note that subdrivers can now access the two regmaps by name, even if the
> primary regmap is registered last so that it's returned by default when
> no name is provided in lookups.
>
> Finally, note that the current QPNP GPIO and temperature alarm
> subdrivers need some minor rework before they can be used with non-SPMI
> devices like the PM8008. The MFD cell names therefore use a "qpnp"
> rather than "spmi" prefix to prevent binding until the drivers have been
> updated.
..
> +static void devm_irq_domain_fwnode_release(void *res)
> +{
> + struct fwnode_handle *fwnode = res;
Unneeded line, can be
static void devm_irq_domain_fwnode_release(void *fwnode)
> + irq_domain_free_fwnode(fwnode);
> +}
..
> + dummy = devm_i2c_new_dummy_device(dev, client->adapter, client->addr + 1);
> + if (IS_ERR(dummy)) {
> + rc = PTR_ERR(dummy);
> + dev_err(&client->dev, "failed to claim second address: %d\n", rc);
> + return rc;
return dev_err_probe(...);
> + }
..
> + name = devm_kasprintf(dev, GFP_KERNEL, "%pOF-internal", dev->of_node);
You are using fwnode for IRQ domain and IRQ domain core uses fwnode, why OF here?
name = devm_kasprintf(dev, GFP_KERNEL, "%pfw-internal", dev_fwnode(dev));
> + if (!name)
> + return -ENOMEM;
> +
> + name = strreplace(name, '/', ':');
> + fwnode = irq_domain_alloc_named_fwnode(name);
> + if (!fwnode)
> + return -ENOMEM;
..
> + rc = devm_regmap_add_irq_chip_fwnode(dev, fwnode, regmap, client->irq,
> IRQF_SHARED, 0, &pm8008_irq_chip, &irq_data);
> - if (rc)
> - dev_err(dev, "failed to add IRQ chip: %d\n", rc);
> + if (rc) {
> + dev_err(dev, "failed to add IRQ chip: %d\n", rc);
> + return rc;
return dev_err_probe(...);
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists