02 Oct, 2020

2 commits

  • The PM660 PMIC is very often paired with the PM660L option on
    SDM630/663/660 (and SDA variants) boards.

    The PM660 has 11 "660" LDOs (2 NMOS, 9 PMOS) and 7 HT LDOs (4 NMOS,
    3 PMOS) and a quirk: the L4 regulator is unaccessible or does not
    exist on the PMIC.
    The PM660L has 8 "660" LDOs (1 NMOS, 7 PMOS) and 2 HT NMOS LDOs.

    Signed-off-by: AngeloGioacchino Del Regno
    Link: https://lore.kernel.org/r/20200926125549.13191-4-kholk11@gmail.com
    Signed-off-by: Mark Brown

    AngeloGioacchino Del Regno
     
  • This commit adds the support for some regulator types that are
    missing in this driver, such as the ht nmos-ldo, ht-lv nmos-ldo
    and new gen n/pmos-ldo, all belonging to the FTSMPS426 register
    layout.
    This is done in preparation for adding support for the PM660 and
    PM660L PMICs.

    Signed-off-by: AngeloGioacchino Del Regno
    Link: https://lore.kernel.org/r/20200926125549.13191-3-kholk11@gmail.com
    Signed-off-by: Mark Brown

    AngeloGioacchino Del Regno
     

19 Aug, 2020

1 commit


02 Jul, 2020

1 commit

  • These are never modified, so make them const to allow the compiler to
    put them in read-only memory.

    Before:
    text data bss dec hex filename
    20362 2592 152 23106 5a42 drivers/regulator/qcom_spmi-regulator.o

    After:
    text data bss dec hex filename
    21814 1140 152 23106 5a42 drivers/regulator/qcom_spmi-regulator.o

    Signed-off-by: Rikard Falkeborn
    Link: https://lore.kernel.org/r/20200629194632.8147-3-rikard.falkeborn@gmail.com
    Signed-off-by: Mark Brown

    Rikard Falkeborn
     

01 Oct, 2019

2 commits

  • This Power IC is used in combination with various PMIC combos,
    generally found on boards with MSM8992, MSM8994, MSM8996,
    MSM8956, MSM8976 and others, usually at address 0x5 on the SPMI
    bus, and its usual usage is to provide power to the GPU and/or
    to the CPU clusters (APC0/APC1).

    Signed-off-by: Angelo G. Del Regno
    Link: https://lore.kernel.org/r/20190921095043.62593-6-kholk11@gmail.com
    Signed-off-by: Mark Brown

    Angelo G. Del Regno
     
  • The PM8950 has 5 HFSMPS, 1 FTSMPS2.5 (s5, controlling APC voltage)
    and 23 LDO regulators.
    Add the configuration for this chip.

    Signed-off-by: Angelo G. Del Regno
    Link: https://lore.kernel.org/r/20190921095043.62593-3-kholk11@gmail.com
    Signed-off-by: Mark Brown

    Angelo G. Del Regno
     

25 Jun, 2019

1 commit

  • Low-voltage switches (lvs) don't have set_points since the voltage ranges
    of the output are really controlled by the inputs. This is a problem for
    the newly added linear range support in the probe(), as that will cause
    a null pointer dereference error on older platforms like msm8974 which
    happen to need to control some of the implemented lvs.

    Fix this by adding the appropriate null check.

    Fixes: 86f4ff7a0c0c ("regulator: qcom_spmi: enable linear range info")
    Reported-by: Bjorn Andersson
    Signed-off-by: Jeffrey Hugo
    Tested-by: Bjorn Andersson
    Signed-off-by: Mark Brown

    Jeffrey Hugo
     

20 Jun, 2019

1 commit

  • spmi_regulator_set_voltage_time_sel() calculates the amount of delay
    needed as the result of setting a new voltage. Essentially this is the
    absolute difference of the old and new voltages, divided by the slew rate.

    The implementation of spmi_regulator_set_voltage_time_sel() is wrong.

    It attempts to calculate the difference in voltages by using the
    difference in selectors and multiplying by the voltage step between
    selectors. This ignores the possibility that the old and new selectors
    might be from different ranges, which have different step values. Also,
    the difference between the selectors may encapsulate N ranges inbetween,
    so a summation of each selector change from old to new would be needed.

    Lets avoid all of that complexity, and just get the actual voltage
    represented by both the old and new selector, and use those to directly
    compute the voltage delta. This is more straight forward, and has the
    side benifit of avoiding issues with regulator implementations that don't
    have hardware register support to get the current configured range.

    Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
    Reported-by: Bjorn Andersson
    Reported-by: Jorge Ramirez-Ortiz
    Reported-by: Mark Brown
    Signed-off-by: Jeffrey Hugo
    Reviewed-by: Bjorn Andersson
    Tested-by: Jorge Ramirez-Ortiz
    Signed-off-by: Mark Brown

    Jeffrey Hugo
     

