mfd: bcm590xx: Add support for BCM59054
Subsystems (3)
v9 cover mfd: bcm590xx: Add support for BCM59054
Add support for the BCM59054 MFD to the bcm590xx driver and fix a couple of small bugs in it that also affected the already supported BCM59056.
While we're at it - convert the devicetree bindings to YAML format and drop the bcm59056 DTS in favor of describing the PMU in users' DTS files, as is done for most other MFDs.
The BCM59054 is fairly similar to the BCM59056, with the primary difference being the different number and layout of regulators. It is primarily used in devices using the BCM21664 and BCM23550 chipsets.
This patchset has been tested on a Samsung Galaxy Grand Neo (baffinlite rev02; DTS not in mainline yet) with a BCM59054 PMIC. Testing on a BCM59056 would be appreciated.
---
Changes in v9:
- Rebase on mfd/for-mfd-next again
- Drop "ARM: dts: Drop DTS for BCM59056 PMU" as it has been applied
- Address another style nitpick on "mfd: bcm590xx: Add PMU ID/revision parsing function"
- Pick up Reviewed-by tag from Stanislav
- Link to v8: https://lore.kernel.org/r/[email protected]
Changes in v8:
- Rebase on mfd/for-mfd-next
- Drop "mfd: bcm590xx: Drop unused "id" member of bcm590xx MFD struct" as it has been applied
- Address style nitpicks on "mfd: bcm590xx: Add PMU ID/revision parsing function"
- Link to v7: https://lore.kernel.org/r/[email protected]
Changes in v7:
- Return -ENODEV on PMU ID mismatch
- Drop "Check your DT compatible" from ID mismatch error message
- Pick up Reviewed-by trailers from Rob on DT bindings
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v6:
- Rename mfd/brcm,bcm590xx.yaml to mfd/brcm,bcm59056.yaml again
- Use PMU ID value as device type
- Rename rev_dig and rev_ana to rev_digital and rev_analog
- Link to v5: https://lore.kernel.org/r/[email protected]
Changes in v5:
- Make regulator binding descriptions reference mfd/brcm,bcm590xx.yaml instead of mfd/brcm,bcm59056.yaml
- Move regmap type enum to common MFD header
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Fix yamllint warnings in DT bindings
- Address miscelaneous review comments related to DT bindings
- Note that I did not end up moving the regulator refs from
allOf compatible matches; I explained my reasoning in [1].
[1] https://lore.kernel.org/lkml/[email protected]/
- Add PMU ID/revision parsing to MFD driver
- Fix instances of regulator data not matching vendor kernel for BCM59054
- Use different voltage table for BCM59054 VSR reg based on PMU revision
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Split out regulator DT bindings into separate YAML
- Use tables of regulator info instead of get_XXX_register, reg_is_XXX functions
- Drop "regulator: bcm590xx: Add proper handling for PMMODE registers"; it adds unnecessary noise to the series and will be submitted separately
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Fixed BCM59054 ID being passed to BCM59056 function in the
regulator driver
- Dropped linux-rpi-kernel from the CC list
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Artur Weber (8):
dt-bindings: mfd: brcm,bcm59056: Convert to YAML
dt-bindings: mfd: brcm,bcm59056: Add compatible for BCM59054
mfd: bcm590xx: Add support for multiple device types + BCM59054 compatible
mfd: bcm590xx: Add PMU ID/revision parsing function
regulator: bcm590xx: Use dev_err_probe for regulator register error
regulator: bcm590xx: Store regulator descriptions in table
regulator: bcm590xx: Rename BCM59056-specific data as such
regulator: bcm590xx: Add support for BCM59054 regulators.../devicetree/bindings/mfd/brcm,bcm59056.txt | 39 - .../devicetree/bindings/mfd/brcm,bcm59056.yaml | 76 ++ .../bindings/regulator/brcm,bcm59054.yaml | 56 + .../bindings/regulator/brcm,bcm59056.yaml | 51 + drivers/mfd/bcm590xx.c | 66 +- drivers/regulator/bcm590xx-regulator.c | 1289 ++++++++++++++++---- include/linux/mfd/bcm590xx.h | 27 + 7 files changed, 1325 insertions(+), 279 deletions(-)
---
base-commit: 6103b87af895954882de162cc652d02a6f65c074
change-id: 20240816-bcm59054-a880695e41e8
Best regards,
Signature · 1 line
Artur Weber <[email protected]>
PATCH v9 1/8 dt-bindings: mfd: brcm,bcm59056: Convert to YAML
Convert devicetree bindings for the Broadcom BCM59056 PMU MFD from TXT to YAML format. This patch does not change any functionality; the bindings remain the same.
The bindings have been split into two parts: the MFD binding and a separate binding for the regulator node, to simplify the addition of other models later (which have different regulators).
---
Changes in v6:
- Replace mfd/brcm,bcm590xx.yaml with mfd/brcm,bcm59056.yaml
Changes in v5:
- Replace mfd/brcm,bcm59056.yaml with mfd/brcm,bcm590xx.yaml in regulator binding description
Changes in v4:
- Made $ref use full schema path
- Cleaned up example
- Dropped regulator name list comment
- Changed description of regulator binding to mention BCM59056 explicitly
- Changed "Power Management IC" to "Power Management Unit" to match official Broadcom naming
- Renamed mfd/brcm,bcm59056.yaml to mfd/brcm,bcm590xx.yaml
Changes in v3:
- Moved regulator node to separate binding
- Removed quotes around compatibles/vbus property
- Style fixes for example
--- .../devicetree/bindings/mfd/brcm,bcm59056.txt | 39 ---------------- .../devicetree/bindings/mfd/brcm,bcm59056.yaml | 54 ++++++++++++++++++++++ .../bindings/regulator/brcm,bcm59056.yaml | 51 ++++++++++++++++++++ 3 files changed, 105 insertions(+), 39 deletions(-)
Documentation/devicetree/bindings/mfd/brcm,bcm59056.txt deleted +0 -39
@@ -1,39 +0,0 @@ -------------------------------- -BCM590xx Power Management Units -------------------------------- - -Required properties: -- compatible: "brcm,bcm59056" -- reg: I2C slave address -- interrupts: interrupt for the PMU. Generic interrupt client node bindings - are described in interrupt-controller/interrupts.txt - ------------------- -Voltage Regulators ------------------- - -Optional child nodes: -- regulators: container node for regulators following the generic - regulator binding in regulator/regulator.txt - - The valid regulator node names for BCM59056 are: - rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo, - mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo, - csr, iosr1, iosr2, msr, sdsr1, sdsr2, vsr, - gpldo1, gpldo2, gpldo3, gpldo4, gpldo5, gpldo6, - vbus - -Example: - pmu: bcm59056@8 { - compatible = "brcm,bcm59056"; - reg = <0x08>; - interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>; - regulators { - rfldo_reg: rfldo { - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3300000>; - }; - - ... - }; - };
Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml new file +54 -0
54 lines not on this page · raw message
Documentation/devicetree/bindings/regulator/brcm,bcm59056.yaml new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.49.0
PATCH v9 2/8 dt-bindings: mfd: brcm,bcm59056: Add compatible for BCM59054
In reply to Artur WeberThe BCM59054 MFD is fairly similar to the BCM59056, and will use the same driver. Add compatible and specify the allowed regulator nodes.
---
Changes in v6:
- Replace mfd/brcm,bcm590xx.yaml with mfd/brcm,bcm59056.yaml
Changes in v5:
- Replace mfd/brcm,bcm59056.yaml with mfd/brcm,bcm590xx.yaml in regulator bindings description
Changes in v4:
- Fix yamllint errors (missing unevaluatedProperties)
- Drop comment with regulator name list
- Use full schema paths for $reg
- Change description of regulator binding to mention BCM59054 explicitly
- Drop quotes around vbus reg name
- Change "Power Management IC" to "Power Management Unit" to match official Broadcom naming
Note that I did not end up moving the regulator refs from allOf compatible matches; I explained my reasoning in [1].
[1] https://lore.kernel.org/lkml/[email protected]/
Changes in v3:
- Split regulator node into separate file
- Removed quotes around compatible
--- .../devicetree/bindings/mfd/brcm,bcm59056.yaml | 26 +++++++++- .../bindings/regulator/brcm,bcm59054.yaml | 56 ++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml +24 -2
@@ -11,7 +11,9 @@ maintainers: properties: compatible: - const: brcm,bcm59056 + enum: + - brcm,bcm59054 + - brcm,bcm59056 reg: maxItems: 1
@@ -21,7 +23,6 @@ properties: regulators: type: object - $ref: /schemas/regulator/brcm,bcm59056.yaml# required: - compatible
@@ -30,6 +31,27 @@ required: additionalProperties: false +allOf: + - if: + properties: + compatible: + contains: + const: brcm,bcm59054 + then: + properties: + regulators: + $ref: /schemas/regulator/brcm,bcm59054.yaml# + + - if: + properties: + compatible: + contains: + const: brcm,bcm59056 + then: + properties: + regulators: + $ref: /schemas/regulator/brcm,bcm59056.yaml# + examples: - | #include <dt-bindings/interrupt-controller/arm-gic.h>
Documentation/devicetree/bindings/regulator/brcm,bcm59054.yaml new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.49.0
PATCH v9 3/8 mfd: bcm590xx: Add support for multiple device types + BCM59054 compatible
In reply to Artur WeberThe BCM59054 is another chip from the BCM590xx line of PMUs, commonly used on devices with the BCM21664/BCM23550 chipsets.
Prepare the BCM590xx driver for supporting other devices by adding the PMUID register values for supported chip types and store them in the MFD data struct as "pmu_id". (These will be checked against the actual PMUID register values in a later commit.)
Then, add a DT compatible for the BCM59054, and provide the PMU ID as OF match data.
---
Changes in v6:
- Move PMUID value to MFD header
- Use PMUID value as OF data/device type value
- Add bcm59054 to I2C ID table
Changes in v4:
- Rewrite commit message description
- Rename "device_type" member to "dev_type"
- Drop awkward line break to fit function call
- Add PMU ID/revision parsing function
Changes in v3:
- Fix compilation warning about device_type pointer cast type
- Name the device types enum and use it as the type in the MFD struct
--- drivers/mfd/bcm590xx.c | 12 +++++++++++- include/linux/mfd/bcm590xx.h | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/mfd/bcm590xx.c +11 -1
@@ -50,6 +50,8 @@ static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri) bcm590xx->dev = &i2c_pri->dev; bcm590xx->i2c_pri = i2c_pri; + bcm590xx->pmu_id = (uintptr_t )of_device_get_match_data (bcm590xx->dev); + bcm590xx->regmap_pri =devm_regmap_init_i2c (i2c_pri, &bcm590xx_regmap_config_pri);if (IS_ERR (bcm590xx->regmap_pri)) {
@@ -91,12 +93,20 @@ static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri) }static const struct of_device_id bcm590xx_of_match[] = { - { .compatible ="brcm,bcm59056" }, + { + .compatible ="brcm,bcm59054" , + .data = (void *)BCM590XX_PMUID_BCM59054 , + }, + { + .compatible ="brcm,bcm59056" , + .data = (void *)BCM590XX_PMUID_BCM59056 , + }, { } };MODULE_DEVICE_TABLE (of, bcm590xx_of_match);static const struct i2c_device_id bcm590xx_i2c_id[] = { + {"bcm59054" }, {"bcm59056" }, { } };
include/linux/mfd/bcm590xx.h +7 -0
@@ -13,6 +13,10 @@#include <linux/i2c.h> #include <linux/regmap.h> +/* PMU ID register values; also used as device type */ +#define BCM590XX_PMUID_BCM59054 0x54 +#define BCM590XX_PMUID_BCM59056 0x56 +/* max register address */ #define BCM590XX_MAX_REGISTER_PRI 0xe7#define BCM590XX_MAX_REGISTER_SEC 0xf0
@@ -23,6 +27,9 @@ struct bcm590xx {struct i2c_client *i2c_sec;struct regmap *regmap_pri;struct regmap *regmap_sec; + +/* PMU ID value; also used as device type */ + u8 pmu_id; };#endif /* __LINUX_MFD_BCM590XX_H */
Signature · 1 line
2.49.0
PATCH v9 4/8 mfd: bcm590xx: Add PMU ID/revision parsing function
In reply to Artur WeberThe BCM590xx PMUs have two I2C registers for reading the PMU ID and revision. The revision is useful for subdevice drivers, since different revisions may have slight differences in behavior (for example - BCM59054 has different regulator configurations for revision A0 and A1).
Check the PMU ID register and make sure it matches the DT compatible. Fetch the digital and analog revision from the PMUREV register so that it can be used in subdevice drivers.
Also add some known revision values to bcm590xx.h, for convenience when writing subdevice drivers.
---
Changes in v9:
- Put params to dev_dbg print on one line
Changes in v8:
- Change PMU ID print from dev_info to dev_dbg
- Unwrap some lines and let them go up to 100 chars
- Drop comment above bcm590xx_parse_version (keep the comments inside the function, they make it a bit more clear what's happening since it's doing two separate things)
Changes in v7:
- Return -ENODEV on PMU ID mismatch
- Drop "Check your DT compatible" from ID mismatch error message
Changes in v6:
- Adapt to PMUID being passed as device type value
- Rename rev_dig and rev_ana to rev_digital and rev_analog
- Rewrite commit message
Changes in v5:
- Add REG_ prefix to register offset constant names
Changes in v4:
- Added this commit
--- drivers/mfd/bcm590xx.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/bcm590xx.h | 14 ++++++++++++ 2 files changed, 68 insertions(+)
drivers/mfd/bcm590xx.c +54 -0
@@ -17,6 +17,15 @@#include <linux/regmap.h> #include <linux/slab.h> +/* Under primary I2C address: */ +#define BCM590XX_REG_PMUID 0x1e + +#define BCM590XX_REG_PMUREV 0x1f +#define BCM590XX_PMUREV_DIG_MASK 0xF +#define BCM590XX_PMUREV_DIG_SHIFT 0 +#define BCM590XX_PMUREV_ANA_MASK 0xF0 +#define BCM590XX_PMUREV_ANA_SHIFT 4 +static const struct mfd_cell bcm590xx_devs[] = { { .name ="bcm590xx-vregs" ,
@@ -37,6 +46,47 @@ static const struct regmap_config bcm590xx_regmap_config_sec = { .cache_type = REGCACHE_MAPLE, }; +/* Map PMU ID value to model name string */ +static const char *const bcm590xx_names[] = { + [BCM590XX_PMUID_BCM59054 ] ="BCM59054" , + [BCM590XX_PMUID_BCM59056 ] ="BCM59056" , +}; + +static int bcm590xx_parse_version (struct bcm590xx *bcm590xx) +{ +unsigned int id, rev; +int ret; + +/* Get PMU ID and verify that it matches compatible */ + ret =regmap_read (bcm590xx->regmap_pri,BCM590XX_REG_PMUID , &id); +if (ret) { +dev_err (bcm590xx->dev,"failed to read PMU ID: %d\n" , ret); +return ret; + } + +if (id != bcm590xx->pmu_id) { +dev_err (bcm590xx->dev,"Incorrect ID for %s: expected %x, got %x.\n" , + bcm590xx_names[bcm590xx->pmu_id], bcm590xx->pmu_id, id); +return -ENODEV ; + } + +/* Get PMU revision and store it in the info struct */ + ret =regmap_read (bcm590xx->regmap_pri,BCM590XX_REG_PMUREV , &rev); +if (ret) { +dev_err (bcm590xx->dev,"failed to read PMU revision: %d\n" , ret); +return ret; + } + + bcm590xx->rev_digital = (rev &BCM590XX_PMUREV_DIG_MASK ) >>BCM590XX_PMUREV_DIG_SHIFT ; + + bcm590xx->rev_analog = (rev &BCM590XX_PMUREV_ANA_MASK ) >>BCM590XX_PMUREV_ANA_SHIFT ; + +dev_dbg (bcm590xx->dev,"PMU ID 0x%x (%s), revision: digital %d, analog %d" , + id, bcm590xx_names[id], bcm590xx->rev_digital, bcm590xx->rev_analog); + +return 0 ; +} +static int bcm590xx_i2c_probe (struct i2c_client *i2c_pri) {struct bcm590xx *bcm590xx;
@@ -78,6 +128,10 @@ static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri) goto err; } + ret =bcm590xx_parse_version (bcm590xx); +if (ret) + goto err; + ret =devm_mfd_add_devices (&i2c_pri->dev,-1 , bcm590xx_devs,ARRAY_SIZE (bcm590xx_devs),NULL ,0 ,NULL );if (ret <0 ) {
include/linux/mfd/bcm590xx.h +14 -0
@@ -17,6 +17,16 @@#define BCM590XX_PMUID_BCM59054 0x54#define BCM590XX_PMUID_BCM59056 0x56 +/* Known chip revision IDs */ +#define BCM59054_REV_DIGITAL_A1 1 +#define BCM59054_REV_ANALOG_A1 2 + +#define BCM59056_REV_DIGITAL_A0 1 +#define BCM59056_REV_ANALOG_A0 1 + +#define BCM59056_REV_DIGITAL_B0 2 +#define BCM59056_REV_ANALOG_B0 2 +/* max register address */ #define BCM590XX_MAX_REGISTER_PRI 0xe7#define BCM590XX_MAX_REGISTER_SEC 0xf0
@@ -30,6 +40,10 @@ struct bcm590xx {/* PMU ID value; also used as device type */ u8 pmu_id; + +/* Chip revision, read from PMUREV reg */ +u8 rev_digital; + u8 rev_analog; };#endif /* __LINUX_MFD_BCM590XX_H */
Signature · 1 line
2.49.0
PATCH v9 5/8 regulator: bcm590xx: Use dev_err_probe for regulator register error
In reply to Artur WeberInstead of calling dev_err() and returning PTR_ERR(...) separately, use a single "return dev_err_probe" statement.
---
Changes in v4:
- Added this commit
--- drivers/regulator/bcm590xx-regulator.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/regulator/bcm590xx-regulator.c +4 -6
@@ -340,12 +340,10 @@ static int bcm590xx_probe(struct platform_device *pdev) rdev =devm_regulator_register (&pdev->dev, &pmu->desc[i], &config); -if (IS_ERR (rdev)) { -dev_err (bcm590xx->dev, -"failed to register %s regulator\n" , - pdev->name); -return PTR_ERR (rdev); - } +if (IS_ERR (rdev)) +return dev_err_probe (bcm590xx->dev,PTR_ERR (rdev), +"failed to register %s regulator\n" , + pdev->name); }return 0 ;
Signature · 1 line
2.49.0
PATCH v9 6/8 regulator: bcm590xx: Store regulator descriptions in table
In reply to Artur WeberInstead of filling in the regulator description programatically, store the data in a struct. This will make it a bit nicer to introduce support for other BCM590xx chips besides the BCM59056.
To do this, add a new struct type, bcm590xx_reg_data, to store all of the necessary information. Drop the old IS_LDO, IS_GPLDO... macros in favor of the "type" field in this struct. Adapt the old bcm590xx_reg struct to the new types.
---
Changes in v6:
- Adapt to changes in MFD header
Changes in v5:
- Move the bcm590xx_regmap_type enum to the bcm590xx.h header
- Rename bcm590xx_reg_info to bcm590xx_reg_data
Changes in v4:
- Replace incorrect return in regmap selection error handling
- Use switch statement for regmap selection
Changes in v3:
- Added this commit
--- drivers/regulator/bcm590xx-regulator.c | 473 ++++++++++++++++++++++----------- include/linux/mfd/bcm590xx.h | 6 + 2 files changed, 322 insertions(+), 157 deletions(-)
drivers/regulator/bcm590xx-regulator.c +316 -157
@@ -20,6 +20,18 @@/* I2C slave 0 registers */ #define BCM590XX_RFLDOPMCTRL1 0x60 +#define BCM590XX_CAMLDO1PMCTRL1 0x62 +#define BCM590XX_CAMLDO2PMCTRL1 0x64 +#define BCM590XX_SIMLDO1PMCTRL1 0x66 +#define BCM590XX_SIMLDO2PMCTRL1 0x68 +#define BCM590XX_SDLDOPMCTRL1 0x6a +#define BCM590XX_SDXLDOPMCTRL1 0x6c +#define BCM590XX_MMCLDO1PMCTRL1 0x6e +#define BCM590XX_MMCLDO2PMCTRL1 0x70 +#define BCM590XX_AUDLDOPMCTRL1 0x72 +#define BCM590XX_MICLDOPMCTRL1 0x74 +#define BCM590XX_USBLDOPMCTRL1 0x76 +#define BCM590XX_VIBLDOPMCTRL1 0x78#define BCM590XX_IOSR1PMCTRL1 0x7a#define BCM590XX_IOSR2PMCTRL1 0x7c#define BCM590XX_CSRPMCTRL1 0x7e
@@ -28,7 +40,25 @@#define BCM590XX_MSRPMCTRL1 0x8a#define BCM590XX_VSRPMCTRL1 0x8e#define BCM590XX_RFLDOCTRL 0x96 +#define BCM590XX_CAMLDO1CTRL 0x97 +#define BCM590XX_CAMLDO2CTRL 0x98 +#define BCM590XX_SIMLDO1CTRL 0x99 +#define BCM590XX_SIMLDO2CTRL 0x9a +#define BCM590XX_SDLDOCTRL 0x9b +#define BCM590XX_SDXLDOCTRL 0x9c +#define BCM590XX_MMCLDO1CTRL 0x9d +#define BCM590XX_MMCLDO2CTRL 0x9e +#define BCM590XX_AUDLDOCTRL 0x9f +#define BCM590XX_MICLDOCTRL 0xa0 +#define BCM590XX_USBLDOCTRL 0xa1 +#define BCM590XX_VIBLDOCTRL 0xa2#define BCM590XX_CSRVOUT1 0xc0 +#define BCM590XX_IOSR1VOUT1 0xc3 +#define BCM590XX_IOSR2VOUT1 0xc6 +#define BCM590XX_MSRVOUT1 0xc9 +#define BCM590XX_SDSR1VOUT1 0xcc +#define BCM590XX_SDSR2VOUT1 0xcf +#define BCM590XX_VSRVOUT1 0xd2/* I2C slave 1 registers */ #define BCM590XX_GPLDO5PMCTRL1 0x16
@@ -94,11 +124,6 @@#define BCM590XX_NUM_REGS 27 -#define BCM590XX_REG_IS_LDO (n) (n < BCM590XX_REG_CSR) -#define BCM590XX_REG_IS_GPLDO (n) \ - ((n > BCM590XX_REG_VSR) && (n < BCM590XX_REG_VBUS)) -#define BCM590XX_REG_IS_VBUS (n) (n == BCM590XX_REG_VBUS) -/* LDO group A: supported voltages in microvolts */ static const unsigned int ldo_a_table[] = {1200000 ,1800000 ,2500000 ,2700000 ,2800000 ,
@@ -111,10 +136,6 @@ static const unsigned int ldo_c_table[] = { 2900000, 3000000, 3300000, }; -static const unsigned int ldo_vbus[] = { -5000000 , -}; -/* DCDC group CSR: supported voltages in microvolts */ static const struct linear_range dcdc_csr_ranges[] = {REGULATOR_LINEAR_RANGE (860000 ,2 ,50 ,10000 ),
@@ -137,115 +158,25 @@ static const struct linear_range dcdc_sdsr1_ranges[] = { REGULATOR_LINEAR_RANGE(900000, 52, 63, 0), }; -struct bcm590xx_info { -const char *name; -const char *vin_name; -u8 n_voltages; -const unsigned int *volt_table; -u8 n_linear_ranges; -const struct linear_range *linear_ranges; +enum bcm590xx_reg_type { +BCM590XX_REG_TYPE_LDO , +BCM590XX_REG_TYPE_GPLDO , +BCM590XX_REG_TYPE_SR , +BCM590XX_REG_TYPE_VBUS }; -#define BCM590XX_REG_TABLE (_name, _table) \ - { \ - .name = #_name, \ - .n_voltages = ARRAY_SIZE(_table), \ - .volt_table = _table, \ - } - -#define BCM590XX_REG_RANGES (_name, _ranges) \ - { \ - .name = #_name, \ - .n_voltages = 64, \ - .n_linear_ranges = ARRAY_SIZE(_ranges), \ - .linear_ranges = _ranges, \ - } - -static struct bcm590xx_info bcm590xx_regs[] = { -BCM590XX_REG_TABLE (rfldo, ldo_a_table), -BCM590XX_REG_TABLE (camldo1, ldo_c_table), -BCM590XX_REG_TABLE (camldo2, ldo_c_table), -BCM590XX_REG_TABLE (simldo1, ldo_a_table), -BCM590XX_REG_TABLE (simldo2, ldo_a_table), -BCM590XX_REG_TABLE (sdldo, ldo_c_table), -BCM590XX_REG_TABLE (sdxldo, ldo_a_table), -BCM590XX_REG_TABLE (mmcldo1, ldo_a_table), -BCM590XX_REG_TABLE (mmcldo2, ldo_a_table), -BCM590XX_REG_TABLE (audldo, ldo_a_table), -BCM590XX_REG_TABLE (micldo, ldo_a_table), -BCM590XX_REG_TABLE (usbldo, ldo_a_table), -BCM590XX_REG_TABLE (vibldo, ldo_c_table), -BCM590XX_REG_RANGES (csr, dcdc_csr_ranges), -BCM590XX_REG_RANGES (iosr1, dcdc_iosr1_ranges), -BCM590XX_REG_RANGES (iosr2, dcdc_iosr1_ranges), -BCM590XX_REG_RANGES (msr, dcdc_iosr1_ranges), -BCM590XX_REG_RANGES (sdsr1, dcdc_sdsr1_ranges), -BCM590XX_REG_RANGES (sdsr2, dcdc_iosr1_ranges), -BCM590XX_REG_RANGES (vsr, dcdc_iosr1_ranges), -BCM590XX_REG_TABLE (gpldo1, ldo_a_table), -BCM590XX_REG_TABLE (gpldo2, ldo_a_table), -BCM590XX_REG_TABLE (gpldo3, ldo_a_table), -BCM590XX_REG_TABLE (gpldo4, ldo_a_table), -BCM590XX_REG_TABLE (gpldo5, ldo_a_table), -BCM590XX_REG_TABLE (gpldo6, ldo_a_table), -BCM590XX_REG_TABLE (vbus, ldo_vbus), +struct bcm590xx_reg_data { +enum bcm590xx_reg_type type; +enum bcm590xx_regmap_type regmap; +const struct regulator_desc desc; };struct bcm590xx_reg { -struct regulator_desc *desc;struct bcm590xx *mfd; +unsigned int n_regulators; +const struct bcm590xx_reg_data *regs; }; -static int bcm590xx_get_vsel_register (int id) -{ -if (BCM590XX_REG_IS_LDO (id)) -return BCM590XX_RFLDOCTRL + id; -else if (BCM590XX_REG_IS_GPLDO (id)) -return BCM590XX_GPLDO1CTRL + id; -else -return BCM590XX_CSRVOUT1 + (id -BCM590XX_REG_CSR ) *3 ; -} - -static int bcm590xx_get_enable_register (int id) -{ -int reg =0 ; - -if (BCM590XX_REG_IS_LDO (id)) - reg =BCM590XX_RFLDOPMCTRL1 + id *2 ; -else if (BCM590XX_REG_IS_GPLDO (id)) - reg =BCM590XX_GPLDO1PMCTRL1 + id *2 ; -else -switch (id) { -case BCM590XX_REG_CSR : - reg =BCM590XX_CSRPMCTRL1 ; -break ; -case BCM590XX_REG_IOSR1 : - reg =BCM590XX_IOSR1PMCTRL1 ; -break ; -case BCM590XX_REG_IOSR2 : - reg =BCM590XX_IOSR2PMCTRL1 ; -break ; -case BCM590XX_REG_MSR : - reg =BCM590XX_MSRPMCTRL1 ; -break ; -case BCM590XX_REG_SDSR1 : - reg =BCM590XX_SDSR1PMCTRL1 ; -break ; -case BCM590XX_REG_SDSR2 : - reg =BCM590XX_SDSR2PMCTRL1 ; -break ; -case BCM590XX_REG_VSR : - reg =BCM590XX_VSRPMCTRL1 ; -break ; -case BCM590XX_REG_VBUS : - reg =BCM590XX_OTG_CTRL ; -break ; - } - - -return reg; -} -static const struct regulator_ops bcm590xx_ops_ldo = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap,
@@ -272,73 +203,301 @@ static const struct regulator_ops bcm590xx_ops_vbus = { .disable = regulator_disable_regmap, }; +#define BCM590XX_REG_DESC (_name, _name_lower) \ + .id = BCM590XX_REG_##_name, \ + .name = #_name_lower, \ + .of_match = of_match_ptr(#_name_lower), \ + .regulators_node = of_match_ptr("regulators"), \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE \ + +#define BCM590XX_LDO_DESC (_name, _name_lower, _table) \ + BCM590XX_REG_DESC(_name, _name_lower), \ + .ops = &bcm590xx_ops_ldo, \ + .n_voltages = ARRAY_SIZE(_table), \ + .volt_table = _table, \ + .vsel_reg = BCM590XX_##_name##CTRL, \ + .vsel_mask = BCM590XX_LDO_VSEL_MASK, \ + .enable_reg = BCM590XX_##_name##PMCTRL1, \ + .enable_mask = BCM590XX_REG_ENABLE, \ + .enable_is_inverted = true + +#define BCM590XX_SR_DESC (_name, _name_lower, _ranges) \ + BCM590XX_REG_DESC(_name, _name_lower), \ + .ops = &bcm590xx_ops_dcdc, \ + .n_voltages = 64, \ + .linear_ranges = _ranges, \ + .n_linear_ranges = ARRAY_SIZE(_ranges), \ + .vsel_reg = BCM590XX_##_name##VOUT1, \ + .vsel_mask = BCM590XX_SR_VSEL_MASK, \ + .enable_reg = BCM590XX_##_name##PMCTRL1, \ + .enable_mask = BCM590XX_REG_ENABLE, \ + .enable_is_inverted = true + +static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS ] = { + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (RFLDO , rfldo, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (CAMLDO1 , camldo1, ldo_c_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (CAMLDO2 , camldo2, ldo_c_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (SIMLDO1 , simldo1, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (SIMLDO2 , simldo2, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (SDLDO , sdldo, ldo_c_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (SDXLDO , sdxldo, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (MMCLDO1 , mmcldo1, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (MMCLDO2 , mmcldo2, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (AUDLDO , audldo, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (MICLDO , micldo, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (USBLDO , usbldo, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_LDO_DESC (VIBLDO , vibldo, ldo_c_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_SR_DESC (CSR , csr, dcdc_csr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_SR_DESC (IOSR1 , iosr1, dcdc_iosr1_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_SR_DESC (IOSR2 , iosr2, dcdc_iosr1_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_SR_DESC (MSR , msr, dcdc_iosr1_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_SR_DESC (SDSR1 , sdsr1, dcdc_sdsr1_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_SR_DESC (SDSR2 , sdsr2, dcdc_iosr1_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM590XX_SR_DESC (VSR , vsr, dcdc_iosr1_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM590XX_LDO_DESC (GPLDO1 , gpldo1, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM590XX_LDO_DESC (GPLDO2 , gpldo2, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM590XX_LDO_DESC (GPLDO3 , gpldo3, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM590XX_LDO_DESC (GPLDO4 , gpldo4, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM590XX_LDO_DESC (GPLDO5 , gpldo5, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM590XX_LDO_DESC (GPLDO6 , gpldo6, ldo_a_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_VBUS , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM590XX_REG_DESC (VBUS , vbus), + .ops = &bcm590xx_ops_vbus, + .n_voltages =1 , + .fixed_uV =5000000 , + .enable_reg =BCM590XX_OTG_CTRL , + .enable_mask =BCM590XX_VBUS_ENABLE , + }, + }, +}; +static int bcm590xx_probe (struct platform_device *pdev) {struct bcm590xx *bcm590xx =dev_get_drvdata (pdev->dev.parent);struct bcm590xx_reg *pmu; +const struct bcm590xx_reg_data *info;struct regulator_config config = { }; -struct bcm590xx_info *info;struct regulator_dev *rdev; -int i; +unsigned int i; pmu =devm_kzalloc (&pdev->dev,sizeof (*pmu),GFP_KERNEL );if (!pmu)return -ENOMEM ; pmu->mfd = bcm590xx; + pmu->n_regulators =BCM590XX_NUM_REGS ; + pmu->regs = bcm590xx_regs;platform_set_drvdata (pdev, pmu); - pmu->desc =devm_kcalloc (&pdev->dev, -BCM590XX_NUM_REGS , -sizeof (struct regulator_desc ), -GFP_KERNEL ); -if (!pmu->desc) -return -ENOMEM ; - - info = bcm590xx_regs; - -for (i =0 ; i <BCM590XX_NUM_REGS ; i++, info++) { -/* Register the regulators */ - pmu->desc[i].name = info->name; - pmu->desc[i].of_match =of_match_ptr (info->name); - pmu->desc[i].regulators_node =of_match_ptr ("regulators" ); - pmu->desc[i].supply_name = info->vin_name; - pmu->desc[i].id = i; - pmu->desc[i].volt_table = info->volt_table; - pmu->desc[i].n_voltages = info->n_voltages; - pmu->desc[i].linear_ranges = info->linear_ranges; - pmu->desc[i].n_linear_ranges = info->n_linear_ranges; - -if ((BCM590XX_REG_IS_LDO (i)) || (BCM590XX_REG_IS_GPLDO (i))) { - pmu->desc[i].ops = &bcm590xx_ops_ldo; - pmu->desc[i].vsel_mask =BCM590XX_LDO_VSEL_MASK ; - }else if (BCM590XX_REG_IS_VBUS (i)) - pmu->desc[i].ops = &bcm590xx_ops_vbus; -else { - pmu->desc[i].ops = &bcm590xx_ops_dcdc; - pmu->desc[i].vsel_mask =BCM590XX_SR_VSEL_MASK ; - } - -if (BCM590XX_REG_IS_VBUS (i)) - pmu->desc[i].enable_mask =BCM590XX_VBUS_ENABLE ; -else { - pmu->desc[i].vsel_reg =bcm590xx_get_vsel_register (i); - pmu->desc[i].enable_is_inverted = true; - pmu->desc[i].enable_mask =BCM590XX_REG_ENABLE ; - } - pmu->desc[i].enable_reg =bcm590xx_get_enable_register (i); - pmu->desc[i].type =REGULATOR_VOLTAGE ; - pmu->desc[i].owner =THIS_MODULE ; +/* Register the regulators */ +for (i =0 ; i < pmu->n_regulators; i++) { + info = &pmu->regs[i]; config.dev = bcm590xx->dev; config.driver_data = pmu; -if (BCM590XX_REG_IS_GPLDO (i) ||BCM590XX_REG_IS_VBUS (i)) - config.regmap = bcm590xx->regmap_sec; -else + +switch (info->regmap) { +case BCM590XX_REGMAP_PRI : config.regmap = bcm590xx->regmap_pri; +break ; +case BCM590XX_REGMAP_SEC : + config.regmap = bcm590xx->regmap_sec; +break ; +default : +dev_err (bcm590xx->dev, +"invalid regmap for %s regulator; this is a driver bug\n" , + pdev->name); +return -EINVAL ; + } - rdev =devm_regulator_register (&pdev->dev, &pmu->desc[i], + rdev =devm_regulator_register (&pdev->dev, &info->desc, &config);if (IS_ERR (rdev)) return dev_err_probe(bcm590xx->dev, PTR_ERR(rdev),
include/linux/mfd/bcm590xx.h +6 -0
@@ -27,6 +27,12 @@#define BCM59056_REV_DIGITAL_B0 2#define BCM59056_REV_ANALOG_B0 2 +/* regmap types */ +enum bcm590xx_regmap_type { +BCM590XX_REGMAP_PRI , +BCM590XX_REGMAP_SEC , +}; +/* max register address */ #define BCM590XX_MAX_REGISTER_PRI 0xe7#define BCM590XX_MAX_REGISTER_SEC 0xf0
Signature · 1 line
2.49.0
PATCH v9 7/8 regulator: bcm590xx: Rename BCM59056-specific data as such
In reply to Artur WeberPreviously, the driver used the BCM590XX prefix for register data specific to the BCM59056. As we will be introducing other regulators to this driver as well, make the BCM59056-specific values use the BCM59056 prefix.
---
Changes in v5:
- Adapt to rename of bcm590xx_reg_info to bcm590xx_reg_data
Changes in v4:
- Drop unused BCM590XX_MAX_NUM_REGS constant
Changes in v3:
- Added this commit
--- drivers/regulator/bcm590xx-regulator.c | 369 +++++++++++++++++---------------- 1 file changed, 189 insertions(+), 180 deletions(-)
drivers/regulator/bcm590xx-regulator.c +189 -180
@@ -18,146 +18,11 @@#include <linux/regulator/of_regulator.h> #include <linux/slab.h> -/* I2C slave 0 registers */ -#define BCM590XX_RFLDOPMCTRL1 0x60 -#define BCM590XX_CAMLDO1PMCTRL1 0x62 -#define BCM590XX_CAMLDO2PMCTRL1 0x64 -#define BCM590XX_SIMLDO1PMCTRL1 0x66 -#define BCM590XX_SIMLDO2PMCTRL1 0x68 -#define BCM590XX_SDLDOPMCTRL1 0x6a -#define BCM590XX_SDXLDOPMCTRL1 0x6c -#define BCM590XX_MMCLDO1PMCTRL1 0x6e -#define BCM590XX_MMCLDO2PMCTRL1 0x70 -#define BCM590XX_AUDLDOPMCTRL1 0x72 -#define BCM590XX_MICLDOPMCTRL1 0x74 -#define BCM590XX_USBLDOPMCTRL1 0x76 -#define BCM590XX_VIBLDOPMCTRL1 0x78 -#define BCM590XX_IOSR1PMCTRL1 0x7a -#define BCM590XX_IOSR2PMCTRL1 0x7c -#define BCM590XX_CSRPMCTRL1 0x7e -#define BCM590XX_SDSR1PMCTRL1 0x82 -#define BCM590XX_SDSR2PMCTRL1 0x86 -#define BCM590XX_MSRPMCTRL1 0x8a -#define BCM590XX_VSRPMCTRL1 0x8e -#define BCM590XX_RFLDOCTRL 0x96 -#define BCM590XX_CAMLDO1CTRL 0x97 -#define BCM590XX_CAMLDO2CTRL 0x98 -#define BCM590XX_SIMLDO1CTRL 0x99 -#define BCM590XX_SIMLDO2CTRL 0x9a -#define BCM590XX_SDLDOCTRL 0x9b -#define BCM590XX_SDXLDOCTRL 0x9c -#define BCM590XX_MMCLDO1CTRL 0x9d -#define BCM590XX_MMCLDO2CTRL 0x9e -#define BCM590XX_AUDLDOCTRL 0x9f -#define BCM590XX_MICLDOCTRL 0xa0 -#define BCM590XX_USBLDOCTRL 0xa1 -#define BCM590XX_VIBLDOCTRL 0xa2 -#define BCM590XX_CSRVOUT1 0xc0 -#define BCM590XX_IOSR1VOUT1 0xc3 -#define BCM590XX_IOSR2VOUT1 0xc6 -#define BCM590XX_MSRVOUT1 0xc9 -#define BCM590XX_SDSR1VOUT1 0xcc -#define BCM590XX_SDSR2VOUT1 0xcf -#define BCM590XX_VSRVOUT1 0xd2 - -/* I2C slave 1 registers */ -#define BCM590XX_GPLDO5PMCTRL1 0x16 -#define BCM590XX_GPLDO6PMCTRL1 0x18 -#define BCM590XX_GPLDO1CTRL 0x1a -#define BCM590XX_GPLDO2CTRL 0x1b -#define BCM590XX_GPLDO3CTRL 0x1c -#define BCM590XX_GPLDO4CTRL 0x1d -#define BCM590XX_GPLDO5CTRL 0x1e -#define BCM590XX_GPLDO6CTRL 0x1f -#define BCM590XX_OTG_CTRL 0x40 -#define BCM590XX_GPLDO1PMCTRL1 0x57 -#define BCM590XX_GPLDO2PMCTRL1 0x59 -#define BCM590XX_GPLDO3PMCTRL1 0x5b -#define BCM590XX_GPLDO4PMCTRL1 0x5d -#define BCM590XX_REG_ENABLE BIT(7)#define BCM590XX_VBUS_ENABLE BIT(2)#define BCM590XX_LDO_VSEL_MASK GENMASK(5, 3)#define BCM590XX_SR_VSEL_MASK GENMASK(5, 0) -/* -* RFLDO to VSR regulators are -* accessed via I2C slave 0 -*/ - -/* LDO regulator IDs */ -#define BCM590XX_REG_RFLDO 0 -#define BCM590XX_REG_CAMLDO1 1 -#define BCM590XX_REG_CAMLDO2 2 -#define BCM590XX_REG_SIMLDO1 3 -#define BCM590XX_REG_SIMLDO2 4 -#define BCM590XX_REG_SDLDO 5 -#define BCM590XX_REG_SDXLDO 6 -#define BCM590XX_REG_MMCLDO1 7 -#define BCM590XX_REG_MMCLDO2 8 -#define BCM590XX_REG_AUDLDO 9 -#define BCM590XX_REG_MICLDO 10 -#define BCM590XX_REG_USBLDO 11 -#define BCM590XX_REG_VIBLDO 12 - -/* DCDC regulator IDs */ -#define BCM590XX_REG_CSR 13 -#define BCM590XX_REG_IOSR1 14 -#define BCM590XX_REG_IOSR2 15 -#define BCM590XX_REG_MSR 16 -#define BCM590XX_REG_SDSR1 17 -#define BCM590XX_REG_SDSR2 18 -#define BCM590XX_REG_VSR 19 - -/* -* GPLDO1 to VBUS regulators are -* accessed via I2C slave 1 -*/ - -#define BCM590XX_REG_GPLDO1 20 -#define BCM590XX_REG_GPLDO2 21 -#define BCM590XX_REG_GPLDO3 22 -#define BCM590XX_REG_GPLDO4 23 -#define BCM590XX_REG_GPLDO5 24 -#define BCM590XX_REG_GPLDO6 25 -#define BCM590XX_REG_VBUS 26 - -#define BCM590XX_NUM_REGS 27 - -/* LDO group A: supported voltages in microvolts */ -static const unsigned int ldo_a_table[] = { -1200000 ,1800000 ,2500000 ,2700000 ,2800000 , -2900000 ,3000000 ,3300000 , -}; - -/* LDO group C: supported voltages in microvolts */ -static const unsigned int ldo_c_table[] = { -3100000 ,1800000 ,2500000 ,2700000 ,2800000 , -2900000 ,3000000 ,3300000 , -}; - -/* DCDC group CSR: supported voltages in microvolts */ -static const struct linear_range dcdc_csr_ranges[] = { -REGULATOR_LINEAR_RANGE (860000 ,2 ,50 ,10000 ), -REGULATOR_LINEAR_RANGE (1360000 ,51 ,55 ,20000 ), -REGULATOR_LINEAR_RANGE (900000 ,56 ,63 ,0 ), -}; - -/* DCDC group IOSR1: supported voltages in microvolts */ -static const struct linear_range dcdc_iosr1_ranges[] = { -REGULATOR_LINEAR_RANGE (860000 ,2 ,51 ,10000 ), -REGULATOR_LINEAR_RANGE (1500000 ,52 ,52 ,0 ), -REGULATOR_LINEAR_RANGE (1800000 ,53 ,53 ,0 ), -REGULATOR_LINEAR_RANGE (900000 ,54 ,63 ,0 ), -}; - -/* DCDC group SDSR1: supported voltages in microvolts */ -static const struct linear_range dcdc_sdsr1_ranges[] = { -REGULATOR_LINEAR_RANGE (860000 ,2 ,50 ,10000 ), -REGULATOR_LINEAR_RANGE (1340000 ,51 ,51 ,0 ), -REGULATOR_LINEAR_RANGE (900000 ,52 ,63 ,0 ), -}; -enum bcm590xx_reg_type {BCM590XX_REG_TYPE_LDO ,BCM590XX_REG_TYPE_GPLDO ,
@@ -203,43 +68,187 @@ static const struct regulator_ops bcm590xx_ops_vbus = { .disable = regulator_disable_regmap, }; -#define BCM590XX_REG_DESC (_name, _name_lower) \ - .id = BCM590XX_REG_##_name, \ +#define BCM590XX_REG_DESC (_model, _name, _name_lower) \ + .id = _model##_REG_##_name, \ .name = #_name_lower, \ .of_match = of_match_ptr(#_name_lower), \ .regulators_node = of_match_ptr("regulators"), \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE \ -#define BCM590XX_LDO_DESC (_name, _name_lower, _table) \ - BCM590XX_REG_DESC(_name, _name_lower), \ +#define BCM590XX_LDO_DESC (_model, _model_lower, _name, _name_lower, _table) \ + BCM590XX_REG_DESC(_model, _name, _name_lower), \ .ops = &bcm590xx_ops_ldo, \ - .n_voltages = ARRAY_SIZE(_table), \ - .volt_table = _table, \ - .vsel_reg = BCM590XX_##_name##CTRL, \ + .n_voltages = ARRAY_SIZE(_model_lower##_##_table), \ + .volt_table = _model_lower##_##_table, \ + .vsel_reg = _model##_##_name##CTRL, \ .vsel_mask = BCM590XX_LDO_VSEL_MASK, \ - .enable_reg = BCM590XX_##_name##PMCTRL1, \ + .enable_reg = _model##_##_name##PMCTRL1, \ .enable_mask = BCM590XX_REG_ENABLE, \ .enable_is_inverted = true -#define BCM590XX_SR_DESC (_name, _name_lower, _ranges) \ - BCM590XX_REG_DESC(_name, _name_lower), \ +#define BCM590XX_SR_DESC (_model, _model_lower, _name, _name_lower, _ranges) \ + BCM590XX_REG_DESC(_model, _name, _name_lower), \ .ops = &bcm590xx_ops_dcdc, \ .n_voltages = 64, \ - .linear_ranges = _ranges, \ - .n_linear_ranges = ARRAY_SIZE(_ranges), \ - .vsel_reg = BCM590XX_##_name##VOUT1, \ + .linear_ranges = _model_lower##_##_ranges, \ + .n_linear_ranges = ARRAY_SIZE(_model_lower##_##_ranges), \ + .vsel_reg = _model##_##_name##VOUT1, \ .vsel_mask = BCM590XX_SR_VSEL_MASK, \ - .enable_reg = BCM590XX_##_name##PMCTRL1, \ + .enable_reg = _model##_##_name##PMCTRL1, \ .enable_mask = BCM590XX_REG_ENABLE, \ .enable_is_inverted = true -static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS ] = { +#define BCM59056_REG_DESC (_name, _name_lower) \ + BCM590XX_REG_DESC(BCM59056, _name, _name_lower) +#define BCM59056_LDO_DESC (_name, _name_lower, _table) \ + BCM590XX_LDO_DESC(BCM59056, bcm59056, _name, _name_lower, _table) +#define BCM59056_SR_DESC (_name, _name_lower, _ranges) \ + BCM590XX_SR_DESC(BCM59056, bcm59056, _name, _name_lower, _ranges) + +/* BCM59056 data */ + +/* I2C slave 0 registers */ +#define BCM59056_RFLDOPMCTRL1 0x60 +#define BCM59056_CAMLDO1PMCTRL1 0x62 +#define BCM59056_CAMLDO2PMCTRL1 0x64 +#define BCM59056_SIMLDO1PMCTRL1 0x66 +#define BCM59056_SIMLDO2PMCTRL1 0x68 +#define BCM59056_SDLDOPMCTRL1 0x6a +#define BCM59056_SDXLDOPMCTRL1 0x6c +#define BCM59056_MMCLDO1PMCTRL1 0x6e +#define BCM59056_MMCLDO2PMCTRL1 0x70 +#define BCM59056_AUDLDOPMCTRL1 0x72 +#define BCM59056_MICLDOPMCTRL1 0x74 +#define BCM59056_USBLDOPMCTRL1 0x76 +#define BCM59056_VIBLDOPMCTRL1 0x78 +#define BCM59056_IOSR1PMCTRL1 0x7a +#define BCM59056_IOSR2PMCTRL1 0x7c +#define BCM59056_CSRPMCTRL1 0x7e +#define BCM59056_SDSR1PMCTRL1 0x82 +#define BCM59056_SDSR2PMCTRL1 0x86 +#define BCM59056_MSRPMCTRL1 0x8a +#define BCM59056_VSRPMCTRL1 0x8e +#define BCM59056_RFLDOCTRL 0x96 +#define BCM59056_CAMLDO1CTRL 0x97 +#define BCM59056_CAMLDO2CTRL 0x98 +#define BCM59056_SIMLDO1CTRL 0x99 +#define BCM59056_SIMLDO2CTRL 0x9a +#define BCM59056_SDLDOCTRL 0x9b +#define BCM59056_SDXLDOCTRL 0x9c +#define BCM59056_MMCLDO1CTRL 0x9d +#define BCM59056_MMCLDO2CTRL 0x9e +#define BCM59056_AUDLDOCTRL 0x9f +#define BCM59056_MICLDOCTRL 0xa0 +#define BCM59056_USBLDOCTRL 0xa1 +#define BCM59056_VIBLDOCTRL 0xa2 +#define BCM59056_CSRVOUT1 0xc0 +#define BCM59056_IOSR1VOUT1 0xc3 +#define BCM59056_IOSR2VOUT1 0xc6 +#define BCM59056_MSRVOUT1 0xc9 +#define BCM59056_SDSR1VOUT1 0xcc +#define BCM59056_SDSR2VOUT1 0xcf +#define BCM59056_VSRVOUT1 0xd2 + +/* I2C slave 1 registers */ +#define BCM59056_GPLDO5PMCTRL1 0x16 +#define BCM59056_GPLDO6PMCTRL1 0x18 +#define BCM59056_GPLDO1CTRL 0x1a +#define BCM59056_GPLDO2CTRL 0x1b +#define BCM59056_GPLDO3CTRL 0x1c +#define BCM59056_GPLDO4CTRL 0x1d +#define BCM59056_GPLDO5CTRL 0x1e +#define BCM59056_GPLDO6CTRL 0x1f +#define BCM59056_OTG_CTRL 0x40 +#define BCM59056_GPLDO1PMCTRL1 0x57 +#define BCM59056_GPLDO2PMCTRL1 0x59 +#define BCM59056_GPLDO3PMCTRL1 0x5b +#define BCM59056_GPLDO4PMCTRL1 0x5d + +/* +* RFLDO to VSR regulators are +* accessed via I2C slave 0 +*/ + +/* LDO regulator IDs */ +#define BCM59056_REG_RFLDO 0 +#define BCM59056_REG_CAMLDO1 1 +#define BCM59056_REG_CAMLDO2 2 +#define BCM59056_REG_SIMLDO1 3 +#define BCM59056_REG_SIMLDO2 4 +#define BCM59056_REG_SDLDO 5 +#define BCM59056_REG_SDXLDO 6 +#define BCM59056_REG_MMCLDO1 7 +#define BCM59056_REG_MMCLDO2 8 +#define BCM59056_REG_AUDLDO 9 +#define BCM59056_REG_MICLDO 10 +#define BCM59056_REG_USBLDO 11 +#define BCM59056_REG_VIBLDO 12 + +/* DCDC regulator IDs */ +#define BCM59056_REG_CSR 13 +#define BCM59056_REG_IOSR1 14 +#define BCM59056_REG_IOSR2 15 +#define BCM59056_REG_MSR 16 +#define BCM59056_REG_SDSR1 17 +#define BCM59056_REG_SDSR2 18 +#define BCM59056_REG_VSR 19 + +/* +* GPLDO1 to VBUS regulators are +* accessed via I2C slave 1 +*/ + +#define BCM59056_REG_GPLDO1 20 +#define BCM59056_REG_GPLDO2 21 +#define BCM59056_REG_GPLDO3 22 +#define BCM59056_REG_GPLDO4 23 +#define BCM59056_REG_GPLDO5 24 +#define BCM59056_REG_GPLDO6 25 +#define BCM59056_REG_VBUS 26 + +#define BCM59056_NUM_REGS 27 + +/* LDO group A: supported voltages in microvolts */ +static const unsigned int bcm59056_ldo_a_table[] = { +1200000 ,1800000 ,2500000 ,2700000 ,2800000 , +2900000 ,3000000 ,3300000 , +}; + +/* LDO group C: supported voltages in microvolts */ +static const unsigned int bcm59056_ldo_c_table[] = { +3100000 ,1800000 ,2500000 ,2700000 ,2800000 , +2900000 ,3000000 ,3300000 , +}; + +/* DCDC group CSR: supported voltages in microvolts */ +static const struct linear_range bcm59056_dcdc_csr_ranges[] = { +REGULATOR_LINEAR_RANGE (860000 ,2 ,50 ,10000 ), +REGULATOR_LINEAR_RANGE (1360000 ,51 ,55 ,20000 ), +REGULATOR_LINEAR_RANGE (900000 ,56 ,63 ,0 ), +}; + +/* DCDC group IOSR1: supported voltages in microvolts */ +static const struct linear_range bcm59056_dcdc_iosr1_ranges[] = { +REGULATOR_LINEAR_RANGE (860000 ,2 ,51 ,10000 ), +REGULATOR_LINEAR_RANGE (1500000 ,52 ,52 ,0 ), +REGULATOR_LINEAR_RANGE (1800000 ,53 ,53 ,0 ), +REGULATOR_LINEAR_RANGE (900000 ,54 ,63 ,0 ), +}; + +/* DCDC group SDSR1: supported voltages in microvolts */ +static const struct linear_range bcm59056_dcdc_sdsr1_ranges[] = { +REGULATOR_LINEAR_RANGE (860000 ,2 ,50 ,10000 ), +REGULATOR_LINEAR_RANGE (1340000 ,51 ,51 ,0 ), +REGULATOR_LINEAR_RANGE (900000 ,52 ,63 ,0 ), +}; + +static const struct bcm590xx_reg_data bcm59056_regs[BCM59056_NUM_REGS ] = { { .type =BCM590XX_REG_TYPE_LDO , .regmap =BCM590XX_REGMAP_PRI , .desc = { -BCM590XX_LDO_DESC (RFLDO , rfldo, ldo_a_table), +BCM59056_LDO_DESC (RFLDO , rfldo, ldo_a_table), }, },
@@ -247,7 +256,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(CAMLDO1, camldo1, ldo_c_table), + BCM59056_LDO_DESC(CAMLDO1, camldo1, ldo_c_table), }, },
@@ -255,7 +264,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(CAMLDO2, camldo2, ldo_c_table), + BCM59056_LDO_DESC(CAMLDO2, camldo2, ldo_c_table), }, },
@@ -263,7 +272,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(SIMLDO1, simldo1, ldo_a_table), + BCM59056_LDO_DESC(SIMLDO1, simldo1, ldo_a_table), }, },
@@ -271,7 +280,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(SIMLDO2, simldo2, ldo_a_table), + BCM59056_LDO_DESC(SIMLDO2, simldo2, ldo_a_table), }, },
@@ -279,7 +288,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(SDLDO, sdldo, ldo_c_table), + BCM59056_LDO_DESC(SDLDO, sdldo, ldo_c_table), }, },
@@ -287,7 +296,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(SDXLDO, sdxldo, ldo_a_table), + BCM59056_LDO_DESC(SDXLDO, sdxldo, ldo_a_table), }, },
@@ -295,7 +304,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(MMCLDO1, mmcldo1, ldo_a_table), + BCM59056_LDO_DESC(MMCLDO1, mmcldo1, ldo_a_table), }, },
@@ -303,7 +312,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(MMCLDO2, mmcldo2, ldo_a_table), + BCM59056_LDO_DESC(MMCLDO2, mmcldo2, ldo_a_table), }, },
@@ -311,7 +320,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(AUDLDO, audldo, ldo_a_table), + BCM59056_LDO_DESC(AUDLDO, audldo, ldo_a_table), }, },
@@ -319,7 +328,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(MICLDO, micldo, ldo_a_table), + BCM59056_LDO_DESC(MICLDO, micldo, ldo_a_table), }, },
@@ -327,7 +336,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(USBLDO, usbldo, ldo_a_table), + BCM59056_LDO_DESC(USBLDO, usbldo, ldo_a_table), }, },
@@ -335,7 +344,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_LDO, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_LDO_DESC(VIBLDO, vibldo, ldo_c_table), + BCM59056_LDO_DESC(VIBLDO, vibldo, ldo_c_table), }, },
@@ -343,7 +352,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_SR, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_SR_DESC(CSR, csr, dcdc_csr_ranges), + BCM59056_SR_DESC(CSR, csr, dcdc_csr_ranges), }, },
@@ -351,7 +360,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_SR, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_SR_DESC(IOSR1, iosr1, dcdc_iosr1_ranges), + BCM59056_SR_DESC(IOSR1, iosr1, dcdc_iosr1_ranges), }, },
@@ -359,7 +368,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_SR, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_SR_DESC(IOSR2, iosr2, dcdc_iosr1_ranges), + BCM59056_SR_DESC(IOSR2, iosr2, dcdc_iosr1_ranges), }, },
@@ -367,7 +376,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_SR, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_SR_DESC(MSR, msr, dcdc_iosr1_ranges), + BCM59056_SR_DESC(MSR, msr, dcdc_iosr1_ranges), }, },
@@ -375,7 +384,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_SR, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_SR_DESC(SDSR1, sdsr1, dcdc_sdsr1_ranges), + BCM59056_SR_DESC(SDSR1, sdsr1, dcdc_sdsr1_ranges), }, },
@@ -383,7 +392,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_SR, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_SR_DESC(SDSR2, sdsr2, dcdc_iosr1_ranges), + BCM59056_SR_DESC(SDSR2, sdsr2, dcdc_iosr1_ranges), }, },
@@ -391,7 +400,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_SR, .regmap = BCM590XX_REGMAP_PRI, .desc = { - BCM590XX_SR_DESC(VSR, vsr, dcdc_iosr1_ranges), + BCM59056_SR_DESC(VSR, vsr, dcdc_iosr1_ranges), }, },
@@ -399,7 +408,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_GPLDO, .regmap = BCM590XX_REGMAP_SEC, .desc = { - BCM590XX_LDO_DESC(GPLDO1, gpldo1, ldo_a_table), + BCM59056_LDO_DESC(GPLDO1, gpldo1, ldo_a_table), }, },
@@ -407,7 +416,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_GPLDO, .regmap = BCM590XX_REGMAP_SEC, .desc = { - BCM590XX_LDO_DESC(GPLDO2, gpldo2, ldo_a_table), + BCM59056_LDO_DESC(GPLDO2, gpldo2, ldo_a_table), }, },
@@ -415,7 +424,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_GPLDO, .regmap = BCM590XX_REGMAP_SEC, .desc = { - BCM590XX_LDO_DESC(GPLDO3, gpldo3, ldo_a_table), + BCM59056_LDO_DESC(GPLDO3, gpldo3, ldo_a_table), }, },
@@ -423,7 +432,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_GPLDO, .regmap = BCM590XX_REGMAP_SEC, .desc = { - BCM590XX_LDO_DESC(GPLDO4, gpldo4, ldo_a_table), + BCM59056_LDO_DESC(GPLDO4, gpldo4, ldo_a_table), }, },
@@ -431,7 +440,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_GPLDO, .regmap = BCM590XX_REGMAP_SEC, .desc = { - BCM590XX_LDO_DESC(GPLDO5, gpldo5, ldo_a_table), + BCM59056_LDO_DESC(GPLDO5, gpldo5, ldo_a_table), }, },
@@ -439,7 +448,7 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_GPLDO, .regmap = BCM590XX_REGMAP_SEC, .desc = { - BCM590XX_LDO_DESC(GPLDO6, gpldo6, ldo_a_table), + BCM59056_LDO_DESC(GPLDO6, gpldo6, ldo_a_table), }, },
@@ -447,11 +456,11 @@ static const struct bcm590xx_reg_data bcm590xx_regs[BCM590XX_NUM_REGS] = { .type = BCM590XX_REG_TYPE_VBUS, .regmap = BCM590XX_REGMAP_SEC, .desc = { - BCM590XX_REG_DESC(VBUS, vbus), + BCM59056_REG_DESC(VBUS, vbus), .ops = &bcm590xx_ops_vbus, .n_voltages = 1, .fixed_uV = 5000000, - .enable_reg = BCM590XX_OTG_CTRL, + .enable_reg = BCM59056_OTG_CTRL, .enable_mask = BCM590XX_VBUS_ENABLE, }, },
@@ -471,8 +480,8 @@ static int bcm590xx_probe(struct platform_device *pdev)return -ENOMEM ; pmu->mfd = bcm590xx; - pmu->n_regulators =BCM590XX_NUM_REGS ; - pmu->regs = bcm590xx_regs; + pmu->n_regulators =BCM59056_NUM_REGS ; + pmu->regs = bcm59056_regs;platform_set_drvdata (pdev, pmu);
Signature · 1 line
2.49.0
PATCH v9 8/8 regulator: bcm590xx: Add support for BCM59054 regulators
In reply to Artur WeberThe BCM59056 and BCM59054 are very similar in terms of regulators. Add the register definitions for the BCM59054 and enable support for it in the driver.
---
Changes in v6:
- dev_type -> pmu_id conversion, rev_ana -> rev_analog rename
Changes in v5:
- Adapt to regmap type enum being moved/value names being renamed
- Adapt to rename of bcm590xx_reg_info to bcm590xx_reg_data
Changes in v4:
- Lock MICLDO at 1.8v to match vendor kernel behavior
- Set different voltage table for VSR based on PMU revision
- Fix incorrect table being used for LVLDO1
- Add missing newline to "unknown device type" error message
Changes in v3:
- Adapt to regulator info being moved to tables
--- drivers/regulator/bcm590xx-regulator.c | 649 ++++++++++++++++++++++++++++++++- 1 file changed, 647 insertions(+), 2 deletions(-)
drivers/regulator/bcm590xx-regulator.c +647 -2
@@ -52,6 +52,17 @@ static const struct regulator_ops bcm590xx_ops_ldo = { .map_voltage = regulator_map_voltage_iterate, }; +/* +* LDO ops without voltage selection, used for MICLDO on BCM59054. +* (These are currently the same as VBUS ops, but will be different +* in the future once full PMMODE support is implemented.) +*/ +static const struct regulator_ops bcm590xx_ops_ldo_novolt = { + .is_enabled = regulator_is_enabled_regmap, + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, +}; +static const struct regulator_ops bcm590xx_ops_dcdc = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap,
@@ -106,6 +117,13 @@ static const struct regulator_ops bcm590xx_ops_vbus = {#define BCM59056_SR_DESC (_name, _name_lower, _ranges) \ BCM590XX_SR_DESC(BCM59056, bcm59056, _name, _name_lower, _ranges) +#define BCM59054_REG_DESC (_name, _name_lower) \ + BCM590XX_REG_DESC(BCM59054, _name, _name_lower) +#define BCM59054_LDO_DESC (_name, _name_lower, _table) \ + BCM590XX_LDO_DESC(BCM59054, bcm59054, _name, _name_lower, _table) +#define BCM59054_SR_DESC (_name, _name_lower, _ranges) \ + BCM590XX_SR_DESC(BCM59054, bcm59054, _name, _name_lower, _ranges) +/* BCM59056 data */ /* I2C slave 0 registers */
@@ -466,6 +484,617 @@ static const struct bcm590xx_reg_data bcm59056_regs[BCM59056_NUM_REGS] = { }, }; +/* BCM59054 data */ + +/* I2C slave 0 registers */ +#define BCM59054_RFLDOPMCTRL1 0x60 +#define BCM59054_CAMLDO1PMCTRL1 0x62 +#define BCM59054_CAMLDO2PMCTRL1 0x64 +#define BCM59054_SIMLDO1PMCTRL1 0x66 +#define BCM59054_SIMLDO2PMCTRL1 0x68 +#define BCM59054_SDLDOPMCTRL1 0x6a +#define BCM59054_SDXLDOPMCTRL1 0x6c +#define BCM59054_MMCLDO1PMCTRL1 0x6e +#define BCM59054_MMCLDO2PMCTRL1 0x70 +#define BCM59054_AUDLDOPMCTRL1 0x72 +#define BCM59054_MICLDOPMCTRL1 0x74 +#define BCM59054_USBLDOPMCTRL1 0x76 +#define BCM59054_VIBLDOPMCTRL1 0x78 +#define BCM59054_IOSR1PMCTRL1 0x7a +#define BCM59054_IOSR2PMCTRL1 0x7c +#define BCM59054_CSRPMCTRL1 0x7e +#define BCM59054_SDSR1PMCTRL1 0x82 +#define BCM59054_SDSR2PMCTRL1 0x86 +#define BCM59054_MMSRPMCTRL1 0x8a +#define BCM59054_VSRPMCTRL1 0x8e +#define BCM59054_RFLDOCTRL 0x96 +#define BCM59054_CAMLDO1CTRL 0x97 +#define BCM59054_CAMLDO2CTRL 0x98 +#define BCM59054_SIMLDO1CTRL 0x99 +#define BCM59054_SIMLDO2CTRL 0x9a +#define BCM59054_SDLDOCTRL 0x9b +#define BCM59054_SDXLDOCTRL 0x9c +#define BCM59054_MMCLDO1CTRL 0x9d +#define BCM59054_MMCLDO2CTRL 0x9e +#define BCM59054_AUDLDOCTRL 0x9f +#define BCM59054_MICLDOCTRL 0xa0 +#define BCM59054_USBLDOCTRL 0xa1 +#define BCM59054_VIBLDOCTRL 0xa2 +#define BCM59054_CSRVOUT1 0xc0 +#define BCM59054_IOSR1VOUT1 0xc3 +#define BCM59054_IOSR2VOUT1 0xc6 +#define BCM59054_MMSRVOUT1 0xc9 +#define BCM59054_SDSR1VOUT1 0xcc +#define BCM59054_SDSR2VOUT1 0xcf +#define BCM59054_VSRVOUT1 0xd2 + +/* I2C slave 1 registers */ +#define BCM59054_LVLDO1PMCTRL1 0x16 +#define BCM59054_LVLDO2PMCTRL1 0x18 +#define BCM59054_GPLDO1CTRL 0x1a +#define BCM59054_GPLDO2CTRL 0x1b +#define BCM59054_GPLDO3CTRL 0x1c +#define BCM59054_TCXLDOCTRL 0x1d +#define BCM59054_LVLDO1CTRL 0x1e +#define BCM59054_LVLDO2CTRL 0x1f +#define BCM59054_OTG_CTRL 0x40 +#define BCM59054_GPLDO1PMCTRL1 0x57 +#define BCM59054_GPLDO2PMCTRL1 0x59 +#define BCM59054_GPLDO3PMCTRL1 0x5b +#define BCM59054_TCXLDOPMCTRL1 0x5d + +/* +* RFLDO to VSR regulators are +* accessed via I2C slave 0 +*/ + +/* LDO regulator IDs */ +#define BCM59054_REG_RFLDO 0 +#define BCM59054_REG_CAMLDO1 1 +#define BCM59054_REG_CAMLDO2 2 +#define BCM59054_REG_SIMLDO1 3 +#define BCM59054_REG_SIMLDO2 4 +#define BCM59054_REG_SDLDO 5 +#define BCM59054_REG_SDXLDO 6 +#define BCM59054_REG_MMCLDO1 7 +#define BCM59054_REG_MMCLDO2 8 +#define BCM59054_REG_AUDLDO 9 +#define BCM59054_REG_MICLDO 10 +#define BCM59054_REG_USBLDO 11 +#define BCM59054_REG_VIBLDO 12 + +/* DCDC regulator IDs */ +#define BCM59054_REG_CSR 13 +#define BCM59054_REG_IOSR1 14 +#define BCM59054_REG_IOSR2 15 +#define BCM59054_REG_MMSR 16 +#define BCM59054_REG_SDSR1 17 +#define BCM59054_REG_SDSR2 18 +#define BCM59054_REG_VSR 19 + +/* +* GPLDO1 to VBUS regulators are +* accessed via I2C slave 1 +*/ + +#define BCM59054_REG_GPLDO1 20 +#define BCM59054_REG_GPLDO2 21 +#define BCM59054_REG_GPLDO3 22 +#define BCM59054_REG_TCXLDO 23 +#define BCM59054_REG_LVLDO1 24 +#define BCM59054_REG_LVLDO2 25 +#define BCM59054_REG_VBUS 26 + +#define BCM59054_NUM_REGS 27 + +/* LDO group 1: supported voltages in microvolts */ +static const unsigned int bcm59054_ldo_1_table[] = { +1200000 ,1800000 ,2500000 ,2700000 ,2800000 , +2900000 ,3000000 ,3300000 , +}; + +/* LDO group 2: supported voltages in microvolts */ +static const unsigned int bcm59054_ldo_2_table[] = { +3100000 ,1800000 ,2500000 ,2700000 ,2800000 , +2900000 ,3000000 ,3300000 , +}; + +/* LDO group 3: supported voltages in microvolts */ +static const unsigned int bcm59054_ldo_3_table[] = { +1000000 ,1107000 ,1143000 ,1214000 ,1250000 , +1464000 ,1500000 ,1786000 , +}; + +/* DCDC group SR: supported voltages in microvolts */ +static const struct linear_range bcm59054_dcdc_sr_ranges[] = { +REGULATOR_LINEAR_RANGE (0 ,0 ,1 ,0 ), +REGULATOR_LINEAR_RANGE (860000 ,2 ,60 ,10000 ), +REGULATOR_LINEAR_RANGE (1500000 ,61 ,61 ,0 ), +REGULATOR_LINEAR_RANGE (1800000 ,62 ,62 ,0 ), +REGULATOR_LINEAR_RANGE (900000 ,63 ,63 ,0 ), +}; + +/* DCDC group VSR (BCM59054A1): supported voltages in microvolts */ +static const struct linear_range bcm59054_dcdc_vsr_a1_ranges[] = { +REGULATOR_LINEAR_RANGE (0 ,0 ,1 ,0 ), +REGULATOR_LINEAR_RANGE (860000 ,2 ,59 ,10000 ), +REGULATOR_LINEAR_RANGE (1700000 ,60 ,60 ,0 ), +REGULATOR_LINEAR_RANGE (1500000 ,61 ,61 ,0 ), +REGULATOR_LINEAR_RANGE (1800000 ,62 ,62 ,0 ), +REGULATOR_LINEAR_RANGE (1600000 ,63 ,63 ,0 ), +}; + +/* DCDC group CSR: supported voltages in microvolts */ +static const struct linear_range bcm59054_dcdc_csr_ranges[] = { +REGULATOR_LINEAR_RANGE (700000 ,0 ,1 ,100000 ), +REGULATOR_LINEAR_RANGE (860000 ,2 ,60 ,10000 ), +REGULATOR_LINEAR_RANGE (900000 ,61 ,63 ,0 ), +}; + +static const struct bcm590xx_reg_data bcm59054_regs[BCM59054_NUM_REGS ] = { + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (RFLDO , rfldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (CAMLDO1 , camldo1, ldo_2_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (CAMLDO2 , camldo2, ldo_2_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (SIMLDO1 , simldo1, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (SIMLDO2 , simldo2, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (SDLDO , sdldo, ldo_2_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (SDXLDO , sdxldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (MMCLDO1 , mmcldo1, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (MMCLDO2 , mmcldo2, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (AUDLDO , audldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_REG_DESC (MICLDO , micldo), + .ops = &bcm590xx_ops_ldo_novolt, +/* MICLDO is locked at 1.8V */ + .n_voltages =1 , + .fixed_uV =1800000 , + .enable_reg =BCM59054_MICLDOPMCTRL1 , + .enable_mask =BCM590XX_REG_ENABLE , + .enable_is_inverted = true, + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (USBLDO , usbldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (VIBLDO , vibldo, ldo_2_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (CSR , csr, dcdc_csr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (IOSR1 , iosr1, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (IOSR2 , iosr2, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (MMSR , mmsr, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (SDSR1 , sdsr1, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (SDSR2 , sdsr2, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (VSR , vsr, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (GPLDO1 , gpldo1, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (GPLDO2 , gpldo2, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (GPLDO3 , gpldo3, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (TCXLDO , tcxldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (LVLDO1 , lvldo1, ldo_3_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (LVLDO2 , lvldo2, ldo_3_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_VBUS , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_REG_DESC (VBUS , vbus), + .ops = &bcm590xx_ops_vbus, + .n_voltages =1 , + .fixed_uV =5000000 , + .enable_reg =BCM59054_OTG_CTRL , + .enable_mask =BCM590XX_VBUS_ENABLE , + }, + }, +}; + +/* +* BCM59054A1 regulators; same as previous revision, but with different +* VSR voltage table. +*/ +static const struct bcm590xx_reg_data bcm59054_a1_regs[BCM59054_NUM_REGS ] = { + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (RFLDO , rfldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (CAMLDO1 , camldo1, ldo_2_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (CAMLDO2 , camldo2, ldo_2_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (SIMLDO1 , simldo1, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (SIMLDO2 , simldo2, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (SDLDO , sdldo, ldo_2_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (SDXLDO , sdxldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (MMCLDO1 , mmcldo1, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (MMCLDO2 , mmcldo2, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (AUDLDO , audldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_REG_DESC (MICLDO , micldo), + .ops = &bcm590xx_ops_ldo_novolt, +/* MICLDO is locked at 1.8V */ + .n_voltages =1 , + .fixed_uV =1800000 , + .enable_reg =BCM59054_MICLDOPMCTRL1 , + .enable_mask =BCM590XX_REG_ENABLE , + .enable_is_inverted = true, + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (USBLDO , usbldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_LDO , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_LDO_DESC (VIBLDO , vibldo, ldo_2_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (CSR , csr, dcdc_csr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (IOSR1 , iosr1, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (IOSR2 , iosr2, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (MMSR , mmsr, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (SDSR1 , sdsr1, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (SDSR2 , sdsr2, dcdc_sr_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_SR , + .regmap =BCM590XX_REGMAP_PRI , + .desc = { +BCM59054_SR_DESC (VSR , vsr, dcdc_vsr_a1_ranges), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (GPLDO1 , gpldo1, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (GPLDO2 , gpldo2, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (GPLDO3 , gpldo3, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (TCXLDO , tcxldo, ldo_1_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (LVLDO1 , lvldo1, ldo_3_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_GPLDO , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_LDO_DESC (LVLDO2 , lvldo2, ldo_3_table), + }, + }, + + { + .type =BCM590XX_REG_TYPE_VBUS , + .regmap =BCM590XX_REGMAP_SEC , + .desc = { +BCM59054_REG_DESC (VBUS , vbus), + .ops = &bcm590xx_ops_vbus, + .n_voltages =1 , + .fixed_uV =5000000 , + .enable_reg =BCM59054_OTG_CTRL , + .enable_mask =BCM590XX_VBUS_ENABLE , + }, + }, +}; +static int bcm590xx_probe (struct platform_device *pdev) {struct bcm590xx *bcm590xx =dev_get_drvdata (pdev->dev.parent);
@@ -480,8 +1109,24 @@ static int bcm590xx_probe(struct platform_device *pdev)return -ENOMEM ; pmu->mfd = bcm590xx; - pmu->n_regulators =BCM59056_NUM_REGS ; - pmu->regs = bcm59056_regs; + +switch (pmu->mfd->pmu_id) { +case BCM590XX_PMUID_BCM59054 : + pmu->n_regulators =BCM59054_NUM_REGS ; +if (pmu->mfd->rev_analog ==BCM59054_REV_ANALOG_A1 ) + pmu->regs = bcm59054_a1_regs; +else + pmu->regs = bcm59054_regs; +break ; +case BCM590XX_PMUID_BCM59056 : + pmu->n_regulators =BCM59056_NUM_REGS ; + pmu->regs = bcm59056_regs; +break ; +default : +dev_err (bcm590xx->dev, +"unknown device type, could not initialize\n" ); +return -EINVAL ; + }platform_set_drvdata (pdev, pmu);
Signature · 1 line
2.49.0
Re: [PATCH v9 5/8] regulator: bcm590xx: Use dev_err_probe for regulator register error
In reply to Artur WeberQuoted 2 lines · Artur Weber
Instead of calling
dev_err()and returningPTR_ERR(...)separately, use a single "returndev_err_probe" statement.
Re: [PATCH v9 6/8] regulator: bcm590xx: Store regulator descriptions in table
In reply to Artur WeberQuoted 3 lines · Artur Weber
Instead of filling in the regulator description programatically, store the data in a struct. This will make it a bit nicer to introduce support for other BCM590xx chips besides the BCM59056.
Re: [PATCH v9 7/8] regulator: bcm590xx: Rename BCM59056-specific data as such
In reply to Artur WeberQuoted 4 lines · Artur Weber
Previously, the driver used the BCM590XX prefix for register data specific to the BCM59056. As we will be introducing other regulators to this driver as well, make the BCM59056-specific values use the BCM59056 prefix.
Re: [PATCH v9 8/8] regulator: bcm590xx: Add support for BCM59054 regulators
In reply to Artur WeberQuoted 3 lines · Artur Weber
The BCM59056 and BCM59054 are very similar in terms of regulators. Add the register definitions for the BCM59054 and enable support for it in the driver.
Quoted 9 lines · Artur Weber
Add support for the BCM59054 MFD to the bcm590xx driver and fix a couple of small bugs in it that also affected the already supported BCM59056.
While we're at it - convert the devicetree bindings to YAML format and drop the bcm59056 DTS in favor of describing the PMU in users' DTS files, as is done for most other MFDs.
[...]
Applied, thanks!
[1/8] dt-bindings: mfd: brcm,bcm59056: Convert to YAML
commit: 9d56594f3ebf6ea4b23884412d3fde11f39518d2
[2/8] dt-bindings: mfd: brcm,bcm59056: Add compatible for BCM59054
commit: 13980ebf8e9431975fe834df9df31dea39cb9a45
[3/8] mfd: bcm590xx: Add support for multiple device types + BCM59054 compatible
commit: 6adf48a3aa316ce360e02dd10222e96da9a0eff5
[4/8] mfd: bcm590xx: Add PMU ID/revision parsing function
commit: d310cdbb4ee6285f374d4dfc32173c35f8a2273e
[5/8] regulator: bcm590xx: Use dev_err_probe for regulator register error
commit: 37512643e1f889549e4f9632d6bccef6804cb776
[6/8] regulator: bcm590xx: Store regulator descriptions in table
commit: 75dc12b4450269821fca4c8634f5185d28cf2117
[7/8] regulator: bcm590xx: Rename BCM59056-specific data as such
commit: d92f474420e5bb2c8b773a4fe9cf93b6051dc1ff
[8/8] regulator: bcm590xx: Add support for BCM59054 regulators
commit: ef7f3631a44b8e0990ab8ffcbed4b2c3a4270883--
Lee Jones [李琼斯]
Lee Jones
maintainer[GIT PULL] Immutable branch between MFD and Regulator due for the v6.16 merge window
In reply to Artur WeberEnjoy!
The following changes since commit 0af2f6be1b4281385b618cb86ad946eded089ac8:
Linux 6.15-rc1 (2025-04-06 13:11:33 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git ib-mfd-regulator-v6.16-1
for you to fetch changes up to ef7f3631a44b8e0990ab8ffcbed4b2c3a4270883:
regulator: bcm590xx: Add support for BCM59054 regulators (2025-05-22 10:57:46 +0100)
----------------------------------------------------------------
Immutable branch between MFD and Regulator due for the v6.16 merge window
----------------------------------------------------------------
Artur Weber (8):
dt-bindings: mfd: brcm,bcm59056: Convert to YAML
dt-bindings: mfd: brcm,bcm59056: Add compatible for BCM59054
mfd: bcm590xx: Add support for multiple device types + BCM59054 compatible
mfd: bcm590xx: Add PMU ID/revision parsing function
regulator: bcm590xx: Use dev_err_probe for regulator register error
regulator: bcm590xx: Store regulator descriptions in table
regulator: bcm590xx: Rename BCM59056-specific data as such
regulator: bcm590xx: Add support for BCM59054 regulators.../devicetree/bindings/mfd/brcm,bcm59056.txt | 39 - .../devicetree/bindings/mfd/brcm,bcm59056.yaml | 76 ++ .../bindings/regulator/brcm,bcm59054.yaml | 56 + .../bindings/regulator/brcm,bcm59056.yaml | 51 + drivers/mfd/bcm590xx.c | 66 +- drivers/regulator/bcm590xx-regulator.c | 1289 ++++++++++++++++---- include/linux/mfd/bcm590xx.h | 27 + 7 files changed, 1325 insertions(+), 279 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mfd/brcm,bcm59056.txt create mode 100644 Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml create mode 100644 Documentation/devicetree/bindings/regulator/brcm,bcm59054.yaml create mode 100644 Documentation/devicetree/bindings/regulator/brcm,bcm59056.yaml
Signature · 1 line
Lee Jones [李琼斯]