add Yuzuki Mavericks

This commit is contained in:
YuzukiTsuru 2022-06-20 20:06:46 +08:00
parent 89dd1a71aa
commit 50446a9f3a
15 changed files with 84013 additions and 0 deletions

View File

@ -27,6 +27,7 @@
:------: | :---------: | :-----: | :-----: | :-----: | :-------: |
*YuzukiHD* | *YuzukiRuler* | `F1C200s` | `2020.07` | `5.4.180` | `yuzukihd_yuzukiruler_defconfig`
*YuzukiHD* | *YuzukiCore F1* | `F1C200s` | `2020.07` | `5.4.180` | `yuzukihd_yuzukicore_f1_defconfig` |
*YuzukiHD* | *Yuzuki Mavericks* | `F1C200s` | `2020.07` | `5.4.180` | `yuzukihd_yuzukimavericks_defconfig` |
*YuzukiHD* | *YuzukiCK1N* | `V3x` | `2022.01` | `5.4.180` | `yuzukihd_yuzukick1n_defconfig` |
*YuzukiHD* | *R11 86 Panel* | `R11` | `2022.01` | `5.4.180` | `yuzukihd_r11_86panel_defconfig` |
*Sipeed* | *Lichee Nano* | `F1C100s` | `2020.07` | `5.4.180` | `sipeed_lichee_nano_defconfig` |

View File

@ -0,0 +1,227 @@
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_CGROUPS=y
CONFIG_NAMESPACES=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EMBEDDED=y
CONFIG_PERF_EVENTS=y
# CONFIG_ARCH_MULTI_V7 is not set
CONFIG_ARCH_SUNXI=y
CONFIG_AEABI=y
CONFIG_OABI_COMPAT=y
# CONFIG_ARM_MODULE_PLTS is not set
CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ATAG_DTB_COMPAT=y
CONFIG_CMDLINE="net.ifnames=0 vt.global_cursor_default=0"
CONFIG_CMDLINE_EXTEND=y
CONFIG_CPU_FREQ=y
CONFIG_CPUFREQ_DT=y
CONFIG_CPU_IDLE=y
CONFIG_ARM_CPUIDLE=y
CONFIG_FPE_NWFPE=y
CONFIG_STRICT_KERNEL_RWX=y
CONFIG_STRICT_MODULE_RWX=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
# CONFIG_INET_DIAG is not set
# CONFIG_IPV6 is not set
CONFIG_DNS_RESOLVER=y
CONFIG_CFG80211=y
CONFIG_CFG80211_WEXT=y
CONFIG_MAC80211=y
CONFIG_UEVENT_HELPER=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_SUNXI_RSB=y
CONFIG_MTD=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_SPI_NAND=y
CONFIG_MTD_SPI_NOR=y
# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_SG=y
CONFIG_CHR_DEV_SCH=y
CONFIG_NETDEVICES=y
# CONFIG_ETHERNET is not set
# CONFIG_USB_NET_DRIVERS is not set
# CONFIG_WLAN_VENDOR_ADMTEK is not set
# CONFIG_WLAN_VENDOR_ATH is not set
# CONFIG_WLAN_VENDOR_ATMEL is not set
# CONFIG_WLAN_VENDOR_BROADCOM is not set
# CONFIG_WLAN_VENDOR_CISCO is not set
# CONFIG_WLAN_VENDOR_INTEL is not set
# CONFIG_WLAN_VENDOR_INTERSIL is not set
# CONFIG_WLAN_VENDOR_MARVELL is not set
# CONFIG_WLAN_VENDOR_MEDIATEK is not set
# CONFIG_WLAN_VENDOR_RALINK is not set
# CONFIG_WLAN_VENDOR_REALTEK is not set
# CONFIG_WLAN_VENDOR_RSI is not set
# CONFIG_WLAN_VENDOR_ST is not set
# CONFIG_WLAN_VENDOR_TI is not set
# CONFIG_WLAN_VENDOR_ZYDAS is not set
# CONFIG_WLAN_VENDOR_QUANTENNA is not set
CONFIG_ESP8089=m
CONFIG_INPUT_POLLDEV=y
CONFIG_INPUT_EVDEV=y
# CONFIG_KEYBOARD_ATKBD is not set
CONFIG_KEYBOARD_SUN4I_LRADC=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_TSC2007=m
# CONFIG_SERIO_SERPORT is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=8
CONFIG_SERIAL_8250_RUNTIME_UARTS=8
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_HW_RANDOM is not set
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y
CONFIG_I2C_MV64XXX=y
CONFIG_SPI=y
CONFIG_SPI_GPIO=y
CONFIG_SPI_SUN6I=y
CONFIG_SPI_SPIDEV=y
CONFIG_PTP_1588_CLOCK=y
CONFIG_GPIO_SYSFS=y
CONFIG_POWER_SUPPLY=y
# CONFIG_HWMON is not set
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_SUNXI_WATCHDOG=y
CONFIG_MFD_AXP20X_I2C=y
CONFIG_MFD_AXP20X_RSB=y
CONFIG_MFD_SYSCON=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_MEDIA_CONTROLLER=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_VIDEO_SUN4I_CSI=y
CONFIG_VIDEO_OV2640=m
CONFIG_VIDEO_OV5640=m
CONFIG_DRM=y
CONFIG_DRM_LOAD_EDID_FIRMWARE=y
CONFIG_DRM_SUN4I=y
CONFIG_DRM_PANEL_SIMPLE=y
CONFIG_FB_FOREIGN_ENDIAN=y
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y
CONFIG_FB_SIMPLE=y
CONFIG_LCD_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_GENERIC is not set
CONFIG_BACKLIGHT_PWM=y
CONFIG_BACKLIGHT_GPIO=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
# CONFIG_SND_DRIVERS is not set
# CONFIG_SND_SPI is not set
CONFIG_SND_SOC=y
CONFIG_SND_SUN4I_CODEC=y
CONFIG_SND_SUN4I_I2S=y
CONFIG_SND_SUN4I_SPDIF=y
CONFIG_SND_SIMPLE_CARD=y
CONFIG_HID_A4TECH=y
CONFIG_HID_APPLE=y
CONFIG_HID_BELKIN=y
CONFIG_HID_CHERRY=y
CONFIG_HID_CHICONY=y
CONFIG_HID_CYPRESS=y
CONFIG_HID_EZKEY=y
CONFIG_HID_ITE=y
CONFIG_HID_KENSINGTON=y
CONFIG_HID_LOGITECH=y
CONFIG_HID_REDRAGON=y
CONFIG_HID_MICROSOFT=y
CONFIG_HID_MONTEREY=y
CONFIG_USB_HIDDEV=y
CONFIG_USB=y
CONFIG_USB_DYNAMIC_MINORS=y
CONFIG_USB_OTG=y
CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_STORAGE=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_SUNXI=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_USB_CONFIGFS_F_PRINTER=y
CONFIG_MMC=y
CONFIG_MMC_SUNXI=y
CONFIG_DMADEVICES=y
# CONFIG_VIRTIO_MENU is not set
CONFIG_STAGING=y
CONFIG_STAGING_MEDIA=y
CONFIG_VIDEO_SUNXI=y
CONFIG_VIDEO_SUNXI_CEDAR_VE=y
CONFIG_VIDEO_SUNXI_CEDAR_ION=y
CONFIG_FB_TFT=y
CONFIG_FB_TFT_ST7789V=y
CONFIG_SUN8I_A83T_CCU=y
CONFIG_SUN8I_DE2_CCU=y
CONFIG_SUN8I_R_CCU=y
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_PWM=y
CONFIG_PWM_SUN4I=y
CONFIG_PHY_SUN4I_USB=y
# CONFIG_NVMEM is not set
CONFIG_EXT4_FS=y
CONFIG_OVERLAY_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_SUMMARY=y
CONFIG_SQUASHFS=y
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_CRYPTO_ECHAINIV=y
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_DEV_SUN4I_SS=y
CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG=y
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_FS=y
CONFIG_STACKTRACE=y
CONFIG_RCU_TRACE=y
# CONFIG_FTRACE is not set
# CONFIG_RUNTIME_TESTING_MENU is not set

