[PATCH V10 6/9] mfd: pm8008: Add mfd_cell struct to register LDOs

From: Satya Priya
Date: Thu Apr 14 2022 - 08:31:51 EST


Add mfd_cell struct to probe LDO regulators using
devm_mfd_add_devices() API.

Signed-off-by: Satya Priya <quic_c_skakit@xxxxxxxxxxx>
---
Changes in V8:
- Split the probe for infra and regulator devices
- Add the reset-gpio toggling in the infra driver probe

Changes in V9:
- Fixed nits.

Changes in V10:
- Removed the extra probe added for regulators as is is not needed now.

drivers/mfd/qcom-pm8008.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
index ca5240d..ab4ba55 100644
--- a/drivers/mfd/qcom-pm8008.c
+++ b/drivers/mfd/qcom-pm8008.c
@@ -9,6 +9,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
+#include <linux/mfd/core.h>
#include <linux/mfd/qcom_pm8008.h>
#include <linux/module.h>
#include <linux/of_device.h>
@@ -29,6 +30,10 @@
#define INT_EN_CLR_OFFSET 0x16
#define INT_LATCHED_STS_OFFSET 0x18

+static const struct mfd_cell pm8008_regulator_devs[] = {
+ MFD_CELL_NAME("qcom-pm8008-regulator"),
+};
+
enum {
PM8008_MISC,
PM8008_TEMP_ALARM,
@@ -282,6 +287,14 @@ static int pm8008_probe(struct i2c_client *client)
}
gpiod_set_value(chip->reset_gpio, 1);

+ rc = devm_mfd_add_devices(&chip->clients[PM8008_REGULATORS_SID]->dev,
+ 0, pm8008_regulator_devs, ARRAY_SIZE(pm8008_regulator_devs),
+ NULL, 0, NULL);
+ if (rc) {
+ dev_err(chip->dev, "Failed to add regulators: %d\n", rc);
+ return rc;
+ }
+
return devm_of_platform_populate(chip->dev);
}

--
2.7.4