blob: 4918560267946128349ec929554f56537d3b4cf7 [file] [log] [blame]
/*
* Copyright (C) 2012 Samsung Electronics
* Lukasz Majewski <l.majewski@samsung.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __POWER_CHARGER_H_
#define __POWER_CHARGER_H_
/* Type of available chargers */
enum {
CHARGER_NO = 0,
CHARGER_TA,
CHARGER_USB,
CHARGER_TA_500,
CHARGER_UNKNOWN,
};
enum {
UNKNOWN,
EXT_SOURCE,
CHARGE,
NORMAL,
};
enum {
CHG_STAT_NORMAL = 0,
CHG_STAT_BAT_LOST,
CHG_STAT_CHGR_LOST,
CHG_STAT_ONKEY_BOOT,
CHG_STAT_NOT_READY,
CHG_STAT_ABNORMAL,
};
/*
* belw parameters can be customized in board header file
*
* battery temperature based on NTC resistor, defined
* corresponding resistor value -- Ohm / C degeree.
*/
#ifndef CUSTOMIZE_BAT_NTC_RESISTOR
#define TBAT_NEG_25D 86580 /* -25 */
#define TBAT_NEG_10D 42450 /* -10 */
#define TBAT_NEG_5D 33922 /* -5 */
#define TBAT_NEG_2D 29741 /* -2 */
#define TBAT_0D 27278 /* 0 */
#define TBAT_10D 17958 /* 10 */
#define TBAT_20D 12091 /* 20 */
#define TBAT_30D 8313 /* 30 */
#define TBAT_40D 5827 /* 40 */
#define TBAT_45D 4913 /* 45 */
#define TBAT_55D 3537 /* 55 */
#define TBAT_60D 3020 /* 60 */
#endif
#ifndef LONG_ONKEY_BOOT
#define LONG_ONKEY_BOOT (2)
#endif
#ifndef UBOOT_CHGBOOT_UV
#define UBOOT_CHGBOOT_UV (3600000)
#endif
#ifndef BAT_LOW_UV
#define BAT_LOW_UV (3450000)
#endif
#ifndef BAT_RESISTOR
#define BAT_RESISTOR (60) /* mohm */
#endif
#ifndef BAT_NTC_GPADC
#define BAT_NTC_GPADC (1)
#endif
#ifndef BAT_PRESENT_CURRENT
#define BAT_PRESENT_CURRENT (31)
#endif
#ifndef BAT_PRESENT_CURRENT_SOC
#define BAT_PRESENT_CURRENT_SOC (30)
#endif
#ifndef UDELAY_INTERVAL
#define UDELAY_INTERVAL (600000) /* minus the led/lcd cost */
#endif
#ifndef ONKEY_CHECK_INTERVAL_USEC
#define ONKEY_CHECK_INTERVAL_USEC (30000)
#endif
#ifndef CHARGE_ONE_ROUND_SECS
#define CHARGE_ONE_ROUND_SECS (60)
#endif
#ifndef BACKLIGHT_ON_SEC
#define BACKLIGHT_ON_SEC (5)
#endif
#ifndef DCP_FAST_CHG_CURRENT
#define DCP_FAST_CHG_CURRENT (1500)
#endif
#ifndef SDP_FAST_CHG_CURRENT
#define SDP_FAST_CHG_CURRENT (500)
#endif
#ifndef BACKLIGHT_INIT_ON_SEC
#define BACKLIGHT_INIT_ON_SEC (10)
#endif
#ifndef BAT_DISCHARGE_MIN_UVOLT
#define BAT_DISCHARGE_MIN_UVOLT (3450000)
#endif
#ifndef BAT_TEMP_LOW_THRESHOLD
#define BAT_TEMP_LOW_THRESHOLD (0)
#endif
#ifndef BAT_TEMP_HIGH_THRESHOLD
#define BAT_TEMP_HIGH_THRESHOLD (45)
#endif
#ifndef RECHARGE_LEVEL
#define RECHARGE_LEVEL (98)
#endif
#ifndef PMIC_SLP_CNT_THRESH
#define PMIC_SLP_CNT_THRESH (600)
#endif
#ifndef SOC_INC_INTERVAL
#define SOC_INC_INTERVAL (30)
#endif
#ifndef ONKEY_BOOT_CHECK_USEC
#define ONKEY_BOOT_CHECK_USEC (2 * 1000 * 1000)
#endif
#ifdef CONFIG_BAT_DISP_SSD1306
#include <power/oled_ssd1306.h>
#endif
#include <linux/usb/mv-phy.h>
void lcd_show_bat_charging(int percent);
void lcd_show_bat_soc(int percent);
void lcd_show_no_battery(void);
void lcd_show_mrvl_log(void);
void charger_enable_bat_priority(void);
#endif /* __POWER_CHARGER_H_ */