Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * internal.h  --  Voltage/Current Regulator framework internal code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright 2007, 2008 Wolfson Microelectronics PLC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright 2008 SlimLogic Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Author: Liam Girdwood <lrg@slimlogic.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #ifndef __REGULATOR_INTERNAL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define __REGULATOR_INTERNAL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/suspend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define REGULATOR_STATES_NUM	(PM_SUSPEND_MAX + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) struct regulator_voltage {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	int min_uV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	int max_uV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * struct regulator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * One for each consumer device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * @voltage - a voltage array for each state of runtime, i.e.:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *            PM_SUSPEND_ON
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *            PM_SUSPEND_TO_IDLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *            PM_SUSPEND_STANDBY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *            PM_SUSPEND_MEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *            PM_SUSPEND_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) struct regulator {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	unsigned int always_on:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	unsigned int bypass:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	unsigned int device_link:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	int uA_load;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	unsigned int enable_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	unsigned int deferred_disables;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct regulator_voltage voltage[REGULATOR_STATES_NUM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	const char *supply_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	struct device_attribute dev_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	struct regulator_dev *rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	struct dentry *debugfs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) extern struct class regulator_class;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) static inline struct regulator_dev *dev_to_rdev(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	return container_of(dev, struct regulator_dev, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #ifdef CONFIG_OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) struct regulator_dev *of_find_regulator_by_node(struct device_node *np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 			         const struct regulator_desc *desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 				 struct regulator_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 				 struct device_node **node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) struct regulator_dev *of_parse_coupled_regulator(struct regulator_dev *rdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 						 int index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) int of_get_n_coupled(struct regulator_dev *rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) bool of_check_coupling_data(struct regulator_dev *rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) static inline struct regulator_dev *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) of_find_regulator_by_node(struct device_node *np)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) static inline struct regulator_init_data *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) regulator_of_get_init_data(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 			   const struct regulator_desc *desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 			   struct regulator_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			   struct device_node **node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) static inline struct regulator_dev *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) of_parse_coupled_regulator(struct regulator_dev *rdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			   int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) static inline int of_get_n_coupled(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) static inline bool of_check_coupling_data(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) enum regulator_get_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	NORMAL_GET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	EXCLUSIVE_GET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	OPTIONAL_GET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	MAX_GET_TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct regulator *_regulator_get(struct device *dev, const char *id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 				 enum regulator_get_type get_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #endif