fusee/sept: delegate SoC selection to individual components and keep common code SoC-agnostic
This commit is contained in:
@@ -98,11 +98,7 @@ static ssize_t decode_utf8(uint32_t *out, const uint8_t *in) {
|
||||
|
||||
static void console_init_display(void) {
|
||||
/* Initialize the display. */
|
||||
if (fuse_get_soc_type() == 1) {
|
||||
display_init_mariko();
|
||||
} else {
|
||||
display_init_erista();
|
||||
}
|
||||
display_init();
|
||||
|
||||
/* Set the framebuffer. */
|
||||
display_init_framebuffer(g_framebuffer);
|
||||
@@ -202,11 +198,7 @@ int console_end(void) {
|
||||
display_backlight(false);
|
||||
|
||||
/* Terminate the display. */
|
||||
if (fuse_get_soc_type() == 1) {
|
||||
display_end_mariko();
|
||||
} else {
|
||||
display_end_erista();
|
||||
}
|
||||
display_end();
|
||||
|
||||
/* Display is terminated. */
|
||||
g_display_initialized = false;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "di.h"
|
||||
#include "fuse.h"
|
||||
#include "timers.h"
|
||||
#include "i2c.h"
|
||||
#include "pmc.h"
|
||||
@@ -32,6 +33,11 @@
|
||||
|
||||
static uint32_t g_lcd_vendor = 0;
|
||||
|
||||
/* Determine the current SoC for Mariko specific code. */
|
||||
static bool is_soc_mariko() {
|
||||
return (fuse_get_soc_type() == 1);
|
||||
}
|
||||
|
||||
static void do_dsi_sleep_or_register_writes(const dsi_sleep_or_register_write_t *writes, uint32_t num_writes) {
|
||||
for (uint32_t i = 0; i < num_writes; i++) {
|
||||
if (writes[i].kind == 1) {
|
||||
@@ -56,7 +62,7 @@ static void dsi_wait(uint32_t timeout, uint32_t offset, uint32_t mask, uint32_t
|
||||
udelay(delay);
|
||||
}
|
||||
|
||||
void display_init_erista(void) {
|
||||
static void display_init_erista(void) {
|
||||
volatile tegra_car_t *car = car_get_regs();
|
||||
volatile tegra_pmc_t *pmc = pmc_get_regs();
|
||||
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
|
||||
@@ -206,7 +212,7 @@ void display_init_erista(void) {
|
||||
do_register_writes(DI_BASE, display_config_dc_02, 113);
|
||||
}
|
||||
|
||||
void display_init_mariko(void) {
|
||||
static void display_init_mariko(void) {
|
||||
volatile tegra_car_t *car = car_get_regs();
|
||||
volatile tegra_pmc_t *pmc = pmc_get_regs();
|
||||
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
|
||||
@@ -366,7 +372,7 @@ void display_init_mariko(void) {
|
||||
do_register_writes(DI_BASE, display_config_dc_02, 113);
|
||||
}
|
||||
|
||||
void display_end_erista(void) {
|
||||
static void display_end_erista(void) {
|
||||
volatile tegra_car_t *car = car_get_regs();
|
||||
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
|
||||
|
||||
@@ -448,7 +454,7 @@ void display_end_erista(void) {
|
||||
pinmux->lcd_bl_pwm = (((pinmux->lcd_bl_pwm >> 2) << 2) | 1);
|
||||
}
|
||||
|
||||
void display_end_mariko(void) {
|
||||
static void display_end_mariko(void) {
|
||||
volatile tegra_car_t *car = car_get_regs();
|
||||
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
|
||||
|
||||
@@ -530,6 +536,22 @@ void display_end_mariko(void) {
|
||||
pinmux->lcd_bl_pwm = (((pinmux->lcd_bl_pwm >> 2) << 2) | 1);
|
||||
}
|
||||
|
||||
void display_init(void) {
|
||||
if (is_soc_mariko()) {
|
||||
display_init_mariko();
|
||||
} else {
|
||||
display_init_erista();
|
||||
}
|
||||
}
|
||||
|
||||
void display_end(void) {
|
||||
if (is_soc_mariko()) {
|
||||
display_end_mariko();
|
||||
} else {
|
||||
display_end_erista();
|
||||
}
|
||||
}
|
||||
|
||||
void display_backlight(bool enable) {
|
||||
/* Enable Backlight PWM. */
|
||||
gpio_write(GPIO_LCD_BL_PWM, enable ? GPIO_LEVEL_HIGH : GPIO_LEVEL_LOW);
|
||||
|
||||
@@ -382,10 +382,8 @@
|
||||
#define MIPI_CAL_DSIC_MIPI_CAL_CONFIG_2 0x70
|
||||
#define MIPI_CAL_DSID_MIPI_CAL_CONFIG_2 0x74
|
||||
|
||||
void display_init_erista(void);
|
||||
void display_init_mariko(void);
|
||||
void display_end_erista(void);
|
||||
void display_end_mariko(void);
|
||||
void display_init(void);
|
||||
void display_end(void);
|
||||
|
||||
/* Switches screen backlight ON/OFF. */
|
||||
void display_backlight(bool enable);
|
||||
|
||||
@@ -70,11 +70,7 @@ void check_and_display_panic(void) {
|
||||
}
|
||||
|
||||
/* Initialize the display. */
|
||||
if (fuse_get_soc_type() == 1) {
|
||||
display_init_mariko();
|
||||
} else {
|
||||
display_init_erista();
|
||||
}
|
||||
display_init();
|
||||
|
||||
/* Fill the screen. */
|
||||
display_color_screen(color);
|
||||
|
||||
Reference in New Issue
Block a user