Skip to contentSkip to conversation

rockchip: Add Powkiddy X55

PATCH Superseded Chris Morgan 4 participants 15 messages Nov 30, 2023 – Dec 1, 2023

Subsystems (7)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover rockchip: Add Powkiddy X55

From: Chris Morgan <[email protected]>

Add support for the Rockchip RK3566 based Powkiddy X55 handheld gaming console.

Chris Morgan (9):
drm/panel: himax-hx8394: Drop prepare/unprepare tracking drm/panel: himax-hx8394: Drop shutdown logic
dt-bindings: display: Document Himax HX8394 panel rotation drm/panel: himax-hx8394: Add Panel Rotation Support
dt-bindings: display: himax-hx8394: Add Powkiddy X55 panel drm/panel: himax-hx8394: Add Support for Powkiddy X55 panel
clk: rockchip: Mark pclk_usb as critical on rk3568
dt-bindings: arm: rockchip: Add Powkiddy X55
arm64: dts: rockchip: Add Powkiddy X55

 .../devicetree/bindings/arm/rockchip.yaml     |   1 +
 .../bindings/display/panel/himax,hx8394.yaml  |   3 +
 arch/arm64/boot/dts/rockchip/Makefile         |   1 +
 .../boot/dts/rockchip/rk3566-powkiddy-x55.dts | 926 ++++++++++++++++++
 drivers/clk/rockchip/clk-rk3568.c             |   1 +
 drivers/gpu/drm/panel/panel-himax-hx8394.c    | 180 +++-
 6 files changed, 1084 insertions(+), 28 deletions(-)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-powkiddy-x55.dts
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/9 drm/panel: himax-hx8394: Drop prepare/unprepare tracking

From: Chris Morgan <[email protected]>

Drop the panel specific prepare/unprepare logic. This is now tracked by the DRM stack [1].

[1] commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel")

---
 drivers/gpu/drm/panel/panel-himax-hx8394.c | 11 -----------
 1 file changed, 11 deletions(-)
drivers/gpu/drm/panel/panel-himax-hx8394.c +0 -11
index c73243d85de7..3823ff388b96 100644
@@ -68,7 +68,6 @@ struct hx8394 {
 	struct gpio_desc *reset_gpio;
 	struct regulator *vcc;
 	struct regulator *iovcc;
-	bool prepared;
 
 	const struct hx8394_panel_desc *desc;
 };
@@ -262,16 +261,11 @@ static int hx8394_unprepare(struct drm_panel *panel)
 {
 	struct hx8394 *ctx = panel_to_hx8394(panel);
 
-	if (!ctx->prepared)
-		return 0;
-
 	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
 
 	regulator_disable(ctx->iovcc);
 	regulator_disable(ctx->vcc);
 
-	ctx->prepared = false;
-
 	return 0;
 }
 
@@ -280,9 +274,6 @@ static int hx8394_prepare(struct drm_panel *panel)
 	struct hx8394 *ctx = panel_to_hx8394(panel);
 	int ret;
 
-	if (ctx->prepared)
-		return 0;
-
 	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
 
 	ret = regulator_enable(ctx->vcc);
@@ -301,8 +292,6 @@ static int hx8394_prepare(struct drm_panel *panel)
 
 	msleep(180);
 
-	ctx->prepared = true;
-
 	return 0;
 
 disable_vcc:
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/9 drm/panel: himax-hx8394: Drop shutdown logic

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

The driver shutdown is duplicate as it calls drm_unprepare and drm_disable which are called anyway when associated drivers are shutdown/removed.

---
 drivers/gpu/drm/panel/panel-himax-hx8394.c | 17 -----------------
 1 file changed, 17 deletions(-)
drivers/gpu/drm/panel/panel-himax-hx8394.c +0 -17
index 3823ff388b96..d8e590d5e1da 100644
@@ -390,27 +390,11 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
 	return 0;
 }
 