View File

@ -0,0 +1,38 @@
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
CONFIG_SYS_TEXT_BASE=0x81700000
CONFIG_SPL=y
CONFIG_MACH_SUNIV=y
CONFIG_SYS_CLK_FREQ=408000000
CONFIG_DRAM_CLK=168
CONFIG_DRAM_ZQ=0
CONFIG_MMC_SUNXI_SLOT_EXTRA=1
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:30000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:0,vmode:0"
CONFIG_SPL_SPI_SUNXI=y
CONFIG_BOOTDELAY=3
CONFIG_CMD_DFU=y
CONFIG_CMD_MTD=y
CONFIG_CMD_USB_MASS_STORAGE=y
CONFIG_CMD_MTDPARTS=y
CONFIG_DEFAULT_DEVICE_TREE="suniv-uboot"
# CONFIG_ENV_IS_IN_FAT is not set
CONFIG_USE_DEFAULT_ENV_FILE=y
CONFIG_DEFAULT_ENV_FILE="../../../board/allwinner-generic/suniv-generic/uboot.env"
# CONFIG_NET is not set
CONFIG_DFU_TIMEOUT=y
CONFIG_DFU_MMC=y
CONFIG_DFU_SF=y
CONFIG_DFU_MTD=y
# CONFIG_USB_FUNCTION_FASTBOOT is not set
CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_MTD_SPI_NAND=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH_BAR=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_PHY_SUN4I_USB=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=250
CONFIG_USB_GADGET_DOWNLOAD=y

View File

@ -0,0 +1,163 @@
// SPDX-License-Identifier: (GPL-2.0+ OR X11)
/dts-v1/;
#include "suniv-f1c100s-linux.dtsi"
/ {
model = "yuzukihd yuzukimavericks";
compatible = "allwinner,suniv-f1c200s", "allwinner,suniv-f1c100s";
chosen {
#address-cells = <1>;
#size-cells = <1>;
ranges;
bootargs = "panic=5 console=tty1 fbcon=rotate:90,font:MINI4x6 console=ttyS0,115200 rootwait root=/dev/mtdblock2 rw rootfstype=squashfs overlayfsdev=/dev/mtdblock3";
};
};
&spi0 {
status = "okay";
spi-nor@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "winbond,w25q128jv", "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x70000>;
read-only;
};
partition@1 {
label = "kernel";
reg = <0x70000 0x590000>;
read-only;
};
partition@2 {
label = "rootfs";
reg = <0x600000 0x700000>;
// read-only;
};
partition@3 {
label = "overlay";
reg = <0xd00000 0x300000>;
};
};
};
spi-nand@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};
partition@1 {
label = "kernel";
reg = <0x100000 0x500000>;
read-only;
};
partition@2 {
label = "rom";
reg = <0x600000 0x2a00000>;
read-only;
};
partition@3 {
label = "vendor";
reg = <0x3000000 0x1000000>;
};
partition@4 {
label = "overlay";
reg = <0x4000000 0x3000000>;
};
};
};
};
&spi1 {
status = "okay";
pinctrl-0 = <&spi1_pins>;
st7789v@0 {
status = "okay";
compatible = "sitronix,st7789v";
reg = <0>;
spi-max-frequency = <50000000>;
rotate = <90>;
spi-cpol;
spi-cpha;
rgb;
fps = <60>;
buswidth = <8>;
reset = <&pio 4 7 GPIO_ACTIVE_LOW>;
dc = <&pio 4 10 GPIO_ACTIVE_LOW>;
debug = <0>;
};
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pe_pins>;
status = "okay";
};
&mmc0 {
status = "okay";
broken-cd;
};
&otg_sram {
status = "okay";
};
&usb_otg {
dr_mode = "otg";
status = "okay";
};
&usbphy {
status = "okay";
};
&cedar_ve {
status = "okay";
};
&ion {
status = "okay";
};
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"LINEIN", "Line In",
"FMINL", "Left FM In",
"FMINR", "Right FM In",
"MIC", "Mic";
status = "okay";
};

View File

@ -0,0 +1,74 @@
// SPDX-License-Identifier: (GPL-2.0+ OR X11)
/dts-v1/;
#include "suniv-f1c100s-uboot.dtsi"
#include <dt-bindings/gpio/gpio.h>
/ {
model = "yuzukihd yuzukimavericks";
compatible = "allwinner,suniv-f1c100s", "allwinner,suniv";
aliases {
serial0 = &uart0;
spi0 = &spi0;
};
chosen {
stdout-path = "serial0:115200n8";
};
};
&otg_sram {
status = "okay";
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_a>;
status = "okay";
spi-nor@0 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
compatible = "winbond,w25q128jv", "jedec,spi-nor";
spi-max-frequency = <50000000>;
};
spi-nand@1 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
compatible = "spi-nand";
spi-max-frequency = <50000000>;
};
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins_a>;
status = "okay";
};
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins_a>;
status = "okay";
};
&usb_otg {
status = "okay";
};
&usbphy {
status = "okay";
};
&mmc0 {
status = "okay";
};
&mmc2 {
status = "okay";
};

View File

