blob: 4ac64865831d6b9c00c24b89dc558c978ddbe001 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Hans de Goede6944aff2015-10-03 15:18:33 +02002/*
3 * (C) Copyright 2015 Hans de Goede <hdegoede@redhat.com>
4 *
5 * X-Powers AX Power Management IC support header
Hans de Goede6944aff2015-10-03 15:18:33 +02006 */
7#ifndef _AXP_PMIC_H_
Samuel Holland5b4afbd2021-08-22 18:18:03 -05008#define _AXP_PMIC_H_
Hans de Goede6944aff2015-10-03 15:18:33 +02009
Samuel Holland104950a2021-10-08 00:17:20 -050010#include <stdbool.h>
11
Hans de Goede6944aff2015-10-03 15:18:33 +020012#include <axp152.h>
Hans de Goede6944aff2015-10-03 15:18:33 +020013#include <axp209.h>
Hans de Goede6944aff2015-10-03 15:18:33 +020014#include <axp221.h>
Jernej Skrabecfbd37d82021-01-11 21:11:33 +010015#include <axp305.h>
Chen-Yu Tsai795857d2016-05-02 10:28:15 +080016#include <axp809.h>
vishnupatekar813c7372015-11-29 01:07:21 +080017#include <axp818.h>
Hans de Goede6944aff2015-10-03 15:18:33 +020018
Samuel Holland104950a2021-10-08 00:17:20 -050019#define AXP_PMIC_MODE_REG 0x3e
20#define AXP_PMIC_MODE_I2C 0x00
21#define AXP_PMIC_MODE_P2WI 0x3e
Samuel Holland3227c852021-10-08 00:17:21 -050022#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 Holland104950a2021-10-08 00:17:20 -050028
Samuel Hollanddc1b1d12023-01-21 17:13:04 -060029enum {
30 AXP152_ID,
31 AXP202_ID,
32 AXP209_ID,
33 AXP221_ID,
34 AXP223_ID,
35 AXP803_ID,
36 AXP806_ID,
37 AXP809_ID,
38 AXP813_ID,
39};
40
Hans de Goede6944aff2015-10-03 15:18:33 +020041int axp_set_dcdc1(unsigned int mvolt);
42int axp_set_dcdc2(unsigned int mvolt);
43int axp_set_dcdc3(unsigned int mvolt);
44int axp_set_dcdc4(unsigned int mvolt);
45int axp_set_dcdc5(unsigned int mvolt);
46int axp_set_aldo1(unsigned int mvolt);
47int axp_set_aldo2(unsigned int mvolt);
48int axp_set_aldo3(unsigned int mvolt);
49int axp_set_aldo4(unsigned int mvolt);
Chen-Yu Tsai3517a272016-01-12 14:42:37 +080050int axp_set_dldo(int dldo_num, unsigned int mvolt);
Hans de Goede6944aff2015-10-03 15:18:33 +020051int axp_set_eldo(int eldo_num, unsigned int mvolt);
Chen-Yu Tsai38491d92016-03-30 00:26:48 +080052int axp_set_fldo(int fldo_num, unsigned int mvolt);
Chen-Yu Tsai15278cc2016-05-02 10:28:12 +080053int axp_set_sw(bool on);
Hans de Goede6944aff2015-10-03 15:18:33 +020054int axp_init(void);
55int axp_get_sid(unsigned int *sid);
56
57#endif