Merge upstream Atmosphere-NX/Atmosphere master

This commit is contained in:
Niklas080208 committed 2026-09-29 21:44:46 +02:00
commit 31d5beb756
223 files changed
+2769 -1401

No files matched your search

@@ -466,12 +466,21 @@ namespace ams::boot {
boot::ShutdownSystem();
}
}
/* On 18.0.0+ i2c shutdown is unconditionally disabled here. */
if (hos::GetVersion() >= hos::Version_18_0_0) {
if (R_FAILED(battery_driver.SetI2cShutdownEnabled(false))) {
boot::ShutdownSystem();
}
}
/* Get the boot reason. */
const auto boot_reason = boot::GetBootReason();
/* Initialize the charger driver. */
if (R_FAILED(charger_driver.Initialize(boot_reason != spl::BootReason_RtcAlarm2)))
if (R_FAILED(charger_driver.Initialize(boot_reason != spl::BootReason_RtcAlarm2))) {
boot::ShutdownSystem();
}
/* Check that the charger input limit is greater than 150 milli-amps. */
{
@@ -481,7 +490,7 @@ namespace ams::boot {
}
if (input_current_limit_ma <= 150) {
charger_driver.SetChargerConfiguration(powctl::ChargerConfiguration_ChargeDisable);
R_DISCARD(charger_driver.SetChargerConfiguration(powctl::ChargerConfiguration_ChargeDisable));
boot::ShutdownSystem();
}
}
+3 -3
View File
@@ -262,10 +262,10 @@ namespace ams::boot {
R_ABORT_UNLESS(i2c::driver::OpenSession(std::addressof(i2c_session), i2c::DeviceCode_Max77620Pmic));
if (g_soc_type == spl::SocType_Mariko) {
WriteI2cRegister(i2c_session, 0x18, 0x3A);
WriteI2cRegister(i2c_session, 0x1F, 0x71);
R_DISCARD(WriteI2cRegister(i2c_session, 0x18, 0x3A));
R_DISCARD(WriteI2cRegister(i2c_session, 0x1F, 0x71));
}
WriteI2cRegister(i2c_session, 0x23, 0xD0);
R_DISCARD(WriteI2cRegister(i2c_session, 0x23, 0xD0));
i2c::driver::CloseSession(i2c_session);
}
@@ -74,11 +74,14 @@ namespace ams::boot {
u8 on_off_1_val = 0;
R_ABORT_UNLESS(ReadI2cRegister(m_i2c_session, std::addressof(on_off_1_val), sizeof(on_off_1_val), std::addressof(on_off_1_addr), sizeof(on_off_1_addr)));
on_off_1_val |= 0x80;
/* Finalize the battery on non-Calcio. */
if (spl::GetHardwareType() != spl::HardwareType::Calcio) {
BatteryDriver battery_driver;
this->FinalizeBattery(battery_driver);
/* 23.0.0+ no longer finalizes the battery on any hardware type. */
if (hos::GetVersion() < hos::Version_23_0_0) {
/* Finalize the battery on non-Calcio. */
if (spl::GetHardwareType() != spl::HardwareType::Calcio) {
BatteryDriver battery_driver;
this->FinalizeBattery(battery_driver);
}
}
/* Actually write the value to trigger shutdown/reset. */
@@ -116,7 +119,7 @@ namespace ams::boot {
desired_shutdown_enabled &= use_desired_shutdown;
if (shutdown_enabled != desired_shutdown_enabled) {
battery_driver.SetI2cShutdownEnabled(desired_shutdown_enabled);
R_DISCARD(battery_driver.SetI2cShutdownEnabled(desired_shutdown_enabled));
}
}