mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode
@ 2023-08-04 13:02 Michael Riesch
  2023-08-04 13:02 ` [PATCH v2 1/4] dt-bindings: vendor-prefixes: add jasonic Michael Riesch
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Michael Riesch @ 2023-08-04 13:02 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
	Sam Ravnborg, David Airlie, Daniel Vetter, Maxime Ripard,
	Miquel Raynal, Sebastian Reichel, Gerald Loacker
  Cc: devicetree, linux-kernel, dri-devel, Conor Dooley, Michael Riesch

Hi all,

This series adds support for the partial display mode to the Sitronix
ST7789V panel driver. This is useful for panels that are partially
occluded by design, such as the Jasonic JT240MHQS-HWT-EK-E3. Support
for this particular panel is added as well.

Looking forward to your comments!

---
Changes in v2:
- Add comment w.r.t. modes (as requested by Maxime)
- Link to v1: https://lore.kernel.org/r/20230718-feature-lcd-panel-v1-0-e9a85d5374fd@wolfvision.net

---
Michael Riesch (4):
      dt-bindings: vendor-prefixes: add jasonic
      dt-bindings: display: st7789v: add jasonic jt240mhqs-hwt-ek-e3 display
      drm/panel: sitronix-st7789v: add support for partial mode
      drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support

 .../bindings/display/panel/sitronix,st7789v.yaml   |  1 +
 .../devicetree/bindings/vendor-prefixes.yaml       |  2 +
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c     | 72 +++++++++++++++++++++-
 3 files changed, 73 insertions(+), 2 deletions(-)
---
base-commit: e83172ec548d420f2e0b01e80a9a8cbae39bbe29
change-id: 20230718-feature-lcd-panel-26d9f29a7830

Best regards,
-- 
Michael Riesch <michael.riesch@wolfvision.net>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/4] dt-bindings: vendor-prefixes: add jasonic
  2023-08-04 13:02 [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
@ 2023-08-04 13:02 ` Michael Riesch
  2023-08-04 13:02 ` [PATCH v2 2/4] dt-bindings: display: st7789v: add jasonic jt240mhqs-hwt-ek-e3 display Michael Riesch
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Michael Riesch @ 2023-08-04 13:02 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
	Sam Ravnborg, David Airlie, Daniel Vetter, Maxime Ripard,
	Miquel Raynal, Sebastian Reichel, Gerald Loacker
  Cc: devicetree, linux-kernel, dri-devel, Conor Dooley, Michael Riesch

Add vendor prefix for Jasonic Technology Ltd., a manufacturer
of custom LCD panels.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 1e2e51401dc5..1dfafc339ddd 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -677,6 +677,8 @@ patternProperties:
     description: iWave Systems Technologies Pvt. Ltd.
   "^jadard,.*":
     description: Jadard Technology Inc.
+  "^jasonic,.*":
+    description: Jasonic Technology Ltd.
   "^jdi,.*":
     description: Japan Display Inc.
   "^jedec,.*":

-- 
2.37.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/4] dt-bindings: display: st7789v: add jasonic jt240mhqs-hwt-ek-e3 display
  2023-08-04 13:02 [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
  2023-08-04 13:02 ` [PATCH v2 1/4] dt-bindings: vendor-prefixes: add jasonic Michael Riesch
