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,28 +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 <vapours.hpp>
#include <stratosphere/gpio/gpio_types.hpp>
#include <stratosphere/gpio/driver/gpio_i_gpio_driver.hpp>
namespace ams::gpio::driver::board::nintendo::nx {
void Initialize(bool enable_interrupt_handlers);
void SetInitialGpioConfig();
void SetInitialWakePinConfig();
}

View File

@@ -1,26 +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 <vapours.hpp>
#include <stratosphere/gpio/gpio_types.hpp>
#include <stratosphere/gpio/driver/gpio_i_gpio_driver.hpp>
namespace ams::gpio::driver {
void Initialize();
void Finalize();
}

View File

@@ -1,35 +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 <vapours.hpp>
#include <stratosphere/gpio/gpio_types.hpp>
#include <stratosphere/gpio/driver/gpio_i_gpio_driver.hpp>
namespace ams::gpio::driver {
void RegisterDriver(IGpioDriver *driver);
void UnregisterDriver(IGpioDriver *driver);
Result RegisterDeviceCode(DeviceCode device_code, Pad *pad);
bool UnregisterDeviceCode(DeviceCode device_code);
void RegisterInterruptHandler(ddsf::IEventHandler *handler);
void UnregisterInterruptHandler(ddsf::IEventHandler *handler);
void SetInitialGpioConfig();
void SetInitialWakePinConfig();
}

View File

@@ -1,75 +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 <vapours.hpp>
#include <stratosphere/gpio/gpio_types.hpp>
#include <stratosphere/ddsf.hpp>
namespace ams::gpio::driver {
class Pad;
class IGpioDriver : public ::ams::ddsf::IDriver {
NON_COPYABLE(IGpioDriver);
NON_MOVEABLE(IGpioDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::gpio::driver::IGpioDriver, ::ams::ddsf::IDriver);
public:
IGpioDriver() : IDriver() { /* ... */ }
virtual ~IGpioDriver() { /* ... */ }
virtual void InitializeDriver() = 0;
virtual void FinalizeDriver() = 0;
virtual Result InitializePad(Pad *pad) = 0;
virtual void FinalizePad(Pad *pad) = 0;
virtual Result GetDirection(Direction *out, Pad *pad) const = 0;
virtual Result SetDirection(Pad *pad, Direction direction) = 0;
virtual Result GetValue(GpioValue *out, Pad *pad) const = 0;
virtual Result SetValue(Pad *pad, GpioValue value) = 0;
virtual Result GetInterruptMode(InterruptMode *out, Pad *pad) const = 0;
virtual Result SetInterruptMode(Pad *pad, InterruptMode mode) = 0;
virtual Result SetInterruptEnabled(Pad *pad, bool en) = 0;
virtual Result GetInterruptStatus(InterruptStatus *out, Pad *pad) = 0;
virtual Result ClearInterruptStatus(Pad *pad) = 0;
virtual os::SdkMutex &GetInterruptControlMutex(const Pad &pad) const = 0;
virtual Result GetDebounceEnabled(bool *out, Pad *pad) const = 0;
virtual Result SetDebounceEnabled(Pad *pad, bool en) = 0;
virtual Result GetDebounceTime(s32 *out_ms, Pad *pad) const = 0;
virtual Result SetDebounceTime(Pad *pad, s32 ms) = 0;
virtual Result GetUnknown22(u32 *out) = 0;
virtual void Unknown23() = 0;
virtual Result SetValueForSleepState(Pad *pad, GpioValue value) = 0;
virtual Result IsWakeEventActive(bool *out, Pad *pad) const = 0;
virtual Result SetWakeEventActiveFlagSetForDebug(Pad *pad, bool en) = 0;
virtual Result SetWakePinDebugMode(WakePinDebugMode mode) = 0;
virtual Result Suspend() = 0;
virtual Result SuspendLow() = 0;
virtual Result Resume() = 0;
virtual Result ResumeLow() = 0;
};
}

View File

@@ -1,61 +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 <vapours.hpp>
#include <stratosphere/gpio/gpio_types.hpp>
#include <stratosphere/ddsf.hpp>
namespace ams::gpio::driver {
class Pad : public ::ams::ddsf::IDevice {
NON_COPYABLE(Pad);
NON_MOVEABLE(Pad);
AMS_DDSF_CASTABLE_TRAITS(ams::gpio::driver::Pad, ::ams::ddsf::IDevice);
private:
int m_pad_number;
bool m_is_interrupt_enabled;
public:
explicit Pad(int pad) : IDevice(true), m_pad_number(pad), m_is_interrupt_enabled(false) { /* ... */ }
Pad() : Pad(0) { /* ... */ }
virtual ~Pad() { /* ... */ }
int GetPadNumber() const {
return m_pad_number;
}
void SetPadNumber(int p) {
m_pad_number = p;
}
bool IsInterruptEnabled() const {
return m_is_interrupt_enabled;
}
void SetInterruptEnabled(bool en) {
m_is_interrupt_enabled = en;
}
bool IsInterruptRequiredForDriver() const {
return this->IsInterruptEnabled() && this->IsAnySessionBoundToInterrupt();
}
bool IsAnySessionBoundToInterrupt() const;
void SignalInterruptBoundEvent();
};
}

