video: seps525: Add new driver for seps525 OLED display
cover video: seps525: Add new driver for seps525 OLED display
Hi,
This driver is connected via spi on one ZynqMP board. Only 8bit SPI connection is supported now. Spi zynq driver was used for testing this driver.
We have tested load image via BMP command and also using it as console as is visible from log in the last patch.
Thanks,
Michal
Michal Simek (2):
video: Introduce video_sync call
video: seps525: Add seps525 SPI driver
Vikhyat Goyal (1):
video: seps525: Add dt binding description
MAINTAINERS | 2 + .../video/syncoam,seps525.txt | 24 ++ drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/seps525.c | 327 ++++++++++++++++++ drivers/video/video-uclass.c | 5 + include/video.h | 13 + 7 files changed, 378 insertions(+) create mode 100644 doc/device-tree-bindings/video/syncoam,seps525.txt create mode 100644 drivers/video/seps525.c
Signature · 1 line
2.29.2
PATCH 1/3 video: Introduce video_sync call
Some drivers like LCD connected via SPI requires explicit sync function which copy framebuffer content over SPI to controller to display. This hook doesn't exist yet that's why introduce it via video operations.
---
Simon: Please review this. I didn't find existing way how this can be done that's why I am introducing this hook. Also maybe name can be named a little bit differently. That's why waiting for better suggestion.
--- drivers/video/video-uclass.c | 5 +++++ include/video.h | 13 +++++++++++++ 2 files changed, 18 insertions(+)
drivers/video/video-uclass.c +5 -0
@@ -174,6 +174,11 @@ void video_set_default_colors(struct udevice *dev, bool invert)/* Flush video activity to the caches */ void video_sync (struct udevice *vid,bool force) { +struct video_ops *ops =video_get_ops (vid); + +if (ops && ops->video_sync) + (void )ops->video_sync (vid); +/* * flush_dcache_range() is declared in common.h but it seems that some * architectures do not actually implement it. Is there a way to find
include/video.h +13 -0
@@ -115,7 +115,20 @@ struct video_priv { };/* Placeholder - there are no video operations at present */ +/** +* struct video_ops - structure for keeping video operations +*/ struct video_ops { +/** +* video_sync - Synchronize FB with device +* +* Some device like SPI based LCD displays needs synchronization when +* data in an FB is available. For these devices implement video_sync +* hook to call a sync function +* +* @vid: Video device udevice structure +*/ +int (*video_sync)(struct udevice *vid); };#define video_get_ops (dev) ((struct video_ops *)(dev)->driver->ops)
Signature · 1 line
2.29.2
PATCH 2/3 video: seps525: Add dt binding description
In reply to Michal SimekFrom: Vikhyat Goyal <[email protected]>
Added dt binding for seps525 display driver.
---
MAINTAINERS | 1 + .../video/syncoam,seps525.txt | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 doc/device-tree-bindings/video/syncoam,seps525.txt
MAINTAINERS +1 -0
@@ -547,6 +547,7 @@ S: Maintained T: git https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze.git F: arch/arm/mach-zynq/ F: doc/board/xilinx/ +F: doc/device-tree-bindings/video/syncoam,seps525.txt F: drivers/clk/clk_zynq.c F: drivers/fpga/zynqpl.c F: drivers/gpio/zynq_gpio.c
doc/device-tree-bindings/video/syncoam,seps525.txt new file +24 -0
@@ -0,0 +1,24 @@ +spi based seps525 framebuffer display driver + +Driver for seps525 display controller (in spi mode), This binding supports selection +of spi chipselect, spi max frequency, gpio to drive dc and reset pin of seps525 +controller and spi transaction bit length. + +Required properties: +- compatible: "syncoam,seps525" +- reg: Specifies the chip-select the seps525 is connected to on the spi bus +- reset-gpios: gpio connected to reset pin of seps525 controller. +- dc-gpios: gpio connected to dc pin of seps525 controller: +- buswidth: bitlength of each spi transaction + +Example: + displayspi at 0 { + compatible = "syncoam,seps525"; + reg = <0>; + spi-max-frequency = <10000000>; + spi-cpol; + spi-cpha; + buswidth = <8>; + reset-gpios = <&gpio 0x1c GPIO_ACTIVE_LOW>; + dc-gpios = <&gpio 0x1b GPIO_ACTIVE_HIGH>; + };
Signature · 1 line
2.29.2
PATCH 3/3 video: seps525: Add seps525 SPI driver
In reply to Michal SimekAdd support for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display using the SEPS525 (Syncoam) LCD Controller. Syncoam Seps525 PM-Oled is RGB 160x128 display. This driver has been tested through zynq-spi driver.
ZynqMP> load mmc 1 100000 rainbow.bmp
61562 bytes read in 20 ms (2.9 MiB/s)
ZynqMP> bmp info 100000
Image size : 160 x 128
Bits per pixel: 24
Compression : 0
ZynqMP> bmp display 100000
ZynqMP> setenv stdout vidconsole
---
MAINTAINERS | 1 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/seps525.c | 327 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+) create mode 100644 drivers/video/seps525.c
MAINTAINERS +1 -0
@@ -589,6 +589,7 @@ F: drivers/spi/zynq_qspi.c F: drivers/spi/zynq_spi.c F: drivers/timer/cadence-ttc.c F: drivers/usb/host/ehci-zynq.c +F: drivers/video/seps525.c F: drivers/watchdog/cdns_wdt.c F: include/zynqmppl.h F: include/zynqmp_firmware.h
drivers/video/Kconfig +6 -0
@@ -979,4 +979,10 @@ config VIDEO_VCXK This enables VCXK driver which can be used with VC2K, VC4K and VC8K devices on various boards from BuS Elektronik GmbH. +config SEPS525 + bool "SEPS525" + help + Enable support for the Syncoam PM-OLED display driver (RGB 160x128). + Currently driver is supporting only SPI interface. + endmenu
drivers/video/Makefile +1 -0
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa.o +obj-$(CONFIG_SEPS525) += seps525.o obj-y += bridge/ obj-y += sunxi/
drivers/video/seps525.c new file +327 -0
327 lines not on this page · raw message
Signature · 1 line
2.29.2
PATCH 1/3 video: Introduce video_sync call
In reply to Michal SimekHi Michal,
Quoted 21 lines · Michal Simek
Some drivers like LCD connected via SPI requires explicit sync function which copy framebuffer content over SPI to controller to display. This hook doesn't exist yet that's why introduce it via video operations.
Signed-off-by Michal Simek <[email protected]>---
Simon: Please review this. I didn't find existing way how this can be done that's why I am introducing this hook. Also maybe name can be named a little bit differently. That's why waiting for better suggestion.
--- drivers/video/video-uclass.c | 5 +++++ include/video.h | 13 +++++++++++++ 2 files changed, 18 insertions(+)drivers/video/video-uclass.c +0
-0
drivers/video/video-uclass.c void video_set_default_colors(struct udevice *dev, bool invert) · line 180
Quoted 7 lines
drivers/video/video-uclass.c +4
-0@@ -174,6 +174,11 @@ void video_set_default_colors(struct udevice *dev, bool invert)/* Flush video activity to the caches */ void video_sync (struct udevice *vid,bool force) { +struct video_ops *ops =video_get_ops (vid); + +if (ops && ops->video_sync) + (void )ops->video_sync (vid);
We should update video_sync() to return an error.
include/video.h struct video_priv { · line 117
Quoted 12 lines
drivers/video/video-uclass.c +1
-0+/* * flush_dcache_range() is declared in common.h but it seems that some * architectures do not actually implement it. Is there a way to find include/video.h +0
-0@@ -115,7 +115,20 @@ struct video_priv { };/* Placeholder - there are no video operations at present */
Need to update comment
include/video.h struct video_priv { · line 129
Quoted 12 lines
include/video.h +11
-0+/** +* struct video_ops - structure for keeping video operations +*/ struct video_ops { +/** +* video_sync - Synchronize FB with device +* +* Some device like SPI based LCD displays needs synchronization when +* data in an FB is available. For these devices implement video_sync +* hook to call a sync function +* +* @vid: Video device udevice structure
@return
Quoted 8 lines
include/video.h +2
-1+*/ +int (*video_sync)(struct udevice *vid); };#define video_get_ops (dev) ((struct video_ops *)(dev)->driver->ops) --2.29.2
Regards,
Simon
PATCH 2/3 video: seps525: Add dt binding description
In reply to Michal SimekQuoted 5 lines · Michal Simek
From: Vikhyat Goyal <[email protected]>
Added dt binding for seps525 display driver.
Quoted 9 lines
Signed-off-by Vikhyat Goyal <[email protected]>Signed-off-by Michal Simek <[email protected]>---
MAINTAINERS | 1 + .../video/syncoam,seps525.txt | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 doc/device-tree-bindings/video/syncoam,seps525.txt
PATCH 3/3 video: seps525: Add seps525 SPI driver
In reply to Michal SimekHi Michal,
Quoted 15 lines · Michal Simek
Add support for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display using the SEPS525 (Syncoam) LCD Controller. Syncoam Seps525 PM-Oled is RGB 160x128 display. This driver has been tested through zynq-spi driver.
ZynqMP> load mmc 1 100000 rainbow.bmp
61562 bytes read in 20 ms (2.9 MiB/s)
ZynqMP> bmp info 100000
Image size : 160 x 128
Bits per pixel: 24
Compression : 0
ZynqMP> bmp display 100000
ZynqMP> setenv stdout vidconsoleSigned-off-by Michal Simek <[email protected]>
Quoted 8 lines
---
MAINTAINERS | 1 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/seps525.c | 327 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+) create mode 100644 drivers/video/seps525.c
nits below
Quoted 122 lines
MAINTAINERS +1
-0@@ -589,6 +589,7 @@ F: drivers/spi/zynq_qspi.c F: drivers/spi/zynq_spi.c F: drivers/timer/cadence-ttc.c F: drivers/usb/host/ehci-zynq.c +F: drivers/video/seps525.c F: drivers/watchdog/cdns_wdt.c F: include/zynqmppl.h F: include/zynqmp_firmware.hdrivers/video/Kconfig +6
-0@@ -979,4 +979,10 @@ config VIDEO_VCXK This enables VCXK driver which can be used with VC2K, VC4K and VC8K devices on various boards from BuS Elektronik GmbH. +config SEPS525 + bool "SEPS525" + help + Enable support for the Syncoam PM-OLED display driver (RGB 160x128). + Currently driver is supporting only SPI interface. + endmenudrivers/video/Makefile +1
-0@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa.o +obj-$(CONFIG_SEPS525) += seps525.o obj-y += bridge/ obj-y += sunxi/drivers/video/seps525.c new file +76
-0@@ -0,0 +1,327 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* FB driver for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display +* using the SEPS525 (Syncoam) LCD Controller +* +* Copyright (C) 2020 Xilinx Inc. +*/ + +#include <common.h> +#include <command.h> +#include <cpu_func.h> +#include <dm.h> +#include <errno.h> +#include <spi.h> +#include <video.h> +#include <asm/gpio.h> +#include <dm/device_compat.h> +#include <linux/delay.h> + +#define WIDTH 160 +#define HEIGHT 128 + +#define SEPS525_INDEX 0x00 +#define SEPS525_STATUS_RD 0x01 +#define SEPS525_OSC_CTL 0x02 +#define SEPS525_IREF 0x80 +#define SEPS525_CLOCK_DIV 0x03 +#define SEPS525_REDUCE_CURRENT 0x04 +#define SEPS525_SOFT_RST 0x05 +#define SEPS525_DISP_ONOFF 0x06 +#define SEPS525_PRECHARGE_TIME_R 0x08 +#define SEPS525_PRECHARGE_TIME_G 0x09 +#define SEPS525_PRECHARGE_TIME_B 0x0A +#define SEPS525_PRECHARGE_CURRENT_R 0x0B +#define SEPS525_PRECHARGE_CURRENT_G 0x0C +#define SEPS525_PRECHARGE_CURRENT_B 0x0D +#define SEPS525_DRIVING_CURRENT_R 0x10 +#define SEPS525_DRIVING_CURRENT_G 0x11 +#define SEPS525_DRIVING_CURRENT_B 0x12 +#define SEPS525_DISPLAYMODE_SET 0x13 +#define SEPS525_RGBIF 0x14 +#define SEPS525_RGB_POL 0x15 +#define SEPS525_MEMORY_WRITEMODE 0x16 +#define SEPS525_MX1_ADDR 0x17 +#define SEPS525_MX2_ADDR 0x18 +#define SEPS525_MY1_ADDR 0x19 +#define SEPS525_MY2_ADDR 0x1A +#define SEPS525_MEMORY_ACCESS_POINTER_X 0x20 +#define SEPS525_MEMORY_ACCESS_POINTER_Y 0x21 +#define SEPS525_DDRAM_DATA_ACCESS_PORT 0x22 +#define SEPS525_GRAY_SCALE_TABLE_INDEX 0x50 +#define SEPS525_GRAY_SCALE_TABLE_DATA 0x51 +#define SEPS525_DUTY 0x28 +#define SEPS525_DSL 0x29 +#define SEPS525_D1_DDRAM_FAC 0x2E +#define SEPS525_D1_DDRAM_FAR 0x2F +#define SEPS525_D2_DDRAM_SAC 0x31 +#define SEPS525_D2_DDRAM_SAR 0x32 +#define SEPS525_SCR1_FX1 0x33 +#define SEPS525_SCR1_FX2 0x34 +#define SEPS525_SCR1_FY1 0x35 +#define SEPS525_SCR1_FY2 0x36 +#define SEPS525_SCR2_SX1 0x37 +#define SEPS525_SCR2_SX2 0x38 +#define SEPS525_SCR2_SY1 0x39 +#define SEPS525_SCR2_SY2 0x3A +#define SEPS525_SCREEN_SAVER_CONTEROL 0x3B +#define SEPS525_SS_SLEEP_TIMER 0x3C +#define SEPS525_SCREEN_SAVER_MODE 0x3D +#define SEPS525_SS_SCR1_FU 0x3E +#define SEPS525_SS_SCR1_MXY 0x3F +#define SEPS525_SS_SCR2_FU 0x40 +#define SEPS525_SS_SCR2_MXY 0x41 +#define SEPS525_MOVING_DIRECTION 0x42 +#define SEPS525_SS_SCR2_SX1 0x47 +#define SEPS525_SS_SCR2_SX2 0x48
drivers/video/seps525.c line 86
Quoted 10 lines
drivers/video/seps525.c new file +10
-0+#define SEPS525_SS_SCR2_SY1 0x49 +#define SEPS525_SS_SCR2_SY2 0x4A + +/* SEPS525_DISPLAYMODE_SET */ +#define MODE_SWAP_BGR BIT(7) +#define MODE_SM BIT(6) +#define MODE_RD BIT(5) +#define MODE_CD BIT(4) + +struct seps525_priv {
comments for this
drivers/video/seps525.c line 92
Quoted 6 lines
drivers/video/seps525.c new file +6
-0+struct gpio_desc reset_gpio; +struct gpio_desc dc_gpio; +struct udevice *dev; +}; + +static int seps525_spi_write_cmd (struct udevice *dev,u8 reg)
u8 reg seems silly as registers are 32/64 bit and this may require masking - just use uint?
drivers/video/seps525.c line 105
Quoted 13 lines
drivers/video/seps525.c new file +13
-0+{ +struct seps525_priv *priv =dev_get_priv (dev); +unsigned long flags =SPI_XFER_BEGIN ; +u8 buf8 = reg; +int ret; + + ret =dm_gpio_set_value (&priv->dc_gpio,0 ); +if (ret) { +dev_dbg (dev,"Failed to handle dc\n" ); +return ret; + } + + flags |=SPI_XFER_END ;
Up to you, but you don't really use this variable in these two functions.
Quoted 5 lines
drivers/video/seps525.c new file +5
-0+ + ret =dm_spi_xfer (dev,8 , &buf8,NULL , flags); +if (ret) +dev_dbg (dev,"Failed to write command\n" ); +
drivers/video/seps525.c line 120
Quoted 10 lines
drivers/video/seps525.c new file +10
-0+return ret; +} + +static int seps525_spi_write_data (struct udevice *dev,u8 val) +{ +struct seps525_priv *priv =dev_get_priv (dev); +unsigned long flags =SPI_XFER_BEGIN ; +u8 buf8 = val; +int ret; +
Regards,
Simon
PATCH 3/3 video: seps525: Add seps525 SPI driver
Quoted 157 lines · Simon Glass
Hi Michal,
Quoted 15 lines · Michal Simek
Add support for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display using the SEPS525 (Syncoam) LCD Controller. Syncoam Seps525 PM-Oled is RGB 160x128 display. This driver has been tested through zynq-spi driver.
ZynqMP> load mmc 1 100000 rainbow.bmp
61562 bytes read in 20 ms (2.9 MiB/s)
ZynqMP> bmp info 100000
Image size : 160 x 128
Bits per pixel: 24
Compression : 0
ZynqMP> bmp display 100000
ZynqMP> setenv stdout vidconsoleSigned-off-by Michal Simek <[email protected]>Quoted 8 lines
---
MAINTAINERS | 1 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/seps525.c | 327 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+) create mode 100644 drivers/video/seps525.cReviewed-by Simon Glass <[email protected]>nits below
Quoted 126 lines
MAINTAINERS +1
-0@@ -589,6 +589,7 @@ F: drivers/spi/zynq_qspi.c F: drivers/spi/zynq_spi.c F: drivers/timer/cadence-ttc.c F: drivers/usb/host/ehci-zynq.c +F: drivers/video/seps525.c F: drivers/watchdog/cdns_wdt.c F: include/zynqmppl.h F: include/zynqmp_firmware.hdrivers/video/Kconfig +6
-0@@ -979,4 +979,10 @@ config VIDEO_VCXK This enables VCXK driver which can be used with VC2K, VC4K and VC8K devices on various boards from BuS Elektronik GmbH. +config SEPS525 + bool "SEPS525" + help + Enable support for the Syncoam PM-OLED display driver (RGB 160x128). + Currently driver is supporting only SPI interface. + endmenudrivers/video/Makefile +1
-0@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa.o +obj-$(CONFIG_SEPS525) += seps525.o obj-y += bridge/ obj-y += sunxi/drivers/video/seps525.c new file +80
-0@@ -0,0 +1,327 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* FB driver for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display +* using the SEPS525 (Syncoam) LCD Controller +* +* Copyright (C) 2020 Xilinx Inc. +*/ + +#include <common.h> +#include <command.h> +#include <cpu_func.h> +#include <dm.h> +#include <errno.h> +#include <spi.h> +#include <video.h> +#include <asm/gpio.h> +#include <dm/device_compat.h> +#include <linux/delay.h> + +#define WIDTH 160 +#define HEIGHT 128 + +#define SEPS525_INDEX 0x00 +#define SEPS525_STATUS_RD 0x01 +#define SEPS525_OSC_CTL 0x02 +#define SEPS525_IREF 0x80 +#define SEPS525_CLOCK_DIV 0x03 +#define SEPS525_REDUCE_CURRENT 0x04 +#define SEPS525_SOFT_RST 0x05 +#define SEPS525_DISP_ONOFF 0x06 +#define SEPS525_PRECHARGE_TIME_R 0x08 +#define SEPS525_PRECHARGE_TIME_G 0x09 +#define SEPS525_PRECHARGE_TIME_B 0x0A +#define SEPS525_PRECHARGE_CURRENT_R 0x0B +#define SEPS525_PRECHARGE_CURRENT_G 0x0C +#define SEPS525_PRECHARGE_CURRENT_B 0x0D +#define SEPS525_DRIVING_CURRENT_R 0x10 +#define SEPS525_DRIVING_CURRENT_G 0x11 +#define SEPS525_DRIVING_CURRENT_B 0x12 +#define SEPS525_DISPLAYMODE_SET 0x13 +#define SEPS525_RGBIF 0x14 +#define SEPS525_RGB_POL 0x15 +#define SEPS525_MEMORY_WRITEMODE 0x16 +#define SEPS525_MX1_ADDR 0x17 +#define SEPS525_MX2_ADDR 0x18 +#define SEPS525_MY1_ADDR 0x19 +#define SEPS525_MY2_ADDR 0x1A +#define SEPS525_MEMORY_ACCESS_POINTER_X 0x20 +#define SEPS525_MEMORY_ACCESS_POINTER_Y 0x21 +#define SEPS525_DDRAM_DATA_ACCESS_PORT 0x22 +#define SEPS525_GRAY_SCALE_TABLE_INDEX 0x50 +#define SEPS525_GRAY_SCALE_TABLE_DATA 0x51 +#define SEPS525_DUTY 0x28 +#define SEPS525_DSL 0x29 +#define SEPS525_D1_DDRAM_FAC 0x2E +#define SEPS525_D1_DDRAM_FAR 0x2F +#define SEPS525_D2_DDRAM_SAC 0x31 +#define SEPS525_D2_DDRAM_SAR 0x32 +#define SEPS525_SCR1_FX1 0x33 +#define SEPS525_SCR1_FX2 0x34 +#define SEPS525_SCR1_FY1 0x35 +#define SEPS525_SCR1_FY2 0x36 +#define SEPS525_SCR2_SX1 0x37 +#define SEPS525_SCR2_SX2 0x38 +#define SEPS525_SCR2_SY1 0x39 +#define SEPS525_SCR2_SY2 0x3A +#define SEPS525_SCREEN_SAVER_CONTEROL 0x3B +#define SEPS525_SS_SLEEP_TIMER 0x3C +#define SEPS525_SCREEN_SAVER_MODE 0x3D +#define SEPS525_SS_SCR1_FU 0x3E +#define SEPS525_SS_SCR1_MXY 0x3F +#define SEPS525_SS_SCR2_FU 0x40 +#define SEPS525_SS_SCR2_MXY 0x41 +#define SEPS525_MOVING_DIRECTION 0x42 +#define SEPS525_SS_SCR2_SX1 0x47 +#define SEPS525_SS_SCR2_SX2 0x48 +#define SEPS525_SS_SCR2_SY1 0x49 +#define SEPS525_SS_SCR2_SY2 0x4A + +/* SEPS525_DISPLAYMODE_SET */
Quoted 8 lines
drivers/video/seps525.c line 86
Quoted 6 lines
drivers/video/seps525.c new file +6
-0+#define MODE_SWAP_BGR BIT(7) +#define MODE_SM BIT(6) +#define MODE_RD BIT(5) +#define MODE_CD BIT(4) + +struct seps525_priv {comments for this
done.
Quoted 10 lines
drivers/video/seps525.c line 92
Quoted 7 lines
drivers/video/seps525.c new file +6
-0+struct gpio_desc reset_gpio; +struct gpio_desc dc_gpio; +struct udevice *dev; +}; + +static int seps525_spi_write_cmd (struct udevice *dev,u8 reg)u8 reg seems silly as registers are 32/64 bit and this may require masking - just use uint?
This is SPI based controller and there are only 0x4a addresses. That's why u8 should be fine. And 8bit interface is also used.
Quoted 16 lines
Quoted 4 lines
drivers/video/seps525.c new file +3
-0+{ +struct seps525_priv *priv =dev_get_priv (dev); +unsigned long flags =SPI_XFER_BEGIN ;drivers/video/seps525.c line 105
Quoted 10 lines
drivers/video/seps525.c new file +10
-0+u8 buf8 = reg; +int ret; + + ret =dm_gpio_set_value (&priv->dc_gpio,0 ); +if (ret) { +dev_dbg (dev,"Failed to handle dc\n" ); +return ret; + } + + flags |=SPI_XFER_END ;Up to you, but you don't really use this variable in these two functions.
Fixed this and just get rid of this variable.
Thanks,
Michal
PATCH 1/3 video: Introduce video_sync call
In reply to Simon GlassHi Simon,
Quoted 19 lines · Simon Glass
Hi Michal,
Quoted 15 lines · Michal Simek
Some drivers like LCD connected via SPI requires explicit sync function which copy framebuffer content over SPI to controller to display. This hook doesn't exist yet that's why introduce it via video operations.
Signed-off-by Michal Simek <[email protected]>---
Simon: Please review this. I didn't find existing way how this can be done that's why I am introducing this hook. Also maybe name can be named a little bit differently. That's why waiting for better suggestion.
--- drivers/video/video-uclass.c | 5 +++++ include/video.h | 13 +++++++++++++ 2 files changed, 18 insertions(+)
Quoted 14 lines
drivers/video/video-uclass.c void video_set_default_colors(struct udevice *dev, bool invert) · line 180
Quoted 12 lines
drivers/video/video-uclass.c +4
-0@@ -174,6 +174,11 @@ void video_set_default_colors(struct udevice *dev, bool invert)/* Flush video activity to the caches */ void video_sync (struct udevice *vid,bool force) { +struct video_ops *ops =video_get_ops (vid); + +if (ops && ops->video_sync) + (void )ops->video_sync (vid);We should update
video_sync()to return an error.
I sent v2 with fixing this.
Quoted 12 lines
Quoted 12 lines
drivers/video/video-uclass.c +1
-0+/* * flush_dcache_range() is declared in common.h but it seems that some * architectures do not actually implement it. Is there a way to find include/video.h +0
-0@@ -115,7 +115,20 @@ struct video_priv { };
Quoted 3 lines
include/video.h struct video_priv { · line 117
Quoted 1 line
include/video.h +0
-0/* Placeholder - there are no video operations at present */ Need to update comment
Removed.
Quoted 14 lines
include/video.h struct video_priv { · line 129
Quoted 13 lines
include/video.h +11
-0+/** +* struct video_ops - structure for keeping video operations +*/ struct video_ops { +/** +* video_sync - Synchronize FB with device +* +* Some device like SPI based LCD displays needs synchronization when +* data in an FB is available. For these devices implement video_sync +* hook to call a sync function +* +* @vid: Video device udevice structure
Quoted 1 line
@return
I have looked at kernel-doc format and completely redo this to pass kernel-doc script.
There are a lot of issues reported by that script. Would be good to run it by patman automatically to be more visible for everybody.
Thanks,
Michal
PATCH 1/3 video: Introduce video_sync call
Hi Michal,
Quoted 72 lines · Michal Simek
Hi Simon,
Quoted 19 lines · Simon Glass
Hi Michal,
Quoted 15 lines · Michal Simek
Some drivers like LCD connected via SPI requires explicit sync function which copy framebuffer content over SPI to controller to display. This hook doesn't exist yet that's why introduce it via video operations.
Signed-off-by Michal Simek <[email protected]>---
Simon: Please review this. I didn't find existing way how this can be done that's why I am introducing this hook. Also maybe name can be named a little bit differently. That's why waiting for better suggestion.
--- drivers/video/video-uclass.c | 5 +++++ include/video.h | 13 +++++++++++++ 2 files changed, 18 insertions(+)Quoted 14 lines
drivers/video/video-uclass.c void video_set_default_colors(struct udevice *dev, bool invert) · line 180
Quoted 12 lines
drivers/video/video-uclass.c +4
-0@@ -174,6 +174,11 @@ void video_set_default_colors(struct udevice *dev, bool invert)/* Flush video activity to the caches */ void video_sync (struct udevice *vid,bool force) { +struct video_ops *ops =video_get_ops (vid); + +if (ops && ops->video_sync) + (void )ops->video_sync (vid);We should update
video_sync()to return an error.I sent v2 with fixing this.
Quoted 12 lines
Quoted 12 lines
drivers/video/video-uclass.c +1
-0+/* * flush_dcache_range() is declared in common.h but it seems that some * architectures do not actually implement it. Is there a way to find include/video.h +0
-0@@ -115,7 +115,20 @@ struct video_priv { };Quoted 3 lines
include/video.h struct video_priv { · line 117
Quoted 1 line
include/video.h +0
-0/* Placeholder - there are no video operations at present */ Need to update comment
Removed.
Quoted 14 lines
Quoted 13 lines
include/video.h +11
-0+/** +* struct video_ops - structure for keeping video operations +*/ struct video_ops { +/** +* video_sync - Synchronize FB with device +* +* Some device like SPI based LCD displays needs synchronization when +* data in an FB is available. For these devices implement video_sync +* hook to call a sync function +* +* @vid: Video device udevice structure
Quoted 6 lines
Quoted 1 line
@return
I have looked at kernel-doc format and completely redo this to pass kernel-doc script.
There are a lot of issues reported by that script. Would be good to run it by patman automatically to be more visible for everybody.
Yes that would be nice.
Regards,
Simon
PATCH 3/3 video: seps525: Add seps525 SPI driver
In reply to Michal SimekHi Michal,
Quoted 183 lines · Michal Simek
Quoted 157 lines · Simon Glass
Hi Michal,
Quoted 15 lines · Michal Simek
Add support for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display using the SEPS525 (Syncoam) LCD Controller. Syncoam Seps525 PM-Oled is RGB 160x128 display. This driver has been tested through zynq-spi driver.
ZynqMP> load mmc 1 100000 rainbow.bmp
61562 bytes read in 20 ms (2.9 MiB/s)
ZynqMP> bmp info 100000
Image size : 160 x 128
Bits per pixel: 24
Compression : 0
ZynqMP> bmp display 100000
ZynqMP> setenv stdout vidconsoleSigned-off-by Michal Simek <[email protected]>Quoted 8 lines
---
MAINTAINERS | 1 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/seps525.c | 327 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+) create mode 100644 drivers/video/seps525.cReviewed-by Simon Glass <[email protected]>nits below
Quoted 126 lines
MAINTAINERS +1
-0@@ -589,6 +589,7 @@ F: drivers/spi/zynq_qspi.c F: drivers/spi/zynq_spi.c F: drivers/timer/cadence-ttc.c F: drivers/usb/host/ehci-zynq.c +F: drivers/video/seps525.c F: drivers/watchdog/cdns_wdt.c F: include/zynqmppl.h F: include/zynqmp_firmware.hdrivers/video/Kconfig +6
-0@@ -979,4 +979,10 @@ config VIDEO_VCXK This enables VCXK driver which can be used with VC2K, VC4K and VC8K devices on various boards from BuS Elektronik GmbH. +config SEPS525 + bool "SEPS525" + help + Enable support for the Syncoam PM-OLED display driver (RGB 160x128). + Currently driver is supporting only SPI interface. + endmenudrivers/video/Makefile +1
-0@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa.o +obj-$(CONFIG_SEPS525) += seps525.o obj-y += bridge/ obj-y += sunxi/drivers/video/seps525.c new file +80
-0@@ -0,0 +1,327 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* FB driver for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display +* using the SEPS525 (Syncoam) LCD Controller +* +* Copyright (C) 2020 Xilinx Inc. +*/ + +#include <common.h> +#include <command.h> +#include <cpu_func.h> +#include <dm.h> +#include <errno.h> +#include <spi.h> +#include <video.h> +#include <asm/gpio.h> +#include <dm/device_compat.h> +#include <linux/delay.h> + +#define WIDTH 160 +#define HEIGHT 128 + +#define SEPS525_INDEX 0x00 +#define SEPS525_STATUS_RD 0x01 +#define SEPS525_OSC_CTL 0x02 +#define SEPS525_IREF 0x80 +#define SEPS525_CLOCK_DIV 0x03 +#define SEPS525_REDUCE_CURRENT 0x04 +#define SEPS525_SOFT_RST 0x05 +#define SEPS525_DISP_ONOFF 0x06 +#define SEPS525_PRECHARGE_TIME_R 0x08 +#define SEPS525_PRECHARGE_TIME_G 0x09 +#define SEPS525_PRECHARGE_TIME_B 0x0A +#define SEPS525_PRECHARGE_CURRENT_R 0x0B +#define SEPS525_PRECHARGE_CURRENT_G 0x0C +#define SEPS525_PRECHARGE_CURRENT_B 0x0D +#define SEPS525_DRIVING_CURRENT_R 0x10 +#define SEPS525_DRIVING_CURRENT_G 0x11 +#define SEPS525_DRIVING_CURRENT_B 0x12 +#define SEPS525_DISPLAYMODE_SET 0x13 +#define SEPS525_RGBIF 0x14 +#define SEPS525_RGB_POL 0x15 +#define SEPS525_MEMORY_WRITEMODE 0x16 +#define SEPS525_MX1_ADDR 0x17 +#define SEPS525_MX2_ADDR 0x18 +#define SEPS525_MY1_ADDR 0x19 +#define SEPS525_MY2_ADDR 0x1A +#define SEPS525_MEMORY_ACCESS_POINTER_X 0x20 +#define SEPS525_MEMORY_ACCESS_POINTER_Y 0x21 +#define SEPS525_DDRAM_DATA_ACCESS_PORT 0x22 +#define SEPS525_GRAY_SCALE_TABLE_INDEX 0x50 +#define SEPS525_GRAY_SCALE_TABLE_DATA 0x51 +#define SEPS525_DUTY 0x28 +#define SEPS525_DSL 0x29 +#define SEPS525_D1_DDRAM_FAC 0x2E +#define SEPS525_D1_DDRAM_FAR 0x2F +#define SEPS525_D2_DDRAM_SAC 0x31 +#define SEPS525_D2_DDRAM_SAR 0x32 +#define SEPS525_SCR1_FX1 0x33 +#define SEPS525_SCR1_FX2 0x34 +#define SEPS525_SCR1_FY1 0x35 +#define SEPS525_SCR1_FY2 0x36 +#define SEPS525_SCR2_SX1 0x37 +#define SEPS525_SCR2_SX2 0x38 +#define SEPS525_SCR2_SY1 0x39 +#define SEPS525_SCR2_SY2 0x3A +#define SEPS525_SCREEN_SAVER_CONTEROL 0x3B +#define SEPS525_SS_SLEEP_TIMER 0x3C +#define SEPS525_SCREEN_SAVER_MODE 0x3D +#define SEPS525_SS_SCR1_FU 0x3E +#define SEPS525_SS_SCR1_MXY 0x3F +#define SEPS525_SS_SCR2_FU 0x40 +#define SEPS525_SS_SCR2_MXY 0x41 +#define SEPS525_MOVING_DIRECTION 0x42 +#define SEPS525_SS_SCR2_SX1 0x47 +#define SEPS525_SS_SCR2_SX2 0x48 +#define SEPS525_SS_SCR2_SY1 0x49 +#define SEPS525_SS_SCR2_SY2 0x4A + +/* SEPS525_DISPLAYMODE_SET */ Quoted 8 lines
drivers/video/seps525.c line 86
Quoted 6 lines
drivers/video/seps525.c new file +6
-0+#define MODE_SWAP_BGR BIT(7) +#define MODE_SM BIT(6) +#define MODE_RD BIT(5) +#define MODE_CD BIT(4) + +struct seps525_priv {comments for this
done.
Quoted 10 lines
drivers/video/seps525.c line 92
Quoted 7 lines
drivers/video/seps525.c new file +6
-0+struct gpio_desc reset_gpio; +struct gpio_desc dc_gpio; +struct udevice *dev; +}; + +static int seps525_spi_write_cmd (struct udevice *dev,u8 reg)u8 reg seems silly as registers are 32/64 bit and this may require masking - just use uint?
Quoted 2 lines
This is SPI based controller and there are only
0x4aaddresses. That's why u8 should be fine. And 8bit interface is also used.
Just for the record, I'm making a different point. Functions should generally use natural sizes so the compiler doesn't have to mask registers. It depends on how you call the code, static/extern, etc. but it can add to code size. Given that args are passed in registers there is no space benefit, so I just don't understand the desire to use an u8 arg.
Quoted 18 lines
Quoted 17 lines
Quoted 5 lines
drivers/video/seps525.c new file +3
-0+{ +struct seps525_priv *priv =dev_get_priv (dev); +unsigned long flags =SPI_XFER_BEGIN ;drivers/video/seps525.c line 105
Quoted 10 lines
drivers/video/seps525.c new file +10
-0+u8 buf8 = reg; +int ret; + + ret =dm_gpio_set_value (&priv->dc_gpio,0 ); +if (ret) { +dev_dbg (dev,"Failed to handle dc\n" ); +return ret; + } + + flags |=SPI_XFER_END ;Up to you, but you don't really use this variable in these two functions.
Quoted 4 lines
Fixed this and just get rid of this variable.
Thanks,
Michal
Regards,
Simon
PATCH 3/3 video: seps525: Add seps525 SPI driver
Hi Simon,
Quoted 189 lines · Simon Glass
Hi Michal,
Quoted 183 lines · Michal Simek
Quoted 157 lines · Simon Glass
Hi Michal,
Quoted 15 lines · Michal Simek
Add support for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display using the SEPS525 (Syncoam) LCD Controller. Syncoam Seps525 PM-Oled is RGB 160x128 display. This driver has been tested through zynq-spi driver.
ZynqMP> load mmc 1 100000 rainbow.bmp
61562 bytes read in 20 ms (2.9 MiB/s)
ZynqMP> bmp info 100000
Image size : 160 x 128
Bits per pixel: 24
Compression : 0
ZynqMP> bmp display 100000
ZynqMP> setenv stdout vidconsoleSigned-off-by Michal Simek <[email protected]>Quoted 8 lines
---
MAINTAINERS | 1 + drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/seps525.c | 327 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+) create mode 100644 drivers/video/seps525.cReviewed-by Simon Glass <[email protected]>nits below
Quoted 126 lines
MAINTAINERS +1
-0@@ -589,6 +589,7 @@ F: drivers/spi/zynq_qspi.c F: drivers/spi/zynq_spi.c F: drivers/timer/cadence-ttc.c F: drivers/usb/host/ehci-zynq.c +F: drivers/video/seps525.c F: drivers/watchdog/cdns_wdt.c F: include/zynqmppl.h F: include/zynqmp_firmware.hdrivers/video/Kconfig +6
-0@@ -979,4 +979,10 @@ config VIDEO_VCXK This enables VCXK driver which can be used with VC2K, VC4K and VC8K devices on various boards from BuS Elektronik GmbH. +config SEPS525 + bool "SEPS525" + help + Enable support for the Syncoam PM-OLED display driver (RGB 160x128). + Currently driver is supporting only SPI interface. + endmenudrivers/video/Makefile +1
-0@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa.o +obj-$(CONFIG_SEPS525) += seps525.o obj-y += bridge/ obj-y += sunxi/drivers/video/seps525.c new file +80
-0@@ -0,0 +1,327 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* FB driver for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display +* using the SEPS525 (Syncoam) LCD Controller +* +* Copyright (C) 2020 Xilinx Inc. +*/ + +#include <common.h> +#include <command.h> +#include <cpu_func.h> +#include <dm.h> +#include <errno.h> +#include <spi.h> +#include <video.h> +#include <asm/gpio.h> +#include <dm/device_compat.h> +#include <linux/delay.h> + +#define WIDTH 160 +#define HEIGHT 128 + +#define SEPS525_INDEX 0x00 +#define SEPS525_STATUS_RD 0x01 +#define SEPS525_OSC_CTL 0x02 +#define SEPS525_IREF 0x80 +#define SEPS525_CLOCK_DIV 0x03 +#define SEPS525_REDUCE_CURRENT 0x04 +#define SEPS525_SOFT_RST 0x05 +#define SEPS525_DISP_ONOFF 0x06 +#define SEPS525_PRECHARGE_TIME_R 0x08 +#define SEPS525_PRECHARGE_TIME_G 0x09 +#define SEPS525_PRECHARGE_TIME_B 0x0A +#define SEPS525_PRECHARGE_CURRENT_R 0x0B +#define SEPS525_PRECHARGE_CURRENT_G 0x0C +#define SEPS525_PRECHARGE_CURRENT_B 0x0D +#define SEPS525_DRIVING_CURRENT_R 0x10 +#define SEPS525_DRIVING_CURRENT_G 0x11 +#define SEPS525_DRIVING_CURRENT_B 0x12 +#define SEPS525_DISPLAYMODE_SET 0x13 +#define SEPS525_RGBIF 0x14 +#define SEPS525_RGB_POL 0x15 +#define SEPS525_MEMORY_WRITEMODE 0x16 +#define SEPS525_MX1_ADDR 0x17 +#define SEPS525_MX2_ADDR 0x18 +#define SEPS525_MY1_ADDR 0x19 +#define SEPS525_MY2_ADDR 0x1A +#define SEPS525_MEMORY_ACCESS_POINTER_X 0x20 +#define SEPS525_MEMORY_ACCESS_POINTER_Y 0x21 +#define SEPS525_DDRAM_DATA_ACCESS_PORT 0x22 +#define SEPS525_GRAY_SCALE_TABLE_INDEX 0x50 +#define SEPS525_GRAY_SCALE_TABLE_DATA 0x51 +#define SEPS525_DUTY 0x28 +#define SEPS525_DSL 0x29 +#define SEPS525_D1_DDRAM_FAC 0x2E +#define SEPS525_D1_DDRAM_FAR 0x2F +#define SEPS525_D2_DDRAM_SAC 0x31 +#define SEPS525_D2_DDRAM_SAR 0x32 +#define SEPS525_SCR1_FX1 0x33 +#define SEPS525_SCR1_FX2 0x34 +#define SEPS525_SCR1_FY1 0x35 +#define SEPS525_SCR1_FY2 0x36 +#define SEPS525_SCR2_SX1 0x37 +#define SEPS525_SCR2_SX2 0x38 +#define SEPS525_SCR2_SY1 0x39 +#define SEPS525_SCR2_SY2 0x3A +#define SEPS525_SCREEN_SAVER_CONTEROL 0x3B +#define SEPS525_SS_SLEEP_TIMER 0x3C +#define SEPS525_SCREEN_SAVER_MODE 0x3D +#define SEPS525_SS_SCR1_FU 0x3E +#define SEPS525_SS_SCR1_MXY 0x3F +#define SEPS525_SS_SCR2_FU 0x40 +#define SEPS525_SS_SCR2_MXY 0x41 +#define SEPS525_MOVING_DIRECTION 0x42 +#define SEPS525_SS_SCR2_SX1 0x47 +#define SEPS525_SS_SCR2_SX2 0x48 +#define SEPS525_SS_SCR2_SY1 0x49 +#define SEPS525_SS_SCR2_SY2 0x4A + +/* SEPS525_DISPLAYMODE_SET */ Quoted 8 lines
drivers/video/seps525.c line 86
Quoted 6 lines
drivers/video/seps525.c new file +6
-0+#define MODE_SWAP_BGR BIT(7) +#define MODE_SM BIT(6) +#define MODE_RD BIT(5) +#define MODE_CD BIT(4) + +struct seps525_priv {comments for this
done.
Quoted 10 lines
drivers/video/seps525.c line 92
Quoted 7 lines
drivers/video/seps525.c new file +6
-0+struct gpio_desc reset_gpio; +struct gpio_desc dc_gpio; +struct udevice *dev; +}; + +static int seps525_spi_write_cmd (struct udevice *dev,u8 reg)u8 reg seems silly as registers are 32/64 bit and this may require masking - just use uint?
Quoted 2 lines
This is SPI based controller and there are only
0x4aaddresses. That's why u8 should be fine. And 8bit interface is also used.
Quoted 6 lines
Just for the record, I'm making a different point. Functions should generally use natural sizes so the compiler doesn't have to mask registers. It depends on how you call the code, static/extern, etc. but it can add to code size. Given that args are passed in registers there is no space benefit, so I just don't understand the desire to use an u8 arg.
I can't see any size difference for arm64 but not a problem to make it 32bit width. I found one more issue with cls that's why I have fixed this in v3 and add one more patch there too.
Thanks,
Michal