Merge remote-tracking branches 'regulator/topic/qcom-spmi', 'regulator/topic/rn5t618', 'regulator/topic/tps65218' and 'regulator/topic/twl' into regulator-next
···11-* Ricoh RN5T618 PMIC11+* Ricoh RN5T567/RN5T618 PMIC2233-Ricoh RN5T618 is a power management IC which integrates 3 step-down44-DCDC converters, 7 low-dropout regulators, a Li-ion battery charger,55-fuel gauge, ADC, GPIOs and a watchdog timer. It can be controlled66-through a I2C interface.33+Ricoh RN5T567/RN5T618 is a power management IC family which integrates44+3 to 4 step-down DCDC converters, 7 low-dropout regulators, GPIOs and55+a watchdog timer. The RN5T618 provides additionally a Li-ion battery66+charger, fuel gauge and an ADC. It can be controlled through an I2C77+interface.7889Required properties:99- - compatible: should be "ricoh,rn5t618"1010+ - compatible: must be one of1111+ "ricoh,rn5t567"1212+ "ricoh,rn5t618"1013 - reg: the I2C slave address of the device11141215Sub-nodes:1316 - regulators: the node is required if the regulator functionality is1414- needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, LDO1,1515- LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2.1717+ needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, DCDC41818+ (RN5T567), LDO1, LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2.1619 The common bindings for each individual regulator can be found in:1720 Documentation/devicetree/bindings/regulator/regulator.txt1821
···852852 including interrupts, RTC, LDO & DCDC regulators, and onkey.853853854854config MFD_RN5T618855855- tristate "Ricoh RN5T5618 PMIC"855855+ tristate "Ricoh RN5T567/618 PMIC"856856 depends on I2C857857+ depends on OF857858 select MFD_CORE858859 select REGMAP_I2C859860 help860860- Say yes here to add support for the Ricoh RN5T618 PMIC. This861861- driver provides common support for accessing the device,861861+ Say yes here to add support for the Ricoh RN5T567 or R5T618 PMIC.862862+ This driver provides common support for accessing the device,862863 additional drivers must be enabled in order to use the863864 functionality of the device.864865
+58-12
drivers/mfd/rn5t618.c
···22 * MFD core driver for Ricoh RN5T618 PMIC33 *44 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>55+ * Copyright (C) 2016 Toradex AG56 *67 * This program is free software; you can redistribute it and/or78 * modify it under the terms of the GNU General Public License···1211 * along with this program. If not, see <http://www.gnu.org/licenses/>.1312 */14131414+#include <linux/delay.h>1515#include <linux/i2c.h>1616#include <linux/mfd/core.h>1717#include <linux/mfd/rn5t618.h>1818#include <linux/module.h>1919+#include <linux/of_device.h>2020+#include <linux/reboot.h>1921#include <linux/regmap.h>20222123static const struct mfd_cell rn5t618_cells[] = {···5248};53495450static struct rn5t618 *rn5t618_pm_power_off;5151+static struct notifier_block rn5t618_restart_handler;55525656-static void rn5t618_power_off(void)5353+static void rn5t618_trigger_poweroff_sequence(bool repower)5754{5855 /* disable automatic repower-on */5956 regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_REPCNT,6060- RN5T618_REPCNT_REPWRON, 0);5757+ RN5T618_REPCNT_REPWRON,5858+ repower ? RN5T618_REPCNT_REPWRON : 0);6159 /* start power-off sequence */6260 regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_SLPCNT,6361 RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF);6462}65636464+static void rn5t618_power_off(void)6565+{6666+ rn5t618_trigger_poweroff_sequence(false);6767+}6868+6969+static int rn5t618_restart(struct notifier_block *this,7070+ unsigned long mode, void *cmd)7171+{7272+ rn5t618_trigger_poweroff_sequence(true);7373+7474+ /*7575+ * Re-power factor detection on PMIC side is not instant. 1ms7676+ * proved to be enough time until reset takes effect.7777+ */7878+ mdelay(1);7979+8080+ return NOTIFY_DONE;8181+}8282+8383+static const struct of_device_id rn5t618_of_match[] = {8484+ { .compatible = "ricoh,rn5t567", .data = (void *)RN5T567 },8585+ { .compatible = "ricoh,rn5t618", .data = (void *)RN5T618 },8686+ { }8787+};8888+MODULE_DEVICE_TABLE(of, rn5t618_of_match);8989+6690static int rn5t618_i2c_probe(struct i2c_client *i2c,6791 const struct i2c_device_id *id)6892{9393+ const struct of_device_id *of_id;6994 struct rn5t618 *priv;7095 int ret;9696+9797+ of_id = of_match_device(rn5t618_of_match, &i2c->dev);9898+ if (!of_id) {9999+ dev_err(&i2c->dev, "Failed to find matching DT ID\n");100100+ return -EINVAL;101101+ }7110272103 priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL);73104 if (!priv)74105 return -ENOMEM;7510676107 i2c_set_clientdata(i2c, priv);108108+ priv->variant = (long)of_id->data;7710978110 priv->regmap = devm_regmap_init_i2c(i2c, &rn5t618_regmap_config);79111 if (IS_ERR(priv->regmap)) {···12585 return ret;12686 }12787128128- if (!pm_power_off) {129129- rn5t618_pm_power_off = priv;130130- pm_power_off = rn5t618_power_off;8888+ rn5t618_pm_power_off = priv;8989+ if (of_device_is_system_power_controller(i2c->dev.of_node)) {9090+ if (!pm_power_off)9191+ pm_power_off = rn5t618_power_off;9292+ else9393+ dev_warn(&i2c->dev, "Poweroff callback already assigned\n");9494+ }9595+9696+ rn5t618_restart_handler.notifier_call = rn5t618_restart;9797+ rn5t618_restart_handler.priority = 192;9898+9999+ ret = register_restart_handler(&rn5t618_restart_handler);100100+ if (ret) {101101+ dev_err(&i2c->dev, "cannot register restart handler, %d\n", ret);102102+ return ret;131103 }132104133105 return 0;···156104157105 return 0;158106}159159-160160-static const struct of_device_id rn5t618_of_match[] = {161161- { .compatible = "ricoh,rn5t618" },162162- { }163163-};164164-MODULE_DEVICE_TABLE(of, rn5t618_of_match);165107166108static const struct i2c_device_id rn5t618_i2c_id[] = {167109 { }···175129module_i2c_driver(rn5t618_i2c_driver);176130177131MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");178178-MODULE_DESCRIPTION("Ricoh RN5T618 MFD driver");132132+MODULE_DESCRIPTION("Ricoh RN5T567/618 MFD driver");179133MODULE_LICENSE("GPL v2");
+3-2
drivers/regulator/Kconfig
···645645 outputs which can be controlled by i2c communication.646646647647config REGULATOR_RN5T618648648- tristate "Ricoh RN5T618 voltage regulators"648648+ tristate "Ricoh RN5T567/618 voltage regulators"649649 depends on MFD_RN5T618650650 help651651- Say y here to support the regulators found on Ricoh RN5T618 PMIC.651651+ Say y here to support the regulators found on Ricoh RN5T567 or652652+ RN5T618 PMIC.652653653654config REGULATOR_RT5033654655 tristate "Richtek RT5033 Regulators"
···246246 * @name: Voltage regulator name247247 * @min_uV: minimum micro volts248248 * @max_uV: minimum micro volts249249+ * @strobe: sequencing strobe value for the regulator249250 *250251 * This data is used to check the regualtor voltage limits while setting.251252 */···255254 const char *name;256255 int min_uV;257256 int max_uV;257257+ int strobe;258258};259259260260/**