@ -0,0 +1,149 @@
From 1b60568adb073e0b76b8bb7cb59419aa11feb7cb Mon Sep 17 00:00:00 2001
From: YuzukiTsuru <gloomyghost@gloomyghost.com>
Date: Sun, 20 Feb 2022 16:40:40 +0800
Subject: [PATCH] fbtft: support kernel 5.4 add st7789v
---
drivers/staging/fbtft/fb_st7789v.c | 4 +-
drivers/staging/fbtft/fbtft-core.c | 89 ++++++++++++++++++++----------
2 files changed, 63 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
index 3c3f38793..eb6f55600 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -230,8 +230,8 @@ static int blank(struct fbtft_par *par, bool on)
static struct fbtft_display display = {
.regwidth = 8,
- .width = 240,
- .height = 320,
+ .width = 135,
+ .height = 240,
.gamma_num = 2,
.gamma_len = 14,
.gamma = DEFAULT_GAMMA,
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 771697508..f8e1bb369 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -26,6 +26,9 @@
#include <linux/of.h>
#include <video/mipi_display.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
+
#include "fbtft.h"
#include "internal.h"
@@ -71,24 +74,42 @@ EXPORT_SYMBOL(fbtft_dbg_hex);
#ifdef CONFIG_OF
static int fbtft_request_one_gpio(struct fbtft_par *par,
- const char *name, int index,
- struct gpio_desc **gpiop)
+ const char *name, int index,
+ struct gpio_desc **gpiop)
{
- struct device *dev = par->info->device;
- int ret = 0;
-
- *gpiop = devm_gpiod_get_index_optional(dev, name, index,
- GPIOD_OUT_LOW);
- if (IS_ERR(*gpiop)) {
- ret = PTR_ERR(*gpiop);
- dev_err(dev,
- "Failed to request %s GPIO: %d\n", name, ret);
- return ret;
- }
- fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' GPIO\n",
- __func__, name);
-
- return ret;
+ struct device *dev = par->info->device;
+ struct device_node *node = dev->of_node;
+ int gpio, flags, ret = 0;
+ enum of_gpio_flags of_flags;
+
+ if (of_find_property(node, name, NULL)) {
+ gpio = of_get_named_gpio_flags(node, name, index, &of_flags);
+ if (gpio == -ENOENT)
+ return 0;
+ if (gpio == -EPROBE_DEFER)
+ return gpio;
+ if (gpio < 0) {
+ dev_err(dev,
+ "failed to get '%s' from DT\n", name);
+ return gpio;
+ }
+ flags = (of_flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_LOW :
+ GPIOF_OUT_INIT_HIGH;
+ ret = devm_gpio_request_one(dev, gpio, flags,
+ dev->driver->name);
+ if (ret) {
+ dev_err(dev,
+ "gpio_request_one('%s'=%d) failed with %d\n",
+ name, gpio, ret);
+ return ret;
+ }
+
+ *gpiop = gpio_to_desc(gpio);
+ fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' = GPIO%d\n",
+ __func__, name, gpio);
+ }
+
+ return ret;
}
static int fbtft_request_gpios_dt(struct fbtft_par *par)
@@ -211,6 +232,20 @@ EXPORT_SYMBOL(fbtft_register_backlight);
static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe,
int ye)
{
+ switch(par->info->var.rotate)
+ {
+ case 0: xs+=53;xe+=53;ys+=40;ye+=40;
+ break;
+ case 90: xs+=40;xe+=40;ys+=53;ye+=53;
+ break;
+ case 180: xs+=53;xe+=53;ys+=40;ye+=40;
+ break;
+ case 270: xs+=40;xe+=40;ys+=53;ye+=53;
+ break;
+ default :
+ break;
+ }
+
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
(xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF);
@@ -222,17 +257,15 @@ static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe,
static void fbtft_reset(struct fbtft_par *par)
{
- if (!par->gpio.reset)
- return;
-
- fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
-
- gpiod_set_value_cansleep(par->gpio.reset, 1);
- usleep_range(20, 40);
- gpiod_set_value_cansleep(par->gpio.reset, 0);
- msleep(120);
-
- gpiod_set_value_cansleep(par->gpio.cs, 1); /* Activate chip */
+ if (!par->gpio.reset)
+ return;
+ fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
+ gpiod_set_value_cansleep(par->gpio.reset, 1);
+ msleep(10);
+ gpiod_set_value_cansleep(par->gpio.reset, 0);
+ msleep(200);
+ gpiod_set_value_cansleep(par->gpio.reset, 1);
+ msleep(10);
}
static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
--
2.17.1

View File

@ -0,0 +1,678 @@
From 6b034170a1b551c450653cdb02d4437a74109a15 Mon Sep 17 00:00:00 2001
From: YuzukiTsuru <gloomyghost@gloomyghost.com>
Date: Mon, 21 Feb 2022 22:02:45 +0800
Subject: [PATCH] fix st7789v init_display para add new shift addr
---
drivers/staging/fbtft/fbtft-core.c | 401 ++++++++++++++---------------
1 file changed, 193 insertions(+), 208 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index f8e1bb369..4e1e11109 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -44,14 +44,14 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc)
ret = par->fbtftops.write(par, buf, len);
if (ret < 0)
- dev_err(par->info->device,
- "write() failed and returned %d\n", ret);
+ dev_err(par->info->device, "write() failed and returned %d\n",
+ ret);
return ret;
}
EXPORT_SYMBOL(fbtft_write_buf_dc);
-void fbtft_dbg_hex(const struct device *dev, int groupsize,
- void *buf, size_t len, const char *fmt, ...)
+void fbtft_dbg_hex(const struct device *dev, int groupsize, void *buf,
+ size_t len, const char *fmt, ...)
{
va_list args;
static char textbuf[512];
@@ -73,43 +73,41 @@ void fbtft_dbg_hex(const struct device *dev, int groupsize,
EXPORT_SYMBOL(fbtft_dbg_hex);
#ifdef CONFIG_OF
-static int fbtft_request_one_gpio(struct fbtft_par *par,
- const char *name, int index,
- struct gpio_desc **gpiop)
+static int fbtft_request_one_gpio(struct fbtft_par *par, const char *name,
+ int index, struct gpio_desc **gpiop)
{
- struct device *dev = par->info->device;
- struct device_node *node = dev->of_node;
- int gpio, flags, ret = 0;
- enum of_gpio_flags of_flags;
-
- if (of_find_property(node, name, NULL)) {
- gpio = of_get_named_gpio_flags(node, name, index, &of_flags);
- if (gpio == -ENOENT)
- return 0;
- if (gpio == -EPROBE_DEFER)
- return gpio;
- if (gpio < 0) {
- dev_err(dev,
- "failed to get '%s' from DT\n", name);
- return gpio;
- }
- flags = (of_flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_LOW :
- GPIOF_OUT_INIT_HIGH;
- ret = devm_gpio_request_one(dev, gpio, flags,
- dev->driver->name);
- if (ret) {
- dev_err(dev,
- "gpio_request_one('%s'=%d) failed with %d\n",
- name, gpio, ret);
- return ret;
- }
-
- *gpiop = gpio_to_desc(gpio);
- fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' = GPIO%d\n",
- __func__, name, gpio);
- }
-
- return ret;
+ struct device *dev = par->info->device;
+ struct device_node *node = dev->of_node;
+ int gpio, flags, ret = 0;
+ enum of_gpio_flags of_flags;
+
+ if (of_find_property(node, name, NULL)) {
+ gpio = of_get_named_gpio_flags(node, name, index, &of_flags);
+ if (gpio == -ENOENT)
+ return 0;
+ if (gpio == -EPROBE_DEFER)
+ return gpio;
+ if (gpio < 0) {
+ dev_err(dev, "failed to get '%s' from DT\n", name);
+ return gpio;
+ }
+ flags = (of_flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_LOW :
+ GPIOF_OUT_INIT_HIGH;
+ ret = devm_gpio_request_one(dev, gpio, flags,
+ dev->driver->name);
+ if (ret) {
+ dev_err(dev,
+ "gpio_request_one('%s'=%d) failed with %d\n",
+ name, gpio, ret);
+ return ret;
+ }
+
+ *gpiop = gpio_to_desc(gpio);
+ fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' = GPIO%d\n",
+ __func__, name, gpio);
+ }
+
+ return ret;
}
static int fbtft_request_gpios_dt(struct fbtft_par *par)
@@ -139,16 +137,13 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par)
if (ret)
return ret;
for (i = 0; i < 16; i++) {
- ret = fbtft_request_one_gpio(par, "db", i,
- &par->gpio.db[i]);
+ ret = fbtft_request_one_gpio(par, "db", i, &par->gpio.db[i]);
if (ret)
return ret;
- ret = fbtft_request_one_gpio(par, "led", i,
- &par->gpio.led[i]);
+ ret = fbtft_request_one_gpio(par, "led", i, &par->gpio.led[i]);
if (ret)
return ret;
- ret = fbtft_request_one_gpio(par, "aux", i,
- &par->gpio.aux[i]);
+ ret = fbtft_request_one_gpio(par, "aux", i, &par->gpio.aux[i]);
if (ret)
return ret;
}
@@ -163,8 +158,8 @@ static int fbtft_backlight_update_status(struct backlight_device *bd)
bool polarity = par->polarity;
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
- "%s: polarity=%d, power=%d, fb_blank=%d\n",
- __func__, polarity, bd->props.power, bd->props.fb_blank);
+ "%s: polarity=%d, power=%d, fb_blank=%d\n", __func__,
+ polarity, bd->props.power, bd->props.fb_blank);
if ((bd->props.power == FB_BLANK_UNBLANK) &&
(bd->props.fb_blank == FB_BLANK_UNBLANK))
@@ -192,14 +187,16 @@ void fbtft_unregister_backlight(struct fbtft_par *par)
EXPORT_SYMBOL(fbtft_unregister_backlight);
static const struct backlight_ops fbtft_bl_ops = {
- .get_brightness = fbtft_backlight_get_brightness,
- .update_status = fbtft_backlight_update_status,
+ .get_brightness = fbtft_backlight_get_brightness,
+ .update_status = fbtft_backlight_update_status,
};
void fbtft_register_backlight(struct fbtft_par *par)
{
struct backlight_device *bd;
- struct backlight_properties bl_props = { 0, };
+ struct backlight_properties bl_props = {
+ 0,
+ };
if (!par->gpio.led[0]) {
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
@@ -214,8 +211,8 @@ void fbtft_register_backlight(struct fbtft_par *par)
par->polarity = true;
bd = backlight_device_register(dev_driver_string(par->info->device),
- par->info->device, par,
- &fbtft_bl_ops, &bl_props);
+ par->info->device, par, &fbtft_bl_ops,
+ &bl_props);
if (IS_ERR(bd)) {
dev_err(par->info->device,
"cannot register backlight device (%ld)\n",
@@ -232,40 +229,37 @@ EXPORT_SYMBOL(fbtft_register_backlight);
static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe,
int ye)
{
- switch(par->info->var.rotate)
- {
- case 0: xs+=53;xe+=53;ys+=40;ye+=40;
- break;
- case 90: xs+=40;xe+=40;ys+=53;ye+=53;
- break;
- case 180: xs+=53;xe+=53;ys+=40;ye+=40;
- break;
- case 270: xs+=40;xe+=40;ys+=53;ye+=53;
- break;
- default :
- break;
- }
+ if (par->info->var.rotate == 90) {
+ write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS, (xs + 40) >> 8,
+ xs + 40, ((xe + 40) >> 8) & 0xFF, (xe + 40) & 0xFF);
+
+ write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
+ ((ys + 52) >> 8) & 0xFF, (ys + 52) & 0xFF,
+ ((ye + 52) >> 8) & 0xFF, (ye + 52) & 0xFF);
- write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
- (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF);
+ write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
+ } else {
+ write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS, (xs >> 8) & 0xFF,
+ xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF);
- write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
- (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF);
+ write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS, (ys >> 8) & 0xFF,
+ ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF);
- write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
+ write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
+ }
}
static void fbtft_reset(struct fbtft_par *par)
{
- if (!par->gpio.reset)
- return;
- fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
- gpiod_set_value_cansleep(par->gpio.reset, 1);
- msleep(10);
- gpiod_set_value_cansleep(par->gpio.reset, 0);
- msleep(200);
- gpiod_set_value_cansleep(par->gpio.reset, 1);
- msleep(10);
+ if (!par->gpio.reset)
+ return;
+ fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
+ gpiod_set_value_cansleep(par->gpio.reset, 1);
+ msleep(10);
+ gpiod_set_value_cansleep(par->gpio.reset, 0);
+ msleep(200);
+ gpiod_set_value_cansleep(par->gpio.reset, 1);
+ msleep(10);
}
static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
@@ -277,11 +271,11 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
bool timeit = false;
int ret = 0;
- if (unlikely(par->debug & (DEBUG_TIME_FIRST_UPDATE |
- DEBUG_TIME_EACH_UPDATE))) {
+ if (unlikely(par->debug &
+ (DEBUG_TIME_FIRST_UPDATE | DEBUG_TIME_EACH_UPDATE))) {
if ((par->debug & DEBUG_TIME_EACH_UPDATE) ||
((par->debug & DEBUG_TIME_FIRST_UPDATE) &&
- !par->first_update_done)) {
+ !par->first_update_done)) {
ts_start = ktime_get();
timeit = true;
}
@@ -289,28 +283,31 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
/* Sanity checks */
if (start_line > end_line) {
- dev_warn(par->info->device,
- "%s: start_line=%u is larger than end_line=%u. Shouldn't happen, will do full display update\n",
- __func__, start_line, end_line);
+ dev_warn(
+ par->info->device,
+ "%s: start_line=%u is larger than end_line=%u. Shouldn't happen, will do full display update\n",
+ __func__, start_line, end_line);
start_line = 0;
end_line = par->info->var.yres - 1;
}
if (start_line > par->info->var.yres - 1 ||
end_line > par->info->var.yres - 1) {
- dev_warn(par->info->device,
- "%s: start_line=%u or end_line=%u is larger than max=%d. Shouldn't happen, will do full display update\n",
- __func__, start_line,
- end_line, par->info->var.yres - 1);
+ dev_warn(
+ par->info->device,
+ "%s: start_line=%u or end_line=%u is larger than max=%d. Shouldn't happen, will do full display update\n",
+ __func__, start_line, end_line,
+ par->info->var.yres - 1);
start_line = 0;
end_line = par->info->var.yres - 1;
}
- fbtft_par_dbg(DEBUG_UPDATE_DISPLAY, par, "%s(start_line=%u, end_line=%u)\n",
- __func__, start_line, end_line);
+ fbtft_par_dbg(DEBUG_UPDATE_DISPLAY, par,
+ "%s(start_line=%u, end_line=%u)\n", __func__, start_line,
+ end_line);
if (par->fbtftops.set_addr_win)
par->fbtftops.set_addr_win(par, 0, start_line,
- par->info->var.xres - 1, end_line);
+ par->info->var.xres - 1, end_line);
offset = start_line * par->info->fix.line_length;
len = (end_line - start_line + 1) * par->info->fix.line_length;
@@ -334,8 +331,8 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
throughput = throughput * 1000 / 1024;
dev_info(par->info->device,
- "Display update: %ld kB/s, fps=%ld\n",
- throughput, fps);
+ "Display update: %ld kB/s, fps=%ld\n", throughput,
+ fps);
par->first_update_done = true;
}
}
@@ -381,13 +378,12 @@ static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagelist)
spin_unlock(&par->dirty_lock);
/* Mark display lines as dirty */
- list_for_each_entry(page, pagelist, lru) {
+ list_for_each_entry (page, pagelist, lru) {
count++;
index = page->index << PAGE_SHIFT;
y_low = index / info->fix.line_length;
y_high = (index + PAGE_SIZE - 1) / info->fix.line_length;
- dev_dbg(info->device,
- "page->index=%lu y_low=%d y_high=%d\n",
+ dev_dbg(info->device, "page->index=%lu y_low=%d y_high=%d\n",
page->index, y_low, y_high);
if (y_high > info->var.yres - 1)
y_high = info->var.yres - 1;
@@ -397,8 +393,8 @@ static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagelist)
dirty_lines_end = y_high;
}
- par->fbtftops.update_display(info->par,
- dirty_lines_start, dirty_lines_end);
+ par->fbtftops.update_display(info->par, dirty_lines_start,
+ dirty_lines_end);
}
static void fbtft_fb_fillrect(struct fb_info *info,
@@ -406,9 +402,8 @@ static void fbtft_fb_fillrect(struct fb_info *info,
{
struct fbtft_par *par = info->par;
- dev_dbg(info->dev,
- "%s: dx=%d, dy=%d, width=%d, height=%d\n",
- __func__, rect->dx, rect->dy, rect->width, rect->height);
+ dev_dbg(info->dev, "%s: dx=%d, dy=%d, width=%d, height=%d\n", __func__,
+ rect->dx, rect->dy, rect->width, rect->height);
sys_fillrect(info, rect);
par->fbtftops.mkdirty(info, rect->dy, rect->height);
@@ -419,9 +414,8 @@ static void fbtft_fb_copyarea(struct fb_info *info,
{
struct fbtft_par *par = info->par;
- dev_dbg(info->dev,
- "%s: dx=%d, dy=%d, width=%d, height=%d\n",
- __func__, area->dx, area->dy, area->width, area->height);
+ dev_dbg(info->dev, "%s: dx=%d, dy=%d, width=%d, height=%d\n", __func__,
+ area->dx, area->dy, area->width, area->height);
sys_copyarea(info, area);
par->fbtftops.mkdirty(info, area->dy, area->height);
@@ -432,9 +426,8 @@ static void fbtft_fb_imageblit(struct fb_info *info,
{
struct fbtft_par *par = info->par;
- dev_dbg(info->dev,
- "%s: dx=%d, dy=%d, width=%d, height=%d\n",
- __func__, image->dx, image->dy, image->width, image->height);
+ dev_dbg(info->dev, "%s: dx=%d, dy=%d, width=%d, height=%d\n", __func__,
+ image->dx, image->dy, image->width, image->height);
sys_imageblit(info, image);
par->fbtftops.mkdirty(info, image->dy, image->height);
@@ -446,8 +439,8 @@ static ssize_t fbtft_fb_write(struct fb_info *info, const char __user *buf,
struct fbtft_par *par = info->par;
ssize_t res;
- dev_dbg(info->dev,
- "%s: count=%zd, ppos=%llu\n", __func__, count, *ppos);
+ dev_dbg(info->dev, "%s: count=%zd, ppos=%llu\n", __func__, count,
+ *ppos);
res = fb_sys_write(info, buf, count, ppos);
/* TODO: only mark changed area update all for now */
@@ -480,9 +473,9 @@ static int fbtft_fb_setcolreg(unsigned int regno, unsigned int red,
if (regno < 16) {
u32 *pal = info->pseudo_palette;
- val = chan_to_field(red, &info->var.red);
+ val = chan_to_field(red, &info->var.red);
val |= chan_to_field(green, &info->var.green);
- val |= chan_to_field(blue, &info->var.blue);
+ val |= chan_to_field(blue, &info->var.blue);
pal[regno] = val;
ret = 0;
@@ -497,8 +490,7 @@ static int fbtft_fb_blank(int blank, struct fb_info *info)
struct fbtft_par *par = info->par;
int ret = -EINVAL;
- dev_dbg(info->dev, "%s(blank=%d)\n",
- __func__, blank);
+ dev_dbg(info->dev, "%s(blank=%d)\n", __func__, blank);
if (!par->fbtftops.blank)
return ret;
@@ -596,7 +588,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
/* sanity check */
if (display->gamma_num * display->gamma_len >
- FBTFT_GAMMA_MAX_VALUES_TOTAL) {
+ FBTFT_GAMMA_MAX_VALUES_TOTAL) {
dev_err(dev, "FBTFT_GAMMA_MAX_VALUES_TOTAL=%d is exceeded\n",
FBTFT_GAMMA_MAX_VALUES_TOTAL);
return NULL;
@@ -641,11 +633,11 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
switch (pdata->rotate) {
case 90:
case 270:
- width = display->height;
+ width = display->height;
height = display->width;
break;
default:
- width = display->width;
+ width = display->width;
height = display->height;
}
@@ -667,11 +659,10 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
goto alloc_fail;
if (display->gamma_num && display->gamma_len) {
- gamma_curves = devm_kcalloc(dev,
- display->gamma_num *
- display->gamma_len,
- sizeof(gamma_curves[0]),
- GFP_KERNEL);
+ gamma_curves =
+ devm_kcalloc(dev,
+ display->gamma_num * display->gamma_len,
+ sizeof(gamma_curves[0]), GFP_KERNEL);
if (!gamma_curves)
goto alloc_fail;
}
@@ -684,48 +675,48 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
info->fbops = fbops;
info->fbdefio = fbdefio;
- fbops->owner = dev->driver->owner;
- fbops->fb_read = fb_sys_read;
- fbops->fb_write = fbtft_fb_write;
- fbops->fb_fillrect = fbtft_fb_fillrect;
- fbops->fb_copyarea = fbtft_fb_copyarea;
- fbops->fb_imageblit = fbtft_fb_imageblit;
- fbops->fb_setcolreg = fbtft_fb_setcolreg;
- fbops->fb_blank = fbtft_fb_blank;
-
- fbdefio->delay = HZ / fps;
- fbdefio->deferred_io = fbtft_deferred_io;
+ fbops->owner = dev->driver->owner;
+ fbops->fb_read = fb_sys_read;
+ fbops->fb_write = fbtft_fb_write;
+ fbops->fb_fillrect = fbtft_fb_fillrect;
+ fbops->fb_copyarea = fbtft_fb_copyarea;
+ fbops->fb_imageblit = fbtft_fb_imageblit;
+ fbops->fb_setcolreg = fbtft_fb_setcolreg;
+ fbops->fb_blank = fbtft_fb_blank;
+
+ fbdefio->delay = HZ / fps;
+ fbdefio->deferred_io = fbtft_deferred_io;
fb_deferred_io_init(info);
snprintf(info->fix.id, sizeof(info->fix.id), "%s", dev->driver->name);
- info->fix.type = FB_TYPE_PACKED_PIXELS;
- info->fix.visual = FB_VISUAL_TRUECOLOR;
- info->fix.xpanstep = 0;
- info->fix.ypanstep = 0;
- info->fix.ywrapstep = 0;
- info->fix.line_length = width * bpp / 8;
- info->fix.accel = FB_ACCEL_NONE;
- info->fix.smem_len = vmem_size;
-
- info->var.rotate = pdata->rotate;
- info->var.xres = width;
- info->var.yres = height;
- info->var.xres_virtual = info->var.xres;
- info->var.yres_virtual = info->var.yres;
+ info->fix.type = FB_TYPE_PACKED_PIXELS;
+ info->fix.visual = FB_VISUAL_TRUECOLOR;
+ info->fix.xpanstep = 0;
+ info->fix.ypanstep = 0;
+ info->fix.ywrapstep = 0;
+ info->fix.line_length = width * bpp / 8;
+ info->fix.accel = FB_ACCEL_NONE;
+ info->fix.smem_len = vmem_size;
+
+ info->var.rotate = pdata->rotate;
+ info->var.xres = width;
+ info->var.yres = height;
+ info->var.xres_virtual = info->var.xres;
+ info->var.yres_virtual = info->var.yres;
info->var.bits_per_pixel = bpp;
- info->var.nonstd = 1;
+ info->var.nonstd = 1;
/* RGB565 */
- info->var.red.offset = 11;
- info->var.red.length = 5;
- info->var.green.offset = 5;
- info->var.green.length = 6;
- info->var.blue.offset = 0;
- info->var.blue.length = 5;
- info->var.transp.offset = 0;
- info->var.transp.length = 0;
+ info->var.red.offset = 11;
+ info->var.red.length = 5;
+ info->var.green.offset = 5;
+ info->var.green.length = 6;
+ info->var.blue.offset = 0;
+ info->var.blue.length = 5;
+ info->var.transp.offset = 0;
+ info->var.transp.length = 0;
- info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
+ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
par = info->par;
par->info = info;
@@ -972,23 +963,20 @@ static int fbtft_init_display_dt(struct fbtft_par *par)
fbtft_par_dbg(DEBUG_INIT_DISPLAY, par,
"buf[%d] = %02X\n", j, buf[j]);
- par->fbtftops.write_register(par, i,
- buf[0], buf[1], buf[2], buf[3],
- buf[4], buf[5], buf[6], buf[7],
- buf[8], buf[9], buf[10], buf[11],
- buf[12], buf[13], buf[14], buf[15],
- buf[16], buf[17], buf[18], buf[19],
- buf[20], buf[21], buf[22], buf[23],
- buf[24], buf[25], buf[26], buf[27],
- buf[28], buf[29], buf[30], buf[31],
- buf[32], buf[33], buf[34], buf[35],
- buf[36], buf[37], buf[38], buf[39],
- buf[40], buf[41], buf[42], buf[43],
- buf[44], buf[45], buf[46], buf[47],
- buf[48], buf[49], buf[50], buf[51],
- buf[52], buf[53], buf[54], buf[55],
- buf[56], buf[57], buf[58], buf[59],
- buf[60], buf[61], buf[62], buf[63]);
+ par->fbtftops.write_register(
+ par, i, buf[0], buf[1], buf[2], buf[3], buf[4],
+ buf[5], buf[6], buf[7], buf[8], buf[9], buf[10],
+ buf[11], buf[12], buf[13], buf[14], buf[15],
+ buf[16], buf[17], buf[18], buf[19], buf[20],
+ buf[21], buf[22], buf[23], buf[24], buf[25],
+ buf[26], buf[27], buf[28], buf[29], buf[30],
+ buf[31], buf[32], buf[33], buf[34], buf[35],
+ buf[36], buf[37], buf[38], buf[39], buf[40],
+ buf[41], buf[42], buf[43], buf[44], buf[45],
+ buf[46], buf[47], buf[48], buf[49], buf[50],
+ buf[51], buf[52], buf[53], buf[54], buf[55],
+ buf[56], buf[57], buf[58], buf[59], buf[60],
+ buf[61], buf[62], buf[63]);
} else if (val & FBTFT_OF_INIT_DELAY) {
fbtft_par_dbg(DEBUG_INIT_DISPLAY, par,
"init: msleep(%u)\n", val & 0xFFFF);
@@ -1023,8 +1011,7 @@ int fbtft_init_display(struct fbtft_par *par)
/* sanity check */
if (!par->init_sequence) {
- dev_err(par->info->device,
- "error: init_sequence is not set\n");
+ dev_err(par->info->device, "error: init_sequence is not set\n");
return -EINVAL;
}
@@ -1083,23 +1070,20 @@ int fbtft_init_display(struct fbtft_par *par)
}
buf[j++] = par->init_sequence[i++];
}
- par->fbtftops.write_register(par, j,
- buf[0], buf[1], buf[2], buf[3],
- buf[4], buf[5], buf[6], buf[7],
- buf[8], buf[9], buf[10], buf[11],
- buf[12], buf[13], buf[14], buf[15],
- buf[16], buf[17], buf[18], buf[19],
- buf[20], buf[21], buf[22], buf[23],
- buf[24], buf[25], buf[26], buf[27],
- buf[28], buf[29], buf[30], buf[31],
- buf[32], buf[33], buf[34], buf[35],
- buf[36], buf[37], buf[38], buf[39],
- buf[40], buf[41], buf[42], buf[43],
- buf[44], buf[45], buf[46], buf[47],
- buf[48], buf[49], buf[50], buf[51],
- buf[52], buf[53], buf[54], buf[55],
- buf[56], buf[57], buf[58], buf[59],
- buf[60], buf[61], buf[62], buf[63]);
+ par->fbtftops.write_register(
+ par, j, buf[0], buf[1], buf[2], buf[3], buf[4],
+ buf[5], buf[6], buf[7], buf[8], buf[9], buf[10],
+ buf[11], buf[12], buf[13], buf[14], buf[15],
+ buf[16], buf[17], buf[18], buf[19], buf[20],
+ buf[21], buf[22], buf[23], buf[24], buf[25],
+ buf[26], buf[27], buf[28], buf[29], buf[30],
+ buf[31], buf[32], buf[33], buf[34], buf[35],
+ buf[36], buf[37], buf[38], buf[39], buf[40],
+ buf[41], buf[42], buf[43], buf[44], buf[45],
+ buf[46], buf[47], buf[48], buf[49], buf[50],
+ buf[51], buf[52], buf[53], buf[54], buf[55],
+ buf[56], buf[57], buf[58], buf[59], buf[60],
+ buf[61], buf[62], buf[63]);
break;
case -2:
i++;
@@ -1137,7 +1121,7 @@ static int fbtft_verify_gpios(struct fbtft_par *par)
fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__);
- if (pdata->display.buswidth != 9 && par->startbyte == 0 &&
+ if (pdata->display.buswidth != 9 && par->startbyte == 0 &&
!par->gpio.dc) {
dev_err(par->info->device,
"Missing info about 'dc' gpio. Aborting.\n");
@@ -1232,8 +1216,7 @@ static struct fbtft_platform_data *fbtft_probe_dt(struct device *dev)
*
* Return: 0 if successful, negative if error
*/
-int fbtft_probe_common(struct fbtft_display *display,
- struct spi_device *sdev,
+int fbtft_probe_common(struct fbtft_display *display, struct spi_device *sdev,
struct platform_device *pdev)
{
struct device *dev;
@@ -1280,9 +1263,10 @@ int fbtft_probe_common(struct fbtft_display *display,
else if (display->regwidth == 16 && display->buswidth == 16)
par->fbtftops.write_register = fbtft_write_reg16_bus16;
else
- dev_warn(dev,
- "no default functions for regwidth=%d and buswidth=%d\n",
- display->regwidth, display->buswidth);
+ dev_warn(
+ dev,
+ "no default functions for regwidth=%d and buswidth=%d\n",
+ display->regwidth, display->buswidth);
/* write_vmem() functions */
if (display->buswidth == 8)
@@ -1305,13 +1289,14 @@ int fbtft_probe_common(struct fbtft_display *display,
if (par->spi->master->bits_per_word_mask & SPI_BPW_MASK(9)) {
par->spi->bits_per_word = 9;
} else {
- dev_warn(&par->spi->dev,
- "9-bit SPI not available, emulating using 8-bit.\n");
+ dev_warn(
+ &par->spi->dev,
+ "9-bit SPI not available, emulating using 8-bit.\n");
/* allocate buffer with room for dc bits */
- par->extra = devm_kzalloc(par->info->device,
- par->txbuf.len +
- (par->txbuf.len / 8) + 8,
- GFP_KERNEL);
+ par->extra = devm_kzalloc(
+ par->info->device,
+ par->txbuf.len + (par->txbuf.len / 8) + 8,
+ GFP_KERNEL);
if (!par->extra) {
ret = -ENOMEM;
goto out_release;
@@ -1363,8 +1348,8 @@ int fbtft_remove_common(struct device *dev, struct fb_info *info)
return -EINVAL;
par = info->par;
if (par)
- fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par,
- "%s()\n", __func__);
+ fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, "%s()\n",
+ __func__);
fbtft_unregister_framebuffer(info);
fbtft_framebuffer_release(info);
--
2.17.1

View File

@ -0,0 +1,138 @@
From a07aa8c4a2300568b6c24a688a454ece1b404824 Mon Sep 17 00:00:00 2001
From: YuzukiTsuru <gloomyghost@gloomyghost.com>
Date: Mon, 21 Feb 2022 22:22:04 +0800
Subject: [PATCH] fbtft fix disp init
---
drivers/staging/fbtft/fb_st7789v.c | 94 ++++++++++++------------------
1 file changed, 36 insertions(+), 58 deletions(-)
diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
index eb6f55600..0ed271198 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -16,8 +16,8 @@
#define DRVNAME "fb_st7789v"
-#define DEFAULT_GAMMA \
- "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \
+#define DEFAULT_GAMMA \
+ "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \
"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25"
/**
@@ -76,50 +76,28 @@ enum st7789v_command {
*/
static int init_display(struct fbtft_par *par)
{
- /* turn off sleep mode */
- write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
- mdelay(120);
-
- /* set pixel format to RGB-565 */
- write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
-
- write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22);
-
- /*
- * VGH = 13.26V
- * VGL = -10.43V
- */
- write_reg(par, GCTRL, 0x35);
-
- /*
- * VDV and VRH register values come from command write
- * (instead of NVM)
- */
- write_reg(par, VDVVRHEN, 0x01, 0xFF);
-
- /*
- * VAP = 4.1V + (VCOM + VCOM offset + 0.5 * VDV)
- * VAN = -4.1V + (VCOM + VCOM offset + 0.5 * VDV)
- */
- write_reg(par, VRHS, 0x0B);
-
- /* VDV = 0V */
- write_reg(par, VDVS, 0x20);
-
- /* VCOM = 0.9V */
- write_reg(par, VCOMS, 0x20);
-
- /* VCOM offset = 0V */
- write_reg(par, VCMOFSET, 0x20);
-
- /*
- * AVDD = 6.8V
- * AVCL = -4.8V
- * VDS = 2.3V
- */
- write_reg(par, PWCTRL1, 0xA4, 0xA1);
-
- write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
+ par->fbtftops.reset(par);
+ mdelay(50);
+ write_reg(par, 0x36, 0x00);
+ write_reg(par, 0x3A, 0x05);
+ write_reg(par, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33);
+ write_reg(par, 0xB7, 0x35);
+ write_reg(par, 0xBB, 0x19);
+ write_reg(par, 0xC0, 0x2C);
+ write_reg(par, 0xC2, 0x01);
+ write_reg(par, 0xC3, 0x12);
+ write_reg(par, 0xC4, 0x20);
+ write_reg(par, 0xC6, 0x0F);
+ write_reg(par, 0xD0, 0xA4, 0xA1);
+ write_reg(par, 0xE0, 0xD0, 0x04, 0x0D, 0x11, 0x13, 0x2B, 0x3F, 0x54,
+ 0x4C, 0x18, 0x0D, 0x0B, 0x1F, 0x23);
+ write_reg(par, 0xE1, 0xD0, 0x04, 0x0C, 0x11, 0x13, 0x2C, 0x3F, 0x44,
+ 0x51, 0x2F, 0x1F, 0x1F, 0x20, 0x23);
+ write_reg(par, 0x21);
+ write_reg(par, 0x11);
+ mdelay(50);
+ write_reg(par, 0x29);
+ mdelay(200);
return 0;
}
@@ -201,12 +179,11 @@ static int set_gamma(struct fbtft_par *par, u32 *curves)
c = i * par->gamma.num_values;
for (j = 0; j < par->gamma.num_values; j++)
curves[c + j] &= gamma_par_mask[j];
- write_reg(par, PVGAMCTRL + i,
- curves[c + 0], curves[c + 1], curves[c + 2],
- curves[c + 3], curves[c + 4], curves[c + 5],
- curves[c + 6], curves[c + 7], curves[c + 8],
- curves[c + 9], curves[c + 10], curves[c + 11],
- curves[c + 12], curves[c + 13]);
+ write_reg(par, PVGAMCTRL + i, curves[c + 0], curves[c + 1],
+ curves[c + 2], curves[c + 3], curves[c + 4],
+ curves[c + 5], curves[c + 6], curves[c + 7],
+ curves[c + 8], curves[c + 9], curves[c + 10],
+ curves[c + 11], curves[c + 12], curves[c + 13]);
}
return 0;
}
@@ -235,12 +212,13 @@ static struct fbtft_display display = {
.gamma_num = 2,
.gamma_len = 14,
.gamma = DEFAULT_GAMMA,
- .fbtftops = {
- .init_display = init_display,
- .set_var = set_var,
- .set_gamma = set_gamma,
- .blank = blank,
- },
+ .fbtftops =
+ {
+ .init_display = init_display,
+ .set_var = set_var,
+ .set_gamma = set_gamma,
+ .blank = blank,
+ },
};
FBTFT_REGISTER_DRIVER(DRVNAME, "sitronix,st7789v", &display);
--
2.17.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,78 @@
#
# uMTP Responder config file
# Must be copied to /etc/umtprd/umtprd.conf
#
# Loop / daemon mode
# Set to 1 to don't shutdown uMTPrd when the link is disconnected.
loop_on_disconnect 1
#storage command : Create add a storage entry point. Up to 16 entry points supported
#Syntax : storage "PATH" "NAME"
storage "/" "rootfs" "rw"
# Set the USB manufacturer string
manufacturer "yuzukihd"
# Set the USB Product string
product "yuzukiruler"
# Set the USB Serial number string
serial "01234567"
# Set the USB interface string. Should be always "MTP"
interface "MTP"
# Set the USB Vendor ID, Product ID and class
usb_vendor_id 0x1D6B # Linux Foundation
usb_product_id 0x0100 # PTP Gadget
usb_class 0x6 # Image
usb_subclass 0x1 # Still Imaging device
usb_protocol 0x1 #
# Device version
usb_dev_version 0x3008
# inotify support
# If you want disable the events support (beta), uncomment the following line :
# no_inotify 0x1
#
# Internal buffers size
#
# Internal default usb_max_rd_buffer_size and usb_max_wr_buffer_size value set to 0x10000.
# Internal default read_buffer_cache_size value set to 0x100000.
# Uncomment the following lines to reduce the buffers sizes to fix USB issues on iMX6 based systems.
# usb_max_rd_buffer_size 0x200 # MAX usb read size. Must be a multiple of 512 and be less than read_buffer_cache_size
# usb_max_wr_buffer_size 0x200 # MAX usb write size. Must be a multiple of 512.
# read_buffer_cache_size 0x4000 # Read file cache buffer. Must be a 2^x value.
#
# USB gadget device driver path
#
########################################################################
#
# -- Generic FunctionFS Mode --
#
########################################################################
usb_functionfs_mode 0x1
usb_dev_path "/dev/ffs-mtp/ep0"
usb_epin_path "/dev/ffs-mtp/ep1"
usb_epout_path "/dev/ffs-mtp/ep2"
usb_epint_path "/dev/ffs-mtp/ep3"
usb_max_packet_size 0x200

View File

@ -0,0 +1,55 @@
BR2_arm=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_GCC_ENABLE_LTO=y
BR2_PACKAGE_HOST_GDB=y
BR2_PACKAGE_HOST_GDB_TUI=y
BR2_PACKAGE_HOST_GDB_SIM=y
BR2_TARGET_GENERIC_HOSTNAME="yuzukimavericks"
BR2_TARGET_GENERIC_ISSUE="Welcome to Yuzuki Mavericks"
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_OVERLAY="board/yuzukihd/yuzukimavericks/rootfs board/allwinner-generic/suniv-f1c100s/rootfs"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/allwinner-generic/suniv-generic/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="${BR2_TARGET_UBOOT_SPL_NAME}"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.180"
BR2_LINUX_KERNEL_PATCH="board/allwinner-generic/suniv-f1c100s/patch/linux board/yuzukihd/yuzukimavericks/patch/linux"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/yuzukihd/yuzukimavericks/config/linux/linux_yuzukihd_yuzukimavericks_defconfig"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/allwinner-generic/suniv-f1c100s/dts/linux/suniv-f1c100s-linux.dtsi board/yuzukihd/yuzukimavericks/dts/suniv-linux.dts"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_GDB=y
BR2_PACKAGE_FB_TEST_APP=y
BR2_PACKAGE_UMTPRD=y
BR2_PACKAGE_TINYALSA=y
BR2_PACKAGE_TSLIB=y
BR2_PACKAGE_HAVEGED=y
BR2_PACKAGE_UTIL_LINUX_UUIDD=y
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_GZIP=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="100M"
BR2_TARGET_ROOTFS_SQUASHFS=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.07"
BR2_TARGET_UBOOT_PATCH="board/allwinner-generic/suniv-f1c100s/patch/uboot board/yuzukihd/yuzukimavericks/patch/uboot"
BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y
BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="board/yuzukihd/yuzukimavericks/config/uboot/uboot_yuzukihd_yuzukimavericks_defconfig"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
BR2_TARGET_UBOOT_CUSTOM_DTS_PATH="board/allwinner-generic/suniv-f1c100s/dts/uboot/suniv-f1c100s-uboot.dtsi board/yuzukihd/yuzukimavericks/dts/suniv-uboot.dts"
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_PYTHON3=y
BR2_PACKAGE_HOST_PYTHON3_SSL=y
BR2_PACKAGE_HOST_UBOOT_TOOLS=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y

View File

@ -9,6 +9,7 @@
| -------- | ----------- | ------- | ------- | ------- | --------- | --------- | --------- | --------- | --------- | --------- |
| YuzukiHD | YuzukiRuler | F1C200s | 2020.07 | 5.4.180 | yuzukihd_yuzukiruler_defconfig | ✅ | ✅ | ✅ | ✅ | ✅ |
| YuzukiHD | YuzukiCore F1 | F1C200s | 2020.07 | 5.4.180 | yuzukihd_yuzukicore_f1_defconfig | ✅ | ✅ | ✅ | ✅ | ✅ |
| YuzukiHD | Yuzuki Mavericks | `F1C200s` | `2020.07` | `5.4.180` | `yuzukihd_yuzukimavericks_defconfig` | ✅ | ✅ | ✅ | ✅ | ✅ |
| YuzukiHD | YuzukiCK1N | V3x | 2022.01 | 5.4.180 | yuzukihd_yuzukick1n_defconfig | ❌ | ❌ | ✅ | ⚠️ | ⚠️ |
| YuzukiHD | R11 86 Panel | R11 | 2022.01 | 5.4.180 | yuzukihd_r11_86panel_defconfig | ✅ | ✅ | ❌ | ❌ | ✅ |
| Sipeed | lichee nano | F1C100s | 2020.07 | 5.4.180 | sipeed_lichee_nano_defconfig | ✅ | ✅ | ✅ | ✅ | ✅ |