2019-03-25 23:31:55 +03:00
// SPDX-License-Identifier: GPL-2.0+
//
// Regulator driver for DA9063 PMIC series
//
// Copyright 2012 Dialog Semiconductors Ltd.
// Copyright 2013 Philipp Zabel, Pengutronix
//
// Author: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
2014-02-12 13:57:52 +04:00
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
# include <linux/kernel.h>
# include <linux/module.h>
# include <linux/init.h>
# include <linux/err.h>
# include <linux/slab.h>
# include <linux/of.h>
# include <linux/platform_device.h>
# include <linux/regmap.h>
# include <linux/regulator/driver.h>
# include <linux/regulator/machine.h>
# include <linux/regulator/of_regulator.h>
# include <linux/mfd/da9063/core.h>
# include <linux/mfd/da9063/registers.h>
/* Definition for registering regmap bit fields using a mask */
# define BFIELD(_reg, _mask) \
REG_FIELD ( _reg , __builtin_ffs ( ( int ) _mask ) - 1 , \
sizeof ( unsigned int ) * 8 - __builtin_clz ( ( _mask ) ) - 1 )
2019-05-20 12:34:45 +03:00
/* DA9063 and DA9063L regulator IDs */
enum {
/* BUCKs */
DA9063_ID_BCORE1 ,
DA9063_ID_BCORE2 ,
DA9063_ID_BPRO ,
DA9063_ID_BMEM ,
DA9063_ID_BIO ,
DA9063_ID_BPERI ,
/* BCORE1 and BCORE2 in merged mode */
DA9063_ID_BCORES_MERGED ,
/* BMEM and BIO in merged mode */
DA9063_ID_BMEM_BIO_MERGED ,
/* When two BUCKs are merged, they cannot be reused separately */
/* LDOs on both DA9063 and DA9063L */
DA9063_ID_LDO3 ,
DA9063_ID_LDO7 ,
DA9063_ID_LDO8 ,
DA9063_ID_LDO9 ,
DA9063_ID_LDO11 ,
/* DA9063-only LDOs */
DA9063_ID_LDO1 ,
DA9063_ID_LDO2 ,
DA9063_ID_LDO4 ,
DA9063_ID_LDO5 ,
DA9063_ID_LDO6 ,
DA9063_ID_LDO10 ,
} ;
/* Old regulator platform data */
struct da9063_regulator_data {
int id ;
struct regulator_init_data * initdata ;
} ;
struct da9063_regulators_pdata {
2020-02-06 16:48:37 +03:00
unsigned int n_regulators ;
2019-05-20 12:34:45 +03:00
struct da9063_regulator_data * regulator_data ;
} ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
/* Regulator capabilities and registers description */
struct da9063_regulator_info {
struct regulator_desc desc ;
/* DA9063 main register fields */
struct reg_field mode ; /* buck mode of operation */
struct reg_field suspend ;
struct reg_field sleep ;
struct reg_field suspend_sleep ;
unsigned int suspend_vsel_reg ;
/* DA9063 event detection bit */
struct reg_field oc_event ;
2023-04-05 20:14:34 +03:00
/* DA9063 voltage monitor bit */
struct reg_field vmon ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ;
/* Macros for LDO */
# define DA9063_LDO(chip, regl_name, min_mV, step_mV, max_mV) \
. desc . id = chip # # _ID_ # # regl_name , \
. desc . name = __stringify ( chip # # _ # # regl_name ) , \
. desc . ops = & da9063_ldo_ops , \
. desc . min_uV = ( min_mV ) * 1000 , \
. desc . uV_step = ( step_mV ) * 1000 , \
2014-02-12 13:57:52 +04:00
. desc . n_voltages = ( ( ( max_mV ) - ( min_mV ) ) / ( step_mV ) + 1 \
+ ( DA9063_V # # regl_name # # _BIAS ) ) , \
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
. desc . enable_reg = DA9063_REG_ # # regl_name # # _CONT , \
. desc . enable_mask = DA9063_LDO_EN , \
. desc . vsel_reg = DA9063_REG_V # # regl_name # # _A , \
. desc . vsel_mask = DA9063_V # # regl_name # # _MASK , \
. desc . linear_min_sel = DA9063_V # # regl_name # # _BIAS , \
. sleep = BFIELD ( DA9063_REG_V # # regl_name # # _A , DA9063_LDO_SL ) , \
2020-03-17 19:14:26 +03:00
. suspend = BFIELD ( DA9063_REG_ # # regl_name # # _CONT , DA9063_LDO_CONF ) , \
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
. suspend_sleep = BFIELD ( DA9063_REG_V # # regl_name # # _B , DA9063_LDO_SL ) , \
. suspend_vsel_reg = DA9063_REG_V # # regl_name # # _B
/* Macros for voltage DC/DC converters (BUCKs) */
2019-03-04 16:16:03 +03:00
# define DA9063_BUCK(chip, regl_name, min_mV, step_mV, max_mV, limits_array, \
creg , cmask ) \
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
. desc . id = chip # # _ID_ # # regl_name , \
. desc . name = __stringify ( chip # # _ # # regl_name ) , \
. desc . ops = & da9063_buck_ops , \
. desc . min_uV = ( min_mV ) * 1000 , \
. desc . uV_step = ( step_mV ) * 1000 , \
. desc . n_voltages = ( ( max_mV ) - ( min_mV ) ) / ( step_mV ) + 1 , \
2019-03-04 16:16:03 +03:00
. desc . csel_reg = ( creg ) , \
. desc . csel_mask = ( cmask ) , \
. desc . curr_table = limits_array , \
. desc . n_current_limits = ARRAY_SIZE ( limits_array )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
# define DA9063_BUCK_COMMON_FIELDS(regl_name) \
. desc . enable_reg = DA9063_REG_ # # regl_name # # _CONT , \
. desc . enable_mask = DA9063_BUCK_EN , \
. desc . vsel_reg = DA9063_REG_V # # regl_name # # _A , \
. desc . vsel_mask = DA9063_VBUCK_MASK , \
. desc . linear_min_sel = DA9063_VBUCK_BIAS , \
. sleep = BFIELD ( DA9063_REG_V # # regl_name # # _A , DA9063_BUCK_SL ) , \
2020-03-17 19:14:26 +03:00
. suspend = BFIELD ( DA9063_REG_ # # regl_name # # _CONT , DA9063_BUCK_CONF ) , \
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
. suspend_sleep = BFIELD ( DA9063_REG_V # # regl_name # # _B , DA9063_BUCK_SL ) , \
. suspend_vsel_reg = DA9063_REG_V # # regl_name # # _B , \
. mode = BFIELD ( DA9063_REG_ # # regl_name # # _CFG , DA9063_BUCK_MODE_MASK )
/* Defines asignment of regulators info table to chip model */
struct da9063_dev_model {
const struct da9063_regulator_info * regulator_info ;
2020-02-06 16:48:37 +03:00
unsigned int n_regulators ;
2018-06-11 14:58:45 +03:00
enum da9063_type type ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ;
/* Single regulator settings */
struct da9063_regulator {
struct regulator_desc desc ;
struct regulator_dev * rdev ;
struct da9063 * hw ;
const struct da9063_regulator_info * info ;
struct regmap_field * mode ;
struct regmap_field * suspend ;
struct regmap_field * sleep ;
struct regmap_field * suspend_sleep ;
2023-04-05 20:14:34 +03:00
struct regmap_field * vmon ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ;
/* Encapsulates all information for the regulators driver */
struct da9063_regulators {
2020-02-06 16:48:37 +03:00
unsigned int n_regulators ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
/* Array size to be defined during init. Keep at end. */
2020-02-12 02:47:10 +03:00
struct da9063_regulator regulator [ ] ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ;
/* BUCK modes for DA9063 */
enum {
BUCK_MODE_MANUAL , /* 0 */
BUCK_MODE_SLEEP , /* 1 */
BUCK_MODE_SYNC , /* 2 */
BUCK_MODE_AUTO /* 3 */
} ;
/* Regulator operations */
2020-02-06 16:48:37 +03:00
/*
* Current limits array ( in uA ) for BCORE1 , BCORE2 , BPRO .
* Entry indexes corresponds to register values .
*/
2019-03-04 16:16:03 +03:00
static const unsigned int da9063_buck_a_limits [ ] = {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
500000 , 600000 , 700000 , 800000 , 900000 , 1000000 , 1100000 , 1200000 ,
1300000 , 1400000 , 1500000 , 1600000 , 1700000 , 1800000 , 1900000 , 2000000
} ;
2020-02-06 16:48:37 +03:00
/*
* Current limits array ( in uA ) for BMEM , BIO , BPERI .
* Entry indexes corresponds to register values .
*/
2019-03-04 16:16:03 +03:00
static const unsigned int da9063_buck_b_limits [ ] = {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
1500000 , 1600000 , 1700000 , 1800000 , 1900000 , 2000000 , 2100000 , 2200000 ,
2300000 , 2400000 , 2500000 , 2600000 , 2700000 , 2800000 , 2900000 , 3000000
} ;
2020-02-06 16:48:37 +03:00
/*
* Current limits array ( in uA ) for merged BCORE1 and BCORE2 .
* Entry indexes corresponds to register values .
*/
2019-03-04 16:16:03 +03:00
static const unsigned int da9063_bcores_merged_limits [ ] = {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
1000000 , 1200000 , 1400000 , 1600000 , 1800000 , 2000000 , 2200000 , 2400000 ,
2600000 , 2800000 , 3000000 , 3200000 , 3400000 , 3600000 , 3800000 , 4000000
} ;
2020-02-06 16:48:37 +03:00
/*
* Current limits array ( in uA ) for merged BMEM and BIO .
* Entry indexes corresponds to register values .
*/
2019-03-04 16:16:03 +03:00
static const unsigned int da9063_bmem_bio_merged_limits [ ] = {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
3000000 , 3200000 , 3400000 , 3600000 , 3800000 , 4000000 , 4200000 , 4400000 ,
4600000 , 4800000 , 5000000 , 5200000 , 5400000 , 5600000 , 5800000 , 6000000
} ;
2023-04-05 20:14:35 +03:00
static int da9063_set_xvp ( struct regulator_dev * rdev , int lim_uV , int severity , bool enable )
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
struct device * dev = regl - > hw - > dev ;
dev_dbg ( dev , " %s: lim: %d, sev: %d, en: %d \n " , regl - > desc . name , lim_uV , severity , enable ) ;
/*
* only support enable and disable .
* the da9063 offers a GPIO ( GP_FB2 ) which is unasserted if an XV happens .
* therefore ignore severity here , as there might be handlers in hardware .
*/
if ( lim_uV )
return - EINVAL ;
return regmap_field_write ( regl - > vmon , enable ? 1 : 0 ) ;
}
2020-02-06 16:48:37 +03:00
static int da9063_buck_set_mode ( struct regulator_dev * rdev , unsigned int mode )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
2020-02-06 16:48:37 +03:00
unsigned int val ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
switch ( mode ) {
case REGULATOR_MODE_FAST :
val = BUCK_MODE_SYNC ;
break ;
case REGULATOR_MODE_NORMAL :
val = BUCK_MODE_AUTO ;
break ;
case REGULATOR_MODE_STANDBY :
val = BUCK_MODE_SLEEP ;
break ;
default :
return - EINVAL ;
}
return regmap_field_write ( regl - > mode , val ) ;
}
/*
* Bucks use single mode register field for normal operation
* and suspend state .
* There are 3 modes to map to : FAST , NORMAL , and STANDBY .
*/
2020-02-06 16:48:37 +03:00
static unsigned int da9063_buck_get_mode ( struct regulator_dev * rdev )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
2019-09-26 08:51:28 +03:00
unsigned int val ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
int ret ;
ret = regmap_field_read ( regl - > mode , & val ) ;
if ( ret < 0 )
return ret ;
switch ( val ) {
default :
case BUCK_MODE_MANUAL :
/* Sleep flag bit decides the mode */
break ;
case BUCK_MODE_SLEEP :
return REGULATOR_MODE_STANDBY ;
case BUCK_MODE_SYNC :
return REGULATOR_MODE_FAST ;
case BUCK_MODE_AUTO :
return REGULATOR_MODE_NORMAL ;
}
2020-03-24 12:25:16 +03:00
ret = regmap_field_read ( regl - > sleep , & val ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
if ( ret < 0 )
return 0 ;
if ( val )
2019-09-26 08:51:28 +03:00
return REGULATOR_MODE_STANDBY ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
else
2019-09-26 08:51:28 +03:00
return REGULATOR_MODE_FAST ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
}
/*
* LDOs use sleep flags - one for normal and one for suspend state .
* There are 2 modes to map to : NORMAL and STANDBY ( sleep ) for each state .
*/
2020-02-06 16:48:37 +03:00
static int da9063_ldo_set_mode ( struct regulator_dev * rdev , unsigned int mode )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
2020-02-06 16:48:37 +03:00
unsigned int val ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
switch ( mode ) {
case REGULATOR_MODE_NORMAL :
val = 0 ;
break ;
case REGULATOR_MODE_STANDBY :
val = 1 ;
break ;
default :
return - EINVAL ;
}
return regmap_field_write ( regl - > sleep , val ) ;
}
2020-02-06 16:48:37 +03:00
static unsigned int da9063_ldo_get_mode ( struct regulator_dev * rdev )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
int ret , val ;
2020-03-24 12:25:16 +03:00
ret = regmap_field_read ( regl - > sleep , & val ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
if ( ret < 0 )
return 0 ;
if ( val )
return REGULATOR_MODE_STANDBY ;
else
return REGULATOR_MODE_NORMAL ;
}
static int da9063_buck_get_status ( struct regulator_dev * rdev )
{
int ret = regulator_is_enabled_regmap ( rdev ) ;
if ( ret = = 0 ) {
ret = REGULATOR_STATUS_OFF ;
} else if ( ret > 0 ) {
ret = da9063_buck_get_mode ( rdev ) ;
if ( ret > 0 )
ret = regulator_mode_to_status ( ret ) ;
else if ( ret = = 0 )
ret = - EIO ;
}
return ret ;
}
static int da9063_ldo_get_status ( struct regulator_dev * rdev )
{
int ret = regulator_is_enabled_regmap ( rdev ) ;
if ( ret = = 0 ) {
ret = REGULATOR_STATUS_OFF ;
} else if ( ret > 0 ) {
ret = da9063_ldo_get_mode ( rdev ) ;
if ( ret > 0 )
ret = regulator_mode_to_status ( ret ) ;
else if ( ret = = 0 )
ret = - EIO ;
}
return ret ;
}
static int da9063_set_suspend_voltage ( struct regulator_dev * rdev , int uV )
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
const struct da9063_regulator_info * rinfo = regl - > info ;
int ret , sel ;
sel = regulator_map_voltage_linear ( rdev , uV , uV ) ;
if ( sel < 0 )
2014-02-18 14:41:05 +04:00
return sel ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
sel < < = ffs ( rdev - > desc - > vsel_mask ) - 1 ;
ret = regmap_update_bits ( regl - > hw - > regmap , rinfo - > suspend_vsel_reg ,
rdev - > desc - > vsel_mask , sel ) ;
return ret ;
}
static int da9063_suspend_enable ( struct regulator_dev * rdev )
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
return regmap_field_write ( regl - > suspend , 1 ) ;
}
static int da9063_suspend_disable ( struct regulator_dev * rdev )
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
return regmap_field_write ( regl - > suspend , 0 ) ;
}
2020-02-06 16:48:37 +03:00
static int da9063_buck_set_suspend_mode ( struct regulator_dev * rdev ,
unsigned int mode )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
int val ;
switch ( mode ) {
case REGULATOR_MODE_FAST :
val = BUCK_MODE_SYNC ;
break ;
case REGULATOR_MODE_NORMAL :
val = BUCK_MODE_AUTO ;
break ;
case REGULATOR_MODE_STANDBY :
val = BUCK_MODE_SLEEP ;
break ;
default :
return - EINVAL ;
}
return regmap_field_write ( regl - > mode , val ) ;
}
2020-02-06 16:48:37 +03:00
static int da9063_ldo_set_suspend_mode ( struct regulator_dev * rdev ,
unsigned int mode )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
2020-02-06 16:48:37 +03:00
unsigned int val ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
switch ( mode ) {
case REGULATOR_MODE_NORMAL :
val = 0 ;
break ;
case REGULATOR_MODE_STANDBY :
val = 1 ;
break ;
default :
return - EINVAL ;
}
return regmap_field_write ( regl - > suspend_sleep , val ) ;
}
2021-07-13 10:20:31 +03:00
static unsigned int da9063_get_overdrive_mask ( const struct regulator_desc * desc )
{
switch ( desc - > id ) {
case DA9063_ID_BCORES_MERGED :
case DA9063_ID_BCORE1 :
return DA9063_BCORE1_OD ;
case DA9063_ID_BCORE2 :
return DA9063_BCORE2_OD ;
case DA9063_ID_BPRO :
return DA9063_BPRO_OD ;
default :
return 0 ;
}
}
static int da9063_buck_set_limit_set_overdrive ( struct regulator_dev * rdev ,
int min_uA , int max_uA ,
unsigned int overdrive_mask )
{
/*
* When enabling overdrive , do it before changing the current limit to
* ensure sufficient supply throughout the switch .
*/
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
int ret ;
unsigned int orig_overdrive ;
ret = regmap_read ( regl - > hw - > regmap , DA9063_REG_CONFIG_H ,
& orig_overdrive ) ;
if ( ret < 0 )
return ret ;
orig_overdrive & = overdrive_mask ;
if ( orig_overdrive = = 0 ) {
ret = regmap_set_bits ( regl - > hw - > regmap , DA9063_REG_CONFIG_H ,
overdrive_mask ) ;
if ( ret < 0 )
return ret ;
}
ret = regulator_set_current_limit_regmap ( rdev , min_uA / 2 , max_uA / 2 ) ;
if ( ret < 0 & & orig_overdrive = = 0 )
/*
* regulator_set_current_limit_regmap may have rejected the
* change because of unusable min_uA and / or max_uA inputs .
* Attempt to restore original overdrive state , ignore failure -
* on - failure .
*/
regmap_clear_bits ( regl - > hw - > regmap , DA9063_REG_CONFIG_H ,
overdrive_mask ) ;
return ret ;
}
static int da9063_buck_set_limit_clear_overdrive ( struct regulator_dev * rdev ,
int min_uA , int max_uA ,
unsigned int overdrive_mask )
{
/*
* When disabling overdrive , do it after changing the current limit to
* ensure sufficient supply throughout the switch .
*/
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
int ret , orig_limit ;
ret = regmap_read ( rdev - > regmap , rdev - > desc - > csel_reg , & orig_limit ) ;
if ( ret < 0 )
return ret ;
ret = regulator_set_current_limit_regmap ( rdev , min_uA , max_uA ) ;
if ( ret < 0 )
return ret ;
ret = regmap_clear_bits ( regl - > hw - > regmap , DA9063_REG_CONFIG_H ,
overdrive_mask ) ;
if ( ret < 0 )
/*
* Attempt to restore original current limit , ignore failure -
* on - failure .
*/
regmap_write ( rdev - > regmap , rdev - > desc - > csel_reg , orig_limit ) ;
return ret ;
}
static int da9063_buck_set_current_limit ( struct regulator_dev * rdev ,
int min_uA , int max_uA )
{
unsigned int overdrive_mask , n_currents ;
overdrive_mask = da9063_get_overdrive_mask ( rdev - > desc ) ;
if ( overdrive_mask ) {
n_currents = rdev - > desc - > n_current_limits ;
if ( n_currents = = 0 )
return - EINVAL ;
if ( max_uA > rdev - > desc - > curr_table [ n_currents - 1 ] )
return da9063_buck_set_limit_set_overdrive ( rdev , min_uA ,
max_uA ,
overdrive_mask ) ;
return da9063_buck_set_limit_clear_overdrive ( rdev , min_uA ,
max_uA ,
overdrive_mask ) ;
}
return regulator_set_current_limit_regmap ( rdev , min_uA , max_uA ) ;
}
static int da9063_buck_get_current_limit ( struct regulator_dev * rdev )
{
struct da9063_regulator * regl = rdev_get_drvdata ( rdev ) ;
int val , ret , limit ;
unsigned int mask ;
limit = regulator_get_current_limit_regmap ( rdev ) ;
if ( limit < 0 )
return limit ;
mask = da9063_get_overdrive_mask ( rdev - > desc ) ;
if ( mask ) {
ret = regmap_read ( regl - > hw - > regmap , DA9063_REG_CONFIG_H , & val ) ;
if ( ret < 0 )
return ret ;
if ( val & mask )
limit * = 2 ;
}
return limit ;
}
2015-12-19 18:07:09 +03:00
static const struct regulator_ops da9063_buck_ops = {
2023-04-05 20:14:35 +03:00
. enable = regulator_enable_regmap ,
. disable = regulator_disable_regmap ,
. is_enabled = regulator_is_enabled_regmap ,
. get_voltage_sel = regulator_get_voltage_sel_regmap ,
. set_voltage_sel = regulator_set_voltage_sel_regmap ,
. list_voltage = regulator_list_voltage_linear ,
. set_current_limit = da9063_buck_set_current_limit ,
. get_current_limit = da9063_buck_get_current_limit ,
. set_mode = da9063_buck_set_mode ,
. get_mode = da9063_buck_get_mode ,
. get_status = da9063_buck_get_status ,
. set_suspend_voltage = da9063_set_suspend_voltage ,
. set_suspend_enable = da9063_suspend_enable ,
. set_suspend_disable = da9063_suspend_disable ,
. set_suspend_mode = da9063_buck_set_suspend_mode ,
. set_over_voltage_protection = da9063_set_xvp ,
. set_under_voltage_protection = da9063_set_xvp ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ;
2015-12-19 18:07:09 +03:00
static const struct regulator_ops da9063_ldo_ops = {
2023-04-05 20:14:35 +03:00
. enable = regulator_enable_regmap ,
. disable = regulator_disable_regmap ,
. is_enabled = regulator_is_enabled_regmap ,
. get_voltage_sel = regulator_get_voltage_sel_regmap ,
. set_voltage_sel = regulator_set_voltage_sel_regmap ,
. list_voltage = regulator_list_voltage_linear ,
. set_mode = da9063_ldo_set_mode ,
. get_mode = da9063_ldo_get_mode ,
. get_status = da9063_ldo_get_status ,
. set_suspend_voltage = da9063_set_suspend_voltage ,
. set_suspend_enable = da9063_suspend_enable ,
. set_suspend_disable = da9063_suspend_disable ,
. set_suspend_mode = da9063_ldo_set_suspend_mode ,
. set_over_voltage_protection = da9063_set_xvp ,
. set_under_voltage_protection = da9063_set_xvp ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ;
/* Info of regulators for DA9063 */
static const struct da9063_regulator_info da9063_regulator_info [ ] = {
{
DA9063_BUCK ( DA9063 , BCORE1 , 300 , 10 , 1570 ,
2019-03-04 16:16:03 +03:00
da9063_buck_a_limits ,
DA9063_REG_BUCK_ILIM_C , DA9063_BCORE1_ILIM_MASK ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
DA9063_BUCK_COMMON_FIELDS ( BCORE1 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_4 , DA9063_BCORE1_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_BUCK ( DA9063 , BCORE2 , 300 , 10 , 1570 ,
2019-03-04 16:16:03 +03:00
da9063_buck_a_limits ,
DA9063_REG_BUCK_ILIM_C , DA9063_BCORE2_ILIM_MASK ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
DA9063_BUCK_COMMON_FIELDS ( BCORE2 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_4 , DA9063_BCORE2_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_BUCK ( DA9063 , BPRO , 530 , 10 , 1800 ,
2019-03-04 16:16:03 +03:00
da9063_buck_a_limits ,
DA9063_REG_BUCK_ILIM_B , DA9063_BPRO_ILIM_MASK ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
DA9063_BUCK_COMMON_FIELDS ( BPRO ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_4 , DA9063_BPRO_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_BUCK ( DA9063 , BMEM , 800 , 20 , 3340 ,
2019-03-04 16:16:03 +03:00
da9063_buck_b_limits ,
DA9063_REG_BUCK_ILIM_A , DA9063_BMEM_ILIM_MASK ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
DA9063_BUCK_COMMON_FIELDS ( BMEM ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_4 , DA9063_BMEM_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_BUCK ( DA9063 , BIO , 800 , 20 , 3340 ,
2019-03-04 16:16:03 +03:00
da9063_buck_b_limits ,
DA9063_REG_BUCK_ILIM_A , DA9063_BIO_ILIM_MASK ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
DA9063_BUCK_COMMON_FIELDS ( BIO ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_4 , DA9063_BIO_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_BUCK ( DA9063 , BPERI , 800 , 20 , 3340 ,
2019-03-04 16:16:03 +03:00
da9063_buck_b_limits ,
DA9063_REG_BUCK_ILIM_B , DA9063_BPERI_ILIM_MASK ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
DA9063_BUCK_COMMON_FIELDS ( BPERI ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_4 , DA9063_BPERI_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_BUCK ( DA9063 , BCORES_MERGED , 300 , 10 , 1570 ,
2019-03-04 16:16:03 +03:00
da9063_bcores_merged_limits ,
DA9063_REG_BUCK_ILIM_C , DA9063_BCORE1_ILIM_MASK ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
/* BCORES_MERGED uses the same register fields as BCORE1 */
DA9063_BUCK_COMMON_FIELDS ( BCORE1 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_4 , DA9063_BCORE1_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_BUCK ( DA9063 , BMEM_BIO_MERGED , 800 , 20 , 3340 ,
2019-03-04 16:16:03 +03:00
da9063_bmem_bio_merged_limits ,
DA9063_REG_BUCK_ILIM_A , DA9063_BMEM_ILIM_MASK ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
/* BMEM_BIO_MERGED uses the same register fields as BMEM */
DA9063_BUCK_COMMON_FIELDS ( BMEM ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_4 , DA9063_BMEM_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
2018-06-11 14:58:50 +03:00
{
DA9063_LDO ( DA9063 , LDO3 , 900 , 20 , 3440 ) ,
. oc_event = BFIELD ( DA9063_REG_STATUS_D , DA9063_LDO3_LIM ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_2 , DA9063_LDO3_MON_EN ) ,
2018-06-11 14:58:50 +03:00
} ,
{
DA9063_LDO ( DA9063 , LDO7 , 900 , 50 , 3600 ) ,
. oc_event = BFIELD ( DA9063_REG_STATUS_D , DA9063_LDO7_LIM ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_2 , DA9063_LDO7_MON_EN ) ,
2018-06-11 14:58:50 +03:00
} ,
{
DA9063_LDO ( DA9063 , LDO8 , 900 , 50 , 3600 ) ,
. oc_event = BFIELD ( DA9063_REG_STATUS_D , DA9063_LDO8_LIM ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_2 , DA9063_LDO8_MON_EN ) ,
2018-06-11 14:58:50 +03:00
} ,
{
DA9063_LDO ( DA9063 , LDO9 , 950 , 50 , 3600 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_3 , DA9063_LDO9_MON_EN ) ,
2018-06-11 14:58:50 +03:00
} ,
{
DA9063_LDO ( DA9063 , LDO11 , 900 , 50 , 3600 ) ,
. oc_event = BFIELD ( DA9063_REG_STATUS_D , DA9063_LDO11_LIM ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_3 , DA9063_LDO11_MON_EN ) ,
2018-06-11 14:58:50 +03:00
} ,
/* The following LDOs are present only on DA9063, not on DA9063L */
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
DA9063_LDO ( DA9063 , LDO1 , 600 , 20 , 1860 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_2 , DA9063_LDO1_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_LDO ( DA9063 , LDO2 , 600 , 20 , 1860 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_2 , DA9063_LDO2_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_LDO ( DA9063 , LDO4 , 900 , 20 , 3440 ) ,
. oc_event = BFIELD ( DA9063_REG_STATUS_D , DA9063_LDO4_LIM ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_2 , DA9063_LDO4_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_LDO ( DA9063 , LDO5 , 900 , 50 , 3600 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_2 , DA9063_LDO5_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
{
DA9063_LDO ( DA9063 , LDO6 , 900 , 50 , 3600 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_2 , DA9063_LDO6_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
2018-06-11 14:58:50 +03:00
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
DA9063_LDO ( DA9063 , LDO10 , 900 , 50 , 3600 ) ,
2023-04-05 20:14:34 +03:00
. vmon = BFIELD ( DA9063_BB_REG_MON_REG_3 , DA9063_LDO10_MON_EN ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
} ;
/* Link chip model with regulators info table */
static struct da9063_dev_model regulators_models [ ] = {
{
. regulator_info = da9063_regulator_info ,
. n_regulators = ARRAY_SIZE ( da9063_regulator_info ) ,
2018-06-11 14:58:45 +03:00
. type = PMIC_TYPE_DA9063 ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
2018-06-11 14:58:50 +03:00
{
. regulator_info = da9063_regulator_info ,
. n_regulators = ARRAY_SIZE ( da9063_regulator_info ) - 6 ,
. type = PMIC_TYPE_DA9063L ,
} ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{ }
} ;
/* Regulator interrupt handlers */
2013-09-01 08:19:51 +04:00
static irqreturn_t da9063_ldo_lim_event ( int irq , void * data )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
{
struct da9063_regulators * regulators = data ;
struct da9063 * hw = regulators - > regulator [ 0 ] . hw ;
struct da9063_regulator * regl ;
2020-02-06 16:48:37 +03:00
int bits , i , ret ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
ret = regmap_read ( hw - > regmap , DA9063_REG_STATUS_D , & bits ) ;
if ( ret < 0 )
return IRQ_NONE ;
for ( i = regulators - > n_regulators - 1 ; i > = 0 ; i - - ) {
regl = & regulators - > regulator [ i ] ;
if ( regl - > info - > oc_event . reg ! = DA9063_REG_STATUS_D )
continue ;
2019-02-26 18:23:02 +03:00
if ( BIT ( regl - > info - > oc_event . lsb ) & bits ) {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
regulator_notifier_call_chain ( regl - > rdev ,
REGULATOR_EVENT_OVER_CURRENT , NULL ) ;
2019-02-26 18:23:02 +03:00
}
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
}
return IRQ_HANDLED ;
}
/*
* Probing and Initialisation functions
*/
static const struct regulator_init_data * da9063_get_regulator_initdata (
const struct da9063_regulators_pdata * regl_pdata , int id )
{
int i ;
for ( i = 0 ; i < regl_pdata - > n_regulators ; i + + ) {
if ( id = = regl_pdata - > regulator_data [ i ] . id )
return regl_pdata - > regulator_data [ i ] . initdata ;
}
return NULL ;
}
2023-04-05 20:14:35 +03:00
static int da9063_check_xvp_constraints ( struct regulator_config * config )
{
struct da9063_regulator * regl = config - > driver_data ;
const struct regulation_constraints * constr = & config - > init_data - > constraints ;
const struct notification_limit * uv_l = & constr - > under_voltage_limits ;
const struct notification_limit * ov_l = & constr - > over_voltage_limits ;
/* make sure that only one severity is used to clarify if unchanged, enabled or disabled */
if ( ( ! ! uv_l - > prot + ! ! uv_l - > err + ! ! uv_l - > warn ) > 1 ) {
dev_err ( config - > dev , " %s: at most one voltage monitoring severity allowed! \n " ,
regl - > desc . name ) ;
return - EINVAL ;
}
/* make sure that UV and OV monitoring is set to the same severity and value */
if ( uv_l - > prot ! = ov_l - > prot ) {
dev_err ( config - > dev ,
" %s: protection-microvolt: value must be equal for uv and ov! \n " ,
regl - > desc . name ) ;
return - EINVAL ;
}
if ( uv_l - > err ! = ov_l - > err ) {
dev_err ( config - > dev , " %s: error-microvolt: value must be equal for uv and ov! \n " ,
regl - > desc . name ) ;
return - EINVAL ;
}
if ( uv_l - > warn ! = ov_l - > warn ) {
dev_err ( config - > dev , " %s: warn-microvolt: value must be equal for uv and ov! \n " ,
regl - > desc . name ) ;
return - EINVAL ;
}
return 0 ;
}
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
static struct of_regulator_match da9063_matches [ ] = {
[ DA9063_ID_BCORE1 ] = { . name = " bcore1 " } ,
[ DA9063_ID_BCORE2 ] = { . name = " bcore2 " } ,
[ DA9063_ID_BPRO ] = { . name = " bpro " , } ,
[ DA9063_ID_BMEM ] = { . name = " bmem " , } ,
[ DA9063_ID_BIO ] = { . name = " bio " , } ,
[ DA9063_ID_BPERI ] = { . name = " bperi " , } ,
[ DA9063_ID_BCORES_MERGED ] = { . name = " bcores-merged " } ,
[ DA9063_ID_BMEM_BIO_MERGED ] = { . name = " bmem-bio-merged " , } ,
2018-06-11 14:58:50 +03:00
[ DA9063_ID_LDO3 ] = { . name = " ldo3 " , } ,
[ DA9063_ID_LDO7 ] = { . name = " ldo7 " , } ,
[ DA9063_ID_LDO8 ] = { . name = " ldo8 " , } ,
[ DA9063_ID_LDO9 ] = { . name = " ldo9 " , } ,
[ DA9063_ID_LDO11 ] = { . name = " ldo11 " , } ,
/* The following LDOs are present only on DA9063, not on DA9063L */
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
[ DA9063_ID_LDO1 ] = { . name = " ldo1 " , } ,
[ DA9063_ID_LDO2 ] = { . name = " ldo2 " , } ,
[ DA9063_ID_LDO4 ] = { . name = " ldo4 " , } ,
[ DA9063_ID_LDO5 ] = { . name = " ldo5 " , } ,
[ DA9063_ID_LDO6 ] = { . name = " ldo6 " , } ,
[ DA9063_ID_LDO10 ] = { . name = " ldo10 " , } ,
} ;
static struct da9063_regulators_pdata * da9063_parse_regulators_dt (
struct platform_device * pdev ,
struct of_regulator_match * * da9063_reg_matches )
{
2018-06-11 14:58:50 +03:00
struct da9063 * da9063 = dev_get_drvdata ( pdev - > dev . parent ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
struct da9063_regulators_pdata * pdata ;
struct da9063_regulator_data * rdata ;
struct device_node * node ;
2018-06-11 14:58:50 +03:00
int da9063_matches_len = ARRAY_SIZE ( da9063_matches ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
int i , n , num ;
2018-06-11 14:58:50 +03:00
if ( da9063 - > type = = PMIC_TYPE_DA9063L )
da9063_matches_len - = 6 ;
2014-02-14 15:49:58 +04:00
node = of_get_child_by_name ( pdev - > dev . parent - > of_node , " regulators " ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
if ( ! node ) {
dev_err ( & pdev - > dev , " Regulators device node not found \n " ) ;
return ERR_PTR ( - ENODEV ) ;
}
num = of_regulator_match ( & pdev - > dev , node , da9063_matches ,
2018-06-11 14:58:50 +03:00
da9063_matches_len ) ;
2014-02-17 13:03:31 +04:00
of_node_put ( node ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
if ( num < 0 ) {
dev_err ( & pdev - > dev , " Failed to match regulators \n " ) ;
return ERR_PTR ( - EINVAL ) ;
}
pdata = devm_kzalloc ( & pdev - > dev , sizeof ( * pdata ) , GFP_KERNEL ) ;
if ( ! pdata )
return ERR_PTR ( - ENOMEM ) ;
treewide: devm_kzalloc() -> devm_kcalloc()
The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
This patch replaces cases of:
devm_kzalloc(handle, a * b, gfp)
with:
devm_kcalloc(handle, a * b, gfp)
as well as handling cases of:
devm_kzalloc(handle, a * b * c, gfp)
with:
devm_kzalloc(handle, array3_size(a, b, c), gfp)
as it's slightly less ugly than:
devm_kcalloc(handle, array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
devm_kzalloc(handle, 4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
Some manual whitespace fixes were needed in this patch, as Coccinelle
really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
expression HANDLE;
type TYPE;
expression THING, E;
@@
(
devm_kzalloc(HANDLE,
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
devm_kzalloc(HANDLE,
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression HANDLE;
expression COUNT;
typedef u8;
typedef __u8;
@@
(
devm_kzalloc(HANDLE,
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
expression HANDLE;
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
expression HANDLE;
identifier SIZE, COUNT;
@@
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression HANDLE;
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression HANDLE;
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
expression HANDLE;
identifier STRIDE, SIZE, COUNT;
@@
(
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression HANDLE;
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE,
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression HANDLE;
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
|
devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
|
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE, C1 * C2, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * E2
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * (E2)
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-13 00:07:58 +03:00
pdata - > regulator_data = devm_kcalloc ( & pdev - > dev ,
num , sizeof ( * pdata - > regulator_data ) ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
GFP_KERNEL ) ;
if ( ! pdata - > regulator_data )
return ERR_PTR ( - ENOMEM ) ;
pdata - > n_regulators = num ;
n = 0 ;
2018-06-11 14:58:50 +03:00
for ( i = 0 ; i < da9063_matches_len ; i + + ) {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
if ( ! da9063_matches [ i ] . init_data )
continue ;
rdata = & pdata - > regulator_data [ n ] ;
rdata - > id = i ;
rdata - > initdata = da9063_matches [ i ] . init_data ;
n + + ;
2015-09-11 05:26:57 +03:00
}
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
* da9063_reg_matches = da9063_matches ;
return pdata ;
}
static int da9063_regulator_probe ( struct platform_device * pdev )
{
struct da9063 * da9063 = dev_get_drvdata ( pdev - > dev . parent ) ;
2013-09-09 15:49:27 +04:00
struct of_regulator_match * da9063_reg_matches = NULL ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
struct da9063_regulators_pdata * regl_pdata ;
const struct da9063_dev_model * model ;
struct da9063_regulators * regulators ;
struct da9063_regulator * regl ;
struct regulator_config config ;
bool bcores_merged , bmem_bio_merged ;
int id , irq , n , n_regulators , ret , val ;
2019-05-20 12:34:44 +03:00
regl_pdata = da9063_parse_regulators_dt ( pdev , & da9063_reg_matches ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
if ( IS_ERR ( regl_pdata ) | | regl_pdata - > n_regulators = = 0 ) {
dev_err ( & pdev - > dev ,
" No regulators defined for the platform \n " ) ;
2017-08-30 17:03:58 +03:00
return - ENODEV ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
}
/* Find regulators set for particular device model */
for ( model = regulators_models ; model - > regulator_info ; model + + ) {
2018-06-11 14:58:45 +03:00
if ( model - > type = = da9063 - > type )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
break ;
}
if ( ! model - > regulator_info ) {
dev_err ( & pdev - > dev , " Chip model not recognised (%u) \n " ,
2018-06-11 14:58:45 +03:00
da9063 - > type ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
return - ENODEV ;
}
ret = regmap_read ( da9063 - > regmap , DA9063_REG_CONFIG_H , & val ) ;
if ( ret < 0 ) {
dev_err ( & pdev - > dev ,
" Error while reading BUCKs configuration \n " ) ;
2014-02-18 14:41:05 +04:00
return ret ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
}
bcores_merged = val & DA9063_BCORE_MERGE ;
bmem_bio_merged = val & DA9063_BUCK_MERGE ;
n_regulators = model - > n_regulators ;
if ( bcores_merged )
n_regulators - = 2 ; /* remove BCORE1, BCORE2 */
else
n_regulators - - ; /* remove BCORES_MERGED */
if ( bmem_bio_merged )
n_regulators - = 2 ; /* remove BMEM, BIO */
else
n_regulators - - ; /* remove BMEM_BIO_MERGED */
/* Allocate memory required by usable regulators */
2019-02-21 20:57:14 +03:00
regulators = devm_kzalloc ( & pdev - > dev , struct_size ( regulators ,
regulator , n_regulators ) , GFP_KERNEL ) ;
2014-02-20 12:53:01 +04:00
if ( ! regulators )
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
return - ENOMEM ;
regulators - > n_regulators = n_regulators ;
platform_set_drvdata ( pdev , regulators ) ;
/* Register all regulators declared in platform information */
n = 0 ;
id = 0 ;
while ( n < regulators - > n_regulators ) {
/* Skip regulator IDs depending on merge mode configuration */
switch ( id ) {
case DA9063_ID_BCORE1 :
case DA9063_ID_BCORE2 :
if ( bcores_merged ) {
id + + ;
continue ;
}
break ;
case DA9063_ID_BMEM :
case DA9063_ID_BIO :
if ( bmem_bio_merged ) {
id + + ;
continue ;
}
break ;
case DA9063_ID_BCORES_MERGED :
if ( ! bcores_merged ) {
id + + ;
continue ;
}
break ;
case DA9063_ID_BMEM_BIO_MERGED :
if ( ! bmem_bio_merged ) {
id + + ;
continue ;
}
break ;
}
/* Initialise regulator structure */
regl = & regulators - > regulator [ n ] ;
regl - > hw = da9063 ;
regl - > info = & model - > regulator_info [ id ] ;
regl - > desc = regl - > info - > desc ;
regl - > desc . type = REGULATOR_VOLTAGE ;
regl - > desc . owner = THIS_MODULE ;
2019-01-26 18:22:34 +03:00
if ( regl - > info - > mode . reg ) {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
regl - > mode = devm_regmap_field_alloc ( & pdev - > dev ,
da9063 - > regmap , regl - > info - > mode ) ;
2019-01-26 18:22:34 +03:00
if ( IS_ERR ( regl - > mode ) )
return PTR_ERR ( regl - > mode ) ;
}
if ( regl - > info - > suspend . reg ) {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
regl - > suspend = devm_regmap_field_alloc ( & pdev - > dev ,
da9063 - > regmap , regl - > info - > suspend ) ;
2019-01-26 18:22:34 +03:00
if ( IS_ERR ( regl - > suspend ) )
return PTR_ERR ( regl - > suspend ) ;
}
if ( regl - > info - > sleep . reg ) {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
regl - > sleep = devm_regmap_field_alloc ( & pdev - > dev ,
da9063 - > regmap , regl - > info - > sleep ) ;
2019-01-26 18:22:34 +03:00
if ( IS_ERR ( regl - > sleep ) )
return PTR_ERR ( regl - > sleep ) ;
}
if ( regl - > info - > suspend_sleep . reg ) {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
regl - > suspend_sleep = devm_regmap_field_alloc ( & pdev - > dev ,
2020-02-06 16:48:37 +03:00
da9063 - > regmap , regl - > info - > suspend_sleep ) ;
2019-01-26 18:22:34 +03:00
if ( IS_ERR ( regl - > suspend_sleep ) )
return PTR_ERR ( regl - > suspend_sleep ) ;
}
2023-04-05 20:14:34 +03:00
if ( regl - > info - > vmon . reg ) {
regl - > vmon = devm_regmap_field_alloc ( & pdev - > dev ,
da9063 - > regmap , regl - > info - > vmon ) ;
if ( IS_ERR ( regl - > vmon ) )
return PTR_ERR ( regl - > vmon ) ;
}
2019-01-26 18:22:34 +03:00
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
/* Register regulator */
memset ( & config , 0 , sizeof ( config ) ) ;
config . dev = & pdev - > dev ;
config . init_data = da9063_get_regulator_initdata ( regl_pdata , id ) ;
config . driver_data = regl ;
if ( da9063_reg_matches )
config . of_node = da9063_reg_matches [ id ] . of_node ;
config . regmap = da9063 - > regmap ;
2023-04-05 20:14:35 +03:00
2023-08-04 11:34:30 +03:00
/* Checking constraints requires init_data from DT. */
if ( config . init_data ) {
ret = da9063_check_xvp_constraints ( & config ) ;
if ( ret )
return ret ;
}
2023-04-05 20:14:35 +03:00
2013-09-30 04:53:09 +04:00
regl - > rdev = devm_regulator_register ( & pdev - > dev , & regl - > desc ,
& config ) ;
2013-08-30 16:08:42 +04:00
if ( IS_ERR ( regl - > rdev ) ) {
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
dev_err ( & pdev - > dev ,
" Failed to register %s regulator \n " ,
regl - > desc . name ) ;
2013-09-30 04:53:09 +04:00
return PTR_ERR ( regl - > rdev ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
}
id + + ;
n + + ;
}
/* LDOs overcurrent event support */
irq = platform_get_irq_byname ( pdev , " LDO_LIM " ) ;
2019-07-30 21:15:37 +03:00
if ( irq < 0 )
2013-09-30 04:53:09 +04:00
return irq ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
2015-05-31 07:27:38 +03:00
ret = devm_request_threaded_irq ( & pdev - > dev , irq ,
2014-11-21 18:29:08 +03:00
NULL , da9063_ldo_lim_event ,
IRQF_TRIGGER_LOW | IRQF_ONESHOT ,
" LDO_LIM " , regulators ) ;
2020-02-06 16:49:56 +03:00
if ( ret )
2015-05-31 07:27:38 +03:00
dev_err ( & pdev - > dev , " Failed to request LDO_LIM IRQ. \n " ) ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
2020-02-06 16:49:56 +03:00
return ret ;
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
}
static struct platform_driver da9063_regulator_driver = {
. driver = {
. name = DA9063_DRVNAME_REGULATORS ,
regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in 4.14
Probing of regulators can be a slow operation and can contribute to
slower boot times. This is especially true if a regulator is turned on
at probe time (with regulator-boot-on or regulator-always-on) and the
regulator requires delays (off-on-time, ramp time, etc).
While the overall kernel is not ready to switch to async probe by
default, as per the discussion on the mailing lists [1] it is believed
that the regulator subsystem is in good shape and we can move
regulator drivers over wholesale. There is no way to just magically
opt in all regulators (regulators are just normal drivers like
platform_driver), so we set PROBE_PREFER_ASYNCHRONOUS for all
regulators found in 'drivers/regulator' individually.
Given the number of drivers touched and the impossibility to test this
ahead of time, it wouldn't be shocking at all if this caused a
regression for someone. If there is a regression caused by this patch,
it's likely to be one of the cases talked about in [1]. As a "quick
fix", drivers involved in the regression could be fixed by changing
them to PROBE_FORCE_SYNCHRONOUS. That being said, the correct fix
would be to directly fix the problem that caused the issue with async
probe.
The approach here follows a similar approach that was used for the mmc
subsystem several years ago [2]. In fact, I ran nearly the same python
script to auto-generate the changes. The only thing I changed was to
search for "i2c_driver", "spmi_driver", and "spi_driver" in addition
to "platform_driver".
[1] https://lore.kernel.org/r/06db017f-e985-4434-8d1d-02ca2100cca0@sirena.org.uk
[2] https://lore.kernel.org/r/20200903232441.2694866-1-dianders@chromium.org/
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230316125351.1.I2a4677392a38db5758dee0788b2cea5872562a82@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-16 22:54:38 +03:00
. probe_type = PROBE_PREFER_ASYNCHRONOUS ,
regulator: da9063: Add Dialog DA9063 voltage regulators support.
The driver adds support for the following DA9063 PMIC regulators:
- 11x LDOs (named LDO1 - LDO11),
- 6x buck converters (BCORE1, BCORE2, BPRO, BMEM, BIO, BPERI),
Regulators provide following operations:
- REGULATOR_CHANGE_STATUS and REGULATOR_CHANGE_VOLTAGE for all regulators,
- REGULATOR_CHANGE_MODE for LDOs and buck converters, where:
- LDOs allow REGULATOR_MODE_NORMAL and REGULATOR_MODE_STANDBY,
- buck converters allow REGULATOR_MODE_FAST, REGULATOR_MODE_NORMAL
and REGULATOR_MODE_STANDBY,
- REGULATOR_CHANGE_CURRENT for buck converters (current limits).
The driver generates REGULATOR_EVENT_OVER_CURRENT for LDO3, LDO4, LDO7, LDO8
and LDO11.
Internally, PMIC provides two voltage configurations for normal and suspend
system state for each regulator. The driver switches between those on
suspend/wake-up to provide quick and fluent output voltage change.
This driver requires MFD core driver for operation.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 21:00:45 +04:00
} ,
. probe = da9063_regulator_probe ,
} ;
static int __init da9063_regulator_init ( void )
{
return platform_driver_register ( & da9063_regulator_driver ) ;
}
subsys_initcall ( da9063_regulator_init ) ;
static void __exit da9063_regulator_cleanup ( void )
{
platform_driver_unregister ( & da9063_regulator_driver ) ;
}
module_exit ( da9063_regulator_cleanup ) ;
/* Module information */
MODULE_AUTHOR ( " Krystian Garbaciak <krystian.garbaciak@diasemi.com> " ) ;
MODULE_DESCRIPTION ( " DA9063 regulators driver " ) ;
MODULE_LICENSE ( " GPL " ) ;
2016-05-10 21:57:57 +03:00
MODULE_ALIAS ( " platform: " DA9063_DRVNAME_REGULATORS ) ;