-static void hx8394_shutdown(struct mipi_dsi_device *dsi)
-{
-	struct hx8394 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = drm_panel_disable(&ctx->panel);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret);
-
-	ret = drm_panel_unprepare(&ctx->panel);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret);
-}
-
 static void hx8394_remove(struct mipi_dsi_device *dsi)
 {
 	struct hx8394 *ctx = mipi_dsi_get_drvdata(dsi);
 	int ret;
 
-	hx8394_shutdown(dsi);
-
 	ret = mipi_dsi_detach(dsi);
 	if (ret < 0)
 		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
@@ -427,7 +411,6 @@ MODULE_DEVICE_TABLE(of, hx8394_of_match);
 static struct mipi_dsi_driver hx8394_driver = {
 	.probe	= hx8394_probe,
 	.remove = hx8394_remove,
-	.shutdown = hx8394_shutdown,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = hx8394_of_match,
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/9 dt-bindings: display: Document Himax HX8394 panel rotation

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Document panel rotation for Himax HX8394 display panel.

---
 .../devicetree/bindings/display/panel/himax,hx8394.yaml         | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml +2 -0
index ffb35288ffbb..3096debca55c 100644
@@ -31,6 +31,8 @@ properties:
 
   backlight: true
 
+  rotation: true
+
   port: true
 
   vcc-supply:
Signature · 1 line
2.34.1
#5 lore raw

PATCH 4/9 drm/panel: himax-hx8394: Add Panel Rotation Support

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add support for setting the rotation property for the Himax HX8394 panel.

---
 drivers/gpu/drm/panel/panel-himax-hx8394.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/panel/panel-himax-hx8394.c +15 -0
index d8e590d5e1da..b68ea09f4725 100644
@@ -68,6 +68,7 @@ struct hx8394 {
 	struct gpio_desc *reset_gpio;
 	struct regulator *vcc;
 	struct regulator *iovcc;
+	enum drm_panel_orientation orientation;
 
 	const struct hx8394_panel_desc *desc;
 };
@@ -324,12 +325,20 @@ static int hx8394_get_modes(struct drm_panel *panel,
 	return 1;
 }
 
+static enum drm_panel_orientation hx8394_get_orientation(struct drm_panel *panel)
+{
+	struct hx8394 *ctx = panel_to_hx8394(panel);
+
+	return ctx->orientation;
+}
+
 static const struct drm_panel_funcs hx8394_drm_funcs = {
 	.disable   = hx8394_disable,
 	.unprepare = hx8394_unprepare,
 	.prepare   = hx8394_prepare,
 	.enable	   = hx8394_enable,
 	.get_modes = hx8394_get_modes,
+	.get_orientation = hx8394_get_orientation,
 };
 
 static int hx8394_probe(struct mipi_dsi_device *dsi)
@@ -347,6 +356,12 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
 				     "Failed to get reset gpio\n");
 
+	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	if (ret < 0) {
+		dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret);
+		return ret;
+	}
+
 	mipi_dsi_set_drvdata(dsi, ctx);
 
 	ctx->dev = dev;
Signature · 1 line
2.34.1
#6 lore raw

PATCH 5/9 dt-bindings: display: himax-hx8394: Add Powkiddy X55 panel

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add compatible string for the Powkiddy X55 panel.

---
 .../devicetree/bindings/display/panel/himax,hx8394.yaml          | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml +1 -0
index 3096debca55c..916bb7f94206 100644
@@ -23,6 +23,7 @@ properties:
     items:
       - enum:
           - hannstar,hsd060bhw4
+          - powkiddy,x55-panel
       - const: himax,hx8394
 
   reg: true
Signature · 1 line
2.34.1
#8 lore raw

PATCH 6/9 drm/panel: himax-hx8394: Add Support for Powkiddy X55 panel

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Powkiddy X55 panel as used on the Powkiddy X55 handheld gaming console. This panel uses a Himax HX8394 display controller and requires a vendor provided init sequence. The display resolution is 720x1280 and is 67mm by 121mm as measured with calipers.

---
 drivers/gpu/drm/panel/panel-himax-hx8394.c | 137 +++++++++++++++++++++
 1 file changed, 137 insertions(+)
drivers/gpu/drm/panel/panel-himax-hx8394.c +137 -0
index b68ea09f4725..4807ab1c10fe 100644
@@ -38,6 +38,7 @@
 #define HX8394_CMD_SETMIPI	  0xba
 #define HX8394_CMD_SETOTP	  0xbb
 #define HX8394_CMD_SETREGBANK	  0xbd
+#define HX8394_CMD_UNKNOWN5	  0xbf
 #define HX8394_CMD_UNKNOWN1	  0xc0
 #define HX8394_CMD_SETDGCLUT	  0xc1
 #define HX8394_CMD_SETID	  0xc3
@@ -52,6 +53,7 @@
 #define HX8394_CMD_SETGIP1	  0xd5
 #define HX8394_CMD_SETGIP2	  0xd6
 #define HX8394_CMD_SETGPO	  0xd6
+#define HX8394_CMD_UNKNOWN4	  0xd8
 #define HX8394_CMD_SETSCALING	  0xdd
 #define HX8394_CMD_SETIDLE	  0xdf
 #define HX8394_CMD_SETGAMMA	  0xe0
