]> Git Repo - linux.git/commitdiff
Merge branch 'regulator-5.3' into regulator-next
authorMark Brown <[email protected]>
Thu, 4 Jul 2019 16:34:32 +0000 (17:34 +0100)
committerMark Brown <[email protected]>
Thu, 4 Jul 2019 16:34:32 +0000 (17:34 +0100)
1  2 
MAINTAINERS
drivers/regulator/88pm800-regulator.c
drivers/regulator/s2mps11.c
include/linux/mfd/samsung/s2mps11.h
include/linux/regulator/driver.h

diff --combined MAINTAINERS
index 01a52fc964daeaf54e30cdfe86ba4e23a9e55425,96b54b548ab0acb8e19d9fcb386101072fdf2a1b..53dbf6c20cd5f518bf82a8c4002ed7fa7fb9f5bc
@@@ -364,7 -364,7 +364,7 @@@ F: drivers/acpi/fan.
  
  ACPI FOR ARM64 (ACPI/arm64)
  M:    Lorenzo Pieralisi <[email protected]>
 -M:    Hanjun Guo <[email protected]>
 +M:    Hanjun Guo <[email protected]>
  M:    Sudeep Holla <[email protected]>
  L:    [email protected]
  L:    [email protected] (moderated for non-subscribers)
@@@ -1235,7 -1235,7 +1235,7 @@@ F:      arch/arm/lib/floppydma.
  F:    arch/arm/include/asm/floppy.h
  
  ARM PMU PROFILING AND DEBUGGING
 -M:    Will Deacon <will[email protected]>
 +M:    Will Deacon <will@kernel.org>
  M:    Mark Rutland <[email protected]>
  S:    Maintained
  L:    [email protected] (moderated for non-subscribers)
@@@ -1307,7 -1307,7 +1307,7 @@@ F:      Documentation/devicetree/bindings/in
  F:    drivers/irqchip/irq-vic.c
  
  ARM SMMU DRIVERS
 -M:    Will Deacon <will[email protected]>
 +M:    Will Deacon <will@kernel.org>
  R:    Robin Murphy <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
@@@ -2085,7 -2085,7 +2085,7 @@@ F:      drivers/tty/serial/msm_serial.
  F:    drivers/usb/dwc3/dwc3-qcom.c
  F:    include/dt-bindings/*/qcom*
  F:    include/linux/*/qcom*
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git
  
  ARM/RADISYS ENP2611 MACHINE SUPPORT
  M:    Lennert Buytenhek <[email protected]>
@@@ -2550,7 -2550,7 +2550,7 @@@ F:      drivers/i2c/busses/i2c-xiic.
  
  ARM64 PORT (AARCH64 ARCHITECTURE)
  M:    Catalin Marinas <[email protected]>
 -M:    Will Deacon <will[email protected]>
 +M:    Will Deacon <will@kernel.org>
  L:    [email protected] (moderated for non-subscribers)
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
  S:    Maintained
@@@ -2734,7 -2734,7 +2734,7 @@@ S:      Maintaine
  F:    drivers/net/wireless/atmel/atmel*
  
  ATOMIC INFRASTRUCTURE
 -M:    Will Deacon <will[email protected]>
 +M:    Will Deacon <will@kernel.org>
  M:    Peter Zijlstra <[email protected]>
  R:    Boqun Feng <[email protected]>
  L:    [email protected]
@@@ -3121,8 -3121,7 +3121,8 @@@ F:      arch/arm/mach-bcm
  
  BROADCOM BCM2835 ARM ARCHITECTURE
  M:    Eric Anholt <[email protected]>
 -M:    Stefan Wahren <[email protected]>
 +M:    Stefan Wahren <[email protected]>
 +L:    [email protected]
  L:    [email protected] (moderated for non-subscribers)
  L:    [email protected] (moderated for non-subscribers)
  T:    git git://github.com/anholt/linux
@@@ -3152,7 -3151,6 +3152,7 @@@ F:      arch/arm/boot/dts/bcm953012
  
  BROADCOM BCM53573 ARM ARCHITECTURE
  M:    Rafał Miłecki <[email protected]>
 +L:    [email protected]
  L:    [email protected]
  S:    Maintained
  F:    arch/arm/boot/dts/bcm53573*
@@@ -3942,14 -3940,6 +3942,14 @@@ M:    Miguel Ojeda <miguel.ojeda.sandonis@
  S:    Maintained
  F:    .clang-format
  
 +CLANG/LLVM BUILD SUPPORT
 +L:    [email protected]
 +W:    https://clangbuiltlinux.github.io/
 +B:    https://github.com/ClangBuiltLinux/linux/issues
 +C:    irc://chat.freenode.net/clangbuiltlinux
 +S:    Supported
 +K:    \b(?i:clang|llvm)\b
 +
  CLEANCACHE API
  M:    Konrad Rzeszutek Wilk <[email protected]>
  L:    [email protected]
@@@ -4707,6 -4697,7 +4707,7 @@@ F:      Documentation/devicetree/bindings/mf
  F:    Documentation/devicetree/bindings/input/da90??-onkey.txt
  F:    Documentation/devicetree/bindings/thermal/da90??-thermal.txt
  F:    Documentation/devicetree/bindings/regulator/da92*.txt
+ F:    Documentation/devicetree/bindings/regulator/slg51000.txt
  F:    Documentation/devicetree/bindings/watchdog/da90??-wdt.txt
  F:    Documentation/devicetree/bindings/sound/da[79]*.txt
  F:    drivers/gpio/gpio-da90??.c