19 Jun, 2019

3 commits

  • The PMS405 has 5 HFSMPS and 13 LDO regulators,

    This commit adds support for one of the 5 HFSMPS regulators (s3) to
    the spmi regulator driver.

    The PMIC HFSMPS 430 regulators have 8 mV step size and a voltage
    control scheme consisting of two 8-bit registers defining a 16-bit
    voltage set point in units of millivolts

    S3 controls the cpu voltages (s3 is a buck regulator of type HFS430);
    it is therefore required so we can enable voltage scaling for safely
    running cpufreq.

    Signed-off-by: Jorge Ramirez-Ortiz
    Signed-off-by: Jeffrey Hugo
    Signed-off-by: Mark Brown

    Jorge Ramirez
     
  • The PM8005 is used on the msm8998 MTP. The S1 regulator is VDD_GFX, ie
    it needs to be on and controlled inorder to use the GPU. Add support to
    drive the PM8005 regulators so that we can bring up the GPU on msm8998.

    Signed-off-by: Jeffrey Hugo
    Reviewed-by: Bjorn Andersson
    Signed-off-by: Mark Brown

    Jeffrey Hugo
     
  • Linux 5.2-rc4

    Mark Brown
     

17 Jun, 2019

2 commits


05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 and
    only version 2 as published by the free software foundation this
    program is distributed in the hope that it will be useful but
    without any warranty without even the implied warranty of
    merchantability or fitness for a particular purpose see the gnu
    general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 294 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141900.825281744@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 Jul, 2018

4 commits

  • Fix the following checkpatch error:

    ERROR: code indent should use tabs where possible
    + { }$

    Fixes: ca5cd8c9400c ("regulator: qcom_spmi: Add support for pmi8994")
    Signed-off-by: Niklas Cassel
    Signed-off-by: Mark Brown

    Niklas Cassel
     
  • Fix the following checkpatch error:

    ERROR: do not initialise statics to NULL
    +static struct regmap *saw_regmap = NULL;

    Fixes: 0caecaa87202 ("regulator: qcom_spmi: Add support for SAW")
    Signed-off-by: Niklas Cassel
    Signed-off-by: Mark Brown

    Niklas Cassel
     
  • Since we have just assigned saw_regmap, and since the error message
    refers to saw_regmap, it feels safe to assume that it is saw_regmap,
    and not regmap, that should be checked for errors.

    Fixes: 0caecaa87202 ("regulator: qcom_spmi: Add support for SAW")
    Signed-off-by: Niklas Cassel
    Signed-off-by: Mark Brown

    Niklas Cassel
     
  • For of_find_node_by_name(), you typically pass what the previous call
    returned. Therefore, of_find_node_by_name() increases the refcount of
    the returned node, and decreases the refcount of the node passed as the
    first argument.

    of_find_node_by_name() is incorrectly used, and produces a warning.
    Fix the warning by using the more suitable function
    of_get_child_by_name().

    Also add a missing of_node_put() for the returned value, since this was
    previously being leaked.

    OF: ERROR: Bad of_node_put() on /soc/qcom,spmi@400f000/pmic@3/regulators
    CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.18.0-rc4-00223-gefd7b360b70e #12
    Hardware name: Qualcomm Technologies, Inc. DB820c (DT)
    Call trace:
    dump_backtrace+0x0/0x1a8
    show_stack+0x14/0x20
    dump_stack+0x90/0xb4
    of_node_release+0x74/0x78
    kobject_put+0x90/0x1f0
    of_node_put+0x14/0x20
    of_find_node_by_name+0x80/0xd8
    qcom_spmi_regulator_probe+0x30c/0x508

    Fixes: 0caecaa87202 ("regulator: qcom_spmi: Add support for SAW")
    Signed-off-by: Niklas Cassel
    Signed-off-by: Mark Brown

    Niklas Cassel
     

25 May, 2018

1 commit

  • Add support for SAW controlled regulators.
    The regulators defined as SAW controlled in the device tree
    will be controlled through special CPU registers instead of direct
    SPMI accesses.
    This is required especially for CPU supply regulators to synchronize
    with clock scaling and for Automatic Voltage Switching.

    Signed-off-by: Ilia Lin
    Signed-off-by: Mark Brown

    Ilia Lin
     

25 Jan, 2018

1 commit


11 Nov, 2017

1 commit


03 Nov, 2017

1 commit

  • This driver converts voltages from a non-linear range in hardware
    to a linear range in software and vice versa. During the
    conversion, we exclude certain voltages that are invalid to use
    because the software interface is more flexible than reality.

    For example, the FTSMPS2P5 regulators have a voltage range from
    80000uV to 1355000uV that software could support, but we only
    want to use the range of 350000uV to 1355000uV. If we don't
    account for the hw selectors between 80000uV and 350000uV we'll
    pick a hw selector of 0 to mean 350000uV when it really means
    80000uV. This can cause us to program voltages into the hardware
    that are significantly lower than what we're expecting.

    And when we read it back from the hardware we'll have the same
    problem, voltages that are in the invalid band will end up being
    calculated as some software selector that represents a larger
    voltage than what is programmed and the user will be confused.

    Fix all this by properly offsetting the software selector and hw
    selector when converting from one number space to another.

    Fixes: 1b5b19689278 ("regulator: qcom_spmi: Only use selector based regulator ops")
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     

