18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __LINUX_MFD_TPS6586X_H 38c2ecf20Sopenharmony_ci#define __LINUX_MFD_TPS6586X_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_INSTANTLY 0x00 68c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_110UV 0x01 78c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_220UV 0x02 88c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_440UV 0x03 98c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_880UV 0x04 108c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_1760UV 0x05 118c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_3520UV 0x06 128c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_7040UV 0x07 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_SET 0x08 158c2ecf20Sopenharmony_ci#define TPS6586X_SLEW_RATE_MASK 0x07 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* VERSION CRC */ 188c2ecf20Sopenharmony_ci#define TPS658621A 0x15 198c2ecf20Sopenharmony_ci#define TPS658621CD 0x2c 208c2ecf20Sopenharmony_ci#define TPS658623 0x1b 218c2ecf20Sopenharmony_ci#define TPS658624 0x0a 228c2ecf20Sopenharmony_ci#define TPS658640 0x01 238c2ecf20Sopenharmony_ci#define TPS658640v2 0x02 248c2ecf20Sopenharmony_ci#define TPS658643 0x03 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cienum { 278c2ecf20Sopenharmony_ci TPS6586X_ID_SYS, 288c2ecf20Sopenharmony_ci TPS6586X_ID_SM_0, 298c2ecf20Sopenharmony_ci TPS6586X_ID_SM_1, 308c2ecf20Sopenharmony_ci TPS6586X_ID_SM_2, 318c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_0, 328c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_1, 338c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_2, 348c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_3, 358c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_4, 368c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_5, 378c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_6, 388c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_7, 398c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_8, 408c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_9, 418c2ecf20Sopenharmony_ci TPS6586X_ID_LDO_RTC, 428c2ecf20Sopenharmony_ci TPS6586X_ID_MAX_REGULATOR, 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cienum { 468c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_0, 478c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_1, 488c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_2, 498c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_3, 508c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_4, 518c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_5, 528c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_6, 538c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_7, 548c2ecf20Sopenharmony_ci TPS6586X_INT_COMP_DET, 558c2ecf20Sopenharmony_ci TPS6586X_INT_ADC, 568c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_8, 578c2ecf20Sopenharmony_ci TPS6586X_INT_PLDO_9, 588c2ecf20Sopenharmony_ci TPS6586X_INT_PSM_0, 598c2ecf20Sopenharmony_ci TPS6586X_INT_PSM_1, 608c2ecf20Sopenharmony_ci TPS6586X_INT_PSM_2, 618c2ecf20Sopenharmony_ci TPS6586X_INT_PSM_3, 628c2ecf20Sopenharmony_ci TPS6586X_INT_RTC_ALM1, 638c2ecf20Sopenharmony_ci TPS6586X_INT_ACUSB_OVP, 648c2ecf20Sopenharmony_ci TPS6586X_INT_USB_DET, 658c2ecf20Sopenharmony_ci TPS6586X_INT_AC_DET, 668c2ecf20Sopenharmony_ci TPS6586X_INT_BAT_DET, 678c2ecf20Sopenharmony_ci TPS6586X_INT_CHG_STAT, 688c2ecf20Sopenharmony_ci TPS6586X_INT_CHG_TEMP, 698c2ecf20Sopenharmony_ci TPS6586X_INT_PP, 708c2ecf20Sopenharmony_ci TPS6586X_INT_RESUME, 718c2ecf20Sopenharmony_ci TPS6586X_INT_LOW_SYS, 728c2ecf20Sopenharmony_ci TPS6586X_INT_RTC_ALM2, 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistruct tps6586x_settings { 768c2ecf20Sopenharmony_ci int slew_rate; 778c2ecf20Sopenharmony_ci}; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cistruct tps6586x_subdev_info { 808c2ecf20Sopenharmony_ci int id; 818c2ecf20Sopenharmony_ci const char *name; 828c2ecf20Sopenharmony_ci void *platform_data; 838c2ecf20Sopenharmony_ci struct device_node *of_node; 848c2ecf20Sopenharmony_ci}; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cistruct tps6586x_platform_data { 878c2ecf20Sopenharmony_ci int num_subdevs; 888c2ecf20Sopenharmony_ci struct tps6586x_subdev_info *subdevs; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci int gpio_base; 918c2ecf20Sopenharmony_ci int irq_base; 928c2ecf20Sopenharmony_ci bool pm_off; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci struct regulator_init_data *reg_init_data[TPS6586X_ID_MAX_REGULATOR]; 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* 988c2ecf20Sopenharmony_ci * NOTE: the functions below are not intended for use outside 998c2ecf20Sopenharmony_ci * of the TPS6586X sub-device drivers 1008c2ecf20Sopenharmony_ci */ 1018c2ecf20Sopenharmony_ciextern int tps6586x_write(struct device *dev, int reg, uint8_t val); 1028c2ecf20Sopenharmony_ciextern int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val); 1038c2ecf20Sopenharmony_ciextern int tps6586x_read(struct device *dev, int reg, uint8_t *val); 1048c2ecf20Sopenharmony_ciextern int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val); 1058c2ecf20Sopenharmony_ciextern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask); 1068c2ecf20Sopenharmony_ciextern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); 1078c2ecf20Sopenharmony_ciextern int tps6586x_update(struct device *dev, int reg, uint8_t val, 1088c2ecf20Sopenharmony_ci uint8_t mask); 1098c2ecf20Sopenharmony_ciextern int tps6586x_irq_get_virq(struct device *dev, int irq); 1108c2ecf20Sopenharmony_ciextern int tps6586x_get_version(struct device *dev); 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#endif /*__LINUX_MFD_TPS6586X_H */ 113