Commit c4d11ccb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regulator-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "A small update for the regualtor API for this cycle, some small fixes
  and a bunch of new devices but none of them very big.

  The most stand out thing is the regulator-fixed-clock driver which is
  for regulators where the enable control is done by using a clock
  instead of a GPIO or register write, a novel hardware design that had
  not previously come up.

  Summary:

   - Added a keyword pattern for regulator_get_optional() since usage of
     that API generally needs extra review.

   - Operating mode and suspend state support for act8865.

   - New device support for Active Semiconductor ACT8600 chargers,
     Mediatek MT6358, Qualcomm SM8150, regulator-fixed-clock, and
     Synoptics SY20276, SY20278 and SY8824E"

* tag 'regulator-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (52 commits)
  regulator: core: Fix error return for /sys access
  regulator: da9211: fix obtaining "enable" GPIO
  regulator: max77686: fix obtaining "maxim,ena" GPIO
  regulator: uniphier: Add Pro5 USB3 VBUS support
  dt-bindings: regulator: add regulator-fixed-clock binding
  regulator: fixed: add possibility to enable by clock
  regulator: s2mps11: Consistently use local variable
  regulator: lp87565: Simplify lp87565_buck_set_ramp_delay
  regulator: slg51000: use devm_gpiod_get_optional() in probe
  regulator: lp8788-ldo: make array en_mask static const, makes object smaller
  regulator: tps65132: Stop parsing DT when gpio is not found
  regulator: Defer init completion for a while after late_initcall
  regulator: add missing 'static inline' to a helper's stub
  regulator: provide regulator_bulk_set_supply_names()
  MAINTAINERS: Add keyword pattern on regulator_get_optional()
  regulator: sy8824x: add prefixes to BUCK_EN and MODE macros
  regulator: sy8824x: use c++style for the comment block near SPDX
  regulator: mt6358: Add BROKEN dependency while waiting for MFD to merge
  regulator: mt6358: Add support for MT6358 regulator
  regulator: Add document for MT6358 regulator
  ...