@@@ -4722,6 -4713,7 +4723,7 @@@ F:      drivers/power/supply/da9052-battery.
  F:    drivers/power/supply/da91??-*.c
  F:    drivers/regulator/da903x.c
  F:    drivers/regulator/da9???-regulator.[ch]
+ F:    drivers/regulator/slg51000-regulator.[ch]
  F:    drivers/thermal/da90??-thermal.c
  F:    drivers/rtc/rtc-da90??.c
  F:    drivers/video/backlight/da90??_bl.c
@@@ -6244,6 -6236,7 +6246,6 @@@ F:      include/linux/ipmi-fru.
  K:    fmc_d.*register
  
  FPGA MANAGER FRAMEWORK
 -M:    Alan Tull <[email protected]>
  M:    Moritz Fischer <[email protected]>
  L:    [email protected]
  S:    Maintained
@@@ -8575,7 -8568,7 +8577,7 @@@ S:      Odd Fixe
  
  KERNEL NFSD, SUNRPC, AND LOCKD SERVERS
  M:    "J. Bruce Fields" <[email protected]>
 -M:    Jeff Layton <[email protected]>
 +M:    Chuck Lever <[email protected]>
  L:    [email protected]
  W:    http://nfs.sourceforge.net/
  T:    git git://linux-nfs.org/~bfields/linux.git
@@@ -9130,7 -9123,7 +9132,7 @@@ F:      drivers/misc/lkdtm/
  LINUX KERNEL MEMORY CONSISTENCY MODEL (LKMM)
  M:    Alan Stern <[email protected]>
  M:    Andrea Parri <[email protected]>
 -M:    Will Deacon <will[email protected]>
 +M:    Will Deacon <will@kernel.org>
  M:    Peter Zijlstra <[email protected]>
  M:    Boqun Feng <[email protected]>
  M:    Nicholas Piggin <[email protected]>
