Commit d6ccf451 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull regulator updates from Mark Brown:
 "Quite a quiet release for the regulator API, mainly a few new drivers
  plus a lot of fixes for the Raspberry Pi panel driver.

  There's also a SPI commit in here which I managed to apply to the
  wrong tree and then didn't notice until there were too many commits on
  top of it, sorry about that.

   - Make it easier to use the virtual consumer test driver with DT
     systems.

   - Substantial overhaul providing various fixes and robustness
     improvements for the Raspberry Pi panel driver.

   - Support for Qualcomm PMX65 and SDX65, Richtek RT5190A, and Texas
     Instruments TPS62864x"

* tag 'regulator-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (26 commits)
  regulator: qcom-rpmh: Add support for SDX65
  regulator: dt-bindings: Add PMX65 compatibles
  regulator: vctrl: Use min() instead of doing it manually
  regulator: rt5190a: Add support for Richtek RT5190A PMIC
  regulator: Add bindings for Richtek RT5190A PMIC
  regulator: Convert TPS62360 binding to json-schema
  regulator: cleanup comments
  regulator: virtual: add devicetree support
  regulator: virtual: warn against production use
  regulator: virtual: use dev_err_probe()
  regulator: tps62864: Fix bindings for SW property
  regulator: Add support for TPS6286x
  regulator: Add bindings for TPS62864x
  regulator/rpi-panel-attiny: Use two transactions for I2C read
  regulator/rpi-panel-attiny: Use the regmap cache
  regulator: rpi-panel: Remove get_brightness hook
  regulator: rpi-panel: Add GPIO control for panel and touch resets
  regulator: rpi-panel: Convert to drive lines directly
  regulator: rpi-panel: Ensure the backlight is off during probe.
  regulator: rpi-panel: Serialise operations.
  ...