View File

@@ -1,45 +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 <vapours.hpp>
#include <stratosphere/gpio/gpio_types.hpp>
namespace ams::gpio::driver {
namespace impl {
constexpr inline size_t GpioPadSessionSize = 0x60;
constexpr inline size_t GpioPadSessionAlign = 8;
struct alignas(GpioPadSessionAlign) GpioPadSessionImplPadded;
}
struct GpioPadSession {
util::TypedStorage<impl::GpioPadSessionImplPadded, impl::GpioPadSessionSize, impl::GpioPadSessionAlign> _impl;
};
Result OpenSession(GpioPadSession *out, DeviceCode device_code, ddsf::AccessMode access_mode);
void CloseSession(GpioPadSession *session);
Result SetDirection(GpioPadSession *session, gpio::Direction direction);
Result GetDirection(gpio::Direction *out, GpioPadSession *session);
Result SetValue(GpioPadSession *session, gpio::GpioValue value);
Result GetValue(gpio::GpioValue *out, GpioPadSession *session);
/* TODO */
}

View File

@@ -1,38 +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 <vapours.hpp>
#include <stratosphere/gpio/gpio_types.hpp>
#include <stratosphere/gpio/driver/gpio_i_gpio_driver.hpp>
#include <stratosphere/gpio/driver/gpio_driver_service_api.hpp>
#include <stratosphere/gpio/driver/gpio_driver_client_api.hpp>
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
#include <stratosphere/gpio/driver/board/nintendo/nx/gpio_driver_api.hpp>
namespace ams::gpio::driver::board {
using namespace ams::gpio::driver::board::nintendo::nx;
}
#else
// TODO: #error "Unknown board for ams::gpio::driver::"
#endif

View File

@@ -1,49 +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 <vapours.hpp>
#include <stratosphere/os.hpp>
namespace ams::gpio::driver::impl {
class EventHolder {
NON_COPYABLE(EventHolder);
NON_MOVEABLE(EventHolder);
private:
os::SystemEventType *m_event;
public:
constexpr EventHolder() : m_event(nullptr) { /* ... */ }
void AttachEvent(os::SystemEventType *event) {
m_event = event;
}
os::SystemEventType *DetachEvent() {
auto ev = m_event;
m_event = nullptr;
return ev;
}
os::SystemEventType *GetSystemEvent() {
return m_event;
}
bool IsBound() const {
return m_event != nullptr;
}
};
}

View File

@@ -1,90 +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 <vapours.hpp>
#include <stratosphere/gpio/gpio_types.hpp>
#include <stratosphere/gpio/driver/gpio_pad_accessor.hpp>
#include <stratosphere/gpio/driver/impl/gpio_event_holder.hpp>
#include <stratosphere/ddsf.hpp>
namespace ams::gpio::driver {
class Pad;
}
namespace ams::gpio::driver::impl {
class PadSessionImpl : public ::ams::ddsf::ISession {
NON_COPYABLE(PadSessionImpl);
NON_MOVEABLE(PadSessionImpl);
AMS_DDSF_CASTABLE_TRAITS(ams::gpio::driver::impl::PadSessionImpl, ::ams::ddsf::ISession);
private:
EventHolder m_event_holder;
private:
Result UpdateDriverInterruptEnabled();
public:
PadSessionImpl() : m_event_holder() { /* ... */ }
~PadSessionImpl() {
this->Close();
}
bool IsInterruptBound() const {
return m_event_holder.IsBound();
}
Result Open(Pad *pad, ddsf::AccessMode access_mode);
void Close();
Result BindInterrupt(os::SystemEventType *event);
void UnbindInterrupt();
Result GetInterruptEnabled(bool *out) const;
Result SetInterruptEnabled(bool en);
void SignalInterruptBoundEvent();
};
static_assert( sizeof(PadSessionImpl) <= GpioPadSessionSize);
static_assert(alignof(PadSessionImpl) <= GpioPadSessionAlign);
struct alignas(GpioPadSessionAlign) GpioPadSessionImplPadded {
PadSessionImpl _impl;
u8 _padding[GpioPadSessionSize - sizeof(PadSessionImpl)];
};
static_assert( sizeof(GpioPadSessionImplPadded) == GpioPadSessionSize);
static_assert(alignof(GpioPadSessionImplPadded) == GpioPadSessionAlign);
ALWAYS_INLINE PadSessionImpl &GetPadSessionImpl(GpioPadSession &session) {
return GetReference(session._impl)._impl;
}
ALWAYS_INLINE const PadSessionImpl &GetPadSessionImpl(const GpioPadSession &session) {
return GetReference(session._impl)._impl;
}
ALWAYS_INLINE PadSessionImpl &GetOpenPadSessionImpl(GpioPadSession &session) {
auto &ref = GetReference(session._impl)._impl;
AMS_ASSERT(ref.IsOpen());
return ref;
}
ALWAYS_INLINE const PadSessionImpl &GetOpenPadSessionImpl(const GpioPadSession &session) {
const auto &ref = GetReference(session._impl)._impl;
AMS_ASSERT(ref.IsOpen());
return ref;
}
}