From f07e572f6447465d8938679533d604e402b0f066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 18 Feb 2021 18:04:33 +0100 Subject: bcm27xx: import latest patches from the RPi foundation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G bcm2710: boot tested on RPi 3B v1.2 bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas --- ...ng-fbtft-Add-support-for-display-variants.patch | 204 +++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch (limited to 'target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch') diff --git a/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch b/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch new file mode 100644 index 0000000000..185e8eb493 --- /dev/null +++ b/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch @@ -0,0 +1,204 @@ +From fe85ae40abf546bf592d171de942c17238103e52 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 1 Sep 2020 18:15:27 +0100 +Subject: [PATCH] staging/fbtft: Add support for display variants + +Display variants are intended as a replacement for the now-deleted +fbtft_device drivers. Drivers can register additional compatible +strings with a custom callback that can make the required changes +to the fbtft_display structure. + +Start the ball rolling by adding adafruit18, adafruit18_green and +sainsmart18 displays. + +Signed-off-by: Phil Elwell +--- + drivers/staging/fbtft/fb_st7735r.c | 38 +++++++++++++++++++++++++++++- + drivers/staging/fbtft/fbtft-core.c | 15 +++++++++++- + drivers/staging/fbtft/fbtft.h | 28 +++++++++++++++++----- + 3 files changed, 73 insertions(+), 8 deletions(-) + +--- a/drivers/staging/fbtft/fb_st7735r.c ++++ b/drivers/staging/fbtft/fb_st7735r.c +@@ -16,6 +16,10 @@ + #define DEFAULT_GAMMA "0F 1A 0F 18 2F 28 20 22 1F 1B 23 37 00 07 02 10\n" \ + "0F 1B 0F 17 33 2C 29 2E 30 30 39 3F 00 07 03 10" + ++#define ADAFRUIT18_GAMMA \ ++ "02 1c 07 12 37 32 29 2d 29 25 2B 39 00 01 03 10\n" \ ++ "03 1d 07 06 2E 2C 29 2D 2E 2E 37 3F 00 00 02 10" ++ + static const s16 default_init_sequence[] = { + -1, MIPI_DCS_SOFT_RESET, + -2, 150, /* delay */ +@@ -94,6 +98,14 @@ static void set_addr_win(struct fbtft_pa + write_reg(par, MIPI_DCS_WRITE_MEMORY_START); + } + ++static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par, ++ int xs, int ys, int xe, int ye) ++{ ++ write_reg(par, 0x2A, 0, xs + 2, 0, xe + 2); ++ write_reg(par, 0x2B, 0, ys + 1, 0, ye + 1); ++ write_reg(par, 0x2C); ++} ++ + #define MY BIT(7) + #define MX BIT(6) + #define MV BIT(5) +@@ -174,12 +186,36 @@ static struct fbtft_display display = { + }, + }; + +-FBTFT_REGISTER_DRIVER(DRVNAME, "sitronix,st7735r", &display); ++int variant_adafruit18(struct fbtft_display *display) ++{ ++ display->gamma = ADAFRUIT18_GAMMA; ++ return 0; ++} ++ ++int variant_adafruit18_green(struct fbtft_display *display) ++{ ++ display->gamma = ADAFRUIT18_GAMMA; ++ display->fbtftops.set_addr_win = adafruit18_green_tab_set_addr_win; ++ return 0; ++} ++ ++FBTFT_REGISTER_DRIVER_START(&display) ++FBTFT_COMPATIBLE("sitronix,st7735r") ++FBTFT_COMPATIBLE("fbtft,sainsmart18") ++FBTFT_VARIANT_COMPATIBLE("fbtft,adafruit18", variant_adafruit18) ++FBTFT_VARIANT_COMPATIBLE("fbtft,adafruit18_green", variant_adafruit18_green) ++FBTFT_REGISTER_DRIVER_END(DRVNAME, &display); + + MODULE_ALIAS("spi:" DRVNAME); + MODULE_ALIAS("platform:" DRVNAME); + MODULE_ALIAS("spi:st7735r"); + MODULE_ALIAS("platform:st7735r"); ++MODULE_ALIAS("spi:sainsmart18"); ++MODULE_ALIAS("platform:sainsmart"); ++MODULE_ALIAS("spi:adafruit18"); ++MODULE_ALIAS("platform:adafruit18"); ++MODULE_ALIAS("spi:adafruit18_green"); ++MODULE_ALIAS("platform:adafruit18_green"); + + MODULE_DESCRIPTION("FB driver for the ST7735R LCD Controller"); + MODULE_AUTHOR("Noralf Tronnes"); +--- a/drivers/staging/fbtft/fbtft-core.c ++++ b/drivers/staging/fbtft/fbtft-core.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include