From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: devnull+samuel.kayode.savoirfairelinux.com@kernel.org
Cc: Frank.li@nxp.com, abelvesa@kernel.org, abelvesa@linux.com,
b38343@freescale.com, broonie@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org, dmitry.torokhov@gmail.com,
eballetbo@gmail.com, imx@lists.linux.dev, krzk+dt@kernel.org,
lee@kernel.org, lgirdwood@gmail.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
robh@kernel.org, samuel.kayode@savoirfairelinux.com,
sre@kernel.org, yibin.gong@nxp.com
Subject: Re: [PATCH v8 2/6] mfd: pf1550: add core driver
Date: Tue, 8 Jul 2025 20:46:48 +0200 [thread overview]
Message-ID: <0406698c-6534-4aca-8994-e8a69ecee2b2@wanadoo.fr> (raw)
In-Reply-To: <20250707-pf1550-v8-2-6b6eb67c03a0@savoirfairelinux.com>
Le 07/07/2025 à 23:37, Samuel Kayode via B4 Relay a écrit :
> From: Samuel Kayode <samuel.kayode-4ysUXcep3aM1wj+D4I0NRVaTQe2KTcn/@public.gmane.org>
>
> Add the core driver for pf1550 PMIC. There are 3 subdevices for which the
> drivers will be added in subsequent patches.
>
> Reviewed-by: Frank Li <Frank.Li-3arQi8VN3Tc@public.gmane.org>
> Signed-off-by: Samuel Kayode <samuel.kayode-4ysUXcep3aM1wj+D4I0NRVaTQe2KTcn/@public.gmane.org>
Hi,
some nitpicks and a few real questions.
CJ
...
> + /* Add top level interrupts */
> + ret = devm_regmap_add_irq_chip(pf1550->dev, pf1550->regmap, pf1550->irq,
> + IRQF_ONESHOT | IRQF_SHARED |
> + IRQF_TRIGGER_FALLING,
> + 0, &pf1550_irq_chip,
> + &pf1550->irq_data);
> + if (ret)
> + return ret;
> +
> + /* Add regulator */
> + irq = regmap_irq_get_virq(pf1550->irq_data, PF1550_IRQ_REGULATOR);
Same as above.
> + if (irq < 0)
> + return dev_err_probe(pf1550->dev, irq,
> + "Failed to get parent vIRQ(%d) for chip %s\n",
> + PF1550_IRQ_REGULATOR, pf1550_irq_chip.name);
> +
> + ret = devm_regmap_add_irq_chip(pf1550->dev, pf1550->regmap, irq,
> + IRQF_ONESHOT | IRQF_SHARED |
> + IRQF_TRIGGER_FALLING, 0,
> + &pf1550_regulator_irq_chip,
> + &pf1550->irq_data_regulator);
> + if (ret)
> + return dev_err_probe(pf1550->dev, ret,
> + "Failed to add %s IRQ chip\n",
> + pf1550_regulator_irq_chip.name);
> +
> + domain = regmap_irq_get_domain(pf1550->irq_data_regulator);
> +
> + ret = devm_mfd_add_devices(pf1550->dev, PLATFORM_DEVID_NONE, regulator,
2 spaces after =
> + 1, NULL, 0, domain);
> + if (ret)
> + return ret;
> +
> + /* Add onkey */
> + irq = regmap_irq_get_virq(pf1550->irq_data, PF1550_IRQ_ONKEY);
Same
> + if (irq < 0)
> + return dev_err_probe(pf1550->dev, irq,
> + "Failed to get parent vIRQ(%d) for chip %s\n",
> + PF1550_IRQ_ONKEY, pf1550_irq_chip.name);
> +
> + ret = devm_regmap_add_irq_chip(pf1550->dev, pf1550->regmap, irq,
> + IRQF_ONESHOT | IRQF_SHARED |
> + IRQF_TRIGGER_FALLING, 0,
> + &pf1550_onkey_irq_chip,
> + &pf1550->irq_data_onkey);
> + if (ret)
> + return dev_err_probe(pf1550->dev, ret,
> + "Failed to add %s IRQ chip\n",
> + pf1550_onkey_irq_chip.name);
> +
> + domain = regmap_irq_get_domain(pf1550->irq_data_onkey);
> +
> + ret = devm_mfd_add_devices(pf1550->dev, PLATFORM_DEVID_NONE, onkey, 1,
2 spaces after =
> + NULL, 0, domain);
> + if (ret)
> + return ret;
> +
> + /* Add battery charger */
> + irq = regmap_irq_get_virq(pf1550->irq_data, PF1550_IRQ_CHG);
This calls irq_create_mapping().
Should irq_dispose_mapping() or another helper be called in the error
handling path and in the remove function, or is it already handled by a
devm_ function?
> + if (irq < 0)
> + return dev_err_probe(pf1550->dev, irq,
> + "Failed to get parent vIRQ(%d) for chip %s\n",
> + PF1550_IRQ_CHG, pf1550_irq_chip.name);
> +
> + ret = devm_regmap_add_irq_chip(pf1550->dev, pf1550->regmap, irq,
> + IRQF_ONESHOT | IRQF_SHARED |
> + IRQF_TRIGGER_FALLING, 0,
> + &pf1550_charger_irq_chip,
> + &pf1550->irq_data_charger);
> + if (ret)
> + return dev_err_probe(pf1550->dev, ret,
> + "Failed to add %s IRQ chip\n",
> + pf1550_charger_irq_chip.name);
> +
> + domain = regmap_irq_get_domain(pf1550->irq_data_charger);
> +
> + return devm_mfd_add_devices(pf1550->dev, PLATFORM_DEVID_NONE, charger,
> + 1, NULL, 0, domain);
> +}
> +
> +static int pf1550_suspend(struct device *dev)
> +{
> + struct pf1550_ddata *pf1550 = dev_get_drvdata(dev);
> +
> + if (device_may_wakeup(dev)) {
> + enable_irq_wake(pf1550->irq);
> + disable_irq(pf1550->irq);
> + }
> +
> + return 0;
> +}
> +
> +static int pf1550_resume(struct device *dev)
> +{
> + struct pf1550_ddata *pf1550 = dev_get_drvdata(dev);
> +
> + if (device_may_wakeup(dev)) {
> + disable_irq_wake(pf1550->irq);
> + enable_irq(pf1550->irq);
Should this 2 lines be inverted?
> + }
> +
> + return 0;
> +}
...
> +#define PF1550_CHG_LINEAR_ONLY 12
> +#define PF1550_CHG_SNS_MASK 0xf
> +#define PF1550_CHG_INT_MASK 0x51
Space vs tab
> +
> +#define PF1550_BAT_NO_VBUS 0
> +#define PF1550_BAT_LOW_THAN_PRECHARG 1
...
CJ
next prev parent reply other threads:[~2025-07-08 18:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 21:37 [PATCH v8 0/6] add support for pf1550 PMIC MFD-based drivers Samuel Kayode via B4 Relay
2025-07-07 21:37 ` [PATCH v8 1/6] dt-bindings: mfd: add pf1550 Samuel Kayode via B4 Relay
2025-07-07 21:37 ` [PATCH v8 2/6] mfd: pf1550: add core driver Samuel Kayode via B4 Relay
2025-07-08 18:46 ` Christophe JAILLET [this message]
2025-07-10 14:08 ` Samuel Kayode
2025-07-10 14:54 ` Sean Nyekjaer
2025-07-10 17:11 ` Samuel Kayode
2025-07-07 21:37 ` [PATCH v8 3/6] regulator: pf1550: add support for regulator Samuel Kayode via B4 Relay
2025-07-10 14:49 ` Sean Nyekjaer
2025-07-10 17:01 ` Samuel Kayode
2025-07-10 17:11 ` Sean Nyekjaer
2025-07-10 17:29 ` Samuel Kayode
2025-07-11 10:04 ` Sean Nyekjaer
2025-07-07 21:37 ` [PATCH v8 4/6] input: pf1550: add onkey support Samuel Kayode via B4 Relay
2025-07-11 10:29 ` Sean Nyekjaer
2025-07-07 21:37 ` [PATCH v8 5/6] power: supply: pf1550: add battery charger support Samuel Kayode via B4 Relay
2025-07-11 9:02 ` Sean Nyekjaer
2025-07-11 16:27 ` Samuel Kayode
2025-07-07 21:37 ` [PATCH v8 6/6] MAINTAINERS: add an entry for pf1550 mfd driver Samuel Kayode via B4 Relay
2025-07-10 17:06 ` Samuel Kayode
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=0406698c-6534-4aca-8994-e8a69ecee2b2@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=Frank.li@nxp.com \
--cc=abelvesa@kernel.org \
--cc=abelvesa@linux.com \
--cc=b38343@freescale.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+samuel.kayode.savoirfairelinux.com@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=eballetbo@gmail.com \
--cc=imx@lists.linux.dev \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh@kernel.org \
--cc=samuel.kayode@savoirfairelinux.com \
--cc=sre@kernel.org \
--cc=yibin.gong@nxp.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
all inboxes | Powered by JetHome®