1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-09 21:51:45 +00:00

boot: update display logic for 13.0.0 changes

This commit is contained in:
Michael Scire 2021-10-14 19:48:13 -07:00
parent 7e536f74ae
commit c04a262d49

View file

@ -319,17 +319,8 @@ namespace ams::boot {
reg::SetBits(g_gpio_regs + GPIO_PORT3_OUT_0, 0x2); reg::SetBits(g_gpio_regs + GPIO_PORT3_OUT_0, 0x2);
os::SleepThread(TimeSpan::FromMilliSeconds(10)); os::SleepThread(TimeSpan::FromMilliSeconds(10));
/* Configure LCD backlight to use PWM. */ reg::SetBits(g_gpio_regs + GPIO_PORT6_CNF_1, 0x7);
reg::ClearBits(g_gpio_regs + GPIO_PORT6_CNF_1, 0x1); reg::SetBits(g_gpio_regs + GPIO_PORT6_OE_1, 0x7);
reg::Write(g_apb_misc_regs + PINMUX_AUX_LCD_BL_PWM, PINMUX_REG_BITS_ENUM(AUX_LCD_BL_PWM_PM, PWM0),
PINMUX_REG_BITS_ENUM(AUX_PUPD, PULL_DOWN));
/* Configure LCD backlight. */
R_ABORT_UNLESS(pwm::driver::OpenSession(std::addressof(g_lcd_backlight_session), pwm::DeviceCode_LcdBacklight));
pwm::driver::SetPeriod(g_lcd_backlight_session, TimeSpan::FromNanoSeconds(33898));
reg::SetBits(g_gpio_regs + GPIO_PORT6_CNF_1, 0x6);
reg::SetBits(g_gpio_regs + GPIO_PORT6_OE_1, 0x6);
reg::SetBits(g_gpio_regs + GPIO_PORT6_OUT_1, 0x2); reg::SetBits(g_gpio_regs + GPIO_PORT6_OUT_1, 0x2);
} }
@ -397,68 +388,80 @@ namespace ams::boot {
} }
/* LCD vendor specific configuration. */ /* LCD vendor specific configuration. */
switch (g_lcd_vendor) { if (g_lcd_vendor != 0x2050) {
case 0x10: /* Japan Display Inc screens. */ /* Configure LCD backlight to use PWM. */
DO_SLEEP_OR_REGISTER_WRITES(g_dsi_regs, DisplayConfigJdiSpecificInit01); reg::ClearBits(g_gpio_regs + GPIO_PORT6_CNF_1, 0x1);
break; reg::Write(g_apb_misc_regs + PINMUX_AUX_LCD_BL_PWM, PINMUX_REG_BITS_ENUM(AUX_LCD_BL_PWM_PM, PWM0),
case 0xF20: /* Innolux first revision screens. */ PINMUX_REG_BITS_ENUM(AUX_PUPD, PULL_DOWN));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x1105);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); /* Configure LCD backlight. */
os::SleepThread(TimeSpan::FromMilliSeconds(180)); R_ABORT_UNLESS(pwm::driver::OpenSession(std::addressof(g_lcd_backlight_session), pwm::DeviceCode_LcdBacklight));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x439); pwm::driver::SetPeriod(g_lcd_backlight_session, TimeSpan::FromNanoSeconds(33898));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x9483FFB9);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); switch (g_lcd_vendor) {
os::SleepThread(TimeSpan::FromMilliSeconds(5)); case 0x10: /* Japan Display Inc screens. */
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x739); DO_SLEEP_OR_REGISTER_WRITES(g_dsi_regs, DisplayConfigJdiSpecificInit01);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x751548B1); break;
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x143209); case 0xF20: /* Innolux first revision screens. */
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x1105);
os::SleepThread(TimeSpan::FromMilliSeconds(5)); reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x2905); os::SleepThread(TimeSpan::FromMilliSeconds(180));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x439);
break; reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x9483FFB9);
case 0xF30: /* AUO first revision screens. */ reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x1105); os::SleepThread(TimeSpan::FromMilliSeconds(5));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x739);
os::SleepThread(TimeSpan::FromMilliSeconds(180)); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x751548B1);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x439); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x143209);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x9483FFB9); reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); os::SleepThread(TimeSpan::FromMilliSeconds(5));
os::SleepThread(TimeSpan::FromMilliSeconds(5)); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x2905);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x739); reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x711148B1); break;
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x143209); case 0xF30: /* AUO first revision screens. */
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x1105);
os::SleepThread(TimeSpan::FromMilliSeconds(5)); reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x2905); os::SleepThread(TimeSpan::FromMilliSeconds(180));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x439);
break; reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x9483FFB9);
case 0x2050: /* Unknown (hardware type 5) screen. */ reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x1105); os::SleepThread(TimeSpan::FromMilliSeconds(5));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x739);
os::SleepThread(TimeSpan::FromMilliSeconds(180)); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x711148B1);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0xA015); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x143209);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x205315); os::SleepThread(TimeSpan::FromMilliSeconds(5));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x2905);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x339); reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x51); break;
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); case 0x1020: /* Innolux second revision screen. */
os::SleepThread(TimeSpan::FromMilliSeconds(5)); case 0x1030: /* AUO second revision screen. */
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x2905); case 0x1040: /* Unknown second revision screen. */
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); default:
break; reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x1105);
case 0x1020: /* Innolux second revision screen. */ reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
case 0x1030: /* AUO second revision screen. */ os::SleepThread(TimeSpan::FromMilliSeconds(120));
case 0x1040: /* Unknown second revision screen. */ reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x2905);
default: reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x1105); break;
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); }
os::SleepThread(TimeSpan::FromMilliSeconds(120)); } else {
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x2905); /* LCD vendor 0x2050, unknown Aula (OLED) screen. */
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST); reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x1105);
break; reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
os::SleepThread(TimeSpan::FromMilliSeconds(180));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0xA015);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x205315);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x339);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x51);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
os::SleepThread(TimeSpan::FromMilliSeconds(5));
reg::Write(g_dsi_regs + sizeof(u32) * DSI_WR_DATA, 0x2905);
reg::Write(g_dsi_regs + sizeof(u32) * DSI_TRIGGER, DSI_TRIGGER_HOST);
} }
os::SleepThread(TimeSpan::FromMilliSeconds(20)); os::SleepThread(TimeSpan::FromMilliSeconds(20));
DO_SOC_DEPENDENT_REGISTER_WRITES(g_clk_rst_regs, DisplayConfigPlld02); DO_SOC_DEPENDENT_REGISTER_WRITES(g_clk_rst_regs, DisplayConfigPlld02);