Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: rn5t618: Add Ricoh RN5T567 PMIC support

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

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Stefan Agner and committed by
Lee Jones
a99ab50d 229d641d

+45 -18
+11 -8
Documentation/devicetree/bindings/mfd/rn5t618.txt
··· 1 - * Ricoh RN5T618 PMIC 1 + * Ricoh RN5T567/RN5T618 PMIC 2 2 3 - Ricoh RN5T618 is a power management IC which integrates 3 step-down 4 - DCDC converters, 7 low-dropout regulators, a Li-ion battery charger, 5 - fuel gauge, ADC, GPIOs and a watchdog timer. It can be controlled 6 - through a I2C interface. 3 + Ricoh RN5T567/RN5T618 is a power management IC family which integrates 4 + 3 to 4 step-down DCDC converters, 7 low-dropout regulators, GPIOs and 5 + a watchdog timer. The RN5T618 provides additionally a Li-ion battery 6 + charger, fuel gauge and an ADC. It can be controlled through an I2C 7 + interface. 7 8 8 9 Required properties: 9 - - compatible: should be "ricoh,rn5t618" 10 + - compatible: must be one of 11 + "ricoh,rn5t567" 12 + "ricoh,rn5t618" 10 13 - reg: the I2C slave address of the device 11 14 12 15 Sub-nodes: 13 16 - regulators: the node is required if the regulator functionality is 14 - needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, LDO1, 15 - LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2. 17 + needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, DCDC4 18 + (RN5T567), LDO1, LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2. 16 19 The common bindings for each individual regulator can be found in: 17 20 Documentation/devicetree/bindings/regulator/regulator.txt 18 21
+4 -3
drivers/mfd/Kconfig
··· 852 852 including interrupts, RTC, LDO & DCDC regulators, and onkey. 853 853 854 854 config MFD_RN5T618 855 - tristate "Ricoh RN5T5618 PMIC" 855 + tristate "Ricoh RN5T567/618 PMIC" 856 856 depends on I2C 857 + depends on OF 857 858 select MFD_CORE 858 859 select REGMAP_I2C 859 860 help 860 - Say yes here to add support for the Ricoh RN5T618 PMIC. This 861 - driver provides common support for accessing the device, 861 + Say yes here to add support for the Ricoh RN5T567 or R5T618 PMIC. 862 + This driver provides common support for accessing the device, 862 863 additional drivers must be enabled in order to use the 863 864 functionality of the device. 864 865
+18 -7
drivers/mfd/rn5t618.c
··· 2 2 * MFD core driver for Ricoh RN5T618 PMIC 3 3 * 4 4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com> 5 + * Copyright (C) 2016 Toradex AG 5 6 * 6 7 * This program is free software; you can redistribute it and/or 7 8 * modify it under the terms of the GNU General Public License ··· 16 15 #include <linux/mfd/core.h> 17 16 #include <linux/mfd/rn5t618.h> 18 17 #include <linux/module.h> 18 + #include <linux/of_device.h> 19 19 #include <linux/regmap.h> 20 20 21 21 static const struct mfd_cell rn5t618_cells[] = { ··· 61 59 RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF); 62 60 } 63 61 62 + static const struct of_device_id rn5t618_of_match[] = { 63 + { .compatible = "ricoh,rn5t567", .data = (void *)RN5T567 }, 64 + { .compatible = "ricoh,rn5t618", .data = (void *)RN5T618 }, 65 + { } 66 + }; 67 + MODULE_DEVICE_TABLE(of, rn5t618_of_match); 68 + 64 69 static int rn5t618_i2c_probe(struct i2c_client *i2c, 65 70 const struct i2c_device_id *id) 66 71 { 72 + const struct of_device_id *of_id; 67 73 struct rn5t618 *priv; 68 74 int ret; 75 + 76 + of_id = of_match_device(rn5t618_of_match, &i2c->dev); 77 + if (!of_id) { 78 + dev_err(&i2c->dev, "Failed to find matching DT ID\n"); 79 + return -EINVAL; 80 + } 69 81 70 82 priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); 71 83 if (!priv) 72 84 return -ENOMEM; 73 85 74 86 i2c_set_clientdata(i2c, priv); 87 + priv->variant = (long)of_id->data; 75 88 76 89 priv->regmap = devm_regmap_init_i2c(i2c, &rn5t618_regmap_config); 77 90 if (IS_ERR(priv->regmap)) { ··· 122 105 return 0; 123 106 } 124 107 125 - static const struct of_device_id rn5t618_of_match[] = { 126 - { .compatible = "ricoh,rn5t618" }, 127 - { } 128 - }; 129 - MODULE_DEVICE_TABLE(of, rn5t618_of_match); 130 - 131 108 static const struct i2c_device_id rn5t618_i2c_id[] = { 132 109 { } 133 110 }; ··· 140 129 module_i2c_driver(rn5t618_i2c_driver); 141 130 142 131 MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>"); 143 - MODULE_DESCRIPTION("Ricoh RN5T618 MFD driver"); 132 + MODULE_DESCRIPTION("Ricoh RN5T567/618 MFD driver"); 144 133 MODULE_LICENSE("GPL v2");
+12
include/linux/mfd/rn5t618.h
··· 20 20 #define RN5T618_OTPVER 0x01 21 21 #define RN5T618_IODAC 0x02 22 22 #define RN5T618_VINDAC 0x03 23 + #define RN5T618_OUT32KEN 0x05 23 24 #define RN5T618_CPUCNT 0x06 24 25 #define RN5T618_PSWR 0x07 25 26 #define RN5T618_PONHIS 0x09 ··· 39 38 #define RN5T618_DC1_SLOT 0x16 40 39 #define RN5T618_DC2_SLOT 0x17 41 40 #define RN5T618_DC3_SLOT 0x18 41 + #define RN5T618_DC4_SLOT 0x19 42 42 #define RN5T618_LDO1_SLOT 0x1b 43 43 #define RN5T618_LDO2_SLOT 0x1c 44 44 #define RN5T618_LDO3_SLOT 0x1d ··· 56 54 #define RN5T618_DC2CTL2 0x2f 57 55 #define RN5T618_DC3CTL 0x30 58 56 #define RN5T618_DC3CTL2 0x31 57 + #define RN5T618_DC4CTL 0x32 58 + #define RN5T618_DC4CTL2 0x33 59 59 #define RN5T618_DC1DAC 0x36 60 60 #define RN5T618_DC2DAC 0x37 61 61 #define RN5T618_DC3DAC 0x38 62 + #define RN5T618_DC4DAC 0x39 62 63 #define RN5T618_DC1DAC_SLP 0x3b 63 64 #define RN5T618_DC2DAC_SLP 0x3c 64 65 #define RN5T618_DC3DAC_SLP 0x3d 66 + #define RN5T618_DC4DAC_SLP 0x3e 65 67 #define RN5T618_DCIREN 0x40 66 68 #define RN5T618_DCIRQ 0x41 67 69 #define RN5T618_DCIRMON 0x42 ··· 227 221 RN5T618_REG_NUM, 228 222 }; 229 223 224 + enum { 225 + RN5T567 = 0, 226 + RN5T618, 227 + }; 228 + 230 229 struct rn5t618 { 231 230 struct regmap *regmap; 231 + long variant; 232 232 }; 233 233 234 234 #endif /* __LINUX_MFD_RN5T618_H */