02 Nov, 2017

1 commit


26 Jun, 2016

3 commits

  • The voltage switches support mode switching, so add support for
    these ops to those types of regulators.

    Cc: Bjorn Andersson
    Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     
  • The mvs1 and mvs2 switches are actually called 5vs1 and 5vs2 on
    some datasheets. Let's rename them to match the datasheets and
    also match the RPM based regulator driver which calls these by
    their 5vs names (see qcom_smd-regulator.c). There aren't any
    users of these regulators so far, so there aren't any concerns of
    DT ABI breakage here. While we're here making updates to the
    switches, also mandate usage of the OCP irq for these switches
    too.

    Cc: Bjorn Andersson
    Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     
  • The S4 supply is sometimes called the boost regulator because it
    outputs 5V. Typically it's connected to the 5vs1 and 5vs2
    switches for use in USB OTG and HDMI applications. Add support
    for this regulator which was mistakenly left out from the initial
    submission of this driver.

    Cc: Bjorn Andersson
    Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     

18 Apr, 2016

1 commit

  • I had a thinko in spmi_regulator_select_voltage_same_range() when
    converting it to return selectors via the function's return value
    instead of by modifying a pointer argument. I only tested
    multi-range regulators so this passed through testing. Fix it by
    returning the selector here.

    Fixes: 1b5b19689278 ("regulator: qcom_spmi: Only use selector based regulator ops")
    Reported-by: Rajendra Nayak
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     

01 Apr, 2016

2 commits

  • Mixing raw voltage and selector based regulator ops is
    inconsistent. This driver already supports some selector based
    ops via the list_voltage and set_voltage_time_sel ops but it uses
    raw voltage ops for get_voltage and set_voltage. This causes
    problems for regulator_set_voltage() and automatic insertion of
    slewing delays because set_voltage_time_sel() is only used if the
    regulator ops are all selector based. Put another way, delays
    aren't happening at all right now when we should be waiting for
    voltages to settle. Let's move to pure selector based regulator
    ops so that the delays are inserted properly.

    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     
  • Only the FT SMPS type regulators have slewing supported in the
    driver, but all types of SMPS regulators need the same support.
    The only difference is that some SMPS regulators don't have a
    step size and the step delay is typically 20, not 8. Luckily, the
    step size reads as 0 for the non-FT types, so we can always read
    that, but we need to detect which type of regulator we're using
    to figure out what step delay to use. Make these minor
    adjustments to the slew rate calculations and add support for the
    delay function to the appropriate regulator ops.

    Reported-by: Georgi Djakov
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     

28 Mar, 2016

2 commits

  • On some designs, a handful of the regulators can't be read via
    SPMI transactions because they're "secure" and not intended to be
    touched by non-secure processors. This driver unconditionally
    attempts to read the id registers of all the regulators though,
    leading to probe failing and no regulators being registered.
    Let's ignore any errors from failing to read the registers and
    keep adding other regulators so that this driver can probe on
    such devices.

    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     
  • Document the regulators available on pm8994 and add support for
    this PMIC to the SPMI PMIC regulator driver.

    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd
     

25 Jul, 2015

1 commit


10 Jul, 2015

1 commit


19 Jun, 2015

1 commit


17 Jun, 2015

1 commit

  • drivers/regulator/qcom_spmi-regulator.c:751:3-50: code aligned
    with following code on line 753
    drivers/regulator/qcom_spmi-regulator.c:584:3-41: code aligned
    with following code on line 587

    These lines where missing braces causing the break to always
    be executed even when it shouldn't be. Fix it.

    Reported-by: kbuild test robot
    Signed-off-by: Stephen Boyd
    Reviewed-by: Andy Gross
    Signed-off-by: Mark Brown

    Stephen Boyd
     

16 Jun, 2015

2 commits

  • Simplify a trivial if-return sequence and combine with a
    preceding function call.

    Generated by: scripts/coccinelle/misc/simple_return.cocci

    CC: Mark Brown
    Signed-off-by: Julia Lawall
    Signed-off-by: Mark Brown

    Julia Lawall
     
  • Add an SPMI regulator driver for Qualcomm's PM8841, PM8941, and
    PM8916 PMICs. This driver is based largely on code from
    codeaurora.org[1].

    [1] https://www.codeaurora.org/cgit/quic/la/kernel/msm-3.10/tree/drivers/regulator/qpnp-regulator.c?h=msm-3.10
    Cc: David Collins
    Cc:
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mark Brown

    Stephen Boyd