mirror of
https://github.com/CTCaer/hekate.git
synced 2024-12-25 15:17:19 +00:00
pmic: Enable Low Battery Shutdown for 2.8V
There's an increasing ammount of users that kill their batteries when forgetting their devices into AutoRCM / RCM mode. This will now force a shutdown the moment the battery reaches 2.8V. Even if device is inside RCM mode. Notice: We might need to increase the limit.
This commit is contained in:
parent
a16b1af698
commit
9811ba53e0
@ -19,9 +19,19 @@
|
|||||||
#define MAX77620_CNFGGLBL1_LBDAC_EN (1 << 7)
|
#define MAX77620_CNFGGLBL1_LBDAC_EN (1 << 7)
|
||||||
#define MAX77620_CNFGGLBL1_MPPLD (1 << 6)
|
#define MAX77620_CNFGGLBL1_MPPLD (1 << 6)
|
||||||
#define MAX77620_CNFGGLBL1_LBHYST ((1 << 5) | (1 << 4))
|
#define MAX77620_CNFGGLBL1_LBHYST ((1 << 5) | (1 << 4))
|
||||||
#define MAX77620_CNFGGLBL1_LBHYST_N (1 << 4)
|
#define MAX77620_CNFGGLBL1_LBHYST_100 (0 << 4)
|
||||||
#define MAX77620_CNFGGLBL1_LBDAC 0x0E
|
#define MAX77620_CNFGGLBL1_LBHYST_200 (1 << 4)
|
||||||
#define MAX77620_CNFGGLBL1_LBDAC_N (1 << 1)
|
#define MAX77620_CNFGGLBL1_LBHYST_300 (2 << 4)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBHYST_400 (3 << 4)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_MASK 0x0E
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_2700 (0 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_2800 (1 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_2900 (2 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3000 (3 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3100 (4 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3200 (5 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3300 (6 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3400 (7 << 1)
|
||||||
#define MAX77620_CNFGGLBL1_LBRSTEN (1 << 0)
|
#define MAX77620_CNFGGLBL1_LBRSTEN (1 << 0)
|
||||||
|
|
||||||
#define MAX77620_REG_CNFGGLBL2 0x01
|
#define MAX77620_REG_CNFGGLBL2 0x01
|
||||||
|
@ -170,6 +170,7 @@ void max77620_config_default()
|
|||||||
|
|
||||||
void max77620_low_battery_monitor_config()
|
void max77620_low_battery_monitor_config()
|
||||||
{
|
{
|
||||||
i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_CNFGGLBL1,
|
_max77620_try_set_reg(MAX77620_REG_CNFGGLBL1,
|
||||||
MAX77620_CNFGGLBL1_LBDAC_EN | MAX77620_CNFGGLBL1_LBHYST_N | MAX77620_CNFGGLBL1_LBDAC_N);
|
MAX77620_CNFGGLBL1_LBDAC_EN | MAX77620_CNFGGLBL1_MPPLD |
|
||||||
|
MAX77620_CNFGGLBL1_LBHYST_200 | MAX77620_CNFGGLBL1_LBDAC_2800);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ void _config_regulators()
|
|||||||
MAX77621_T_JUNCTION_120 | MAX77621_FT_ENABLE | MAX77621_CKKADV_TRIP_75mV_PER_US_HIST_DIS |
|
MAX77621_T_JUNCTION_120 | MAX77621_FT_ENABLE | MAX77621_CKKADV_TRIP_75mV_PER_US_HIST_DIS |
|
||||||
MAX77621_CKKADV_TRIP_150mV_PER_US | MAX77621_INDUCTOR_NOMINAL);
|
MAX77621_CKKADV_TRIP_150mV_PER_US | MAX77621_INDUCTOR_NOMINAL);
|
||||||
|
|
||||||
// Disable low battery shutdown monitor.
|
// Enable low battery shutdown monitor for < 2800mV.
|
||||||
max77620_low_battery_monitor_config();
|
max77620_low_battery_monitor_config();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,19 @@
|
|||||||
#define MAX77620_CNFGGLBL1_LBDAC_EN (1 << 7)
|
#define MAX77620_CNFGGLBL1_LBDAC_EN (1 << 7)
|
||||||
#define MAX77620_CNFGGLBL1_MPPLD (1 << 6)
|
#define MAX77620_CNFGGLBL1_MPPLD (1 << 6)
|
||||||
#define MAX77620_CNFGGLBL1_LBHYST ((1 << 5) | (1 << 4))
|
#define MAX77620_CNFGGLBL1_LBHYST ((1 << 5) | (1 << 4))
|
||||||
#define MAX77620_CNFGGLBL1_LBHYST_N (1 << 4)
|
#define MAX77620_CNFGGLBL1_LBHYST_100 (0 << 4)
|
||||||
#define MAX77620_CNFGGLBL1_LBDAC 0x0E
|
#define MAX77620_CNFGGLBL1_LBHYST_200 (1 << 4)
|
||||||
#define MAX77620_CNFGGLBL1_LBDAC_N (1 << 1)
|
#define MAX77620_CNFGGLBL1_LBHYST_300 (2 << 4)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBHYST_400 (3 << 4)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_MASK 0x0E
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_2700 (0 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_2800 (1 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_2900 (2 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3000 (3 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3100 (4 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3200 (5 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3300 (6 << 1)
|
||||||
|
#define MAX77620_CNFGGLBL1_LBDAC_3400 (7 << 1)
|
||||||
#define MAX77620_CNFGGLBL1_LBRSTEN (1 << 0)
|
#define MAX77620_CNFGGLBL1_LBRSTEN (1 << 0)
|
||||||
|
|
||||||
#define MAX77620_REG_CNFGGLBL2 0x01
|
#define MAX77620_REG_CNFGGLBL2 0x01
|
||||||
|
@ -173,8 +173,9 @@ void max77620_config_default()
|
|||||||
|
|
||||||
void max77620_low_battery_monitor_config()
|
void max77620_low_battery_monitor_config()
|
||||||
{
|
{
|
||||||
i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_CNFGGLBL1,
|
_max77620_try_set_reg(MAX77620_REG_CNFGGLBL1,
|
||||||
MAX77620_CNFGGLBL1_LBDAC_EN | MAX77620_CNFGGLBL1_LBHYST_N | MAX77620_CNFGGLBL1_LBDAC_N);
|
MAX77620_CNFGGLBL1_LBDAC_EN | MAX77620_CNFGGLBL1_MPPLD |
|
||||||
|
MAX77620_CNFGGLBL1_LBHYST_200 | MAX77620_CNFGGLBL1_LBDAC_2800);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC pop_options
|
#pragma GCC pop_options
|
||||||
|
Loading…
Reference in New Issue
Block a user