Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2015 Hans de Goede <hdegoede@redhat.com> |
| 4 | * |
| 5 | * X-Powers AX Power Management IC support header |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 6 | */ |
| 7 | #ifndef _AXP_PMIC_H_ |
Samuel Holland | 02a7707 | 2021-08-22 18:18:03 -0500 | [diff] [blame] | 8 | #define _AXP_PMIC_H_ |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 9 | |
Samuel Holland | 60d4928 | 2021-10-08 00:17:20 -0500 | [diff] [blame] | 10 | #include <stdbool.h> |
| 11 | |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 12 | #include <axp152.h> |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 13 | #include <axp209.h> |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 14 | #include <axp221.h> |
Jernej Skrabec | fde828c | 2021-01-11 21:11:33 +0100 | [diff] [blame] | 15 | #include <axp305.h> |
Chen-Yu Tsai | f1e66e7 | 2016-05-02 10:28:15 +0800 | [diff] [blame] | 16 | #include <axp809.h> |
vishnupatekar | 91bce9c | 2015-11-29 01:07:21 +0800 | [diff] [blame] | 17 | #include <axp818.h> |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 18 | |
Samuel Holland | 60d4928 | 2021-10-08 00:17:20 -0500 | [diff] [blame] | 19 | #define AXP_PMIC_MODE_REG 0x3e |
| 20 | #define AXP_PMIC_MODE_I2C 0x00 |
| 21 | #define AXP_PMIC_MODE_P2WI 0x3e |
Samuel Holland | b348efb | 2021-10-08 00:17:21 -0500 | [diff] [blame] | 22 | #define AXP_PMIC_MODE_RSB 0x7c |
| 23 | |
| 24 | #define AXP_PMIC_PRI_DEVICE_ADDR 0x3a3 |
| 25 | #define AXP_PMIC_PRI_RUNTIME_ADDR 0x2d |
| 26 | #define AXP_PMIC_SEC_DEVICE_ADDR 0x745 |
| 27 | #define AXP_PMIC_SEC_RUNTIME_ADDR 0x3a |
Samuel Holland | 60d4928 | 2021-10-08 00:17:20 -0500 | [diff] [blame] | 28 | |
Samuel Holland | 0aa18bf | 2023-01-21 17:13:04 -0600 | [diff] [blame] | 29 | enum { |
| 30 | AXP152_ID, |
| 31 | AXP202_ID, |
| 32 | AXP209_ID, |
| 33 | AXP221_ID, |
| 34 | AXP223_ID, |
Andre Przywara | 943afa7 | 2023-10-17 14:12:44 +0100 | [diff] [blame] | 35 | AXP313_ID, |
Andre Przywara | caf9f72 | 2024-05-10 00:43:19 +0100 | [diff] [blame] | 36 | AXP717_ID, |
Samuel Holland | 0aa18bf | 2023-01-21 17:13:04 -0600 | [diff] [blame] | 37 | AXP803_ID, |
| 38 | AXP806_ID, |
| 39 | AXP809_ID, |
| 40 | AXP813_ID, |
| 41 | }; |
| 42 | |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 43 | int axp_set_dcdc1(unsigned int mvolt); |
| 44 | int axp_set_dcdc2(unsigned int mvolt); |
| 45 | int axp_set_dcdc3(unsigned int mvolt); |
| 46 | int axp_set_dcdc4(unsigned int mvolt); |
| 47 | int axp_set_dcdc5(unsigned int mvolt); |
| 48 | int axp_set_aldo1(unsigned int mvolt); |
| 49 | int axp_set_aldo2(unsigned int mvolt); |
| 50 | int axp_set_aldo3(unsigned int mvolt); |
| 51 | int axp_set_aldo4(unsigned int mvolt); |
Chen-Yu Tsai | 2e6911f | 2016-01-12 14:42:37 +0800 | [diff] [blame] | 52 | int axp_set_dldo(int dldo_num, unsigned int mvolt); |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 53 | int axp_set_eldo(int eldo_num, unsigned int mvolt); |
Chen-Yu Tsai | d028fba | 2016-03-30 00:26:48 +0800 | [diff] [blame] | 54 | int axp_set_fldo(int fldo_num, unsigned int mvolt); |
Chen-Yu Tsai | 0e3efd3 | 2016-05-02 10:28:12 +0800 | [diff] [blame] | 55 | int axp_set_sw(bool on); |
Hans de Goede | d9ee84b | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 56 | int axp_init(void); |
| 57 | int axp_get_sid(unsigned int *sid); |
| 58 | |
| 59 | #endif |