[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250103230446.197597-5-s-ramamoorthy@ti.com>
Date: Fri, 3 Jan 2025 17:04:43 -0600
From: Shree Ramamoorthy <s-ramamoorthy@...com>
To: <lgirdwood@...il.com>, <broonie@...nel.org>, <robh@...nel.org>,
<krzk+dt@...nel.org>, <conor+dt@...nel.org>, <aaro.koskinen@....fi>,
<andreas@...nade.info>, <khilman@...libre.com>, <rogerq@...nel.org>,
<tony@...mide.com>, <jerome.neanne@...libre.com>,
<linux-omap@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<devicetree@...r.kernel.org>
CC: <m-leonard@...com>, <praneeth@...com>, <christophe.jaillet@...adoo.fr>
Subject: [PATCH v2 4/7] regulator: tps65215: Add chip_data struct for multi-PMIC support
'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@...com>
---
drivers/regulator/tps65219-regulator.c | 33 ++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index eddb22d0758a..30928f1f216f 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
+
//
// Regulator driver for TPS65215/TPS65219 PMIC
//
@@ -314,6 +315,38 @@ static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data)
return IRQ_HANDLED;
}
+struct tps65219_chip_data {
+ size_t common_irq_size;
+ size_t rdesc_size;
+ size_t common_rdesc_size;
+ size_t dev_irq_size;
+ const struct regulator_desc *rdesc;
+ const struct regulator_desc *common_rdesc;
+ struct tps65219_regulator_irq_type *irq_types;
+ struct tps65219_regulator_irq_type *common_irq_types;
+};
+
+static struct tps65219_chip_data chip_info_table[] = {
+ [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),
+ },
+ [TPS65219] = {
+ .rdesc = tps65219_regs,
+ .rdesc_size = ARRAY_SIZE(tps65219_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),
+ .irq_types = tps65219_regulator_irq_types,
+ .dev_irq_size = ARRAY_SIZE(tps65219_regulator_irq_types),
+ },
+};
+
static int tps65219_regulator_probe(struct platform_device *pdev)
{
struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
--
2.34.1
Powered by blists - more mailing lists