drm/panel: st7701: add the Miyoo A30 panel
Subsystems (5)
cover drm/panel: st7701: add the Miyoo A30 panel
The Miyoo A30 is an Allwinner A33 handheld with a 480x640 2-lane MIPI-DSI panel driven by a Sitronix ST7701S.
Its stock init table doesn't fit the encoding st7701_init_sequence() derives from the panel descriptor, and the panel doesn't work in the burst mode the driver always uses. Patch 3 adds two optional descriptor fields for that, a complete init sequence and the DSI mode flags; the existing panels set neither and are unchanged. Patch 4 adds the panel, patch 2 its compatible.
Patch 1 does for sitronix,st7701 what commit 2f50e0a0f9d3 ("dt-bindings: display: panel: Make DSI panels port optional") did for the other DSI panel bindings: the port becomes optional, and stays required for the panel with an RGB input set up over SPI. The Allwinner sun6i DSI host links its panel as a child node and has no output port.
The board devicetree will be sent to the sunxi tree separately.
Testing: each patch built with W=1 for arm (multi_v7_defconfig, DRM_PANEL_SITRONIX_ST7701=y and =m) and arm64 (defconfig, =m), no warnings; dt_binding_check clean for sitronix,st7701.yaml. Tested on a Miyoo A30 on 6.18.54 and again on 7.3.1 with the same driver change (A33 sun6i DSI): the panel comes up with a stable picture and correct colours. The other
panels of the driver were not tested on hardware.
checkpatch --strict reports "Alignment should match open parenthesis" for the continuation lines of the init table: they follow the style of the existing tables in the driver (46 such checks in the current file).
Tool disclosure: this series was prepared with Claude Opus 5.5 (Anthropic) as a coding assistant, in an interactive session: it extracted the stock init table, wrote the code, the split and the messages. I reviewed and understand it, and tested it as described.
Romain TISSERAND (4):
dt-bindings: display: panel: sitronix,st7701: make the port optional
for DSI
dt-bindings: display: panel: sitronix,st7701: add the Miyoo A30 panel drm/panel: st7701: let a panel provide its own init sequence and DSI
flags
drm/panel: st7701: add the Miyoo A30 panel
.../display/panel/sitronix,st7701.yaml | 13 +- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 115 +++++++++++++++++- 2 files changed, 122 insertions(+), 6 deletions(-)
base-commit: 53063c88338aa6125d43a7ce3ff1e0cf5066bad1
Signature · 1 line
2.43.0
PATCH 1/4 dt-bindings: display: panel: sitronix,st7701: make the port optional for DSI
A MIPI-DSI panel is a child node of its DSI host and the driver does not use a graph port for it. Commit 2f50e0a0f9d3 ("dt-bindings: display:
panel: Make DSI panels port optional") made the port optional in the DSI panel bindings for that reason. sitronix,st7701 was not part of it, as the binding also covers panels with an RGB input set up over SPI, which do need the port to the display controller output.
Make the port optional, and keep it required for the SPI-controlled RGB panel (anbernic,rg28xx-panel) only, as that commit does for ilitek,ili9806e.
The Allwinner sun6i-a31-mipi-dsi host links its panel through the child node and has no output port, so the Miyoo A30 panel added next needs this.
--- .../bindings/display/panel/sitronix,st7701.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml +10 -1
@@ -54,7 +54,6 @@ required: - reg - VCC-supply - IOVCC-supply - - port - reset-gpios allOf:
@@ -69,6 +68,16 @@ allOf: then: $ref: /schemas/spi/spi-peripheral-props.yaml# + - if: + properties: + compatible: + contains: + # RGB input, controlled over SPI + const: anbernic,rg28xx-panel + then: + required: + - port + - if: properties: compatible:
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 1/4] dt-bindings: display: panel: sitronix,st7701: make the port optional for DSI
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dt-bindings: display: sitronix,st7701: duplicate if/then for rg28xx-panel --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: display: sitronix,st7701: duplicate if/then for rg28xx-panel
--
commit 8125a9df8a4287a7ea90e2141e5a278695835f1d
Author: Romain TISSERAND <[email protected]>
dt-bindings: display: panel: sitronix,st7701: make the port optional for DSI
This commit removes port from the top-level required list in the sitronix,st7701 binding and makes it required only for the SPI-controlled anbernic,rg28xx-panel.
Quoted 15 lines
Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml +0
-1@@ -54,7 +54,6 @@ required: - reg - VCC-supply - IOVCC-supply - - port - reset-gpios allOf:@@ -69,6 +68,16 @@ allOf: then: $ref: /schemas/spi/spi-peripheral-props.yaml#
Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml allOf: · line 79
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml +9
-0+ - if: + properties: + compatible: + contains: + # RGB input, controlled over SPI + const: anbernic,rg28xx-panel + then: + required: + - port
[Severity: Low]
This isn't a bug, but the block right above under allOf already matches anbernic,rg28xx-panel:
Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml:
- if:
properties:
compatible:
contains:
# SPI connected panels
enum:
- anbernic,rg28xx-panel
then:
$ref: /schemas/spi/spi-peripheral-props.yaml#
Can required: [port] be added to that existing then: clause instead of adding a second if/then block for the same compatible string, matching how 2f50e0a0f9d3 ("dt-bindings: display: panel: Make DSI panels port optional") handled ilitek,ili9806e.yaml?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/4 dt-bindings: display: panel: sitronix,st7701: add the Miyoo A30 panel
In reply to Romain TISSERANDThe Miyoo A30 handheld has a 480x640 2-lane MIPI-DSI panel driven by a Sitronix ST7701S. It is connected over DSI, so it has no D/CX GPIO.
--- .../devicetree/bindings/display/panel/sitronix,st7701.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml +2 -0
@@ -28,6 +28,7 @@ properties: - anbernic,rg28xx-panel - densitron,dmt028vghmcmi-1a - elida,kd50t048a + - miyoo,a30-panel - techstar,ts8550b - winstar,wf40eswaa6mnn0 - const: sitronix,st7701
@@ -89,6 +90,7 @@ allOf: - anbernic,rg28xx-panel - densitron,dmt028vghmcmi-1a - elida,kd50t048a + - miyoo,a30-panel - techstar,ts8550b then: required:
Signature · 1 line
2.43.0
PATCH 3/4 drm/panel: st7701: let a panel provide its own init sequence and DSI flags
In reply to Romain TISSERANDEvery DSI panel handled by the driver gets its init sequence from st7701_init_sequence(), which encodes the Command2 BK0/BK1 settings from the panel timings and descriptor fields, followed by a panel specific GIP sequence. All of them also run in burst video mode.
Some vendor init tables don't fit that encoding, and some panels don't work in burst mode. Add two optional descriptor fields:
- init_sequence: sent instead of the generic sequence and the GIP sequence;
- mode_flags: DSI mode flags to use instead of the default ones.
No change for the existing panels, which set neither.
--- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/panel/panel-sitronix-st7701.c +22 -5
@@ -128,6 +128,16 @@ struct st7701_panel_desc {/* GIP sequence, fully custom and undocumented. */ void (*gip_sequence)(struct st7701 *st7701); + +/* +* Complete vendor init sequence, sent instead of the generic one and +* the GIP sequence, for panels whose vendor table does not fit the +* generic encoding. +*/ +void (*init_sequence)(struct st7701 *st7701); + +/* DSI mode flags, when the default burst mode does not suit the panel */ +unsigned long mode_flags; };struct st7701 {
@@ -559,10 +569,14 @@ static int st7701_prepare(struct drm_panel *panel)gpiod_set_value (st7701->reset,1 );msleep (150 ); -st7701_init_sequence (st7701); +if (st7701->desc->init_sequence) { + st7701->desc->init_sequence (st7701); + }else { +st7701_init_sequence (st7701); -if (st7701->desc->gip_sequence) - st7701->desc->gip_sequence (st7701); +if (st7701->desc->gip_sequence) + st7701->desc->gip_sequence (st7701); + }/* Disable Command2 */ st7701_switch_cmd_bkx (st7701, false,0 );
@@ -1343,8 +1357,11 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)if (!st7701->desc->lanes)return dev_err_probe (&dsi->dev, -EINVAL ,"This panel is not for MIPI DSI\n" ); - dsi->mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_VIDEO_BURST | -MIPI_DSI_MODE_LPM |MIPI_DSI_CLOCK_NON_CONTINUOUS ; +if (st7701->desc->mode_flags) + dsi->mode_flags = st7701->desc->mode_flags; +else + dsi->mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_VIDEO_BURST | +MIPI_DSI_MODE_LPM |MIPI_DSI_CLOCK_NON_CONTINUOUS ; dsi->format = st7701->desc->format; dsi->lanes = st7701->desc->lanes;
Signature · 1 line
2.43.0
PATCH 4/4 drm/panel: st7701: add the Miyoo A30 panel
In reply to Romain TISSERANDThe Miyoo A30 handheld (Allwinner A33) has a 480x640 2-lane MIPI-DSI panel driven by a Sitronix ST7701S.
Its init table, taken from the stock kernel, doesn't fit the encoding of st7701_init_sequence(): byte 0 of C2 (INVSEL) lacks the 0x30 bits and RTNI is not derived from htotal. Send it as-is through the new init_sequence hook.
The stock configuration runs the panel in non-burst video mode with sync pulses and without EoT packets; in burst mode the picture is unstable and the colours are wrong.
Timings and size are from the stock configuration: 23 MHz pixel clock, htotal 560, vtotal 684, 43x57 mm.
--- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+)
drivers/gpu/drm/panel/panel-sitronix-st7701.c +88 -0
@@ -421,6 +421,64 @@ static void dmt028vghmcmi_1a_gip_sequence(struct st7701 *st7701)ST7701_WRITE (st7701,0x3A ,0x70 ); } +static void miyoo_a30_init_sequence (struct st7701 *st7701) +{ +/* Vendor table, from the Miyoo A30 stock kernel (default_panel). */ +msleep (200 ); + +st7701_switch_cmd_bkx (st7701, true,3 ); +ST7701_WRITE (st7701,0xEF ,0x08 ); + +st7701_switch_cmd_bkx (st7701, true,0 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK0_LNESET ,0x4F ,0x00 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK0_PORCTRL ,0x10 ,0x0C ); +ST7701_WRITE (st7701,ST7701_CMD2_BK0_INVSEL ,0x01 ,0x14 ); +ST7701_WRITE (st7701,0xCC ,0x10 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK0_PVGAMCTRL , +0x0A ,0x18 ,0x1E ,0x12 ,0x16 ,0x0C ,0x0E ,0x0D , +0x0C ,0x29 ,0x06 ,0x14 ,0x13 ,0x29 ,0x33 ,0x1C ); +ST7701_WRITE (st7701,ST7701_CMD2_BK0_NVGAMCTRL , +0x0A ,0x19 ,0x21 ,0x0A ,0x0C ,0x00 ,0x0C ,0x03 , +0x03 ,0x23 ,0x01 ,0x0E ,0x0C ,0x27 ,0x2B ,0x1C ); + +st7701_switch_cmd_bkx (st7701, true,1 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_VRHS ,0x5D ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_VCOM ,0x71 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_VGHSS ,0x8A ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_TESTCMD ,0x80 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_VGLS ,0x4D ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_PWCTLR1 ,0x85 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_PWCTLR2 ,0x20 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_SPD1 ,0x78 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_SPD2 ,0x78 ); +ST7701_WRITE (st7701,ST7701_CMD2_BK1_MIPISET1 ,0x88 ); + +ST7701_WRITE (st7701,0xE0 ,0x00 ,0x00 ,0x02 ); +ST7701_WRITE (st7701,0xE1 ,0x06 ,0xA0 ,0x08 ,0xA0 ,0x05 ,0xA0 ,0x07 , +0xA0 ,0x00 ,0x44 ,0x44 ); +ST7701_WRITE (st7701,0xE2 ,0x20 ,0x20 ,0x44 ,0x44 ,0x96 ,0xA0 ,0x00 , +0x00 ,0x96 ,0xA0 ,0x00 ,0x00 ); +ST7701_WRITE (st7701,0xE3 ,0x00 ,0x00 ,0x22 ,0x22 ); +ST7701_WRITE (st7701,0xE4 ,0x44 ,0x44 ); +ST7701_WRITE (st7701,0xE5 ,0x0D ,0x91 ,0x0A ,0xA0 ,0x0F ,0x93 ,0x0A , +0xA0 ,0x09 ,0x8D ,0x0A ,0xA0 ,0x0B ,0x8F ,0x0A ,0xA0 ); +ST7701_WRITE (st7701,0xE6 ,0x00 ,0x00 ,0x22 ,0x22 ); +ST7701_WRITE (st7701,0xE7 ,0x44 ,0x44 ); +ST7701_WRITE (st7701,0xE8 ,0x0C ,0x90 ,0x0A ,0xA0 ,0x0E ,0x92 ,0x0A , +0xA0 ,0x08 ,0x8C ,0x0A ,0xA0 ,0x0A ,0x8E ,0x0A ,0xA0 ); +ST7701_WRITE (st7701,0xE9 ,0x36 ,0x00 ); +ST7701_WRITE (st7701,0xEB ,0x00 ,0x01 ,0xE4 ,0xE4 ,0x44 ,0x88 ,0x40 ); +ST7701_WRITE (st7701,0xED ,0xFF ,0x45 ,0x67 ,0xFA ,0x01 ,0x2B ,0xCF , +0xFF ,0xFF ,0xFC ,0xB2 ,0x10 ,0xAF ,0x76 ,0x54 ,0xFF ); +ST7701_WRITE (st7701,0xEF ,0x10 ,0x0D ,0x04 ,0x08 ,0x3F ,0x1F ); + +ST7701_WRITE (st7701,MIPI_DCS_EXIT_SLEEP_MODE ); +msleep (200 ); + +ST7701_WRITE (st7701,MIPI_DCS_SET_TEAR_ON ,0x00 ); +ST7701_WRITE (st7701,MIPI_DCS_SET_PIXEL_FORMAT ,0x77 ); +} +static void kd50t048a_gip_sequence (struct st7701 *st7701) {/**
@@ -874,6 +932,35 @@ static const struct st7701_panel_desc dmt028vghmcmi_1a_desc = { .gip_sequence = dmt028vghmcmi_1a_gip_sequence, }; +static const struct drm_display_mode miyoo_a30_mode = { + .clock =23000 , + + .hdisplay =480 , + .hsync_start =480 +48 , + .hsync_end =480 +48 +10 , + .htotal =480 +48 +10 +22 , + + .vdisplay =640 , + .vsync_start =640 +26 , + .vsync_end =640 +26 +4 , + .vtotal =640 +26 +4 +14 , + + .width_mm =43 , + .height_mm =57 , + + .type =DRM_MODE_TYPE_DRIVER |DRM_MODE_TYPE_PREFERRED , +}; + +static const struct st7701_panel_desc miyoo_a30_desc = { + .mode = &miyoo_a30_mode, + .lanes =2 , + .format =MIPI_DSI_FMT_RGB888 , + .init_sequence = miyoo_a30_init_sequence, +/* stock sys_config: lcd_dsi_if = 0 (non-burst video), lcd_dsi_eotp = 0 */ + .mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_VIDEO_SYNC_PULSE | +MIPI_DSI_MODE_LPM |MIPI_DSI_MODE_NO_EOT_PACKET , +}; +static const struct drm_display_mode kd50t048a_mode = { .clock =27500 ,
@@ -1401,6 +1488,7 @@ static const struct of_device_id st7701_dsi_of_match[] = { { .compatible = "anbernic,rg-arc-panel", .data = &rg_arc_desc }, { .compatible = "densitron,dmt028vghmcmi-1a", .data = &dmt028vghmcmi_1a_desc }, { .compatible = "elida,kd50t048a", .data = &kd50t048a_desc }, + { .compatible = "miyoo,a30-panel", .data = &miyoo_a30_desc }, { .compatible = "techstar,ts8550b", .data = &ts8550b_desc }, { .compatible = "winstar,wf40eswaa6mnn0", .data = &wf40eswaa6mnn0_desc }, { }
Signature · 1 line
2.43.0