SmartAudio/lichee/linux-4.9/drivers/power/supply/axp/axp20x/axp20x-charger.h

100 lines
3.9 KiB
C
Executable File

/*
* drivers/power/axp/axp20x/axp20x-charger.h
* (C) Copyright 2010-2016
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
* Pannan <pannan@allwinnertech.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
*/
#ifndef AXP20X_CHARGER_H
#define AXP20X_CHARGER_H
#include "axp20x.h"
#define AXP20X_CHARGE_STATUS AXP20X_STATUS
#define AXP20X_IN_CHARGE (1 << 6)
#define AXP20X_PDBC (0x32)
#define AXP20X_CHARGE_CONTROL1 AXP20X_CHARGE1
#define AXP20X_CHARGER_ENABLE (1 << 7)
#define AXP20X_CHARGE_CONTROL2 AXP20X_CHARGE2
#define AXP20X_CHARGE_VBUS AXP20X_IPS_SET
#define AXP20X_CAP (0xB9)
#define AXP20X_RDC0 (0xba)
#define AXP20X_RDC1 (0xbb)
#define AXP20X_FAULT_LOG1 AXP20X_MODE_CHGSTATUS
#define AXP20X_FAULT_LOG_CHA_CUR_LOW (1 << 2)
#define AXP20X_FAULT_LOG_BATINACT (1 << 3)
#define AXP20X_FAULT_LOG_OVER_TEMP (1 << 7)
#define AXP20X_FAULT_LOG2 AXP20X_INTSTS2
#define AXP20X_FAULT_LOG_COLD (1 << 0)
#define AXP20X_FINISH_CHARGE (1 << 2)
#define AXP20X_COULOMB_CONTROL AXP20X_COULOMB_CTL
#define AXP20X_COULOMB_ENABLE (1 << 7)
#define AXP20X_COULOMB_SUSPEND (1 << 6)
#define AXP20X_COULOMB_CLEAR (1 << 5)
#define AXP20X_ADC_CONTROL1 AXP20X_ADC_EN1
#define AXP20X_ADC_BATVOL_ENABLE (1 << 7)
#define AXP20X_ADC_BATCUR_ENABLE (1 << 6)
#define AXP20X_ADC_DCINVOL_ENABLE (1 << 5)
#define AXP20X_ADC_DCINCUR_ENABLE (1 << 4)
#define AXP20X_ADC_USBVOL_ENABLE (1 << 3)
#define AXP20X_ADC_USBCUR_ENABLE (1 << 2)
#define AXP20X_ADC_APSVOL_ENABLE (1 << 1)
#define AXP20X_ADC_TSVOL_ENABLE (1 << 0)
#define AXP20X_ADC_INTERTEM_ENABLE (1 << 7)
#define AXP20X_ADC_GPIO0_ENABLE (1 << 3)
#define AXP20X_ADC_GPIO1_ENABLE (1 << 2)
#define AXP20X_ADC_CONTROL3 (AXP20X_ADC_ADC_SPEED)
#define AXP20X_VACH_RES (0x56)
#define AXP20X_IACH_RES (0x58)
#define AXP20X_VUSBH_RES (0x5A)
#define AXP20X_IUSBH_RES (0x5C)
#define AXP20X_TICH_RES (0x5E)
#define AXP20X_VBATH_RES (0x78)
#define AXP20X_IBATH_REG (0x7a)
#define AXP20X_DISIBATH_REG (0x7c)
#define AXP20X_VTS_RES (0x62)
#define AXP20_VGPIO0H_RES (0x64)
#define AXP20_VGPIO1H_RES (0x66)
#define AXP20X_INTTEMP (0x5E)
#define AXP20X_DATA_BUFFER0 AXP20X_BUFFER1
#define AXP20X_DATA_BUFFER1 AXP20X_BUFFER2
#define AXP20X_DATA_BUFFER2 AXP20X_BUFFER3
#define AXP20X_DATA_BUFFER3 AXP20X_BUFFER4
#define AXP20X_DATA_BUFFER4 AXP20X_BUFFER5
#define AXP20X_DATA_BUFFER5 AXP20X_BUFFER6
#define AXP20X_DATA_BUFFER6 AXP20X_BUFFER7
#define AXP20X_DATA_BUFFER7 AXP20X_BUFFER8
#define AXP20X_DATA_BUFFER8 AXP20X_BUFFER9
#define AXP20X_DATA_BUFFER9 AXP20X_BUFFERA
#define AXP20X_DATA_BUFFERA AXP20X_BUFFERB
#define AXP20X_DATA_BUFFERB AXP20X_BUFFERC
#define AXP20X_OCV_BASE (0xC0)
#define AXP_CHG_ATTR(_name) \
{ \
.attr = { .name = #_name, .mode = 0644 }, \
.show = _name##_show, \
.store = _name##_store, \
}
#define AXP20X_VOL_MAX 1 /* capability buffer length */
#define AXP20X_TIME_MAX 20
#define AXP20X_AVER_MAX 10
#define AXP20X_RDC_COUNT 10
#endif /* AXP20X_CHARGER_H */