@@ -203,6 +205,140 @@ static const struct hx8394_panel_desc hsd060bhw4_desc = {
 	.init_sequence = hsd060bhw4_init_sequence,
 };
 
+static int powkiddy_x55_init_sequence(struct hx8394 *ctx)
+{
+	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+
+	/* 5.19.8 SETEXTC: Set extension command (B9h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETEXTC,
+			       0xff, 0x83, 0x94);
+
+	/* 5.19.9 SETMIPI: Set MIPI control (BAh) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETMIPI,
+			       0x63, 0x03, 0x68, 0x6b, 0xb2, 0xc0);
+
+	/* 5.19.2 SETPOWER: Set power (B1h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER,
+			       0x48, 0x12, 0x72, 0x09, 0x32, 0x54, 0x71, 0x71, 0x57, 0x47);
+
+	/* 5.19.3 SETDISP: Set display related register (B2h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETDISP,
+			       0x00, 0x80, 0x64, 0x0c, 0x0d, 0x2f);
+
+	/* 5.19.4 SETCYC: Set display waveform cycles (B4h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCYC,
+			       0x73, 0x74, 0x73, 0x74, 0x73, 0x74, 0x01, 0x0c, 0x86, 0x75,
+			       0x00, 0x3f, 0x73, 0x74, 0x73, 0x74, 0x73, 0x74, 0x01, 0x0c,
+			       0x86);
+
+	/* 5.19.5 SETVCOM: Set VCOM voltage (B6h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETVCOM,
+			       0x6e, 0x6e);
+
+	/* 5.19.19 SETGIP0: Set GIP Option0 (D3h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP0,
+			       0x00, 0x00, 0x07, 0x07, 0x40, 0x07, 0x0c, 0x00, 0x08, 0x10,
+			       0x08, 0x00, 0x08, 0x54, 0x15, 0x0a, 0x05, 0x0a, 0x02, 0x15,
+			       0x06, 0x05, 0x06, 0x47, 0x44, 0x0a, 0x0a, 0x4b, 0x10, 0x07,
+			       0x07, 0x0c, 0x40);
+
+	/* 5.19.20 Set GIP Option1 (D5h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP1,
+			       0x1c, 0x1c, 0x1d, 0x1d, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+			       0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x24, 0x25, 0x18, 0x18,
+			       0x26, 0x27, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+			       0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x20, 0x21,
+			       0x18, 0x18, 0x18, 0x18);
+
+	/* 5.19.21 Set GIP Option2 (D6h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP2,
+			       0x1c, 0x1c, 0x1d, 0x1d, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02,
+			       0x01, 0x00, 0x0b, 0x0a, 0x09, 0x08, 0x21, 0x20, 0x18, 0x18,
+			       0x27, 0x26, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+			       0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x25, 0x24,
+			       0x18, 0x18, 0x18, 0x18);
+
+	/* 5.19.25 SETGAMMA: Set gamma curve related setting (E0h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGAMMA,
+			       0x00, 0x0a, 0x15, 0x1b, 0x1e, 0x21, 0x24, 0x22, 0x47, 0x56,
+			       0x65, 0x66, 0x6e, 0x82, 0x88, 0x8b, 0x9a, 0x9d, 0x98, 0xa8,
+			       0xb9, 0x5d, 0x5c, 0x61, 0x66, 0x6a, 0x6f, 0x7f, 0x7f, 0x00,
+			       0x0a, 0x15, 0x1b, 0x1e, 0x21, 0x24, 0x22, 0x47, 0x56, 0x65,
+			       0x65, 0x6e, 0x81, 0x87, 0x8b, 0x98, 0x9d, 0x99, 0xa8, 0xba,
+			       0x5d, 0x5d, 0x62, 0x67, 0x6b, 0x72, 0x7f, 0x7f);
+
+	/* Unknown command, not listed in the HX8394-F datasheet */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN1,
+			       0x1f, 0x31);
+
+	/* 5.19.17 SETPANEL (CCh) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPANEL,
+			       0x0b);
+
+	/* Unknown command, not listed in the HX8394-F datasheet */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3,
+			       0x02);
+
+	/* 5.19.11 Set register bank (BDh) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+			       0x02);
+
+	/* Unknown command, not listed in the HX8394-F datasheet */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN4,
+			       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+			       0xff, 0xff);
+
+	/* 5.19.11 Set register bank (BDh) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+			       0x00);
+
+	/* 5.19.11 Set register bank (BDh) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+			       0x01);
+
+	/* 5.19.2 SETPOWER: Set power (B1h) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER,
+			       0x00);
+
+	/* 5.19.11 Set register bank (BDh) */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+			       0x00);
+
+	/* Unknown command, not listed in the HX8394-F datasheet */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN5,
+			       0x40, 0x81, 0x50, 0x00, 0x1a, 0xfc, 0x01);
+
+	/* Unknown command, not listed in the HX8394-F datasheet */
+	mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN2,
+			       0xed);
+
+	return 0;
+}
+
+static const struct drm_display_mode powkiddy_x55_mode = {
+	.hdisplay	= 720,
+	.hsync_start	= 720 + 24,
+	.hsync_end	= 720 + 24 + 4,
+	.htotal		= 720 + 24 + 4 + 20,
+	.vdisplay	= 1280,
+	.vsync_start	= 1280 + 8,
+	.vsync_end	= 1280 + 8 + 4,
+	.vtotal		= 1280 + 8 + 4 + 8,
+	.clock		= 59904,
+	.flags		= DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+	.width_mm	= 67,
+	.height_mm	= 121,
+};
+
+static const struct hx8394_panel_desc powkiddy_x55_desc = {
+	.mode = &powkiddy_x55_mode,
+	.lanes = 4,
+	.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+		      MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET,
+	.format = MIPI_DSI_FMT_RGB888,
+	.init_sequence = powkiddy_x55_init_sequence,
+};
+
 static int hx8394_enable(struct drm_panel *panel)
 {
 	struct hx8394 *ctx = panel_to_hx8394(panel);
@@ -419,6 +555,7 @@ static void hx8394_remove(struct mipi_dsi_device *dsi)
 
 static const struct of_device_id hx8394_of_match[] = {
 	{ .compatible = "hannstar,hsd060bhw4", .data = &hsd060bhw4_desc },
+	{ .compatible = "powkiddy,x55-panel", .data = &powkiddy_x55_desc },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, hx8394_of_match);
Signature · 1 line
2.34.1
#11 lore raw

PATCH 7/9 clk: rockchip: Mark pclk_usb as critical on rk3568

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

In the reference manual under "2.8.6 NIU Clock gating reliance" it is stated that pclk_usb_niu has a dependency on hclk_usb_niu.

While the manual does not state that this is a bi-directional relationship it was noted that the sdmmc2 failed to operate for me in mmc mode if the pclk_usb was not marked as critical. The parent clock of the hclk_sdmmc2 is hclk_usb.

---
 drivers/clk/rockchip/clk-rk3568.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/rockchip/clk-rk3568.c +1 -0
index a8457b17bc41..0e0b7b396682 100644
@@ -1596,6 +1596,7 @@ static const char *const rk3568_cru_critical_clocks[] __initconst = {
 	"pclk_php",
 	"hclk_usb",
 	"hclk_vo",
+	"pclk_usb",
 };
 
 static const char *const rk3568_pmucru_critical_clocks[] __initconst = {
Signature · 1 line
2.34.1
#12 lore raw

PATCH 8/9 dt-bindings: arm: rockchip: Add Powkiddy X55

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

The Powkiddy RK2023 is a handheld gaming device made by Powkiddy and powered by the Rockchip RK3566 SoC. This device is somewhat similar to the existing Powkiddy RK3566 devices, which have been grouped together with a previous commit[1].

[1] https://lore.kernel.org/linux-rockchip/[email protected]/T/#m4764997cfafaca22fe677200de96caa5fb8f0005

---
 Documentation/devicetree/bindings/arm/rockchip.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/rockchip.yaml +1 -0
index 021a0e95ba62..5e22f247ee6e 100644
@@ -681,6 +681,7 @@ properties:
           - enum:
               - powkiddy,rgb30
               - powkiddy,rk2023
+              - powkiddy,x55
           - const: rockchip,rk3566
 
       - description: Radxa Compute Module 3(CM3)
Signature · 1 line
2.34.1
#14 lore raw

PATCH 9/9 arm64: dts: rockchip: Add Powkiddy X55

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Powkiddy X55. The Powkiddy RK2023 is a handheld gaming device with a 720p 5.5 inch screen powered by the Rockchip RK3566 SoC. It includes a Realtek 8821cs WiFi/BT module, 2 ADC joysticks powered by 4 dedicated ADC channels, and several GPIO face buttons. There are 2 SDMMC slots (sdmmc1 and sdmmc3), and an 8GB internal eMMC.

---
 arch/arm64/boot/dts/rockchip/Makefile         |   1 +
 .../boot/dts/rockchip/rk3566-powkiddy-x55.dts | 926 ++++++++++++++++++
 2 files changed, 927 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3566-powkiddy-x55.dts
arch/arm64/boot/dts/rockchip/Makefile +1 -0
index 9dcb65f76342..a1a06e33a299 100644
@@ -82,6 +82,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pinenote-v1.1.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pinenote-v1.2.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-powkiddy-rgb30.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-powkiddy-rk2023.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-powkiddy-x55.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-a.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-b.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-radxa-cm3-io.dtb
arch/arm64/boot/dts/rockchip/rk3566-powkiddy-x55.dts new file +926 -0

926 lines not on this page · raw message

Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH 6/9] drm/panel: himax-hx8394: Add Support for Powkiddy X55 panel

In reply to Chris Morgan
Quoted 157 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Powkiddy X55 panel as used on the Powkiddy X55 handheld gaming console. This panel uses a Himax HX8394 display controller and requires a vendor provided init sequence. The display resolution is 720x1280 and is 67mm by 121mm as measured with calipers.

---
  drivers/gpu/drm/panel/panel-himax-hx8394.c | 137 +++++++++++++++++++++

  1 file changed, 137 insertions(+)
drivers/gpu/drm/panel/panel-himax-hx8394.c +123 -0
index b68ea09f4725..4807ab1c10fe 100644
@@ -38,6 +38,7 @@
   #define HX8394_CMD_SETMIPI      0xba
   #define HX8394_CMD_SETOTP      0xbb
   #define HX8394_CMD_SETREGBANK      0xbd
+#define HX8394_CMD_UNKNOWN5      0xbf
   #define HX8394_CMD_UNKNOWN1      0xc0
   #define HX8394_CMD_SETDGCLUT      0xc1
   #define HX8394_CMD_SETID      0xc3
@@ -52,6 +53,7 @@
   #define HX8394_CMD_SETGIP1      0xd5
   #define HX8394_CMD_SETGIP2      0xd6
   #define HX8394_CMD_SETGPO      0xd6
+#define HX8394_CMD_UNKNOWN4      0xd8
   #define HX8394_CMD_SETSCALING      0xdd
   #define HX8394_CMD_SETIDLE      0xdf
   #define HX8394_CMD_SETGAMMA      0xe0
@@ -203,6 +205,140 @@ static const struct hx8394_panel_desc hsd060bhw4_desc = {
      .init_sequence = hsd060bhw4_init_sequence,
   };
 
+static int powkiddy_x55_init_sequence(struct hx8394 *ctx)
+{
+    struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+
+    /* 5.19.8 SETEXTC: Set extension command (B9h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETEXTC,
+                   0xff, 0x83, 0x94);
+
+    /* 5.19.9 SETMIPI: Set MIPI control (BAh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETMIPI,
+                   0x63, 0x03, 0x68, 0x6b, 0xb2, 0xc0);
+
+    /* 5.19.2 SETPOWER: Set power (B1h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER,
+                   0x48, 0x12, 0x72, 0x09, 0x32, 0x54, 0x71, 0x71, 0x57, 0x47);
+
+    /* 5.19.3 SETDISP: Set display related register (B2h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETDISP,
+                   0x00, 0x80, 0x64, 0x0c, 0x0d, 0x2f);
+
+    /* 5.19.4 SETCYC: Set display waveform cycles (B4h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCYC,
+                   0x73, 0x74, 0x73, 0x74, 0x73, 0x74, 0x01, 0x0c, 0x86, 0x75,
+                   0x00, 0x3f, 0x73, 0x74, 0x73, 0x74, 0x73, 0x74, 0x01, 0x0c,
+                   0x86);
+
+    /* 5.19.5 SETVCOM: Set VCOM voltage (B6h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETVCOM,
+                   0x6e, 0x6e);
+
+    /* 5.19.19 SETGIP0: Set GIP Option0 (D3h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP0,
+                   0x00, 0x00, 0x07, 0x07, 0x40, 0x07, 0x0c, 0x00, 0x08, 0x10,
+                   0x08, 0x00, 0x08, 0x54, 0x15, 0x0a, 0x05, 0x0a, 0x02, 0x15,
+                   0x06, 0x05, 0x06, 0x47, 0x44, 0x0a, 0x0a, 0x4b, 0x10, 0x07,
+                   0x07, 0x0c, 0x40);
+
+    /* 5.19.20 Set GIP Option1 (D5h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP1,
+                   0x1c, 0x1c, 0x1d, 0x1d, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+                   0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x24, 0x25, 0x18, 0x18,
+                   0x26, 0x27, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+                   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x20, 0x21,
+                   0x18, 0x18, 0x18, 0x18);
+
+    /* 5.19.21 Set GIP Option2 (D6h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP2,
+                   0x1c, 0x1c, 0x1d, 0x1d, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02,
+                   0x01, 0x00, 0x0b, 0x0a, 0x09, 0x08, 0x21, 0x20, 0x18, 0x18,
+                   0x27, 0x26, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+                   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x25, 0x24,
+                   0x18, 0x18, 0x18, 0x18);
+
+    /* 5.19.25 SETGAMMA: Set gamma curve related setting (E0h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGAMMA,
+                   0x00, 0x0a, 0x15, 0x1b, 0x1e, 0x21, 0x24, 0x22, 0x47, 0x56,
+                   0x65, 0x66, 0x6e, 0x82, 0x88, 0x8b, 0x9a, 0x9d, 0x98, 0xa8,
+                   0xb9, 0x5d, 0x5c, 0x61, 0x66, 0x6a, 0x6f, 0x7f, 0x7f, 0x00,
+                   0x0a, 0x15, 0x1b, 0x1e, 0x21, 0x24, 0x22, 0x47, 0x56, 0x65,
+                   0x65, 0x6e, 0x81, 0x87, 0x8b, 0x98, 0x9d, 0x99, 0xa8, 0xba,
+                   0x5d, 0x5d, 0x62, 0x67, 0x6b, 0x72, 0x7f, 0x7f);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN1,
+                   0x1f, 0x31);
+
+    /* 5.19.17 SETPANEL (CCh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPANEL,
+                   0x0b);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3,
+                   0x02);
+
+    /* 5.19.11 Set register bank (BDh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+                   0x02);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN4,
+                   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+                   0xff, 0xff);
+
+    /* 5.19.11 Set register bank (BDh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+                   0x00);
+
+    /* 5.19.11 Set register bank (BDh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+                   0x01);
+
+    /* 5.19.2 SETPOWER: Set power (B1h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER,
+                   0x00);
+
+    /* 5.19.11 Set register bank (BDh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+                   0x00);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN5,
+                   0x40, 0x81, 0x50, 0x00, 0x1a, 0xfc, 0x01);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN2,
+                   0xed);
+
+    return 0;
+}
+
+static const struct drm_display_mode powkiddy_x55_mode = {
+    .hdisplay    = 720,
+    .hsync_start    = 720 + 24,
+    .hsync_end    = 720 + 24 + 4,
+    .htotal        = 720 + 24 + 4 + 20,
+    .vdisplay    = 1280,
+    .vsync_start    = 1280 + 8,
+    .vsync_end    = 1280 + 8 + 4,
+    .vtotal        = 1280 + 8 + 4 + 8,
+    .clock        = 59904,
+    .flags        = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = { · line 338

Quoted 10 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +9 -0
+    .width_mm    = 67,
+    .height_mm    = 121,
+};
+
+static const struct hx8394_panel_desc powkiddy_x55_desc = {
+    .mode = &powkiddy_x55_mode,
+    .lanes = 4,
+    .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
 
+                     MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET,

It looks like a mode flag is set twice. The line above should be this below:

                         MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,

Quoted 23 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +4 -0
+    .format = MIPI_DSI_FMT_RGB888,
+    .init_sequence = powkiddy_x55_init_sequence,
+};
+
   static int hx8394_enable(struct drm_panel *panel)
   {

     struct hx8394 *ctx = panel_to_hx8394(panel);

drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -1
@@ -419,6 +555,7 @@ static void hx8394_remove(struct mipi_dsi_device *dsi)
 
   static const struct of_device_id hx8394_of_match[] = {
      { .compatible = "hannstar,hsd060bhw4", .data = &hsd060bhw4_desc },
+    { .compatible = "powkiddy,x55-panel", .data = &powkiddy_x55_desc },
      { /* sentinel */ }
   };
   MODULE_DEVICE_TABLE(of, hx8394_of_match);
