26 Dec, 2019

1 commit

  • Current code set incorrect bits when set ramp_delay for AXP20X_DCDC2,
    fix it.

    Fixes: d29f54df8b16 ("regulator: axp20x: add support for set_ramp_delay for AXP209")
    Signed-off-by: Axel Lin
    Link: https://lore.kernel.org/r/20191221081049.32490-1-axel.lin@ingics.com
    Signed-off-by: Mark Brown

    Axel Lin
     

19 Dec, 2019

1 commit

  • A copy-paste error was introduced when bitmasks were converted to
    macros, incorrectly setting the enable bitmask for ELDO2 to the one
    for ELDO1 for the AXP22x units.

    Fix it by using the correct macro.

    On affected boards, ELDO1 and/or ELDO2 are used to power the camera,
    which is currently unsupported.

    Fixes: db4a555f7c4c ("regulator: axp20x: use defines for masks")
    Signed-off-by: Chen-Yu Tsai
    Link: https://lore.kernel.org/r/20191218044720.21990-1-wens@kernel.org
    Signed-off-by: Mark Brown

    Chen-Yu Tsai
     

17 Jul, 2019

2 commits

  • Refactoring of axp20x driver introduced a bug in AXP803's DCDC6
    regulator definition. AXP803_DCDC6_1120mV_STEPS was obtained by
    subtracting 0x47 and 0x33. This should be 0x14 (hex) and not 14
    (dec).

    Refactoring also carried over a bug in DCDC5 regulator definition.
    Number of possible voltages must be for 1 bigger than maximum valid
    voltage index, because 0 is also valid and it means lowest voltage.

    Fixes: 1dbe0ccb0631 ("regulator: axp20x-regulator: add support for AXP803")
    Fixes: db4a555f7c4c ("regulator: axp20x: use defines for masks")
    Signed-off-by: Jernej Skrabec
    Link: https://lore.kernel.org/r/20190713090717.347-3-jernej.skrabec@siol.net
    Signed-off-by: Mark Brown

    Jernej Skrabec
     
  • Refactoring of the driver introduced bugs in AXP806's DCDCA and DCDCD
    regulator definitions.

    In DCDCA case, AXP806_DCDCA_1120mV_STEPS was obtained by subtracting
    0x47 and 0x33. This should be 0x14 (hex) and not 14 (dec).

    In DCDCD case, axp806_dcdcd_ranges[] contains two ranges with same
    start and end macros, which is clearly wrong. Second range starts at
    1.6V so it should use AXP806_DCDCD_1600mV_[START|END] macros. They are
    already defined but unused.

    Fixes: db4a555f7c4c ("regulator: axp20x: use defines for masks")
    Signed-off-by: Jernej Skrabec
    Link: https://lore.kernel.org/r/20190713090717.347-2-jernej.skrabec@siol.net
    Signed-off-by: Mark Brown

    Jernej Skrabec
     

21 Mar, 2019

1 commit

  • In preparation to enabling -Wimplicit-fallthrough, mark switch
    cases where we are expecting to fall through.

    This patch fixes the following warnings:

    drivers/regulator/axp20x-regulator.c: In function ‘axp20x_set_dcdc_freq’:
    drivers/regulator/axp20x-regulator.c:1023:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    reg = AXP803_DCDC_FREQ_CTRL;
    drivers/regulator/axp20x-regulator.c:1025:2: note: here
    case AXP806_ID:
    ^~~~
    drivers/regulator/axp20x-regulator.c: In function ‘axp20x_set_dcdc_workmode’:
    drivers/regulator/axp20x-regulator.c:1115:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    reg = AXP806_DCDC_MODE_CTRL2;
    drivers/regulator/axp20x-regulator.c:1121:2: note: here
    case AXP221_ID:
    ^~~~

    Notice that in this particular case, I moved the whole comment
    "Fall through to the check below.", which contains the "Fall through"
    comment, at the bottom of the case, which is what GCC is expecting
    to find.

    Warning level 3 was used: -Wimplicit-fallthrough=3

    This patch is part of the ongoing efforts to enable
    -Wimplicit-fallthrough.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Mark Brown

    Gustavo A. R. Silva
     

