mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge tag 'regulator-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "There's one API update here, a new API factoring out a common pattern for reference voltage supplies. These are supplies used as a reference by analogue circuits where the consumer requests and enables the supply, reads the voltage to calibrate the user and then never touches it again. This is factored out into a single operation which just returns the voltage and uses devm_ to manage the request and enable portion. Otherwise this has been a very quiet release, we've got some new device support, some small fixes, housekeeping and cleanup work but nothing substantial. There's also some non-regulator changes in here, a number of users for the new reference voltage API were merged along with it and some MFD changes were pulled in as dependencies for new driver work. Highlights: - Add a new API for single operation handling of reference voltages - Support for Allwinner AXP717 and D1, and NXP PCA9561A" * tag 'regulator-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (33 commits) regulator: sun20i: Add Allwinner D1 LDOs driver regulator: dt-bindings: Add Allwinner D1 system LDOs regulator: Mention regulator id in error message about dummy supplies staging: iio: impedance-analyzer: ad5933: Use devm_regulator_get_enable_read_voltage() iio: frequency: admv1013: Use devm_regulator_get_enable_read_voltage() iio: addac: ad74115: Use devm_regulator_get_enable_read_voltage() hwmon: (adc128d818) simplify final return in probe regulator: devres: fix devm_regulator_get_enable_read_voltage() return hwmon: (da9052) Use devm_regulator_get_enable_read_voltage() hwmon: (adc128d818) Use devm_regulator_get_enable_read_voltage() regulator: devres: add API for reference voltage supplies regulator: rtq2208: Fix LDO discharge register and add vsel setting regulator: dt-bindings: fixed-regulator: Add a preferred node name regulator: axp20x: add support for the AXP717 mfd: axp20x: Add support for AXP717 PMIC dt-bindings: mfd: x-powers,axp152: Document AXP717 regulator: axp20x: fix typo-ed identifier dt-bindings: regulator: qcom,usb-vbus-regulator: Add PM7250B compatible regulator: pca9450: add pca9451a support regulator: dt-bindings: pca9450: add pca9451a support ...
This commit is contained in:
@@ -83,6 +83,7 @@ allOf:
|
||||
enum:
|
||||
- x-powers,axp313a
|
||||
- x-powers,axp15060
|
||||
- x-powers,axp717
|
||||
|
||||
then:
|
||||
properties:
|
||||
@@ -99,6 +100,7 @@ properties:
|
||||
- x-powers,axp221
|
||||
- x-powers,axp223
|
||||
- x-powers,axp313a
|
||||
- x-powers,axp717
|
||||
- x-powers,axp803
|
||||
- x-powers,axp806
|
||||
- x-powers,axp809
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/regulator/allwinner,sun20i-d1-system-ldos.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Allwinner D1 System LDOs
|
||||
|
||||
maintainers:
|
||||
- Samuel Holland <samuel@sholland.org>
|
||||
|
||||
description:
|
||||
Allwinner D1 contains a pair of general-purpose LDOs which are designed to
|
||||
supply power inside and outside the SoC. They are controlled by a register
|
||||
within the system control MMIO space.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- allwinner,sun20i-d1-system-ldos
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
patternProperties:
|
||||
"^ldo[ab]$":
|
||||
type: object
|
||||
$ref: regulator.yaml#
|
||||
unevaluatedProperties: false
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
...
|
||||
@@ -41,6 +41,13 @@ allOf:
|
||||
- gpios
|
||||
|
||||
properties:
|
||||
$nodename:
|
||||
anyOf:
|
||||
- description: Preferred name is 'regulator-[0-9]v[0-9]'
|
||||
pattern: '^regulator(-[0-9]+v[0-9]+|-[0-9a-z-]+)?$'
|
||||
- description: Any name allowed
|
||||
deprecated: true
|
||||
|
||||
compatible:
|
||||
enum:
|
||||
- regulator-fixed
|
||||
|
||||
@@ -28,6 +28,7 @@ properties:
|
||||
- nxp,pca9450a
|
||||
- nxp,pca9450b
|
||||
- nxp,pca9450c
|
||||
- nxp,pca9451a
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
@@ -26,6 +26,7 @@ properties:
|
||||
- enum:
|
||||
- qcom,pm4125-vbus-reg
|
||||
- qcom,pm6150-vbus-reg
|
||||
- qcom,pm7250b-vbus-reg
|
||||
- qcom,pmi632-vbus-reg
|
||||
- const: qcom,pm8150b-vbus-reg
|
||||
|
||||
|
||||
@@ -433,6 +433,7 @@ REGULATOR
|
||||
devm_regulator_bulk_put()
|
||||
devm_regulator_get()
|
||||
devm_regulator_get_enable()
|
||||
devm_regulator_get_enable_read_voltage()
|
||||
devm_regulator_get_enable_optional()
|
||||
devm_regulator_get_exclusive()
|
||||
devm_regulator_get_optional()
|
||||
|
||||
@@ -58,7 +58,6 @@ static const u8 num_inputs[] = { 7, 8, 4, 6 };
|
||||
|
||||
struct adc128_data {
|
||||
struct i2c_client *client;
|
||||
struct regulator *regulator;
|
||||
int vref; /* Reference voltage in mV */
|
||||
struct mutex update_lock;
|
||||
u8 mode; /* Operation mode */
|
||||
@@ -389,7 +388,7 @@ static int adc128_detect(struct i2c_client *client, struct i2c_board_info *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adc128_init_client(struct adc128_data *data)
|
||||
static int adc128_init_client(struct adc128_data *data, bool external_vref)
|
||||
{
|
||||
struct i2c_client *client = data->client;
|
||||
int err;
|
||||
@@ -408,7 +407,7 @@ static int adc128_init_client(struct adc128_data *data)
|
||||
regval |= data->mode << 1;
|
||||
|
||||
/* If external vref is selected, configure the chip to use it */
|
||||
if (data->regulator)
|
||||
if (external_vref)
|
||||
regval |= 0x01;
|
||||
|
||||
/* Write advanced configuration register */
|
||||
@@ -430,9 +429,9 @@ static int adc128_init_client(struct adc128_data *data)
|
||||
static int adc128_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
struct regulator *regulator;
|
||||
struct device *hwmon_dev;
|
||||
struct adc128_data *data;
|
||||
bool external_vref;
|
||||
int err, vref;
|
||||
|
||||
data = devm_kzalloc(dev, sizeof(struct adc128_data), GFP_KERNEL);
|
||||
@@ -440,20 +439,15 @@ static int adc128_probe(struct i2c_client *client)
|
||||
return -ENOMEM;
|
||||
|
||||
/* vref is optional. If specified, is used as chip reference voltage */
|
||||
regulator = devm_regulator_get_optional(dev, "vref");
|
||||
if (!IS_ERR(regulator)) {
|
||||
data->regulator = regulator;
|
||||
err = regulator_enable(regulator);
|
||||
if (err < 0)
|
||||
return err;
|
||||
vref = regulator_get_voltage(regulator);
|
||||
if (vref < 0) {
|
||||
err = vref;
|
||||
goto error;
|
||||
}
|
||||
data->vref = DIV_ROUND_CLOSEST(vref, 1000);
|
||||
} else {
|
||||
vref = devm_regulator_get_enable_read_voltage(dev, "vref");
|
||||
if (vref == -ENODEV) {
|
||||
external_vref = false;
|
||||
data->vref = 2560; /* 2.56V, in mV */
|
||||
} else if (vref < 0) {
|
||||
return vref;
|
||||
} else {
|
||||
external_vref = true;
|
||||
data->vref = DIV_ROUND_CLOSEST(vref, 1000);
|
||||
}
|
||||
|
||||
/* Operation mode is optional. If unspecified, keep current mode */
|
||||
@@ -461,13 +455,12 @@ static int adc128_probe(struct i2c_client *client)
|
||||
if (data->mode > 3) {
|
||||
dev_err(dev, "invalid operation mode %d\n",
|
||||
data->mode);
|
||||
err = -EINVAL;
|
||||
goto error;
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
err = i2c_smbus_read_byte_data(client, ADC128_REG_CONFIG_ADV);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
return err;
|
||||
data->mode = (err >> 1) & ADC128_REG_MASK;
|
||||
}
|
||||
|
||||
@@ -476,31 +469,14 @@ static int adc128_probe(struct i2c_client *client)
|
||||
mutex_init(&data->update_lock);
|
||||
|
||||
/* Initialize the chip */
|
||||
err = adc128_init_client(data);
|
||||
err = adc128_init_client(data, external_vref);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
return err;
|
||||
|
||||
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
|
||||
data, adc128_groups);
|
||||
if (IS_ERR(hwmon_dev)) {
|
||||
err = PTR_ERR(hwmon_dev);
|
||||
goto error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (data->regulator)
|
||||
regulator_disable(data->regulator);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void adc128_remove(struct i2c_client *client)
|
||||
{
|
||||
struct adc128_data *data = i2c_get_clientdata(client);
|
||||
|
||||
if (data->regulator)
|
||||
regulator_disable(data->regulator);
|
||||
return PTR_ERR_OR_ZERO(hwmon_dev);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id adc128_id[] = {
|
||||
@@ -522,7 +498,6 @@ static struct i2c_driver adc128_driver = {
|
||||
.of_match_table = of_match_ptr(adc128_of_match),
|
||||
},
|
||||
.probe = adc128_probe,
|
||||
.remove = adc128_remove,
|
||||
.id_table = adc128_id,
|
||||
.detect = adc128_detect,
|
||||
.address_list = normal_i2c,
|
||||
|
||||
@@ -26,7 +26,6 @@ struct da9052_hwmon {
|
||||
struct mutex hwmon_lock;
|
||||
bool tsi_as_adc;
|
||||
int tsiref_mv;
|
||||
struct regulator *tsiref;
|
||||
struct completion tsidone;
|
||||
};
|
||||
|
||||
@@ -397,7 +396,7 @@ static int da9052_hwmon_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
struct da9052_hwmon *hwmon;
|
||||
struct device *hwmon_dev;
|
||||
int err;
|
||||
int err, tsiref_uv;
|
||||
|
||||
hwmon = devm_kzalloc(dev, sizeof(struct da9052_hwmon), GFP_KERNEL);
|
||||
if (!hwmon)
|
||||
@@ -414,32 +413,20 @@ static int da9052_hwmon_probe(struct platform_device *pdev)
|
||||
device_property_read_bool(pdev->dev.parent, "dlg,tsi-as-adc");
|
||||
|
||||
if (hwmon->tsi_as_adc) {
|
||||
hwmon->tsiref = devm_regulator_get(pdev->dev.parent, "tsiref");
|
||||
if (IS_ERR(hwmon->tsiref)) {
|
||||
err = PTR_ERR(hwmon->tsiref);
|
||||
dev_err(&pdev->dev, "failed to get tsiref: %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = regulator_enable(hwmon->tsiref);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
hwmon->tsiref_mv = regulator_get_voltage(hwmon->tsiref);
|
||||
if (hwmon->tsiref_mv < 0) {
|
||||
err = hwmon->tsiref_mv;
|
||||
goto exit_regulator;
|
||||
}
|
||||
tsiref_uv = devm_regulator_get_enable_read_voltage(dev->parent,
|
||||
"tsiref");
|
||||
if (tsiref_uv < 0)
|
||||
return dev_err_probe(dev, tsiref_uv,
|
||||
"failed to get tsiref voltage\n");
|
||||
|
||||
/* convert from microvolt (DT) to millivolt (hwmon) */
|
||||
hwmon->tsiref_mv /= 1000;
|
||||
hwmon->tsiref_mv = tsiref_uv / 1000;
|
||||
|
||||
/* TSIREF limits from datasheet */
|
||||
if (hwmon->tsiref_mv < 1800 || hwmon->tsiref_mv > 2600) {
|
||||
dev_err(hwmon->da9052->dev, "invalid TSIREF voltage: %d",
|
||||
hwmon->tsiref_mv);
|
||||
err = -ENXIO;
|
||||
goto exit_regulator;
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
/* disable touchscreen features */
|
||||
@@ -456,7 +443,7 @@ static int da9052_hwmon_probe(struct platform_device *pdev)
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "Failed to register TSIRDY IRQ: %d",
|
||||
err);
|
||||
goto exit_regulator;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,9 +459,6 @@ static int da9052_hwmon_probe(struct platform_device *pdev)
|
||||
exit_irq:
|
||||
if (hwmon->tsi_as_adc)
|
||||
da9052_free_irq(hwmon->da9052, DA9052_IRQ_TSIREADY, hwmon);
|
||||
exit_regulator:
|
||||
if (hwmon->tsiref)
|
||||
regulator_disable(hwmon->tsiref);
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -483,10 +467,8 @@ static void da9052_hwmon_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct da9052_hwmon *hwmon = platform_get_drvdata(pdev);
|
||||
|
||||
if (hwmon->tsi_as_adc) {
|
||||
if (hwmon->tsi_as_adc)
|
||||
da9052_free_irq(hwmon->da9052, DA9052_IRQ_TSIREADY, hwmon);
|
||||
regulator_disable(hwmon->tsiref);
|
||||
}
|
||||
}
|
||||
|
||||
static struct platform_driver da9052_hwmon_driver = {
|
||||
|
||||
@@ -199,7 +199,6 @@ struct ad74115_state {
|
||||
struct spi_device *spi;
|
||||
struct regmap *regmap;
|
||||
struct iio_trigger *trig;
|
||||
struct regulator *avdd;
|
||||
|
||||
/*
|
||||
* Synchronize consecutive operations when doing a one-shot
|
||||
@@ -1672,13 +1671,9 @@ static int ad74115_setup(struct iio_dev *indio_dev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (val == AD74115_DIN_THRESHOLD_MODE_AVDD) {
|
||||
ret = regulator_get_voltage(st->avdd);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
st->avdd_mv = ret / 1000;
|
||||
}
|
||||
if (val == AD74115_DIN_THRESHOLD_MODE_AVDD && !st->avdd_mv)
|
||||
return dev_err_probe(dev, -EINVAL,
|
||||
"AVDD voltage is required for digital input threshold mode AVDD\n");
|
||||
|
||||
st->din_threshold_mode = val;
|
||||
|
||||
@@ -1788,11 +1783,6 @@ static int ad74115_reset(struct ad74115_state *st)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ad74115_regulator_disable(void *data)
|
||||
{
|
||||
regulator_disable(data);
|
||||
}
|
||||
|
||||
static int ad74115_setup_trigger(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct ad74115_state *st = iio_priv(indio_dev);
|
||||
@@ -1855,20 +1845,20 @@ static int ad74115_probe(struct spi_device *spi)
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->info = &ad74115_info;
|
||||
|
||||
st->avdd = devm_regulator_get(dev, "avdd");
|
||||
if (IS_ERR(st->avdd))
|
||||
return PTR_ERR(st->avdd);
|
||||
|
||||
ret = regulator_enable(st->avdd);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to enable avdd regulator\n");
|
||||
return ret;
|
||||
ret = devm_regulator_get_enable_read_voltage(dev, "avdd");
|
||||
if (ret < 0) {
|
||||
/*
|
||||
* Since this is both a power supply and only optionally a
|
||||
* reference voltage, make sure to enable it even when the
|
||||
* voltage is not available.
|
||||
*/
|
||||
ret = devm_regulator_get_enable(dev, "avdd");
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to enable avdd\n");
|
||||
} else {
|
||||
st->avdd_mv = ret / 1000;
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(dev, ad74115_regulator_disable, st->avdd);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names),
|
||||
regulator_names);
|
||||
if (ret)
|
||||
|
||||
@@ -95,7 +95,6 @@ struct admv1013_state {
|
||||
struct clk *clkin;
|
||||
/* Protect against concurrent accesses to the device and to data */
|
||||
struct mutex lock;
|
||||
struct regulator *reg;
|
||||
struct notifier_block nb;
|
||||
unsigned int input_mode;
|
||||
unsigned int quad_se_mode;
|
||||
@@ -342,14 +341,9 @@ static int admv1013_update_quad_filters(struct admv1013_state *st)
|
||||
FIELD_PREP(ADMV1013_QUAD_FILTERS_MSK, filt_raw));
|
||||
}
|
||||
|
||||
static int admv1013_update_mixer_vgate(struct admv1013_state *st)
|
||||
static int admv1013_update_mixer_vgate(struct admv1013_state *st, int vcm)
|
||||
{
|
||||
unsigned int mixer_vgate;
|
||||
int vcm;
|
||||
|
||||
vcm = regulator_get_voltage(st->reg);
|
||||
if (vcm < 0)
|
||||
return vcm;
|
||||
|
||||
if (vcm <= 1800000)
|
||||
mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100;
|
||||
@@ -443,7 +437,7 @@ static const struct iio_chan_spec admv1013_channels[] = {
|
||||
ADMV1013_CHAN_CALIB(1, Q),
|
||||
};
|
||||
|
||||
static int admv1013_init(struct admv1013_state *st)
|
||||
static int admv1013_init(struct admv1013_state *st, int vcm_uv)
|
||||
{
|
||||
int ret;
|
||||
unsigned int data;
|
||||
@@ -483,7 +477,7 @@ static int admv1013_init(struct admv1013_state *st)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = admv1013_update_mixer_vgate(st);
|
||||
ret = admv1013_update_mixer_vgate(st, vcm_uv);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -498,11 +492,6 @@ static int admv1013_init(struct admv1013_state *st)
|
||||
st->input_mode);
|
||||
}
|
||||
|
||||
static void admv1013_reg_disable(void *data)
|
||||
{
|
||||
regulator_disable(data);
|
||||
}
|
||||
|
||||
static void admv1013_powerdown(void *data)
|
||||
{
|
||||
unsigned int enable_reg, enable_reg_msk;
|
||||
@@ -557,11 +546,6 @@ static int admv1013_properties_parse(struct admv1013_state *st)
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
st->reg = devm_regulator_get(&spi->dev, "vcm");
|
||||
if (IS_ERR(st->reg))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st->reg),
|
||||
"failed to get the common-mode voltage\n");
|
||||
|
||||
ret = devm_regulator_bulk_get_enable(&st->spi->dev,
|
||||
ARRAY_SIZE(admv1013_vcc_regs),
|
||||
admv1013_vcc_regs);
|
||||
@@ -578,7 +562,7 @@ static int admv1013_probe(struct spi_device *spi)
|
||||
{
|
||||
struct iio_dev *indio_dev;
|
||||
struct admv1013_state *st;
|
||||
int ret;
|
||||
int ret, vcm_uv;
|
||||
|
||||
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
|
||||
if (!indio_dev)
|
||||
@@ -597,16 +581,12 @@ static int admv1013_probe(struct spi_device *spi)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = regulator_enable(st->reg);
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "Failed to enable specified Common-Mode Voltage!\n");
|
||||
return ret;
|
||||
}
|
||||
ret = devm_regulator_get_enable_read_voltage(&spi->dev, "vcm");
|
||||
if (ret < 0)
|
||||
return dev_err_probe(&spi->dev, ret,
|
||||
"failed to get the common-mode voltage\n");
|
||||
|
||||
ret = devm_add_action_or_reset(&spi->dev, admv1013_reg_disable,
|
||||
st->reg);
|
||||
if (ret)
|
||||
return ret;
|
||||
vcm_uv = ret;
|
||||
|
||||
st->clkin = devm_clk_get_enabled(&spi->dev, "lo_in");
|
||||
if (IS_ERR(st->clkin))
|
||||
@@ -620,7 +600,7 @@ static int admv1013_probe(struct spi_device *spi)
|
||||
|
||||
mutex_init(&st->lock);
|
||||
|
||||
ret = admv1013_init(st);
|
||||
ret = admv1013_init(st, vcm_uv);
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "admv1013 init failed\n");
|
||||
return ret;
|
||||
|
||||
@@ -65,6 +65,7 @@ static const struct of_device_id axp20x_i2c_of_match[] = {
|
||||
{ .compatible = "x-powers,axp221", .data = (void *)AXP221_ID },
|
||||
{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
|
||||
{ .compatible = "x-powers,axp313a", .data = (void *)AXP313A_ID },
|
||||
{ .compatible = "x-powers,axp717", .data = (void *)AXP717_ID },
|
||||
{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
|
||||
{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
|
||||
{ .compatible = "x-powers,axp15060", .data = (void *)AXP15060_ID },
|
||||
@@ -81,6 +82,7 @@ static const struct i2c_device_id axp20x_i2c_id[] = {
|
||||
{ "axp221", 0 },
|
||||
{ "axp223", 0 },
|
||||
{ "axp313a", 0 },
|
||||
{ "axp717", 0 },
|
||||
{ "axp803", 0 },
|
||||
{ "axp806", 0 },
|
||||
{ "axp15060", 0 },
|
||||
|
||||
@@ -58,6 +58,7 @@ static void axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
|
||||
|
||||
static const struct of_device_id axp20x_rsb_of_match[] = {
|
||||
{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
|
||||
{ .compatible = "x-powers,axp717", .data = (void *)AXP717_ID },
|
||||
{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
|
||||
{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
|
||||
{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
|
||||
|
||||
@@ -42,6 +42,7 @@ static const char * const axp20x_model_names[] = {
|
||||
"AXP223",
|
||||
"AXP288",
|
||||
"AXP313a",
|
||||
"AXP717",
|
||||
"AXP803",
|
||||
"AXP806",
|
||||
"AXP809",
|
||||
@@ -207,6 +208,25 @@ static const struct regmap_access_table axp313a_volatile_table = {
|
||||
.n_yes_ranges = ARRAY_SIZE(axp313a_volatile_ranges),
|
||||
};
|
||||
|
||||
static const struct regmap_range axp717_writeable_ranges[] = {
|
||||
regmap_reg_range(AXP717_IRQ0_EN, AXP717_IRQ4_EN),
|
||||
regmap_reg_range(AXP717_DCDC_OUTPUT_CONTROL, AXP717_CPUSLDO_CONTROL),
|
||||
};
|
||||
|
||||
static const struct regmap_range axp717_volatile_ranges[] = {
|
||||
regmap_reg_range(AXP717_IRQ0_STATE, AXP717_IRQ4_STATE),
|
||||
};
|
||||
|
||||
static const struct regmap_access_table axp717_writeable_table = {
|
||||
.yes_ranges = axp717_writeable_ranges,
|
||||
.n_yes_ranges = ARRAY_SIZE(axp717_writeable_ranges),
|
||||
};
|
||||
|
||||
static const struct regmap_access_table axp717_volatile_table = {
|
||||
.yes_ranges = axp717_volatile_ranges,
|
||||
.n_yes_ranges = ARRAY_SIZE(axp717_volatile_ranges),
|
||||
};
|
||||
|
||||
static const struct regmap_range axp806_volatile_ranges[] = {
|
||||
regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
|
||||
};
|
||||
@@ -317,6 +337,11 @@ static const struct resource axp313a_pek_resources[] = {
|
||||
DEFINE_RES_IRQ_NAMED(AXP313A_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
|
||||
};
|
||||
|
||||
static const struct resource axp717_pek_resources[] = {
|
||||
DEFINE_RES_IRQ_NAMED(AXP717_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
|
||||
DEFINE_RES_IRQ_NAMED(AXP717_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
|
||||
};
|
||||
|
||||
static const struct resource axp803_pek_resources[] = {
|
||||
DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
|
||||
DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
|
||||
@@ -391,6 +416,15 @@ static const struct regmap_config axp313a_regmap_config = {
|
||||
.cache_type = REGCACHE_MAPLE,
|
||||
};
|
||||
|
||||
static const struct regmap_config axp717_regmap_config = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.wr_table = &axp717_writeable_table,
|
||||
.volatile_table = &axp717_volatile_table,
|
||||
.max_register = AXP717_CPUSLDO_CONTROL,
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
};
|
||||
|
||||
static const struct regmap_config axp806_regmap_config = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
@@ -589,6 +623,40 @@ static const struct regmap_irq axp313a_regmap_irqs[] = {
|
||||
INIT_REGMAP_IRQ(AXP313A, DIE_TEMP_HIGH, 0, 0),
|
||||
};
|
||||
|
||||
static const struct regmap_irq axp717_regmap_irqs[] = {
|
||||
INIT_REGMAP_IRQ(AXP717, SOC_DROP_LVL2, 0, 7),
|
||||
INIT_REGMAP_IRQ(AXP717, SOC_DROP_LVL1, 0, 6),
|
||||
INIT_REGMAP_IRQ(AXP717, GAUGE_NEW_SOC, 0, 4),
|
||||
INIT_REGMAP_IRQ(AXP717, BOOST_OVER_V, 0, 2),
|
||||
INIT_REGMAP_IRQ(AXP717, VBUS_OVER_V, 0, 1),
|
||||
INIT_REGMAP_IRQ(AXP717, VBUS_FAULT, 0, 0),
|
||||
INIT_REGMAP_IRQ(AXP717, VBUS_PLUGIN, 1, 7),
|
||||
INIT_REGMAP_IRQ(AXP717, VBUS_REMOVAL, 1, 6),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_PLUGIN, 1, 5),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_REMOVAL, 1, 4),
|
||||
INIT_REGMAP_IRQ(AXP717, PEK_SHORT, 1, 3),
|
||||
INIT_REGMAP_IRQ(AXP717, PEK_LONG, 1, 2),
|
||||
INIT_REGMAP_IRQ(AXP717, PEK_FAL_EDGE, 1, 1),
|
||||
INIT_REGMAP_IRQ(AXP717, PEK_RIS_EDGE, 1, 0),
|
||||
INIT_REGMAP_IRQ(AXP717, WDOG_EXPIRE, 2, 7),
|
||||
INIT_REGMAP_IRQ(AXP717, LDO_OVER_CURR, 2, 6),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_OVER_CURR, 2, 5),
|
||||
INIT_REGMAP_IRQ(AXP717, CHARG_DONE, 2, 4),
|
||||
INIT_REGMAP_IRQ(AXP717, CHARG, 2, 3),
|
||||
INIT_REGMAP_IRQ(AXP717, DIE_TEMP_HIGH, 2, 2),
|
||||
INIT_REGMAP_IRQ(AXP717, CHARG_TIMER, 2, 1),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_OVER_V, 2, 0),
|
||||
INIT_REGMAP_IRQ(AXP717, BC_USB_DONE, 3, 7),
|
||||
INIT_REGMAP_IRQ(AXP717, BC_USB_CHNG, 3, 6),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_QUIT_TEMP_HIGH, 3, 4),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_CHG_TEMP_HIGH, 3, 3),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_CHG_TEMP_LOW, 3, 2),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_ACT_TEMP_HIGH, 3, 1),
|
||||
INIT_REGMAP_IRQ(AXP717, BATT_ACT_TEMP_LOW, 3, 0),
|
||||
INIT_REGMAP_IRQ(AXP717, TYPEC_REMOVE, 4, 6),
|
||||
INIT_REGMAP_IRQ(AXP717, TYPEC_PLUGIN, 4, 5),
|
||||
};
|
||||
|
||||
static const struct regmap_irq axp803_regmap_irqs[] = {
|
||||
INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V, 0, 7),
|
||||
INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN, 0, 6),
|
||||
@@ -776,6 +844,17 @@ static const struct regmap_irq_chip axp313a_regmap_irq_chip = {
|
||||
.num_regs = 1,
|
||||
};
|
||||
|
||||
static const struct regmap_irq_chip axp717_regmap_irq_chip = {
|
||||
.name = "axp717_irq_chip",
|
||||
.status_base = AXP717_IRQ0_STATE,
|
||||
.ack_base = AXP717_IRQ0_STATE,
|
||||
.unmask_base = AXP717_IRQ0_EN,
|
||||
.init_ack_masked = true,
|
||||
.irqs = axp717_regmap_irqs,
|
||||
.num_irqs = ARRAY_SIZE(axp717_regmap_irqs),
|
||||
.num_regs = 5,
|
||||
};
|
||||
|
||||
static const struct regmap_irq_chip axp803_regmap_irq_chip = {
|
||||
.name = "axp803",
|
||||
.status_base = AXP20X_IRQ1_STATE,
|
||||
@@ -941,6 +1020,11 @@ static struct mfd_cell axp313a_cells[] = {
|
||||
MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
|
||||
};
|
||||
|
||||
static struct mfd_cell axp717_cells[] = {
|
||||
MFD_CELL_NAME("axp20x-regulator"),
|
||||
MFD_CELL_RES("axp20x-pek", axp717_pek_resources),
|
||||
};
|
||||
|
||||
static const struct resource axp288_adc_resources[] = {
|
||||
DEFINE_RES_IRQ_NAMED(AXP288_IRQ_GPADC, "GPADC"),
|
||||
};
|
||||
@@ -1181,6 +1265,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
|
||||
axp20x->regmap_cfg = &axp313a_regmap_config;
|
||||
axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
|
||||
break;
|
||||
case AXP717_ID:
|
||||
axp20x->nr_cells = ARRAY_SIZE(axp717_cells);
|
||||
axp20x->cells = axp717_cells;
|
||||
axp20x->regmap_cfg = &axp717_regmap_config;
|
||||
axp20x->regmap_irq_chip = &axp717_regmap_irq_chip;
|
||||
break;
|
||||
case AXP803_ID:
|
||||
axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
|
||||
axp20x->cells = axp803_cells;
|
||||
|
||||
@@ -1415,6 +1415,14 @@ config REGULATOR_STW481X_VMMC
|
||||
This driver supports the internal VMMC regulator in the STw481x
|
||||
PMIC chips.
|
||||
|
||||
config REGULATOR_SUN20I
|
||||
tristate "Allwinner D1 internal LDOs"
|
||||
depends on ARCH_SUNXI || COMPILE_TEST
|
||||
select MFD_SYSCON
|
||||
default ARCH_SUNXI
|
||||
help
|
||||
This driver supports the internal LDOs in the Allwinner D1 SoC.
|
||||
|
||||
config REGULATOR_SY7636A
|
||||
tristate "Silergy SY7636A voltage regulator"
|
||||
depends on MFD_SY7636A
|
||||
|
||||
@@ -163,6 +163,7 @@ obj-$(CONFIG_REGULATOR_STM32_VREFBUF) += stm32-vrefbuf.o
|
||||
obj-$(CONFIG_REGULATOR_STM32_PWR) += stm32-pwr.o
|
||||
obj-$(CONFIG_REGULATOR_STPMIC1) += stpmic1_regulator.o
|
||||
obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o
|
||||
obj-$(CONFIG_REGULATOR_SUN20I) += sun20i-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_SY7636A) += sy7636a-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_SY8106A) += sy8106a-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_SY8824X) += sy8824x.o
|
||||
|
||||
@@ -138,6 +138,12 @@
|
||||
#define AXP313A_DCDC_V_OUT_MASK GENMASK(6, 0)
|
||||
#define AXP313A_LDO_V_OUT_MASK GENMASK(4, 0)
|
||||
|
||||
#define AXP717_DCDC1_NUM_VOLTAGES 88
|
||||
#define AXP717_DCDC2_NUM_VOLTAGES 107
|
||||
#define AXP717_DCDC3_NUM_VOLTAGES 104
|
||||
#define AXP717_DCDC_V_OUT_MASK GENMASK(6, 0)
|
||||
#define AXP717_LDO_V_OUT_MASK GENMASK(4, 0)
|
||||
|
||||
#define AXP803_PWR_OUT_DCDC1_MASK BIT_MASK(0)
|
||||
#define AXP803_PWR_OUT_DCDC2_MASK BIT_MASK(1)
|
||||
#define AXP803_PWR_OUT_DCDC3_MASK BIT_MASK(2)
|
||||
@@ -733,25 +739,98 @@ static const struct linear_range axp313a_dcdc3_ranges[] = {
|
||||
static const struct regulator_desc axp313a_regulators[] = {
|
||||
AXP_DESC_RANGES(AXP313A, DCDC1, "dcdc1", "vin1",
|
||||
axp313a_dcdc1_ranges, AXP313A_DCDC1_NUM_VOLTAGES,
|
||||
AXP313A_DCDC1_CONRTOL, AXP313A_DCDC_V_OUT_MASK,
|
||||
AXP313A_DCDC1_CONTROL, AXP313A_DCDC_V_OUT_MASK,
|
||||
AXP313A_OUTPUT_CONTROL, BIT(0)),
|
||||
AXP_DESC_RANGES(AXP313A, DCDC2, "dcdc2", "vin2",
|
||||
axp313a_dcdc2_ranges, AXP313A_DCDC23_NUM_VOLTAGES,
|
||||
AXP313A_DCDC2_CONRTOL, AXP313A_DCDC_V_OUT_MASK,
|
||||
AXP313A_DCDC2_CONTROL, AXP313A_DCDC_V_OUT_MASK,
|
||||
AXP313A_OUTPUT_CONTROL, BIT(1)),
|
||||
AXP_DESC_RANGES(AXP313A, DCDC3, "dcdc3", "vin3",
|
||||
axp313a_dcdc3_ranges, AXP313A_DCDC23_NUM_VOLTAGES,
|
||||
AXP313A_DCDC3_CONRTOL, AXP313A_DCDC_V_OUT_MASK,
|
||||
AXP313A_DCDC3_CONTROL, AXP313A_DCDC_V_OUT_MASK,
|
||||
AXP313A_OUTPUT_CONTROL, BIT(2)),
|
||||
AXP_DESC(AXP313A, ALDO1, "aldo1", "vin1", 500, 3500, 100,
|
||||
AXP313A_ALDO1_CONRTOL, AXP313A_LDO_V_OUT_MASK,
|
||||
AXP313A_ALDO1_CONTROL, AXP313A_LDO_V_OUT_MASK,
|
||||
AXP313A_OUTPUT_CONTROL, BIT(3)),
|
||||
AXP_DESC(AXP313A, DLDO1, "dldo1", "vin1", 500, 3500, 100,
|
||||
AXP313A_DLDO1_CONRTOL, AXP313A_LDO_V_OUT_MASK,
|
||||
AXP313A_DLDO1_CONTROL, AXP313A_LDO_V_OUT_MASK,
|
||||
AXP313A_OUTPUT_CONTROL, BIT(4)),
|
||||
AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800),
|
||||
};
|
||||
|
||||
static const struct linear_range axp717_dcdc1_ranges[] = {
|
||||
REGULATOR_LINEAR_RANGE(500000, 0, 70, 10000),
|
||||
REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
|
||||
};
|
||||
|
||||
static const struct linear_range axp717_dcdc2_ranges[] = {
|
||||
REGULATOR_LINEAR_RANGE(500000, 0, 70, 10000),
|
||||
REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
|
||||
REGULATOR_LINEAR_RANGE(1600000, 88, 107, 100000),
|
||||
};
|
||||
|
||||
static const struct linear_range axp717_dcdc3_ranges[] = {
|
||||
REGULATOR_LINEAR_RANGE(500000, 0, 70, 10000),
|
||||
REGULATOR_LINEAR_RANGE(1220000, 71, 102, 20000),
|
||||
};
|
||||
|
||||
static const struct regulator_desc axp717_regulators[] = {
|
||||
AXP_DESC_RANGES(AXP717, DCDC1, "dcdc1", "vin1",
|
||||
axp717_dcdc1_ranges, AXP717_DCDC1_NUM_VOLTAGES,
|
||||
AXP717_DCDC1_CONTROL, AXP717_DCDC_V_OUT_MASK,
|
||||
AXP717_DCDC_OUTPUT_CONTROL, BIT(0)),
|
||||
AXP_DESC_RANGES(AXP717, DCDC2, "dcdc2", "vin2",
|
||||
axp717_dcdc2_ranges, AXP717_DCDC2_NUM_VOLTAGES,
|
||||
AXP717_DCDC2_CONTROL, AXP717_DCDC_V_OUT_MASK,
|
||||
AXP717_DCDC_OUTPUT_CONTROL, BIT(1)),
|
||||
AXP_DESC_RANGES(AXP717, DCDC3, "dcdc3", "vin3",
|
||||
axp717_dcdc3_ranges, AXP717_DCDC3_NUM_VOLTAGES,
|
||||
AXP717_DCDC3_CONTROL, AXP717_DCDC_V_OUT_MASK,
|
||||
AXP717_DCDC_OUTPUT_CONTROL, BIT(2)),
|
||||
AXP_DESC(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
|
||||
AXP717_DCDC4_CONTROL, AXP717_DCDC_V_OUT_MASK,
|
||||
AXP717_DCDC_OUTPUT_CONTROL, BIT(3)),
|
||||
AXP_DESC(AXP717, ALDO1, "aldo1", "vin1", 500, 3500, 100,
|
||||
AXP717_ALDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO0_OUTPUT_CONTROL, BIT(0)),
|
||||
AXP_DESC(AXP717, ALDO2, "aldo2", "vin1", 500, 3500, 100,
|
||||
AXP717_ALDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO0_OUTPUT_CONTROL, BIT(1)),
|
||||
AXP_DESC(AXP717, ALDO3, "aldo3", "vin1", 500, 3500, 100,
|
||||
AXP717_ALDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO0_OUTPUT_CONTROL, BIT(2)),
|
||||
AXP_DESC(AXP717, ALDO4, "aldo4", "vin1", 500, 3500, 100,
|
||||
AXP717_ALDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO0_OUTPUT_CONTROL, BIT(3)),
|
||||
AXP_DESC(AXP717, BLDO1, "bldo1", "vin1", 500, 3500, 100,
|
||||
AXP717_BLDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO0_OUTPUT_CONTROL, BIT(4)),
|
||||
AXP_DESC(AXP717, BLDO2, "bldo2", "vin1", 500, 3500, 100,
|
||||
AXP717_BLDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO0_OUTPUT_CONTROL, BIT(5)),
|
||||
AXP_DESC(AXP717, BLDO3, "bldo3", "vin1", 500, 3500, 100,
|
||||
AXP717_BLDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO0_OUTPUT_CONTROL, BIT(6)),
|
||||
AXP_DESC(AXP717, BLDO4, "bldo4", "vin1", 500, 3500, 100,
|
||||
AXP717_BLDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO0_OUTPUT_CONTROL, BIT(7)),
|
||||
AXP_DESC(AXP717, CLDO1, "cldo1", "vin1", 500, 3500, 100,
|
||||
AXP717_CLDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO1_OUTPUT_CONTROL, BIT(0)),
|
||||
AXP_DESC(AXP717, CLDO2, "cldo2", "vin1", 500, 3500, 100,
|
||||
AXP717_CLDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO1_OUTPUT_CONTROL, BIT(1)),
|
||||
AXP_DESC(AXP717, CLDO3, "cldo3", "vin1", 500, 3500, 100,
|
||||
AXP717_CLDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO1_OUTPUT_CONTROL, BIT(2)),
|
||||
AXP_DESC(AXP717, CLDO4, "cldo4", "vin1", 500, 3500, 100,
|
||||
AXP717_CLDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO1_OUTPUT_CONTROL, BIT(3)),
|
||||
AXP_DESC(AXP717, CPUSLDO, "cpusldo", "vin1", 500, 1400, 50,
|
||||
AXP717_CPUSLDO_CONTROL, AXP717_LDO_V_OUT_MASK,
|
||||
AXP717_LDO1_OUTPUT_CONTROL, BIT(4)),
|
||||
};
|
||||
|
||||
/* DCDC ranges shared with AXP813 */
|
||||
static const struct linear_range axp803_dcdc234_ranges[] = {
|
||||
REGULATOR_LINEAR_RANGE(500000,
|
||||
@@ -1253,6 +1332,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
|
||||
step = 150;
|
||||
break;
|
||||
case AXP313A_ID:
|
||||
case AXP717_ID:
|
||||
case AXP15060_ID:
|
||||
/* The DCDC PWM frequency seems to be fixed to 3 MHz. */
|
||||
if (dcdcfreq != 0) {
|
||||
@@ -1479,6 +1559,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
|
||||
regulators = axp313a_regulators;
|
||||
nregulators = AXP313A_REG_ID_MAX;
|
||||
break;
|
||||
case AXP717_ID:
|
||||
regulators = axp717_regulators;
|
||||
nregulators = AXP717_REG_ID_MAX;
|
||||
break;
|
||||
case AXP803_ID:
|
||||
regulators = axp803_regulators;
|
||||
nregulators = AXP803_REG_ID_MAX;
|
||||
|
||||
@@ -2200,7 +2200,7 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
|
||||
|
||||
if (!have_full_constraints()) {
|
||||
dev_warn(dev,
|
||||
"incomplete constraints, dummy supplies not allowed\n");
|
||||
"incomplete constraints, dummy supplies not allowed (id=%s)\n", id);
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
@@ -2218,7 +2218,7 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
|
||||
|
||||
case EXCLUSIVE_GET:
|
||||
dev_warn(dev,
|
||||
"dummy supplies not allowed for exclusive requests\n");
|
||||
"dummy supplies not allowed for exclusive requests (id=%s)\n", id);
|
||||
fallthrough;
|
||||
|
||||
default:
|
||||
|
||||
@@ -872,7 +872,7 @@ static struct regmap_config da9121_1ch_regmap_config = {
|
||||
.rd_table = &da9121_1ch_readable_table,
|
||||
.wr_table = &da9121_1ch_writeable_table,
|
||||
.volatile_table = &da9121_volatile_table,
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
.cache_type = REGCACHE_MAPLE,
|
||||
};
|
||||
|
||||
/* DA9121 regmap config for 2 channel variants */
|
||||
@@ -883,7 +883,7 @@ static struct regmap_config da9121_2ch_regmap_config = {
|
||||
.rd_table = &da9121_2ch_readable_table,
|
||||
.wr_table = &da9121_2ch_writeable_table,
|
||||
.volatile_table = &da9121_volatile_table,
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
.cache_type = REGCACHE_MAPLE,
|
||||
};
|
||||
|
||||
static int da9121_check_device_type(struct i2c_client *i2c, struct da9121 *chip)
|
||||
|
||||
@@ -68,7 +68,7 @@ static const struct regmap_config da9211_regmap_config = {
|
||||
.val_bits = 8,
|
||||
.max_register = 5 * 128,
|
||||
.volatile_reg = da9211_volatile_reg,
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
.cache_type = REGCACHE_MAPLE,
|
||||
.ranges = da9211_regmap_range,
|
||||
.num_ranges = ARRAY_SIZE(da9211_regmap_range),
|
||||
};
|
||||
|
||||
@@ -145,6 +145,65 @@ struct regulator *devm_regulator_get_optional(struct device *dev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_regulator_get_optional);
|
||||
|
||||
/**
|
||||
* devm_regulator_get_enable_read_voltage - Resource managed regulator get and
|
||||
* enable that returns the voltage
|
||||
* @dev: device to supply
|
||||
* @id: supply name or regulator ID.
|
||||
*
|
||||
* Get and enable regulator for duration of the device life-time.
|
||||
* regulator_disable() and regulator_put() are automatically called on driver
|
||||
* detach. See regulator_get_optional(), regulator_enable(), and
|
||||
* regulator_get_voltage() for more information.
|
||||
*
|
||||
* This is a convenience function for supplies that provide a reference voltage
|
||||
* where the consumer driver just needs to know the voltage and keep the
|
||||
* regulator enabled.
|
||||
*
|
||||
* In cases where the supply is not strictly required, callers can check for
|
||||
* -ENODEV error and handle it accordingly.
|
||||
*
|
||||
* Returns: voltage in microvolts on success, or an error code on failure.
|
||||
*/
|
||||
int devm_regulator_get_enable_read_voltage(struct device *dev, const char *id)
|
||||
{
|
||||
struct regulator *r;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Since we need a real voltage, we use devm_regulator_get_optional()
|
||||
* rather than getting a dummy regulator with devm_regulator_get() and
|
||||
* then letting regulator_get_voltage() fail with -EINVAL. This way, the
|
||||
* caller can handle the -ENODEV error code if needed instead of the
|
||||
* ambiguous -EINVAL.
|
||||
*/
|
||||
r = devm_regulator_get_optional(dev, id);
|
||||
if (IS_ERR(r))
|
||||
return PTR_ERR(r);
|
||||
|
||||
ret = regulator_enable(r);
|
||||
if (ret)
|
||||
goto err_regulator_put;
|
||||
|
||||
ret = devm_add_action_or_reset(dev, regulator_action_disable, r);
|
||||
if (ret)
|
||||
goto err_regulator_put;
|
||||
|
||||
ret = regulator_get_voltage(r);
|
||||
if (ret < 0)
|
||||
goto err_release_action;
|
||||
|
||||
return ret;
|
||||
|
||||
err_release_action:
|
||||
devm_release_action(dev, regulator_action_disable, r);
|
||||
err_regulator_put:
|
||||
devm_regulator_put(r);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_regulator_get_enable_read_voltage);
|
||||
|
||||
static int devm_regulator_match(struct device *dev, void *res, void *data)
|
||||
{
|
||||
struct regulator **r = res;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user