Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Hans de Goede | 6944aff | 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 | 6944aff | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 6 | */ |
| 7 | #ifndef _AXP_PMIC_H_ |
| 8 | |
Samuel Holland | 104950a | 2021-10-08 00:17:20 -0500 | [diff] [blame] | 9 | #include <stdbool.h> |
| 10 | |
Hans de Goede | 6944aff | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 11 | #ifdef CONFIG_AXP152_POWER |
| 12 | #include <axp152.h> |
| 13 | #endif |
| 14 | #ifdef CONFIG_AXP209_POWER |
| 15 | #include <axp209.h> |
| 16 | #endif |
| 17 | #ifdef CONFIG_AXP221_POWER |
| 18 | #include <axp221.h> |
| 19 | #endif |
Jernej Skrabec | fbd37d8 | 2021-01-11 21:11:33 +0100 | [diff] [blame] | 20 | #ifdef CONFIG_AXP305_POWER |
| 21 | #include <axp305.h> |
| 22 | #endif |
Chen-Yu Tsai | 795857d | 2016-05-02 10:28:15 +0800 | [diff] [blame] | 23 | #ifdef CONFIG_AXP809_POWER |
| 24 | #include <axp809.h> |
| 25 | #endif |
vishnupatekar | 813c737 | 2015-11-29 01:07:21 +0800 | [diff] [blame] | 26 | #ifdef CONFIG_AXP818_POWER |
| 27 | #include <axp818.h> |
| 28 | #endif |
Hans de Goede | 6944aff | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 29 | |
Samuel Holland | 104950a | 2021-10-08 00:17:20 -0500 | [diff] [blame] | 30 | #define AXP_PMIC_MODE_REG 0x3e |
| 31 | #define AXP_PMIC_MODE_I2C 0x00 |
| 32 | #define AXP_PMIC_MODE_P2WI 0x3e |
Samuel Holland | 3227c85 | 2021-10-08 00:17:21 -0500 | [diff] [blame] | 33 | #define AXP_PMIC_MODE_RSB 0x7c |
| 34 | |
| 35 | #define AXP_PMIC_PRI_DEVICE_ADDR 0x3a3 |
| 36 | #define AXP_PMIC_PRI_RUNTIME_ADDR 0x2d |
| 37 | #define AXP_PMIC_SEC_DEVICE_ADDR 0x745 |
| 38 | #define AXP_PMIC_SEC_RUNTIME_ADDR 0x3a |
Samuel Holland | 104950a | 2021-10-08 00:17:20 -0500 | [diff] [blame] | 39 | |
Hans de Goede | 6944aff | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 40 | int axp_set_dcdc1(unsigned int mvolt); |
| 41 | int axp_set_dcdc2(unsigned int mvolt); |
| 42 | int axp_set_dcdc3(unsigned int mvolt); |
| 43 | int axp_set_dcdc4(unsigned int mvolt); |
| 44 | int axp_set_dcdc5(unsigned int mvolt); |
| 45 | int axp_set_aldo1(unsigned int mvolt); |
| 46 | int axp_set_aldo2(unsigned int mvolt); |
| 47 | int axp_set_aldo3(unsigned int mvolt); |
| 48 | int axp_set_aldo4(unsigned int mvolt); |
Chen-Yu Tsai | 3517a27 | 2016-01-12 14:42:37 +0800 | [diff] [blame] | 49 | int axp_set_dldo(int dldo_num, unsigned int mvolt); |
Hans de Goede | 6944aff | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 50 | int axp_set_eldo(int eldo_num, unsigned int mvolt); |
Chen-Yu Tsai | 38491d9 | 2016-03-30 00:26:48 +0800 | [diff] [blame] | 51 | int axp_set_fldo(int fldo_num, unsigned int mvolt); |
Chen-Yu Tsai | 15278cc | 2016-05-02 10:28:12 +0800 | [diff] [blame] | 52 | int axp_set_sw(bool on); |
Hans de Goede | 6944aff | 2015-10-03 15:18:33 +0200 | [diff] [blame] | 53 | int axp_init(void); |
| 54 | int axp_get_sid(unsigned int *sid); |
| 55 | |
| 56 | #endif |