devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Satya Priya <quic_c_skakit@quicinc.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Das Srinagesh <gurus@codeaurora.org>,
	<linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <swboyd@chromium.org>,
	<quic_collinsd@quicinc.com>, <quic_subbaram@quicinc.com>,
	<quic_jprakash@quicinc.com>,
	Satya Priya <quic_c_skakit@quicinc.com>
Subject: [PATCH V7 2/5] mfd: pm8008: Add mfd cell struct to register LDOs
Date: Fri, 18 Feb 2022 16:31:00 +0530	[thread overview]
Message-ID: <1645182064-15843-3-git-send-email-quic_c_skakit@quicinc.com> (raw)
In-Reply-To: <1645182064-15843-1-git-send-email-quic_c_skakit@quicinc.com>

Add mfd cell struct with regulator driver name to match
with the pm8008 regulator driver and probe the LDOs.

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>
---
Changes in V5:
 - Changes newly added from V5.

Changes in V6:
 - Changed the mfd_cell struct to have only name of the regulator driver.
 - Using device_get_match_data() instead of of_match_node() to match data.
 - Fixed few nits.

Changes in V7:
 - Fixed minor errors.

 drivers/mfd/qcom-pm8008.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
index c472d7f..6cfb267 100644
--- a/drivers/mfd/qcom-pm8008.c
+++ b/drivers/mfd/qcom-pm8008.c
@@ -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,25 @@ 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 = {
-- 
2.7.4


  parent reply	other threads:[~2022-02-18 11:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18 11:00 [PATCH V7 0/5] Add Qualcomm Technologies, Inc. PM8008 regulator driver Satya Priya
2022-02-18 11:00 ` [PATCH V7 1/5] dt-bindings: mfd: pm8008: Add pm8008 regulators Satya Priya
2022-02-19  1:39   ` Stephen Boyd
2022-02-28 14:14     ` Satya Priya Kakitapalli (Temp)
2022-02-28 20:31       ` Stephen Boyd
2022-02-18 11:01 ` Satya Priya [this message]
2022-02-18 11:01 ` [PATCH V7 3/5] regulator: Add a regulator driver for the PM8008 PMIC Satya Priya
2022-02-19  1:50   ` Stephen Boyd
2022-02-28 14:18     ` Satya Priya Kakitapalli (Temp)
2022-02-18 11:01 ` [PATCH V7 4/5] arm64: dts: qcom: pm8008: Add base dts file Satya Priya
2022-02-19  1:57   ` Stephen Boyd
2022-02-28 14:18     ` Satya Priya Kakitapalli (Temp)
2022-02-18 11:01 ` [PATCH V7 5/5] arm64: dts: qcom: sc7280: Add pm8008 support for sc7280-idp Satya Priya
2022-02-19  2:01   ` Stephen Boyd
2022-02-28 14:25     ` Satya Priya Kakitapalli (Temp)
2022-02-28 20:36       ` Stephen Boyd
2022-03-07 14:49         ` Satya Priya Kakitapalli (Temp)
2022-03-08 20:50           ` Stephen Boyd

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=1645182064-15843-3-git-send-email-quic_c_skakit@quicinc.com \
    --to=quic_c_skakit@quicinc.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gurus@codeaurora.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_collinsd@quicinc.com \
    --cc=quic_jprakash@quicinc.com \
    --cc=quic_subbaram@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=swboyd@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).