--

2.34.1

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Acked-by on v1 8/9
#13 lore raw

Re: [PATCH 8/9] dt-bindings: arm: rockchip: Add Powkiddy X55

In reply to Chris Morgan
Quoted 7 lines · Chris Morgan

From: Chris Morgan <[email protected]>

The Powkiddy RK2023 is a handheld gaming device made by Powkiddy and powered by the Rockchip RK3566 SoC. This device is somewhat similar to the existing Powkiddy RK3566 devices, which have been grouped together with a previous commit[1].

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH 6/9] drm/panel: himax-hx8394: Add Support for Powkiddy X55 panel

In reply to Kendrick Curry
Quoted 189 lines · Kendrick Curry
Quoted 7 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Powkiddy X55 panel as used on the Powkiddy X55 handheld gaming console. This panel uses a Himax HX8394 display controller and requires a vendor provided init sequence. The display resolution is 720x1280 and is 67mm by 121mm as measured with calipers.

Review

Quoted 6 lines

---
  drivers/gpu/drm/panel/panel-himax-hx8394.c | 137 +++++++++++++++++++++

  1 file changed, 137 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/panel/panel-himax-hx8394.c

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc

Quoted 20 lines

index b68ea09f4725..4807ab1c10fe 100644

drivers/gpu/drm/panel/panel-himax-hx8394.c +2 -0
@@ -38,6 +38,7 @@
   #define HX8394_CMD_SETMIPI      0xba
   #define HX8394_CMD_SETOTP      0xbb
   #define HX8394_CMD_SETREGBANK      0xbd
