mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-26 11:42:09 +00:00
Bugfixes
The fan driver change ensures power off in any situation where a chainload software re-enables the 5V regulator.
This commit is contained in:
parent
976925c697
commit
9c6931a17c
6 changed files with 13 additions and 7 deletions
|
@ -1317,7 +1317,7 @@ void ipl_main()
|
||||||
heap_init(IPL_HEAP_START);
|
heap_init(IPL_HEAP_START);
|
||||||
|
|
||||||
#ifdef DEBUG_UART_PORT
|
#ifdef DEBUG_UART_PORT
|
||||||
uart_send(DEBUG_UART_PORT, (u8 *)"Hekate: Hello!\r\n", 16);
|
uart_send(DEBUG_UART_PORT, (u8 *)"hekate: Hello!\r\n", 16);
|
||||||
uart_wait_idle(DEBUG_UART_PORT, UART_TX_IDLE);
|
uart_wait_idle(DEBUG_UART_PORT, UART_TX_IDLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ void nx_emmc_gpt_parse(link_t *gpt, sdmmc_storage_t *storage)
|
||||||
for (u32 i = 0; i < hdr->num_part_ents; i++)
|
for (u32 i = 0; i < hdr->num_part_ents; i++)
|
||||||
{
|
{
|
||||||
gpt_entry_t *ent = (gpt_entry_t *)(buf + (hdr->part_ent_lba - 1) * NX_EMMC_BLOCKSIZE + i * sizeof(gpt_entry_t));
|
gpt_entry_t *ent = (gpt_entry_t *)(buf + (hdr->part_ent_lba - 1) * NX_EMMC_BLOCKSIZE + i * sizeof(gpt_entry_t));
|
||||||
emmc_part_t *part = (emmc_part_t *)malloc(sizeof(emmc_part_t));
|
emmc_part_t *part = (emmc_part_t *)calloc(sizeof(emmc_part_t), 1);
|
||||||
part->lba_start = ent->lba_start;
|
part->lba_start = ent->lba_start;
|
||||||
part->lba_end = ent->lba_end;
|
part->lba_end = ent->lba_end;
|
||||||
part->attrs = ent->attrs;
|
part->attrs = ent->attrs;
|
||||||
|
|
|
@ -300,6 +300,7 @@ static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32
|
||||||
sdFileSector += num;
|
sdFileSector += num;
|
||||||
sparseShouldVerify++;
|
sparseShouldVerify++;
|
||||||
|
|
||||||
|
// Check for cancellation combo.
|
||||||
btn = btn_wait_timeout(0, BTN_VOL_DOWN | BTN_VOL_UP);
|
btn = btn_wait_timeout(0, BTN_VOL_DOWN | BTN_VOL_UP);
|
||||||
if ((btn & BTN_VOL_DOWN) && (btn & BTN_VOL_UP))
|
if ((btn & BTN_VOL_DOWN) && (btn & BTN_VOL_UP))
|
||||||
{
|
{
|
||||||
|
@ -660,6 +661,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_storage_t
|
||||||
bytesWritten = 0;
|
bytesWritten = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for cancellation combo.
|
||||||
btn = btn_wait_timeout(0, BTN_VOL_DOWN | BTN_VOL_UP);
|
btn = btn_wait_timeout(0, BTN_VOL_DOWN | BTN_VOL_UP);
|
||||||
if ((btn & BTN_VOL_DOWN) && (btn & BTN_VOL_UP))
|
if ((btn & BTN_VOL_DOWN) && (btn & BTN_VOL_UP))
|
||||||
{
|
{
|
||||||
|
|
|
@ -400,8 +400,6 @@ void nyx_init_load_res()
|
||||||
h_cfg.rcm_patched = fuse_check_patched_rcm();
|
h_cfg.rcm_patched = fuse_check_patched_rcm();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void pivot_stack(u32 stack_top);
|
|
||||||
|
|
||||||
#if (LV_LOG_PRINTF == 1)
|
#if (LV_LOG_PRINTF == 1)
|
||||||
#include "soc/clock.h"
|
#include "soc/clock.h"
|
||||||
#include "soc/gpio.h"
|
#include "soc/gpio.h"
|
||||||
|
@ -427,7 +425,7 @@ void ipl_main()
|
||||||
clock_enable_uart(UART_B);
|
clock_enable_uart(UART_B);
|
||||||
uart_init(UART_B, 115200);
|
uart_init(UART_B, 115200);
|
||||||
|
|
||||||
uart_send(UART_B, (u8 *)"Hekate-NYX: Hello!\r\n", 20);
|
uart_send(UART_B, (u8 *)"hekate-NYX: Hello!\r\n", 20);
|
||||||
uart_wait_idle(UART_B, UART_TX_IDLE);
|
uart_wait_idle(UART_B, UART_TX_IDLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void nx_emmc_gpt_parse(link_t *gpt, sdmmc_storage_t *storage)
|
||||||
for (u32 i = 0; i < hdr->num_part_ents; i++)
|
for (u32 i = 0; i < hdr->num_part_ents; i++)
|
||||||
{
|
{
|
||||||
gpt_entry_t *ent = (gpt_entry_t *)(buf + (hdr->part_ent_lba - 1) * NX_EMMC_BLOCKSIZE + i * sizeof(gpt_entry_t));
|
gpt_entry_t *ent = (gpt_entry_t *)(buf + (hdr->part_ent_lba - 1) * NX_EMMC_BLOCKSIZE + i * sizeof(gpt_entry_t));
|
||||||
emmc_part_t *part = (emmc_part_t *)malloc(sizeof(emmc_part_t));
|
emmc_part_t *part = (emmc_part_t *)calloc(sizeof(emmc_part_t), 1);
|
||||||
part->lba_start = ent->lba_start;
|
part->lba_start = ent->lba_start;
|
||||||
part->lba_end = ent->lba_end;
|
part->lba_end = ent->lba_end;
|
||||||
part->attrs = ent->attrs;
|
part->attrs = ent->attrs;
|
||||||
|
|
|
@ -37,7 +37,6 @@ void set_fan_duty(u32 duty)
|
||||||
PINMUX_AUX(PINMUX_AUX_CAM1_PWDN) = PINMUX_TRISTATE | PINMUX_INPUT_ENABLE | PINMUX_PULL_UP | 1;
|
PINMUX_AUX(PINMUX_AUX_CAM1_PWDN) = PINMUX_TRISTATE | PINMUX_INPUT_ENABLE | PINMUX_PULL_UP | 1;
|
||||||
gpio_config(GPIO_PORT_S, GPIO_PIN_7, GPIO_MODE_GPIO);
|
gpio_config(GPIO_PORT_S, GPIO_PIN_7, GPIO_MODE_GPIO);
|
||||||
gpio_output_enable(GPIO_PORT_S, GPIO_PIN_7, GPIO_OUTPUT_DISABLE);
|
gpio_output_enable(GPIO_PORT_S, GPIO_PIN_7, GPIO_OUTPUT_DISABLE);
|
||||||
gpio_write(GPIO_PORT_S, GPIO_PIN_7, GPIO_LOW);
|
|
||||||
|
|
||||||
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (1 << 24); // Max PWM to disable fan.
|
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (1 << 24); // Max PWM to disable fan.
|
||||||
|
|
||||||
|
@ -58,12 +57,19 @@ void set_fan_duty(u32 duty)
|
||||||
{
|
{
|
||||||
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (1 << 24); // Bit 24 is absolute 0%.
|
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (1 << 24); // Bit 24 is absolute 0%.
|
||||||
regulator_disable_5v(REGULATOR_5V_FAN);
|
regulator_disable_5v(REGULATOR_5V_FAN);
|
||||||
|
|
||||||
|
// Disable fan.
|
||||||
|
PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) =
|
||||||
|
PINMUX_INPUT_ENABLE | PINMUX_PARKED | PINMUX_TRISTATE | PINMUX_PULL_DOWN; // Set source to PWM1.
|
||||||
}
|
}
|
||||||
else // Set PWM duty.
|
else // Set PWM duty.
|
||||||
{
|
{
|
||||||
// Fan power supply.
|
// Fan power supply.
|
||||||
regulator_enable_5v(REGULATOR_5V_FAN);
|
regulator_enable_5v(REGULATOR_5V_FAN);
|
||||||
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (inv_duty << 16);
|
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (inv_duty << 16);
|
||||||
|
|
||||||
|
// Enable fan.
|
||||||
|
PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) = 1; // Set source to PWM1.
|
||||||
}
|
}
|
||||||
|
|
||||||
curr_duty = duty;
|
curr_duty = duty;
|
||||||
|
|
Loading…
Reference in a new issue