From 8cb5c6501d100c415fc5dead5ed8a6805dc4593f Mon Sep 17 00:00:00 2001 From: Sota4Ever Date: Tue, 5 Nov 2024 07:14:02 -0500 Subject: [PATCH] board: Add support for r8s (Samsung Galaxy S20 FE) Signed-off-by: Sota4Ever --- board/Kconfig | 13 +++++++++ board/Makefile | 1 + board/samsung/board-r8s.c | 57 +++++++++++++++++++++++++++++++++++++++ configs/r8s_defconfig | 3 +++ 4 files changed, 74 insertions(+) create mode 100644 board/samsung/board-r8s.c create mode 100644 configs/r8s_defconfig diff --git a/board/Kconfig b/board/Kconfig index 4592075..765848e 100644 --- a/board/Kconfig +++ b/board/Kconfig @@ -47,6 +47,13 @@ menu "Device Support" depends on EXYNOS_9810 help Say Y if you want to include support for Samsung Galaxy S9 + + config SAMSUNG_R8S + bool "Support for Samsung Galaxy S20 FE" + default n + depends on EXYNOS_990 + help + Say Y if you want to include support for Samsung Galaxy S20 FE config SAMSUNG_X1S bool "Support for Samsung Galaxy S20" @@ -92,6 +99,7 @@ menu "Device Specific Addresses" default 0x090000000 if SAMSUNG_ZEROFLTE default 0x090000000 if SAMSUNG_DREAMLTE default 0x090000000 if SAMSUNG_STARLTE + default 0x090000000 if SAMSUNG_R8S default 0x090000000 if SAMSUNG_X1S default 0x050000000 if SAMSUNG_J4LTE default 0x090000000 if SAMSUNG_J5LTE @@ -101,6 +109,7 @@ menu "Device Specific Addresses" hex "Ramdisk Entry Address" default 0x082000000 if SAMSUNG_DREAMLTE default 0x084000000 if SAMSUNG_C1S + default 0x084000000 if SAMSUNG_R8S default 0x084000000 if SAMSUNG_X1S config FRAMEBUFFER_BASE @@ -113,6 +122,7 @@ menu "Device Specific Addresses" default 0x0e2a00000 if SAMSUNG_ZEROFLTE default 0x0cc000000 if SAMSUNG_DREAMLTE default 0x0cc000000 if SAMSUNG_STARLTE + default 0x0f1000000 if SAMSUNG_R8S default 0x0f1000000 if SAMSUNG_X1S default 0x067000000 if SAMSUNG_J4LTE default 0x08e000000 if SAMSUNG_J5LTE @@ -128,6 +138,7 @@ menu "Device Specific Addresses" default 1440 if SAMSUNG_ZEROFLTE default 1440 if SAMSUNG_DREAMLTE default 1440 if SAMSUNG_STARLTE + default 1080 if SAMSUNG_R8S default 1440 if SAMSUNG_X1S default 720 if SAMSUNG_J4LTE default 720 if SAMSUNG_J5LTE @@ -143,6 +154,7 @@ menu "Device Specific Addresses" default 2560 if SAMSUNG_ZEROFLTE default 2960 if SAMSUNG_DREAMLTE default 2960 if SAMSUNG_STARLTE + default 2400 if SAMSUNG_R8S default 3200 if SAMSUNG_X1S default 1280 if SAMSUNG_J4LTE default 1280 if SAMSUNG_J5LTE @@ -158,6 +170,7 @@ menu "Device Specific Addresses" default 4 if SAMSUNG_ZEROFLTE default 4 if SAMSUNG_DREAMLTE default 4 if SAMSUNG_STARLTE + default 4 if SAMSUNG_R8S default 4 if SAMSUNG_X1S default 4 if SAMSUNG_J4LTE default 3 if SAMSUNG_J5LTE diff --git a/board/Makefile b/board/Makefile index 8aff4c7..f748332 100644 --- a/board/Makefile +++ b/board/Makefile @@ -5,6 +5,7 @@ lib-$(CONFIG_SAMSUNG_JACKPOTLTE) += samsung/board-jackpotlte.o lib-$(CONFIG_SAMSUNG_ZEROFLTE) += samsung/board-zeroflte.o lib-$(CONFIG_SAMSUNG_DREAMLTE) += samsung/board-dreamlte.o lib-$(CONFIG_SAMSUNG_STARLTE) += samsung/board-starlte.o +lib-$(CONFIG_SAMSUNG_R8S) += samsung/board-r8s.o lib-$(CONFIG_SAMSUNG_X1S) += samsung/board-x1s.o lib-$(CONFIG_SAMSUNG_J5LTE) += samsung/board-j5lte.o lib-$(CONFIG_SAMSUNG_J4LTE) += samsung/board-j4lte.o diff --git a/board/samsung/board-r8s.c b/board/samsung/board-r8s.c new file mode 100644 index 0000000..04b3420 --- /dev/null +++ b/board/samsung/board-r8s.c @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) Sota4Ever + * Copyright (c) 2024, Ivaylo Ivanov + */ +#include +#include +#include + +#define DECON_F_BASE 0x19050000 +#define HW_SW_TRIG_CONTROL 0x70 + +void init_board_funcs(void *board) +{ + /* + * Parsing the struct directly without restructing is + * broken as of Sep 29 2024 + */ + struct { + const char *name; + int ops[BOARD_OP_EXIT]; + } *board_restruct = board; + + board_restruct->name = "R8S"; +} + +// Early initialization +int board_init(void) +{ + /* Allow framebuffer to be written to */ + *(int*) (DECON_F_BASE + HW_SW_TRIG_CONTROL) = 0x1281; + return 0; +} + +// Late initialization +int board_late_init(void) +{ + return 0; +} + +int board_driver_setup(void) +{ + struct { + int width; + int height; + int stride; + void *address; + } simplefb_data = { + .width = 1080, + .height = 2400, + .stride = 4, + .address = (void *)0xf1000000 + }; + + REGISTER_DRIVER("simplefb", simplefb_probe, &simplefb_data); + return 0; +} diff --git a/configs/r8s_defconfig b/configs/r8s_defconfig new file mode 100644 index 0000000..4a6454a --- /dev/null +++ b/configs/r8s_defconfig @@ -0,0 +1,3 @@ +CONFIG_CROSS_COMPILE="aarch64-linux-gnu-" +CONFIG_EXYNOS_990=y +CONFIG_SAMSUNG_R8S=y