From: Shree Ramamoorthy <s-ramamoorthy@ti.com>
To: <lgirdwood@gmail.com>, <broonie@kernel.org>, <robh@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>,
<aaro.koskinen@iki.fi>, <andreas@kemnade.info>,
<khilman@baylibre.com>, <rogerq@kernel.org>, <tony@atomide.com>,
<jerome.neanne@baylibre.com>, <linux-omap@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>
Cc: <m-leonard@ti.com>, <praneeth@ti.com>
Subject: [PATCH v1 5/7] regulator: tps65215: Add chip_data struct for multi-PMIC support
Date: Thu, 26 Dec 2024 15:54:10 -0600 [thread overview]
Message-ID: <20241226215412.395822-6-s-ramamoorthy@ti.com> (raw)
In-Reply-To: <20241226215412.395822-1-s-ramamoorthy@ti.com>
'chipid' will identify which PMIC to support, and the corresponding
chip_data struct element to use in probe(). The chip_data struct is helpful
for any new PMICs added to this driver. The goal is to add future PMIC info
to necessary structs and minimize probe() function edits.
Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@ti.com>
---
drivers/regulator/tps65219-regulator.c | 32 ++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index 2c49613400e1..13f0e68d8e85 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -314,6 +314,39 @@ static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data)
return IRQ_HANDLED;
}
+struct chip_data {
+ size_t common_irq_size;
+ size_t common_rdesc_size;
+
+ size_t dev_irq_size
+ size_t rdesc_size;
+ struct tps65219_regulator_irq_type *common_irq_types;
+ struct tps65219_regulator_irq_type *irq_types;
+ const struct regulator_desc *common_rdesc;
+ const struct regulator_desc *rdesc;
+};
+
+static struct chip_data chip_info_table[] = {
+ [TPS65219] = {
+ .rdesc = tps65219_regs,
+ .rdesc_size = ARRAY_SIZE(tps65219_regs),
+ .common_rdesc = common_regs,
+ .common_rdesc_size = ARRAY_SIZE(common_regs),
+ .irq_types = tps65219_regulator_irq_types,
+ .dev_irq_size = ARRAY_SIZE(tps65219_regulator_irq_types),
+ .common_irq_types = common_regulator_irq_types,
+ .common_irq_size = ARRAY_SIZE(common_regulator_irq_types),
+ },
+ [TPS65215] = {
+ .rdesc = tps65215_regs,
+ .rdesc_size = ARRAY_SIZE(tps65215_regs),
+ .common_rdesc = common_regs,
+ .common_rdesc_size = ARRAY_SIZE(common_regs),
+ .common_irq_types = common_regulator_irq_types,
+ .common_irq_size = ARRAY_SIZE(common_regulator_irq_types),
+ },
+};
+
static int tps65219_regulator_probe(struct platform_device *pdev)
{
struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
--
2.34.1
next prev parent reply other threads:[~2024-12-26 21:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-26 21:54 [PATCH v1 0/7] Add TI TPS65215 PMIC Regulator Support Shree Ramamoorthy
2024-12-26 21:54 ` [PATCH v1 1/7] regulator: dt-bindings: Add TI TPS65215 PMIC bindings Shree Ramamoorthy
2024-12-27 17:45 ` Conor Dooley
2025-01-04 18:28 ` Roger Quadros
2024-12-26 21:54 ` [PATCH v1 2/7] regulator: tps65215: Update platform_device_id table Shree Ramamoorthy
2025-01-01 10:49 ` Christophe JAILLET
2024-12-26 21:54 ` [PATCH v1 3/7] regulator: tps65215: Update function & struct names Shree Ramamoorthy
2025-01-04 18:35 ` Roger Quadros
2024-12-26 21:54 ` [PATCH v1 4/7] regulator: tps65215: Update IRQ structs to include TPS65215 Shree Ramamoorthy
2024-12-26 21:54 ` Shree Ramamoorthy [this message]
2024-12-26 21:54 ` [PATCH v1 6/7] regulator: tps65215: Define probe() helper functions Shree Ramamoorthy
2025-01-01 11:01 ` Christophe JAILLET
2025-01-02 23:41 ` Shree Ramamoorthy
2025-01-03 13:10 ` Christophe JAILLET
2025-01-04 18:42 ` Roger Quadros
2025-01-04 18:45 ` Roger Quadros
2025-01-06 22:02 ` Shree Ramamoorthy
2025-01-06 22:57 ` Andrew Davis
2025-01-07 21:09 ` Shree Ramamoorthy
2024-12-26 21:54 ` [PATCH v1 7/7] regulator: tps65215: Restructure probe() for multi-PMIC support Shree Ramamoorthy
2025-01-01 11:04 ` Christophe JAILLET
2025-01-02 23:46 ` Shree Ramamoorthy
2025-01-04 18:47 ` Roger Quadros
2025-01-07 21:12 ` Shree Ramamoorthy
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=20241226215412.395822-6-s-ramamoorthy@ti.com \
--to=s-ramamoorthy@ti.com \
--cc=aaro.koskinen@iki.fi \
--cc=andreas@kemnade.info \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jerome.neanne@baylibre.com \
--cc=khilman@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=m-leonard@ti.com \
--cc=praneeth@ti.com \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=tony@atomide.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