mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-29 13:02:09 +00:00
bdk: fan: add Hoag and Aula SKUs support
Now that what was hanging Aula is found (using PWM with its clock disabled), add full support for fan control on both SKUs.
This commit is contained in:
parent
58a2094448
commit
4a1cb1f2ea
1 changed files with 17 additions and 7 deletions
|
@ -18,8 +18,11 @@
|
||||||
|
|
||||||
#include <thermal/fan.h>
|
#include <thermal/fan.h>
|
||||||
#include <power/regulator_5v.h>
|
#include <power/regulator_5v.h>
|
||||||
|
#include <soc/bpmp.h>
|
||||||
|
#include <soc/clock.h>
|
||||||
#include <soc/fuse.h>
|
#include <soc/fuse.h>
|
||||||
#include <soc/gpio.h>
|
#include <soc/gpio.h>
|
||||||
|
#include <soc/hw_init.h>
|
||||||
#include <soc/pinmux.h>
|
#include <soc/pinmux.h>
|
||||||
#include <soc/t210.h>
|
#include <soc/t210.h>
|
||||||
#include <utils/util.h>
|
#include <utils/util.h>
|
||||||
|
@ -37,19 +40,26 @@ void set_fan_duty(u32 duty)
|
||||||
|
|
||||||
curr_duty = duty;
|
curr_duty = duty;
|
||||||
|
|
||||||
//! TODO: Add HOAG/AULA support.
|
|
||||||
u32 hw_type = fuse_read_hw_type();
|
|
||||||
if (hw_type != FUSE_NX_HW_TYPE_ICOSA &&
|
|
||||||
hw_type != FUSE_NX_HW_TYPE_IOWA)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!fan_init)
|
if (!fan_init)
|
||||||
{
|
{
|
||||||
// Fan tachometer.
|
// Fan tachometer.
|
||||||
PINMUX_AUX(PINMUX_AUX_CAM1_PWDN) = PINMUX_TRISTATE | PINMUX_INPUT_ENABLE | PINMUX_PULL_UP | 1;
|
u32 pull_resistor = hw_get_chip_id() == GP_HIDREV_MAJOR_T210 ? PINMUX_PULL_UP : 0;
|
||||||
|
PINMUX_AUX(PINMUX_AUX_CAM1_PWDN) = PINMUX_TRISTATE | PINMUX_INPUT_ENABLE | pull_resistor | 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);
|
||||||
|
|
||||||
|
// Enable PWM if disabled.
|
||||||
|
if (fuse_read_hw_type() == FUSE_NX_HW_TYPE_AULA)
|
||||||
|
{
|
||||||
|
// Ease the stress to APB.
|
||||||
|
bpmp_freq_t prev_fid = bpmp_clk_rate_set(BPMP_CLK_NORMAL);
|
||||||
|
|
||||||
|
clock_enable_pwm();
|
||||||
|
|
||||||
|
// Restore OC.
|
||||||
|
bpmp_clk_rate_set(prev_fid);
|
||||||
|
}
|
||||||
|
|
||||||
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (0x100 << 16); // Max PWM to disable fan.
|
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (0x100 << 16); // Max PWM to disable fan.
|
||||||
|
|
||||||
PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) = 1; // Set source to PWM1.
|
PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) = 1; // Set source to PWM1.
|
||||||
|
|
Loading…
Reference in a new issue