summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-05-06 16:43:02 -0700
committerMax Krummenacher <max.krummenacher@toradex.com>2016-06-24 11:15:45 +0200
commitffa57d218bae244bdde3f4b3f4a77b00e9d3f1de (patch)
tree7c42571b944958ccc471e04329ce75370334583a /drivers
parenta4d2a08f3bfc57ff5d7d1307fb23f52f1e681aca (diff)
mfd: add Ricoh RN5T567 PMIC suppport
The Ricoh RN5T567 is from the same family as the Ricoh RN5T618 is, the differences are: + DCDC4 + Slightly different output voltage/currents + 32kHz Output - ADC/Charger capabilities Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Signed-off-by: Stefan Agner <stefan@agner.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/Kconfig7
-rw-r--r--drivers/mfd/rn5t618.c27
2 files changed, 24 insertions, 10 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 767c3f827b28..fbaa3444ade4 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -753,13 +753,14 @@ config MFD_RK808
including interrupts, RTC, LDO & DCDC regulators, and onkey.
config MFD_RN5T618
- tristate "Ricoh RN5T5618 PMIC"
+ tristate "Ricoh RN5T567/618 PMIC"
depends on I2C
+ depends on OF
select MFD_CORE
select REGMAP_I2C
help
- Say yes here to add support for the Ricoh RN5T618 PMIC. This
- driver provides common support for accessing the device,
+ Say yes here to add support for the Ricoh RN5T567 or R5T618 PMIC.
+ This driver provides common support for accessing the device,
additional drivers must be enabled in order to use the
functionality of the device.
diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c
index 666857192dbe..ccf3ffe1fa33 100644
--- a/drivers/mfd/rn5t618.c
+++ b/drivers/mfd/rn5t618.c
@@ -2,6 +2,7 @@
* MFD core driver for Ricoh RN5T618 PMIC
*
* Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
+ * Copyright (C) 2016 Stefan Agner <stefan.agner@toradex.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -15,6 +16,7 @@
#include <linux/mfd/core.h>
#include <linux/mfd/rn5t618.h>
#include <linux/module.h>
+#include <linux/of_device.h>
#include <linux/regmap.h>
static const struct mfd_cell rn5t618_cells[] = {
@@ -59,12 +61,27 @@ static void rn5t618_power_off(void)
RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF);
}
+static const struct of_device_id rn5t618_of_match[] = {
+ { .compatible = "ricoh,rn5t567", .data = (void *)RN5T567 },
+ { .compatible = "ricoh,rn5t618", .data = (void *)RN5T618 },
+ { }
+};
+MODULE_DEVICE_TABLE(of, rn5t618_of_match);
+
static int rn5t618_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
+ const struct of_device_id *of_id =
+ of_match_device(rn5t618_of_match, &i2c->dev);
struct rn5t618 *priv;
int ret;
+ if (!of_id) {
+ dev_err(&i2c->dev, "Failed to find matching dt id\n");
+ return -EINVAL;
+ }
+
+
priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -78,6 +95,8 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
return ret;
}
+ priv->variant = (long)of_id->data;
+
ret = mfd_add_devices(&i2c->dev, -1, rn5t618_cells,
ARRAY_SIZE(rn5t618_cells), NULL, 0, NULL);
if (ret) {
@@ -106,12 +125,6 @@ static int rn5t618_i2c_remove(struct i2c_client *i2c)
return 0;
}
-static const struct of_device_id rn5t618_of_match[] = {
- { .compatible = "ricoh,rn5t618" },
- { }
-};
-MODULE_DEVICE_TABLE(of, rn5t618_of_match);
-
static const struct i2c_device_id rn5t618_i2c_id[] = {
{ }
};
@@ -130,5 +143,5 @@ static struct i2c_driver rn5t618_i2c_driver = {
module_i2c_driver(rn5t618_i2c_driver);
MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
-MODULE_DESCRIPTION("Ricoh RN5T618 MFD driver");
+MODULE_DESCRIPTION("Ricoh RN5T567/618 MFD driver");
MODULE_LICENSE("GPL v2");