Skip to contentSkip to conversation

Add driver for Sharp Memory LCD

PATCH Superseded Alex Lanzano 3 participants 7 messages Jul 29, 2024

Subsystems (4)

v3 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

Alex Lanzano

author maintainer
#0 lore raw

v3 cover Add driver for Sharp Memory LCD

This patch series add support for the monochrome Sharp Memory LCD panels. This series is based off of the work done by Mehdi Djait.

References:
https://lore.kernel.org/dri-devel/71a9dbf4609dbba46026a31f60261830163a0b99.1701267411.git.mehdi.djait@bootlin.com/
https://www.sharpsde.com/fileadmin/products/Displays/2016_SDE_App_Note_for_Memory_LCD_programming_V1.3.pdf

---
Changes in v3:
- Fix file path in MAINTAINERS file
- Address review comments
- Simplify mode selection based on match data instead of model

Changes in v2:
- Credited Mehdi Djait in commit messages
- Renamed sharp,sharp-memory.yaml to sharp,ls010b7dh04.yaml
- Using strings instead of int for vcom-mode in dt-binding
- Fixed indentation of binding example
- Removed binding header
- Removed extra whitespace in sharp-memory.c
- Fixed error handling in sharp-memory.c
- Added match data to of_device_id table to be in-sync with spi_device_id table
- Replaced redundant function with spi_get_device_match_data
- Sorted header files in sharp-memory.c
---

Alex Lanzano (2):
dt-bindings: display: Add Sharp Memory LCD bindings drm/tiny: Add driver for Sharp Memory LCD

 .../bindings/display/sharp,ls010b7dh04.yaml   |  92 +++
 MAINTAINERS                                   |   6 +
 drivers/gpu/drm/tiny/Kconfig                  |  20 +
 drivers/gpu/drm/tiny/Makefile                 |   1 +
 drivers/gpu/drm/tiny/sharp-memory.c           | 684 ++++++++++++++++++
 5 files changed, 803 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sharp,ls010b7dh04.yaml
 create mode 100644 drivers/gpu/drm/tiny/sharp-memory.c
Signature · 1 line
2.45.2
author maintainer
#1 lore raw

PATCH v3 1/2 dt-bindings: display: Add Sharp Memory LCD bindings

Add device tree bindings for the monochrome Sharp Memory LCD

---
 .../bindings/display/sharp,ls010b7dh04.yaml   | 92 +++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/sharp,ls010b7dh04.yaml
Documentation/devicetree/bindings/display/sharp,ls010b7dh04.yaml new file +92 -0
new file mode 100644
index 000000000000..8097f091c2a5
@@ -0,0 +1,92 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sharp,ls010b7dh04.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sharp Memory LCD panels
+
+maintainers:
+  - Alex Lanzano <[email protected]>
+
+description:
+  Sharp Memory LCDs are a series of monochrome displays that operate over
+  a SPI bus. The displays require a signal (VCOM) to be generated to prevent
+  DC bias build up resulting in pixels being unable to change. Three modes
+  can be used to provide the VCOM signal ("software", "external", "pwm").
+
+properties:
+  compatible:
+    enum:
+      - sharp,ls010b7dh04
+      - sharp,ls011b7dh03
+      - sharp,ls012b7dd01
+      - sharp,ls013b7dh03
+      - sharp,ls013b7dh05
+      - sharp,ls018b7dh02
+      - sharp,ls027b7dh01
+      - sharp,ls027b7dh01a
+      - sharp,ls032b7dd02
+      - sharp,ls044q7dh01
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 2000000
+
+  sharp,vcom-mode:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: |
+      software - This mode relies on a software operation to send a
+      "maintain display" message to the display, toggling the vcom
+      bit on and off with each message
+
+      external - This mode relies on an external clock to generate
+      the signal on the EXTCOMM pin
+
+      pwm - This mode relies on a pwm device to generate the signal
+      on the EXTCOMM pin
+
+    enum: [software, external, pwm]
+
+  enable-gpios: true
+
+  pwms:
+    maxItems: 1
+    description: External VCOM signal
+
+required:
+  - compatible
+  - reg
+  - sharp,vcom-mode
+
+allOf:
+  - $ref: panel/panel-common.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+  - if:
+      properties:
+        sharp,vcom-mode:
+          const: pwm
+    then:
+      required:
+        - pwms
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        display@0 {
+            compatible = "sharp,ls013b7dh03";
+            reg = <0>;
+            spi-cs-high;
+            spi-max-frequency = <1000000>;
+            sharp,vcom-mode = "software";
+        };
+    };
+...
Signature · 1 line
2.45.2
Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] dt-bindings: display: Add Sharp Memory LCD bindings

