mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge tag 'regulator-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown:
"The big change in this release is the addition of Rust bindings from
Daniel Almeida, allowing fairly basic consumer use with support for
enable and voltage setting operations. This should be good for the
vast majority of consumers.
Otherwise it's been quite quiet, a few new devices supported, plus
some cleanups and fixes.
Summary:
- Basic Rust bindings
- A fix for making large voltage changes on regulators where we limit
the size of voltage change we will do in one step, previously we
just got as close as we could in one step
- Cleanups of our usage of the PM autosuspend functions, this pulls
in some PM core changes on a shared tag
- Mode setting support for PCA9450
- Support for Mediatek MT6893 and MT8196 DVFSRC, Qualcomm PM7550 and
PMR735B, Raspberry Pi displays and TI TPS652G1
The TI driver pulls in the MFD portion of the support for the device
and the pinctrl driver which was in the same tag"
* tag 'regulator-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (40 commits)
regulator: mt6370: Fix spelling mistake in mt6370_regualtor_register
regulator: Kconfig: Fix spelling mistake "regualtor" -> "regulator"
regulator: core: repeat voltage setting request for stepped regulators
regulator: rt6160: Add rt6166 vout min_uV setting for compatible
MAINTAINERS: add regulator.rs to the regulator API entry
rust: regulator: add a bare minimum regulator abstraction
regulator: tps6286x-regulator: Fix a copy & paste error
regulator: qcom-rpmh: add support for pm7550 regulators
regulator: qcom-rpmh: add support for pmr735b regulators
regulator: dt-bindings: qcom,rpmh: Add PMR735B compatible
regulator: dt-bindings: qcom,rpmh: Add PM7550 compatible
regulator: tps6594-regulator: Add TI TPS652G1 PMIC regulators
regulator: tps6594-regulator: refactor variant descriptions
regulator: tps6594-regulator: remove hardcoded buck config
regulator: tps6594-regulator: remove interrupt_count
dt-bindings: mfd: ti,tps6594: Add TI TPS652G1 PMIC
pinctrl: pinctrl-tps6594: Add TPS652G1 PMIC pinctrl and GPIO
misc: tps6594-pfsm: Add TI TPS652G1 PMIC PFSM
mfd: tps6594: Add TI TPS652G1 support
regulator: sy8827n: make enable gpio NONEXCLUSIVE
...
This commit is contained in:
@@ -22,6 +22,7 @@ properties:
|
||||
- ti,tps6593-q1
|
||||
- ti,tps6594-q1
|
||||
- ti,tps65224-q1
|
||||
- ti,tps652g1
|
||||
|
||||
reg:
|
||||
description: I2C slave address or SPI chip select number.
|
||||
|
||||
@@ -17,9 +17,11 @@ properties:
|
||||
compatible:
|
||||
enum:
|
||||
- mediatek,mt6873-dvfsrc-regulator
|
||||
- mediatek,mt6893-dvfsrc-regulator
|
||||
- mediatek,mt8183-dvfsrc-regulator
|
||||
- mediatek,mt8192-dvfsrc-regulator
|
||||
- mediatek,mt8195-dvfsrc-regulator
|
||||
- mediatek,mt8196-dvfsrc-regulator
|
||||
|
||||
dvfsrc-vcore:
|
||||
description: DVFSRC-controlled SoC Vcore regulator
|
||||
|
||||
@@ -100,6 +100,15 @@ properties:
|
||||
PMIC default "STANDBY" state voltage in uV. Only Buck1~3 have such
|
||||
dvs(dynamic voltage scaling) property.
|
||||
|
||||
regulator-allowed-modes:
|
||||
description: |
|
||||
Buck regulator operating modes allowed. Valid values below.
|
||||
Users should use the macros from dt-bindings/regulator/nxp,pca9450-regulator.h
|
||||
0 (PCA9450_BUCK_MODE_AUTO): Auto PFM/PWM mode
|
||||
1 (PCA9450_BUCK_MODE_FORCE_PWM): Forced PWM mode
|
||||
items:
|
||||
enum: [ 0, 1 ]
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
additionalProperties: false
|
||||
@@ -143,6 +152,7 @@ allOf:
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/regulator/nxp,pca9450-regulator.h>
|
||||
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
@@ -179,6 +189,8 @@ examples:
|
||||
regulator-max-microvolt = <3400000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
regulator-initial-mode = <PCA9450_BUCK_MODE_FORCE_PWM>;
|
||||
regulator-allowed-modes = <PCA9450_BUCK_MODE_FORCE_PWM>;
|
||||
};
|
||||
buck5: BUCK5 {
|
||||
regulator-name = "BUCK5";
|
||||
@@ -186,6 +198,8 @@ examples:
|
||||
regulator-max-microvolt = <3400000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
regulator-allowed-modes = <PCA9450_BUCK_MODE_AUTO
|
||||
PCA9450_BUCK_MODE_FORCE_PWM>;
|
||||
};
|
||||
buck6: BUCK6 {
|
||||
regulator-name = "BUCK6";
|
||||
|
||||
@@ -40,6 +40,7 @@ description: |
|
||||
For PM660, smps1 - smps6, ldo1 - ldo3, ldo5 - ldo19
|
||||
For PM660L, smps1 - smps3, smps5, ldo1 - ldo8, bob
|
||||
For PM7325, smps1 - smps8, ldo1 - ldo19
|
||||
For PM7550, smps1 - smps6, ldo1 - ldo23, bob
|
||||
For PM8005, smps1 - smps4
|
||||
For PM8009, smps1 - smps2, ldo1 - ldo7
|
||||
For PM8010, ldo1 - ldo7
|
||||
@@ -53,6 +54,7 @@ description: |
|
||||
For PMI8998, bob
|
||||
For PMC8380, smps1 - smps8, ldo1 - lodo3
|
||||
For PMR735A, smps1 - smps3, ldo1 - ldo7
|
||||
For PMR735B, ldo1 - ldo12
|
||||
For PMX55, smps1 - smps7, ldo1 - ldo16
|
||||
For PMX65, smps1 - smps8, ldo1 - ldo21
|
||||
For PMX75, smps1 - smps10, ldo1 - ldo21
|
||||
@@ -66,6 +68,7 @@ properties:
|
||||
- qcom,pm660-rpmh-regulators
|
||||
- qcom,pm660l-rpmh-regulators
|
||||
- qcom,pm7325-rpmh-regulators
|
||||
- qcom,pm7550-rpmh-regulators
|
||||
- qcom,pm8005-rpmh-regulators
|
||||
- qcom,pm8009-rpmh-regulators
|
||||
- qcom,pm8009-1-rpmh-regulators
|
||||
@@ -87,6 +90,7 @@ properties:
|
||||
- qcom,pmm8155au-rpmh-regulators
|
||||
- qcom,pmm8654au-rpmh-regulators
|
||||
- qcom,pmr735a-rpmh-regulators
|
||||
- qcom,pmr735b-rpmh-regulators
|
||||
- qcom,pmx55-rpmh-regulators
|
||||
- qcom,pmx65-rpmh-regulators
|
||||
- qcom,pmx75-rpmh-regulators
|
||||
@@ -218,6 +222,25 @@ allOf:
|
||||
"^vdd-l[358]-supply$": true
|
||||
"^vdd-s[1-8]-supply$": true
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- qcom,pm7550-rpmh-regulators
|
||||
then:
|
||||
properties:
|
||||
vdd-bob-supply:
|
||||
description: BOB regulator parent supply phandle.
|
||||
vdd-l2-l3-supply: true
|
||||
vdd-l4-l5-supply: true
|
||||
vdd-l9-l10-supply: true
|
||||
vdd-l12-l14-supply: true
|
||||
vdd-l13-l16-supply: true
|
||||
vdd-l15-l17-l18-l19-l20-l21-l22-l23-supply: true
|
||||
patternProperties:
|
||||
"^vdd-l(1|[6-8]|11)-supply$": true
|
||||
"^vdd-s[1-6]-supply$": true
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
@@ -424,6 +447,18 @@ allOf:
|
||||
patternProperties:
|
||||
"^vdd-s[1-3]-supply$": true
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- qcom,pmr735b-rpmh-regulators
|
||||
then:
|
||||
properties:
|
||||
vdd-l1-l2-supply: true
|
||||
vdd-l7-l8-supply: true
|
||||
patternProperties:
|
||||
"^vdd-l([3-6]|9|1[0-2])-supply$": true
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
|
||||
+5
-2
@@ -12,14 +12,17 @@ maintainers:
|
||||
description: |
|
||||
The RaspberryPi 7" display has an ATTINY88-based regulator/backlight
|
||||
controller on the PCB, which is used to turn the display unit on/off
|
||||
and control the backlight.
|
||||
and control the backlight. The V2 supports 5" and 7" panels and also
|
||||
offers PWM backlight control.
|
||||
|
||||
allOf:
|
||||
- $ref: regulator.yaml#
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: raspberrypi,7inch-touchscreen-panel-regulator
|
||||
enum:
|
||||
- raspberrypi,7inch-touchscreen-panel-regulator
|
||||
- raspberrypi,touchscreen-panel-regulator-v2
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
@@ -26582,6 +26582,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
|
||||
F: Documentation/devicetree/bindings/regulator/
|
||||
F: Documentation/power/regulator/
|
||||
F: drivers/regulator/
|
||||
F: rust/kernel/regulator.rs
|
||||
F: include/dt-bindings/regulator/
|
||||
F: include/linux/regulator/
|
||||
K: regulator_get_optional
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Core functions for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
|
||||
* Core functions for following TI PMICs:
|
||||
* - LP8764
|
||||
* - TPS65224
|
||||
* - TPS652G1
|
||||
* - TPS6593
|
||||
* - TPS6594
|
||||
*
|
||||
* Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
|
||||
*/
|
||||
@@ -414,6 +419,61 @@ static const unsigned int tps65224_irq_reg[] = {
|
||||
TPS6594_REG_INT_FSM_ERR,
|
||||
};
|
||||
|
||||
/* TPS652G1 Resources */
|
||||
|
||||
static const struct mfd_cell tps652g1_common_cells[] = {
|
||||
MFD_CELL_RES("tps6594-pfsm", tps65224_pfsm_resources),
|
||||
MFD_CELL_RES("tps6594-pinctrl", tps65224_pinctrl_resources),
|
||||
MFD_CELL_NAME("tps6594-regulator"),
|
||||
};
|
||||
|
||||
static const struct regmap_irq tps652g1_irqs[] = {
|
||||
/* INT_GPIO register */
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_GPIO1, 2, TPS65224_BIT_GPIO1_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_GPIO2, 2, TPS65224_BIT_GPIO2_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_GPIO3, 2, TPS65224_BIT_GPIO3_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_GPIO4, 2, TPS65224_BIT_GPIO4_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_GPIO5, 2, TPS65224_BIT_GPIO5_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_GPIO6, 2, TPS65224_BIT_GPIO6_INT),
|
||||
|
||||
/* INT_STARTUP register */
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_VSENSE, 3, TPS65224_BIT_VSENSE_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_ENABLE, 3, TPS6594_BIT_ENABLE_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_PB_SHORT, 3, TPS65224_BIT_PB_SHORT_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_FSD, 3, TPS6594_BIT_FSD_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_SOFT_REBOOT, 3, TPS6594_BIT_SOFT_REBOOT_INT),
|
||||
|
||||
/* INT_MISC register */
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_BIST_PASS, 4, TPS6594_BIT_BIST_PASS_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_EXT_CLK, 4, TPS6594_BIT_EXT_CLK_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_REG_UNLOCK, 4, TPS65224_BIT_REG_UNLOCK_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_TWARN, 4, TPS6594_BIT_TWARN_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_PB_LONG, 4, TPS65224_BIT_PB_LONG_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_PB_FALL, 4, TPS65224_BIT_PB_FALL_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_PB_RISE, 4, TPS65224_BIT_PB_RISE_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_ADC_CONV_READY, 4, TPS65224_BIT_ADC_CONV_READY_INT),
|
||||
|
||||
/* INT_MODERATE_ERR register */
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_TSD_ORD, 5, TPS6594_BIT_TSD_ORD_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_BIST_FAIL, 5, TPS6594_BIT_BIST_FAIL_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_REG_CRC_ERR, 5, TPS6594_BIT_REG_CRC_ERR_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_RECOV_CNT, 5, TPS6594_BIT_RECOV_CNT_INT),
|
||||
|
||||
/* INT_SEVERE_ERR register */
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_TSD_IMM, 6, TPS6594_BIT_TSD_IMM_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_VCCA_OVP, 6, TPS6594_BIT_VCCA_OVP_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_PFSM_ERR, 6, TPS6594_BIT_PFSM_ERR_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_BG_XMON, 6, TPS65224_BIT_BG_XMON_INT),
|
||||
|
||||
/* INT_FSM_ERR register */
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_IMM_SHUTDOWN, 7, TPS6594_BIT_IMM_SHUTDOWN_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_ORD_SHUTDOWN, 7, TPS6594_BIT_ORD_SHUTDOWN_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_MCU_PWR_ERR, 7, TPS6594_BIT_MCU_PWR_ERR_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_SOC_PWR_ERR, 7, TPS6594_BIT_SOC_PWR_ERR_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_COMM_ERR, 7, TPS6594_BIT_COMM_ERR_INT),
|
||||
REGMAP_IRQ_REG(TPS65224_IRQ_I2C2_ERR, 7, TPS65224_BIT_I2C2_ERR_INT),
|
||||
};
|
||||
|
||||
static inline unsigned int tps6594_get_irq_reg(struct regmap_irq_chip_data *data,
|
||||
unsigned int base, int index)
|
||||
{
|
||||
@@ -443,7 +503,7 @@ static int tps6594_handle_post_irq(void *irq_drv_data)
|
||||
* a new interrupt.
|
||||
*/
|
||||
if (tps->use_crc) {
|
||||
if (tps->chip_id == TPS65224) {
|
||||
if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) {
|
||||
regmap_reg = TPS6594_REG_INT_FSM_ERR;
|
||||
mask_val = TPS6594_BIT_COMM_ERR_INT;
|
||||
} else {
|
||||
@@ -481,6 +541,18 @@ static struct regmap_irq_chip tps65224_irq_chip = {
|
||||
.handle_post_irq = tps6594_handle_post_irq,
|
||||
};
|
||||
|
||||
static struct regmap_irq_chip tps652g1_irq_chip = {
|
||||
.ack_base = TPS6594_REG_INT_BUCK,
|
||||
.ack_invert = 1,
|
||||
.clear_ack = 1,
|
||||
.init_ack_masked = 1,
|
||||
.num_regs = ARRAY_SIZE(tps65224_irq_reg),
|
||||
.irqs = tps652g1_irqs,
|
||||
.num_irqs = ARRAY_SIZE(tps652g1_irqs),
|
||||
.get_irq_reg = tps65224_get_irq_reg,
|
||||
.handle_post_irq = tps6594_handle_post_irq,
|
||||
};
|
||||
|
||||
static const struct regmap_range tps6594_volatile_ranges[] = {
|
||||
regmap_reg_range(TPS6594_REG_INT_TOP, TPS6594_REG_STAT_READBACK_ERR),
|
||||
regmap_reg_range(TPS6594_REG_RTC_STATUS, TPS6594_REG_RTC_STATUS),
|
||||
@@ -507,7 +579,7 @@ static int tps6594_check_crc_mode(struct tps6594 *tps, bool primary_pmic)
|
||||
int ret;
|
||||
unsigned int regmap_reg, mask_val;
|
||||
|
||||
if (tps->chip_id == TPS65224) {
|
||||
if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) {
|
||||
regmap_reg = TPS6594_REG_CONFIG_2;
|
||||
mask_val = TPS65224_BIT_I2C1_SPI_CRC_EN;
|
||||
} else {
|
||||
@@ -537,7 +609,7 @@ static int tps6594_set_crc_feature(struct tps6594 *tps)
|
||||
int ret;
|
||||
unsigned int regmap_reg, mask_val;
|
||||
|
||||
if (tps->chip_id == TPS65224) {
|
||||
if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) {
|
||||
regmap_reg = TPS6594_REG_CONFIG_2;
|
||||
mask_val = TPS65224_BIT_I2C1_SPI_CRC_EN;
|
||||
} else {
|
||||
@@ -628,6 +700,10 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
|
||||
irq_chip = &tps65224_irq_chip;
|
||||
n_cells = ARRAY_SIZE(tps65224_common_cells);
|
||||
cells = tps65224_common_cells;
|
||||
} else if (tps->chip_id == TPS652G1) {
|
||||
irq_chip = &tps652g1_irq_chip;
|
||||
n_cells = ARRAY_SIZE(tps652g1_common_cells);
|
||||
cells = tps652g1_common_cells;
|
||||
} else {
|
||||
irq_chip = &tps6594_irq_chip;
|
||||
n_cells = ARRAY_SIZE(tps6594_common_cells);
|
||||
@@ -651,8 +727,8 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to add common child devices\n");
|
||||
|
||||
/* No RTC for LP8764 and TPS65224 */
|
||||
if (tps->chip_id != LP8764 && tps->chip_id != TPS65224) {
|
||||
/* No RTC for LP8764, TPS65224 and TPS652G1 */
|
||||
if (tps->chip_id != LP8764 && tps->chip_id != TPS65224 && tps->chip_id != TPS652G1) {
|
||||
ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, tps6594_rtc_cells,
|
||||
ARRAY_SIZE(tps6594_rtc_cells), NULL, 0,
|
||||
regmap_irq_get_domain(tps->irq_data));
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* I2C access driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
|
||||
* I2C access driver for the following TI PMICs:
|
||||
* - LP8764
|
||||
* - TPS65224
|
||||
* - TPS652G1
|
||||
* - TPS6593
|
||||
* - TPS6594
|
||||
*
|
||||
* Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
|
||||
*/
|
||||
@@ -197,6 +202,7 @@ static const struct of_device_id tps6594_i2c_of_match_table[] = {
|
||||
{ .compatible = "ti,tps6593-q1", .data = (void *)TPS6593, },
|
||||
{ .compatible = "ti,lp8764-q1", .data = (void *)LP8764, },
|
||||
{ .compatible = "ti,tps65224-q1", .data = (void *)TPS65224, },
|
||||
{ .compatible = "ti,tps652g1", .data = (void *)TPS652G1, },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, tps6594_i2c_of_match_table);
|
||||
@@ -222,7 +228,7 @@ static int tps6594_i2c_probe(struct i2c_client *client)
|
||||
return dev_err_probe(dev, -EINVAL, "Failed to find matching chip ID\n");
|
||||
tps->chip_id = (unsigned long)match->data;
|
||||
|
||||
if (tps->chip_id == TPS65224)
|
||||
if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1)
|
||||
tps6594_i2c_regmap_config.volatile_table = &tps65224_volatile_table;
|
||||
|
||||
tps->regmap = devm_regmap_init(dev, NULL, client, &tps6594_i2c_regmap_config);
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* SPI access driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
|
||||
* SPI access driver for the following TI PMICs:
|
||||
* - LP8764
|
||||
* - TPS65224
|
||||
* - TPS652G1
|
||||
* - TPS6593
|
||||
* - TPS6594
|
||||
*
|
||||
* Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
|
||||
*/
|
||||
@@ -82,6 +87,7 @@ static const struct of_device_id tps6594_spi_of_match_table[] = {
|
||||
{ .compatible = "ti,tps6593-q1", .data = (void *)TPS6593, },
|
||||
{ .compatible = "ti,lp8764-q1", .data = (void *)LP8764, },
|
||||
{ .compatible = "ti,tps65224-q1", .data = (void *)TPS65224, },
|
||||
{ .compatible = "ti,tps652g1", .data = (void *)TPS652G1, },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, tps6594_spi_of_match_table);
|
||||
@@ -107,7 +113,7 @@ static int tps6594_spi_probe(struct spi_device *spi)
|
||||
return dev_err_probe(dev, -EINVAL, "Failed to find matching chip ID\n");
|
||||
tps->chip_id = (unsigned long)match->data;
|
||||
|
||||
if (tps->chip_id == TPS65224)
|
||||
if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1)
|
||||
tps6594_spi_regmap_config.volatile_table = &tps65224_volatile_table;
|
||||
|
||||
tps->regmap = devm_regmap_init(dev, NULL, spi, &tps6594_spi_regmap_config);
|
||||
|
||||
+21
-10
@@ -1,6 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* PFSM (Pre-configurable Finite State Machine) driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
|
||||
* PFSM (Pre-configurable Finite State Machine) driver for the following
|
||||
* PMICs:
|
||||
* - LP8764
|
||||
* - TPS65224
|
||||
* - TPS652G1
|
||||
* - TPS6594
|
||||
* - TPS6593
|
||||
*
|
||||
* Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
|
||||
*/
|
||||
@@ -141,7 +147,7 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
|
||||
switch (cmd) {
|
||||
case PMIC_GOTO_STANDBY:
|
||||
/* Disable LP mode on TPS6594 Family PMIC */
|
||||
if (pfsm->chip_id != TPS65224) {
|
||||
if (pfsm->chip_id != TPS65224 && pfsm->chip_id != TPS652G1) {
|
||||
ret = regmap_clear_bits(pfsm->regmap, TPS6594_REG_RTC_CTRL_2,
|
||||
TPS6594_BIT_LP_STANDBY_SEL);
|
||||
|
||||
@@ -154,8 +160,8 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
|
||||
TPS6594_BIT_TRIGGER_I2C(0), TPS6594_BIT_TRIGGER_I2C(0));
|
||||
break;
|
||||
case PMIC_GOTO_LP_STANDBY:
|
||||
/* TPS65224 does not support LP STANDBY */
|
||||
if (pfsm->chip_id == TPS65224)
|
||||
/* TPS65224/TPS652G1 does not support LP STANDBY */
|
||||
if (pfsm->chip_id == TPS65224 || pfsm->chip_id == TPS652G1)
|
||||
return ret;
|
||||
|
||||
/* Enable LP mode */
|
||||
@@ -179,8 +185,8 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
|
||||
TPS6594_BIT_NSLEEP1B | TPS6594_BIT_NSLEEP2B);
|
||||
break;
|
||||
case PMIC_SET_MCU_ONLY_STATE:
|
||||
/* TPS65224 does not support MCU_ONLY_STATE */
|
||||
if (pfsm->chip_id == TPS65224)
|
||||
/* TPS65224/TPS652G1 does not support MCU_ONLY_STATE */
|
||||
if (pfsm->chip_id == TPS65224 || pfsm->chip_id == TPS652G1)
|
||||
return ret;
|
||||
|
||||
if (copy_from_user(&state_opt, argp, sizeof(state_opt)))
|
||||
@@ -206,7 +212,7 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
|
||||
return -EFAULT;
|
||||
|
||||
/* Configure wake-up destination */
|
||||
if (pfsm->chip_id == TPS65224) {
|
||||
if (pfsm->chip_id == TPS65224 || pfsm->chip_id == TPS652G1) {
|
||||
regmap_reg = TPS65224_REG_STARTUP_CTRL;
|
||||
mask = TPS65224_MASK_STARTUP_DEST;
|
||||
} else {
|
||||
@@ -230,9 +236,14 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
|
||||
return ret;
|
||||
|
||||
/* Modify NSLEEP1-2 bits */
|
||||
ret = regmap_clear_bits(pfsm->regmap, TPS6594_REG_FSM_NSLEEP_TRIGGERS,
|
||||
pfsm->chip_id == TPS65224 ?
|
||||
TPS6594_BIT_NSLEEP1B : TPS6594_BIT_NSLEEP2B);
|
||||
if (pfsm->chip_id == TPS65224 || pfsm->chip_id == TPS652G1)
|
||||
ret = regmap_clear_bits(pfsm->regmap,
|
||||
TPS6594_REG_FSM_NSLEEP_TRIGGERS,
|
||||
TPS6594_BIT_NSLEEP1B);
|
||||
else
|
||||
ret = regmap_clear_bits(pfsm->regmap,
|
||||
TPS6594_REG_FSM_NSLEEP_TRIGGERS,
|
||||
TPS6594_BIT_NSLEEP2B);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,6 +226,10 @@ static const char *const tps65224_nerr_mcu_func_group_names[] = {
|
||||
"GPIO5",
|
||||
};
|
||||
|
||||
static const char *const tps652g1_cs_spi_func_group_names[] = {
|
||||
"GPIO1",
|
||||
};
|
||||
|
||||
struct tps6594_pinctrl_function {
|
||||
struct pinfunction pinfunction;
|
||||
u8 muxval;
|
||||
@@ -287,6 +291,18 @@ static const struct tps6594_pinctrl_function tps65224_pinctrl_functions[] = {
|
||||
FUNCTION(tps65224, nerr_mcu, TPS65224_PINCTRL_NERR_MCU_FUNCTION),
|
||||
};
|
||||
|
||||
static const struct tps6594_pinctrl_function tps652g1_pinctrl_functions[] = {
|
||||
FUNCTION(tps65224, gpio, TPS6594_PINCTRL_GPIO_FUNCTION),
|
||||
FUNCTION(tps65224, sda_i2c2_sdo_spi, TPS65224_PINCTRL_SDA_I2C2_SDO_SPI_FUNCTION),
|
||||
FUNCTION(tps65224, nsleep2, TPS65224_PINCTRL_NSLEEP2_FUNCTION),
|
||||
FUNCTION(tps65224, nint, TPS65224_PINCTRL_NINT_FUNCTION),
|
||||
FUNCTION(tps652g1, cs_spi, TPS65224_PINCTRL_SCL_I2C2_CS_SPI_FUNCTION),
|
||||
FUNCTION(tps65224, nsleep1, TPS65224_PINCTRL_NSLEEP1_FUNCTION),
|
||||
FUNCTION(tps65224, pb, TPS65224_PINCTRL_PB_FUNCTION),
|
||||
FUNCTION(tps65224, wkup, TPS65224_PINCTRL_WKUP_FUNCTION),
|
||||
FUNCTION(tps65224, syncclkin, TPS65224_PINCTRL_SYNCCLKIN_FUNCTION),
|
||||
};
|
||||
|
||||
struct tps6594_pinctrl {
|
||||
struct tps6594 *tps;
|
||||
struct gpio_regmap *gpio_regmap;
|
||||
@@ -300,6 +316,16 @@ struct tps6594_pinctrl {
|
||||
struct muxval_remap *remap;
|
||||
};
|
||||
|
||||
static struct tps6594_pinctrl tps652g1_template_pinctrl = {
|
||||
.funcs = tps652g1_pinctrl_functions,
|
||||
.func_cnt = ARRAY_SIZE(tps652g1_pinctrl_functions),
|
||||
.pins = tps65224_pins,
|
||||
.num_pins = ARRAY_SIZE(tps65224_pins),
|
||||
.mux_sel_mask = TPS65224_MASK_GPIO_SEL,
|
||||
.remap = tps65224_muxval_remap,
|
||||
.remap_cnt = ARRAY_SIZE(tps65224_muxval_remap),
|
||||
};
|
||||
|
||||
static struct tps6594_pinctrl tps65224_template_pinctrl = {
|
||||
.funcs = tps65224_pinctrl_functions,
|
||||
.func_cnt = ARRAY_SIZE(tps65224_pinctrl_functions),
|
||||
@@ -475,6 +501,15 @@ static int tps6594_pinctrl_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
switch (tps->chip_id) {
|
||||
case TPS652G1:
|
||||
pctrl_desc->pins = tps65224_pins;
|
||||
pctrl_desc->npins = ARRAY_SIZE(tps65224_pins);
|
||||
|
||||
*pinctrl = tps652g1_template_pinctrl;
|
||||
|
||||
config.ngpio = ARRAY_SIZE(tps65224_gpio_func_group_names);
|
||||
config.ngpio_per_reg = TPS65224_NGPIO_PER_REG;
|
||||
break;
|
||||
case TPS65224:
|
||||
pctrl_desc->pins = tps65224_pins;
|
||||
pctrl_desc->npins = ARRAY_SIZE(tps65224_pins);
|
||||
|
||||
@@ -1153,6 +1153,17 @@ config REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY
|
||||
touchscreen unit. The regulator is used to enable power to the
|
||||
TC358762, display and to control backlight.
|
||||
|
||||
config REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2
|
||||
tristate "Raspberry Pi 7-inch touchscreen panel V2 regulator"
|
||||
depends on GPIOLIB
|
||||
depends on I2C && OF
|
||||
select GPIO_REGMAP
|
||||
select REGMAP_I2C
|
||||
help
|
||||
This driver supports regulator on the V2 Raspberry Pi touchscreen
|
||||
unit. The regulator is used to enable power to the display and to
|
||||
control backlight PWM.
|
||||
|
||||
config REGULATOR_RC5T583
|
||||
tristate "RICOH RC5T583 Power regulators"
|
||||
depends on MFD_RC5T583
|
||||
@@ -1192,7 +1203,7 @@ config REGULATOR_RT4801
|
||||
The device supports two regulators (DSVP/DSVN).
|
||||
|
||||
config REGULATOR_RT4803
|
||||
tristate "Richtek RT4803 boost regualtor"
|
||||
tristate "Richtek RT4803 boost regulator"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
|
||||
@@ -136,6 +136,7 @@ obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_RAA215300) += raa215300.o
|
||||
obj-$(CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY) += rpi-panel-attiny-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2) += rpi-panel-v2-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_RK808) += rk808-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_RN5T618) += rn5t618-regulator.o
|
||||
|
||||
@@ -134,9 +134,19 @@ static void voltage_change_done(struct regulator_dev *rdev, unsigned int sel,
|
||||
|
||||
if (*mask) {
|
||||
/*
|
||||
* Let's allow scheduling as we use I2C anyways. We just need to
|
||||
* guarantee minimum of 1ms sleep - it shouldn't matter if we
|
||||
* exceed it due to the scheduling.
|
||||
* We had fault detection disabled for the duration of the
|
||||
* voltage change.
|
||||
*
|
||||
* According to HW colleagues the maximum time it takes is
|
||||
* 1000us. I assume that on systems with light load this
|
||||
* might be less - and we could probably use DT to give
|
||||
* system specific delay value if performance matters.
|
||||
*
|
||||
* Well, knowing we use I2C here and can add scheduling delays
|
||||
* I don't think it is worth the hassle and I just add fixed
|
||||
* 1ms sleep here (and allow scheduling). If this turns out to
|
||||
* be a problem we can change it to delay and make the delay
|
||||
* time configurable.
|
||||
*/
|
||||
msleep(1);
|
||||
|
||||
@@ -173,16 +183,7 @@ static int voltage_change_prepare(struct regulator_dev *rdev, unsigned int sel,
|
||||
/*
|
||||
* If we increase LDO voltage when LDO is enabled we need to
|
||||
* disable the power-good detection until voltage has reached
|
||||
* the new level. According to HW colleagues the maximum time
|
||||
* it takes is 1000us. I assume that on systems with light load
|
||||
* this might be less - and we could probably use DT to give
|
||||
* system specific delay value if performance matters.
|
||||
*
|
||||
* Well, knowing we use I2C here and can add scheduling delays
|
||||
* I don't think it is worth the hassle and I just add fixed
|
||||
* 1ms sleep here (and allow scheduling). If this turns out to
|
||||
* be a problem we can change it to delay and make the delay
|
||||
* time configurable.
|
||||
* the new level.
|
||||
*/
|
||||
if (new > now) {
|
||||
int tmp;
|
||||
|
||||
@@ -3797,6 +3797,16 @@ static int _regulator_do_set_suspend_voltage(struct regulator_dev *rdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int regulator_get_voltage_delta(struct regulator_dev *rdev, int uV)
|
||||
{
|
||||
int current_uV = regulator_get_voltage_rdev(rdev);
|
||||
|
||||
if (current_uV < 0)
|
||||
return current_uV;
|
||||
|
||||
return abs(current_uV - uV);
|
||||
}
|
||||
|
||||
static int regulator_set_voltage_unlocked(struct regulator *regulator,
|
||||
int min_uV, int max_uV,
|
||||
suspend_state_t state)
|
||||
@@ -3804,8 +3814,8 @@ static int regulator_set_voltage_unlocked(struct regulator *regulator,
|
||||
struct regulator_dev *rdev = regulator->rdev;
|
||||
struct regulator_voltage *voltage = ®ulator->voltage[state];
|
||||
int ret = 0;
|
||||
int current_uV, delta, new_delta;
|
||||
int old_min_uV, old_max_uV;
|
||||
int current_uV;
|
||||
|
||||
/* If we're setting the same range as last time the change
|
||||
* should be a noop (some cpufreq implementations use the same
|
||||
@@ -3852,6 +3862,37 @@ static int regulator_set_voltage_unlocked(struct regulator *regulator,
|
||||
voltage->max_uV = old_max_uV;
|
||||
}
|
||||
|
||||
if (rdev->constraints->max_uV_step > 0) {
|
||||
/* For regulators with a maximum voltage step, reaching the desired
|
||||
* voltage might take a few retries.
|
||||
*/
|
||||
ret = regulator_get_voltage_delta(rdev, min_uV);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
delta = ret;
|
||||
|
||||
while (delta > 0) {
|
||||
ret = regulator_balance_voltage(rdev, state);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
ret = regulator_get_voltage_delta(rdev, min_uV);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
new_delta = ret;
|
||||
|
||||
/* check that voltage is converging quickly enough */
|
||||
if (new_delta - delta > rdev->constraints->max_uV_step) {
|
||||
ret = -EWOULDBLOCK;
|
||||
goto out;
|
||||
}
|
||||
|
||||
delta = new_delta;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ static int mt6370_regulator_irq_register(struct mt6370_priv *priv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mt6370_regualtor_register(struct mt6370_priv *priv)
|
||||
static int mt6370_regulator_register(struct mt6370_priv *priv)
|
||||
{
|
||||
struct regulator_dev *rdev;
|
||||
struct regulator_config cfg = {};
|
||||
@@ -363,7 +363,7 @@ static int mt6370_regulator_probe(struct platform_device *pdev)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = mt6370_regualtor_register(priv);
|
||||
ret = mt6370_regulator_register(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -117,6 +117,24 @@ static const struct dvfsrc_regulator_pdata mt6873_data = {
|
||||
.size = ARRAY_SIZE(mt6873_regulators),
|
||||
};
|
||||
|
||||
static const unsigned int mt6893_voltages[] = {
|
||||
575000,
|
||||
600000,
|
||||
650000,
|
||||
725000,
|
||||
750000,
|
||||
};
|
||||
|
||||
static const struct regulator_desc mt6893_regulators[] = {
|
||||
MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt6893_voltages),
|
||||
MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt6893_voltages),
|
||||
};
|
||||
|
||||
static const struct dvfsrc_regulator_pdata mt6893_data = {
|
||||
.descs = mt6893_regulators,
|
||||
.size = ARRAY_SIZE(mt6893_regulators),
|
||||
};
|
||||
|
||||
static const unsigned int mt8183_voltages[] = {
|
||||
725000,
|
||||
800000,
|
||||
@@ -148,6 +166,24 @@ static const struct dvfsrc_regulator_pdata mt8195_data = {
|
||||
.size = ARRAY_SIZE(mt8195_regulators),
|
||||
};
|
||||
|
||||
static const unsigned int mt8196_voltages[] = {
|
||||
575000,
|
||||
600000,
|
||||
650000,
|
||||
725000,
|
||||
825000,
|
||||
875000,
|
||||
};
|
||||
|
||||
static const struct regulator_desc mt8196_regulators[] = {
|
||||
MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8196_voltages),
|
||||
};
|
||||
|
||||
static const struct dvfsrc_regulator_pdata mt8196_data = {
|
||||
.descs = mt8196_regulators,
|
||||
.size = ARRAY_SIZE(mt8196_regulators),
|
||||
};
|
||||
|
||||
static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct regulator_config config = { .dev = &pdev->dev };
|
||||
@@ -173,9 +209,11 @@ static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev)
|
||||
|
||||
static const struct of_device_id mtk_dvfsrc_regulator_match[] = {
|
||||
{ .compatible = "mediatek,mt6873-dvfsrc-regulator", .data = &mt6873_data },
|
||||
{ .compatible = "mediatek,mt6893-dvfsrc-regulator", .data = &mt6893_data },
|
||||
{ .compatible = "mediatek,mt8183-dvfsrc-regulator", .data = &mt8183_data },
|
||||
{ .compatible = "mediatek,mt8192-dvfsrc-regulator", .data = &mt6873_data },
|
||||
{ .compatible = "mediatek,mt8195-dvfsrc-regulator", .data = &mt8195_data },
|
||||
{ .compatible = "mediatek,mt8196-dvfsrc-regulator", .data = &mt8196_data },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, mtk_dvfsrc_regulator_match);
|
||||
|
||||
@@ -17,12 +17,18 @@
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/regulator/of_regulator.h>
|
||||
#include <linux/regulator/pca9450.h>
|
||||
#include <dt-bindings/regulator/nxp,pca9450-regulator.h>
|
||||
|
||||
static unsigned int pca9450_buck_get_mode(struct regulator_dev *rdev);
|
||||
static int pca9450_buck_set_mode(struct regulator_dev *rdev, unsigned int mode);
|
||||
|
||||
struct pc9450_dvs_config {
|
||||
unsigned int run_reg; /* dvs0 */
|
||||
unsigned int run_mask;
|
||||
unsigned int standby_reg; /* dvs1 */
|
||||
unsigned int standby_mask;
|
||||
unsigned int mode_reg; /* ctrl */
|
||||
unsigned int mode_mask;
|
||||
};
|
||||
|
||||
struct pca9450_regulator_desc {
|
||||
@@ -80,6 +86,8 @@ static const struct regulator_ops pca9450_dvs_buck_regulator_ops = {
|
||||
.get_voltage_sel = regulator_get_voltage_sel_regmap,
|
||||
.set_voltage_time_sel = regulator_set_voltage_time_sel,
|
||||
.set_ramp_delay = regulator_set_ramp_delay_regmap,
|
||||
.set_mode = pca9450_buck_set_mode,
|
||||
.get_mode = pca9450_buck_get_mode,
|
||||
};
|
||||
|
||||
static const struct regulator_ops pca9450_buck_regulator_ops = {
|
||||
@@ -90,6 +98,8 @@ static const struct regulator_ops pca9450_buck_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,
|
||||
.set_mode = pca9450_buck_set_mode,
|
||||
.get_mode = pca9450_buck_get_mode,
|
||||
};
|
||||
|
||||
static const struct regulator_ops pca9450_ldo_regulator_ops = {
|
||||
@@ -285,7 +295,64 @@ static int pca9450_set_dvs_levels(struct device_node *np,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
static inline unsigned int pca9450_map_mode(unsigned int mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case PCA9450_BUCK_MODE_AUTO:
|
||||
return REGULATOR_MODE_NORMAL;
|
||||
case PCA9450_BUCK_MODE_FORCE_PWM:
|
||||
return REGULATOR_MODE_FAST;
|
||||
default:
|
||||
return REGULATOR_MODE_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
static int pca9450_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
|
||||
{
|
||||
struct pca9450_regulator_desc *desc = container_of(rdev->desc,
|
||||
struct pca9450_regulator_desc, desc);
|
||||
const struct pc9450_dvs_config *dvs = &desc->dvs;
|
||||
int val;
|
||||
|
||||
switch (mode) {
|
||||
case REGULATOR_MODE_FAST:
|
||||
val = dvs->mode_mask;
|
||||
break;
|
||||
case REGULATOR_MODE_NORMAL:
|
||||
val = 0;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(&rdev->dev, "pca9450 buck set_mode %#x, %#x, %#x\n",
|
||||
dvs->mode_reg, dvs->mode_mask, val);
|
||||
|
||||
return regmap_update_bits(rdev->regmap, dvs->mode_reg,
|
||||
dvs->mode_mask, val);
|
||||
}
|
||||
|
||||
static unsigned int pca9450_buck_get_mode(struct regulator_dev *rdev)
|
||||
{
|
||||
struct pca9450_regulator_desc *desc = container_of(rdev->desc,
|
||||
struct pca9450_regulator_desc, desc);
|
||||
const struct pc9450_dvs_config *dvs = &desc->dvs;
|
||||
int ret = 0, regval;
|
||||
|
||||
ret = regmap_read(rdev->regmap, dvs->mode_reg, ®val);
|
||||
if (ret != 0) {
|
||||
dev_err(&rdev->dev,
|
||||
"Failed to get pca9450 buck mode: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((regval & dvs->mode_mask) == dvs->mode_mask)
|
||||
return REGULATOR_MODE_FAST;
|
||||
|
||||
return REGULATOR_MODE_NORMAL;
|
||||
}
|
||||
|
||||
static struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
{
|
||||
.desc = {
|
||||
.name = "buck1",
|
||||
@@ -308,12 +375,15 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_parse_cb = pca9450_set_dvs_levels,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.run_reg = PCA9450_REG_BUCK1OUT_DVS0,
|
||||
.run_mask = BUCK1OUT_DVS0_MASK,
|
||||
.standby_reg = PCA9450_REG_BUCK1OUT_DVS1,
|
||||
.standby_mask = BUCK1OUT_DVS1_MASK,
|
||||
.mode_reg = PCA9450_REG_BUCK1CTRL,
|
||||
.mode_mask = BUCK1_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -338,12 +408,15 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
.n_ramp_values = ARRAY_SIZE(pca9450_dvs_buck_ramp_table),
|
||||
.owner = THIS_MODULE,
|
||||
.of_parse_cb = pca9450_set_dvs_levels,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.run_reg = PCA9450_REG_BUCK2OUT_DVS0,
|
||||
.run_mask = BUCK2OUT_DVS0_MASK,
|
||||
.standby_reg = PCA9450_REG_BUCK2OUT_DVS1,
|
||||
.standby_mask = BUCK2OUT_DVS1_MASK,
|
||||
.mode_reg = PCA9450_REG_BUCK2CTRL,
|
||||
.mode_mask = BUCK2_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -368,12 +441,15 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
.n_ramp_values = ARRAY_SIZE(pca9450_dvs_buck_ramp_table),
|
||||
.owner = THIS_MODULE,
|
||||
.of_parse_cb = pca9450_set_dvs_levels,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.run_reg = PCA9450_REG_BUCK3OUT_DVS0,
|
||||
.run_mask = BUCK3OUT_DVS0_MASK,
|
||||
.standby_reg = PCA9450_REG_BUCK3OUT_DVS1,
|
||||
.standby_mask = BUCK3OUT_DVS1_MASK,
|
||||
.mode_reg = PCA9450_REG_BUCK3CTRL,
|
||||
.mode_mask = BUCK3_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -393,6 +469,11 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
.enable_mask = BUCK4_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK4CTRL,
|
||||
.mode_mask = BUCK4_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -412,6 +493,11 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
.enable_mask = BUCK5_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK5CTRL,
|
||||
.mode_mask = BUCK5_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -431,6 +517,11 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
.enable_mask = BUCK6_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK6CTRL,
|
||||
.mode_mask = BUCK6_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -529,7 +620,7 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
|
||||
* Buck3 removed on PCA9450B and connected with Buck1 internal for dual phase
|
||||
* on PCA9450C as no Buck3.
|
||||
*/
|
||||
static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
|
||||
static struct pca9450_regulator_desc pca9450bc_regulators[] = {
|
||||
{
|
||||
.desc = {
|
||||
.name = "buck1",
|
||||
@@ -552,12 +643,15 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
|
||||
.n_ramp_values = ARRAY_SIZE(pca9450_dvs_buck_ramp_table),
|
||||
.owner = THIS_MODULE,
|
||||
.of_parse_cb = pca9450_set_dvs_levels,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.run_reg = PCA9450_REG_BUCK1OUT_DVS0,
|
||||
.run_mask = BUCK1OUT_DVS0_MASK,
|
||||
.standby_reg = PCA9450_REG_BUCK1OUT_DVS1,
|
||||
.standby_mask = BUCK1OUT_DVS1_MASK,
|
||||
.mode_reg = PCA9450_REG_BUCK1CTRL,
|
||||
.mode_mask = BUCK1_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -582,12 +676,15 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
|
||||
.n_ramp_values = ARRAY_SIZE(pca9450_dvs_buck_ramp_table),
|
||||
.owner = THIS_MODULE,
|
||||
.of_parse_cb = pca9450_set_dvs_levels,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.run_reg = PCA9450_REG_BUCK2OUT_DVS0,
|
||||
.run_mask = BUCK2OUT_DVS0_MASK,
|
||||
.standby_reg = PCA9450_REG_BUCK2OUT_DVS1,
|
||||
.standby_mask = BUCK2OUT_DVS1_MASK,
|
||||
.mode_reg = PCA9450_REG_BUCK2CTRL,
|
||||
.mode_mask = BUCK2_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -607,6 +704,11 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
|
||||
.enable_mask = BUCK4_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK4CTRL,
|
||||
.mode_mask = BUCK4_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -626,6 +728,11 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
|
||||
.enable_mask = BUCK5_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK5CTRL,
|
||||
.mode_mask = BUCK5_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -645,6 +752,11 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
|
||||
.enable_mask = BUCK6_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK6CTRL,
|
||||
.mode_mask = BUCK6_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -739,7 +851,7 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct pca9450_regulator_desc pca9451a_regulators[] = {
|
||||
static struct pca9450_regulator_desc pca9451a_regulators[] = {
|
||||
{
|
||||
.desc = {
|
||||
.name = "buck1",
|
||||
@@ -761,12 +873,15 @@ static const struct pca9450_regulator_desc pca9451a_regulators[] = {
|
||||
.n_ramp_values = ARRAY_SIZE(pca9450_dvs_buck_ramp_table),
|
||||
.owner = THIS_MODULE,
|
||||
.of_parse_cb = pca9450_set_dvs_levels,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.run_reg = PCA9450_REG_BUCK1OUT_DVS0,
|
||||
.run_mask = BUCK1OUT_DVS0_MASK,
|
||||
.standby_reg = PCA9450_REG_BUCK1OUT_DVS1,
|
||||
.standby_mask = BUCK1OUT_DVS1_MASK,
|
||||
.mode_reg = PCA9450_REG_BUCK1CTRL,
|
||||
.mode_mask = BUCK1_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -790,12 +905,15 @@ static const struct pca9450_regulator_desc pca9451a_regulators[] = {
|
||||
.n_ramp_values = ARRAY_SIZE(pca9450_dvs_buck_ramp_table),
|
||||
.owner = THIS_MODULE,
|
||||
.of_parse_cb = pca9450_set_dvs_levels,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.run_reg = PCA9450_REG_BUCK2OUT_DVS0,
|
||||
.run_mask = BUCK2OUT_DVS0_MASK,
|
||||
.standby_reg = PCA9450_REG_BUCK2OUT_DVS1,
|
||||
.standby_mask = BUCK2OUT_DVS1_MASK,
|
||||
.mode_reg = PCA9450_REG_BUCK2CTRL,
|
||||
.mode_mask = BUCK2_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -815,6 +933,11 @@ static const struct pca9450_regulator_desc pca9451a_regulators[] = {
|
||||
.enable_mask = BUCK4_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK4CTRL,
|
||||
.mode_mask = BUCK4_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -834,6 +957,11 @@ static const struct pca9450_regulator_desc pca9451a_regulators[] = {
|
||||
.enable_mask = BUCK5_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK5CTRL,
|
||||
.mode_mask = BUCK5_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -853,6 +981,11 @@ static const struct pca9450_regulator_desc pca9451a_regulators[] = {
|
||||
.enable_mask = BUCK6_ENMODE_MASK,
|
||||
.enable_val = BUCK_ENMODE_ONREQ,
|
||||
.owner = THIS_MODULE,
|
||||
.of_map_mode = pca9450_map_mode,
|
||||
},
|
||||
.dvs = {
|
||||
.mode_reg = PCA9450_REG_BUCK6CTRL,
|
||||
.mode_mask = BUCK6_FPWM,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -990,7 +1123,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
enum pca9450_chip_type type = (unsigned int)(uintptr_t)
|
||||
of_device_get_match_data(&i2c->dev);
|
||||
const struct pca9450_regulator_desc *regulator_desc;
|
||||
const struct pca9450_regulator_desc *regulator_desc;
|
||||
struct regulator_config config = { };
|
||||
struct regulator_dev *ldo5;
|
||||
struct pca9450 *pca9450;
|
||||
|
||||
@@ -1462,6 +1462,40 @@ static const struct rpmh_vreg_init_data pm7325_vreg_data[] = {
|
||||
{}
|
||||
};
|
||||
|
||||
static const struct rpmh_vreg_init_data pm7550_vreg_data[] = {
|
||||
RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps525, "vdd-s1"),
|
||||
RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps525, "vdd-s2"),
|
||||
RPMH_VREG("smps3", "smp%s3", &pmic5_ftsmps525, "vdd-s3"),
|
||||
RPMH_VREG("smps4", "smp%s4", &pmic5_ftsmps525, "vdd-s4"),
|
||||
RPMH_VREG("smps5", "smp%s5", &pmic5_ftsmps525, "vdd-s5"),
|
||||
RPMH_VREG("smps6", "smp%s6", &pmic5_ftsmps525, "vdd-s6"),
|
||||
RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo515, "vdd-l1"),
|
||||
RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo515, "vdd-l2-l3"),
|
||||
RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo515, "vdd-l2-l3"),
|
||||
RPMH_VREG("ldo4", "ldo%s4", &pmic5_nldo515, "vdd-l4-l5"),
|
||||
RPMH_VREG("ldo5", "ldo%s5", &pmic5_nldo515, "vdd-l4-l5"),
|
||||
RPMH_VREG("ldo6", "ldo%s6", &pmic5_nldo515, "vdd-l6"),
|
||||
RPMH_VREG("ldo7", "ldo%s7", &pmic5_nldo515, "vdd-l7"),
|
||||
RPMH_VREG("ldo8", "ldo%s8", &pmic5_nldo515, "vdd-l8"),
|
||||
RPMH_VREG("ldo9", "ldo%s9", &pmic5_nldo515, "vdd-l9-l10"),
|
||||
RPMH_VREG("ldo10", "ldo%s10", &pmic5_nldo515, "vdd-l9-l10"),
|
||||
RPMH_VREG("ldo11", "ldo%s11", &pmic5_nldo515, "vdd-l11"),
|
||||
RPMH_VREG("ldo12", "ldo%s12", &pmic5_pldo515_mv, "vdd-l12-l14"),
|
||||
RPMH_VREG("ldo13", "ldo%s13", &pmic5_pldo515_mv, "vdd-l13-l16"),
|
||||
RPMH_VREG("ldo14", "ldo%s14", &pmic5_pldo, "vdd-l12-l14"),
|
||||
RPMH_VREG("ldo15", "ldo%s15", &pmic5_pldo, "vdd-l15-l17-l18-l19-l20-l21-l22-l23"),
|
||||
RPMH_VREG("ldo16", "ldo%s16", &pmic5_pldo, "vdd-l13-l16"),
|
||||
RPMH_VREG("ldo17", "ldo%s17", &pmic5_pldo, "vdd-l15-l17-l18-l19-l20-l21-l22-l23"),
|
||||
RPMH_VREG("ldo18", "ldo%s18", &pmic5_pldo, "vdd-l15-l17-l18-l19-l20-l21-l22-l23"),
|
||||
RPMH_VREG("ldo19", "ldo%s19", &pmic5_pldo, "vdd-l15-l17-l18-l19-l20-l21-l22-l23"),
|
||||
RPMH_VREG("ldo20", "ldo%s20", &pmic5_pldo, "vdd-l15-l17-l18-l19-l20-l21-l22-l23"),
|
||||
RPMH_VREG("ldo21", "ldo%s21", &pmic5_pldo, "vdd-l15-l17-l18-l19-l20-l21-l22-l23"),
|
||||
RPMH_VREG("ldo22", "ldo%s22", &pmic5_pldo, "vdd-l15-l17-l18-l19-l20-l21-l22-l23"),
|
||||
RPMH_VREG("ldo23", "ldo%s23", &pmic5_pldo, "vdd-l15-l17-l18-l19-l20-l21-l22-l23"),
|
||||
RPMH_VREG("bob", "bob%s1", &pmic5_bob, "vdd-bob"),
|
||||
{}
|
||||
};
|
||||
|
||||
static const struct rpmh_vreg_init_data pmr735a_vreg_data[] = {
|
||||
RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps520, "vdd-s1"),
|
||||
RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps520, "vdd-s2"),
|
||||
@@ -1476,6 +1510,22 @@ static const struct rpmh_vreg_init_data pmr735a_vreg_data[] = {
|
||||
{}
|
||||
};
|
||||
|
||||
static const struct rpmh_vreg_init_data pmr735b_vreg_data[] = {
|
||||
RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo, "vdd-l1-l2"),
|
||||
RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo, "vdd-l1-l2"),
|
||||
RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo, "vdd-l3"),
|
||||
RPMH_VREG("ldo4", "ldo%s4", &pmic5_pldo_lv, "vdd-l4"),
|
||||
RPMH_VREG("ldo5", "ldo%s5", &pmic5_nldo, "vdd-l5"),
|
||||
RPMH_VREG("ldo6", "ldo%s6", &pmic5_nldo, "vdd-l6"),
|
||||
RPMH_VREG("ldo7", "ldo%s7", &pmic5_nldo, "vdd-l7-l8"),
|
||||
RPMH_VREG("ldo8", "ldo%s8", &pmic5_nldo, "vdd-l7-l8"),
|
||||
RPMH_VREG("ldo9", "ldo%s9", &pmic5_nldo, "vdd-l9"),
|
||||
RPMH_VREG("ldo10", "ldo%s10", &pmic5_pldo_lv, "vdd-l10"),
|
||||
RPMH_VREG("ldo11", "ldo%s11", &pmic5_nldo, "vdd-l11"),
|
||||
RPMH_VREG("ldo12", "ldo%s12", &pmic5_nldo, "vdd-l12"),
|
||||
{}
|
||||
};
|
||||
|
||||
static const struct rpmh_vreg_init_data pm660_vreg_data[] = {
|
||||
RPMH_VREG("smps1", "smp%s1", &pmic4_ftsmps426, "vdd-s1"),
|
||||
RPMH_VREG("smps2", "smp%s2", &pmic4_ftsmps426, "vdd-s2"),
|
||||
@@ -1663,10 +1713,18 @@ static const struct of_device_id __maybe_unused rpmh_regulator_match_table[] = {
|
||||
.compatible = "qcom,pm7325-rpmh-regulators",
|
||||
.data = pm7325_vreg_data,
|
||||
},
|
||||
{
|
||||
.compatible = "qcom,pm7550-rpmh-regulators",
|
||||
.data = pm7550_vreg_data,
|
||||
},
|
||||
{
|
||||
.compatible = "qcom,pmr735a-rpmh-regulators",
|
||||
.data = pmr735a_vreg_data,
|
||||
},
|
||||
{
|
||||
.compatible = "qcom,pmr735b-rpmh-regulators",
|
||||
.data = pmr735b_vreg_data,
|
||||
},
|
||||
{
|
||||
.compatible = "qcom,pm660-rpmh-regulators",
|
||||
.data = pm660_vreg_data,
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2022 Raspberry Pi Ltd.
|
||||
* Copyright (C) 2025 Marek Vasut
|
||||
*/
|
||||
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/gpio/regmap.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pwm.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
/* I2C registers of the microcontroller. */
|
||||
#define REG_ID 0x01
|
||||
#define REG_POWERON 0x02
|
||||
#define REG_PWM 0x03
|
||||
|
||||
/* Bits for poweron register */
|
||||
#define LCD_RESET_BIT BIT(0)
|
||||
#define CTP_RESET_BIT BIT(1)
|
||||
|
||||
/* Bits for the PWM register */
|
||||
#define PWM_BL_ENABLE BIT(7)
|
||||
#define PWM_BL_MASK GENMASK(4, 0)
|
||||
|
||||
/* Treat LCD_RESET and CTP_RESET as GPIOs */
|
||||
#define NUM_GPIO 2
|
||||
|
||||
static const struct regmap_config rpi_panel_regmap_config = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.max_register = REG_PWM,
|
||||
.can_sleep = true,
|
||||
};
|
||||
|
||||
static int rpi_panel_v2_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||
const struct pwm_state *state)
|
||||
{
|
||||
struct regmap *regmap = pwmchip_get_drvdata(chip);
|
||||
unsigned int duty;
|
||||
|
||||
if (state->polarity != PWM_POLARITY_NORMAL)
|
||||
return -EINVAL;
|
||||
|
||||
if (!state->enabled)
|
||||
return regmap_write(regmap, REG_PWM, 0);
|
||||
|
||||
duty = pwm_get_relative_duty_cycle(state, PWM_BL_MASK);
|
||||
return regmap_write(regmap, REG_PWM, duty | PWM_BL_ENABLE);
|
||||
}
|
||||
|
||||
static const struct pwm_ops rpi_panel_v2_pwm_ops = {
|
||||
.apply = rpi_panel_v2_pwm_apply,
|
||||
};
|
||||
|
||||
/*
|
||||
* I2C driver interface functions
|
||||
*/
|
||||
static int rpi_panel_v2_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
struct gpio_regmap_config gconfig = {
|
||||
.ngpio = NUM_GPIO,
|
||||
.ngpio_per_reg = NUM_GPIO,
|
||||
.parent = &i2c->dev,
|
||||
.reg_set_base = REG_POWERON,
|
||||
};
|
||||
struct regmap *regmap;
|
||||
struct pwm_chip *pc;
|
||||
int ret;
|
||||
|
||||
pc = devm_pwmchip_alloc(&i2c->dev, 1, 0);
|
||||
if (IS_ERR(pc))
|
||||
return PTR_ERR(pc);
|
||||
|
||||
pc->ops = &rpi_panel_v2_pwm_ops;
|
||||
|
||||
regmap = devm_regmap_init_i2c(i2c, &rpi_panel_regmap_config);
|
||||
if (IS_ERR(regmap))
|
||||
return dev_err_probe(&i2c->dev, PTR_ERR(regmap), "Failed to allocate regmap\n");
|
||||
|
||||
pwmchip_set_drvdata(pc, regmap);
|
||||
|
||||
regmap_write(regmap, REG_POWERON, 0);
|
||||
|
||||
gconfig.regmap = regmap;
|
||||
ret = PTR_ERR_OR_ZERO(devm_gpio_regmap_register(&i2c->dev, &gconfig));
|
||||
if (ret)
|
||||
return dev_err_probe(&i2c->dev, ret, "Failed to create gpiochip\n");
|
||||
|
||||
i2c_set_clientdata(i2c, regmap);
|
||||
|
||||
return devm_pwmchip_add(&i2c->dev, pc);
|
||||
}
|
||||
|
||||
static void rpi_panel_v2_i2c_shutdown(struct i2c_client *client)
|
||||
{
|
||||
struct regmap *regmap = i2c_get_clientdata(client);
|
||||
|
||||
regmap_write(regmap, REG_PWM, 0);
|
||||
regmap_write(regmap, REG_POWERON, 0);
|
||||
}
|
||||
|
||||
static const struct of_device_id rpi_panel_v2_dt_ids[] = {
|
||||
{ .compatible = "raspberrypi,touchscreen-panel-regulator-v2" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, rpi_panel_v2_dt_ids);
|
||||
|
||||
static struct i2c_driver rpi_panel_v2_regulator_driver = {
|
||||
.driver = {
|
||||
.name = "rpi_touchscreen_v2",
|
||||
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
|
||||
.of_match_table = rpi_panel_v2_dt_ids,
|
||||
},
|
||||
.probe = rpi_panel_v2_i2c_probe,
|
||||
.shutdown = rpi_panel_v2_i2c_shutdown,
|
||||
};
|
||||
|
||||
module_i2c_driver(rpi_panel_v2_regulator_driver);
|
||||
|
||||
MODULE_AUTHOR("Dave Stevenson <dave.stevenson@raspberrypi.com>");
|
||||
MODULE_DESCRIPTION("Regulator device driver for Raspberry Pi 7-inch V2 touchscreen");
|
||||
MODULE_LICENSE("GPL");
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user