mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 03:11:16 +00:00
bdk: rename exec_cfg to reg_write_array
And cfg_op_t to reg_cfg_t.
This commit is contained in:
parent
320b91a767
commit
4fef1890aa
4 changed files with 60 additions and 59 deletions
|
@ -448,19 +448,19 @@ void display_init()
|
||||||
clock_enable_plld(3, 20, true, tegra_t210);
|
clock_enable_plld(3, 20, true, tegra_t210);
|
||||||
|
|
||||||
// Setup Display Interface initial window configuration.
|
// Setup Display Interface initial window configuration.
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_dc_setup_win_config, ARRAY_SIZE(_di_dc_setup_win_config));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_dc_setup_win_config, ARRAY_SIZE(_di_dc_setup_win_config));
|
||||||
|
|
||||||
// Setup dsi init sequence packets.
|
// Setup dsi init sequence packets.
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_init_config0, ARRAY_SIZE(_di_dsi_init_config0));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_init_config0, ARRAY_SIZE(_di_dsi_init_config0));
|
||||||
DSI(_DSIREG(tegra_t210 ? DSI_INIT_SEQ_DATA_15 : DSI_INIT_SEQ_DATA_15_B01)) = 0;
|
DSI(_DSIREG(tegra_t210 ? DSI_INIT_SEQ_DATA_15 : DSI_INIT_SEQ_DATA_15_B01)) = 0;
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_init_config1, ARRAY_SIZE(_di_dsi_init_config1));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_init_config1, ARRAY_SIZE(_di_dsi_init_config1));
|
||||||
|
|
||||||
// Reset pad trimmers for T210B01.
|
// Reset pad trimmers for T210B01.
|
||||||
if (!tegra_t210)
|
if (!tegra_t210)
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_init_pads_t210b01, ARRAY_SIZE(_di_dsi_init_pads_t210b01));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_init_pads_t210b01, ARRAY_SIZE(_di_dsi_init_pads_t210b01));
|
||||||
|
|
||||||
// Setup init sequence packets, timings and power on DSI.
|
// Setup init sequence packets, timings and power on DSI.
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_init_config2, ARRAY_SIZE(_di_dsi_init_config2));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_init_config2, ARRAY_SIZE(_di_dsi_init_config2));
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
|
|
||||||
// Enable LCD Reset.
|
// Enable LCD Reset.
|
||||||
|
@ -530,7 +530,7 @@ void display_init()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PANEL_JDI_XXX062M:
|
case PANEL_JDI_XXX062M:
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_panel_init_config_jdi, ARRAY_SIZE(_di_dsi_panel_init_config_jdi));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_panel_init_config_jdi, ARRAY_SIZE(_di_dsi_panel_init_config_jdi));
|
||||||
_display_dsi_send_cmd(MIPI_DSI_DCS_SHORT_WRITE, MIPI_DCS_EXIT_SLEEP_MODE, 180000);
|
_display_dsi_send_cmd(MIPI_DSI_DCS_SHORT_WRITE, MIPI_DCS_EXIT_SLEEP_MODE, 180000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -571,18 +571,18 @@ void display_init()
|
||||||
clock_enable_plld(1, 24, false, tegra_t210);
|
clock_enable_plld(1, 24, false, tegra_t210);
|
||||||
|
|
||||||
// Finalize DSI init packet sequence configuration.
|
// Finalize DSI init packet sequence configuration.
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_init_seq_pkt_final_config, ARRAY_SIZE(_di_dsi_init_seq_pkt_final_config));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_init_seq_pkt_final_config, ARRAY_SIZE(_di_dsi_init_seq_pkt_final_config));
|
||||||
|
|
||||||
// Set 1-by-1 pixel/clock and pixel clock to 234 / 3 = 78 MHz. For 60 Hz refresh rate.
|
// Set 1-by-1 pixel/clock and pixel clock to 234 / 3 = 78 MHz. For 60 Hz refresh rate.
|
||||||
DISPLAY_A(_DIREG(DC_DISP_DISP_CLOCK_CONTROL)) = PIXEL_CLK_DIVIDER_PCD1 | SHIFT_CLK_DIVIDER(4); // 4: div3.
|
DISPLAY_A(_DIREG(DC_DISP_DISP_CLOCK_CONTROL)) = PIXEL_CLK_DIVIDER_PCD1 | SHIFT_CLK_DIVIDER(4); // 4: div3.
|
||||||
|
|
||||||
// Set DSI mode.
|
// Set DSI mode.
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_mode_config, ARRAY_SIZE(_di_dsi_mode_config));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_mode_config, ARRAY_SIZE(_di_dsi_mode_config));
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
|
|
||||||
// Calibrate display communication pads.
|
// Calibrate display communication pads.
|
||||||
const u32 loops = tegra_t210 ? 1 : 2; // Calibrate pads 2 times on T210B01.
|
const u32 loops = tegra_t210 ? 1 : 2; // Calibrate pads 2 times on T210B01.
|
||||||
exec_cfg((u32 *)MIPI_CAL_BASE, _di_mipi_pad_cal_config, ARRAY_SIZE(_di_mipi_pad_cal_config));
|
reg_write_array((u32 *)MIPI_CAL_BASE, _di_mipi_pad_cal_config, ARRAY_SIZE(_di_mipi_pad_cal_config));
|
||||||
for (u32 i = 0; i < loops; i++)
|
for (u32 i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
// Set MIPI bias pad config.
|
// Set MIPI bias pad config.
|
||||||
|
@ -592,22 +592,22 @@ void display_init()
|
||||||
// Set pad trimmers and set MIPI DSI cal offsets.
|
// Set pad trimmers and set MIPI DSI cal offsets.
|
||||||
if (tegra_t210)
|
if (tegra_t210)
|
||||||
{
|
{
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_pad_cal_config_t210, ARRAY_SIZE(_di_dsi_pad_cal_config_t210));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_pad_cal_config_t210, ARRAY_SIZE(_di_dsi_pad_cal_config_t210));
|
||||||
exec_cfg((u32 *)MIPI_CAL_BASE, _di_mipi_dsi_cal_offsets_config_t210, ARRAY_SIZE(_di_mipi_dsi_cal_offsets_config_t210));
|
reg_write_array((u32 *)MIPI_CAL_BASE, _di_mipi_dsi_cal_offsets_config_t210, ARRAY_SIZE(_di_mipi_dsi_cal_offsets_config_t210));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_pad_cal_config_t210b01, ARRAY_SIZE(_di_dsi_pad_cal_config_t210b01));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_pad_cal_config_t210b01, ARRAY_SIZE(_di_dsi_pad_cal_config_t210b01));
|
||||||
exec_cfg((u32 *)MIPI_CAL_BASE, _di_mipi_dsi_cal_offsets_config_t210b01, ARRAY_SIZE(_di_mipi_dsi_cal_offsets_config_t210b01));
|
reg_write_array((u32 *)MIPI_CAL_BASE, _di_mipi_dsi_cal_offsets_config_t210b01, ARRAY_SIZE(_di_mipi_dsi_cal_offsets_config_t210b01));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset all MIPI cal offsets and start calibration.
|
// Reset all MIPI cal offsets and start calibration.
|
||||||
exec_cfg((u32 *)MIPI_CAL_BASE, _di_mipi_start_dsi_cal_config, ARRAY_SIZE(_di_mipi_start_dsi_cal_config));
|
reg_write_array((u32 *)MIPI_CAL_BASE, _di_mipi_start_dsi_cal_config, ARRAY_SIZE(_di_mipi_start_dsi_cal_config));
|
||||||
}
|
}
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
|
|
||||||
// Enable video display controller.
|
// Enable video display controller.
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_dc_video_enable_config, ARRAY_SIZE(_di_dc_video_enable_config));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_dc_video_enable_config, ARRAY_SIZE(_di_dc_video_enable_config));
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_backlight_pwm_init()
|
void display_backlight_pwm_init()
|
||||||
|
@ -718,7 +718,7 @@ static void _display_panel_and_hw_end(bool no_panel_deinit)
|
||||||
DSI(_DSIREG(DSI_VIDEO_MODE_CONTROL)) = 0;
|
DSI(_DSIREG(DSI_VIDEO_MODE_CONTROL)) = 0;
|
||||||
|
|
||||||
// De-initialize video controller.
|
// De-initialize video controller.
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_dc_video_disable_config, ARRAY_SIZE(_di_dc_video_disable_config));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_dc_video_disable_config, ARRAY_SIZE(_di_dc_video_disable_config));
|
||||||
|
|
||||||
// Set DISP1 clock source, parent clock and DSI/PCLK to low power mode.
|
// Set DISP1 clock source, parent clock and DSI/PCLK to low power mode.
|
||||||
// T210: DIVM: 1, DIVN: 20, DIVP: 3. PLLD_OUT: 100.0 MHz, PLLD_OUT0 (DSI-PCLK): 50.0 MHz. (PCLK: 16.66 MHz)
|
// T210: DIVM: 1, DIVN: 20, DIVP: 3. PLLD_OUT: 100.0 MHz, PLLD_OUT0 (DSI-PCLK): 50.0 MHz. (PCLK: 16.66 MHz)
|
||||||
|
@ -726,7 +726,7 @@ static void _display_panel_and_hw_end(bool no_panel_deinit)
|
||||||
clock_enable_plld(3, 20, true, hw_get_chip_id() == GP_HIDREV_MAJOR_T210);
|
clock_enable_plld(3, 20, true, hw_get_chip_id() == GP_HIDREV_MAJOR_T210);
|
||||||
|
|
||||||
// Set timings for lowpower clocks.
|
// Set timings for lowpower clocks.
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_timing_deinit_config, ARRAY_SIZE(_di_dsi_timing_deinit_config));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_timing_deinit_config, ARRAY_SIZE(_di_dsi_timing_deinit_config));
|
||||||
|
|
||||||
if (_display_id != PANEL_SAM_AMS699VC01)
|
if (_display_id != PANEL_SAM_AMS699VC01)
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
|
@ -735,11 +735,11 @@ static void _display_panel_and_hw_end(bool no_panel_deinit)
|
||||||
switch (_display_id)
|
switch (_display_id)
|
||||||
{
|
{
|
||||||
case PANEL_JDI_XXX062M:
|
case PANEL_JDI_XXX062M:
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_panel_deinit_config_jdi, ARRAY_SIZE(_di_dsi_panel_deinit_config_jdi));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_panel_deinit_config_jdi, ARRAY_SIZE(_di_dsi_panel_deinit_config_jdi));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PANEL_AUO_A062TAN01:
|
case PANEL_AUO_A062TAN01:
|
||||||
exec_cfg((u32 *)DSI_BASE, _di_dsi_panel_deinit_config_auo, ARRAY_SIZE(_di_dsi_panel_deinit_config_auo));
|
reg_write_array((u32 *)DSI_BASE, _di_dsi_panel_deinit_config_auo, ARRAY_SIZE(_di_dsi_panel_deinit_config_auo));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PANEL_INL_2J055IA_27A:
|
case PANEL_INL_2J055IA_27A:
|
||||||
|
@ -845,7 +845,7 @@ void display_set_decoded_panel_id(u32 id)
|
||||||
void display_color_screen(u32 color)
|
void display_color_screen(u32 color)
|
||||||
{
|
{
|
||||||
// Disable all windows.
|
// Disable all windows.
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_win_one_color, ARRAY_SIZE(_di_win_one_color));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_win_one_color, ARRAY_SIZE(_di_win_one_color));
|
||||||
|
|
||||||
// Configure display to show single color.
|
// Configure display to show single color.
|
||||||
DISPLAY_A(_DIREG(DC_DISP_BLEND_BACKGROUND_COLOR)) = color;
|
DISPLAY_A(_DIREG(DC_DISP_BLEND_BACKGROUND_COLOR)) = color;
|
||||||
|
@ -867,7 +867,7 @@ u32 *display_init_framebuffer_pitch()
|
||||||
memset((u32 *)IPL_FB_ADDRESS, 0, IPL_FB_SZ);
|
memset((u32 *)IPL_FB_ADDRESS, 0, IPL_FB_SZ);
|
||||||
|
|
||||||
// This configures the framebuffer @ IPL_FB_ADDRESS with a resolution of 720x1280 (line stride 720).
|
// This configures the framebuffer @ IPL_FB_ADDRESS with a resolution of 720x1280 (line stride 720).
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_winA_pitch, ARRAY_SIZE(_di_winA_pitch));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_winA_pitch, ARRAY_SIZE(_di_winA_pitch));
|
||||||
//usleep(35000); // Wait 2 frames. No need on Aula.
|
//usleep(35000); // Wait 2 frames. No need on Aula.
|
||||||
|
|
||||||
return (u32 *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
|
return (u32 *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
|
||||||
|
@ -878,7 +878,7 @@ u32 *display_init_framebuffer_pitch_vic()
|
||||||
// This configures the framebuffer @ NYX_FB_ADDRESS with a resolution of 720x1280 (line stride 720).
|
// This configures the framebuffer @ NYX_FB_ADDRESS with a resolution of 720x1280 (line stride 720).
|
||||||
if (_display_id != PANEL_SAM_AMS699VC01)
|
if (_display_id != PANEL_SAM_AMS699VC01)
|
||||||
usleep(8000); // Wait half frame for PWM to apply.
|
usleep(8000); // Wait half frame for PWM to apply.
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_winA_pitch_vic, ARRAY_SIZE(_di_winA_pitch_vic));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_winA_pitch_vic, ARRAY_SIZE(_di_winA_pitch_vic));
|
||||||
if (_display_id != PANEL_SAM_AMS699VC01)
|
if (_display_id != PANEL_SAM_AMS699VC01)
|
||||||
usleep(35000); // Wait 2 frames.
|
usleep(35000); // Wait 2 frames.
|
||||||
|
|
||||||
|
@ -888,7 +888,7 @@ u32 *display_init_framebuffer_pitch_vic()
|
||||||
u32 *display_init_framebuffer_pitch_inv()
|
u32 *display_init_framebuffer_pitch_inv()
|
||||||
{
|
{
|
||||||
// This configures the framebuffer @ NYX_FB_ADDRESS with a resolution of 720x1280 (line stride 720).
|
// This configures the framebuffer @ NYX_FB_ADDRESS with a resolution of 720x1280 (line stride 720).
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_winA_pitch_inv, ARRAY_SIZE(_di_winA_pitch_inv));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_winA_pitch_inv, ARRAY_SIZE(_di_winA_pitch_inv));
|
||||||
usleep(35000); // Wait 2 frames. No need on Aula.
|
usleep(35000); // Wait 2 frames. No need on Aula.
|
||||||
|
|
||||||
return (u32 *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
|
return (u32 *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
|
||||||
|
@ -897,7 +897,7 @@ u32 *display_init_framebuffer_pitch_inv()
|
||||||
u32 *display_init_framebuffer_block()
|
u32 *display_init_framebuffer_block()
|
||||||
{
|
{
|
||||||
// This configures the framebuffer @ NYX_FB_ADDRESS with a resolution of 720x1280.
|
// This configures the framebuffer @ NYX_FB_ADDRESS with a resolution of 720x1280.
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_winA_block, ARRAY_SIZE(_di_winA_block));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_winA_block, ARRAY_SIZE(_di_winA_block));
|
||||||
usleep(35000); // Wait 2 frames. No need on Aula.
|
usleep(35000); // Wait 2 frames. No need on Aula.
|
||||||
|
|
||||||
return (u32 *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
|
return (u32 *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
|
||||||
|
@ -906,7 +906,7 @@ u32 *display_init_framebuffer_block()
|
||||||
u32 *display_init_framebuffer_log()
|
u32 *display_init_framebuffer_log()
|
||||||
{
|
{
|
||||||
// This configures the framebuffer @ LOG_FB_ADDRESS with a resolution of 1280x720 (line stride 720).
|
// This configures the framebuffer @ LOG_FB_ADDRESS with a resolution of 1280x720 (line stride 720).
|
||||||
exec_cfg((u32 *)DISPLAY_A_BASE, _di_winD_log, ARRAY_SIZE(_di_winD_log));
|
reg_write_array((u32 *)DISPLAY_A_BASE, _di_winD_log, ARRAY_SIZE(_di_winD_log));
|
||||||
|
|
||||||
return (u32 *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
|
return (u32 *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Display A config.
|
// Display A config.
|
||||||
static const cfg_op_t _di_dc_setup_win_config[] = {
|
static const reg_cfg_t _di_dc_setup_win_config[] = {
|
||||||
{DC_CMD_STATE_ACCESS, READ_MUX_ASSEMBLY | WRITE_MUX_ASSEMBLY},
|
{DC_CMD_STATE_ACCESS, READ_MUX_ASSEMBLY | WRITE_MUX_ASSEMBLY},
|
||||||
{DC_CMD_STATE_CONTROL, GENERAL_UPDATE},
|
{DC_CMD_STATE_CONTROL, GENERAL_UPDATE},
|
||||||
{DC_CMD_STATE_CONTROL, GENERAL_ACT_REQ},
|
{DC_CMD_STATE_CONTROL, GENERAL_ACT_REQ},
|
||||||
|
@ -64,7 +64,7 @@ static const cfg_op_t _di_dc_setup_win_config[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DSI Init config.
|
// DSI Init config.
|
||||||
static const cfg_op_t _di_dsi_init_config0[] = {
|
static const reg_cfg_t _di_dsi_init_config0[] = {
|
||||||
{DSI_WR_DATA, 0},
|
{DSI_WR_DATA, 0},
|
||||||
{DSI_INT_ENABLE, 0},
|
{DSI_INT_ENABLE, 0},
|
||||||
{DSI_INT_STATUS, 0},
|
{DSI_INT_STATUS, 0},
|
||||||
|
@ -74,7 +74,7 @@ static const cfg_op_t _di_dsi_init_config0[] = {
|
||||||
{DSI_INIT_SEQ_DATA_2, 0},
|
{DSI_INIT_SEQ_DATA_2, 0},
|
||||||
{DSI_INIT_SEQ_DATA_3, 0}
|
{DSI_INIT_SEQ_DATA_3, 0}
|
||||||
};
|
};
|
||||||
static const cfg_op_t _di_dsi_init_config1[] = {
|
static const reg_cfg_t _di_dsi_init_config1[] = {
|
||||||
{DSI_DCS_CMDS, 0},
|
{DSI_DCS_CMDS, 0},
|
||||||
{DSI_PKT_SEQ_0_LO, 0},
|
{DSI_PKT_SEQ_0_LO, 0},
|
||||||
{DSI_PKT_SEQ_1_LO, 0},
|
{DSI_PKT_SEQ_1_LO, 0},
|
||||||
|
@ -90,7 +90,7 @@ static const cfg_op_t _di_dsi_init_config1[] = {
|
||||||
{DSI_PKT_SEQ_5_HI, 0},
|
{DSI_PKT_SEQ_5_HI, 0},
|
||||||
{DSI_CONTROL, 0}
|
{DSI_CONTROL, 0}
|
||||||
};
|
};
|
||||||
static const cfg_op_t _di_dsi_init_pads_t210b01[] = {
|
static const reg_cfg_t _di_dsi_init_pads_t210b01[] = {
|
||||||
{DSI_PAD_CONTROL_1, 0},
|
{DSI_PAD_CONTROL_1, 0},
|
||||||
{DSI_PAD_CONTROL_2, 0},
|
{DSI_PAD_CONTROL_2, 0},
|
||||||
{DSI_PAD_CONTROL_3, 0},
|
{DSI_PAD_CONTROL_3, 0},
|
||||||
|
@ -99,7 +99,7 @@ static const cfg_op_t _di_dsi_init_pads_t210b01[] = {
|
||||||
{DSI_PAD_CONTROL_6_B01, 0},
|
{DSI_PAD_CONTROL_6_B01, 0},
|
||||||
{DSI_PAD_CONTROL_7_B01, 0}
|
{DSI_PAD_CONTROL_7_B01, 0}
|
||||||
};
|
};
|
||||||
static const cfg_op_t _di_dsi_init_config2[] = {
|
static const reg_cfg_t _di_dsi_init_config2[] = {
|
||||||
{DSI_PAD_CONTROL_CD, 0},
|
{DSI_PAD_CONTROL_CD, 0},
|
||||||
{DSI_SOL_DELAY, 24},
|
{DSI_SOL_DELAY, 24},
|
||||||
{DSI_MAX_THRESHOLD, 480},
|
{DSI_MAX_THRESHOLD, 480},
|
||||||
|
@ -141,7 +141,7 @@ static const cfg_op_t _di_dsi_init_config2[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DSI panel JDI config.
|
// DSI panel JDI config.
|
||||||
static const cfg_op_t _di_dsi_panel_init_config_jdi[] = {
|
static const reg_cfg_t _di_dsi_panel_init_config_jdi[] = {
|
||||||
{DSI_WR_DATA, 0x0439}, // MIPI_DSI_DCS_LONG_WRITE: 4 bytes.
|
{DSI_WR_DATA, 0x0439}, // MIPI_DSI_DCS_LONG_WRITE: 4 bytes.
|
||||||
{DSI_WR_DATA, 0x9483FFB9}, // MIPI_DCS_PRIV_SET_EXTC. (Pass: FF 83 94).
|
{DSI_WR_DATA, 0x9483FFB9}, // MIPI_DCS_PRIV_SET_EXTC. (Pass: FF 83 94).
|
||||||
{DSI_TRIGGER, DSI_TRIGGER_HOST},
|
{DSI_TRIGGER, DSI_TRIGGER_HOST},
|
||||||
|
@ -188,7 +188,7 @@ static const cfg_op_t _di_dsi_panel_init_config_jdi[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DSI packet config.
|
// DSI packet config.
|
||||||
static const cfg_op_t _di_dsi_init_seq_pkt_final_config[] = {
|
static const reg_cfg_t _di_dsi_init_seq_pkt_final_config[] = {
|
||||||
{DSI_PAD_CONTROL_1, 0},
|
{DSI_PAD_CONTROL_1, 0},
|
||||||
{DSI_PHY_TIMING_0, 0x6070603},
|
{DSI_PHY_TIMING_0, 0x6070603},
|
||||||
{DSI_PHY_TIMING_1, 0x40A0E05},
|
{DSI_PHY_TIMING_1, 0x40A0E05},
|
||||||
|
@ -213,7 +213,7 @@ static const cfg_op_t _di_dsi_init_seq_pkt_final_config[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DSI mode config.
|
// DSI mode config.
|
||||||
static const cfg_op_t _di_dsi_mode_config[] = {
|
static const reg_cfg_t _di_dsi_mode_config[] = {
|
||||||
{DSI_TRIGGER, 0},
|
{DSI_TRIGGER, 0},
|
||||||
{DSI_CONTROL, 0},
|
{DSI_CONTROL, 0},
|
||||||
{DSI_SOL_DELAY, 6},
|
{DSI_SOL_DELAY, 6},
|
||||||
|
@ -227,7 +227,7 @@ static const cfg_op_t _di_dsi_mode_config[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// MIPI CAL config.
|
// MIPI CAL config.
|
||||||
static const cfg_op_t _di_mipi_pad_cal_config[] = {
|
static const reg_cfg_t _di_mipi_pad_cal_config[] = {
|
||||||
{MIPI_CAL_MIPI_BIAS_PAD_CFG2, 0},
|
{MIPI_CAL_MIPI_BIAS_PAD_CFG2, 0},
|
||||||
{MIPI_CAL_CIL_MIPI_CAL_STATUS, 0xF3F10000},
|
{MIPI_CAL_CIL_MIPI_CAL_STATUS, 0xF3F10000},
|
||||||
{MIPI_CAL_MIPI_BIAS_PAD_CFG0, 0},
|
{MIPI_CAL_MIPI_BIAS_PAD_CFG0, 0},
|
||||||
|
@ -235,13 +235,13 @@ static const cfg_op_t _di_mipi_pad_cal_config[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DSI pad config.
|
// DSI pad config.
|
||||||
static const cfg_op_t _di_dsi_pad_cal_config_t210[] = {
|
static const reg_cfg_t _di_dsi_pad_cal_config_t210[] = {
|
||||||
{DSI_PAD_CONTROL_1, 0},
|
{DSI_PAD_CONTROL_1, 0},
|
||||||
{DSI_PAD_CONTROL_2, 0},
|
{DSI_PAD_CONTROL_2, 0},
|
||||||
{DSI_PAD_CONTROL_3, DSI_PAD_PREEMP_PD_CLK(0x3) | DSI_PAD_PREEMP_PU_CLK(0x3) | DSI_PAD_PREEMP_PD(0x03) | DSI_PAD_PREEMP_PU(0x3)},
|
{DSI_PAD_CONTROL_3, DSI_PAD_PREEMP_PD_CLK(0x3) | DSI_PAD_PREEMP_PU_CLK(0x3) | DSI_PAD_PREEMP_PD(0x03) | DSI_PAD_PREEMP_PU(0x3)},
|
||||||
{DSI_PAD_CONTROL_4, 0}
|
{DSI_PAD_CONTROL_4, 0}
|
||||||
};
|
};
|
||||||
static const cfg_op_t _di_dsi_pad_cal_config_t210b01[] = {
|
static const reg_cfg_t _di_dsi_pad_cal_config_t210b01[] = {
|
||||||
{DSI_PAD_CONTROL_1, 0},
|
{DSI_PAD_CONTROL_1, 0},
|
||||||
{DSI_PAD_CONTROL_2, 0},
|
{DSI_PAD_CONTROL_2, 0},
|
||||||
{DSI_PAD_CONTROL_3, 0},
|
{DSI_PAD_CONTROL_3, 0},
|
||||||
|
@ -252,19 +252,19 @@ static const cfg_op_t _di_dsi_pad_cal_config_t210b01[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// MIPI CAL config.
|
// MIPI CAL config.
|
||||||
static const cfg_op_t _di_mipi_dsi_cal_offsets_config_t210[] = {
|
static const reg_cfg_t _di_mipi_dsi_cal_offsets_config_t210[] = {
|
||||||
{MIPI_CAL_DSIA_MIPI_CAL_CONFIG, 0x200200},
|
{MIPI_CAL_DSIA_MIPI_CAL_CONFIG, 0x200200},
|
||||||
{MIPI_CAL_DSIB_MIPI_CAL_CONFIG, 0x200200},
|
{MIPI_CAL_DSIB_MIPI_CAL_CONFIG, 0x200200},
|
||||||
{MIPI_CAL_DSIA_MIPI_CAL_CONFIG_2, 0x200002},
|
{MIPI_CAL_DSIA_MIPI_CAL_CONFIG_2, 0x200002},
|
||||||
{MIPI_CAL_DSIB_MIPI_CAL_CONFIG_2, 0x200002}
|
{MIPI_CAL_DSIB_MIPI_CAL_CONFIG_2, 0x200002}
|
||||||
};
|
};
|
||||||
static const cfg_op_t _di_mipi_dsi_cal_offsets_config_t210b01[] = {
|
static const reg_cfg_t _di_mipi_dsi_cal_offsets_config_t210b01[] = {
|
||||||
{MIPI_CAL_DSIA_MIPI_CAL_CONFIG, 0x200006},
|
{MIPI_CAL_DSIA_MIPI_CAL_CONFIG, 0x200006},
|
||||||
{MIPI_CAL_DSIB_MIPI_CAL_CONFIG, 0x200006},
|
{MIPI_CAL_DSIB_MIPI_CAL_CONFIG, 0x200006},
|
||||||
{MIPI_CAL_DSIA_MIPI_CAL_CONFIG_2, 0x260000},
|
{MIPI_CAL_DSIA_MIPI_CAL_CONFIG_2, 0x260000},
|
||||||
{MIPI_CAL_DSIB_MIPI_CAL_CONFIG_2, 0x260000}
|
{MIPI_CAL_DSIB_MIPI_CAL_CONFIG_2, 0x260000}
|
||||||
};
|
};
|
||||||
static const cfg_op_t _di_mipi_start_dsi_cal_config[] = {
|
static const reg_cfg_t _di_mipi_start_dsi_cal_config[] = {
|
||||||
{MIPI_CAL_CILA_MIPI_CAL_CONFIG, 0},
|
{MIPI_CAL_CILA_MIPI_CAL_CONFIG, 0},
|
||||||
{MIPI_CAL_CILB_MIPI_CAL_CONFIG, 0},
|
{MIPI_CAL_CILB_MIPI_CAL_CONFIG, 0},
|
||||||
{MIPI_CAL_CILC_MIPI_CAL_CONFIG, 0},
|
{MIPI_CAL_CILC_MIPI_CAL_CONFIG, 0},
|
||||||
|
@ -280,7 +280,7 @@ static const cfg_op_t _di_mipi_start_dsi_cal_config[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display A enable config.
|
// Display A enable config.
|
||||||
static const cfg_op_t _di_dc_video_enable_config[] = {
|
static const reg_cfg_t _di_dc_video_enable_config[] = {
|
||||||
/* Set panel timings */
|
/* Set panel timings */
|
||||||
{DC_DISP_DISP_TIMING_OPTIONS, VSYNC_H_POSITION(0)},
|
{DC_DISP_DISP_TIMING_OPTIONS, VSYNC_H_POSITION(0)},
|
||||||
{DC_DISP_REF_TO_SYNC, V_REF_TO_SYNC(1) | H_REF_TO_SYNC(0)},
|
{DC_DISP_REF_TO_SYNC, V_REF_TO_SYNC(1) | H_REF_TO_SYNC(0)},
|
||||||
|
@ -309,7 +309,7 @@ static const cfg_op_t _di_dc_video_enable_config[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display A disable config.
|
// Display A disable config.
|
||||||
static const cfg_op_t _di_dc_video_disable_config[] = {
|
static const reg_cfg_t _di_dc_video_disable_config[] = {
|
||||||
{DC_CMD_INT_MASK, 0},
|
{DC_CMD_INT_MASK, 0},
|
||||||
{DC_CMD_STATE_ACCESS, READ_MUX_ASSEMBLY | WRITE_MUX_ASSEMBLY},
|
{DC_CMD_STATE_ACCESS, READ_MUX_ASSEMBLY | WRITE_MUX_ASSEMBLY},
|
||||||
{DC_CMD_INT_ENABLE, 0},
|
{DC_CMD_INT_ENABLE, 0},
|
||||||
|
@ -332,7 +332,7 @@ static const cfg_op_t _di_dc_video_disable_config[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DSI deinit config.
|
// DSI deinit config.
|
||||||
static const cfg_op_t _di_dsi_timing_deinit_config[] = {
|
static const reg_cfg_t _di_dsi_timing_deinit_config[] = {
|
||||||
{DSI_POWER_CONTROL, 0},
|
{DSI_POWER_CONTROL, 0},
|
||||||
{DSI_PAD_CONTROL_1, 0},
|
{DSI_PAD_CONTROL_1, 0},
|
||||||
{DSI_PHY_TIMING_0, 0x6070603},
|
{DSI_PHY_TIMING_0, 0x6070603},
|
||||||
|
@ -352,7 +352,7 @@ static const cfg_op_t _di_dsi_timing_deinit_config[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DSI panel JDI deinit config.
|
// DSI panel JDI deinit config.
|
||||||
static const cfg_op_t _di_dsi_panel_deinit_config_jdi[] = {
|
static const reg_cfg_t _di_dsi_panel_deinit_config_jdi[] = {
|
||||||
{DSI_WR_DATA, 0x439}, // MIPI_DSI_DCS_LONG_WRITE: 4 bytes.
|
{DSI_WR_DATA, 0x439}, // MIPI_DSI_DCS_LONG_WRITE: 4 bytes.
|
||||||
{DSI_WR_DATA, 0x9483FFB9}, // MIPI_DCS_PRIV_SET_EXTC. (Pass: FF 83 94).
|
{DSI_WR_DATA, 0x9483FFB9}, // MIPI_DCS_PRIV_SET_EXTC. (Pass: FF 83 94).
|
||||||
{DSI_TRIGGER, DSI_TRIGGER_HOST},
|
{DSI_TRIGGER, DSI_TRIGGER_HOST},
|
||||||
|
@ -378,7 +378,7 @@ static const cfg_op_t _di_dsi_panel_deinit_config_jdi[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// DSI panel AUO deinit config.
|
// DSI panel AUO deinit config.
|
||||||
static const cfg_op_t _di_dsi_panel_deinit_config_auo[] = {
|
static const reg_cfg_t _di_dsi_panel_deinit_config_auo[] = {
|
||||||
{DSI_WR_DATA, 0x439}, // MIPI_DSI_DCS_LONG_WRITE: 4 bytes.
|
{DSI_WR_DATA, 0x439}, // MIPI_DSI_DCS_LONG_WRITE: 4 bytes.
|
||||||
{DSI_WR_DATA, 0x9483FFB9}, // MIPI_DCS_PRIV_SET_EXTC. (Pass: FF 83 94).
|
{DSI_WR_DATA, 0x9483FFB9}, // MIPI_DCS_PRIV_SET_EXTC. (Pass: FF 83 94).
|
||||||
{DSI_TRIGGER, DSI_TRIGGER_HOST},
|
{DSI_TRIGGER, DSI_TRIGGER_HOST},
|
||||||
|
@ -420,7 +420,7 @@ static const cfg_op_t _di_dsi_panel_deinit_config_auo[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static const cfg_op_t _di_init_config_invert[] = {
|
static const reg_cfg_t _di_init_config_invert[] = {
|
||||||
{DSI_WR_DATA, 0x239},
|
{DSI_WR_DATA, 0x239},
|
||||||
{DSI_WR_DATA, 0x02C1}, // INV_EN.
|
{DSI_WR_DATA, 0x02C1}, // INV_EN.
|
||||||
{DSI_TRIGGER, DSI_TRIGGER_HOST},
|
{DSI_TRIGGER, DSI_TRIGGER_HOST},
|
||||||
|
@ -428,7 +428,7 @@ static const cfg_op_t _di_init_config_invert[] = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Display A Window A one color config.
|
// Display A Window A one color config.
|
||||||
static const cfg_op_t _di_win_one_color[] = {
|
static const reg_cfg_t _di_win_one_color[] = {
|
||||||
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT | WINDOW_B_SELECT | WINDOW_C_SELECT | WINDOW_D_SELECT},
|
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT | WINDOW_B_SELECT | WINDOW_C_SELECT | WINDOW_D_SELECT},
|
||||||
{DC_WIN_WIN_OPTIONS, 0},
|
{DC_WIN_WIN_OPTIONS, 0},
|
||||||
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
||||||
|
@ -436,7 +436,7 @@ static const cfg_op_t _di_win_one_color[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display A Window A linear pitch config.
|
// Display A Window A linear pitch config.
|
||||||
static const cfg_op_t _di_winA_pitch[] = {
|
static const reg_cfg_t _di_winA_pitch[] = {
|
||||||
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT},
|
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT},
|
||||||
{DC_WIN_WIN_OPTIONS, 0},
|
{DC_WIN_WIN_OPTIONS, 0},
|
||||||
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
||||||
|
@ -460,7 +460,7 @@ static const cfg_op_t _di_winA_pitch[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display A Window A linear pitch + Win D support config.
|
// Display A Window A linear pitch + Win D support config.
|
||||||
static const cfg_op_t _di_winA_pitch_vic[] = {
|
static const reg_cfg_t _di_winA_pitch_vic[] = {
|
||||||
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT},
|
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT},
|
||||||
{DC_WIN_WIN_OPTIONS, 0},
|
{DC_WIN_WIN_OPTIONS, 0},
|
||||||
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
||||||
|
@ -484,7 +484,7 @@ static const cfg_op_t _di_winA_pitch_vic[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display A Window A linear pitch inverse + Win D support config.
|
// Display A Window A linear pitch inverse + Win D support config.
|
||||||
static const cfg_op_t _di_winA_pitch_inv[] = {
|
static const reg_cfg_t _di_winA_pitch_inv[] = {
|
||||||
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT},
|
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT},
|
||||||
{DC_WIN_WIN_OPTIONS, 0},
|
{DC_WIN_WIN_OPTIONS, 0},
|
||||||
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
||||||
|
@ -508,7 +508,7 @@ static const cfg_op_t _di_winA_pitch_inv[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display A Window A block linear config.
|
// Display A Window A block linear config.
|
||||||
static const cfg_op_t _di_winA_block[] = {
|
static const reg_cfg_t _di_winA_block[] = {
|
||||||
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT},
|
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_A_SELECT},
|
||||||
{DC_WIN_WIN_OPTIONS, 0},
|
{DC_WIN_WIN_OPTIONS, 0},
|
||||||
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
{DC_DISP_DISP_WIN_OPTIONS, DSI_ENABLE},
|
||||||
|
@ -532,7 +532,7 @@ static const cfg_op_t _di_winA_block[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display A Window D config.
|
// Display A Window D config.
|
||||||
static const cfg_op_t _di_winD_log[] = {
|
static const reg_cfg_t _di_winD_log[] = {
|
||||||
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_D_SELECT},
|
{DC_CMD_DISPLAY_WINDOW_HEADER, WINDOW_D_SELECT},
|
||||||
{DC_WIN_WIN_OPTIONS, 0},
|
{DC_WIN_WIN_OPTIONS, 0},
|
||||||
{DC_WIN_COLOR_DEPTH, WIN_COLOR_DEPTH_B8G8R8A8},
|
{DC_WIN_COLOR_DEPTH, WIN_COLOR_DEPTH_B8G8R8A8},
|
||||||
|
|
|
@ -197,10 +197,11 @@ int atoi(const char *nptr)
|
||||||
return (int)strtol(nptr, (char **)NULL, 10);
|
return (int)strtol(nptr, (char **)NULL, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops)
|
void reg_write_array(u32 *base, const reg_cfg_t *cfg, u32 num_cfg)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < num_ops; i++)
|
// Expected register offset is a u32 array index.
|
||||||
base[ops[i].off] = ops[i].val;
|
for (u32 i = 0; i < num_cfg; i++)
|
||||||
|
base[cfg[i].idx] = cfg[i].val;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 crc32_calc(u32 crc, const u8 *buf, u32 len)
|
u32 crc32_calc(u32 crc, const u8 *buf, u32 len)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 naehrwert
|
* Copyright (c) 2018 naehrwert
|
||||||
* Copyright (c) 2018-2022 CTCaer
|
* Copyright (c) 2018-2024 CTCaer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
@ -51,11 +51,11 @@ typedef enum
|
||||||
ERR_EXCEPTION = BIT(31),
|
ERR_EXCEPTION = BIT(31),
|
||||||
} hekate_errors_t;
|
} hekate_errors_t;
|
||||||
|
|
||||||
typedef struct _cfg_op_t
|
typedef struct _reg_cfg_t
|
||||||
{
|
{
|
||||||
u32 off;
|
u32 idx;
|
||||||
u32 val;
|
u32 val;
|
||||||
} cfg_op_t;
|
} reg_cfg_t;
|
||||||
|
|
||||||
typedef struct _nyx_info_t
|
typedef struct _nyx_info_t
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ u64 sqrt64(u64 num);
|
||||||
long strtol(const char *nptr, char **endptr, register int base);
|
long strtol(const char *nptr, char **endptr, register int base);
|
||||||
int atoi(const char *nptr);
|
int atoi(const char *nptr);
|
||||||
|
|
||||||
void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops);
|
void reg_write_array(u32 *base, const reg_cfg_t *cfg, u32 num_cfg);
|
||||||
u32 crc32_calc(u32 crc, const u8 *buf, u32 len);
|
u32 crc32_calc(u32 crc, const u8 *buf, u32 len);
|
||||||
|
|
||||||
void panic(u32 val);
|
void panic(u32 val);
|
||||||
|
|
Loading…
Reference in a new issue