Quoted 5 lines · Alex Lanzano

Add device tree bindings for the monochrome Sharp Memory LCD

---

<form letter>
This is an automated instruction, just in case, because many review tags are being ignored. If you know the process, you can skip it (please do not feel offended by me posting it here - no bad intentions intended). If you do not know the process, here is a short explanation:

Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions, under or above your Signed-off-by tag. Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

https://elixir.bootlin.com/linux/v6.5-rc3/source/Documentation/process/submitting-patches.rst#L577
</form letter>

Best regards,
Krzysztof

author maintainer
#3 lore raw

PATCH v3 2/2 drm/tiny: Add driver for Sharp Memory LCD

In reply to Alex Lanzano

Add support for the monochrome Sharp Memory LCDs.

---
 MAINTAINERS                         |   6 +
 drivers/gpu/drm/tiny/Kconfig        |  20 +
 drivers/gpu/drm/tiny/Makefile       |   1 +
 drivers/gpu/drm/tiny/sharp-memory.c | 684 ++++++++++++++++++++++++++++
 4 files changed, 711 insertions(+)
 create mode 100644 drivers/gpu/drm/tiny/sharp-memory.c
MAINTAINERS +6 -0
index 71b739b40921..933d7f885d89 100644
@@ -7123,6 +7123,12 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml
 F:	drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
 
+DRM DRIVER FOR SHARP MEMORY LCD
+M:	Alex Lanzano <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/display/sharp,ls010b7dh04.yaml
+F:	drivers/gpu/drm/tiny/sharp-memory.c
+
 DRM DRIVER FOR SITRONIX ST7586 PANELS
 M:	David Lechner <[email protected]>
 S:	Maintained
drivers/gpu/drm/tiny/Kconfig +20 -0
index f6889f649bc1..bc386954faa2 100644
@@ -186,6 +186,26 @@ config TINYDRM_REPAPER
 
 	  If M is selected the module will be called repaper.
 
+config TINYDRM_SHARP_MEMORY
+	tristate "DRM support for Sharp Memory LCD panels"
+	depends on DRM && SPI
+	select DRM_GEM_DMA_HELPER
+	select DRM_KMS_HELPER
+	help
+	  DRM Driver for the following Sharp Memory Panels:
+	  * 1.00" Sharp Memory LCD (LS010B7DH04)
+	  * 1.10" Sharp Memory LCD (LS011B7DH03)
+	  * 1.20" Sharp Memory LCD (LS012B7DD01)
+	  * 1.28" Sharp Memory LCD (LS013B7DH03)
+	  * 1.26" Sharp Memory LCD (LS013B7DH05)
+	  * 1.80" Sharp Memory LCD (LS018B7DH02)
+	  * 2.70" Sharp Memory LCD (LS027B7DH01)
+	  * 2.70" Sharp Memory LCD (LS027B7DH01A)
+	  * 3.20" Sharp Memory LCD (LS032B7DD02)
+	  * 4.40" Sharp Memory LCD (LS044Q7DH01)
+
+	  If M is selected the module will be called sharp_memory.
+
 config TINYDRM_ST7586
 	tristate "DRM support for Sitronix ST7586 display panels"
 	depends on DRM && SPI
drivers/gpu/drm/tiny/Makefile +1 -0
index 76dde89a044b..4aaf56f8707d 100644
@@ -14,5 +14,6 @@ obj-$(CONFIG_TINYDRM_ILI9341)		+= ili9341.o
 obj-$(CONFIG_TINYDRM_ILI9486)		+= ili9486.o
 obj-$(CONFIG_TINYDRM_MI0283QT)		+= mi0283qt.o
 obj-$(CONFIG_TINYDRM_REPAPER)		+= repaper.o
