xref: /rk3399_ARM-atf/plat/mediatek/include/drivers/spmi_api.h (revision cf2df874cd09305ac7282fadb0fef6be597dfffb)
1*adf73ae2SHope Wang /*
2*adf73ae2SHope Wang  * Copyright (c) 2025, MediaTek Inc. All rights reserved.
3*adf73ae2SHope Wang  *
4*adf73ae2SHope Wang  * SPDX-License-Identifier: BSD-3-Clause
5*adf73ae2SHope Wang  */
6*adf73ae2SHope Wang 
7*adf73ae2SHope Wang #ifndef SPMI_API_H
8*adf73ae2SHope Wang #define SPMI_API_H
9*adf73ae2SHope Wang 
10*adf73ae2SHope Wang #include <stdint.h>
11*adf73ae2SHope Wang 
12*adf73ae2SHope Wang #include <drivers/spmi/spmi_common.h>
13*adf73ae2SHope Wang 
14*adf73ae2SHope Wang /* external API */
15*adf73ae2SHope Wang int spmi_register_zero_write(struct spmi_device *dev, uint8_t data);
16*adf73ae2SHope Wang int spmi_register_read(struct spmi_device *dev, uint8_t addr, uint8_t *buf);
17*adf73ae2SHope Wang int spmi_register_write(struct spmi_device *dev, uint8_t addr, uint8_t data);
18*adf73ae2SHope Wang int spmi_ext_register_read(struct spmi_device *dev, uint8_t addr, uint8_t *buf,
19*adf73ae2SHope Wang 			   uint8_t len);
20*adf73ae2SHope Wang int spmi_ext_register_write(struct spmi_device *dev, uint8_t addr,
21*adf73ae2SHope Wang 			    const uint8_t *buf, uint8_t len);
22*adf73ae2SHope Wang int spmi_ext_register_readl(struct spmi_device *dev, uint16_t addr,
23*adf73ae2SHope Wang 			    uint8_t *buf, uint8_t len);
24*adf73ae2SHope Wang int spmi_ext_register_writel(struct spmi_device *dev, uint16_t addr,
25*adf73ae2SHope Wang 			     const uint8_t *buf, uint8_t len);
26*adf73ae2SHope Wang int spmi_ext_register_readl_field(struct spmi_device *dev, uint16_t addr,
27*adf73ae2SHope Wang 				  uint8_t *buf, uint16_t mask, uint16_t shift);
28*adf73ae2SHope Wang int spmi_ext_register_writel_field(struct spmi_device *dev, uint16_t addr,
29*adf73ae2SHope Wang 				   uint8_t data, uint16_t mask, uint16_t shift);
30*adf73ae2SHope Wang struct spmi_device *get_spmi_device(int mstid, int slvid);
31*adf73ae2SHope Wang int spmi_device_register(struct spmi_device *platform_spmi_dev, int num_devs);
32*adf73ae2SHope Wang 
33*adf73ae2SHope Wang #endif
34