1. 06 1月, 2022 1 次提交
    • K
      regulator: qcom_smd: Align probe function with rpmh-regulator · 14e2976f
      Konrad Dybcio 提交于
      The RPMh regulator driver is much newer and gets more attention, which in
      consequence makes it do a few things better. Update qcom_smd-regulator's
      probe function to mimic what rpmh-regulator does to address a couple of
      issues:
      
      - Probe defer now works correctly, before it used to, well,
        kinda just die.. This fixes reliable probing on (at least) PM8994,
        because Linux apparently cannot deal with supply map dependencies yet..
      
      - Regulator data is now matched more sanely: regulator data is matched
        against each individual regulator node name and throwing an -EINVAL if
        data is missing, instead of just assuming everything is fine and
        iterating over all subsequent array members.
      
      - status = "disabled" will now work for disabling individual regulators in
        DT. Previously it didn't seem to do much if anything at all.
      Signed-off-by: NKonrad Dybcio <konrad.dybcio@somainline.org>
      Link: https://lore.kernel.org/r/20211230023442.1123424-1-konrad.dybcio@somainline.orgSigned-off-by: NMark Brown <broonie@kernel.org>
      14e2976f
  2. 04 1月, 2022 1 次提交
  3. 24 12月, 2021 1 次提交
  4. 16 12月, 2021 1 次提交
  5. 14 12月, 2021 1 次提交
  6. 01 12月, 2021 1 次提交
  7. 30 11月, 2021 2 次提交
  8. 29 11月, 2021 1 次提交
  9. 26 11月, 2021 1 次提交
  10. 24 11月, 2021 1 次提交
  11. 18 11月, 2021 2 次提交
  12. 16 11月, 2021 1 次提交
  13. 23 10月, 2021 3 次提交
  14. 21 10月, 2021 5 次提交
  15. 17 10月, 2021 1 次提交
  16. 09 10月, 2021 1 次提交
    • K
      regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled · b16bef60
      Krzysztof Kozlowski 提交于
      The driver and its bindings, before commit 04f9f068 ("regulator:
      s5m8767: Modify parsing method of the voltage table of buck2/3/4") were
      requiring to provide at least one safe/default voltage for DVS registers
      if DVS GPIO is not being enabled.
      
      IOW, if s5m8767,pmic-buck2-uses-gpio-dvs is missing, the
      s5m8767,pmic-buck2-dvs-voltage should still be present and contain one
      voltage.
      
      This requirement was coming from driver behavior matching this condition
      (none of DVS GPIO is enabled): it was always initializing the DVS
      selector pins to 0 and keeping the DVS enable setting at reset value
      (enabled).  Therefore if none of DVS GPIO is enabled in devicetree,
      driver was configuring the first DVS voltage for buck[234].
      
      Mentioned commit 04f9f068 ("regulator: s5m8767: Modify parsing
      method of the voltage table of buck2/3/4") broke it because DVS voltage
      won't be parsed from devicetree if DVS GPIO is not enabled.  After the
      change, driver will configure bucks to use the register reset value as
      voltage which might have unpleasant effects.
      
      Fix this by relaxing the bindings constrain: if DVS GPIO is not enabled
      in devicetree (therefore DVS voltage is also not parsed), explicitly
      disable it.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 04f9f068 ("regulator: s5m8767: Modify parsing method of the voltage table of buck2/3/4")
      Signed-off-by: NKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Message-Id: <20211008113723.134648-2-krzysztof.kozlowski@canonical.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      b16bef60
  17. 05 10月, 2021 1 次提交
  18. 04 10月, 2021 1 次提交
  19. 02 10月, 2021 1 次提交
  20. 30 9月, 2021 1 次提交
  21. 27 9月, 2021 2 次提交
  22. 20 9月, 2021 1 次提交
  23. 17 9月, 2021 2 次提交
    • M
      kernel/locking: Add context to ww_mutex_trylock() · 12235da8
      Maarten Lankhorst 提交于
      i915 will soon gain an eviction path that trylock a whole lot of locks
      for eviction, getting dmesg failures like below:
      
        BUG: MAX_LOCK_DEPTH too low!
        turning off the locking correctness validator.
        depth: 48  max: 48!
        48 locks held by i915_selftest/5776:
         #0: ffff888101a79240 (&dev->mutex){....}-{3:3}, at: __driver_attach+0x88/0x160
         #1: ffffc900009778c0 (reservation_ww_class_acquire){+.+.}-{0:0}, at: i915_vma_pin.constprop.63+0x39/0x1b0 [i915]
         #2: ffff88800cf74de8 (reservation_ww_class_mutex){+.+.}-{3:3}, at: i915_vma_pin.constprop.63+0x5f/0x1b0 [i915]
         #3: ffff88810c7f9e38 (&vm->mutex/1){+.+.}-{3:3}, at: i915_vma_pin_ww+0x1c4/0x9d0 [i915]
         #4: ffff88810bad5768 (reservation_ww_class_mutex){+.+.}-{3:3}, at: i915_gem_evict_something+0x110/0x860 [i915]
         #5: ffff88810bad60e8 (reservation_ww_class_mutex){+.+.}-{3:3}, at: i915_gem_evict_something+0x110/0x860 [i915]
        ...
         #46: ffff88811964d768 (reservation_ww_class_mutex){+.+.}-{3:3}, at: i915_gem_evict_something+0x110/0x860 [i915]
         #47: ffff88811964e0e8 (reservation_ww_class_mutex){+.+.}-{3:3}, at: i915_gem_evict_something+0x110/0x860 [i915]
        INFO: lockdep is turned off.
      
      Fixing eviction to nest into ww_class_acquire is a high priority, but
      it requires a rework of the entire driver, which can only be done one
      step at a time.
      
      As an intermediate solution, add an acquire context to
      ww_mutex_trylock, which allows us to do proper nesting annotations on
      the trylocks, making the above lockdep splat disappear.
      
      This is also useful in regulator_lock_nested, which may avoid dropping
      regulator_nesting_mutex in the uncontended path, so use it there.
      
      TTM may be another user for this, where we could lock a buffer in a
      fastpath with list locks held, without dropping all locks we hold.
      
      [peterz: rework actual ww_mutex_trylock() implementations]
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/YUBGPdDDjKlxAuXJ@hirez.programming.kicks-ass.net
      12235da8
    • K
      regulator: max14577: Revert "regulator: max14577: Add proper module aliases strings" · dc966059
      Krzysztof Kozlowski 提交于
      This reverts commit 0da6736e.
      
      The MODULE_DEVICE_TABLE already creates proper alias.  Having another
      MODULE_ALIAS causes the alias to be duplicated:
      
        $ modinfo max14577-regulator.ko
      
        alias:          platform:max77836-regulator
        alias:          platform:max14577-regulator
        description:    Maxim 14577/77836 regulator driver
        alias:          platform:max77836-regulator
        alias:          platform:max14577-regulator
      
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Fixes: 0da6736e ("regulator: max14577: Add proper module aliases strings")
      Signed-off-by: NKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
      Tested-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Link: https://lore.kernel.org/r/20210916144102.120980-1-krzysztof.kozlowski@canonical.comSigned-off-by: NMark Brown <broonie@kernel.org>
      dc966059
  24. 15 9月, 2021 1 次提交
  25. 13 9月, 2021 4 次提交
  26. 02 9月, 2021 1 次提交
  27. 25 8月, 2021 1 次提交
    • C
      regulator: vctrl: Avoid lockdep warning in enable/disable ops · 21e39809
      Chen-Yu Tsai 提交于
      vctrl_enable() and vctrl_disable() call regulator_enable() and
      regulator_disable(), respectively. However, vctrl_* are regulator ops
      and should not be calling the locked regulator APIs. Doing so results in
      a lockdep warning.
      
      Instead of exporting more internal regulator ops, model the ctrl supply
      as an actual supply to vctrl-regulator. At probe time this driver still
      needs to use the consumer API to fetch its constraints, but otherwise
      lets the regulator core handle the upstream supply for it.
      
      The enable/disable/is_enabled ops are not removed, but now only track
      state internally. This preserves the original behavior with the ops
      being available, but one could argue that the original behavior was
      already incorrect: the internal state would not match the upstream
      supply if that supply had another consumer that enabled the supply,
      while vctrl-regulator was not enabled.
      
      The lockdep warning is as follows:
      
      	WARNING: possible circular locking dependency detected
      	5.14.0-rc6 #2 Not tainted
      	------------------------------------------------------
      	swapper/0/1 is trying to acquire lock:
      	ffffffc011306d00 (regulator_list_mutex){+.+.}-{3:3}, at:
      		regulator_lock_dependent (arch/arm64/include/asm/current.h:19
      					  include/linux/ww_mutex.h:111
      					  drivers/regulator/core.c:329)
      
      	but task is already holding lock:
      	ffffff8004a77160 (regulator_ww_class_mutex){+.+.}-{3:3}, at:
      		regulator_lock_recursive (drivers/regulator/core.c:156
      					  drivers/regulator/core.c:263)
      
      	which lock already depends on the new lock.
      
      	the existing dependency chain (in reverse order) is:
      
      	-> #2 (regulator_ww_class_mutex){+.+.}-{3:3}:
      	__mutex_lock_common (include/asm-generic/atomic-instrumented.h:606
      			     include/asm-generic/atomic-long.h:29
      			     kernel/locking/mutex.c:103
      			     kernel/locking/mutex.c:144
      			     kernel/locking/mutex.c:963)
      	ww_mutex_lock (kernel/locking/mutex.c:1199)
      	regulator_lock_recursive (drivers/regulator/core.c:156
      				  drivers/regulator/core.c:263)
      	regulator_lock_dependent (drivers/regulator/core.c:343)
      	regulator_enable (drivers/regulator/core.c:2808)
      	set_machine_constraints (drivers/regulator/core.c:1536)
      	regulator_register (drivers/regulator/core.c:5486)
      	devm_regulator_register (drivers/regulator/devres.c:196)
      	reg_fixed_voltage_probe (drivers/regulator/fixed.c:289)
      	platform_probe (drivers/base/platform.c:1427)
      	[...]
      
      	-> #1 (regulator_ww_class_acquire){+.+.}-{0:0}:
      	regulator_lock_dependent (include/linux/ww_mutex.h:129
      				  drivers/regulator/core.c:329)
      	regulator_enable (drivers/regulator/core.c:2808)
      	set_machine_constraints (drivers/regulator/core.c:1536)
      	regulator_register (drivers/regulator/core.c:5486)
      	devm_regulator_register (drivers/regulator/devres.c:196)
      	reg_fixed_voltage_probe (drivers/regulator/fixed.c:289)
      	[...]
      
      	-> #0 (regulator_list_mutex){+.+.}-{3:3}:
      	__lock_acquire (kernel/locking/lockdep.c:3052 (discriminator 4)
      			kernel/locking/lockdep.c:3174 (discriminator 4)
      			kernel/locking/lockdep.c:3789 (discriminator 4)
      			kernel/locking/lockdep.c:5015 (discriminator 4))
      	lock_acquire (arch/arm64/include/asm/percpu.h:39
      		      kernel/locking/lockdep.c:438
      		      kernel/locking/lockdep.c:5627)
      	__mutex_lock_common (include/asm-generic/atomic-instrumented.h:606
      			     include/asm-generic/atomic-long.h:29
      			     kernel/locking/mutex.c:103
      			     kernel/locking/mutex.c:144
      			     kernel/locking/mutex.c:963)
      	mutex_lock_nested (kernel/locking/mutex.c:1125)
      	regulator_lock_dependent (arch/arm64/include/asm/current.h:19
      				  include/linux/ww_mutex.h:111
      				  drivers/regulator/core.c:329)
      	regulator_enable (drivers/regulator/core.c:2808)
      	vctrl_enable (drivers/regulator/vctrl-regulator.c:400)
      	_regulator_do_enable (drivers/regulator/core.c:2617)
      	_regulator_enable (drivers/regulator/core.c:2764)
      	regulator_enable (drivers/regulator/core.c:308
      			  drivers/regulator/core.c:2809)
      	_set_opp (drivers/opp/core.c:819 drivers/opp/core.c:1072)
      	dev_pm_opp_set_rate (drivers/opp/core.c:1164)
      	set_target (drivers/cpufreq/cpufreq-dt.c:62)
      	__cpufreq_driver_target (drivers/cpufreq/cpufreq.c:2216
      				 drivers/cpufreq/cpufreq.c:2271)
      	cpufreq_online (drivers/cpufreq/cpufreq.c:1488 (discriminator 2))
      	cpufreq_add_dev (drivers/cpufreq/cpufreq.c:1563)
      	subsys_interface_register (drivers/base/bus.c:?)
      	cpufreq_register_driver (drivers/cpufreq/cpufreq.c:2819)
      	dt_cpufreq_probe (drivers/cpufreq/cpufreq-dt.c:344)
      	[...]
      
      	other info that might help us debug this:
      
      	Chain exists of:
      	  regulator_list_mutex --> regulator_ww_class_acquire --> regulator_ww_class_mutex
      
      	 Possible unsafe locking scenario:
      
      	       CPU0                    CPU1
      	       ----                    ----
      	  lock(regulator_ww_class_mutex);
      				       lock(regulator_ww_class_acquire);
      				       lock(regulator_ww_class_mutex);
      	  lock(regulator_list_mutex);
      
      	 *** DEADLOCK ***
      
      	6 locks held by swapper/0/1:
      	#0: ffffff8002d32188 (&dev->mutex){....}-{3:3}, at:
      		__device_driver_lock (drivers/base/dd.c:1030)
      	#1: ffffffc0111a0520 (cpu_hotplug_lock){++++}-{0:0}, at:
      		cpufreq_register_driver (drivers/cpufreq/cpufreq.c:2792 (discriminator 2))
      	#2: ffffff8002a8d918 (subsys mutex#9){+.+.}-{3:3}, at:
      		subsys_interface_register (drivers/base/bus.c:1033)
      	#3: ffffff800341bb90 (&policy->rwsem){+.+.}-{3:3}, at:
      		cpufreq_online (include/linux/bitmap.h:285
      				include/linux/cpumask.h:405
      				drivers/cpufreq/cpufreq.c:1399)
      	#4: ffffffc011f0b7b8 (regulator_ww_class_acquire){+.+.}-{0:0}, at:
      		regulator_enable (drivers/regulator/core.c:2808)
      	#5: ffffff8004a77160 (regulator_ww_class_mutex){+.+.}-{3:3}, at:
      		regulator_lock_recursive (drivers/regulator/core.c:156
      		drivers/regulator/core.c:263)
      
      	stack backtrace:
      	CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.14.0-rc6 #2 7c8f8996d021ed0f65271e6aeebf7999de74a9fa
      	Hardware name: Google Scarlet (DT)
      	Call trace:
      	dump_backtrace (arch/arm64/kernel/stacktrace.c:161)
      	show_stack (arch/arm64/kernel/stacktrace.c:218)
      	dump_stack_lvl (lib/dump_stack.c:106 (discriminator 2))
      	dump_stack (lib/dump_stack.c:113)
      	print_circular_bug (kernel/locking/lockdep.c:?)
      	check_noncircular (kernel/locking/lockdep.c:?)
      	__lock_acquire (kernel/locking/lockdep.c:3052 (discriminator 4)
      			kernel/locking/lockdep.c:3174 (discriminator 4)
      			kernel/locking/lockdep.c:3789 (discriminator 4)
      			kernel/locking/lockdep.c:5015 (discriminator 4))
      	lock_acquire (arch/arm64/include/asm/percpu.h:39
      		      kernel/locking/lockdep.c:438
      		      kernel/locking/lockdep.c:5627)
      	__mutex_lock_common (include/asm-generic/atomic-instrumented.h:606
      			     include/asm-generic/atomic-long.h:29
      			     kernel/locking/mutex.c:103
      			     kernel/locking/mutex.c:144
      			     kernel/locking/mutex.c:963)
      	mutex_lock_nested (kernel/locking/mutex.c:1125)
      	regulator_lock_dependent (arch/arm64/include/asm/current.h:19
      				  include/linux/ww_mutex.h:111
      				  drivers/regulator/core.c:329)
      	regulator_enable (drivers/regulator/core.c:2808)
      	vctrl_enable (drivers/regulator/vctrl-regulator.c:400)
      	_regulator_do_enable (drivers/regulator/core.c:2617)
      	_regulator_enable (drivers/regulator/core.c:2764)
      	regulator_enable (drivers/regulator/core.c:308
      			  drivers/regulator/core.c:2809)
      	_set_opp (drivers/opp/core.c:819 drivers/opp/core.c:1072)
      	dev_pm_opp_set_rate (drivers/opp/core.c:1164)
      	set_target (drivers/cpufreq/cpufreq-dt.c:62)
      	__cpufreq_driver_target (drivers/cpufreq/cpufreq.c:2216
      				 drivers/cpufreq/cpufreq.c:2271)
      	cpufreq_online (drivers/cpufreq/cpufreq.c:1488 (discriminator 2))
      	cpufreq_add_dev (drivers/cpufreq/cpufreq.c:1563)
      	subsys_interface_register (drivers/base/bus.c:?)
      	cpufreq_register_driver (drivers/cpufreq/cpufreq.c:2819)
      	dt_cpufreq_probe (drivers/cpufreq/cpufreq-dt.c:344)
      	[...]
      Reported-by: NBrian Norris <briannorris@chromium.org>
      Fixes: f8702f9e ("regulator: core: Use ww_mutex for regulators locking")
      Fixes: e9153311 ("regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage")
      Signed-off-by: NChen-Yu Tsai <wenst@chromium.org>
      Link: https://lore.kernel.org/r/20210825033704.3307263-3-wenst@chromium.orgSigned-off-by: NMark Brown <broonie@kernel.org>
      21e39809