19 Mar, 2019

2 commits


19 Feb, 2019

3 commits


04 Feb, 2019

1 commit


28 Jan, 2019

2 commits


09 Jan, 2019

1 commit

  • Currently rdev is dereferenced when assigning desc before rdev is null
    checked, hence there is a potential null pointer dereference on rdev.
    Fix this by null checking rdev first.

    Detected by CoverityScan, CID#1476031 ("Dereference before null check")

    Fixes: 77e3e3b165db ("regulator: axp20x: add software based soft_start for AXP209 LDO3")
    Signed-off-by: Colin Ian King
    Signed-off-by: Mark Brown

    Colin Ian King
     

17 Dec, 2018

1 commit


14 Dec, 2018

2 commits

  • In the past, there have been words on various lists that if LDO3 is
    disabled in u-boot, but enabled in the DTS, the axp209 driver would
    fail to continue/hang. Several enable/disable patches have been
    issues to devicetree's in both the kernel and u-boot to address
    this issue.

    What really happened however, was that the AXP209 shuts down without
    a notice and without setting an interrupt. This is caused when LDO3
    gets overloaded, for example with large capacitors on the LDO3 output.

    Normally, we would expect that AXP209 would source 200 mA as per
    datasheet and set and trigger an interrupt when being overloaded.
    For some reason however, this does not happen.

    As a work-around, we use the soft-start constraint of the regulator
    node to first bring up the LDO3 to the lowest possible voltage and
    then enable the LDO. After that, we can set the requested voltage
    as usual.

    Combining this setting with the regulator-ramp-delay allows LDO3 to
    enable voltage slowly and staggered, potentially reducing overall
    inrush current.

    Signed-off-by: Olliver Schinagl
    Signed-off-by: Priit Laes
    Signed-off-by: Mark Brown

    Olliver Schinagl
     
  • The AXP209 supports ramping up voltages on several regulators such as
    DCDC2 and LDO3.

    This patch adds preliminary support for the regulator-ramp-delay property
    for these 2 regulators. Note that the voltage ramp only works when
    regulator is already enabled. E.g. when going from say 0.7 V to 3.6 V.

    When turning on the regulator, no voltage ramp is performed in hardware.

    What this means, is that if the bootloader brings up the voltage at 0.7 V,
    the ramp delay property is properly applied. If however, the bootloader
    leaves the power off, no ramp delay is applied when the power is
    enabled by the regulator framework.

    Signed-off-by: Olliver Schinagl
    Signed-off-by: Priit Laes
    Signed-off-by: Mark Brown

    Olliver Schinagl
     

28 Nov, 2018

1 commit

  • The AXP20X driver currently has several masks defined throughout the
    code. Use nice defines to make them clean and more descriptive.

    Additionally include bitops.h, which was missing before, and sort
    headers.

    Signed-off-by: Olliver Schinagl
    Signed-off-by: Priit Laes
    Signed-off-by: Mark Brown

    Olliver Schinagl
     

04 Oct, 2018

1 commit

  • In preparation to enabling -Wimplicit-fallthrough, mark switch cases
    where we are expecting to fall through.

    Notice that in this particular case, I moved the whole comment
    "Fall through to the check below.", which contains the "Fall through"
    comment, at the bottom of the case, which is what GCC is expecting
    to find.

    Addresses-Coverity-ID: 1436594 ("Missing break in switch")
    Addresses-Coverity-ID: 1364475 ("Missing break in switch")
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Mark Brown

    Gustavo A. R. Silva
     

23 Apr, 2018

1 commit


18 Oct, 2017

1 commit


04 Oct, 2017