@@@ -9238,7 -9231,7 +9240,7 @@@ F:      Documentation/admin-guide/LSM/LoadPi
  LOCKING PRIMITIVES
  M:    Peter Zijlstra <[email protected]>
  M:    Ingo Molnar <[email protected]>
 -M:    Will Deacon <will[email protected]>
 +M:    Will Deacon <will@kernel.org>
  L:    [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
  S:    Maintained
@@@ -10559,7 -10552,7 +10561,7 @@@ F:   arch/arm/boot/dts/mmp
  F:    arch/arm/mach-mmp/
  
  MMU GATHER AND TLB INVALIDATION
 -M:    Will Deacon <will[email protected]>
 +M:    Will Deacon <will@kernel.org>
  M:    "Aneesh Kumar K.V" <[email protected]>
  M:    Andrew Morton <[email protected]>
  M:    Nick Piggin <[email protected]>
@@@ -12048,7 -12041,7 +12050,7 @@@ S:   Maintaine
  F:    drivers/pci/controller/dwc/*layerscape*
  
  PCI DRIVER FOR GENERIC OF HOSTS
 -M:    Will Deacon <will[email protected]>
 +M:    Will Deacon <will@kernel.org>
  L:    [email protected]
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
@@@ -14344,15 -14337,6 +14346,15 @@@ S: Supporte
  K:    sifive
  N:    sifive
  
 +SIFIVE FU540 SYSTEM-ON-CHIP
 +M:    Paul Walmsley <[email protected]>
 +M:    Palmer Dabbelt <[email protected]>
 +L:    [email protected]
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git
 +S:    Supported
 +K:    fu540
 +N:    fu540
 +
  SILEAD TOUCHSCREEN DRIVER
  M:    Hans de Goede <[email protected]>
  L:    [email protected]
@@@ -14413,7 -14397,7 +14415,7 @@@ F:   lib/test_siphash.
  F:    include/linux/siphash.h
  
  SIOX
 -M:    Gavin Schenk <g.schenk@eckelmann.de>
 +M:    Thorsten Scherer <t.scherer@eckelmann.de>
  M:    Uwe Kleine-König <[email protected]>
  R:    Pengutronix Kernel Team <[email protected]>
  S:    Supported
index 0000000000000000000000000000000000000000,9fd379732d1868ba8e686d1fd4edb1ace9beb35b..69ae25886181fd2313a227f50065db14935e725d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,289 +1,286 @@@
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
++// SPDX-License-Identifier: GPL-2.0-only
+ /*
+  * Regulators driver for Marvell 88PM800
+  *
+  * Copyright (C) 2012 Marvell International Ltd.
+  * Joseph(Yossi) Hanin <[email protected]>
+  * Yi Zhang <[email protected]>
+  */
+ #include <linux/module.h>
+ #include <linux/moduleparam.h>
+ #include <linux/init.h>
+ #include <linux/err.h>
+ #include <linux/regmap.h>
+ #include <linux/regulator/driver.h>
+ #include <linux/regulator/machine.h>
+ #include <linux/mfd/88pm80x.h>
+ #include <linux/delay.h>
+ #include <linux/io.h>
+ #include <linux/of.h>
+ #include <linux/regulator/of_regulator.h>
+ /* LDO1 with DVC[0..3] */
+ #define PM800_LDO1_VOUT               (0x08) /* VOUT1 */
+ #define PM800_LDO1_VOUT_2     (0x09)
+ #define PM800_LDO1_VOUT_3     (0x0A)
+ #define PM800_LDO2_VOUT               (0x0B)
+ #define PM800_LDO3_VOUT               (0x0C)
+ #define PM800_LDO4_VOUT               (0x0D)
+ #define PM800_LDO5_VOUT               (0x0E)
+ #define PM800_LDO6_VOUT               (0x0F)
+ #define PM800_LDO7_VOUT               (0x10)
+ #define PM800_LDO8_VOUT               (0x11)
+ #define PM800_LDO9_VOUT               (0x12)
+ #define PM800_LDO10_VOUT      (0x13)
+ #define PM800_LDO11_VOUT      (0x14)
+ #define PM800_LDO12_VOUT      (0x15)
+ #define PM800_LDO13_VOUT      (0x16)
+ #define PM800_LDO14_VOUT      (0x17)
+ #define PM800_LDO15_VOUT      (0x18)
+ #define PM800_LDO16_VOUT      (0x19)
+ #define PM800_LDO17_VOUT      (0x1A)
+ #define PM800_LDO18_VOUT      (0x1B)
+ #define PM800_LDO19_VOUT      (0x1C)
+ /* BUCK1 with DVC[0..3] */
+ #define PM800_BUCK1           (0x3C)
+ #define PM800_BUCK1_1         (0x3D)
+ #define PM800_BUCK1_2         (0x3E)
+ #define PM800_BUCK1_3         (0x3F)
+ #define PM800_BUCK2           (0x40)
+ #define PM800_BUCK3           (0x41)
+ #define PM800_BUCK4           (0x42)
+ #define PM800_BUCK4_1         (0x43)
+ #define PM800_BUCK4_2         (0x44)
+ #define PM800_BUCK4_3         (0x45)
+ #define PM800_BUCK5           (0x46)
+ #define PM800_BUCK_ENA                (0x50)
+ #define PM800_LDO_ENA1_1      (0x51)
+ #define PM800_LDO_ENA1_2      (0x52)
+ #define PM800_LDO_ENA1_3      (0x53)
+ #define PM800_LDO_ENA2_1      (0x56)
+ #define PM800_LDO_ENA2_2      (0x57)
+ #define PM800_LDO_ENA2_3      (0x58)
+ #define PM800_BUCK1_MISC1     (0x78)
+ #define PM800_BUCK3_MISC1     (0x7E)
+ #define PM800_BUCK4_MISC1     (0x81)
+ #define PM800_BUCK5_MISC1     (0x84)
+ struct pm800_regulator_info {
+       struct regulator_desc desc;
+       int max_ua;
+ };
+ /*
+  * vreg - the buck regs string.
+  * ereg - the string for the enable register.
+  * ebit - the bit number in the enable register.
+  * amax - the current
+  * Buck has 2 kinds of voltage steps. It is easy to find voltage by ranges,
+  * not the constant voltage table.
+  * n_volt - Number of available selectors
+  */
+ #define PM800_BUCK(match, vreg, ereg, ebit, amax, volt_ranges, n_volt)        \
+ {                                                                     \
+       .desc   = {                                                     \
+               .name                   = #vreg,                        \
+               .of_match               = of_match_ptr(#match),         \
+               .regulators_node        = of_match_ptr("regulators"),   \
+               .ops                    = &pm800_volt_range_ops,        \
+               .type                   = REGULATOR_VOLTAGE,            \
+               .id                     = PM800_ID_##vreg,              \
+               .owner                  = THIS_MODULE,                  \
+               .n_voltages             = n_volt,                       \
+               .linear_ranges          = volt_ranges,                  \
+               .n_linear_ranges        = ARRAY_SIZE(volt_ranges),      \
+               .vsel_reg               = PM800_##vreg,                 \
+               .vsel_mask              = 0x7f,                         \
+               .enable_reg             = PM800_##ereg,                 \
+               .enable_mask            = 1 << (ebit),                  \
+       },                                                              \
+       .max_ua = (amax),                                               \
+ }
+ /*
+  * vreg - the LDO regs string
+  * ereg -  the string for the enable register.
+  * ebit - the bit number in the enable register.
+  * amax - the current
+  * volt_table - the LDO voltage table
+  * For all the LDOes, there are too many ranges. Using volt_table will be
+  * simpler and faster.
+  */
+ #define PM800_LDO(match, vreg, ereg, ebit, amax, ldo_volt_table)      \
+ {                                                                     \
+       .desc   = {                                                     \
+               .name                   = #vreg,                        \
+               .of_match               = of_match_ptr(#match),         \
+               .regulators_node        = of_match_ptr("regulators"),   \
+               .ops                    = &pm800_volt_table_ops,        \
+               .type                   = REGULATOR_VOLTAGE,            \
+               .id                     = PM800_ID_##vreg,              \
+               .owner                  = THIS_MODULE,                  \
+               .n_voltages             = ARRAY_SIZE(ldo_volt_table),   \
+               .vsel_reg               = PM800_##vreg##_VOUT,          \
+               .vsel_mask              = 0xf,                          \
+               .enable_reg             = PM800_##ereg,                 \
+               .enable_mask            = 1 << (ebit),                  \
+               .volt_table             = ldo_volt_table,               \
+       },                                                              \
+       .max_ua = (amax),                                               \
+ }
+ /* Ranges are sorted in ascending order. */
+ static const struct regulator_linear_range buck1_volt_range[] = {
+       REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500),
+       REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x54, 50000),
+ };
+ /* BUCK 2~5 have same ranges. */
+ static const struct regulator_linear_range buck2_5_volt_range[] = {
+       REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500),
+       REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x72, 50000),
+ };
+ static const unsigned int ldo1_volt_table[] = {
+       600000,  650000,  700000,  750000,  800000,  850000,  900000,  950000,
+       1000000, 1050000, 1100000, 1150000, 1200000, 1300000, 1400000, 1500000,
+ };
+ static const unsigned int ldo2_volt_table[] = {
+       1700000, 1800000, 1900000, 2000000, 2100000, 2500000, 2700000, 2800000,
+ };
+ /* LDO 3~17 have same voltage table. */
+ static const unsigned int ldo3_17_volt_table[] = {
+       1200000, 1250000, 1700000, 1800000, 1850000, 1900000, 2500000, 2600000,
+       2700000, 2750000, 2800000, 2850000, 2900000, 3000000, 3100000, 3300000,
+ };
+ /* LDO 18~19 have same voltage table. */
+ static const unsigned int ldo18_19_volt_table[] = {
+       1700000, 1800000, 1900000, 2500000, 2800000, 2900000, 3100000, 3300000,
+ };
+ static int pm800_get_current_limit(struct regulator_dev *rdev)
+ {
+       struct pm800_regulator_info *info = rdev_get_drvdata(rdev);
+       return info->max_ua;
+ }
+ static const struct regulator_ops pm800_volt_range_ops = {
+       .list_voltage           = regulator_list_voltage_linear_range,
+       .map_voltage            = regulator_map_voltage_linear_range,
+       .set_voltage_sel        = regulator_set_voltage_sel_regmap,
+       .get_voltage_sel        = regulator_get_voltage_sel_regmap,
+       .enable                 = regulator_enable_regmap,
+       .disable                = regulator_disable_regmap,
+       .is_enabled             = regulator_is_enabled_regmap,
+       .get_current_limit      = pm800_get_current_limit,
+ };
+ static const struct regulator_ops pm800_volt_table_ops = {
+       .list_voltage           = regulator_list_voltage_table,
+       .map_voltage            = regulator_map_voltage_iterate,
+       .set_voltage_sel        = regulator_set_voltage_sel_regmap,
+       .get_voltage_sel        = regulator_get_voltage_sel_regmap,
+       .enable                 = regulator_enable_regmap,
+       .disable                = regulator_disable_regmap,
+       .is_enabled             = regulator_is_enabled_regmap,
+       .get_current_limit      = pm800_get_current_limit,
+ };
+ /* The array is indexed by id(PM800_ID_XXX) */
+ static struct pm800_regulator_info pm800_regulator_info[] = {
+       PM800_BUCK(buck1, BUCK1, BUCK_ENA, 0, 3000000, buck1_volt_range, 0x55),
+       PM800_BUCK(buck2, BUCK2, BUCK_ENA, 1, 1200000, buck2_5_volt_range, 0x73),
+       PM800_BUCK(buck3, BUCK3, BUCK_ENA, 2, 1200000, buck2_5_volt_range, 0x73),
+       PM800_BUCK(buck4, BUCK4, BUCK_ENA, 3, 1200000, buck2_5_volt_range, 0x73),
+       PM800_BUCK(buck5, BUCK5, BUCK_ENA, 4, 1200000, buck2_5_volt_range, 0x73),
+       PM800_LDO(ldo1, LDO1, LDO_ENA1_1, 0, 200000, ldo1_volt_table),
+       PM800_LDO(ldo2, LDO2, LDO_ENA1_1, 1, 10000, ldo2_volt_table),
+       PM800_LDO(ldo3, LDO3, LDO_ENA1_1, 2, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo4, LDO4, LDO_ENA1_1, 3, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo5, LDO5, LDO_ENA1_1, 4, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo6, LDO6, LDO_ENA1_1, 5, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo7, LDO7, LDO_ENA1_1, 6, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo8, LDO8, LDO_ENA1_1, 7, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo9, LDO9, LDO_ENA1_2, 0, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo10, LDO10, LDO_ENA1_2, 1, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo11, LDO11, LDO_ENA1_2, 2, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo12, LDO12, LDO_ENA1_2, 3, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo13, LDO13, LDO_ENA1_2, 4, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo14, LDO14, LDO_ENA1_2, 5, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo15, LDO15, LDO_ENA1_2, 6, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo16, LDO16, LDO_ENA1_2, 7, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo17, LDO17, LDO_ENA1_3, 0, 300000, ldo3_17_volt_table),
+       PM800_LDO(ldo18, LDO18, LDO_ENA1_3, 1, 200000, ldo18_19_volt_table),
+       PM800_LDO(ldo19, LDO19, LDO_ENA1_3, 2, 200000, ldo18_19_volt_table),
+ };
+ static int pm800_regulator_probe(struct platform_device *pdev)
+ {
+       struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent);
+       struct pm80x_platform_data *pdata = dev_get_platdata(pdev->dev.parent);
+       struct regulator_config config = { };
+       struct regulator_init_data *init_data;
+       int i, ret;
+       if (pdata && pdata->num_regulators) {
+               unsigned int count = 0;
+               /* Check whether num_regulator is valid. */
+               for (i = 0; i < ARRAY_SIZE(pdata->regulators); i++) {
+                       if (pdata->regulators[i])
+                               count++;
+               }
+               if (count != pdata->num_regulators)
+                       return -EINVAL;
+       }
+       config.dev = chip->dev;
+       config.regmap = chip->subchip->regmap_power;
+       for (i = 0; i < PM800_ID_RG_MAX; i++) {
+               struct regulator_dev *regulator;
+               if (pdata && pdata->num_regulators) {
+                       init_data = pdata->regulators[i];
+                       if (!init_data)
+                               continue;
+                       config.init_data = init_data;
+               }
+               config.driver_data = &pm800_regulator_info[i];
+               regulator = devm_regulator_register(&pdev->dev,
+                               &pm800_regulator_info[i].desc, &config);
+               if (IS_ERR(regulator)) {
+                       ret = PTR_ERR(regulator);
+                       dev_err(&pdev->dev, "Failed to register %s\n",
+                                       pm800_regulator_info[i].desc.name);
+                       return ret;
+               }
+       }
+       return 0;
+ }
+ static struct platform_driver pm800_regulator_driver = {
+       .driver         = {
+               .name   = "88pm80x-regulator",
+       },
+       .probe          = pm800_regulator_probe,
+ };
+ module_platform_driver(pm800_regulator_driver);
+ MODULE_LICENSE("GPL");
+ MODULE_AUTHOR("Joseph(Yossi) Hanin <[email protected]>");
+ MODULE_DESCRIPTION("Regulator Driver for Marvell 88PM800 PMIC");
+ MODULE_ALIAS("platform:88pm800-regulator");
index 5b7ba7c6c4f6f084f06fca5081ead4603c9beb88,e5a74ae4068704abe67abdd28bee8524a56cd211..054baaadfdfddc39c83f7ffd1fa58c6a29f2eb7f
@@@ -34,7 -34,7 +34,7 @@@ struct s2mps11_info 
        enum sec_device_type dev_type;
  
        /*
-        * One bit for each S2MPS13/S2MPS14/S2MPU02 regulator whether
+        * One bit for each S2MPS11/S2MPS13/S2MPS14/S2MPU02 regulator whether
         * the suspend mode was enabled.
         */
        DECLARE_BITMAP(suspend_state, S2MPS_REGULATOR_MAX);