+#define HX8394_CMD_UNKNOWN5      0xbf
   #define HX8394_CMD_UNKNOWN1      0xc0
   #define HX8394_CMD_SETDGCLUT      0xc1
   #define HX8394_CMD_SETID      0xc3
@@ -52,6 +53,7 @@
   #define HX8394_CMD_SETGIP1      0xd5
   #define HX8394_CMD_SETGIP2      0xd6
   #define HX8394_CMD_SETGPO      0xd6
+#define HX8394_CMD_UNKNOWN4      0xd8
   #define HX8394_CMD_SETSCALING      0xdd
   #define HX8394_CMD_SETIDLE      0xdf
   #define HX8394_CMD_SETGAMMA      0xe0
@@ -203,6 +205,140 @@ static const struct hx8394_panel_desc

hsd060bhw4_desc = {

Quoted 8 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +5 -0
      .init_sequence = hsd060bhw4_init_sequence,
   };
 
+static int powkiddy_x55_init_sequence(struct hx8394 *ctx)
+{
+    struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+
+    /* 5.19.8 SETEXTC: Set extension command (B9h) */

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = {

Quoted 10 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +10 -0
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETEXTC,
+                   0xff, 0x83, 0x94);
+
+    /* 5.19.9 SETMIPI: Set MIPI control (BAh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETMIPI,
+                   0x63, 0x03, 0x68, 0x6b, 0xb2, 0xc0);
+
+    /* 5.19.2 SETPOWER: Set power (B1h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER,
+                   0x48, 0x12, 0x72, 0x09, 0x32, 0x54, 0x71, 0x71, 0x57,

0x47);

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = {

Quoted 8 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +8 -0
+
+    /* 5.19.3 SETDISP: Set display related register (B2h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETDISP,
+                   0x00, 0x80, 0x64, 0x0c, 0x0d, 0x2f);
+
+    /* 5.19.4 SETCYC: Set display waveform cycles (B4h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCYC,
+                   0x73, 0x74, 0x73, 0x74, 0x73, 0x74, 0x01, 0x0c, 0x86,

0x75,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 231

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x00, 0x3f, 0x73, 0x74, 0x73, 0x74, 0x73, 0x74, 0x01,

0x0c,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = {

Quoted 9 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +9 -0
+                   0x86);
+
+    /* 5.19.5 SETVCOM: Set VCOM voltage (B6h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETVCOM,
+                   0x6e, 0x6e);
+
+    /* 5.19.19 SETGIP0: Set GIP Option0 (D3h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP0,
+                   0x00, 0x00, 0x07, 0x07, 0x40, 0x07, 0x0c, 0x00, 0x08,

0x10,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 241

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x08, 0x00, 0x08, 0x54, 0x15, 0x0a, 0x05, 0x0a, 0x02,

0x15,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 242

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x06, 0x05, 0x06, 0x47, 0x44, 0x0a, 0x0a, 0x4b, 0x10,

0x07,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = {

Quoted 5 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +5 -0
+                   0x07, 0x0c, 0x40);
+
+    /* 5.19.20 Set GIP Option1 (D5h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP1,
+                   0x1c, 0x1c, 0x1d, 0x1d, 0x00, 0x01, 0x02, 0x03, 0x04,

0x05,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 248

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x24, 0x25, 0x18,

0x18,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 249

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x26, 0x27, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,

0x18,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 250

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x20,

0x21,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = {

Quoted 5 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +5 -0
+                   0x18, 0x18, 0x18, 0x18);
+
+    /* 5.19.21 Set GIP Option2 (D6h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP2,
+                   0x1c, 0x1c, 0x1d, 0x1d, 0x07, 0x06, 0x05, 0x04, 0x03,

0x02,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 256

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x01, 0x00, 0x0b, 0x0a, 0x09, 0x08, 0x21, 0x20, 0x18,

0x18,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 257

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x27, 0x26, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,

0x18,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 258

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x25,

0x24,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = {

Quoted 5 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +5 -0
+                   0x18, 0x18, 0x18, 0x18);
+
+    /* 5.19.25 SETGAMMA: Set gamma curve related setting (E0h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGAMMA,
+                   0x00, 0x0a, 0x15, 0x1b, 0x1e, 0x21, 0x24, 0x22, 0x47,

0x56,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 264

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x65, 0x66, 0x6e, 0x82, 0x88, 0x8b, 0x9a, 0x9d, 0x98,

0xa8,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 265

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0xb9, 0x5d, 0x5c, 0x61, 0x66, 0x6a, 0x6f, 0x7f, 0x7f,

0x00,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 266

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x0a, 0x15, 0x1b, 0x1e, 0x21, 0x24, 0x22, 0x47, 0x56,

0x65,

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc · line 267

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                   0x65, 0x6e, 0x81, 0x87, 0x8b, 0x98, 0x9d, 0x99, 0xa8,

0xba,

Quoted 11 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +11 -0
+                   0x5d, 0x5d, 0x62, 0x67, 0x6b, 0x72, 0x7f, 0x7f);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN1,
+                   0x1f, 0x31);
+
+    /* 5.19.17 SETPANEL (CCh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPANEL,
+                   0x0b);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = {

Quoted 10 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +10 -0
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3,
+                   0x02);
+
+    /* 5.19.11 Set register bank (BDh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+                   0x02);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN4,
+                   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,

0xff,

Quoted 48 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +48 -0
+                   0xff, 0xff);
+
+    /* 5.19.11 Set register bank (BDh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+                   0x00);
+
+    /* 5.19.11 Set register bank (BDh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+                   0x01);
+
+    /* 5.19.2 SETPOWER: Set power (B1h) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER,
+                   0x00);
+
+    /* 5.19.11 Set register bank (BDh) */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
+                   0x00);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN5,
+                   0x40, 0x81, 0x50, 0x00, 0x1a, 0xfc, 0x01);
+
+    /* Unknown command, not listed in the HX8394-F datasheet */
+    mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN2,
+                   0xed);
+
+    return 0;
+}
+
+static const struct drm_display_mode powkiddy_x55_mode = {
+    .hdisplay    = 720,
+    .hsync_start    = 720 + 24,
+    .hsync_end    = 720 + 24 + 4,
+    .htotal        = 720 + 24 + 4 + 20,
+    .vdisplay    = 1280,
+    .vsync_start    = 1280 + 8,
+    .vsync_end    = 1280 + 8 + 4,
+    .vtotal        = 1280 + 8 + 4 + 8,
+    .clock        = 59904,
+    .flags        = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+    .width_mm    = 67,
+    .height_mm    = 121,
+};
+
+static const struct hx8394_panel_desc powkiddy_x55_desc = {
+    .mode = &powkiddy_x55_mode,
+    .lanes = 4,
+    .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
Quoted 6 lines

drivers/gpu/drm/panel/panel-himax-hx8394.c static const struct hx8394_panel_desc hsd060bhw4_desc = { · line 337

Quoted 1 line
drivers/gpu/drm/panel/panel-himax-hx8394.c +1 -0
+                     MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET,

It looks like a mode flag is set twice. The line above should be this below:

                         MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,

Thank you, you are correct. I've since fixed this and it caused the image on the panel to shift slightly, so I've had to adjust the timings somewhat. I'll fix this with the V2 (I'll also have to add a new clock frequency for the PLL_VPLL so we can run this panel at 60hz).

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/panel/panel-himax-hx8394.c +5 -1
+    .format = MIPI_DSI_FMT_RGB888,
+    .init_sequence = powkiddy_x55_init_sequence,
+};
+
   static int hx8394_enable(struct drm_panel *panel)
   {
      struct hx8394 *ctx = panel_to_hx8394(panel);
@@ -419,6 +555,7 @@ static void hx8394_remove(struct mipi_dsi_device *dsi)
 
   static const struct of_device_id hx8394_of_match[] = {
      { .compatible = "hannstar,hsd060bhw4", .data = &hsd060bhw4_desc },
+    { .compatible = "powkiddy,x55-panel", .data = &powkiddy_x55_desc },
      { /* sentinel */ }
   };
   MODULE_DEVICE_TABLE(of, hx8394_of_match);
--

2.34.1

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip