Revert "hoc-clk: add live vdd2, live boost clock and basic pwm dimming"

This reverts commit 15b7df8ef1.
This commit is contained in:
souldbminersmwc
2025-11-09 16:14:52 -05:00
parent 22ec140738
commit 21a3f953d7
3804 changed files with 435 additions and 570162 deletions

View File

@@ -1,36 +0,0 @@
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "i2c_server_manager_impl.hpp"
namespace ams::i2c::server {
namespace {
ams::sf::UnmanagedServiceObject<i2c::sf::IManager, i2c::server::ManagerImpl> g_manager_impl;
ams::sf::UnmanagedServiceObject<i2c::sf::IManager, i2c::server::ManagerImpl> g_pcv_manager_impl;
}
ams::sf::SharedPointer<i2c::sf::IManager> GetServiceObject() {
return g_manager_impl.GetShared();
}
ams::sf::SharedPointer<i2c::sf::IManager> GetServiceObjectPowerBus() {
return g_pcv_manager_impl.GetShared();
}
}

View File

@@ -1,64 +0,0 @@
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "i2c_server_manager_impl.hpp"
namespace ams::i2c::server {
ManagerImpl::ManagerImpl() {
m_heap_handle = lmem::CreateExpHeap(m_heap_buffer, sizeof(m_heap_buffer), lmem::CreateOption_None);
m_allocator.Attach(m_heap_handle);
}
ManagerImpl::~ManagerImpl() {
lmem::DestroyExpHeap(m_heap_handle);
}
Result ManagerImpl::OpenSessionForDev(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, s32 bus_idx, u16 slave_address, i2c::AddressingMode addressing_mode, i2c::SpeedMode speed_mode) {
/* TODO */
AMS_UNUSED(out, bus_idx, slave_address, addressing_mode, speed_mode);
AMS_ABORT();
}
Result ManagerImpl::OpenSession(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, i2c::I2cDevice device) {
R_RETURN(this->OpenSession2(out, ConvertToDeviceCode(device)));
}
Result ManagerImpl::HasDevice(ams::sf::Out<bool> out, i2c::I2cDevice device) {
/* TODO */
AMS_UNUSED(out, device);
AMS_ABORT();
}
Result ManagerImpl::HasDeviceForDev(ams::sf::Out<bool> out, i2c::I2cDevice device) {
/* TODO */
AMS_UNUSED(out, device);
AMS_ABORT();
}
Result ManagerImpl::OpenSession2(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, DeviceCode device_code) {
/* Allocate a session. */
auto session = Factory::CreateSharedEmplaced<i2c::sf::ISession, SessionImpl>(std::addressof(m_allocator), this);
/* Open the session. */
R_TRY(session.GetImpl().OpenSession(device_code));
/* We succeeded. */
*out = std::move(session);
R_SUCCEED();
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stratosphere.hpp>
#include "i2c_server_session_impl.hpp"
namespace ams::i2c::server {
class ManagerImpl {
private:
using Allocator = ams::sf::ExpHeapAllocator;
using Factory = ams::sf::ObjectFactory<Allocator::Policy>;
private:
lmem::HeapHandle m_heap_handle;
Allocator m_allocator;
u8 m_heap_buffer[4_KB];
public:
ManagerImpl();
~ManagerImpl();
public:
/* Actual commands. */
Result OpenSessionForDev(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, s32 bus_idx, u16 slave_address, i2c::AddressingMode addressing_mode, i2c::SpeedMode speed_mode);
Result OpenSession(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, i2c::I2cDevice device);
Result HasDevice(ams::sf::Out<bool> out, i2c::I2cDevice device);
Result HasDeviceForDev(ams::sf::Out<bool> out, i2c::I2cDevice device);
Result OpenSession2(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, DeviceCode device_code);
};
static_assert(i2c::sf::IsIManager<ManagerImpl>);
}

View File

@@ -1,76 +0,0 @@
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stratosphere.hpp>
namespace ams::i2c::server {
class ManagerImpl;
class SessionImpl {
private:
ManagerImpl *m_parent; /* NOTE: this is an sf::SharedPointer<> in Nintendo's code. */
i2c::driver::I2cSession m_internal_session;
bool m_has_session;
public:
explicit SessionImpl(ManagerImpl *p) : m_parent(p), m_has_session(false) { /* ... */ }
~SessionImpl() {
if (m_has_session) {
i2c::driver::CloseSession(m_internal_session);
}
}
Result OpenSession(DeviceCode device_code) {
AMS_ABORT_UNLESS(!m_has_session);
R_TRY(i2c::driver::OpenSession(std::addressof(m_internal_session), device_code));
m_has_session = true;
R_SUCCEED();
}
public:
/* Actual commands. */
Result SendOld(const ams::sf::InBuffer &in_data, i2c::TransactionOption option) {
R_RETURN(i2c::driver::Send(m_internal_session, in_data.GetPointer(), in_data.GetSize(), option));
}
Result ReceiveOld(const ams::sf::OutBuffer &out_data, i2c::TransactionOption option) {
R_RETURN(i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), m_internal_session, option));
}
Result ExecuteCommandListOld(const ams::sf::OutBuffer &rcv_buf, const ams::sf::InPointerArray<i2c::I2cCommand> &command_list){
R_RETURN(i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), m_internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand)));
}
Result Send(const ams::sf::InAutoSelectBuffer &in_data, i2c::TransactionOption option) {
R_RETURN(i2c::driver::Send(m_internal_session, in_data.GetPointer(), in_data.GetSize(), option));
}
Result Receive(const ams::sf::OutAutoSelectBuffer &out_data, i2c::TransactionOption option) {
R_RETURN(i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), m_internal_session, option));
}
Result ExecuteCommandList(const ams::sf::OutAutoSelectBuffer &rcv_buf, const ams::sf::InPointerArray<i2c::I2cCommand> &command_list) {
R_RETURN(i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), m_internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand)));
}
Result SetRetryPolicy(s32 max_retry_count, s32 retry_interval_us) {
R_RETURN(i2c::driver::SetRetryPolicy(m_internal_session, max_retry_count, retry_interval_us));
}
};
static_assert(i2c::sf::IsISession<SessionImpl>);
}