@@@ -70,10 -70,11 +70,11 @@@ static int s2mps11_regulator_set_voltag
                                   unsigned int new_selector)
  {
        struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
+       int rdev_id = rdev_get_id(rdev);
        unsigned int ramp_delay = 0;
        int old_volt, new_volt;
  
-       switch (rdev_get_id(rdev)) {
+       switch (rdev_id) {
        case S2MPS11_BUCK2:
                ramp_delay = s2mps11->ramp_delay2;
                break;
@@@ -111,9 -112,10 +112,10 @@@ static int s2mps11_set_ramp_delay(struc
        struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
        unsigned int ramp_val, ramp_shift, ramp_reg = S2MPS11_REG_RAMP_BUCK;
        unsigned int ramp_enable = 1, enable_shift = 0;
+       int rdev_id = rdev_get_id(rdev);
        int ret;
  
-       switch (rdev_get_id(rdev)) {
+       switch (rdev_id) {
        case S2MPS11_BUCK1:
                if (ramp_delay > s2mps11->ramp_delay16)
                        s2mps11->ramp_delay16 = ramp_delay;
                goto ramp_disable;
  
        /* Ramp delay can be enabled/disabled only for buck[2346] */
-       if ((rdev_get_id(rdev) >= S2MPS11_BUCK2 &&
-                       rdev_get_id(rdev) <= S2MPS11_BUCK4) ||
-                       rdev_get_id(rdev) == S2MPS11_BUCK6)  {
+       if ((rdev_id >= S2MPS11_BUCK2 && rdev_id <= S2MPS11_BUCK4) ||
+           rdev_id == S2MPS11_BUCK6)  {
                ret = regmap_update_bits(rdev->regmap, S2MPS11_REG_RAMP,
                                         1 << enable_shift, 1 << enable_shift);
                if (ret) {
@@@ -224,27 -225,133 +225,133 @@@ ramp_disable
                                  1 << enable_shift, 0);
  }
  
+ static int s2mps11_regulator_enable(struct regulator_dev *rdev)
+ {
+       struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
+       int rdev_id = rdev_get_id(rdev);
+       unsigned int val;
+       switch (s2mps11->dev_type) {
+       case S2MPS11X:
+               if (test_bit(rdev_id, s2mps11->suspend_state))
+                       val = S2MPS14_ENABLE_SUSPEND;
+               else
+                       val = rdev->desc->enable_mask;
+               break;
+       case S2MPS13X:
+       case S2MPS14X:
+               if (test_bit(rdev_id, s2mps11->suspend_state))
+                       val = S2MPS14_ENABLE_SUSPEND;
+               else if (s2mps11->ext_control_gpiod[rdev_id])
+                       val = S2MPS14_ENABLE_EXT_CONTROL;
+               else
+                       val = rdev->desc->enable_mask;
+               break;
+       case S2MPU02:
+               if (test_bit(rdev_id, s2mps11->suspend_state))
+                       val = S2MPU02_ENABLE_SUSPEND;
+               else
+                       val = rdev->desc->enable_mask;
+               break;
+       default:
+               return -EINVAL;
+       }
+       return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
+                       rdev->desc->enable_mask, val);
+ }
+ static int s2mps11_regulator_set_suspend_disable(struct regulator_dev *rdev)
+ {
+       int ret;
+       unsigned int val, state;
+       struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
+       int rdev_id = rdev_get_id(rdev);
+       /* Below LDO should be always on or does not support suspend mode. */
+       switch (s2mps11->dev_type) {
+       case S2MPS11X:
+               switch (rdev_id) {
+               case S2MPS11_LDO2:
+               case S2MPS11_LDO36:
+               case S2MPS11_LDO37:
+               case S2MPS11_LDO38:
+                       return 0;
+               default:
+                       state = S2MPS14_ENABLE_SUSPEND;
+                       break;
+               }
+               break;
+       case S2MPS13X:
+       case S2MPS14X:
+               switch (rdev_id) {
+               case S2MPS14_LDO3:
+                       return 0;
+               default:
+                       state = S2MPS14_ENABLE_SUSPEND;
+                       break;
+               }
+               break;
+       case S2MPU02:
+               switch (rdev_id) {
+               case S2MPU02_LDO13:
+               case S2MPU02_LDO14:
+               case S2MPU02_LDO15:
+               case S2MPU02_LDO17:
+               case S2MPU02_BUCK7:
+                       state = S2MPU02_DISABLE_SUSPEND;
+                       break;
+               default:
+                       state = S2MPU02_ENABLE_SUSPEND;
+                       break;
+               }
+               break;
+       default:
+               return -EINVAL;
+       }
+       ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
+       if (ret < 0)
+               return ret;
+       set_bit(rdev_id, s2mps11->suspend_state);
+       /*
+        * Don't enable suspend mode if regulator is already disabled because
+        * this would effectively for a short time turn on the regulator after
+        * resuming.
+        * However we still want to toggle the suspend_state bit for regulator
+        * in case if it got enabled before suspending the system.
+        */
+       if (!(val & rdev->desc->enable_mask))
+               return 0;
+       return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
+                                 rdev->desc->enable_mask, state);
+ }
  static const struct regulator_ops s2mps11_ldo_ops = {
        .list_voltage           = regulator_list_voltage_linear,
        .map_voltage            = regulator_map_voltage_linear,
        .is_enabled             = regulator_is_enabled_regmap,
-       .enable                 = regulator_enable_regmap,
+       .enable                 = s2mps11_regulator_enable,
        .disable                = regulator_disable_regmap,
        .get_voltage_sel        = regulator_get_voltage_sel_regmap,
        .set_voltage_sel        = regulator_set_voltage_sel_regmap,
        .set_voltage_time_sel   = regulator_set_voltage_time_sel,
+       .set_suspend_disable    = s2mps11_regulator_set_suspend_disable,
  };
  
  static const struct regulator_ops s2mps11_buck_ops = {
        .list_voltage           = regulator_list_voltage_linear,
        .map_voltage            = regulator_map_voltage_linear,
        .is_enabled             = regulator_is_enabled_regmap,
-       .enable                 = regulator_enable_regmap,
+       .enable                 = s2mps11_regulator_enable,
        .disable                = regulator_disable_regmap,
        .get_voltage_sel        = regulator_get_voltage_sel_regmap,
        .set_voltage_sel        = regulator_set_voltage_sel_regmap,
        .set_voltage_time_sel   = s2mps11_regulator_set_voltage_time_sel,
        .set_ramp_delay         = s2mps11_set_ramp_delay,
+       .set_suspend_disable    = s2mps11_regulator_set_suspend_disable,
  };
  
  #define regulator_desc_s2mps11_ldo(num, step) {               \
        .ops            = &s2mps11_buck_ops,                    \
        .type           = REGULATOR_VOLTAGE,                    \
        .owner          = THIS_MODULE,                          \
 -      .min_uV         = MIN_600_MV,                           \
 +      .min_uV         = MIN_650_MV,                           \
        .uV_step        = STEP_6_25_MV,                         \
 -      .n_voltages     = S2MPS11_BUCK_N_VOLTAGES,              \
 +      .linear_min_sel = 8,                                    \
 +      .n_voltages     = S2MPS11_BUCK12346_N_VOLTAGES,         \
        .ramp_delay     = S2MPS11_RAMP_DELAY,                   \
        .vsel_reg       = S2MPS11_REG_B1CTRL2 + (num - 1) * 2,  \
        .vsel_mask      = S2MPS11_BUCK_VSEL_MASK,               \
        .ops            = &s2mps11_buck_ops,                    \
        .type           = REGULATOR_VOLTAGE,                    \
        .owner          = THIS_MODULE,                          \
 -      .min_uV         = MIN_600_MV,                           \
 +      .min_uV         = MIN_650_MV,                           \
        .uV_step        = STEP_6_25_MV,                         \
 -      .n_voltages     = S2MPS11_BUCK_N_VOLTAGES,              \
 +      .linear_min_sel = 8,                                    \
 +      .n_voltages     = S2MPS11_BUCK5_N_VOLTAGES,             \
        .ramp_delay     = S2MPS11_RAMP_DELAY,                   \
        .vsel_reg       = S2MPS11_REG_B5CTRL2,                  \
        .vsel_mask      = S2MPS11_BUCK_VSEL_MASK,               \
        .enable_mask    = S2MPS11_ENABLE_MASK                   \
  }
  
 -#define regulator_desc_s2mps11_buck67810(num, min, step) {    \
 +#define regulator_desc_s2mps11_buck67810(num, min, step, min_sel, voltages) { \
        .name           = "BUCK"#num,                           \
        .id             = S2MPS11_BUCK##num,                    \
        .ops            = &s2mps11_buck_ops,                    \
        .owner          = THIS_MODULE,                          \
        .min_uV         = min,                                  \
        .uV_step        = step,                                 \
 -      .n_voltages     = S2MPS11_BUCK_N_VOLTAGES,              \
 +      .linear_min_sel = min_sel,                              \
 +      .n_voltages     = voltages,                             \
        .ramp_delay     = S2MPS11_RAMP_DELAY,                   \
        .vsel_reg       = S2MPS11_REG_B6CTRL2 + (num - 6) * 2,  \
        .vsel_mask      = S2MPS11_BUCK_VSEL_MASK,               \
@@@ -374,15 -478,11 +481,15 @@@ static const struct regulator_desc s2mp
        regulator_desc_s2mps11_buck1_4(3),
        regulator_desc_s2mps11_buck1_4(4),
        regulator_desc_s2mps11_buck5,
 -      regulator_desc_s2mps11_buck67810(6, MIN_600_MV, STEP_6_25_MV),
 -      regulator_desc_s2mps11_buck67810(7, MIN_600_MV, STEP_12_5_MV),
 -      regulator_desc_s2mps11_buck67810(8, MIN_600_MV, STEP_12_5_MV),
 +      regulator_desc_s2mps11_buck67810(6, MIN_650_MV, STEP_6_25_MV, 8,
 +                                       S2MPS11_BUCK12346_N_VOLTAGES),
 +      regulator_desc_s2mps11_buck67810(7, MIN_750_MV, STEP_12_5_MV, 0,
 +                                       S2MPS11_BUCK7810_N_VOLTAGES),
 +      regulator_desc_s2mps11_buck67810(8, MIN_750_MV, STEP_12_5_MV, 0,
 +                                       S2MPS11_BUCK7810_N_VOLTAGES),
        regulator_desc_s2mps11_buck9,
 -      regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV),
 +      regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV, 0,
 +                                       S2MPS11_BUCK7810_N_VOLTAGES),
  };
  
  static const struct regulator_ops s2mps14_reg_ops;
@@@ -507,101 -607,16 +614,16 @@@ static const struct regulator_desc s2mp
        regulator_desc_s2mps13_buck8_10(10, MIN_500_MV,  STEP_6_25_MV, 0x10),
  };
  
