24 Jul, 2019

1 commit


23 Jul, 2019

1 commit

  • Fix below build warning when CONFIG_PM_SLEEP=n:

    drivers/regulator/pfuze100-regulator.c:743:12: warning:
    'pfuze_resume' defined but not used [-Wunused-function]
    static int pfuze_resume(struct device *dev)
    ^~~~~~~~~~~~
    drivers/regulator/pfuze100-regulator.c:717:12: warning:
    'pfuze_suspend' defined but not used [-Wunused-functio ]
    static int pfuze_suspend(struct device *dev)
    ^~~~~~~~~~~~~

    Signed-off-by: Anson Huang
    Reviewed-by: Jacky Bai
    (cherry picked from commit 36fb6ba8ad9f3a5eb6d883e53c5bb42cd5aec3ce)

    Anson Huang
     

18 Apr, 2019

38 commits

  • read ROHM BD71837 / BD71847 specific device tree bindings for
    controlling the PMIC shutdown/reset states and voltages for
    different HW states. The PMIC was designed to be used with NXP
    i.MX8 SoC and it supports SNVS low power state which seems to
    be typical for NXP i.MX SoCs. However, when SNVS is used we must
    not allow SW to control enabling/disabling those regulators which
    are crucial for system to boot as there is a HW limitation which
    causes SW controlled regulators to be kept shut down after SNVS
    reset.

    Allow setting the SNVS to be used as reset target state and allow
    marking those regulators which are critical for boot.

    Signed-off-by: Matti Vaittinen
    Tested-by: Angus Ainslie
    Reviewed-by: Angus Ainslie
    Signed-off-by: Mark Brown
    (cherry picked from commit 049369d464289bb57bcfb6faa20990a06fe1e7ae)

    Matti Vaittinen
     
  • Add regulator_desc_list_voltage_linear_range which can be used
    by drivers for getting the voltages before regulator is registered.
    This may be useful for drivers which need to fetch the voltage
    selectors at device-tree parsing callback.

    Signed-off-by: Matti Vaittinen
    Acked-by: Mark Brown
    Tested-by: Angus Ainslie
    Reviewed-by: Angus Ainslie
    Signed-off-by: Mark Brown
    (cherry picked from commit 6a47b4da551a762217215aeeda22e46469c5868a)

    Matti Vaittinen
     
  • Signed-off-by: Axel Lin
    Signed-off-by: Mark Brown
    (cherry picked from commit 704c5c01ce6e0d322e2c9555490b39c41e729383)

    Axel Lin
     
  • BD71837 and BD71847 have a HW functionality which leave power
    rails OFF after powerof state:
    - if they have been controlled by SW.
    - if state transition from poweroff is done to SNVS

    BD71837 can after reset transition from power-off to SNVS or
    READY state depending on reset reason. By default only wathcdog
    reset changes state from poweroff to ready. Change PMIC
    configuration to always transition to READY in order to avoid
    crucial power rails being OFF after reset.

    If SNVS is required the crucial power rails should not be
    controlled by SW - eg corresponding regulator control register
    should have SEL bit kept zero. Currently the driver assumes all
    regulators to be controlled by SW so it sets all SEL bits to 1.

    Signed-off-by: Matti Vaittinen
    Signed-off-by: Mark Brown
    (cherry picked from commit e770b18bbbaecebfb37389b45bf82974a17488d7)

    Matti Vaittinen
     
  • The voltages in bd718xx_3rd_nodvs_buck_volts are in ascendant order, so use
    regulator_map_voltage_ascend.

    Signed-off-by: Axel Lin
    Signed-off-by: Mark Brown
    (cherry picked from commit 2e61286dc6ce10ebce17825cd61031c5fd0289db)

    Axel Lin
     
  • 0-Day tests found compilation error on x86.
    Driver won't compile on x86_64 as "of_match_ptr" is
    not found. Add missing include

    At some point this fix was lost. So re-apply it.

    Signed-off-by: Matti Vaittinen
    Signed-off-by: Mark Brown
    (cherry picked from commit 9cce72448364675ed5d4c793cf546023c003fdd6)

    Matti Vaittinen
     
  • With gcc 4.1:

    drivers/regulator/bd718x7-regulator.c: In function ‘bd718xx_probe’:
    drivers/regulator/bd718x7-regulator.c:1020: warning: initialization from incompatible pointer type
    drivers/regulator/bd718x7-regulator.c:1024: warning: initialization from incompatible pointer type

    Apparently this old compiler can't handle the obscure double
    indirection.

    However, there is no need for a double indirection. Just store a
    pointer to the array instead, like other drivers tend to do.

    Fixes: 494edd266b945f36 ("regulator/mfd: Support ROHM BD71847 power management IC")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Mark Brown
    (cherry picked from commit de226ebda96cafa981b9c0fef56888931668b671)

    Geert Uytterhoeven
     
  • All the fields in struct bd718xx_pmic are not really necessary.
    Remove struct bd718xx_pmic to simplify the code.

    Signed-off-by: Axel Lin
    Reviewed-by: Matti Vaittinen
    Signed-off-by: Mark Brown
    (cherry picked from commit bcb047ebf28453da56f0265aeeb9edc52b797ea7)

    Axel Lin
     
  • rename bd71837-regulator.c to bd718x7-regulator.c to reflect the
    fact that also BD71847 is now supported by the driver.

    Signed-off-by: Matti Vaittinen
    Signed-off-by: Mark Brown
    (cherry picked from commit 2ece646c90c5b45dd76c76ea207a3f3459f2c472)

    Matti Vaittinen
     
  • Few regulators in BD71837 and BD71847 can output voltages from
    different voltage ranges. Register interface is arranged so that
    used range is selected by toggling bits which are not next to actual
    voltage selection bits. Then the voltage inside selected range is
    determined by voltage selection bits (as usual). Support BD71837
    and BD71847 selectible range voltages using new pickable ranges
    helpers.

    Signed-off-by: Matti Vaittinen
    Signed-off-by: Mark Brown
    (cherry picked from commit a4bfc2c28a21f4d5274d813b20fd015a9dc9bcfa)

    Matti Vaittinen
     
  • Rename parts of code that support both BD71837 and BD71847 to BD718XX.

    Signed-off-by: Matti Vaittinen
    Acked-by: Lee Jones
    Signed-off-by: Mark Brown
    (cherry picked from commit dd2be639f4a918b335818bf22a937956e552b957)

    Matti Vaittinen
     
  • For example ROHM BD71837 and ROHM BD71847 Power management ICs have
    regulators which provide multiple linear ranges. Ranges can be
    selected by individual non contagious bit in vsel register. Add
    regmap helper functions for selecting ranges.

    Signed-off-by: Matti Vaittinen
    Signed-off-by: Mark Brown
    (cherry picked from commit 18e4b55fbd2069cee51ef9660b35c65ec13bee6d)

    Matti Vaittinen
     
  • BD71847 is reduced version of BD71837. DVS bucks 3 and 4 are
    removed as is LDO7. Voltage ranges of some regulators are
    expanded.

    Add initial support for BD71847 with BD71837 driver.

    Signed-off-by: Matti Vaittinen
    Acked-by: Lee Jones
    Signed-off-by: Mark Brown
    (cherry picked from commit 494edd266b945f36908184433dd36eda1719cdb0)

    Matti Vaittinen
     
  • Don't give up voltage mapping if first range with suitable min/max uV
    does not provide the wanted voltage.

    Signed-off-by: Matti Vaittinen
    Signed-off-by: Mark Brown
    (cherry picked from commit e7d80b6b848b4b5f83d3fbee9fd042d036ede9c6)

    Matti Vaittinen
     
  • Set it once is enough.
    Also move n_voltages close to volt_table for better readability.

    Signed-off-by: Axel Lin
    Signed-off-by: Mark Brown
    (cherry picked from commit 61b2e6741e81226c29a5ed92fd886f11efb78e98)

    Axel Lin
     
  • Fix 'Division or modulo by zero' coverity issue(CID-4159438).
    In fact, no need to call set_ramp_delay() in case of ramp_disable
    is true, hence, ramp_delay never be 0 while set_ramp_delay() called.

    Signed-off-by: Robin Gong
    Reviewed-by: Anson Huang
    Signed-off-by: Arulpandiyan Vadivel

    Robin Gong
     
  • The Linux kernel regulator core implementation does not accept negative
    voltage values; all negative values are treated as errors.

    The problem with the EPDC is that the panel uses a negative voltage
    regulator which fails to be enabled by the regulator core. This issue has
    slipped up until the 4.9 rebase because the voltage range [min, max] was
    checked against only when min = max. This has been fixed in 4.9, resulting
    in errors in the VCOM regulator driver.

    The fix is to use the negative values when communicating with the hardware,
    but send only positive values to the regulator core.

    This patch sends the absolute value to the regulator core and transforms
    the received value (from the regulator core) to negative one before sending
    it to hardware.

    Fix device tree to deal with negative voltage regulator values by setting
    min_value = -real_max_value and vice versa. Boards affected:
    - imx6dl-sabresd
    - imx6ull-14x14-ddr3-arm2
    - imx7d-12x12-lpddr3-arm2
    - imx7d-sdb
    - imx6sll-evk
    - imx6sl-evk
    - imx6sll-lpddr3-arm2

    Signed-off-by: Cristina Ciocan
    [Arul: Fix merge conflicts]
    Signed-off-by: Arulpandiyan Vadivel

    Cristina Ciocan
     
  • add 500us enable_time for switch to be stable while turned on.

    Signed-off-by: Robin Gong
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • Add enable/disable support for switch regulator on pfuze100.

    Signed-off-by: Robin Gong
    Signed-off-by: Bai Ping
    (Vipul: Fixed merge conflicts)
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • Actually, m4 only fill the least 1byte, so we'd better clear 'val' before
    reading by rpmsg, thus the gabage data will not bother us.

    Signed-off-by: Robin Gong
    (cherry picked from commit df3428c6588a00fa153a3b6996cc33b21b69efb6)
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • Add off_on_delay for fixed regulator. This can assign the delay time
    between the regulator disable and regulator enable.

    User can define the delay value by using 'off-on-delay' in dts file.

    Signed-off-by: Haibo Chen
    Signed-off-by: Vipul Kumar

    Haibo Chen
     
  • Multi drivers(mmc, cpufreq..) may access pf1550 regulator rpmsg driver at
    the same time, so we have to add mutex for this multi-entry case. Otherwise
    the below kernel warning maybe triggered:

    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 19 at kernel/power/qos.c:453 pf1550_send_message+0x4c/0xf8()
    pm_qos_add_request() called for already added request
    Modules linked in:
    CPU: 0 PID: 19 Comm: kworker/0:1 Not tainted 4.1.33-02293-g80b8c19 #636
    Hardware name: Freescale i.MX7ULP (Device Tree)
    Workqueue: events od_dbs_timer
    [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
    [] (show_stack) from [] (dump_stack+0x88/0x9c)
    [] (dump_stack) from [] (warn_slowpath_common+0x80/0xb0)
    [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x30/0x40)
    [] (warn_slowpath_fmt) from [] (pf1550_send_message+0x4c/0xf8)
    [] (pf1550_send_message) from [] (pf1550_get_voltage+0x48/0x5c)
    [] (pf1550_get_voltage) from [] (_regulator_get_voltage+0x68/0xb4)
    [] (_regulator_get_voltage) from [] (_regulator_do_set_voltage+0x5c/0x3e4)
    [] (_regulator_do_set_voltage) from [] (regulator_set_voltage+0xb0/0x14c)
    [] (regulator_set_voltage) from [] (imx7ulp_set_target+0x178/0x238)
    [] (imx7ulp_set_target) from [] (__cpufreq_driver_target+0x164/0x294)
    [] (__cpufreq_driver_target) from [] (dbs_check_cpu+0x1a0/0x1e0)
    [] (dbs_check_cpu) from [] (od_dbs_timer+0x80/0x138)
    [] (od_dbs_timer) from [] (process_one_work+0x118/0x3e4)
    [] (process_one_work) from [] (worker_thread+0x4c/0x4f4)
    [] (worker_thread) from [] (kthread+0xdc/0xf4)
    [] (kthread) from [] (ret_from_fork+0x14/0x2c)
    ---[ end trace f8281ecde7a0b4ce ]---
    ------------[ cut here ]------------

    Signed-off-by: Robin Gong

    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • update driver since m4 side refine the header structure.

    Signed-off-by: Robin Gong
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • At some systems, the pinctrl setting will be lost or needs to
    set as "sleep" state to save power consumption. So, we need to
    configure pinctrl as "sleep" state when system enters suspend,
    and as "default" state after system resumes. In this way, the
    pinctrl value can be recovered as "default" state after resuming.

    Signed-off-by: Peter Chen
    Signed-off-by: Vipul Kumar

    Peter Chen
     
  • In bypass mode, the anatop digital regulators do not have any minimum
    dropout value (the input voltage is equal to the output voltage according
    to documentation).

    Having a min dropout value of 125mV will lead to an increased voltage
    for PMIC supplies.

    Only set minimum dropout value for ldo enabled mode.

    Signed-off-by: Irina Tirdea
    Signed-off-by: Vipul Kumar

    Irina Tirdea
     
  • When a regulator is in bypass mode it's output is equal to it's supply
    and it can't do any adjustment. Deal with all set_voltage calls by
    propagating them upwards.

    Signed-off-by: Leonard Crestez
    (Vipul: Fixed merge conflicts)
    Signed-off-by: Vipul Kumar

    Leonard Crestez
     
  • It is difficult to understand what's going on inside a single if
    statement so split it into a separate function.

    Signed-off-by: Leonard Crestez
    (Vipul: Fixed merge conflicts)
    Signed-off-by: Vipul Kumar

    Leonard Crestez
     
  • An anatop regulator will return -EPROBE_DEFER when trying to register,
    if it has a supply from PMIC and this supply is not yet registered.
    This does not represent an error since the driver will call probe again
    later, so skip the error message in this case.

    Signed-off-by: Irina Tirdea
    Signed-off-by: Vipul Kumar

    Irina Tirdea
     
  • Sometimes rpmsg callback triggered quickly before reinit_completion, then
    cause "rpmsg_send timeout!". Move reinit_completion to the place before
    rpmsg_send to make sure the completion is ready before callback triggered.

    Signed-off-by: Robin Gong
    (cherry picked from commit 8e44277d3f27e5f46232bd705ee9ef594db42575)
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • Since multi rpmsg instances supported now, we can use the specific rpmsg
    channel name "rpmsg-regulator-channel" instead of
    "rpmsg-openamp-demo-channel".

    Signed-off-by: Robin Gong
    (cherry picked from commit 8a9d73fe43da2833951b428f389aac01aef7cb2a)
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • CLKE bit of MU_CR may bring VLS state mess in M4 side, so use pm_qos
    instead to prevent i.mx7ulp A7 core enter STOP mode during pf1550 send
    command by rpmsg.

    Signed-off-by: Robin Gong
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • According to API definition, Set the voltage for the regulator within the
    range specified, the driver should select the voltage closest to min_uV.

    Signed-off-by: Dong Aisheng
    Signed-off-by: Vipul Kumar

    Dong Aisheng
     
  • add pf1550 regulator rpmsg driver to control pf1550 on the m4 side
    by rpmsg.

    Signed-off-by: Robin Gong
    TODO: checkpatch warnings
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • Add one new regulator events macro 'REGULATOR_EVENT_AFT_DO_ENABLE'.
    1.8v of imx7d pcie phy, should be turned on after
    the 1p0d(1.0v) of pcie phy is turned on.

    Signed-off-by: Richard Zhu
    Signed-off-by: Vipul Kumar

    Richard Zhu
     
  • Do not probe if the device node is not correct in dts.

    Signed-off-by: Robin Gong
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • check OTP_SW2_DVS_ENB bit for the different voltage list while SW2
    regulator registered.

    Signed-off-by: Robin Gong
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • The voltage of LDO1 and LDO3 are not linear, use voltage_table instead,so
    add new ops for them. Meanwhile, correct 12500uV for one step of SW1/SW2
    rather than 125000uV.

    Signed-off-by: Robin Gong
    Signed-off-by: Vipul Kumar

    Robin Gong
     
  • Add basic pf1550 regulator driver.

    Signed-off-by: Robin Gong
    Signed-off-by: Vipul Kumar

    Robin Gong