xref: /rk3399_rockchip-uboot/include/power/as3722.h (revision deea211aec45e95cdc4fed006526591fe70abe22)
16173c45bSThierry Reding /*
26173c45bSThierry Reding  * Copyright (C) 2014 NVIDIA Corporation
36173c45bSThierry Reding  *
46173c45bSThierry Reding  * SPDX-License-Identifier: GPL-2.0+
56173c45bSThierry Reding  */
66173c45bSThierry Reding 
76173c45bSThierry Reding #ifndef __POWER_AS3722_H__
86173c45bSThierry Reding #define __POWER_AS3722_H__
96173c45bSThierry Reding 
106173c45bSThierry Reding #include <asm/types.h>
116173c45bSThierry Reding 
126173c45bSThierry Reding #define AS3722_GPIO_OUTPUT_VDDH (1 << 0)
136173c45bSThierry Reding #define AS3722_GPIO_INVERT (1 << 1)
146173c45bSThierry Reding 
15*deea211aSSimon Glass #define AS3722_DEVICE_ID 0x0c
16*deea211aSSimon Glass #define AS3722_SD_VOLTAGE(n) (0x00 + (n))
17*deea211aSSimon Glass #define AS3722_LDO_VOLTAGE(n) (0x10 + (n))
18*deea211aSSimon Glass #define AS3722_SD_CONTROL 0x4d
19*deea211aSSimon Glass #define AS3722_LDO_CONTROL 0x4e
20*deea211aSSimon Glass #define AS3722_ASIC_ID1 0x90
21*deea211aSSimon Glass #define AS3722_ASIC_ID2 0x91
22*deea211aSSimon Glass 
236173c45bSThierry Reding struct udevice;
246173c45bSThierry Reding 
256173c45bSThierry Reding int as3722_init(struct udevice **devp);
266173c45bSThierry Reding int as3722_sd_enable(struct udevice *pmic, unsigned int sd);
276173c45bSThierry Reding int as3722_sd_set_voltage(struct udevice *pmic, unsigned int sd, u8 value);
286173c45bSThierry Reding int as3722_ldo_enable(struct udevice *pmic, unsigned int ldo);
296173c45bSThierry Reding int as3722_ldo_set_voltage(struct udevice *pmic, unsigned int ldo, u8 value);
306173c45bSThierry Reding int as3722_gpio_configure(struct udevice *pmic, unsigned int gpio,
316173c45bSThierry Reding 			  unsigned long flags);
326173c45bSThierry Reding int as3722_gpio_direction_output(struct udevice *pmic, unsigned int gpio,
336173c45bSThierry Reding 				 unsigned int level);
34d55b7d4cSSimon Glass int as3722_read(struct udevice *pmic, u8 reg, u8 *value);
35d55b7d4cSSimon Glass int as3722_write(struct udevice *pmic, u8 reg, u8 value);
36d55b7d4cSSimon Glass int as3722_get(struct udevice **devp);
376173c45bSThierry Reding 
386173c45bSThierry Reding #endif /* __POWER_AS3722_H__ */
39