- static int s2mps14_regulator_enable(struct regulator_dev *rdev)
- {
-       struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
-       unsigned int val;
-       switch (s2mps11->dev_type) {
-       case S2MPS13X:
-       case S2MPS14X:
-               if (test_bit(rdev_get_id(rdev), s2mps11->suspend_state))
-                       val = S2MPS14_ENABLE_SUSPEND;
-               else if (s2mps11->ext_control_gpiod[rdev_get_id(rdev)])
-                       val = S2MPS14_ENABLE_EXT_CONTROL;
-               else
-                       val = rdev->desc->enable_mask;
-               break;
-       case S2MPU02:
-               if (test_bit(rdev_get_id(rdev), s2mps11->suspend_state))
-                       val = S2MPU02_ENABLE_SUSPEND;
-               else
-                       val = rdev->desc->enable_mask;
-               break;
-       default:
-               return -EINVAL;
-       }
-       return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
-                       rdev->desc->enable_mask, val);
- }
- static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev)
- {
-       int ret;
-       unsigned int val, state;
-       struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
-       int rdev_id = rdev_get_id(rdev);
-       /* Below LDO should be always on or does not support suspend mode. */
-       switch (s2mps11->dev_type) {
-       case S2MPS13X:
-       case S2MPS14X:
-               switch (rdev_id) {
-               case S2MPS14_LDO3:
-                       return 0;
-               default:
-                       state = S2MPS14_ENABLE_SUSPEND;
-                       break;
-               }
-               break;
-       case S2MPU02:
-               switch (rdev_id) {
-               case S2MPU02_LDO13:
-               case S2MPU02_LDO14:
-               case S2MPU02_LDO15:
-               case S2MPU02_LDO17:
-               case S2MPU02_BUCK7:
-                       state = S2MPU02_DISABLE_SUSPEND;
-                       break;
-               default:
-                       state = S2MPU02_ENABLE_SUSPEND;
-                       break;
-               }
-               break;
-       default:
-               return -EINVAL;
-       }
-       ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
-       if (ret < 0)
-               return ret;
-       set_bit(rdev_get_id(rdev), s2mps11->suspend_state);
-       /*
-        * Don't enable suspend mode if regulator is already disabled because
-        * this would effectively for a short time turn on the regulator after
-        * resuming.
-        * However we still want to toggle the suspend_state bit for regulator
-        * in case if it got enabled before suspending the system.
-        */
-       if (!(val & rdev->desc->enable_mask))
-               return 0;
-       return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
-                       rdev->desc->enable_mask, state);
- }
  static const struct regulator_ops s2mps14_reg_ops = {
        .list_voltage           = regulator_list_voltage_linear,
        .map_voltage            = regulator_map_voltage_linear,
        .is_enabled             = regulator_is_enabled_regmap,
-       .enable                 = s2mps14_regulator_enable,
+       .enable                 = s2mps11_regulator_enable,
        .disable                = regulator_disable_regmap,
        .get_voltage_sel        = regulator_get_voltage_sel_regmap,
        .set_voltage_sel        = regulator_set_voltage_sel_regmap,
        .set_voltage_time_sel   = regulator_set_voltage_time_sel,
-       .set_suspend_disable    = s2mps14_regulator_set_suspend_disable,
+       .set_suspend_disable    = s2mps11_regulator_set_suspend_disable,
  };
  
  #define regulator_desc_s2mps14_ldo(num, min, step) {  \
@@@ -828,10 -843,11 +850,12 @@@ static void s2mps14_pmic_dt_parse_ext_c
                                0,
                                GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
                                "s2mps11-regulator");
-               if (IS_ERR(gpio[reg])) {
+               if (PTR_ERR(gpio[reg]) == -ENOENT)
+                       gpio[reg] = NULL;
+               else if (IS_ERR(gpio[reg])) {
                        dev_err(&pdev->dev, "Failed to get control GPIO for %d/%s\n",
                                reg, rdata[reg].name);
 +                      gpio[reg] = NULL;
                        continue;
                }
                if (gpio[reg])
@@@ -864,8 -880,9 +888,9 @@@ static int s2mps11_pmic_dt_parse(struc
  static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
  {
        unsigned int ramp_val, ramp_shift, ramp_reg;
+       int rdev_id = rdev_get_id(rdev);
  
-       switch (rdev_get_id(rdev)) {
+       switch (rdev_id) {
        case S2MPU02_BUCK1:
                ramp_shift = S2MPU02_BUCK1_RAMP_SHIFT;
                break;
@@@ -893,24 -910,24 +918,24 @@@ static const struct regulator_ops s2mpu
        .list_voltage           = regulator_list_voltage_linear,
        .map_voltage            = regulator_map_voltage_linear,
        .is_enabled             = regulator_is_enabled_regmap,
-       .enable                 = s2mps14_regulator_enable,
+       .enable                 = s2mps11_regulator_enable,
        .disable                = regulator_disable_regmap,
        .get_voltage_sel        = regulator_get_voltage_sel_regmap,
        .set_voltage_sel        = regulator_set_voltage_sel_regmap,
        .set_voltage_time_sel   = regulator_set_voltage_time_sel,
-       .set_suspend_disable    = s2mps14_regulator_set_suspend_disable,
+       .set_suspend_disable    = s2mps11_regulator_set_suspend_disable,
  };
  
  static const struct regulator_ops s2mpu02_buck_ops = {
        .list_voltage           = regulator_list_voltage_linear,
        .map_voltage            = regulator_map_voltage_linear,
        .is_enabled             = regulator_is_enabled_regmap,
-       .enable                 = s2mps14_regulator_enable,
+       .enable                 = s2mps11_regulator_enable,
        .disable                = regulator_disable_regmap,
        .get_voltage_sel        = regulator_get_voltage_sel_regmap,
        .set_voltage_sel        = regulator_set_voltage_sel_regmap,
        .set_voltage_time_sel   = regulator_set_voltage_time_sel,
-       .set_suspend_disable    = s2mps14_regulator_set_suspend_disable,
+       .set_suspend_disable    = s2mps11_regulator_set_suspend_disable,
        .set_ramp_delay         = s2mpu02_set_ramp_delay,
  };
  
index fc67c9e75bbaa73d0e7b1b629877c3b6d2070837,f6c035eb87be2c02435fbef1c65cd648c0f774c3..4805c90609c434c0dd51ba11710c29ff68ae7fcd
@@@ -170,9 -170,7 +170,9 @@@ enum s2mps11_regulators 
  #define S2MPS11_ENABLE_MASK   (0x03 << S2MPS11_ENABLE_SHIFT)
  #define S2MPS11_ENABLE_SHIFT  0x06
  #define S2MPS11_LDO_N_VOLTAGES        (S2MPS11_LDO_VSEL_MASK + 1)
 -#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
 +#define S2MPS11_BUCK12346_N_VOLTAGES  153
 +#define S2MPS11_BUCK5_N_VOLTAGES      216
 +#define S2MPS11_BUCK7810_N_VOLTAGES   225
  #define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1)
  #define S2MPS11_RAMP_DELAY    25000           /* uV/us */
  
  #define S2MPS11_BUCK6_RAMP_EN_SHIFT   0
  #define S2MPS11_PMIC_EN_SHIFT 6
  
+ /*
+  * Bits for "enable suspend" (On/Off controlled by PWREN)
+  * are the same as in S2MPS14: S2MPS14_ENABLE_SUSPEND
+  */
  #endif /*  __LINUX_MFD_S2MPS11_H */
index d45ab52c91c9a583bca831fb10f26b9438332b15,f0d7b0496e5446b77bb93ded6797166741384171..08259a75fecd24e448434e96f9aea2a5a3415c25
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   * driver.h -- SoC Regulator driver support.
   *
@@@ -6,6 -5,10 +6,6 @@@
   *
   * Author: Liam Girdwood <[email protected]>
   *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
 - *
   * Regulator Driver Interface.
   */
  
@@@ -283,6 -286,11 +283,11 @@@ enum regulator_type 
   * @vsel_range_mask: Mask for register bitfield used for range selector
   * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
   * @vsel_mask: Mask for register bitfield used for selector
+  * @vsel_step: Specify the resolution of selector stepping when setting
+  *           voltage. If 0, then no stepping is done (requested selector is
+  *           set directly), if >0 then the regulator API will ramp the
+  *           voltage up/down gradually each time increasing/decreasing the
+  *           selector by the specified step value.
   * @csel_reg: Register for current limit selector using regmap set_current_limit
   * @csel_mask: Mask for register bitfield used for current limit selector
   * @apply_reg: Register for initiate voltage change on the output when
@@@ -357,6 -365,7 +362,7 @@@ struct regulator_desc 
        unsigned int vsel_range_mask;
        unsigned int vsel_reg;
        unsigned int vsel_mask;
+       unsigned int vsel_step;
        unsigned int csel_reg;
        unsigned int csel_mask;
        unsigned int apply_reg;
This page took 0.165649 seconds and 4 git commands to generate.