parents 0372fd1a c4ad8502
...@@ -34,6 +34,9 @@ Optional input supply properties: ...@@ -34,6 +34,9 @@ Optional input supply properties:
- inl67-supply: The input supply for LDO_REG3 and LDO_REG4 - inl67-supply: The input supply for LDO_REG3 and LDO_REG4
Any standard regulator properties can be used to configure the single regulator. Any standard regulator properties can be used to configure the single regulator.
regulator-initial-mode, regulator-allowed-modes and regulator-mode could be specified
for act8865 using mode values from dt-bindings/regulator/active-semi,8865-regulator.h
file.
The valid names for regulators are: The valid names for regulators are:
- for act8846: - for act8846:
...@@ -47,6 +50,8 @@ The valid names for regulators are: ...@@ -47,6 +50,8 @@ The valid names for regulators are:
Example: Example:
-------- --------
#include <dt-bindings/regulator/active-semi,8865-regulator.h>
i2c1: i2c@f0018000 { i2c1: i2c@f0018000 {
pmic: act8865@5b { pmic: act8865@5b {
compatible = "active-semi,act8865"; compatible = "active-semi,act8865";
...@@ -65,9 +70,19 @@ Example: ...@@ -65,9 +70,19 @@ Example:
regulator-name = "VCC_1V2"; regulator-name = "VCC_1V2";
regulator-min-microvolt = <1100000>; regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1300000>; regulator-max-microvolt = <1300000>;
regulator-suspend-mem-microvolt = <1150000>;
regulator-suspend-standby-microvolt = <1150000>;
regulator-always-on; regulator-always-on;
regulator-allowed-modes = <ACT8865_REGULATOR_MODE_FIXED>,
<ACT8865_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8865_REGULATOR_MODE_FIXED>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-min-microvolt = <1150000>;
regulator-suspend-max-microvolt = <1150000>;
regulator-changeable-in-suspend;
regulator-mode = <ACT8865_REGULATOR_MODE_LOWPOWER>;
};
}; };
vcc_3v3_reg: DCDC_REG3 { vcc_3v3_reg: DCDC_REG3 {
...@@ -82,6 +97,14 @@ Example: ...@@ -82,6 +97,14 @@ Example:
regulator-min-microvolt = <3300000>; regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>; regulator-max-microvolt = <3300000>;
regulator-always-on; regulator-always-on;
regulator-allowed-modes = <ACT8865_REGULATOR_MODE_NORMAL>,
<ACT8865_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8865_REGULATOR_MODE_NORMAL>;
regulator-state-mem {
regulator-off-in-suspend;
};
}; };
vddfuse_reg: LDO_REG2 { vddfuse_reg: LDO_REG2 {
......
...@@ -19,9 +19,19 @@ description: ...@@ -19,9 +19,19 @@ description:
allOf: allOf:
- $ref: "regulator.yaml#" - $ref: "regulator.yaml#"
if:
properties:
compatible:
contains:
const: regulator-fixed-clock
required:
- clocks
properties: properties:
compatible: compatible:
const: regulator-fixed enum:
- const: regulator-fixed
- const: regulator-fixed-clock
regulator-name: true regulator-name: true
...@@ -29,6 +39,13 @@ properties: ...@@ -29,6 +39,13 @@ properties:
description: gpio to use for enable control description: gpio to use for enable control
maxItems: 1 maxItems: 1
clocks:
description:
clock to use for enable control. This binding is only available if
the compatible is chosen to regulator-fixed-clock. The clock binding
is mandatory if compatible is chosen to regulator-fixed-clock.
maxItems: 1
startup-delay-us: startup-delay-us:
description: startup time in microseconds description: startup time in microseconds
$ref: /schemas/types.yaml#/definitions/uint32 $ref: /schemas/types.yaml#/definitions/uint32
......
...@@ -22,9 +22,12 @@ RPMh resource. ...@@ -22,9 +22,12 @@ RPMh resource.
The names used for regulator nodes must match those supported by a given PMIC. The names used for regulator nodes must match those supported by a given PMIC.
Supported regulator node names: Supported regulator node names:
PM8005: smps1 - smps4
PM8009: smps1 - smps2, ldo1 - ldo7
PM8150: smps1 - smps10, ldo1 - ldo18
PM8150L: smps1 - smps8, ldo1 - ldo11, bob, flash, rgb
PM8998: smps1 - smps13, ldo1 - ldo28, lvs1 - lvs2 PM8998: smps1 - smps13, ldo1 - ldo28, lvs1 - lvs2
PMI8998: bob PMI8998: bob
PM8005: smps1 - smps4
======================== ========================
First Level Nodes - PMIC First Level Nodes - PMIC
...@@ -33,9 +36,13 @@ First Level Nodes - PMIC ...@@ -33,9 +36,13 @@ First Level Nodes - PMIC
- compatible - compatible
Usage: required Usage: required
Value type: <string> Value type: <string>
Definition: Must be one of: "qcom,pm8998-rpmh-regulators", Definition: Must be one of below:
"qcom,pmi8998-rpmh-regulators" or "qcom,pm8005-rpmh-regulators"
"qcom,pm8005-rpmh-regulators". "qcom,pm8009-rpmh-regulators"
"qcom,pm8150-rpmh-regulators"
"qcom,pm8150l-rpmh-regulators"
"qcom,pm8998-rpmh-regulators"
"qcom,pmi8998-rpmh-regulators"
- qcom,pmic-id - qcom,pmic-id
Usage: required Usage: required
......
SY8824C/SY8824E/SY20276 Voltage regulator
Required properties:
- compatible: Must be one of the following.
"silergy,sy8824c"
"silergy,sy8824e"
"silergy,sy20276"
"silergy,sy20278"
- reg: I2C slave address
Any property defined as part of the core regulator binding, defined in
./regulator.txt, can also be used.
Example:
vcore: regulator@00 {
compatible = "silergy,sy8824c";
reg = <0x66>;
regulator-name = "vcore";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <1150000>;
regulator-boot-on;
regulator-always-on;
};
...@@ -71,3 +71,10 @@ Example: ...@@ -71,3 +71,10 @@ Example:
regulator-min-microvolt = <1000000>; regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <3000000>; regulator-max-microvolt = <3000000>;
}; };
For twl6030 regulators/LDOs:
- ti,retain-on-reset: Does not turn off the supplies during warm
reset. Could be needed for VMMC, as TWL6030
reset sequence for this signal does not comply
with the SD specification.
...@@ -13,6 +13,7 @@ this layer. These clocks and resets should be described in each property. ...@@ -13,6 +13,7 @@ this layer. These clocks and resets should be described in each property.
Required properties: Required properties:
- compatible: Should be - compatible: Should be
"socionext,uniphier-pro4-usb3-regulator" - for Pro4 SoC "socionext,uniphier-pro4-usb3-regulator" - for Pro4 SoC
"socionext,uniphier-pro5-usb3-regulator" - for Pro5 SoC
"socionext,uniphier-pxs2-usb3-regulator" - for PXs2 SoC "socionext,uniphier-pxs2-usb3-regulator" - for PXs2 SoC
"socionext,uniphier-ld20-usb3-regulator" - for LD20 SoC "socionext,uniphier-ld20-usb3-regulator" - for LD20 SoC
"socionext,uniphier-pxs3-usb3-regulator" - for PXs3 SoC "socionext,uniphier-pxs3-usb3-regulator" - for PXs3 SoC
...@@ -20,12 +21,12 @@ Required properties: ...@@ -20,12 +21,12 @@ Required properties:
- clocks: A list of phandles to the clock gate for USB3 glue layer. - clocks: A list of phandles to the clock gate for USB3 glue layer.
According to the clock-names, appropriate clocks are required. According to the clock-names, appropriate clocks are required.
- clock-names: Should contain - clock-names: Should contain
"gio", "link" - for Pro4 SoC "gio", "link" - for Pro4 and Pro5 SoCs
"link" - for others "link" - for others
- resets: A list of phandles to the reset control for USB3 glue layer. - resets: A list of phandles to the reset control for USB3 glue layer.
According to the reset-names, appropriate resets are required. According to the reset-names, appropriate resets are required.
- reset-names: Should contain - reset-names: Should contain
"gio", "link" - for Pro4 SoC "gio", "link" - for Pro4 and Pro5 SoCs
"link" - for others "link" - for others
See Documentation/devicetree/bindings/regulator/regulator.txt See Documentation/devicetree/bindings/regulator/regulator.txt
......
...@@ -17261,6 +17261,7 @@ F: Documentation/power/regulator/ ...@@ -17261,6 +17261,7 @@ F: Documentation/power/regulator/
F: drivers/regulator/ F: drivers/regulator/
F: include/dt-bindings/regulator/ F: include/dt-bindings/regulator/
F: include/linux/regulator/ F: include/linux/regulator/
K: regulator_get_optional
VRF VRF
M: David Ahern <dsa@cumulusnetworks.com> M: David Ahern <dsa@cumulusnetworks.com>
......
...@@ -83,6 +83,7 @@ config REGULATOR_88PM8607 ...@@ -83,6 +83,7 @@ config REGULATOR_88PM8607
config REGULATOR_ACT8865 config REGULATOR_ACT8865
tristate "Active-semi act8865 voltage regulator" tristate "Active-semi act8865 voltage regulator"
depends on I2C depends on I2C
depends on POWER_SUPPLY
select REGMAP_I2C select REGMAP_I2C
help help
This driver controls a active-semi act8865 voltage output This driver controls a active-semi act8865 voltage output
...@@ -618,6 +619,15 @@ config REGULATOR_MT6323 ...@@ -618,6 +619,15 @@ config REGULATOR_MT6323
This driver supports the control of different power rails of device This driver supports the control of different power rails of device
through regulator interface. through regulator interface.
config REGULATOR_MT6358
tristate "MediaTek MT6358 PMIC"
depends on MFD_MT6397 && BROKEN
help
Say y here to select this option to enable the power regulator of
MediaTek MT6358 PMIC.
This driver supports the control of different power rails of device
through regulator interface.
config REGULATOR_MT6380 config REGULATOR_MT6380
tristate "MediaTek MT6380 PMIC" tristate "MediaTek MT6380 PMIC"
depends on MTK_PMIC_WRAP depends on MTK_PMIC_WRAP
...@@ -906,6 +916,13 @@ config REGULATOR_SY8106A ...@@ -906,6 +916,13 @@ config REGULATOR_SY8106A
help help
This driver supports SY8106A single output regulator. This driver supports SY8106A single output regulator.
config REGULATOR_SY8824X
tristate "Silergy SY8824C/SY8824E regulator"
depends on I2C && (OF || COMPILE_TEST)
select REGMAP_I2C
help
This driver supports SY8824C single output regulator.
config REGULATOR_TPS51632 config REGULATOR_TPS51632
tristate "TI TPS51632 Power Regulator" tristate "TI TPS51632 Power Regulator"
depends on I2C depends on I2C
......
...@@ -79,6 +79,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o ...@@ -79,6 +79,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o
obj-$(CONFIG_REGULATOR_MCP16502) += mcp16502.o obj-$(CONFIG_REGULATOR_MCP16502) += mcp16502.o
obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
obj-$(CONFIG_REGULATOR_MT6323) += mt6323-regulator.o obj-$(CONFIG_REGULATOR_MT6323) += mt6323-regulator.o
obj-$(CONFIG_REGULATOR_MT6358) += mt6358-regulator.o
obj-$(CONFIG_REGULATOR_MT6380) += mt6380-regulator.o obj-$(CONFIG_REGULATOR_MT6380) += mt6380-regulator.o
obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o
obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o
...@@ -111,6 +112,7 @@ obj-$(CONFIG_REGULATOR_STM32_PWR) += stm32-pwr.o ...@@ -111,6 +112,7 @@ obj-$(CONFIG_REGULATOR_STM32_PWR) += stm32-pwr.o
obj-$(CONFIG_REGULATOR_STPMIC1) += stpmic1_regulator.o obj-$(CONFIG_REGULATOR_STPMIC1) += stpmic1_regulator.o
obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o
obj-$(CONFIG_REGULATOR_SY8106A) += sy8106a-regulator.o obj-$(CONFIG_REGULATOR_SY8106A) += sy8106a-regulator.o
obj-$(CONFIG_REGULATOR_SY8824X) += sy8824x.o
obj-$(CONFIG_REGULATOR_TI_ABB) += ti-abb-regulator.o obj-$(CONFIG_REGULATOR_TI_ABB) += ti-abb-regulator.o
obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o
......
This diff is collapsed.
...@@ -381,12 +381,16 @@ static struct device_node *of_get_child_regulator(struct device_node *parent, ...@@ -381,12 +381,16 @@ static struct device_node *of_get_child_regulator(struct device_node *parent,
if (!regnode) { if (!regnode) {
regnode = of_get_child_regulator(child, prop_name); regnode = of_get_child_regulator(child, prop_name);
if (regnode) if (regnode)
return regnode; goto err_node_put;
} else { } else {
return regnode; goto err_node_put;
} }
} }
return NULL; return NULL;
err_node_put:
of_node_put(child);
return regnode;
} }
/** /**
...@@ -564,13 +568,15 @@ static ssize_t regulator_uV_show(struct device *dev, ...@@ -564,13 +568,15 @@ static ssize_t regulator_uV_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct regulator_dev *rdev = dev_get_drvdata(dev); struct regulator_dev *rdev = dev_get_drvdata(dev);
ssize_t ret; int uV;
regulator_lock(rdev); regulator_lock(rdev);
ret = sprintf(buf, "%d\n", regulator_get_voltage_rdev(rdev)); uV = regulator_get_voltage_rdev(rdev);
regulator_unlock(rdev); regulator_unlock(rdev);
return ret; if (uV < 0)
return uV;
return sprintf(buf, "%d\n", uV);
} }
static DEVICE_ATTR(microvolts, 0444, regulator_uV_show, NULL); static DEVICE_ATTR(microvolts, 0444, regulator_uV_show, NULL);
...@@ -5640,7 +5646,7 @@ static int __init regulator_init(void) ...@@ -5640,7 +5646,7 @@ static int __init regulator_init(void)
/* init early to allow our consumers to complete system booting */ /* init early to allow our consumers to complete system booting */
core_initcall(regulator_init); core_initcall(regulator_init);
static int __init regulator_late_cleanup(struct device *dev, void *data) static int regulator_late_cleanup(struct device *dev, void *data)
{ {
struct regulator_dev *rdev = dev_to_rdev(dev); struct regulator_dev *rdev = dev_to_rdev(dev);
const struct regulator_ops *ops = rdev->desc->ops; const struct regulator_ops *ops = rdev->desc->ops;
...@@ -5689,17 +5695,8 @@ static int __init regulator_late_cleanup(struct device *dev, void *data) ...@@ -5689,17 +5695,8 @@ static int __init regulator_late_cleanup(struct device *dev, void *data)
return 0; return 0;
} }
static int __init regulator_init_complete(void) static void regulator_init_complete_work_function(struct work_struct *work)
{ {
/*
* Since DT doesn't provide an idiomatic mechanism for
* enabling full constraints and since it's much more natural
* with DT to provide them just assume that a DT enabled
* system has full constraints.
*/
if (of_have_populated_dt())
has_full_constraints = true;
/* /*
* Regulators may had failed to resolve their input supplies * Regulators may had failed to resolve their input supplies
* when were registered, either because the input supply was * when were registered, either because the input supply was
...@@ -5717,6 +5714,35 @@ static int __init regulator_init_complete(void) ...@@ -5717,6 +5714,35 @@ static int __init regulator_init_complete(void)
*/ */
class_for_each_device(&regulator_class, NULL, NULL, class_for_each_device(&regulator_class, NULL, NULL,
regulator_late_cleanup); regulator_late_cleanup);
}
static DECLARE_DELAYED_WORK(regulator_init_complete_work,
regulator_init_complete_work_function);
static int __init regulator_init_complete(void)
{
/*
* Since DT doesn't provide an idiomatic mechanism for
* enabling full constraints and since it's much more natural
* with DT to provide them just assume that a DT enabled
* system has full constraints.
*/
if (of_have_populated_dt())
has_full_constraints = true;
/*
* We punt completion for an arbitrary amount of time since
* systems like distros will load many drivers from userspace
* so consumers might not always be ready yet, this is
* particularly an issue with laptops where this might bounce
* the display off then on. Ideally we'd get a notification
* from userspace when this happens but we don't so just wait
* a bit and hope we waited long enough. It'd be better if
* we'd only do this on systems that need it, and a kernel
* command line option might be useful.
*/
schedule_delayed_work(&regulator_init_complete_work,
msecs_to_jiffies(30000));
return 0; return 0;
} }
......
...@@ -1032,10 +1032,8 @@ static int da9062_regulator_probe(struct platform_device *pdev) ...@@ -1032,10 +1032,8 @@ static int da9062_regulator_probe(struct platform_device *pdev)
/* LDOs overcurrent event support */ /* LDOs overcurrent event support */
irq = platform_get_irq_byname(pdev, "LDO_LIM"); irq = platform_get_irq_byname(pdev, "LDO_LIM");
if (irq < 0) { if (irq < 0)
dev_err(&pdev->dev, "Failed to get IRQ.\n");
return irq; return irq;
}
regulators->irq_ldo_lim = irq; regulators->irq_ldo_lim = irq;
ret = devm_request_threaded_irq(&pdev->dev, irq, ret = devm_request_threaded_irq(&pdev->dev, irq,
......
...@@ -863,10 +863,8 @@ static int da9063_regulator_probe(struct platform_device *pdev) ...@@ -863,10 +863,8 @@ static int da9063_regulator_probe(struct platform_device *pdev)
/* LDOs overcurrent event support */ /* LDOs overcurrent event support */
irq = platform_get_irq_byname(pdev, "LDO_LIM"); irq = platform_get_irq_byname(pdev, "LDO_LIM");
if (irq < 0) { if (irq < 0)
dev_err(&pdev->dev, "Failed to get IRQ.\n");
return irq; return irq;
}
ret = devm_request_threaded_irq(&pdev->dev, irq, ret = devm_request_threaded_irq(&pdev->dev, irq,
NULL, da9063_ldo_lim_event, NULL, da9063_ldo_lim_event,
......
...@@ -285,7 +285,7 @@ static struct da9211_pdata *da9211_parse_regulators_dt( ...@@ -285,7 +285,7 @@ static struct da9211_pdata *da9211_parse_regulators_dt(
pdata->reg_node[n] = da9211_matches[i].of_node; pdata->reg_node[n] = da9211_matches[i].of_node;
pdata->gpiod_ren[n] = devm_gpiod_get_from_of_node(dev, pdata->gpiod_ren[n] = devm_gpiod_get_from_of_node(dev,
da9211_matches[i].of_node, da9211_matches[i].of_node,
"enable", "enable-gpios",
0, 0,
GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
"da9211-enable"); "da9211-enable");
......
...@@ -23,14 +23,63 @@ ...@@ -23,14 +23,63 @@
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regulator/of_regulator.h> #include <linux/regulator/of_regulator.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/clk.h>
struct fixed_voltage_data { struct fixed_voltage_data {
struct regulator_desc desc; struct regulator_desc desc;
struct regulator_dev *dev; struct regulator_dev *dev;
struct clk *enable_clock;
unsigned int clk_enable_counter;
}; };
struct fixed_dev_type {
bool has_enable_clock;
};
static const struct fixed_dev_type fixed_voltage_data = {
.has_enable_clock = false,
};
static const struct fixed_dev_type fixed_clkenable_data = {
.has_enable_clock = true,
};
static int reg_clock_enable(struct regulator_dev *rdev)
{
struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
int ret = 0;
ret = clk_prepare_enable(priv->enable_clock);
if (ret)
return ret;
priv->clk_enable_counter++;
return ret;
}
static int reg_clock_disable(struct regulator_dev *rdev)
{
struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
clk_disable_unprepare(priv->enable_clock);
priv->clk_enable_counter--;
return 0;
}
static int reg_clock_is_enabled(struct regulator_dev *rdev)
{
struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
return priv->clk_enable_counter > 0;
}
/** /**
* of_get_fixed_voltage_config - extract fixed_voltage_config structure info * of_get_fixed_voltage_config - extract fixed_voltage_config structure info
...@@ -84,10 +133,19 @@ of_get_fixed_voltage_config(struct device *dev, ...@@ -84,10 +133,19 @@ of_get_fixed_voltage_config(struct device *dev,
static struct regulator_ops fixed_voltage_ops = { static struct regulator_ops fixed_voltage_ops = {
}; };
static struct regulator_ops fixed_voltage_clkenabled_ops = {
.enable = reg_clock_enable,
.disable = reg_clock_disable,
.is_enabled = reg_clock_is_enabled,
};
static int reg_fixed_voltage_probe(struct platform_device *pdev) static int reg_fixed_voltage_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct fixed_voltage_config *config; struct fixed_voltage_config *config;
struct fixed_voltage_data *drvdata; struct fixed_voltage_data *drvdata;
const struct fixed_dev_type *drvtype =
of_match_device(dev->driver->of_match_table, dev)->data;
struct regulator_config cfg = { }; struct regulator_config cfg = { };
enum gpiod_flags gflags; enum gpiod_flags gflags;
int ret; int ret;
...@@ -118,7 +176,18 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) ...@@ -118,7 +176,18 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
} }
drvdata->desc.type = REGULATOR_VOLTAGE; drvdata->desc.type = REGULATOR_VOLTAGE;
drvdata->desc.owner = THIS_MODULE; drvdata->desc.owner = THIS_MODULE;
drvdata->desc.ops = &fixed_voltage_ops;
if (drvtype->has_enable_clock) {
drvdata->desc.ops = &fixed_voltage_clkenabled_ops;
drvdata->enable_clock = devm_clk_get(dev, NULL);
if (IS_ERR(drvdata->enable_clock)) {
dev_err(dev, "Cant get enable-clock from devicetree\n");
return -ENOENT;
}
} else {
drvdata->desc.ops = &fixed_voltage_ops;
}
drvdata->desc.enable_time = config->startup_delay; drvdata->desc.enable_time = config->startup_delay;
...@@ -191,8 +260,16 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) ...@@ -191,8 +260,16 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
#if defined(CONFIG_OF) #if defined(CONFIG_OF)
static const struct of_device_id fixed_of_match[] = { static const struct of_device_id fixed_of_match[] = {
{ .compatible = "regulator-fixed", }, {
{}, .compatible = "regulator-fixed",
.data = &fixed_voltage_data,
},
{
.compatible = "regulator-fixed-clock",
.data = &fixed_clkenable_data,
},
{
},
}; };
MODULE_DEVICE_TABLE(of, fixed_of_match); MODULE_DEVICE_TABLE(of, fixed_of_match);
#endif #endif
......
...@@ -860,3 +860,24 @@ int regulator_get_current_limit_regmap(struct regulator_dev *rdev) ...@@ -860,3 +860,24 @@ int regulator_get_current_limit_regmap(struct regulator_dev *rdev)
return -EINVAL; return -EINVAL;
} }
EXPORT_SYMBOL_GPL(regulator_get_current_limit_regmap); EXPORT_SYMBOL_GPL(regulator_get_current_limit_regmap);
/**
* regulator_bulk_set_supply_names - initialize the 'supply' fields in an array
* of regulator_bulk_data structs
*
* @consumers: array of regulator_bulk_data entries to initialize
* @supply_names: array of supply name strings
* @num_supplies: number of supply names to initialize
*
* Note: the 'consumers' array must be the size of 'num_supplies'.
*/
void regulator_bulk_set_supply_names(struct regulator_bulk_data *consumers,
const char *const *supply_names,
unsigned int num_supplies)
{
unsigned int i;
for (i = 0; i < num_supplies; i++)
consumers[i].supply = supply_names[i];
}
EXPORT_SYMBOL_GPL(regulator_bulk_set_supply_names);
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
/* LM3632 */ /* LM3632 */
#define LM3632_BOOST_VSEL_MAX 0x26 #define LM3632_BOOST_VSEL_MAX 0x26
#define LM3632_LDO_VSEL_MAX 0x29 #define LM3632_LDO_VSEL_MAX 0x28
#define LM3632_VBOOST_MIN 4500000 #define LM3632_VBOOST_MIN 4500000
#define LM3632_VLDO_MIN 4000000 #define LM3632_VLDO_MIN 4000000
/* LM36274 */ /* LM36274 */
#define LM36274_BOOST_VSEL_MAX 0x3f #define LM36274_BOOST_VSEL_MAX 0x3f
#define LM36274_LDO_VSEL_MAX 0x34 #define LM36274_LDO_VSEL_MAX 0x32
#define LM36274_VOLTAGE_MIN 4000000 #define LM36274_VOLTAGE_MIN 4000000
/* Common */ /* Common */
...@@ -226,7 +226,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = { ...@@ -226,7 +226,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = {
.of_match = "vboost", .of_match = "vboost",
.id = LM36274_BOOST, .id = LM36274_BOOST,
.ops = &lm363x_boost_voltage_table_ops, .ops = &lm363x_boost_voltage_table_ops,
.n_voltages = LM36274_BOOST_VSEL_MAX, .n_voltages = LM36274_BOOST_VSEL_MAX + 1,
.min_uV = LM36274_VOLTAGE_MIN, .min_uV = LM36274_VOLTAGE_MIN,
.uV_step = LM363X_STEP_50mV, .uV_step = LM363X_STEP_50mV,
.type = REGULATOR_VOLTAGE, .type = REGULATOR_VOLTAGE,
...@@ -239,7 +239,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = { ...@@ -239,7 +239,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = {
.of_match = "vpos", .of_match = "vpos",
.id = LM36274_LDO_POS, .id = LM36274_LDO_POS,
.ops = &lm363x_regulator_voltage_table_ops, .ops = &lm363x_regulator_voltage_table_ops,
.n_voltages = LM36274_LDO_VSEL_MAX, .n_voltages = LM36274_LDO_VSEL_MAX + 1,
.min_uV = LM36274_VOLTAGE_MIN, .min_uV = LM36274_VOLTAGE_MIN,
.uV_step = LM363X_STEP_50mV, .uV_step = LM363X_STEP_50mV,
.type = REGULATOR_VOLTAGE, .type = REGULATOR_VOLTAGE,
...@@ -254,7 +254,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = { ...@@ -254,7 +254,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = {
.of_match = "vneg", .of_match = "vneg",
.id = LM36274_LDO_NEG, .id = LM36274_LDO_NEG,
.ops = &lm363x_regulator_voltage_table_ops, .ops = &lm363x_regulator_voltage_table_ops,
.n_voltages = LM36274_LDO_VSEL_MAX, .n_voltages = LM36274_LDO_VSEL_MAX + 1,
.min_uV = LM36274_VOLTAGE_MIN, .min_uV = LM36274_VOLTAGE_MIN,
.uV_step = LM363X_STEP_50mV, .uV_step = LM363X_STEP_50mV,
.type = REGULATOR_VOLTAGE, .type = REGULATOR_VOLTAGE,
......
...@@ -65,7 +65,6 @@ static int lp87565_buck_set_ramp_delay(struct regulator_dev *rdev, ...@@ -65,7 +65,6 @@ static int lp87565_buck_set_ramp_delay(struct regulator_dev *rdev,
int ramp_delay) int ramp_delay)
{ {
int id = rdev_get_id(rdev); int id = rdev_get_id(rdev);
struct lp87565 *lp87565 = rdev_get_drvdata(rdev);
unsigned int reg; unsigned int reg;
int ret; int ret;
...@@ -86,11 +85,11 @@ static int lp87565_buck_set_ramp_delay(struct regulator_dev *rdev, ...@@ -86,11 +85,11 @@ static int lp87565_buck_set_ramp_delay(struct regulator_dev *rdev,
else else
reg = 0; reg = 0;
ret = regmap_update_bits(lp87565->regmap, regulators[id].ctrl2_reg, ret = regmap_update_bits(rdev->regmap, regulators[id].ctrl2_reg,
LP87565_BUCK_CTRL_2_SLEW_RATE, LP87565_BUCK_CTRL_2_SLEW_RATE,
reg << __ffs(LP87565_BUCK_CTRL_2_SLEW_RATE)); reg << __ffs(LP87565_BUCK_CTRL_2_SLEW_RATE));
if (ret) { if (ret) {
dev_err(lp87565->dev, "SLEW RATE write failed: %d\n", ret); dev_err(&rdev->dev, "SLEW RATE write failed: %d\n", ret);
return ret; return ret;
} }
......
...@@ -464,7 +464,7 @@ static int lp8788_config_ldo_enable_mode(struct platform_device *pdev, ...@@ -464,7 +464,7 @@ static int lp8788_config_ldo_enable_mode(struct platform_device *pdev,
{ {
struct lp8788 *lp = ldo->lp; struct lp8788 *lp = ldo->lp;
enum lp8788_ext_ldo_en_id enable_id; enum lp8788_ext_ldo_en_id enable_id;
u8 en_mask[] = { static const u8 en_mask[] = {
[EN_ALDO1] = LP8788_EN_SEL_ALDO1_M, [EN_ALDO1] = LP8788_EN_SEL_ALDO1_M,
[EN_ALDO234] = LP8788_EN_SEL_ALDO234_M, [EN_ALDO234] = LP8788_EN_SEL_ALDO234_M,
[EN_ALDO5] = LP8788_EN_SEL_ALDO5_M, [EN_ALDO5] = LP8788_EN_SEL_ALDO5_M,
......
...@@ -257,7 +257,7 @@ static int max77686_of_parse_cb(struct device_node *np, ...@@ -257,7 +257,7 @@ static int max77686_of_parse_cb(struct device_node *np,
case MAX77686_BUCK9: case MAX77686_BUCK9:
case MAX77686_LDO20 ... MAX77686_LDO22: case MAX77686_LDO20 ... MAX77686_LDO22:
config->ena_gpiod = gpiod_get_from_of_node(np, config->ena_gpiod = gpiod_get_from_of_node(np,
"maxim,ena", "maxim,ena-gpios",
0, 0,
GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
"max77686-regulator"); "max77686-regulator");
......
...@@ -485,7 +485,6 @@ static int max8660_probe(struct i2c_client *client, ...@@ -485,7 +485,6 @@ static int max8660_probe(struct i2c_client *client,
rdev = devm_regulator_register(&client->dev, rdev = devm_regulator_register(&client->dev,
&max8660_reg[id], &config); &max8660_reg[id], &config);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
ret = PTR_ERR(rdev);
dev_err(&client->dev, "failed to register %s\n", dev_err(&client->dev, "failed to register %s\n",
max8660_reg[id].name); max8660_reg[id].name);
return PTR_ERR(rdev); return PTR_ERR(rdev);
......
This diff is collapsed.
...@@ -50,6 +50,20 @@ enum rpmh_regulator_type { ...@@ -50,6 +50,20 @@ enum rpmh_regulator_type {
#define PMIC4_BOB_MODE_AUTO 2 #define PMIC4_BOB_MODE_AUTO 2
#define PMIC4_BOB_MODE_PWM 3 #define PMIC4_BOB_MODE_PWM 3
#define PMIC5_LDO_MODE_RETENTION 3
#define PMIC5_LDO_MODE_LPM 4
#define PMIC5_LDO_MODE_HPM 7
#define PMIC5_SMPS_MODE_RETENTION 3
#define PMIC5_SMPS_MODE_PFM 4
#define PMIC5_SMPS_MODE_AUTO 6
#define PMIC5_SMPS_MODE_PWM 7
#define PMIC5_BOB_MODE_PASS 2
#define PMIC5_BOB_MODE_PFM 4
#define PMIC5_BOB_MODE_AUTO 6
#define PMIC5_BOB_MODE_PWM 7
/** /**
* struct rpmh_vreg_hw_data - RPMh regulator hardware configurations * struct rpmh_vreg_hw_data - RPMh regulator hardware configurations
* @regulator_type: RPMh accelerator type used to manage this * @regulator_type: RPMh accelerator type used to manage this
...@@ -488,6 +502,14 @@ static const int pmic_mode_map_pmic4_ldo[REGULATOR_MODE_STANDBY + 1] = { ...@@ -488,6 +502,14 @@ static const int pmic_mode_map_pmic4_ldo[REGULATOR_MODE_STANDBY + 1] = {
[REGULATOR_MODE_FAST] = -EINVAL, [REGULATOR_MODE_FAST] = -EINVAL,
}; };
static const int pmic_mode_map_pmic5_ldo[REGULATOR_MODE_STANDBY + 1] = {
[REGULATOR_MODE_INVALID] = -EINVAL,
[REGULATOR_MODE_STANDBY] = PMIC5_LDO_MODE_RETENTION,
[REGULATOR_MODE_IDLE] = PMIC5_LDO_MODE_LPM,
[REGULATOR_MODE_NORMAL] = PMIC5_LDO_MODE_HPM,
[REGULATOR_MODE_FAST] = -EINVAL,
};
static unsigned int rpmh_regulator_pmic4_ldo_of_map_mode(unsigned int rpmh_mode) static unsigned int rpmh_regulator_pmic4_ldo_of_map_mode(unsigned int rpmh_mode)
{ {
unsigned int mode; unsigned int mode;
...@@ -518,6 +540,14 @@ static const int pmic_mode_map_pmic4_smps[REGULATOR_MODE_STANDBY + 1] = { ...@@ -518,6 +540,14 @@ static const int pmic_mode_map_pmic4_smps[REGULATOR_MODE_STANDBY + 1] = {
[REGULATOR_MODE_FAST] = PMIC4_SMPS_MODE_PWM, [REGULATOR_MODE_FAST] = PMIC4_SMPS_MODE_PWM,
}; };
static const int pmic_mode_map_pmic5_smps[REGULATOR_MODE_STANDBY + 1] = {
[REGULATOR_MODE_INVALID] = -EINVAL,
[REGULATOR_MODE_STANDBY] = PMIC5_SMPS_MODE_RETENTION,
[REGULATOR_MODE_IDLE] = PMIC5_SMPS_MODE_PFM,
[REGULATOR_MODE_NORMAL] = PMIC5_SMPS_MODE_AUTO,
[REGULATOR_MODE_FAST] = PMIC5_SMPS_MODE_PWM,
};
static unsigned int static unsigned int
rpmh_regulator_pmic4_smps_of_map_mode(unsigned int rpmh_mode) rpmh_regulator_pmic4_smps_of_map_mode(unsigned int rpmh_mode)
{ {
...@@ -552,6 +582,14 @@ static const int pmic_mode_map_pmic4_bob[REGULATOR_MODE_STANDBY + 1] = { ...@@ -552,6 +582,14 @@ static const int pmic_mode_map_pmic4_bob[REGULATOR_MODE_STANDBY + 1] = {
[REGULATOR_MODE_FAST] = PMIC4_BOB_MODE_PWM, [REGULATOR_MODE_FAST] = PMIC4_BOB_MODE_PWM,
}; };
static const int pmic_mode_map_pmic5_bob[REGULATOR_MODE_STANDBY + 1] = {
[REGULATOR_MODE_INVALID] = -EINVAL,
[REGULATOR_MODE_STANDBY] = -EINVAL,
[REGULATOR_MODE_IDLE] = PMIC5_BOB_MODE_PFM,
[REGULATOR_MODE_NORMAL] = PMIC5_BOB_MODE_AUTO,
[REGULATOR_MODE_FAST] = PMIC5_BOB_MODE_PWM,
};
static unsigned int rpmh_regulator_pmic4_bob_of_map_mode(unsigned int rpmh_mode) static unsigned int rpmh_regulator_pmic4_bob_of_map_mode(unsigned int rpmh_mode)
{ {
unsigned int mode; unsigned int mode;
...@@ -637,6 +675,72 @@ static const struct rpmh_vreg_hw_data pmic4_lvs = { ...@@ -637,6 +675,72 @@ static const struct rpmh_vreg_hw_data pmic4_lvs = {
/* LVS hardware does not support voltage or mode configuration. */ /* LVS hardware does not support voltage or mode configuration. */
}; };
static const struct rpmh_vreg_hw_data pmic5_pldo = {
.regulator_type = VRM,
.ops = &rpmh_regulator_vrm_drms_ops,
.voltage_range = REGULATOR_LINEAR_RANGE(1504000, 0, 255, 8000),
.n_voltages = 256,
.hpm_min_load_uA = 10000,
.pmic_mode_map = pmic_mode_map_pmic5_ldo,
.of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode,
};
static const struct rpmh_vreg_hw_data pmic5_pldo_lv = {
.regulator_type = VRM,
.ops = &rpmh_regulator_vrm_drms_ops,
.voltage_range = REGULATOR_LINEAR_RANGE(1504000, 0, 62, 8000),
.n_voltages = 63,
.hpm_min_load_uA = 10000,
.pmic_mode_map = pmic_mode_map_pmic5_ldo,
.of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode,
};
static const struct rpmh_vreg_hw_data pmic5_nldo = {
.regulator_type = VRM,
.ops = &rpmh_regulator_vrm_drms_ops,
.voltage_range = REGULATOR_LINEAR_RANGE(320000, 0, 123, 8000),
.n_voltages = 124,
.hpm_min_load_uA = 30000,
.pmic_mode_map = pmic_mode_map_pmic5_ldo,
.of_map_mode = rpmh_regulator_pmic4_ldo_of_map_mode,
};
static const struct rpmh_vreg_hw_data pmic5_hfsmps510 = {
.regulator_type = VRM,
.ops = &rpmh_regulator_vrm_ops,
.voltage_range = REGULATOR_LINEAR_RANGE(320000, 0, 215, 8000),
.n_voltages = 216,
.pmic_mode_map = pmic_mode_map_pmic5_smps,
.of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode,
};
static const struct rpmh_vreg_hw_data pmic5_ftsmps510 = {
.regulator_type = VRM,
.ops = &rpmh_regulator_vrm_ops,
.voltage_range = REGULATOR_LINEAR_RANGE(300000, 0, 263, 4000),
.n_voltages = 264,
.pmic_mode_map = pmic_mode_map_pmic5_smps,
.of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode,
};
static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = {
.regulator_type = VRM,
.ops = &rpmh_regulator_vrm_ops,
.voltage_range = REGULATOR_LINEAR_RANGE(2800000, 0, 4, 1600),
.n_voltages = 5,
.pmic_mode_map = pmic_mode_map_pmic5_smps,
.of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode,
};
static const struct rpmh_vreg_hw_data pmic5_bob = {
.regulator_type = VRM,
.ops = &rpmh_regulator_vrm_bypass_ops,
.voltage_range = REGULATOR_LINEAR_RANGE(300000, 0, 135, 32000),
.n_voltages = 136,
.pmic_mode_map = pmic_mode_map_pmic5_bob,
.of_map_mode = rpmh_regulator_pmic4_bob_of_map_mode,
};
#define RPMH_VREG(_name, _resource_name, _hw_data, _supply_name) \ #define RPMH_VREG(_name, _resource_name, _hw_data, _supply_name) \
{ \ { \
.name = _name, \ .name = _name, \
...@@ -705,6 +809,75 @@ static const struct rpmh_vreg_init_data pm8005_vreg_data[] = { ...@@ -705,6 +809,75 @@ static const struct rpmh_vreg_init_data pm8005_vreg_data[] = {
{}, {},
}; };
static const struct rpmh_vreg_init_data pm8150_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps510, "vdd-s1"),
RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps510, "vdd-s2"),
RPMH_VREG("smps3", "smp%s3", &pmic5_ftsmps510, "vdd-s3"),
RPMH_VREG("smps4", "smp%s4", &pmic5_hfsmps510, "vdd-s4"),
RPMH_VREG("smps5", "smp%s5", &pmic5_hfsmps510, "vdd-s5"),
RPMH_VREG("smps6", "smp%s6", &pmic5_ftsmps510, "vdd-s6"),
RPMH_VREG("smps7", "smp%s7", &pmic5_ftsmps510, "vdd-s7"),
RPMH_VREG("smps8", "smp%s8", &pmic5_ftsmps510, "vdd-s8"),
RPMH_VREG("smps9", "smp%s9", &pmic5_ftsmps510, "vdd-s9"),
RPMH_VREG("smps10", "smp%s10", &pmic5_ftsmps510, "vdd-s10"),
RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo, "vdd-l1-l8-l11"),
RPMH_VREG("ldo2", "ldo%s2", &pmic5_pldo, "vdd-l2-l10"),
RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo, "vdd-l3-l4-l5-l18"),
RPMH_VREG("ldo4", "ldo%s4", &pmic5_nldo, "vdd-l3-l4-l5-l18"),
RPMH_VREG("ldo5", "ldo%s5", &pmic5_nldo, "vdd-l3-l4-l5-l18"),
RPMH_VREG("ldo6", "ldo%s6", &pmic5_nldo, "vdd-l6-l9"),
RPMH_VREG("ldo7", "ldo%s7", &pmic5_pldo, "vdd-l7-l12-l14-l15"),
RPMH_VREG("ldo8", "ldo%s8", &pmic5_nldo, "vdd-l1-l8-l11"),
RPMH_VREG("ldo9", "ldo%s9", &pmic5_nldo, "vdd-l6-l9"),
RPMH_VREG("ldo10", "ldo%s10", &pmic5_pldo, "vdd-l2-l10"),
RPMH_VREG("ldo11", "ldo%s11", &pmic5_nldo, "vdd-l1-l8-l11"),
RPMH_VREG("ldo12", "ldo%s12", &pmic5_pldo_lv, "vdd-l7-l12-l14-l15"),
RPMH_VREG("ldo13", "ldo%s13", &pmic5_pldo, "vdd-l13-l6-l17"),
RPMH_VREG("ldo14", "ldo%s14", &pmic5_pldo_lv, "vdd-l7-l12-l14-l15"),
RPMH_VREG("ldo15", "ldo%s15", &pmic5_pldo_lv, "vdd-l7-l12-l14-l15"),
RPMH_VREG("ldo16", "ldo%s16", &pmic5_pldo, "vdd-l13-l6-l17"),
RPMH_VREG("ldo17", "ldo%s17", &pmic5_pldo, "vdd-l13-l6-l17"),
RPMH_VREG("ldo18", "ldo%s18", &pmic5_nldo, "vdd-l3-l4-l5-l18"),
{},
};
static const struct rpmh_vreg_init_data pm8150l_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps510, "vdd-s1"),
RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps510, "vdd-s2"),
RPMH_VREG("smps3", "smp%s3", &pmic5_ftsmps510, "vdd-s3"),
RPMH_VREG("smps4", "smp%s4", &pmic5_ftsmps510, "vdd-s4"),
RPMH_VREG("smps5", "smp%s5", &pmic5_ftsmps510, "vdd-s5"),
RPMH_VREG("smps6", "smp%s6", &pmic5_ftsmps510, "vdd-s6"),
RPMH_VREG("smps7", "smp%s7", &pmic5_ftsmps510, "vdd-s7"),
RPMH_VREG("smps8", "smp%s8", &pmic5_hfsmps510, "vdd-s8"),
RPMH_VREG("ldo1", "ldo%s1", &pmic5_pldo_lv, "vdd-l1-l8"),
RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo, "vdd-l2-l3"),
RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo, "vdd-l2-l3"),
RPMH_VREG("ldo4", "ldo%s4", &pmic5_pldo, "vdd-l4-l5-l6"),
RPMH_VREG("ldo5", "ldo%s5", &pmic5_pldo, "vdd-l4-l5-l6"),
RPMH_VREG("ldo6", "ldo%s6", &pmic5_pldo, "vdd-l4-l5-l6"),
RPMH_VREG("ldo7", "ldo%s7", &pmic5_pldo, "vdd-l7-l11"),
RPMH_VREG("ldo8", "ldo%s8", &pmic5_pldo_lv, "vdd-l1-l8-l11"),
RPMH_VREG("ldo9", "ldo%s9", &pmic5_pldo, "vdd-l9-l10"),
RPMH_VREG("ldo10", "ldo%s10", &pmic5_pldo, "vdd-l9-l10"),
RPMH_VREG("ldo11", "ldo%s11", &pmic5_pldo, "vdd-l7-l11"),
RPMH_VREG("bob", "bob%s1", &pmic5_bob, "vdd-bob"),
{},
};
static const struct rpmh_vreg_init_data pm8009_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic5_hfsmps510, "vdd-s1"),
RPMH_VREG("smps2", "smp%s2", &pmic5_hfsmps515, "vdd-s2"),
RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo, "vdd-l1"),
RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo, "vdd-l2"),
RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo, "vdd-l3"),
RPMH_VREG("ldo4", "ldo%s4", &pmic5_nldo, "vdd-l4"),
RPMH_VREG("ldo5", "ldo%s5", &pmic5_pldo, "vdd-l5-l6"),
RPMH_VREG("ldo6", "ldo%s6", &pmic5_pldo, "vdd-l5-l6"),
RPMH_VREG("ldo7", "ldo%s6", &pmic5_pldo_lv, "vdd-l7"),
{},
};
static int rpmh_regulator_probe(struct platform_device *pdev) static int rpmh_regulator_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
...@@ -743,6 +916,22 @@ static int rpmh_regulator_probe(struct platform_device *pdev) ...@@ -743,6 +916,22 @@ static int rpmh_regulator_probe(struct platform_device *pdev)
} }
static const struct of_device_id rpmh_regulator_match_table[] = { static const struct of_device_id rpmh_regulator_match_table[] = {
{
.compatible = "qcom,pm8005-rpmh-regulators",
.data = pm8005_vreg_data,
},
{
.compatible = "qcom,pm8009-rpmh-regulators",
.data = pm8009_vreg_data,
},
{
.compatible = "qcom,pm8150-rpmh-regulators",
.data = pm8150_vreg_data,
},
{
.compatible = "qcom,pm8150l-rpmh-regulators",
.data = pm8150l_vreg_data,
},
{ {
.compatible = "qcom,pm8998-rpmh-regulators", .compatible = "qcom,pm8998-rpmh-regulators",
.data = pm8998_vreg_data, .data = pm8998_vreg_data,
...@@ -751,10 +940,6 @@ static const struct of_device_id rpmh_regulator_match_table[] = { ...@@ -751,10 +940,6 @@ static const struct of_device_id rpmh_regulator_match_table[] = {
.compatible = "qcom,pmi8998-rpmh-regulators", .compatible = "qcom,pmi8998-rpmh-regulators",
.data = pmi8998_vreg_data, .data = pmi8998_vreg_data,
}, },
{
.compatible = "qcom,pm8005-rpmh-regulators",
.data = pm8005_vreg_data,
},
{} {}
}; };
MODULE_DEVICE_TABLE(of, rpmh_regulator_match_table); MODULE_DEVICE_TABLE(of, rpmh_regulator_match_table);
......
...@@ -606,7 +606,7 @@ static unsigned int rk8xx_regulator_of_map_mode(unsigned int mode) ...@@ -606,7 +606,7 @@ static unsigned int rk8xx_regulator_of_map_mode(unsigned int mode)
case 2: case 2:
return REGULATOR_MODE_NORMAL; return REGULATOR_MODE_NORMAL;
default: default:
return -EINVAL; return REGULATOR_MODE_INVALID;
} }
} }
......
...@@ -1226,7 +1226,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) ...@@ -1226,7 +1226,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
goto out; goto out;
} }
if (s2mps11->ext_control_gpiod[i]) { if (config.ena_gpiod) {
ret = s2mps14_pmic_enable_ext_control(s2mps11, ret = s2mps14_pmic_enable_ext_control(s2mps11,
regulator); regulator);
if (ret < 0) { if (ret < 0) {
......
...@@ -447,19 +447,20 @@ static int slg51000_i2c_probe(struct i2c_client *client, ...@@ -447,19 +447,20 @@ static int slg51000_i2c_probe(struct i2c_client *client,
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct slg51000 *chip; struct slg51000 *chip;
struct gpio_desc *cs_gpiod = NULL; struct gpio_desc *cs_gpiod;
int error, ret; int error, ret;
chip = devm_kzalloc(dev, sizeof(struct slg51000), GFP_KERNEL); chip = devm_kzalloc(dev, sizeof(struct slg51000), GFP_KERNEL);
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
cs_gpiod = devm_gpiod_get_from_of_node(dev, dev->of_node, cs_gpiod = devm_gpiod_get_optional(dev, "dlg,cs",
"dlg,cs-gpios", 0, GPIOD_OUT_HIGH |
GPIOD_OUT_HIGH GPIOD_FLAGS_BIT_NONEXCLUSIVE);
| GPIOD_FLAGS_BIT_NONEXCLUSIVE, if (IS_ERR(cs_gpiod))
"slg51000-cs"); return PTR_ERR(cs_gpiod);
if (!IS_ERR(cs_gpiod)) {
if (cs_gpiod) {
dev_info(dev, "Found chip selector property\n"); dev_info(dev, "Found chip selector property\n");
chip->cs_gpiod = cs_gpiod; chip->cs_gpiod = cs_gpiod;
} }
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#define STM32MP1_SYSCFG_EN_BOOSTER_MASK BIT(8) #define STM32MP1_SYSCFG_EN_BOOSTER_MASK BIT(8)
static const struct regulator_ops stm32h7_booster_ops = { static const struct regulator_ops stm32h7_booster_ops = {
.list_voltage = regulator_list_voltage_linear,
.enable = regulator_enable_regmap, .enable = regulator_enable_regmap,
.disable = regulator_disable_regmap, .disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap, .is_enabled = regulator_is_enabled_regmap,
...@@ -31,7 +30,6 @@ static const struct regulator_desc stm32h7_booster_desc = { ...@@ -31,7 +30,6 @@ static const struct regulator_desc stm32h7_booster_desc = {
.supply_name = "vdda", .supply_name = "vdda",
.n_voltages = 1, .n_voltages = 1,
.type = REGULATOR_VOLTAGE, .type = REGULATOR_VOLTAGE,
.min_uV = 3300000,
.fixed_uV = 3300000, .fixed_uV = 3300000,
.ramp_delay = 66000, /* up to 50us to stabilize */ .ramp_delay = 66000, /* up to 50us to stabilize */
.ops = &stm32h7_booster_ops, .ops = &stm32h7_booster_ops,
...@@ -53,7 +51,6 @@ static int stm32mp1_booster_disable(struct regulator_dev *rdev) ...@@ -53,7 +51,6 @@ static int stm32mp1_booster_disable(struct regulator_dev *rdev)
} }
static const struct regulator_ops stm32mp1_booster_ops = { static const struct regulator_ops stm32mp1_booster_ops = {
.list_voltage = regulator_list_voltage_linear,
.enable = stm32mp1_booster_enable, .enable = stm32mp1_booster_enable,
.disable = stm32mp1_booster_disable, .disable = stm32mp1_booster_disable,
.is_enabled = regulator_is_enabled_regmap, .is_enabled = regulator_is_enabled_regmap,
...@@ -64,7 +61,6 @@ static const struct regulator_desc stm32mp1_booster_desc = { ...@@ -64,7 +61,6 @@ static const struct regulator_desc stm32mp1_booster_desc = {
.supply_name = "vdda", .supply_name = "vdda",
.n_voltages = 1, .n_voltages = 1,
.type = REGULATOR_VOLTAGE, .type = REGULATOR_VOLTAGE,
.min_uV = 3300000,
.fixed_uV = 3300000, .fixed_uV = 3300000,
.ramp_delay = 66000, .ramp_delay = 66000,
.ops = &stm32mp1_booster_ops, .ops = &stm32mp1_booster_ops,
......
// SPDX-License-Identifier: GPL-2.0
//
// SY8824C/SY8824E regulator driver
//
// Copyright (C) 2019 Synaptics Incorporated
//
// Author: Jisheng Zhang <jszhang@kernel.org>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/of_regulator.h>
#define SY8824C_BUCK_EN (1 << 7)
#define SY8824C_MODE (1 << 6)
struct sy8824_config {
/* registers */
unsigned int vol_reg;
unsigned int mode_reg;
unsigned int enable_reg;
/* Voltage range and step(linear) */
unsigned int vsel_min;
unsigned int vsel_step;
unsigned int vsel_count;
};
struct sy8824_device_info {
struct device *dev;
struct regulator_desc desc;
struct regulator_init_data *regulator;
const struct sy8824_config *cfg;
};
static int sy8824_set_mode(struct regulator_dev *rdev, unsigned int mode)
{
struct sy8824_device_info *di = rdev_get_drvdata(rdev);
const struct sy8824_config *cfg = di->cfg;
switch (mode) {
case REGULATOR_MODE_FAST:
regmap_update_bits(rdev->regmap, cfg->mode_reg,
SY8824C_MODE, SY8824C_MODE);
break;
case REGULATOR_MODE_NORMAL:
regmap_update_bits(rdev->regmap, cfg->mode_reg,
SY8824C_MODE, 0);
break;
default:
return -EINVAL;
}
return 0;
}
static unsigned int sy8824_get_mode(struct regulator_dev *rdev)
{
struct sy8824_device_info *di = rdev_get_drvdata(rdev);
const struct sy8824_config *cfg = di->cfg;
u32 val;
int ret = 0;
ret = regmap_read(rdev->regmap, cfg->mode_reg, &val);
if (ret < 0)
return ret;
if (val & SY8824C_MODE)
return REGULATOR_MODE_FAST;
else
return REGULATOR_MODE_NORMAL;
}
static const struct regulator_ops sy8824_regulator_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
.map_voltage = regulator_map_voltage_linear,
.list_voltage = regulator_list_voltage_linear,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.set_mode = sy8824_set_mode,
.get_mode = sy8824_get_mode,
};
static int sy8824_regulator_register(struct sy8824_device_info *di,
struct regulator_config *config)
{
struct regulator_desc *rdesc = &di->desc;
const struct sy8824_config *cfg = di->cfg;
struct regulator_dev *rdev;
rdesc->name = "sy8824-reg";
rdesc->supply_name = "vin";
rdesc->ops = &sy8824_regulator_ops;
rdesc->type = REGULATOR_VOLTAGE;
rdesc->n_voltages = cfg->vsel_count;
rdesc->enable_reg = cfg->enable_reg;
rdesc->enable_mask = SY8824C_BUCK_EN;
rdesc->min_uV = cfg->vsel_min;
rdesc->uV_step = cfg->vsel_step;
rdesc->vsel_reg = cfg->vol_reg;
rdesc->vsel_mask = cfg->vsel_count - 1;
rdesc->owner = THIS_MODULE;
rdev = devm_regulator_register(di->dev, &di->desc, config);
return PTR_ERR_OR_ZERO(rdev);
}
static const struct regmap_config sy8824_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
static int sy8824_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
struct device_node *np = dev->of_node;
struct sy8824_device_info *di;
struct regulator_config config = { };
struct regmap *regmap;
int ret;
di = devm_kzalloc(dev, sizeof(struct sy8824_device_info), GFP_KERNEL);
if (!di)
return -ENOMEM;
di->regulator = of_get_regulator_init_data(dev, np, &di->desc);
if (!di->regulator) {
dev_err(dev, "Platform data not found!\n");
return -EINVAL;
}
di->dev = dev;
di->cfg = of_device_get_match_data(dev);
regmap = devm_regmap_init_i2c(client, &sy8824_regmap_config);
if (IS_ERR(regmap)) {
dev_err(dev, "Failed to allocate regmap!\n");
return PTR_ERR(regmap);
}
i2c_set_clientdata(client, di);
config.dev = di->dev;
config.init_data = di->regulator;
config.regmap = regmap;
config.driver_data = di;
config.of_node = np;
ret = sy8824_regulator_register(di, &config);
if (ret < 0)
dev_err(dev, "Failed to register regulator!\n");
return ret;
}
static const struct sy8824_config sy8824c_cfg = {
.vol_reg = 0x00,
.mode_reg = 0x00,
.enable_reg = 0x00,
.vsel_min = 762500,
.vsel_step = 12500,
.vsel_count = 64,
};
static const struct sy8824_config sy8824e_cfg = {
.vol_reg = 0x00,
.mode_reg = 0x00,
.enable_reg = 0x00,
.vsel_min = 700000,
.vsel_step = 12500,
.vsel_count = 64,
};
static const struct sy8824_config sy20276_cfg = {
.vol_reg = 0x00,
.mode_reg = 0x01,
.enable_reg = 0x01,
.vsel_min = 600000,
.vsel_step = 10000,
.vsel_count = 128,
};
static const struct sy8824_config sy20278_cfg = {
.vol_reg = 0x00,
.mode_reg = 0x01,
.enable_reg = 0x01,
.vsel_min = 762500,
.vsel_step = 12500,
.vsel_count = 64,
};
static const struct of_device_id sy8824_dt_ids[] = {
{
.compatible = "silergy,sy8824c",
.data = &sy8824c_cfg
},
{
.compatible = "silergy,sy8824e",
.data = &sy8824e_cfg
},
{
.compatible = "silergy,sy20276",
.data = &sy20276_cfg
},
{
.compatible = "silergy,sy20278",
.data = &sy20278_cfg
},
{ }
};
MODULE_DEVICE_TABLE(of, sy8824_dt_ids);
static const struct i2c_device_id sy8824_id[] = {
{ "sy8824", },
{ },
};
MODULE_DEVICE_TABLE(i2c, sy8824_id);
static struct i2c_driver sy8824_regulator_driver = {
.driver = {
.name = "sy8824-regulator",
.of_match_table = of_match_ptr(sy8824_dt_ids),
},
.probe = sy8824_i2c_probe,
.id_table = sy8824_id,
};
module_i2c_driver(sy8824_regulator_driver);
MODULE_AUTHOR("Jisheng Zhang <jszhang@kernel.org>");
MODULE_DESCRIPTION("SY8824C/SY8824E regulator driver");
MODULE_LICENSE("GPL v2");
...@@ -138,7 +138,7 @@ static int tps65132_of_parse_cb(struct device_node *np, ...@@ -138,7 +138,7 @@ static int tps65132_of_parse_cb(struct device_node *np,
rpdata->en_gpiod = devm_fwnode_get_index_gpiod_from_child(tps->dev, rpdata->en_gpiod = devm_fwnode_get_index_gpiod_from_child(tps->dev,
"enable", 0, &np->fwnode, 0, "enable"); "enable", 0, &np->fwnode, 0, "enable");
if (IS_ERR(rpdata->en_gpiod)) { if (IS_ERR_OR_NULL(rpdata->en_gpiod)) {
ret = PTR_ERR(rpdata->en_gpiod); ret = PTR_ERR(rpdata->en_gpiod);
/* Ignore the error other than probe defer */ /* Ignore the error other than probe defer */
...@@ -150,7 +150,7 @@ static int tps65132_of_parse_cb(struct device_node *np, ...@@ -150,7 +150,7 @@ static int tps65132_of_parse_cb(struct device_node *np,
rpdata->act_dis_gpiod = devm_fwnode_get_index_gpiod_from_child( rpdata->act_dis_gpiod = devm_fwnode_get_index_gpiod_from_child(
tps->dev, "active-discharge", 0, tps->dev, "active-discharge", 0,
&np->fwnode, 0, "active-discharge"); &np->fwnode, 0, "active-discharge");
if (IS_ERR(rpdata->act_dis_gpiod)) { if (IS_ERR_OR_NULL(rpdata->act_dis_gpiod)) {
ret = PTR_ERR(rpdata->act_dis_gpiod); ret = PTR_ERR(rpdata->act_dis_gpiod);
/* Ignore the error other than probe defer */ /* Ignore the error other than probe defer */
......
...@@ -57,6 +57,9 @@ struct twlreg_info { ...@@ -57,6 +57,9 @@ struct twlreg_info {
#define VREG_BC_PROC 3 #define VREG_BC_PROC 3
#define VREG_BC_CLK_RST 4 #define VREG_BC_CLK_RST 4
/* TWL6030 LDO register values for VREG_VOLTAGE */
#define TWL6030_VREG_VOLTAGE_WR_S BIT(7)
/* TWL6030 LDO register values for CFG_STATE */ /* TWL6030 LDO register values for CFG_STATE */
#define TWL6030_CFG_STATE_OFF 0x00 #define TWL6030_CFG_STATE_OFF 0x00
#define TWL6030_CFG_STATE_ON 0x01 #define TWL6030_CFG_STATE_ON 0x01
...@@ -68,9 +71,10 @@ struct twlreg_info { ...@@ -68,9 +71,10 @@ struct twlreg_info {
#define TWL6030_CFG_STATE_APP(v) (((v) & TWL6030_CFG_STATE_APP_MASK) >>\ #define TWL6030_CFG_STATE_APP(v) (((v) & TWL6030_CFG_STATE_APP_MASK) >>\
TWL6030_CFG_STATE_APP_SHIFT) TWL6030_CFG_STATE_APP_SHIFT)
/* Flags for SMPS Voltage reading */ /* Flags for SMPS Voltage reading and LDO reading*/
#define SMPS_OFFSET_EN BIT(0) #define SMPS_OFFSET_EN BIT(0)
#define SMPS_EXTENDED_EN BIT(1) #define SMPS_EXTENDED_EN BIT(1)
#define TWL_6030_WARM_RESET BIT(3)
/* twl6032 SMPS EPROM values */ /* twl6032 SMPS EPROM values */
#define TWL6030_SMPS_OFFSET 0xB0 #define TWL6030_SMPS_OFFSET 0xB0
...@@ -250,6 +254,9 @@ twl6030ldo_set_voltage_sel(struct regulator_dev *rdev, unsigned selector) ...@@ -250,6 +254,9 @@ twl6030ldo_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
{ {
struct twlreg_info *info = rdev_get_drvdata(rdev); struct twlreg_info *info = rdev_get_drvdata(rdev);
if (info->flags & TWL_6030_WARM_RESET)
selector |= TWL6030_VREG_VOLTAGE_WR_S;
return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE, return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE,
selector); selector);
} }
...@@ -259,6 +266,9 @@ static int twl6030ldo_get_voltage_sel(struct regulator_dev *rdev) ...@@ -259,6 +266,9 @@ static int twl6030ldo_get_voltage_sel(struct regulator_dev *rdev)
struct twlreg_info *info = rdev_get_drvdata(rdev); struct twlreg_info *info = rdev_get_drvdata(rdev);
int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE); int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE);
if (info->flags & TWL_6030_WARM_RESET)
vsel &= ~TWL6030_VREG_VOLTAGE_WR_S;
return vsel; return vsel;
} }
...@@ -665,14 +675,14 @@ static int twlreg_probe(struct platform_device *pdev) ...@@ -665,14 +675,14 @@ static int twlreg_probe(struct platform_device *pdev)
struct regulation_constraints *c; struct regulation_constraints *c;
struct regulator_dev *rdev; struct regulator_dev *rdev;
struct regulator_config config = { }; struct regulator_config config = { };
struct device_node *np = pdev->dev.of_node;
template = of_device_get_match_data(&pdev->dev); template = of_device_get_match_data(&pdev->dev);
if (!template) if (!template)
return -ENODEV; return -ENODEV;
id = template->desc.id; id = template->desc.id;
initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node, initdata = of_get_regulator_init_data(&pdev->dev, np, &template->desc);
&template->desc);
if (!initdata) if (!initdata)
return -EINVAL; return -EINVAL;
...@@ -710,10 +720,13 @@ static int twlreg_probe(struct platform_device *pdev) ...@@ -710,10 +720,13 @@ static int twlreg_probe(struct platform_device *pdev)
break; break;
} }
if (of_get_property(np, "ti,retain-on-reset", NULL))
info->flags |= TWL_6030_WARM_RESET;
config.dev = &pdev->dev; config.dev = &pdev->dev;
config.init_data = initdata; config.init_data = initdata;
config.driver_data = info; config.driver_data = info;
config.of_node = pdev->dev.of_node; config.of_node = np;
rdev = devm_regulator_register(&pdev->dev, &info->desc, &config); rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
......
...@@ -185,6 +185,10 @@ static const struct of_device_id uniphier_regulator_match[] = { ...@@ -185,6 +185,10 @@ static const struct of_device_id uniphier_regulator_match[] = {
.compatible = "socionext,uniphier-pro4-usb3-regulator", .compatible = "socionext,uniphier-pro4-usb3-regulator",
.data = &uniphier_pro4_usb3_data, .data = &uniphier_pro4_usb3_data,
}, },
{
.compatible = "socionext,uniphier-pro5-usb3-regulator",
.data = &uniphier_pro4_usb3_data,
},
{ {
.compatible = "socionext,uniphier-pxs2-usb3-regulator", .compatible = "socionext,uniphier-pxs2-usb3-regulator",
.data = &uniphier_pxs2_usb3_data, .data = &uniphier_pxs2_usb3_data,
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Device Tree binding constants for the ACT8865 PMIC regulators
*/
#ifndef _DT_BINDINGS_REGULATOR_ACT8865_H
#define _DT_BINDINGS_REGULATOR_ACT8865_H
/*
* These constants should be used to specify regulator modes in device tree for
* ACT8865 regulators as follows:
* ACT8865_REGULATOR_MODE_FIXED: It is specific to DCDC regulators and it
* specifies the usage of fixed-frequency
* PWM.
*
* ACT8865_REGULATOR_MODE_NORMAL: It is specific to LDO regulators and it
* specifies the usage of normal mode.
*
* ACT8865_REGULATOR_MODE_LOWPOWER: For DCDC and LDO regulators; it specify
* the usage of proprietary power-saving
* mode.
*/
#define ACT8865_REGULATOR_MODE_FIXED 1
#define ACT8865_REGULATOR_MODE_NORMAL 2
#define ACT8865_REGULATOR_MODE_LOWPOWER 3
#endif
...@@ -281,6 +281,12 @@ void devm_regulator_unregister_notifier(struct regulator *regulator, ...@@ -281,6 +281,12 @@ void devm_regulator_unregister_notifier(struct regulator *regulator,
void *regulator_get_drvdata(struct regulator *regulator); void *regulator_get_drvdata(struct regulator *regulator);
void regulator_set_drvdata(struct regulator *regulator, void *data); void regulator_set_drvdata(struct regulator *regulator, void *data);
/* misc helpers */
void regulator_bulk_set_supply_names(struct regulator_bulk_data *consumers,
const char *const *supply_names,
unsigned int num_supplies);
#else #else
/* /*
...@@ -580,6 +586,13 @@ static inline int regulator_list_voltage(struct regulator *regulator, unsigned s ...@@ -580,6 +586,13 @@ static inline int regulator_list_voltage(struct regulator *regulator, unsigned s
return -EINVAL; return -EINVAL;
} }
static inline void
regulator_bulk_set_supply_names(struct regulator_bulk_data *consumers,
const char *const *supply_names,
unsigned int num_supplies)
{
}
#endif #endif
static inline int regulator_set_voltage_triplet(struct regulator *regulator, static inline int regulator_set_voltage_triplet(struct regulator *regulator,
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __LINUX_REGULATOR_MT6358_H
#define __LINUX_REGULATOR_MT6358_H
enum {
MT6358_ID_VDRAM1 = 0,
MT6358_ID_VCORE,
MT6358_ID_VPA,
MT6358_ID_VPROC11,
MT6358_ID_VPROC12,
MT6358_ID_VGPU,
MT6358_ID_VS2,
MT6358_ID_VMODEM,
MT6358_ID_VS1,
MT6358_ID_VDRAM2 = 9,
MT6358_ID_VSIM1,
MT6358_ID_VIBR,
MT6358_ID_VRF12,
MT6358_ID_VIO18,
MT6358_ID_VUSB,
MT6358_ID_VCAMIO,
MT6358_ID_VCAMD,
MT6358_ID_VCN18,
MT6358_ID_VFE28,
MT6358_ID_VSRAM_PROC11,
MT6358_ID_VCN28,
MT6358_ID_VSRAM_OTHERS,
MT6358_ID_VSRAM_GPU,
MT6358_ID_VXO22,
MT6358_ID_VEFUSE,
MT6358_ID_VAUX18,
MT6358_ID_VMCH,
MT6358_ID_VBIF28,
MT6358_ID_VSRAM_PROC12,
MT6358_ID_VCAMA1,
MT6358_ID_VEMC,
MT6358_ID_VIO28,
MT6358_ID_VA12,
MT6358_ID_VRF18,
MT6358_ID_VCN33_BT,
MT6358_ID_VCN33_WIFI,
MT6358_ID_VCAMA2,
MT6358_ID_VMC,
MT6358_ID_VLDO28,
MT6358_ID_VAUD28,
MT6358_ID_VSIM2,
MT6358_ID_RG_MAX,
};
#define MT6358_MAX_REGULATOR MT6358_ID_RG_MAX
#endif /* __LINUX_REGULATOR_MT6358_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment