1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* Copyright (C) 2018 ROHM Semiconductors */ 2 /* Copyright (C) 2018 ROHM Semiconductors */ 3 3 4 #ifndef __LINUX_MFD_ROHM_H__ 4 #ifndef __LINUX_MFD_ROHM_H__ 5 #define __LINUX_MFD_ROHM_H__ 5 #define __LINUX_MFD_ROHM_H__ 6 6 7 #include <linux/regmap.h> 7 #include <linux/regmap.h> 8 #include <linux/regulator/driver.h> 8 #include <linux/regulator/driver.h> 9 9 10 enum rohm_chip_type { 10 enum rohm_chip_type { 11 ROHM_CHIP_TYPE_BD9571, !! 11 ROHM_CHIP_TYPE_BD71837 = 0, 12 ROHM_CHIP_TYPE_BD9573, << 13 ROHM_CHIP_TYPE_BD9574, << 14 ROHM_CHIP_TYPE_BD9576, << 15 ROHM_CHIP_TYPE_BD71815, << 16 ROHM_CHIP_TYPE_BD71828, << 17 ROHM_CHIP_TYPE_BD71837, << 18 ROHM_CHIP_TYPE_BD71847, 12 ROHM_CHIP_TYPE_BD71847, 19 ROHM_CHIP_TYPE_BD96801, !! 13 ROHM_CHIP_TYPE_BD70528, >> 14 ROHM_CHIP_TYPE_BD71828, 20 ROHM_CHIP_TYPE_AMOUNT 15 ROHM_CHIP_TYPE_AMOUNT 21 }; 16 }; 22 17 23 struct rohm_regmap_dev { 18 struct rohm_regmap_dev { 24 struct device *dev; 19 struct device *dev; 25 struct regmap *regmap; 20 struct regmap *regmap; 26 }; 21 }; 27 22 28 #define ROHM_DVS_LEVEL_RUN BIT(0) !! 23 enum { 29 #define ROHM_DVS_LEVEL_IDLE BIT(1) !! 24 ROHM_DVS_LEVEL_UNKNOWN, 30 #define ROHM_DVS_LEVEL_SUSPEND BIT(2) !! 25 ROHM_DVS_LEVEL_RUN, 31 #define ROHM_DVS_LEVEL_LPSR BIT(3) !! 26 ROHM_DVS_LEVEL_IDLE, 32 #define ROHM_DVS_LEVEL_SNVS BIT(4) !! 27 ROHM_DVS_LEVEL_SUSPEND, 33 #define ROHM_DVS_LEVEL_VALID_AMOUNT 5 !! 28 ROHM_DVS_LEVEL_LPSR, 34 #define ROHM_DVS_LEVEL_UNKNOWN 0 !! 29 ROHM_DVS_LEVEL_MAX = ROHM_DVS_LEVEL_LPSR, >> 30 }; 35 31 36 /** 32 /** 37 * struct rohm_dvs_config - dynamic voltage sc 33 * struct rohm_dvs_config - dynamic voltage scaling register descriptions 38 * 34 * 39 * @level_map: bitmap representing su 35 * @level_map: bitmap representing supported run-levels for this 40 * regulator 36 * regulator 41 * @run_reg: register address for r 37 * @run_reg: register address for regulator config at 'run' state 42 * @run_mask: value mask for regulat 38 * @run_mask: value mask for regulator voltages at 'run' state 43 * @run_on_mask: enable mask for regula 39 * @run_on_mask: enable mask for regulator at 'run' state 44 * @idle_reg: register address for r 40 * @idle_reg: register address for regulator config at 'idle' state 45 * @idle_mask: value mask for regulat 41 * @idle_mask: value mask for regulator voltages at 'idle' state 46 * @idle_on_mask: enable mask for regula 42 * @idle_on_mask: enable mask for regulator at 'idle' state 47 * @suspend_reg: register address for r 43 * @suspend_reg: register address for regulator config at 'suspend' state 48 * @suspend_mask: value mask for regulat 44 * @suspend_mask: value mask for regulator voltages at 'suspend' state 49 * @suspend_on_mask: enable mask for regula 45 * @suspend_on_mask: enable mask for regulator at 'suspend' state 50 * @lpsr_reg: register address for r 46 * @lpsr_reg: register address for regulator config at 'lpsr' state 51 * @lpsr_mask: value mask for regulat 47 * @lpsr_mask: value mask for regulator voltages at 'lpsr' state 52 * @lpsr_on_mask: enable mask for regula 48 * @lpsr_on_mask: enable mask for regulator at 'lpsr' state 53 * 49 * 54 * Description of ROHM PMICs voltage configura 50 * Description of ROHM PMICs voltage configuration registers for different 55 * system states. This is used to correctly co 51 * system states. This is used to correctly configure the PMIC at startup 56 * based on values read from DT. 52 * based on values read from DT. 57 */ 53 */ 58 struct rohm_dvs_config { 54 struct rohm_dvs_config { 59 uint64_t level_map; 55 uint64_t level_map; 60 unsigned int run_reg; 56 unsigned int run_reg; 61 unsigned int run_mask; 57 unsigned int run_mask; 62 unsigned int run_on_mask; 58 unsigned int run_on_mask; 63 unsigned int idle_reg; 59 unsigned int idle_reg; 64 unsigned int idle_mask; 60 unsigned int idle_mask; 65 unsigned int idle_on_mask; 61 unsigned int idle_on_mask; 66 unsigned int suspend_reg; 62 unsigned int suspend_reg; 67 unsigned int suspend_mask; 63 unsigned int suspend_mask; 68 unsigned int suspend_on_mask; 64 unsigned int suspend_on_mask; 69 unsigned int lpsr_reg; 65 unsigned int lpsr_reg; 70 unsigned int lpsr_mask; 66 unsigned int lpsr_mask; 71 unsigned int lpsr_on_mask; 67 unsigned int lpsr_on_mask; 72 unsigned int snvs_reg; << 73 unsigned int snvs_mask; << 74 unsigned int snvs_on_mask; << 75 }; 68 }; 76 69 77 #if IS_ENABLED(CONFIG_REGULATOR_ROHM) 70 #if IS_ENABLED(CONFIG_REGULATOR_ROHM) 78 int rohm_regulator_set_dvs_levels(const struct 71 int rohm_regulator_set_dvs_levels(const struct rohm_dvs_config *dvs, 79 struct devic 72 struct device_node *np, 80 const struct 73 const struct regulator_desc *desc, 81 struct regma 74 struct regmap *regmap); 82 75 83 int rohm_regulator_set_voltage_sel_restricted( !! 76 #else 84 !! 77 static inline int rohm_regulator_set_dvs_levels(const struct rohm_dvs_config *dvs, >> 78 struct device_node *np, >> 79 const struct regulator_desc *desc, >> 80 struct regmap *regmap) >> 81 { >> 82 return 0; >> 83 } 85 #endif 84 #endif 86 85 87 #endif 86 #endif 88 87
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.