mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Subject: [PATCH 4/9] mfd: da9063: add device specific init function
Date: Thu, 12 Apr 2018 09:22:26 +0200	[thread overview]
Message-ID: <20180412072231.31207-5-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20180412072231.31207-1-s.hauer@pengutronix.de>

From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>

Provide some more information about the used PMIC type; later patches
will add support for DA9062 which needs a custom init function.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Tested-by: Stefan Christ <s.christ@phytec.de>
Signed-off-by: Christian Hemp <c.hemp@phytec.de>
---
 drivers/mfd/da9063.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/da9063.c b/drivers/mfd/da9063.c
index 4f09bd384e..a1c748610a 100644
--- a/drivers/mfd/da9063.c
+++ b/drivers/mfd/da9063.c
@@ -52,6 +52,10 @@ struct da9063 {
 #define DA9063_WATCHDOG		0x01
 #define DA9063_SHUTDOWN		0x02
 
+struct da906x_device_data {
+	int	(*init)(struct da9063 *priv);
+};
+
 static int da906x_reg_update(struct da9063 *priv, unsigned int reg,
 			     uint8_t mask, uint8_t val)
 {
@@ -182,8 +186,13 @@ static void da9063_restart(struct restart_handler *rst)
 static int da9063_probe(struct device_d *dev)
 {
 	struct da9063 *priv = NULL;
+	struct da906x_device_data const *dev_data;
+	void const *dev_data_tmp;
 	int ret;
 
+	ret = dev_get_drvdata(dev, &dev_data_tmp);
+	dev_data = ret < 0 ? NULL : dev_data_tmp;
+
 	priv = xzalloc(sizeof(struct da9063));
 	priv->wd.priority = of_get_watchdog_priority(dev->device_node);
 	priv->wd.set_timeout = da9063_watchdog_set_timeout;
@@ -192,6 +201,12 @@ static int da9063_probe(struct device_d *dev)
 	priv->client = to_i2c_client(dev);
 	priv->dev = dev;
 
+	if (dev_data && dev_data->init) {
+		ret = dev_data->init(priv);
+		if (ret < 0)
+			goto on_error;
+	}
+
 	ret = watchdog_register(&priv->wd);
 	if (ret)
 		goto on_error;
@@ -213,7 +228,7 @@ on_error:
 }
 
 static struct platform_device_id da9063_id[] = {
-        { "da9063", },
+	{ "da9063", (uintptr_t)(NULL) },
 	{ }
 };
 
-- 
2.16.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-04-12  7:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12  7:22 [PATCH 0/9] Dialog da9063 updates Sascha Hauer
2018-04-12  7:22 ` [PATCH 1/9] mfd: da9063: reset watchdog timer Sascha Hauer
2018-04-12  7:22 ` [PATCH 2/9] mfd: da9063: added generic reg_update() function Sascha Hauer
2018-04-12  7:22 ` [PATCH 3/9] mfd: da9063: use da906x_reg_update() Sascha Hauer
2018-04-12  7:22 ` Sascha Hauer [this message]
2018-04-12  7:22 ` [PATCH 5/9] mfd: da9063: added of_device_id information Sascha Hauer
2018-04-12  7:22 ` [PATCH 6/9] mfd: da9063: read out and report device id Sascha Hauer
2018-04-12  7:22 ` [PATCH 7/9] mfd: da9063: update Kconfig for DA9062 Sascha Hauer
2018-04-12  7:22 ` [PATCH 8/9] ARM: i.MX: phycore-som: added and enabled DA9062 PMIC Sascha Hauer
2018-04-12  7:22 ` [PATCH 9/9] ARM: i.MX: pfla02: set priority of da9063 watchdog Sascha Hauer

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=20180412072231.31207-5-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=enrico.scholz@sigma-chemnitz.de \
    /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