@@ -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);
'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(+)