2 commits

  • The AXP813 PMIC has 7 DC-DC buck regulators, 16 LDOs (including the
    fixed RTC LDO and 2 GPIO LDOs), and 1 switchable. The drive-vbus
    feature is also supported. All the hardware details are very similar
    to the AXP803, with the following exceptions:

    - Extra DCDC7 buck regulator, with the same range as DCDC6

    - SWitch now has a separate supply pin, instead of being chained
    internaly from DCDC1

    - RTC LDO output voltage is now 1.8V

    - FLDO3 is an LDO with switchable supplies, but unconfigurable output
    voltage. The voltage is always half that of its supply.

    Support for FLDO3 is currently unimplemented, as it requires runtime
    switching of its supplies, something the regulator subsystem does not
    support. It is not used in either the reference designs nor actually
    produced boards available.

    Signed-off-by: Chen-Yu Tsai
    Tested-by: Maxime Ripard
    Acked-by: Maxime Ripard
    Signed-off-by: Mark Brown

    Chen-Yu Tsai
     
  • The bit offset used to check if DCDC5 and DCDC6 are tied together in
    poly-phase output is wrong. It was checking against a reserved bit,
    which is always false.

    In reality, neither the reference design layout nor actually produced
    boards tie these two buck regulators together. But we should still
    fix it, just in case.

    Fixes: 1dbe0ccb0631 ("regulator: axp20x-regulator: add support for AXP803")
    Signed-off-by: Chen-Yu Tsai
    Tested-by: Maxime Ripard
    Acked-by: Maxime Ripard
    Signed-off-by: Mark Brown

    Chen-Yu Tsai
     

07 Jul, 2017

1 commit


20 May, 2017

1 commit


20 Feb, 2017

1 commit


01 Feb, 2017

1 commit

  • Declare regulator_ops structure as const as it is only stored in the ops
    field of a regulator_desc structure. This field is of type const, so
    regulator_ops structures having this property can be made const too.

    File size before: drivers/regulator/axp20x-regulator.o
    text data bss dec hex filename
    16848 1232 0 18080 46a0 regulator/axp20x-regulator.o

    File size after: drivers/regulator/axp20x-regulator.o
    text data bss dec hex filename
    17888 192 0 18080 46a0 regulator/axp20x-regulator.o

    Signed-off-by: Bhumika Goyal
    Signed-off-by: Mark Brown

    Bhumika Goyal
     

24 Jan, 2017

1 commit


11 Nov, 2016

1 commit

  • The maximum supported voltage for ldo_io# is 3.3V, but on cold boot
    the selector comes up at 0x1f, which maps to 3.8V. This was previously
    corrected by Allwinner's U-boot, which set all regulators on the PMICs
    to some pre-configured voltage. With recent progress in U-boot SPL
    support, this is no longer the case. In any case we should handle
    this quirk in the kernel driver as well.

    This invalid setting causes _regulator_get_voltage() to fail with -EINVAL
    which causes regulator registration to fail when constrains are used:

    [ 1.054181] vcc-pg: failed to get the current voltage(-22)
    [ 1.059670] axp20x-regulator axp20x-regulator.0: Failed to register ldo_io0
    [ 1.069749] axp20x-regulator: probe of axp20x-regulator.0 failed with error -22

    This commits makes the axp20x regulator driver accept the 0x1f register
    value, fixing this.

    The datasheet does not guarantee reliable operation above 3.3V, so on
    boards where this regulator is used the regulator-max-microvolt setting
    must be 3.3V or less.

    This is essentially the same as the commit f40d4896bf32 ("regulator:
    axp20x: Fix axp22x ldo_io registration error on cold boot") for AXP22x
    PMICs.

    Fixes: a51f9f4622a3 ("regulator: axp20x: support AXP809 variant")
    Signed-off-by: Chen-Yu Tsai
    Signed-off-by: Mark Brown

    Chen-Yu Tsai
     

13 Sep, 2016

1 commit

  • The X-Powers AXP806 PMIC has a new set of buck and LDO regulators, and
    also a switch. The buck regulators support teaming into multi-phase
    groups, with A+B, A+B+C, D+E groupings.

    Some registers controlling DCDC converter work settings are at different
    offsets. Deal with them as well.

    Add support for this new variant.

    Signed-off-by: Chen-Yu Tsai
    Acked-by: Mark Brown
    Signed-off-by: Lee Jones

    Chen-Yu Tsai
     

07 Jun, 2016

1 commit

  • The axp20x pmics have 2 power inputs, one called ACIN which is intended
    for to be supplied via a powerbarrel on the board and one called VBUS
    which is intended to be supplied via an otg connector.

    In the VBUS case the pmic needs to know if the board is supplying power
    to the otg connector, because then it should not take any power from
    its VBUS pin. The axp209 pmic has a N_VBUSEN input pin via which the
    board can signal to the pmic whether the board is supplying power to the
    otg connector or not.

    On the axp221/axp223 this pin can alternatively be used as an output
    which controls an external regulator which (optionally) supplies
    power to the otg connector from the board. When the pin is used as
    output it is called DRIVEVBUS in the datasheet.

    This commit adds support for the DRIVEVBUS pin as an extra pmic
    controlled regulator. Since this is optional a new x-powers,drivebus dt
    property is added. When this is present the misc-control register is
    written to change the N_VBUSEN input pin to DRIVEVBUS output pin mode and
    the extra drivebus regulator is registered with the regulator subsystem.

    Signed-off-by: Hans de Goede
    Acked-by: Chen-Yu Tsai
    Signed-off-by: Mark Brown

    Hans de Goede
     

01 Jun, 2016

1 commit

  • The X-Powers AXP809 PMIC has a similar set of regulators as the AXP221,
    though a few LDOs were removed, and a new switch output added. Like the
    AXP221, AXP809 also has DC1SW and DC5LDO, which are internally chained
    to DCDC1 and DCDC5, respectively.

    Add support for this new variant. Also remove the "axp22x_" prefix from
    DC1SW/DC5LDO supply handling code, as the AXP809 uses it as well.

    Signed-off-by: Chen-Yu Tsai
    Signed-off-by: Mark Brown

    Chen-Yu Tsai
     

29 Apr, 2016

1 commit

  • The maximum supported voltage for ldo_io# is 3.3V, but on cold
    boot the selector comes up at 0x1f, which maps to 3.8V.

    This causes _regulator_get_voltage() to fail with -EINVAL which
    causes regulator registration to fail when constrains are used:

    [ 1.467788] vcc-touchscreen: failed to get the current voltage(-22)
    [ 1.474209] axp20x-regulator axp20x-regulator: Failed to register ldo_io1
    [ 1.483363] axp20x-regulator: probe of axp20x-regulator failed with error -22

    This commits makes the axp20x regulator driver accept the 0x1f register
    value, fixing this.

    The datasheet does not guarantee reliable operation above 3.3V, so on
    boards where this regulator is used the regulator-max-microvolt setting
    must be 3.3V or less.

    Signed-off-by: Hans de Goede
    Signed-off-by: Mark Brown

    Hans de Goede
     

27 Apr, 2016

1 commit

  • The minium voltage of 1800mV is a copy and paste error from the axp20x
    regulator info. The correct minimum voltage for the ldo_io regulators
    on the axp22x is 700mV.

    Fixes: 1b82b4e4f954 ("regulator: axp20x: Add support for AXP22X regulators")
    Signed-off-by: Hans de Goede
    Acked-by: Chen-Yu Tsai
    Signed-off-by: Mark Brown

    Hans de Goede
     

26 Apr, 2016

1 commit

  • The current linear voltage range for the LDO4 regulator found in the APX20X
    PMICs assumes that the voltage is linear between 2.5 and 3.1V.

    However, the PMIC can output up to 3.3V on that regulator by skipping the
    2.6V and 2.9V steps.

    Fix the ranges to read and set the proper voltages.

    Fixes: 13d57e64352a ("regulator: axp20x: Use linear voltage ranges for AXP20X LDO4")
    Signed-off-by: Maxime Ripard
    Acked-by: Chen-Yu Tsai
    Signed-off-by: Mark Brown

    Maxime Ripard
     

19 Mar, 2016

1 commit

  • Pull MFD updates from Lee Jones:
    "New Drivers:
    - Freescale Touch Screen ADC
    - X-Powers AXP PMIC with RSB
    - TI TPS65086 Power Management IC (PMIC)

    New Device Support:
    - Supply device PCI IDs for Intel Broxton

    Fix-ups:
    - Move to clkdev_create() API; intel_quark_i2c_gpio
    - Complete re-write of TI's TPS65912 Power Management IC (PMIC)
    - Remove unnecessary function argument; axp20x
    - Separate out bus related code; axp20x
    - Coding Style changes; axp20x
    - Allow more drivers to be compiled as modules
    - Work around false positive 'used uninitialised' warning; db8500-prcmu

    Bug Fixes:
    - Remove do_div(); fsl-imx25-gcq
    - Fix driver init when built-in; tps65010
    - Fix clock-unregister leak; intel-lpss"

    * tag 'mfd-for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (53 commits)
    mfd: intel-lpss: Pass I2C configuration via properties on BXT
    mfd: imx6sx: Add PCIe register definitions for iomuxc gpr
    mfd: ipaq-micro: Use __maybe_unused to hide pm functions
    mfd: max77686: Add max77802 to I2C device ID table
    mfd: max77686: Export OF module alias information
    mfd: max77686: Allow driver to be built as a module
    mfd: stmpe: Add the proper PWM resources
    mfd: tps65090: Set regmap config reg counts properly
    mfd: syscon: Return ENOTSUPP instead of ENOSYS when disabled
    mfd: as3711: Set regmap config reg counts properly
    mfd: rc5t583: Set regmap config reg counts properly
    gpio: tps65086: Add GPO driver for the TPS65086 PMIC
    mfd: mt6397: Add platform device ID table
    mfd: da9063: Fix missing volatile registers in the core regmap_range volatile lists
    mfd: mt6397: Add MT6323 support to MT6397 driver
    mfd: mt6397: Add support for different Slave types
    mfd: mt6397: int_con and int_status may vary in location
    dt-bindings: mfd: Add bindings for the MediaTek MT6323 PMIC
    mfd: da9062: Fix missing volatile registers in the core regmap_range volatile lists
    mfd: Add documentation for ACT8945A DT bindings
    ...

    Linus Torvalds
     

16 Feb, 2016

1 commit


12 Feb, 2016

1 commit

  • The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
    It is functionally identical to AXP221; only the regulator default
    voltage/status and the external host interface are different.

    Signed-off-by: Chen-Yu Tsai
    Reviewed-by: Mark Brown
    Signed-off-by: Lee Jones

    Chen-Yu Tsai
     

04 Feb, 2016

2 commits

  • AXP20X datasheet lists the possible voltage settings for LDO4, so
    it was implemented using a voltage table. Upon closer examination,
    the valid voltages can be mapped into 3 linear ranges.

    Move AXP20X LDO4 to use linear ranges. The supporting code can be
    reused with later AXP8xx PMICs, which have a number of regulators
    that have 2 linear ranges.

    Signed-off-by: Chen-Yu Tsai
    Signed-off-by: Mark Brown

    Chen-Yu Tsai
     
  • Switch-type regulators, such as DC1SW on AXP22X, are a secondary output
    from DCDC1. They are just an on/off switch, and the driver should not
    try to read its voltage directly from the DCDC1 control registers.

    Instead, the core will pass down the voltage from the regulator supply
    chain.

    Signed-off-by: Chen-Yu Tsai
    Signed-off-by: Mark Brown

    Chen-Yu Tsai