~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/regulator/coupler.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * coupler.h -- SoC Regulator support, coupler API.
  4  *
  5  * Regulator Coupler Interface.
  6  */
  7 
  8 #ifndef __LINUX_REGULATOR_COUPLER_H_
  9 #define __LINUX_REGULATOR_COUPLER_H_
 10 
 11 #include <linux/kernel.h>
 12 #include <linux/suspend.h>
 13 
 14 struct regulator_coupler;
 15 struct regulator_dev;
 16 
 17 /**
 18  * struct regulator_coupler - customized regulator's coupler
 19  *
 20  * Regulator's coupler allows to customize coupling algorithm.
 21  *
 22  * @list: couplers list entry
 23  * @attach_regulator: Callback invoked on creation of a coupled regulator,
 24  *                    couples are unresolved at this point. The callee should
 25  *                    check that it could handle the regulator and return 0 on
 26  *                    success, -errno on failure and 1 if given regulator is
 27  *                    not suitable for this coupler (case of having multiple
 28  *                    regulators in a system). Callback shall be implemented.
 29  * @detach_regulator: Callback invoked on destruction of a coupled regulator.
 30  *                    This callback is optional and could be NULL.
 31  * @balance_voltage: Callback invoked when voltage of a coupled regulator is
 32  *                   changing. Called with all of the coupled rdev's being held
 33  *                   under "consumer lock". The callee should perform voltage
 34  *                   balancing, changing voltage of the coupled regulators as
 35  *                   needed. It's up to the coupler to verify the voltage
 36  *                   before changing it in hardware, i.e. coupler should
 37  *                   check consumer's min/max and etc. This callback is
 38  *                   optional and could be NULL, in which case a generic
 39  *                   voltage balancer will be used.
 40  */
 41 struct regulator_coupler {
 42         struct list_head list;
 43 
 44         int (*attach_regulator)(struct regulator_coupler *coupler,
 45                                 struct regulator_dev *rdev);
 46         int (*detach_regulator)(struct regulator_coupler *coupler,
 47                                 struct regulator_dev *rdev);
 48         int (*balance_voltage)(struct regulator_coupler *coupler,
 49                                struct regulator_dev *rdev,
 50                                suspend_state_t state);
 51 };
 52 
 53 #ifdef CONFIG_REGULATOR
 54 int regulator_coupler_register(struct regulator_coupler *coupler);
 55 int regulator_check_consumers(struct regulator_dev *rdev,
 56                               int *min_uV, int *max_uV,
 57                               suspend_state_t state);
 58 int regulator_check_voltage(struct regulator_dev *rdev,
 59                             int *min_uV, int *max_uV);
 60 int regulator_get_voltage_rdev(struct regulator_dev *rdev);
 61 int regulator_set_voltage_rdev(struct regulator_dev *rdev,
 62                                int min_uV, int max_uV,
 63                                suspend_state_t state);
 64 int regulator_do_balance_voltage(struct regulator_dev *rdev,
 65                                  suspend_state_t state, bool skip_coupled);
 66 #else
 67 static inline int regulator_coupler_register(struct regulator_coupler *coupler)
 68 {
 69         return 0;
 70 }
 71 static inline int regulator_check_consumers(struct regulator_dev *rdev,
 72                                             int *min_uV, int *max_uV,
 73                                             suspend_state_t state)
 74 {
 75         return -EINVAL;
 76 }
 77 static inline int regulator_check_voltage(struct regulator_dev *rdev,
 78                                           int *min_uV, int *max_uV)
 79 {
 80         return -EINVAL;
 81 }
 82 static inline int regulator_get_voltage_rdev(struct regulator_dev *rdev)
 83 {
 84         return -EINVAL;
 85 }
 86 static inline int regulator_set_voltage_rdev(struct regulator_dev *rdev,
 87                                              int min_uV, int max_uV,
 88                                              suspend_state_t state)
 89 {
 90         return -EINVAL;
 91 }
 92 static inline int regulator_do_balance_voltage(struct regulator_dev *rdev,
 93                                                suspend_state_t state,
 94                                                bool skip_coupled)
 95 {
 96         return -EINVAL;
 97 }
 98 #endif
 99 
100 #endif
101 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php