aboutsummaryrefslogtreecommitdiff
path: root/target/linux/bcm27xx/patches-6.1/950-0742-panel-sitronix-st7701-Fix-panel-prepare-over-SPI.patch
blob: eccffec4e172ec6f2191585316c6ff24f8d89251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 162aedd492c420bbfe3d44dae1770c60a6c367bb Mon Sep 17 00:00:00 2001
From: Jack Andersen <jackoalan@gmail.com>
Date: Fri, 26 May 2023 12:19:19 -0700
Subject: [PATCH] panel-sitronix-st7701: Fix panel prepare over SPI

A DSI write is issued in st7701_prepare even when the probed panel
runs on SPI. In practice, this results in a panic with the
vc4-kms-dpi-hyperpixel2r overlay active.

Perform the equivalent write over SPI in this case.

Signed-off-by: Jack Andersen <jackoalan@gmail.com>
---
 drivers/gpu/drm/panel/panel-sitronix-st7701.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -571,8 +571,16 @@ static int st7701_prepare(struct drm_pan
 		st7701->desc->gip_sequence(st7701);
 
 	/* Disable Command2 */
-	ST7701_DSI(st7701, DSI_CMD2BKX_SEL,
-		   0x77, 0x01, 0x00, 0x00, DSI_CMD2BKX_SEL_NONE);
+	switch (st7701->desc->interface) {
+	case ST7701_CTRL_DSI:
+		ST7701_DSI(st7701, DSI_CMD2BKX_SEL,
+			   0x77, 0x01, 0x00, 0x00, DSI_CMD2BKX_SEL_NONE);
+		break;
+	case ST7701_CTRL_SPI:
+		ST7701_SPI(st7701, DSI_CMD2BKX_SEL,
+			   0x177, 0x101, 0x100, 0x100, SPI_CMD2BKX_SEL_NONE);
+		break;
+	}
 
 	return 0;
 }