344df3ca2c
A single DM-based driver should be able to support some feature for several PMIC variants where the interface is the same. For example, all PMIC variants use the same register bit to trigger poweroff. However, currently only definitions for a single PMIC are available at a time. This requires drivers to use #ifdefs and different indentifiers for each variant they support. Let's simplify this by making register definitions for all variants available from the header. Then no preprocessor conditions are needed; the driver can use the register definition from any variant that supports the relevant feature. An exception is the GPIO-related definitions, which do not use unique identifiers. So for now, keep them like before. They will be cleaned up along with the GPIO driver. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* (C) Copyright 2015 Hans de Goede <hdegoede@redhat.com>
|
|
*
|
|
* X-Powers AX Power Management IC support header
|
|
*/
|
|
#ifndef _AXP_PMIC_H_
|
|
#define _AXP_PMIC_H_
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <axp152.h>
|
|
#include <axp209.h>
|
|
#include <axp221.h>
|
|
#include <axp305.h>
|
|
#include <axp809.h>
|
|
#include <axp818.h>
|
|
|
|
#define AXP_PMIC_MODE_REG 0x3e
|
|
#define AXP_PMIC_MODE_I2C 0x00
|
|
#define AXP_PMIC_MODE_P2WI 0x3e
|
|
#define AXP_PMIC_MODE_RSB 0x7c
|
|
|
|
#define AXP_PMIC_PRI_DEVICE_ADDR 0x3a3
|
|
#define AXP_PMIC_PRI_RUNTIME_ADDR 0x2d
|
|
#define AXP_PMIC_SEC_DEVICE_ADDR 0x745
|
|
#define AXP_PMIC_SEC_RUNTIME_ADDR 0x3a
|
|
|
|
int axp_set_dcdc1(unsigned int mvolt);
|
|
int axp_set_dcdc2(unsigned int mvolt);
|
|
int axp_set_dcdc3(unsigned int mvolt);
|
|
int axp_set_dcdc4(unsigned int mvolt);
|
|
int axp_set_dcdc5(unsigned int mvolt);
|
|
int axp_set_aldo1(unsigned int mvolt);
|
|
int axp_set_aldo2(unsigned int mvolt);
|
|
int axp_set_aldo3(unsigned int mvolt);
|
|
int axp_set_aldo4(unsigned int mvolt);
|
|
int axp_set_dldo(int dldo_num, unsigned int mvolt);
|
|
int axp_set_eldo(int eldo_num, unsigned int mvolt);
|
|
int axp_set_fldo(int fldo_num, unsigned int mvolt);
|
|
int axp_set_sw(bool on);
|
|
int axp_init(void);
|
|
int axp_get_sid(unsigned int *sid);
|
|
|
|
#endif
|