parents a50a8c38 5999f85d
...@@ -113,7 +113,7 @@ examples: ...@@ -113,7 +113,7 @@ examples:
}; };
- | - |
#include <dt-bindings/gpio/tegra-gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/irq.h>
i2c { i2c {
...@@ -123,8 +123,7 @@ examples: ...@@ -123,8 +123,7 @@ examples:
regulator@1b { regulator@1b {
compatible = "maxim,max77621"; compatible = "maxim,max77621";
reg = <0x1b>; reg = <0x1b>;
interrupt-parent = <&gpio>; interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
interrupts = <TEGRA_GPIO(Y, 1) IRQ_TYPE_LEVEL_LOW>;
regulator-always-on; regulator-always-on;
regulator-boot-on; regulator-boot-on;
......
...@@ -70,7 +70,11 @@ properties: ...@@ -70,7 +70,11 @@ properties:
$ref: "regulator.yaml#" $ref: "regulator.yaml#"
type: object type: object
"^(vsnvs|vref|vrefddr|swbst|coin)$": "^vldo[1-4]$":
$ref: "regulator.yaml#"
type: object
"^(vsnvs|vref|vrefddr|swbst|coin|v33|vccsd)$":
$ref: "regulator.yaml#" $ref: "regulator.yaml#"
type: object type: object
......
...@@ -48,6 +48,7 @@ description: | ...@@ -48,6 +48,7 @@ description: |
For PMI8998, bob For PMI8998, bob
For PMR735A, smps1 - smps3, ldo1 - ldo7 For PMR735A, smps1 - smps3, ldo1 - ldo7
For PMX55, smps1 - smps7, ldo1 - ldo16 For PMX55, smps1 - smps7, ldo1 - ldo16
For PMX65, smps1 - smps8, ldo1 - ldo21
properties: properties:
compatible: compatible:
...@@ -70,6 +71,7 @@ properties: ...@@ -70,6 +71,7 @@ properties:
- qcom,pmm8155au-rpmh-regulators - qcom,pmm8155au-rpmh-regulators
- qcom,pmr735a-rpmh-regulators - qcom,pmr735a-rpmh-regulators
- qcom,pmx55-rpmh-regulators - qcom,pmx55-rpmh-regulators
- qcom,pmx65-rpmh-regulators
qcom,pmic-id: qcom,pmic-id:
description: | description: |
......
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/richtek,rt5190a-regulator.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Richtek RT5190A PMIC Regulator
maintainers:
- ChiYuan Huang <cy_huang@richtek.com>
description: |
The RT5190A integrates 1 channel buck controller, 3 channels high efficiency
synchronous buck converters, 1 LDO, I2C control interface and peripherial
logical control.
It also supports mute AC OFF depop sound and quick setting storage while
input power is removed.
properties:
compatible:
enum:
- richtek,rt5190a
reg:
maxItems: 1
interrupts:
maxItems: 1
vin2-supply:
description: phandle to buck2 input voltage.
vin3-supply:
description: phandle to buck3 input voltage.
vin4-supply:
description: phandle to buck4 input voltage.
vinldo-supply:
description: phandle to ldo input voltage
richtek,mute-enable:
description: |
The mute function uses 'mutein', 'muteout', and 'vdet' pins as the control
signal. When enabled, The normal behavior is to bypass the 'mutein' signal
'muteout'. But if the power source removal is detected from 'vdet',
whatever the 'mutein' signal is, it will pull down the 'muteout' to force
speakers mute. this function is commonly used to prevent the speaker pop
noise during AC power turned off in the modern TV system design.
type: boolean
regulators:
type: object
patternProperties:
"^buck[1-4]$|^ldo$":
type: object
$ref: regulator.yaml#
description: |
regulator description for buck1 and buck4.
properties:
regulator-allowed-modes:
description: |
buck operating mode, only buck1/4 support mode operating.
0: auto mode
1: force pwm mode
items:
enum: [0, 1]
richtek,latchup-enable:
type: boolean
description: |
If specified, undervolt protection mode changes from the default
hiccup to latchup.
unevaluatedProperties: false
additionalProperties: false
required:
- compatible
- reg
- regulators
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/regulator/richtek,rt5190a-regulator.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
pmic@64 {
compatible = "richtek,rt5190a";
reg = <0x64>;
interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;
vin2-supply = <&rt5190_buck1>;
vin3-supply = <&rt5190_buck1>;
vin4-supply = <&rt5190_buck1>;
regulators {
rt5190_buck1: buck1 {
regulator-name = "rt5190a-buck1";
regulator-min-microvolt = <5090000>;
regulator-max-microvolt = <5090000>;
regulator-allowed-modes = <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
regulator-boot-on;
};
buck2 {
regulator-name = "rt5190a-buck2";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <1400000>;
regulator-boot-on;
};
buck3 {
regulator-name = "rt5190a-buck3";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <1400000>;
regulator-boot-on;
};
buck4 {
regulator-name = "rt5190a-buck4";
regulator-min-microvolt = <850000>;
regulator-max-microvolt = <850000>;
regulator-allowed-modes = <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
regulator-boot-on;
};
ldo {
regulator-name = "rt5190a-ldo";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
regulator-boot-on;
};
};
};
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/ti,tps62360.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Texas Instruments TPS6236x Voltage Regulators
maintainers:
- Laxman Dewangan <ldewangan@nvidia.com>
description: |
The TPS6236x are a family of step down dc-dc converter with
an input voltage range of 2.5V to 5.5V. The devices provide
up to 3A peak load current, and an output voltage range of
0.77V to 1.4V (TPS62360/62) and 0.5V to 1.77V (TPS62361B/63).
Datasheet is available at:
https://www.ti.com/lit/gpn/tps62360
allOf:
- $ref: "regulator.yaml#"
properties:
compatible:
enum:
- ti,tps62360
- ti,tps62361
- ti,tps62362
- ti,tps62363
reg:
maxItems: 1
ti,vsel0-gpio:
description: |
GPIO for controlling VSEL0 line. If this property
is missing, then assume that there is no GPIO for
VSEL0 control.
maxItems: 1
ti,vsel1-gpio:
description: |
GPIO for controlling VSEL1 line. If this property
is missing, then assume that there is no GPIO for
VSEL1 control.
maxItems: 1
ti,enable-vout-discharge:
description: Enable output discharge.
type: boolean
ti,enable-pull-down:
description: Enable pull down.
type: boolean
ti,vsel0-state-high:
description: |
Initial state of VSEL0 input is high. If this property
is missing, then assume the state as low.
type: boolean
ti,vsel1-state-high:
description: |
Initial state of VSEL1 input is high. If this property
is missing, then assume the state as low.
type: boolean
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@60 {
compatible = "ti,tps62361";
reg = <0x60>;
regulator-name = "tps62361-vout";
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <1500000>;
regulator-boot-on;
ti,vsel0-gpio = <&gpio1 16 GPIO_ACTIVE_HIGH>;
ti,vsel1-gpio = <&gpio1 17 GPIO_ACTIVE_HIGH>;
ti,vsel0-state-high;
ti,vsel1-state-high;
ti,enable-pull-down;
ti,enable-vout-discharge;
};
};
...
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/ti,tps62864.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: TI TPS62864/TPS6286/TPS62868/TPS62869 voltage regulator
maintainers:
- Vincent Whitchurch <vincent.whitchurch@axis.com>
properties:
compatible:
enum:
- ti,tps62864
- ti,tps62866
- ti,tps62868
- ti,tps62869
reg:
maxItems: 1
regulators:
type: object
properties:
"SW":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
additionalProperties: false
required:
- compatible
- reg
- regulators
additionalProperties: false
examples:
- |
#include <dt-bindings/regulator/ti,tps62864.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@48 {
compatible = "ti,tps62864";
reg = <0x48>;
regulators {
SW {
regulator-name = "+0.85V";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <890000>;
regulator-initial-mode = <TPS62864_MODE_FPWM>;
};
};
};
};
...
TPS62360 Voltage regulators
Required properties:
- compatible: Must be one of the following.
"ti,tps62360"
"ti,tps62361",
"ti,tps62362",
"ti,tps62363",
- reg: I2C slave address
Optional properties:
- ti,enable-vout-discharge: Enable output discharge. This is boolean value.
- ti,enable-pull-down: Enable pull down. This is boolean value.
- ti,vsel0-gpio: GPIO for controlling VSEL0 line.
If this property is missing, then assume that there is no GPIO
for vsel0 control.
- ti,vsel1-gpio: Gpio for controlling VSEL1 line.
If this property is missing, then assume that there is no GPIO
for vsel1 control.
- ti,vsel0-state-high: Initial state of vsel0 input is high.
If this property is missing, then assume the state as low (0).
- ti,vsel1-state-high: Initial state of vsel1 input is high.
If this property is missing, then assume the state as low (0).
Any property defined as part of the core regulator binding, defined in
regulator.txt, can also be used.
Example:
abc: tps62360 {
compatible = "ti,tps62361";
reg = <0x60>;
regulator-name = "tps62361-vout";
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <1500000>;
regulator-boot-on
ti,vsel0-gpio = <&gpio1 16 0>;
ti,vsel1-gpio = <&gpio1 17 0>;
ti,vsel0-state-high;
ti,vsel1-state-high;
ti,enable-pull-down;
ti,enable-force-pwm;
ti,enable-vout-discharge;
};
...@@ -984,6 +984,7 @@ config REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY ...@@ -984,6 +984,7 @@ config REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY
tristate "Raspberry Pi 7-inch touchscreen panel ATTINY regulator" tristate "Raspberry Pi 7-inch touchscreen panel ATTINY regulator"
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on I2C depends on I2C
depends on OF_GPIO
select REGMAP_I2C select REGMAP_I2C
help help
This driver supports ATTINY regulator on the Raspberry Pi 7-inch This driver supports ATTINY regulator on the Raspberry Pi 7-inch
...@@ -1046,6 +1047,16 @@ config REGULATOR_RT5033 ...@@ -1046,6 +1047,16 @@ config REGULATOR_RT5033
RT5033 PMIC. The device supports multiple regulators like RT5033 PMIC. The device supports multiple regulators like
current source, LDO and Buck. current source, LDO and Buck.
config REGULATOR_RT5190A
tristate "Richtek RT5190A PMIC"
depends on I2C
select REGMAP_I2C
help
This adds support for voltage regulator in Richtek RT5190A PMIC.
It integratas 1 channel buck controller, 3 channels high efficiency
buck converters, 1 LDO, mute AC OFF depop function, with the general
I2C control interface.
config REGULATOR_RT6160 config REGULATOR_RT6160
tristate "Richtek RT6160 BuckBoost voltage regulator" tristate "Richtek RT6160 BuckBoost voltage regulator"
depends on I2C depends on I2C
...@@ -1263,6 +1274,15 @@ config REGULATOR_TPS62360 ...@@ -1263,6 +1274,15 @@ config REGULATOR_TPS62360
high-frequency synchronous step down dc-dc converter optimized high-frequency synchronous step down dc-dc converter optimized
for battery-powered portable applications. for battery-powered portable applications.
config REGULATOR_TPS6286X
tristate "TI TPS6286x Power Regulator"
depends on I2C && OF
select REGMAP_I2C
help
This driver supports TPS6236x voltage regulator chips. These are
high-frequency synchronous step-down converters with an I2C
interface.
config REGULATOR_TPS65023 config REGULATOR_TPS65023
tristate "TI TPS65023 Power regulators" tristate "TI TPS65023 Power regulators"
depends on I2C depends on I2C
......
...@@ -126,6 +126,7 @@ obj-$(CONFIG_REGULATOR_ROHM) += rohm-regulator.o ...@@ -126,6 +126,7 @@ obj-$(CONFIG_REGULATOR_ROHM) += rohm-regulator.o
obj-$(CONFIG_REGULATOR_RT4801) += rt4801-regulator.o obj-$(CONFIG_REGULATOR_RT4801) += rt4801-regulator.o
obj-$(CONFIG_REGULATOR_RT4831) += rt4831-regulator.o obj-$(CONFIG_REGULATOR_RT4831) += rt4831-regulator.o
obj-$(CONFIG_REGULATOR_RT5033) += rt5033-regulator.o obj-$(CONFIG_REGULATOR_RT5033) += rt5033-regulator.o
obj-$(CONFIG_REGULATOR_RT5190A) += rt5190a-regulator.o
obj-$(CONFIG_REGULATOR_RT6160) += rt6160-regulator.o obj-$(CONFIG_REGULATOR_RT6160) += rt6160-regulator.o
obj-$(CONFIG_REGULATOR_RT6245) += rt6245-regulator.o obj-$(CONFIG_REGULATOR_RT6245) += rt6245-regulator.o
obj-$(CONFIG_REGULATOR_RTMV20) += rtmv20-regulator.o obj-$(CONFIG_REGULATOR_RTMV20) += rtmv20-regulator.o
...@@ -149,6 +150,7 @@ obj-$(CONFIG_REGULATOR_SY8827N) += sy8827n.o ...@@ -149,6 +150,7 @@ obj-$(CONFIG_REGULATOR_SY8827N) += sy8827n.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
obj-$(CONFIG_REGULATOR_TPS6286X) += tps6286x-regulator.o
obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
obj-$(CONFIG_REGULATOR_TPS65086) += tps65086-regulator.o obj-$(CONFIG_REGULATOR_TPS65086) += tps65086-regulator.o
......
...@@ -459,7 +459,7 @@ static int max8973_thermal_read_temp(void *data, int *temp) ...@@ -459,7 +459,7 @@ static int max8973_thermal_read_temp(void *data, int *temp)
return ret; return ret;
} }
/* +1 degC to trigger cool devive */ /* +1 degC to trigger cool device */
if (val & MAX77621_CHIPID_TJINT_S) if (val & MAX77621_CHIPID_TJINT_S)
*temp = mchip->junction_temp_warning + 1000; *temp = mchip->junction_temp_warning + 1000;
else else
......
...@@ -1121,6 +1121,39 @@ static const struct rpmh_vreg_init_data pmx55_vreg_data[] = { ...@@ -1121,6 +1121,39 @@ static const struct rpmh_vreg_init_data pmx55_vreg_data[] = {
{} {}
}; };
static const struct rpmh_vreg_init_data pmx65_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps510, "vdd-s1"),
RPMH_VREG("smps2", "smp%s2", &pmic5_hfsmps510, "vdd-s2"),
RPMH_VREG("smps3", "smp%s3", &pmic5_hfsmps510, "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_hfsmps510, "vdd-s7"),
RPMH_VREG("smps8", "smp%s8", &pmic5_hfsmps510, "vdd-s8"),
RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo, "vdd-l1"),
RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo, "vdd-l2-l18"),
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-l16"),
RPMH_VREG("ldo6", "ldo%s6", &pmic5_pldo, "vdd-l5-l6-l16"),
RPMH_VREG("ldo7", "ldo%s7", &pmic5_nldo, "vdd-l7"),
RPMH_VREG("ldo8", "ldo%s8", &pmic5_nldo, "vdd-l8-l9"),
RPMH_VREG("ldo9", "ldo%s9", &pmic5_nldo, "vdd-l8-l9"),
RPMH_VREG("ldo10", "ldo%s10", &pmic5_pldo, "vdd-l10"),
RPMH_VREG("ldo11", "ldo%s11", &pmic5_pldo, "vdd-l11-l13"),
RPMH_VREG("ldo12", "ldo%s12", &pmic5_nldo, "vdd-l12"),
RPMH_VREG("ldo13", "ldo%s13", &pmic5_pldo, "vdd-l11-l13"),
RPMH_VREG("ldo14", "ldo%s14", &pmic5_nldo, "vdd-l14"),
RPMH_VREG("ldo15", "ldo%s15", &pmic5_nldo, "vdd-l15"),
RPMH_VREG("ldo16", "ldo%s16", &pmic5_pldo, "vdd-l5-l6-l16"),
RPMH_VREG("ldo17", "ldo%s17", &pmic5_nldo, "vdd-l17"),
/* ldo18 not configured */
RPMH_VREG("ldo19", "ldo%s19", &pmic5_nldo, "vdd-l19"),
RPMH_VREG("ldo20", "ldo%s20", &pmic5_nldo, "vdd-l20"),
RPMH_VREG("ldo21", "ldo%s21", &pmic5_nldo, "vdd-l21"),
{}
};
static const struct rpmh_vreg_init_data pm7325_vreg_data[] = { static const struct rpmh_vreg_init_data pm7325_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic5_hfsmps510, "vdd-s1"), RPMH_VREG("smps1", "smp%s1", &pmic5_hfsmps510, "vdd-s1"),
RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps520, "vdd-s2"), RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps520, "vdd-s2"),
...@@ -1276,6 +1309,10 @@ static const struct of_device_id __maybe_unused rpmh_regulator_match_table[] = { ...@@ -1276,6 +1309,10 @@ static const struct of_device_id __maybe_unused rpmh_regulator_match_table[] = {
.compatible = "qcom,pmx55-rpmh-regulators", .compatible = "qcom,pmx55-rpmh-regulators",
.data = pmx55_vreg_data, .data = pmx55_vreg_data,
}, },
{
.compatible = "qcom,pmx65-rpmh-regulators",
.data = pmx65_vreg_data,
},
{ {
.compatible = "qcom,pm7325-rpmh-regulators", .compatible = "qcom,pm7325-rpmh-regulators",
.data = pm7325_vreg_data, .data = pm7325_vreg_data,
......
...@@ -1317,8 +1317,10 @@ static int rpm_reg_probe(struct platform_device *pdev) ...@@ -1317,8 +1317,10 @@ static int rpm_reg_probe(struct platform_device *pdev)
for_each_available_child_of_node(dev->of_node, node) { for_each_available_child_of_node(dev->of_node, node) {
vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL);
if (!vreg) if (!vreg) {
of_node_put(node);
return -ENOMEM; return -ENOMEM;
}
ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data);
......
This diff is collapsed.
//SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2017 Spreadtrum Communications Inc. * Copyright (C) 2017 Spreadtrum Communications Inc.
*/ */
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
/** /**
* struct ti_abb_info - ABB information per voltage setting * struct ti_abb_info - ABB information per voltage setting
* @opp_sel: one of TI_ABB macro * @opp_sel: one of TI_ABB macro
* @vset: (optional) vset value that LDOVBB needs to be overriden with. * @vset: (optional) vset value that LDOVBB needs to be overridden with.
* *
* Array of per voltage entries organized in the same order as regulator_desc's * Array of per voltage entries organized in the same order as regulator_desc's
* volt_table list. (selector is used to index from this array) * volt_table list. (selector is used to index from this array)
...@@ -484,7 +484,7 @@ static int ti_abb_init_timings(struct device *dev, struct ti_abb *abb) ...@@ -484,7 +484,7 @@ static int ti_abb_init_timings(struct device *dev, struct ti_abb *abb)
/* Calculate cycle rate */ /* Calculate cycle rate */
cycle_rate = DIV_ROUND_CLOSEST(clock_cycles * 10, clk_rate); cycle_rate = DIV_ROUND_CLOSEST(clock_cycles * 10, clk_rate);
/* Calulate SR2_WTCNT_VALUE */ /* Calculate SR2_WTCNT_VALUE */
sr2_wt_cnt_val = DIV_ROUND_CLOSEST(abb->settling_time * 10, cycle_rate); sr2_wt_cnt_val = DIV_ROUND_CLOSEST(abb->settling_time * 10, cycle_rate);
dev_dbg(dev, "%s: Clk_rate=%ld, sr2_cnt=0x%08x\n", __func__, dev_dbg(dev, "%s: Clk_rate=%ld, sr2_cnt=0x%08x\n", __func__,
...@@ -688,7 +688,7 @@ MODULE_DEVICE_TABLE(of, ti_abb_of_match); ...@@ -688,7 +688,7 @@ MODULE_DEVICE_TABLE(of, ti_abb_of_match);
* @pdev: ABB platform device * @pdev: ABB platform device
* *
* Initializes an individual ABB LDO for required Body-Bias. ABB is used to * Initializes an individual ABB LDO for required Body-Bias. ABB is used to
* addional bias supply to SoC modules for power savings or mandatory stability * additional bias supply to SoC modules for power savings or mandatory stability
* configuration at certain Operating Performance Points(OPPs). * configuration at certain Operating Performance Points(OPPs).
* *
* Return: 0 on success or appropriate error value when fails * Return: 0 on success or appropriate error value when fails
......
// SPDX-License-Identifier: GPL-2.0-only
// Copyright Axis Communications AB
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/driver.h>
#include <dt-bindings/regulator/ti,tps62864.h>
#define TPS6286X_VOUT1 0x01
#define TPS6286X_VOUT1_VO1_SET GENMASK(7, 0)
#define TPS6286X_CONTROL 0x03
#define TPS6286X_CONTROL_FPWM BIT(4)
#define TPS6286X_CONTROL_SWEN BIT(5)
#define TPS6286X_MIN_MV 400
#define TPS6286X_MAX_MV 1675
#define TPS6286X_STEP_MV 5
static const struct regmap_config tps6286x_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
static int tps6286x_set_mode(struct regulator_dev *rdev, unsigned int mode)
{
unsigned int val;
switch (mode) {
case REGULATOR_MODE_NORMAL:
val = 0;
break;
case REGULATOR_MODE_FAST:
val = TPS6286X_CONTROL_FPWM;
break;
default:
return -EINVAL;
}
return regmap_update_bits(rdev->regmap, TPS6286X_CONTROL,
TPS6286X_CONTROL_FPWM, val);
}
static unsigned int tps6286x_get_mode(struct regulator_dev *rdev)
{
unsigned int val;
int ret;
ret = regmap_read(rdev->regmap, TPS6286X_CONTROL, &val);
if (ret < 0)
return 0;
return (val & TPS6286X_CONTROL_FPWM) ? REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL;
}
static const struct regulator_ops tps6286x_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.set_mode = tps6286x_set_mode,
.get_mode = tps6286x_get_mode,
.is_enabled = regulator_is_enabled_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
};
static unsigned int tps6286x_of_map_mode(unsigned int mode)
{
switch (mode) {
case TPS62864_MODE_NORMAL:
return REGULATOR_MODE_NORMAL;
case TPS62864_MODE_FPWM:
return REGULATOR_MODE_FAST;
default:
return REGULATOR_MODE_INVALID;
}
}
static const struct regulator_desc tps6286x_reg = {
.name = "tps6286x",
.of_match = of_match_ptr("SW"),
.owner = THIS_MODULE,
.ops = &tps6286x_regulator_ops,
.of_map_mode = tps6286x_of_map_mode,
.regulators_node = of_match_ptr("regulators"),
.type = REGULATOR_VOLTAGE,
.n_voltages = ((TPS6286X_MAX_MV - TPS6286X_MIN_MV) / TPS6286X_STEP_MV) + 1,
.min_uV = TPS6286X_MIN_MV * 1000,
.uV_step = TPS6286X_STEP_MV * 1000,
.vsel_reg = TPS6286X_VOUT1,
.vsel_mask = TPS6286X_VOUT1_VO1_SET,
.enable_reg = TPS6286X_CONTROL,
.enable_mask = TPS6286X_CONTROL_SWEN,
.ramp_delay = 1000,
/* tDelay + tRamp, rounded up */
.enable_time = 3000,
};
static const struct of_device_id tps6286x_dt_ids[] = {
{ .compatible = "ti,tps62864", },
{ .compatible = "ti,tps62866", },
{ .compatible = "ti,tps62868", },
{ .compatible = "ti,tps62869", },
{ }
};
MODULE_DEVICE_TABLE(of, tps6286x_dt_ids);
static int tps6286x_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct device *dev = &i2c->dev;
struct regulator_config config = {};
struct regulator_dev *rdev;
struct regmap *regmap;
regmap = devm_regmap_init_i2c(i2c, &tps6286x_regmap_config);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
config.dev = &i2c->dev;
config.of_node = dev->of_node;
config.regmap = regmap;
rdev = devm_regulator_register(&i2c->dev, &tps6286x_reg, &config);
if (IS_ERR(rdev)) {
dev_err(&i2c->dev, "Failed to register tps6286x regulator\n");
return PTR_ERR(rdev);
}
return 0;
}
static const struct i2c_device_id tps6286x_i2c_id[] = {
{ "tps62864", 0 },
{ "tps62866", 0 },
{ "tps62868", 0 },
{ "tps62869", 0 },
{},
};
MODULE_DEVICE_TABLE(i2c, tps6286x_i2c_id);
static struct i2c_driver tps6286x_regulator_driver = {
.driver = {
.name = "tps6286x",
.of_match_table = of_match_ptr(tps6286x_dt_ids),
},
.probe = tps6286x_i2c_probe,
.id_table = tps6286x_i2c_id,
};
module_i2c_driver(tps6286x_regulator_driver);
MODULE_LICENSE("GPL v2");
...@@ -185,10 +185,7 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev, ...@@ -185,10 +185,7 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev,
unsigned int next_sel; unsigned int next_sel;
int delay; int delay;
if (selector >= vctrl->vtable[vctrl->sel].ovp_min_sel) next_sel = max_t(unsigned int, selector, vctrl->vtable[vctrl->sel].ovp_min_sel);
next_sel = selector;
else
next_sel = vctrl->vtable[vctrl->sel].ovp_min_sel;
ret = regulator_set_voltage_rdev(rdev->supply->rdev, ret = regulator_set_voltage_rdev(rdev->supply->rdev,
vctrl->vtable[next_sel].ctrl, vctrl->vtable[next_sel].ctrl,
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h>
struct virtual_consumer_data { struct virtual_consumer_data {
struct mutex lock; struct mutex lock;
...@@ -281,26 +282,53 @@ static const struct attribute_group regulator_virtual_attr_group = { ...@@ -281,26 +282,53 @@ static const struct attribute_group regulator_virtual_attr_group = {
.attrs = regulator_virtual_attributes, .attrs = regulator_virtual_attributes,
}; };
#ifdef CONFIG_OF
static const struct of_device_id regulator_virtual_consumer_of_match[] = {
{ .compatible = "regulator-virtual-consumer" },
{},
};
MODULE_DEVICE_TABLE(of, regulator_virtual_consumer_of_match);
#endif
static int regulator_virtual_probe(struct platform_device *pdev) static int regulator_virtual_probe(struct platform_device *pdev)
{ {
char *reg_id = dev_get_platdata(&pdev->dev); char *reg_id = dev_get_platdata(&pdev->dev);
struct virtual_consumer_data *drvdata; struct virtual_consumer_data *drvdata;
static bool warned;
int ret; int ret;
if (!warned) {
warned = true;
pr_warn("**********************************************************\n");
pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n");
pr_warn("** **\n");
pr_warn("** regulator-virtual-consumer is only for testing and **\n");
pr_warn("** debugging. Do not use it in a production kernel. **\n");
pr_warn("** **\n");
pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n");
pr_warn("**********************************************************\n");
}
drvdata = devm_kzalloc(&pdev->dev, sizeof(struct virtual_consumer_data), drvdata = devm_kzalloc(&pdev->dev, sizeof(struct virtual_consumer_data),
GFP_KERNEL); GFP_KERNEL);
if (drvdata == NULL) if (drvdata == NULL)
return -ENOMEM; return -ENOMEM;
/*
* This virtual consumer does not have any hardware-defined supply
* name, so just allow the regulator to be specified in a property
* named "default-supply" when we're being probed from devicetree.
*/
if (!reg_id && pdev->dev.of_node)
reg_id = "default";
mutex_init(&drvdata->lock); mutex_init(&drvdata->lock);
drvdata->regulator = devm_regulator_get(&pdev->dev, reg_id); drvdata->regulator = devm_regulator_get(&pdev->dev, reg_id);
if (IS_ERR(drvdata->regulator)) { if (IS_ERR(drvdata->regulator))
ret = PTR_ERR(drvdata->regulator); return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->regulator),
dev_err(&pdev->dev, "Failed to obtain supply '%s': %d\n", "Failed to obtain supply '%s'\n",
reg_id, ret); reg_id);
return ret;
}
ret = sysfs_create_group(&pdev->dev.kobj, ret = sysfs_create_group(&pdev->dev.kobj,
&regulator_virtual_attr_group); &regulator_virtual_attr_group);
...@@ -334,6 +362,7 @@ static struct platform_driver regulator_virtual_consumer_driver = { ...@@ -334,6 +362,7 @@ static struct platform_driver regulator_virtual_consumer_driver = {
.remove = regulator_virtual_remove, .remove = regulator_virtual_remove,
.driver = { .driver = {
.name = "reg-virt-consumer", .name = "reg-virt-consumer",
.of_match_table = of_match_ptr(regulator_virtual_consumer_of_match),
}, },
}; };
......
...@@ -1112,7 +1112,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev) ...@@ -1112,7 +1112,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev)
if (pdev->id < WM8350_DCDC_1 || pdev->id > WM8350_ISINK_B) if (pdev->id < WM8350_DCDC_1 || pdev->id > WM8350_ISINK_B)
return -ENODEV; return -ENODEV;
/* do any regulatior specific init */ /* do any regulator specific init */
switch (pdev->id) { switch (pdev->id) {
case WM8350_DCDC_1: case WM8350_DCDC_1:
val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER); val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER);
......
...@@ -898,11 +898,8 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -898,11 +898,8 @@ static int spi_geni_probe(struct platform_device *pdev)
return irq; return irq;
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
if (ret) {
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
if (ret) if (ret)
return dev_err_probe(dev, ret, "could not set DMA mask\n"); return dev_err_probe(dev, ret, "could not set DMA mask\n");
}
base = devm_platform_ioremap_resource(pdev, 0); base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base)) if (IS_ERR(base))
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __DT_BINDINGS_RICHTEK_RT5190A_REGULATOR_H__
#define __DT_BINDINGS_RICHTEK_RT5190A_REGULATOR_H__
/*
* BUCK/LDO mode constants which may be used in devicetree properties
* (eg. regulator-allowed-modes).
* See the manufacturer's datasheet for more information on these modes.
*/
#define RT5190A_OPMODE_AUTO 0
#define RT5190A_OPMODE_FPWM 1
#endif
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
#ifndef _DT_BINDINGS_REGULATOR_TI_TPS62864_H
#define _DT_BINDINGS_REGULATOR_TI_TPS62864_H
#define TPS62864_MODE_NORMAL 0
#define TPS62864_MODE_FPWM 1
#endif
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