Skip to content
Permalink
Browse files
mfd: pm8008: Add mfd cell struct to register LDOs
Register mfd cell ID and name for each of the 7 pm8008
LDOs to probe them through mfd driver without needing
a separate compatible for regulator driver.

Also, add a different compatible for the mfd node that
contains regulators to make sure that the LDOs are
registered with the correct mfd device.

Signed-off-by: Satya Priya <quic_c_skakit@quicinc.com>
  • Loading branch information
Satya Priya authored and intel-lab-lkp committed Feb 15, 2022
1 parent 60b74bd commit 12b686033a10eae2956b1c8436bfaa8c411baa92
Showing 1 changed file with 24 additions and 2 deletions.
@@ -8,6 +8,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
@@ -27,6 +28,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-regulators"),
};

enum {
PM8008_MISC,
PM8008_TEMP_ALARM,
@@ -35,6 +40,11 @@ enum {
PM8008_NUM_PERIPHS,
};

enum pm8008_type {
PM8008_INFRA,
PM8008_REGULATORS,
};

#define PM8008_PERIPH_0_BASE 0x900
#define PM8008_PERIPH_1_BASE 0x2400
#define PM8008_PERIPH_2_BASE 0xC000
@@ -221,6 +231,7 @@ static int pm8008_probe(struct i2c_client *client)
{
int rc;
struct pm8008_data *chip;
enum pm8008_type type;

chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
@@ -239,13 +250,24 @@ static int pm8008_probe(struct i2c_client *client)
dev_err(chip->dev, "Failed to probe irq periphs: %d\n", rc);
}

type = (uintptr_t) device_get_match_data(chip->dev);
if (type == PM8008_REGULATORS) {
rc = devm_mfd_add_devices(chip->dev, 0, pm8008_regulator_devs,
ARRAY_SIZE(pm8008_regulator_devs), NULL, 0, NULL);
if (rc) {
dev_err(chip->dev, "Failed to add children: %d\n", rc);
return rc;
}
}

return devm_of_platform_populate(chip->dev);
}

static const struct of_device_id pm8008_match[] = {
{ .compatible = "qcom,pm8008", },
{ },
{ .compatible = "qcom,pm8008", .data = (void *)PM8008_INFRA},
{ .compatible = "qcom,pm8008-regulators", .data = (void *)PM8008_REGULATORS},
};
MODULE_DEVICE_TABLE(of, pm8008_match)

static struct i2c_driver pm8008_mfd_driver = {
.driver = {

0 comments on commit 12b6860

Please sign in to comment.