Hi all,
This patch series adds support for the Okaya RH128128T LCD to the
existing ST7735R driver. This is a 128x128 1.4" TFT display driven by a
Sitronix ST7715R TFT Controller/Driver. It is used on e.g. the Renesas
YRSK-LCD-PMOD extension board, which is shipped with Renesas RSK+RZA1
development boards[1], and with several other Renesas starter kits, for
RX, Synergy, and RZ/T1 MCUs and SoCs.
Changes compared to v1[2]:
- Convert DT bindings to DT schema,
- Add YRSK-LCD-PMOD reference and links,
- Add Reviewed-by,
- Split driver preparation and adding actual support in two separate
patches,
- Replace st7735r_priv.rgb by a pointer to struct st7735r_cfg,
- Change prefix of jd_t18003_t01_pipe_enable() and
jd_t18003_t01_pipe_funcs(),
- Update Kconfig help text,
- Improve file comment header.
This has been tested using the r7s72100-rskrza1-pmod-spi.dtso and
r7s72100-rskrza1-pmod2-lcd.dtso DT overlays[3].
Note that for using this on RSK+RZA1, there is a dependency on RSPI
cs-gpios support (now in linux-next).
With DT overlays, this also depends on DT overlays[4] and gpio-hog
overlay support[5].
Thanks!
[1] https://renesasrulz.com/the_vault/f/archive-forum/4981/upgrading-to-the-renesas-rz-a1h
[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/renesas-overlays
[4] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/overlays
[5] "[PATCH/RFC 0/2] gpio: of: Add DT overlay support for GPIO hogs"
https://lore.kernel.org/lkml/[email protected]/
Geert Uytterhoeven (5):
dt-bindings: display: sitronix,st7735r: Convert to DT schema
dt-bindings: display: sitronix,st7735r: Add Okaya RH128128T
drm/mipi_dbi: Add support for display offsets
drm: tiny: st7735r: Prepare for adding support for more displays
drm: tiny: st7735r: Add support for Okaya RH128128T
.../bindings/display/sitronix,st7735r.txt | 35 ---------
.../bindings/display/sitronix,st7735r.yaml | 71 +++++++++++++++++
MAINTAINERS | 2 +-
drivers/gpu/drm/drm_mipi_dbi.c | 30 +++++---
drivers/gpu/drm/tiny/Kconfig | 8 +-
drivers/gpu/drm/tiny/st7735r.c | 76 +++++++++++++++----
include/drm/drm_mipi_dbi.h | 12 +++
7 files changed, 170 insertions(+), 64 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.txt
create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml
--
2.17.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
If the resolution of the TFT display is smaller than the maximum
resolution supported by the display controller, the display may be
connected to the driver output arrays with a horizontal and/or vertical
offset, leading to a shifted image.
Add support for specifying these offsets.
Signed-off-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Sam Ravnborg <[email protected]>
---
v2:
- Add Reviewed-by.
---
drivers/gpu/drm/drm_mipi_dbi.c | 30 ++++++++++++++++++++----------
include/drm/drm_mipi_dbi.h | 12 ++++++++++++
2 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 16bff1be4b8ac622..27fe81a53c88e338 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -238,6 +238,23 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
}
EXPORT_SYMBOL(mipi_dbi_buf_copy);
+static void mipi_dbi_set_window_address(struct mipi_dbi_dev *dbidev,
+ unsigned int xs, unsigned int xe,
+ unsigned int ys, unsigned int ye)
+{
+ struct mipi_dbi *dbi = &dbidev->dbi;
+
+ xs += dbidev->left_offset;
+ xe += dbidev->left_offset;
+ ys += dbidev->top_offset;
+ ye += dbidev->top_offset;
+
+ mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, (xs >> 8) & 0xff,
+ xs & 0xff, (xe >> 8) & 0xff, xe & 0xff);
+ mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, (ys >> 8) & 0xff,
+ ys & 0xff, (ye >> 8) & 0xff, ye & 0xff);
+}
+
static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
{
struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
@@ -271,12 +288,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
tr = cma_obj->vaddr;
}
- mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS,
- (rect->x1 >> 8) & 0xff, rect->x1 & 0xff,
- ((rect->x2 - 1) >> 8) & 0xff, (rect->x2 - 1) & 0xff);
- mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS,
- (rect->y1 >> 8) & 0xff, rect->y1 & 0xff,
- ((rect->y2 - 1) >> 8) & 0xff, (rect->y2 - 1) & 0xff);
+ mipi_dbi_set_window_address(dbidev, rect->x1, rect->x2 - 1, rect->y1,
+ rect->y2 - 1);
ret = mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, tr,
width * height * 2);
@@ -366,10 +379,7 @@ static void mipi_dbi_blank(struct mipi_dbi_dev *dbidev)
memset(dbidev->tx_buf, 0, len);
- mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, 0, 0,
- ((width - 1) >> 8) & 0xFF, (width - 1) & 0xFF);
- mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, 0, 0,
- ((height - 1) >> 8) & 0xFF, (height - 1) & 0xFF);
+ mipi_dbi_set_window_address(dbidev, 0, width - 1, 0, height - 1);
mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START,
(u8 *)dbidev->tx_buf, len);
diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h
index 67c66f5ee591e80f..33f325f5af2b921f 100644
--- a/include/drm/drm_mipi_dbi.h
+++ b/include/drm/drm_mipi_dbi.h
@@ -109,6 +109,18 @@ struct mipi_dbi_dev {
*/
unsigned int rotation;
+ /**
+ * @left_offset: Horizontal offset of the display relative to the
+ * controller's driver array
+ */
+ unsigned int left_offset;
+
+ /**
+ * @top_offset: Vertical offset of the display relative to the
+ * controller's driver array
+ */
+ unsigned int top_offset;
+
/**
* @backlight: backlight device (optional)
*/
--
2.17.1
Hi Noralf.
If you could find time to review this patch it would be great.
I am reluctant to apply it until you have acked/reviewed it.
Thanks in advance,
Sam
On Wed, Jan 15, 2020 at 01:45:46PM +0100, Geert Uytterhoeven wrote:
> If the resolution of the TFT display is smaller than the maximum
> resolution supported by the display controller, the display may be
> connected to the driver output arrays with a horizontal and/or vertical
> offset, leading to a shifted image.
>
> Add support for specifying these offsets.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> Reviewed-by: Sam Ravnborg <[email protected]>
> ---
> v2:
> - Add Reviewed-by.
> ---
> drivers/gpu/drm/drm_mipi_dbi.c | 30 ++++++++++++++++++++----------
> include/drm/drm_mipi_dbi.h | 12 ++++++++++++
> 2 files changed, 32 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> index 16bff1be4b8ac622..27fe81a53c88e338 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -238,6 +238,23 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
> }
> EXPORT_SYMBOL(mipi_dbi_buf_copy);
>
> +static void mipi_dbi_set_window_address(struct mipi_dbi_dev *dbidev,
> + unsigned int xs, unsigned int xe,
> + unsigned int ys, unsigned int ye)
> +{
> + struct mipi_dbi *dbi = &dbidev->dbi;
> +
> + xs += dbidev->left_offset;
> + xe += dbidev->left_offset;
> + ys += dbidev->top_offset;
> + ye += dbidev->top_offset;
> +
> + mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, (xs >> 8) & 0xff,
> + xs & 0xff, (xe >> 8) & 0xff, xe & 0xff);
> + mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, (ys >> 8) & 0xff,
> + ys & 0xff, (ye >> 8) & 0xff, ye & 0xff);
> +}
> +
> static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
> {
> struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
> @@ -271,12 +288,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
> tr = cma_obj->vaddr;
> }
>
> - mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS,
> - (rect->x1 >> 8) & 0xff, rect->x1 & 0xff,
> - ((rect->x2 - 1) >> 8) & 0xff, (rect->x2 - 1) & 0xff);
> - mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS,
> - (rect->y1 >> 8) & 0xff, rect->y1 & 0xff,
> - ((rect->y2 - 1) >> 8) & 0xff, (rect->y2 - 1) & 0xff);
> + mipi_dbi_set_window_address(dbidev, rect->x1, rect->x2 - 1, rect->y1,
> + rect->y2 - 1);
>
> ret = mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, tr,
> width * height * 2);
> @@ -366,10 +379,7 @@ static void mipi_dbi_blank(struct mipi_dbi_dev *dbidev)
>
> memset(dbidev->tx_buf, 0, len);
>
> - mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, 0, 0,
> - ((width - 1) >> 8) & 0xFF, (width - 1) & 0xFF);
> - mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, 0, 0,
> - ((height - 1) >> 8) & 0xFF, (height - 1) & 0xFF);
> + mipi_dbi_set_window_address(dbidev, 0, width - 1, 0, height - 1);
> mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START,
> (u8 *)dbidev->tx_buf, len);
>
> diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h
> index 67c66f5ee591e80f..33f325f5af2b921f 100644
> --- a/include/drm/drm_mipi_dbi.h
> +++ b/include/drm/drm_mipi_dbi.h
> @@ -109,6 +109,18 @@ struct mipi_dbi_dev {
> */
> unsigned int rotation;
>
> + /**
> + * @left_offset: Horizontal offset of the display relative to the
> + * controller's driver array
> + */
> + unsigned int left_offset;
> +
> + /**
> + * @top_offset: Vertical offset of the display relative to the
> + * controller's driver array
> + */
> + unsigned int top_offset;
> +
> /**
> * @backlight: backlight device (optional)
> */
> --
> 2.17.1
Den 15.01.2020 13.45, skrev Geert Uytterhoeven:
> If the resolution of the TFT display is smaller than the maximum
> resolution supported by the display controller, the display may be
> connected to the driver output arrays with a horizontal and/or vertical
> offset, leading to a shifted image.
>
> Add support for specifying these offsets.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> Reviewed-by: Sam Ravnborg <[email protected]>
> ---
Acked-by: Noralf Trønnes <[email protected]>
Hi Geert.
On Wed, Jan 15, 2020 at 01:45:43PM +0100, Geert Uytterhoeven wrote:
> Hi all,
>
> This patch series adds support for the Okaya RH128128T LCD to the
> existing ST7735R driver. This is a 128x128 1.4" TFT display driven by a
> Sitronix ST7715R TFT Controller/Driver. It is used on e.g. the Renesas
> YRSK-LCD-PMOD extension board, which is shipped with Renesas RSK+RZA1
> development boards[1], and with several other Renesas starter kits, for
> RX, Synergy, and RZ/T1 MCUs and SoCs.
>
> Changes compared to v1[2]:
> - Convert DT bindings to DT schema,
> - Add YRSK-LCD-PMOD reference and links,
> - Add Reviewed-by,
> - Split driver preparation and adding actual support in two separate
> patches,
> - Replace st7735r_priv.rgb by a pointer to struct st7735r_cfg,
> - Change prefix of jd_t18003_t01_pipe_enable() and
> jd_t18003_t01_pipe_funcs(),
> - Update Kconfig help text,
> - Improve file comment header.
>
> This has been tested using the r7s72100-rskrza1-pmod-spi.dtso and
> r7s72100-rskrza1-pmod2-lcd.dtso DT overlays[3].
> Note that for using this on RSK+RZA1, there is a dependency on RSPI
> cs-gpios support (now in linux-next).
> With DT overlays, this also depends on DT overlays[4] and gpio-hog
> overlay support[5].
>
> Thanks!
>
> [1] https://renesasrulz.com/the_vault/f/archive-forum/4981/upgrading-to-the-renesas-rz-a1h
> [1] https://lore.kernel.org/dri-devel/[email protected]/
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/renesas-overlays
> [4] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/overlays
> [5] "[PATCH/RFC 0/2] gpio: of: Add DT overlay support for GPIO hogs"
> https://lore.kernel.org/lkml/[email protected]/
>
> Geert Uytterhoeven (5):
> dt-bindings: display: sitronix,st7735r: Convert to DT schema
> dt-bindings: display: sitronix,st7735r: Add Okaya RH128128T
> drm/mipi_dbi: Add support for display offsets
> drm: tiny: st7735r: Prepare for adding support for more displays
> drm: tiny: st7735r: Add support for Okaya RH128128T
Thanks, it ended up with a nice small patch adding support for
another controller/panel combo to this driver.
All 5 patches applied to drm-misc-next.
Sam