From ffa57d218bae244bdde3f4b3f4a77b00e9d3f1de Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 6 May 2016 16:43:02 -0700 Subject: 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 Signed-off-by: Stefan Agner --- drivers/mfd/Kconfig | 7 ++++--- drivers/mfd/rn5t618.c | 27 ++++++++++++++++++++------- 2 files changed, 24 insertions(+), 10 deletions(-) (limited to 'drivers') 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 + * Copyright (C) 2016 Stefan Agner * * 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 #include #include +#include #include 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 "); -MODULE_DESCRIPTION("Ricoh RN5T618 MFD driver"); +MODULE_DESCRIPTION("Ricoh RN5T567/618 MFD driver"); MODULE_LICENSE("GPL v2"); -- cgit v1.2.3