@ 2023-08-04 13:02 ` Michael Riesch
  2023-08-04 13:02 ` [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Michael Riesch @ 2023-08-04 13:02 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
	Sam Ravnborg, David Airlie, Daniel Vetter, Maxime Ripard,
	Miquel Raynal, Sebastian Reichel, Gerald Loacker
  Cc: devicetree, linux-kernel, dri-devel, Conor Dooley, Michael Riesch

Add compatible for the Jasonic Technology Ltd. JT240MHQS-HWT-EK-E3
display.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml b/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
index 0da4c7e05097..ef162b51d010 100644
--- a/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
+++ b/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
@@ -18,6 +18,7 @@ properties:
     enum:
       - edt,et028013dma
       - inanbo,t28cp45tn89-v17
+      - jasonic,jt240mhqs-hwt-ek-e3
       - sitronix,st7789v
 
   reg: true

-- 
2.37.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode
  2023-08-04 13:02 [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
  2023-08-04 13:02 ` [PATCH v2 1/4] dt-bindings: vendor-prefixes: add jasonic Michael Riesch
  2023-08-04 13:02 ` [PATCH v2 2/4] dt-bindings: display: st7789v: add jasonic jt240mhqs-hwt-ek-e3 display Michael Riesch
@ 2023-08-04 13:02 ` Michael Riesch
  2023-08-04 13:06   ` Neil Armstrong
  2023-08-04 13:35   ` Maxime Ripard
  2023-08-04 13:02 ` [PATCH v2 4/4] drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support Michael Riesch
  2023-08-04 13:28 ` [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Neil Armstrong
  4 siblings, 2 replies; 9+ messages in thread
From: Michael Riesch @ 2023-08-04 13:02 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
	Sam Ravnborg, David Airlie, Daniel Vetter, Maxime Ripard,
	Miquel Raynal, Sebastian Reichel, Gerald Loacker
  Cc: devicetree, linux-kernel, dri-devel, Michael Riesch

The ST7789V controller features support for the partial mode. Here,
the area to be displayed can be restricted in one direction (by default,
in vertical direction). This is useful for panels that are partially
occluded by design. Add support for the partial mode.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 43 ++++++++++++++++++++++++--
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index 0ded72ed2fcd..ebc9a3bd6db3 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -118,6 +118,9 @@ struct st7789_panel_info {
 	u32 bus_format;
 	u32 bus_flags;
 	bool invert_mode;
+	bool partial_mode;
+	u16 partial_start;
+	u16 partial_end;
 };
 
 struct st7789v {
@@ -345,9 +348,14 @@ static enum drm_panel_orientation st7789v_get_orientation(struct drm_panel *p)
 static int st7789v_prepare(struct drm_panel *panel)
 {
 	struct st7789v *ctx = panel_to_st7789v(panel);
-	u8 pixel_fmt, polarity;
+	u8 mode, pixel_fmt, polarity;
 	int ret;
 
+	if (!ctx->info->partial_mode)
+		mode = ST7789V_RGBCTRL_WO;
+	else
+		mode = 0;
+
 	switch (ctx->info->bus_format) {
 	case MEDIA_BUS_FMT_RGB666_1X18:
 		pixel_fmt = MIPI_DCS_PIXEL_FMT_18BIT;
@@ -487,6 +495,37 @@ static int st7789v_prepare(struct drm_panel *panel)
 						MIPI_DCS_EXIT_INVERT_MODE));
 	}
 
+	if (ctx->info->partial_mode) {
+		u8 area_data[4] = {
+			(ctx->info->partial_start >> 8) & 0xff,
+			(ctx->info->partial_start >> 0) & 0xff,
+			((ctx->info->partial_end - 1) >> 8) & 0xff,
+			((ctx->info->partial_end - 1) >> 0) & 0xff,
+		};
+
+		/* Caution: if userspace ever pushes a mode different from the
+		 * expected one (i.e., the one advertised by get_modes), we'll
+		 * add margins.
+		 */
+
+		ST7789V_TEST(ret, st7789v_write_command(
+					  ctx, MIPI_DCS_ENTER_PARTIAL_MODE));
+
+		ST7789V_TEST(ret, st7789v_write_command(
+					  ctx, MIPI_DCS_SET_PAGE_ADDRESS));
+		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[0]));
+		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[1]));
+		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[2]));
+		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[3]));
+
+		ST7789V_TEST(ret, st7789v_write_command(
+					  ctx, MIPI_DCS_SET_PARTIAL_ROWS));
+		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[0]));
+		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[1]));
+		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[2]));
+		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[3]));
+	}
+
 	ST7789V_TEST(ret, st7789v_write_command(ctx, ST7789V_RAMCTRL_CMD));
 	ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_RAMCTRL_DM_RGB |
 					     ST7789V_RAMCTRL_RM_RGB));
@@ -494,7 +533,7 @@ static int st7789v_prepare(struct drm_panel *panel)
 					     ST7789V_RAMCTRL_MAGIC));
 
 	ST7789V_TEST(ret, st7789v_write_command(ctx, ST7789V_RGBCTRL_CMD));
-	ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_RGBCTRL_WO |
+	ST7789V_TEST(ret, st7789v_write_data(ctx, mode |
 					     ST7789V_RGBCTRL_RCM(2) |
 					     polarity));
 	ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_RGBCTRL_VBP(8)));

-- 
2.37.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 4/4] drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support
  2023-08-04 13:02 [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
                   ` (2 preceding siblings ...)
  2023-08-04 13:02 ` [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
@ 2023-08-04 13:02 ` Michael Riesch
  2023-08-04 13:06   ` Neil Armstrong
  2023-08-04 13:28 ` [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Neil Armstrong
  4 siblings, 1 reply; 9+ messages in thread
From: Michael Riesch @ 2023-08-04 13:02 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
	Sam Ravnborg, David Airlie, Daniel Vetter, Maxime Ripard,
	Miquel Raynal, Sebastian Reichel, Gerald Loacker
  Cc: devicetree, linux-kernel, dri-devel, Michael Riesch

The Jasonic JT240MHQS-HWT-EK-E3 is a custom panel using the Sitronix
ST7789V controller. While the controller features a resolution of
320x240, only an area of 280x240 is visible by design.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 29 ++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index ebc9a3bd6db3..88e80fe98112 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -279,6 +279,21 @@ static const struct drm_display_mode et028013dma_mode = {
 	.flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
 };
 
+static const struct drm_display_mode jt240mhqs_hwt_ek_e3_mode = {
+	.clock = 6000,
+	.hdisplay = 240,
+	.hsync_start = 240 + 28,
+	.hsync_end = 240 + 28 + 10,
+	.htotal = 240 + 28 + 10 + 10,
+	.vdisplay = 280,
+	.vsync_start = 280 + 8,
+	.vsync_end = 280 + 8 + 4,
+	.vtotal = 280 + 8 + 4 + 4,
+	.width_mm = 43,
+	.height_mm = 37,
+	.flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
+};
+
 static const struct st7789_panel_info default_panel = {
 	.mode = &default_mode,
 	.invert_mode = true,
@@ -303,6 +318,17 @@ static const struct st7789_panel_info et028013dma_panel = {
 		     DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
 };
 
+static const struct st7789_panel_info jt240mhqs_hwt_ek_e3_panel = {
+	.mode = &jt240mhqs_hwt_ek_e3_mode,
+	.invert_mode = true,
+	.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
+	.bus_flags = DRM_BUS_FLAG_DE_HIGH |
+		     DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
+	.partial_mode = true,
+	.partial_start = 38,
+	.partial_end = 318,
+};
+
 static int st7789v_get_modes(struct drm_panel *panel,
 			     struct drm_connector *connector)
 {
@@ -635,6 +661,7 @@ static const struct spi_device_id st7789v_spi_id[] = {
 	{ "st7789v", (unsigned long) &default_panel },
 	{ "t28cp45tn89-v17", (unsigned long) &t28cp45tn89_panel },
 	{ "et028013dma", (unsigned long) &et028013dma_panel },
+	{ "jt240mhqs-hwt-ek-e3", (unsigned long) &jt240mhqs_hwt_ek_e3_panel },
 	{ }
 };
 MODULE_DEVICE_TABLE(spi, st7789v_spi_id);
@@ -643,6 +670,8 @@ static const struct of_device_id st7789v_of_match[] = {
 	{ .compatible = "sitronix,st7789v", .data = &default_panel },
 	{ .compatible = "inanbo,t28cp45tn89-v17", .data = &t28cp45tn89_panel },
 	{ .compatible = "edt,et028013dma", .data = &et028013dma_panel },
+	{ .compatible = "jasonic,jt240mhqs-hwt-ek-e3",
+	  .data = &jt240mhqs_hwt_ek_e3_panel },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, st7789v_of_match);

-- 
2.37.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode
  2023-08-04 13:02 ` [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
@ 2023-08-04 13:06   ` Neil Armstrong
  2023-08-04 13:35   ` Maxime Ripard
  1 sibling, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2023-08-04 13:06 UTC (permalink / raw)
  To: Michael Riesch, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Sam Ravnborg, David Airlie, Daniel Vetter, Maxime Ripard,
	Miquel Raynal, Sebastian Reichel, Gerald Loacker
  Cc: devicetree, linux-kernel, dri-devel

On 04/08/2023 15:02, Michael Riesch wrote:
> The ST7789V controller features support for the partial mode. Here,
> the area to be displayed can be restricted in one direction (by default,
> in vertical direction). This is useful for panels that are partially
> occluded by design. Add support for the partial mode.
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
>   drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 43 ++++++++++++++++++++++++--
>   1 file changed, 41 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index 0ded72ed2fcd..ebc9a3bd6db3 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -118,6 +118,9 @@ struct st7789_panel_info {
>   	u32 bus_format;
>   	u32 bus_flags;
>   	bool invert_mode;
> +	bool partial_mode;
> +	u16 partial_start;
> +	u16 partial_end;
>   };
>   
>   struct st7789v {
> @@ -345,9 +348,14 @@ static enum drm_panel_orientation st7789v_get_orientation(struct drm_panel *p)
>   static int st7789v_prepare(struct drm_panel *panel)
>   {
>   	struct st7789v *ctx = panel_to_st7789v(panel);
> -	u8 pixel_fmt, polarity;
> +	u8 mode, pixel_fmt, polarity;
>   	int ret;
>   
> +	if (!ctx->info->partial_mode)
> +		mode = ST7789V_RGBCTRL_WO;
> +	else
> +		mode = 0;
> +
>   	switch (ctx->info->bus_format) {
>   	case MEDIA_BUS_FMT_RGB666_1X18:
>   		pixel_fmt = MIPI_DCS_PIXEL_FMT_18BIT;
> @@ -487,6 +495,37 @@ static int st7789v_prepare(struct drm_panel *panel)
>   						MIPI_DCS_EXIT_INVERT_MODE));
>   	}
>   
> +	if (ctx->info->partial_mode) {
> +		u8 area_data[4] = {
> +			(ctx->info->partial_start >> 8) & 0xff,
> +			(ctx->info->partial_start >> 0) & 0xff,
> +			((ctx->info->partial_end - 1) >> 8) & 0xff,
> +			((ctx->info->partial_end - 1) >> 0) & 0xff,
> +		};
> +
> +		/* Caution: if userspace ever pushes a mode different from the
> +		 * expected one (i.e., the one advertised by get_modes), we'll
> +		 * add margins.
> +		 */
> +
> +		ST7789V_TEST(ret, st7789v_write_command(
> +					  ctx, MIPI_DCS_ENTER_PARTIAL_MODE));
> +
> +		ST7789V_TEST(ret, st7789v_write_command(
> +					  ctx, MIPI_DCS_SET_PAGE_ADDRESS));
> +		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[0]));
> +		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[1]));
> +		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[2]));
> +		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[3]));
> +
> +		ST7789V_TEST(ret, st7789v_write_command(
> +					  ctx, MIPI_DCS_SET_PARTIAL_ROWS));
> +		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[0]));
> +		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[1]));
> +		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[2]));
> +		ST7789V_TEST(ret, st7789v_write_data(ctx, area_data[3]));
> +	}
> +
>   	ST7789V_TEST(ret, st7789v_write_command(ctx, ST7789V_RAMCTRL_CMD));
>   	ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_RAMCTRL_DM_RGB |
>   					     ST7789V_RAMCTRL_RM_RGB));
> @@ -494,7 +533,7 @@ static int st7789v_prepare(struct drm_panel *panel)
>   					     ST7789V_RAMCTRL_MAGIC));
>   
>   	ST7789V_TEST(ret, st7789v_write_command(ctx, ST7789V_RGBCTRL_CMD));
> -	ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_RGBCTRL_WO |
> +	ST7789V_TEST(ret, st7789v_write_data(ctx, mode |
>   					     ST7789V_RGBCTRL_RCM(2) |
>   					     polarity));
>   	ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_RGBCTRL_VBP(8)));
> 

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 4/4] drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support
  2023-08-04 13:02 ` [PATCH v2 4/4] drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support Michael Riesch
@ 2023-08-04 13:06   ` Neil Armstrong
  0 siblings, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2023-08-04 13:06 UTC (permalink / raw)
  To: Michael Riesch, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Sam Ravnborg, David Airlie, Daniel Vetter, Maxime Ripard,
	Miquel Raynal, Sebastian Reichel, Gerald Loacker
  Cc: devicetree, linux-kernel, dri-devel

On 04/08/2023 15:02, Michael Riesch wrote:
> The Jasonic JT240MHQS-HWT-EK-E3 is a custom panel using the Sitronix
> ST7789V controller. While the controller features a resolution of
> 320x240, only an area of 280x240 is visible by design.
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
>   drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 29 ++++++++++++++++++++++++++
>   1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index ebc9a3bd6db3..88e80fe98112 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -279,6 +279,21 @@ static const struct drm_display_mode et028013dma_mode = {
>   	.flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
>   };
>   
> +static const struct drm_display_mode jt240mhqs_hwt_ek_e3_mode = {
> +	.clock = 6000,
> +	.hdisplay = 240,
> +	.hsync_start = 240 + 28,
> +	.hsync_end = 240 + 28 + 10,
> +	.htotal = 240 + 28 + 10 + 10,
> +	.vdisplay = 280,
> +	.vsync_start = 280 + 8,
> +	.vsync_end = 280 + 8 + 4,
> +	.vtotal = 280 + 8 + 4 + 4,
> +	.width_mm = 43,
> +	.height_mm = 37,
> +	.flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
> +};
> +
>   static const struct st7789_panel_info default_panel = {
>   	.mode = &default_mode,
>   	.invert_mode = true,
> @@ -303,6 +318,17 @@ static const struct st7789_panel_info et028013dma_panel = {
>   		     DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
>   };
>   
> +static const struct st7789_panel_info jt240mhqs_hwt_ek_e3_panel = {
> +	.mode = &jt240mhqs_hwt_ek_e3_mode,
> +	.invert_mode = true,
> +	.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
> +	.bus_flags = DRM_BUS_FLAG_DE_HIGH |
> +		     DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
> +	.partial_mode = true,
> +	.partial_start = 38,
> +	.partial_end = 318,
> +};
> +
>   static int st7789v_get_modes(struct drm_panel *panel,
>   			     struct drm_connector *connector)
>   {
> @@ -635,6 +661,7 @@ static const struct spi_device_id st7789v_spi_id[] = {
>   	{ "st7789v", (unsigned long) &default_panel },
>   	{ "t28cp45tn89-v17", (unsigned long) &t28cp45tn89_panel },
>   	{ "et028013dma", (unsigned long) &et028013dma_panel },
> +	{ "jt240mhqs-hwt-ek-e3", (unsigned long) &jt240mhqs_hwt_ek_e3_panel },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(spi, st7789v_spi_id);
> @@ -643,6 +670,8 @@ static const struct of_device_id st7789v_of_match[] = {
>   	{ .compatible = "sitronix,st7789v", .data = &default_panel },
>   	{ .compatible = "inanbo,t28cp45tn89-v17", .data = &t28cp45tn89_panel },
>   	{ .compatible = "edt,et028013dma", .data = &et028013dma_panel },
> +	{ .compatible = "jasonic,jt240mhqs-hwt-ek-e3",
> +	  .data = &jt240mhqs_hwt_ek_e3_panel },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(of, st7789v_of_match);
> 

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode
  2023-08-04 13:02 [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
                   ` (3 preceding siblings ...)
  2023-08-04 13:02 ` [PATCH v2 4/4] drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support Michael Riesch
@ 2023-08-04 13:28 ` Neil Armstrong
  4 siblings, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2023-08-04 13:28 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sam Ravnborg,
	David Airlie, Daniel Vetter, Maxime Ripard, Miquel Raynal,
	Sebastian Reichel, Gerald Loacker, Michael Riesch
  Cc: devicetree, linux-kernel, dri-devel, Conor Dooley

Hi,

On Fri, 04 Aug 2023 15:02:31 +0200, Michael Riesch wrote:
> This series adds support for the partial display mode to the Sitronix
> ST7789V panel driver. This is useful for panels that are partially
> occluded by design, such as the Jasonic JT240MHQS-HWT-EK-E3. Support
> for this particular panel is added as well.
> 
> Looking forward to your comments!
> 
> [...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)

[1/4] dt-bindings: vendor-prefixes: add jasonic
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=c1e98bb9e69f49e16c34c1cb48bcb5b0f0cb064a
[2/4] dt-bindings: display: st7789v: add jasonic jt240mhqs-hwt-ek-e3 display
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=a5382e358e56f3bef13aae3432bec906130b2074
[3/4] drm/panel: sitronix-st7789v: add support for partial mode
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=a82db60440c552b1def32ab33b642454490d850e
[4/4] drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=0fbbe96bfa089c3758a7d1969ff34036d3f03d68

-- 
Neil


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode
  2023-08-04 13:02 ` [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
  2023-08-04 13:06   ` Neil Armstrong
@ 2023-08-04 13:35   ` Maxime Ripard
  1 sibling, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2023-08-04 13:35 UTC (permalink / raw)
  To: Michael Riesch
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Neil Armstrong,
	Sam Ravnborg, David Airlie, Daniel Vetter, Miquel Raynal,
	Sebastian Reichel, Gerald Loacker, devicetree, linux-kernel,
	dri-devel

[-- Attachment #1: Type: text/plain, Size: 2313 bytes --]

On Fri, Aug 04, 2023 at 03:02:34PM +0200, Michael Riesch wrote:
> The ST7789V controller features support for the partial mode. Here,
> the area to be displayed can be restricted in one direction (by default,
> in vertical direction). This is useful for panels that are partially
> occluded by design. Add support for the partial mode.
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
>  drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 43 ++++++++++++++++++++++++--
>  1 file changed, 41 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index 0ded72ed2fcd..ebc9a3bd6db3 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -118,6 +118,9 @@ struct st7789_panel_info {
>  	u32 bus_format;
>  	u32 bus_flags;
>  	bool invert_mode;
> +	bool partial_mode;
> +	u16 partial_start;
> +	u16 partial_end;
>  };
>  
>  struct st7789v {
> @@ -345,9 +348,14 @@ static enum drm_panel_orientation st7789v_get_orientation(struct drm_panel *p)
>  static int st7789v_prepare(struct drm_panel *panel)
>  {
>  	struct st7789v *ctx = panel_to_st7789v(panel);
> -	u8 pixel_fmt, polarity;
> +	u8 mode, pixel_fmt, polarity;
>  	int ret;
>  
> +	if (!ctx->info->partial_mode)
> +		mode = ST7789V_RGBCTRL_WO;
> +	else
> +		mode = 0;
> +
>  	switch (ctx->info->bus_format) {
>  	case MEDIA_BUS_FMT_RGB666_1X18:
>  		pixel_fmt = MIPI_DCS_PIXEL_FMT_18BIT;
> @@ -487,6 +495,37 @@ static int st7789v_prepare(struct drm_panel *panel)
>  						MIPI_DCS_EXIT_INVERT_MODE));
>  	}
>  
> +	if (ctx->info->partial_mode) {
> +		u8 area_data[4] = {
> +			(ctx->info->partial_start >> 8) & 0xff,
> +			(ctx->info->partial_start >> 0) & 0xff,
> +			((ctx->info->partial_end - 1) >> 8) & 0xff,
> +			((ctx->info->partial_end - 1) >> 0) & 0xff,
> +		};
> +
> +		/* Caution: if userspace ever pushes a mode different from the
> +		 * expected one (i.e., the one advertised by get_modes), we'll
> +		 * add margins.
> +		 */

The comment format is incorrect. Since Neil applied the patches already,
please send a patch to fix it.

Looks good to me otherwise, thanks for sticking up with this :)

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-04 13:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-04 13:02 [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
2023-08-04 13:02 ` [PATCH v2 1/4] dt-bindings: vendor-prefixes: add jasonic Michael Riesch
2023-08-04 13:02 ` [PATCH v2 2/4] dt-bindings: display: st7789v: add jasonic jt240mhqs-hwt-ek-e3 display Michael Riesch
2023-08-04 13:02 ` [PATCH v2 3/4] drm/panel: sitronix-st7789v: add support for partial mode Michael Riesch
2023-08-04 13:06   ` Neil Armstrong
2023-08-04 13:35   ` Maxime Ripard
2023-08-04 13:02 ` [PATCH v2 4/4] drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support Michael Riesch
2023-08-04 13:06   ` Neil Armstrong
2023-08-04 13:28 ` [PATCH v2 0/4] drm/panel: sitronix-st7789v: add support for partial mode Neil Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®