Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1705743 > unrolled thread
| Started by | David Lechner <david@lechnology.com> |
|---|---|
| First post | 2017-08-07 19:50 +0200 |
| Last post | 2017-08-09 18:00 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v4 0/5] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-08-07 19:50 +0200
[PATCH v4 4/5] ARM: dts: da850-lego-ev3: Add node for LCD display David Lechner <david@lechnology.com> - 2017-08-07 19:50 +0200
[PATCH v4 5/5] ARM: davinci_all_defconfig: enable tinydrm and ST7586 David Lechner <david@lechnology.com> - 2017-08-07 19:50 +0200
[PATCH v4 1/5] drm/tinydrm: Generalize tinydrm_xrgb8888_to_gray8() David Lechner <david@lechnology.com> - 2017-08-07 19:50 +0200
Re: [PATCH v4 1/5] drm/tinydrm: Generalize tinydrm_xrgb8888_to_gray8() Noralf Trønnes <noralf@tronnes.org> - 2017-08-09 18:00 +0200
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2017-08-07 19:50 +0200 |
| Subject | [PATCH v4 0/5] Support for LEGO MINDSTORMS EV3 LCD display |
| Message-ID | <ubUk9-3qL-11@gated-at.bofh.it> |
The goal of this series is to get the built-in LCD of the LEGO MINDSTORMS EV3 working. v2 changes: * Wrote a new driver for ST7586 instead of combining it with existing drivers * Don't touch MIPI DBI code (other than the patch suggested by Noralf) * New defconfig patch v3 changes: * New patch to generalize tinydrm_xrgb8888_to_gray8() so that it can be reused. * Device tree bindings in separate patch. * Fixed incorrect device tree binding pin descriptions. * Added MAINTAINERS entry for drivers/gpu/drm/tinydrm/st7586.c. * Removed "mipi_dbi_" from function names in st7586.c. * Moved init and fini to pipe_enable and pipe_disable ops. * Dropped RGB565 format. * Made adjustments for the fact the controller cannot be read via SPI. * Dropped st7586.h - values moved into st7586.c. v4 changes: * Dropped patch "drm/tinydrm: remove call to mipi_dbi_init() from mipi_dbi_spi_init()" since it has been applied. * correct order for MAINTAINERS entry * Drop code/dt bindings not used by LEGO EV3 (regulator, backlight, etc) * Make gpios required * Use lookup table for pixel packing algorithm * Don't modify clip when used as function parameter * Rename dc to a0 since that is what is on the datasheet/LEGO schematic. David Lechner (5): drm/tinydrm: Generalize tinydrm_xrgb8888_to_gray8() dt-bindings: add binding for Sitronix ST7586 display panels drm/tinydrm: add support for LEGO MINDSTORMS EV3 LCD ARM: dts: da850-lego-ev3: Add node for LCD display ARM: davinci_all_defconfig: enable tinydrm and ST7586 .../bindings/display/sitronix,st7586.txt | 22 ++ MAINTAINERS | 6 + arch/arm/boot/dts/da850-lego-ev3.dts | 24 ++ arch/arm/configs/davinci_all_defconfig | 2 + drivers/gpu/drm/tinydrm/Kconfig | 10 + drivers/gpu/drm/tinydrm/Makefile | 1 + drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 42 +- drivers/gpu/drm/tinydrm/repaper.c | 28 +- drivers/gpu/drm/tinydrm/st7586.c | 428 +++++++++++++++++++++ include/drm/tinydrm/tinydrm-helpers.h | 3 +- 10 files changed, 534 insertions(+), 32 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7586.txt create mode 100644 drivers/gpu/drm/tinydrm/st7586.c -- 2.7.4
[toc] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2017-08-07 19:50 +0200 |
| Subject | [PATCH v4 4/5] ARM: dts: da850-lego-ev3: Add node for LCD display |
| Message-ID | <ubUka-3qL-19@gated-at.bofh.it> |
| In reply to | #1705743 |
This adds a new node for the LEGO MINDSTORMS EV3 LCD display.
Signed-off-by: David Lechner <david@lechnology.com>
---
v4 changes:
* changed dc to a0
arch/arm/boot/dts/da850-lego-ev3.dts | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/arm/boot/dts/da850-lego-ev3.dts b/arch/arm/boot/dts/da850-lego-ev3.dts
index 45983c0..413dbd5 100644
--- a/arch/arm/boot/dts/da850-lego-ev3.dts
+++ b/arch/arm/boot/dts/da850-lego-ev3.dts
@@ -249,6 +249,15 @@
0x4c 0x00000080 0x000000f0
>;
};
+
+ ev3_lcd_pins: pinmux_lcd {
+ pinctrl-single,bits = <
+ /* SIMO, GP2[11], GP2[12], CLK */
+ 0x14 0x00188100 0x00ffff00
+ /* GP5[0] */
+ 0x30 0x80000000 0xf0000000
+ >;
+ };
};
&pinconf {
@@ -357,6 +366,21 @@
};
};
+&spi1 {
+ status = "okay";
+ pinctrl-0 = <&ev3_lcd_pins>;
+ pinctrl-names = "default";
+ cs-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
+
+ display@0{
+ compatible = "lego,ev3-lcd";
+ reg = <0>;
+ spi-max-frequency = <10000000>;
+ a0-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
+ reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
+ };
+};
+
&ehrpwm0 {
status = "okay";
};
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2017-08-07 19:50 +0200 |
| Subject | [PATCH v4 5/5] ARM: davinci_all_defconfig: enable tinydrm and ST7586 |
| Message-ID | <ubUkb-3qL-49@gated-at.bofh.it> |
| In reply to | #1705743 |
This enables the tinydrm and ST7586 panel modules used by the display on LEGO MINDSTORMS EV3. Signed-off-by: David Lechner <david@lechnology.com> --- arch/arm/configs/davinci_all_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig index 06e2e2a..27d9720 100644 --- a/arch/arm/configs/davinci_all_defconfig +++ b/arch/arm/configs/davinci_all_defconfig @@ -143,6 +143,8 @@ CONFIG_VIDEO_ADV7343=m CONFIG_DRM=m CONFIG_DRM_TILCDC=m CONFIG_DRM_DUMB_VGA_DAC=m +CONFIG_DRM_TINYDRM=m +CONFIG_TINYDRM_ST7586=m CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_DA8XX=y -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2017-08-07 19:50 +0200 |
| Subject | [PATCH v4 1/5] drm/tinydrm: Generalize tinydrm_xrgb8888_to_gray8() |
| Message-ID | <ubUkb-3qL-55@gated-at.bofh.it> |
| In reply to | #1705743 |
This adds parameters for vaddr and clip to tinydrm_xrgb8888_to_gray8() to
make it more generic.
dma_buf_{begin,end}_cpu_access() are moved out to the repaper driver.
Return type is change to void to simplify error handling by callers.
Signed-off-by: David Lechner <david@lechnology.com>
---
v4 changes:
* Change return type to void.
drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 42 +++++++++-----------------
drivers/gpu/drm/tinydrm/repaper.c | 28 +++++++++++++++--
include/drm/tinydrm/tinydrm-helpers.h | 3 +-
3 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index 75808bb..bd6cce0 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -185,7 +185,9 @@ EXPORT_SYMBOL(tinydrm_xrgb8888_to_rgb565);
/**
* tinydrm_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale
* @dst: 8-bit grayscale destination buffer
+ * @vaddr: XRGB8888 source buffer
* @fb: DRM framebuffer
+ * @clip: Clip rectangle area to copy
*
* Drm doesn't have native monochrome or grayscale support.
* Such drivers can announce the commonly supported XR24 format to userspace
@@ -195,41 +197,31 @@ EXPORT_SYMBOL(tinydrm_xrgb8888_to_rgb565);
* where 1 means foreground color and 0 background color.
*
* ITU BT.601 is used for the RGB -> luma (brightness) conversion.
- *
- * Returns:
- * Zero on success, negative error code on failure.
*/
-int tinydrm_xrgb8888_to_gray8(u8 *dst, struct drm_framebuffer *fb)
+void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
+ struct drm_clip_rect *clip)
{
- struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
- struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
- unsigned int x, y, pitch = fb->pitches[0];
- int ret = 0;
+ unsigned int len = (clip->x2 - clip->x1) * sizeof(u32);
+ unsigned int x, y;
void *buf;
u32 *src;
if (WARN_ON(fb->format->format != DRM_FORMAT_XRGB8888))
- return -EINVAL;
+ return;
/*
* The cma memory is write-combined so reads are uncached.
* Speed up by fetching one line at a time.
*/
- buf = kmalloc(pitch, GFP_KERNEL);
+ buf = kmalloc(len, GFP_KERNEL);
if (!buf)
- return -ENOMEM;
-
- if (import_attach) {
- ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
- DMA_FROM_DEVICE);
- if (ret)
- goto err_free;
- }
+ return;
- for (y = 0; y < fb->height; y++) {
- src = cma_obj->vaddr + (y * pitch);
- memcpy(buf, src, pitch);
+ for (y = clip->y1; y < clip->y2; y++) {
+ src = vaddr + (y * fb->pitches[0]);
+ src += clip->x1;
+ memcpy(buf, src, len);
src = buf;
- for (x = 0; x < fb->width; x++) {
+ for (x = clip->x1; x < clip->x2; x++) {
u8 r = (*src & 0x00ff0000) >> 16;
u8 g = (*src & 0x0000ff00) >> 8;
u8 b = *src & 0x000000ff;
@@ -240,13 +232,7 @@ int tinydrm_xrgb8888_to_gray8(u8 *dst, struct drm_framebuffer *fb)
}
}
- if (import_attach)
- ret = dma_buf_end_cpu_access(import_attach->dmabuf,
- DMA_FROM_DEVICE);
-err_free:
kfree(buf);
-
- return ret;
}
EXPORT_SYMBOL(tinydrm_xrgb8888_to_gray8);
diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c
index 3343d3f..30dc97b 100644
--- a/drivers/gpu/drm/tinydrm/repaper.c
+++ b/drivers/gpu/drm/tinydrm/repaper.c
@@ -18,6 +18,7 @@
*/
#include <linux/delay.h>
+#include <linux/dma-buf.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of_device.h>
@@ -525,11 +526,20 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,
struct drm_clip_rect *clips,
unsigned int num_clips)
{
+ struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
+ struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
struct tinydrm_device *tdev = fb->dev->dev_private;
struct repaper_epd *epd = epd_from_tinydrm(tdev);
+ struct drm_clip_rect clip;
u8 *buf = NULL;
int ret = 0;
+ /* repaper can't do partial updates */
+ clip.x1 = 0;
+ clip.x2 = fb->width;
+ clip.y1 = 0;
+ clip.y2 = fb->height;
+
mutex_lock(&tdev->dirty_lock);
if (!epd->enabled)
@@ -550,9 +560,21 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,
goto out_unlock;
}
- ret = tinydrm_xrgb8888_to_gray8(buf, fb);
- if (ret)
- goto out_unlock;
+ if (import_attach) {
+ ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
+ DMA_FROM_DEVICE);
+ if (ret)
+ goto out_unlock;
+ }
+
+ tinydrm_xrgb8888_to_gray8(buf, cma_obj->vaddr, fb, &clip);
+
+ if (import_attach) {
+ ret = dma_buf_end_cpu_access(import_attach->dmabuf,
+ DMA_FROM_DEVICE);
+ if (ret)
+ goto out_unlock;
+ }
repaper_gray8_to_mono_reversed(buf, fb->width, fb->height);
diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h
index a6c387f..d554ded 100644
--- a/include/drm/tinydrm/tinydrm-helpers.h
+++ b/include/drm/tinydrm/tinydrm-helpers.h
@@ -43,7 +43,8 @@ void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
struct drm_framebuffer *fb,
struct drm_clip_rect *clip, bool swap);
-int tinydrm_xrgb8888_to_gray8(u8 *dst, struct drm_framebuffer *fb);
+void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
+ struct drm_clip_rect *clip);
struct backlight_device *tinydrm_of_find_backlight(struct device *dev);
int tinydrm_enable_backlight(struct backlight_device *backlight);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Noralf Trønnes <noralf@tronnes.org> |
|---|---|
| Date | 2017-08-09 18:00 +0200 |
| Subject | Re: [PATCH v4 1/5] drm/tinydrm: Generalize tinydrm_xrgb8888_to_gray8() |
| Message-ID | <ucByO-T5-7@gated-at.bofh.it> |
| In reply to | #1705760 |
Den 07.08.2017 19.39, skrev David Lechner:
> This adds parameters for vaddr and clip to tinydrm_xrgb8888_to_gray8() to
> make it more generic.
>
> dma_buf_{begin,end}_cpu_access() are moved out to the repaper driver.
>
> Return type is change to void to simplify error handling by callers.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
Thanks for doing this, applied to drm-misc.
Noralf.
> v4 changes:
> * Change return type to void.
>
>
> drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 42 +++++++++-----------------
> drivers/gpu/drm/tinydrm/repaper.c | 28 +++++++++++++++--
> include/drm/tinydrm/tinydrm-helpers.h | 3 +-
> 3 files changed, 41 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
> index 75808bb..bd6cce0 100644
> --- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
> +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
> @@ -185,7 +185,9 @@ EXPORT_SYMBOL(tinydrm_xrgb8888_to_rgb565);
> /**
> * tinydrm_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale
> * @dst: 8-bit grayscale destination buffer
> + * @vaddr: XRGB8888 source buffer
> * @fb: DRM framebuffer
> + * @clip: Clip rectangle area to copy
> *
> * Drm doesn't have native monochrome or grayscale support.
> * Such drivers can announce the commonly supported XR24 format to userspace
> @@ -195,41 +197,31 @@ EXPORT_SYMBOL(tinydrm_xrgb8888_to_rgb565);
> * where 1 means foreground color and 0 background color.
> *
> * ITU BT.601 is used for the RGB -> luma (brightness) conversion.
> - *
> - * Returns:
> - * Zero on success, negative error code on failure.
> */
> -int tinydrm_xrgb8888_to_gray8(u8 *dst, struct drm_framebuffer *fb)
> +void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
> + struct drm_clip_rect *clip)
> {
> - struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
> - struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
> - unsigned int x, y, pitch = fb->pitches[0];
> - int ret = 0;
> + unsigned int len = (clip->x2 - clip->x1) * sizeof(u32);
> + unsigned int x, y;
> void *buf;
> u32 *src;
>
> if (WARN_ON(fb->format->format != DRM_FORMAT_XRGB8888))
> - return -EINVAL;
> + return;
> /*
> * The cma memory is write-combined so reads are uncached.
> * Speed up by fetching one line at a time.
> */
> - buf = kmalloc(pitch, GFP_KERNEL);
> + buf = kmalloc(len, GFP_KERNEL);
> if (!buf)
> - return -ENOMEM;
> -
> - if (import_attach) {
> - ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
> - DMA_FROM_DEVICE);
> - if (ret)
> - goto err_free;
> - }
> + return;
>
> - for (y = 0; y < fb->height; y++) {
> - src = cma_obj->vaddr + (y * pitch);
> - memcpy(buf, src, pitch);
> + for (y = clip->y1; y < clip->y2; y++) {
> + src = vaddr + (y * fb->pitches[0]);
> + src += clip->x1;
> + memcpy(buf, src, len);
> src = buf;
> - for (x = 0; x < fb->width; x++) {
> + for (x = clip->x1; x < clip->x2; x++) {
> u8 r = (*src & 0x00ff0000) >> 16;
> u8 g = (*src & 0x0000ff00) >> 8;
> u8 b = *src & 0x000000ff;
> @@ -240,13 +232,7 @@ int tinydrm_xrgb8888_to_gray8(u8 *dst, struct drm_framebuffer *fb)
> }
> }
>
> - if (import_attach)
> - ret = dma_buf_end_cpu_access(import_attach->dmabuf,
> - DMA_FROM_DEVICE);
> -err_free:
> kfree(buf);
> -
> - return ret;
> }
> EXPORT_SYMBOL(tinydrm_xrgb8888_to_gray8);
>
> diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c
> index 3343d3f..30dc97b 100644
> --- a/drivers/gpu/drm/tinydrm/repaper.c
> +++ b/drivers/gpu/drm/tinydrm/repaper.c
> @@ -18,6 +18,7 @@
> */
>
> #include <linux/delay.h>
> +#include <linux/dma-buf.h>
> #include <linux/gpio/consumer.h>
> #include <linux/module.h>
> #include <linux/of_device.h>
> @@ -525,11 +526,20 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,
> struct drm_clip_rect *clips,
> unsigned int num_clips)
> {
> + struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
> + struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
> struct tinydrm_device *tdev = fb->dev->dev_private;
> struct repaper_epd *epd = epd_from_tinydrm(tdev);
> + struct drm_clip_rect clip;
> u8 *buf = NULL;
> int ret = 0;
>
> + /* repaper can't do partial updates */
> + clip.x1 = 0;
> + clip.x2 = fb->width;
> + clip.y1 = 0;
> + clip.y2 = fb->height;
> +
> mutex_lock(&tdev->dirty_lock);
>
> if (!epd->enabled)
> @@ -550,9 +560,21 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,
> goto out_unlock;
> }
>
> - ret = tinydrm_xrgb8888_to_gray8(buf, fb);
> - if (ret)
> - goto out_unlock;
> + if (import_attach) {
> + ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
> + DMA_FROM_DEVICE);
> + if (ret)
> + goto out_unlock;
> + }
> +
> + tinydrm_xrgb8888_to_gray8(buf, cma_obj->vaddr, fb, &clip);
> +
> + if (import_attach) {
> + ret = dma_buf_end_cpu_access(import_attach->dmabuf,
> + DMA_FROM_DEVICE);
> + if (ret)
> + goto out_unlock;
> + }
>
> repaper_gray8_to_mono_reversed(buf, fb->width, fb->height);
>
> diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h
> index a6c387f..d554ded 100644
> --- a/include/drm/tinydrm/tinydrm-helpers.h
> +++ b/include/drm/tinydrm/tinydrm-helpers.h
> @@ -43,7 +43,8 @@ void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
> void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
> struct drm_framebuffer *fb,
> struct drm_clip_rect *clip, bool swap);
> -int tinydrm_xrgb8888_to_gray8(u8 *dst, struct drm_framebuffer *fb);
> +void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
> + struct drm_clip_rect *clip);
>
> struct backlight_device *tinydrm_of_find_backlight(struct device *dev);
> int tinydrm_enable_backlight(struct backlight_device *backlight);
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web