+obj-$(CONFIG_TINYDRM_SHARP_MEMORY)	+= sharp-memory.o
 obj-$(CONFIG_TINYDRM_ST7586)		+= st7586.o
 obj-$(CONFIG_TINYDRM_ST7735R)		+= st7735r.o
drivers/gpu/drm/tiny/sharp-memory.c new file +684 -0

684 lines not on this page · raw message

Signature · 1 line
2.45.2
#4 lore raw

Re: [PATCH v3 2/2] drm/tiny: Add driver for Sharp Memory LCD

…

Quoted 2 lines

+++ b/drivers/gpu/drm/tiny/sharp-memory.c

(quoted diff) +0 -0
@@ -0,0 +1,684 @@

…

Quoted 5 lines

static int sharp_memory_update_display(struct sharp_memory_device *smd,

drivers/gpu/drm/tiny/sharp-memory.c new file +4 -0
+				       struct drm_framebuffer *fb,
+				       struct drm_rect clip,
+				       struct drm_format_conv_state *fmtcnv_state)
+{

…

Quoted 3 lines
drivers/gpu/drm/tiny/sharp-memory.c new file +3 -0
+	mutex_lock(&smd->tx_mutex);
+
+	/* Populate the transmit buffer with frame data */

…

drivers/gpu/drm/tiny/sharp-memory.c line 173

Quoted 4 lines
drivers/gpu/drm/tiny/sharp-memory.c new file +4 -0
+	mutex_unlock(&smd->tx_mutex);
+
+	return ret;
+}

…

Under which circumstances would you become interested to apply a statement like “guard(mutex)(&smd->tx_mutex);”?
https://elixir.bootlin.com/linux/v6.10.2/source/include/linux/mutex.h#L196

Regards,
Markus

author maintainer
#5 lore raw

Re: [PATCH v3 2/2] drm/tiny: Add driver for Sharp Memory LCD

Quoted 20 lines · Markus Elfring

…

Quoted 2 lines

+++ b/drivers/gpu/drm/tiny/sharp-memory.c

(quoted diff) +0 -0
@@ -0,0 +1,684 @@

…

Quoted 5 lines

static int sharp_memory_update_display(struct sharp_memory_device *smd,

drivers/gpu/drm/tiny/sharp-memory.c new file +4 -0
+				       struct drm_framebuffer *fb,
+				       struct drm_rect clip,
+				       struct drm_format_conv_state *fmtcnv_state)
+{

…

Quoted 3 lines
drivers/gpu/drm/tiny/sharp-memory.c new file +3 -0
+	mutex_lock(&smd->tx_mutex);
+
+	/* Populate the transmit buffer with frame data */

…

Quoted 4 lines
drivers/gpu/drm/tiny/sharp-memory.c new file +4 -0
+	mutex_unlock(&smd->tx_mutex);
+
+	return ret;
+}

…

Quoted 4 lines

Under which circumstances would you become interested to apply a statement like “guard(mutex)(&smd->tx_mutex);”?
https://elixir.bootlin.com/linux/v6.10.2/source/include/linux/mutex.h#L196

Ah, I didn't realize guarded mutexes were implemented. That's really good to know.

I'd usually use them when it's possible to return before mutex_unlock is called to avoid goto cleanup logic. But it's probably best to just use them by default.

Thanks for the review. Will clean up in v4.

Best regards,
Alex

#6 lore raw

Re: [PATCH v3 2/2] drm/tiny: Add driver for Sharp Memory LCD

Quoted 5 lines · Alex Lanzano
Quoted 4 lines

Under which circumstances would you become interested to apply a statement like “guard(mutex)(&smd->tx_mutex);”?
https://elixir.bootlin.com/linux/v6.10.2/source/include/linux/mutex.h#L196

Quoted 8 lines

Ah, I didn't realize guarded mutexes were implemented. That's really good to know.

I'd usually use them when it's possible to return before mutex_unlock is called to avoid goto cleanup logic. But it's probably best to just use them by default.

Thanks for the review. Will clean up in v4.

<form letter>
Feel free to ignore all comments from Markus, regardless whether the suggestion is reasonable or not. This person is banned from LKML and several maintainers ignore Markus' feedback, because it is just a waste of time.
</form letter>

Best regards,
Krzysztof