2020-07-01 10:34:00

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v6 00/13] Add support for PinePhone LCD panel

This patchset adds support for the LCD panel of PinePhone.

I've tested this on PinePhone 1.0 and 1.2.

Please take a look.

thank you and regards,
Ondrej Jirman

Changes in v6:
- Fixed spacing in yaml
- Fixed wrong vccio->iovcc supply name in the bindings doc
- I noticed that the original driver uses a delay of 20ms in the init
function to achieve a combined total of 120ms required from post-reset
to display_on. I've added a similar delay to xbd599_init, so that
xbd599 panel also has the right timing. (patch 9)
- v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
- Added review/ack tags
- Learned to run dt_binding_check by myself ;)

Changes in v5:
- rewritten on top of rocktech-jh057n00900 driver
- rocktech-jh057n00900 renamed to st7703 (controller name)
- converted rocktech-jh057n00900 bindings to yaml and extended for xbd599

Changes in v4:
- use ->type from the mode instead of hardcoding (Samuel)
- move init_sequence to ->prepare (Samuel)
- move anti-flicker delay to ->enable, explain it (Samuel)
- add enter_sleep after display_off (Samuel)
- drop ->disable (move code to ->unprepare)
- add ID bytes dumping (Linus)
(I can't test it since allwinner DSI driver has a broken
dcs_read function, and I didn't manage to fix it.)
- document magic bytes (Linus)
- assert reset during powerup
- cleanup powerup timings according to the datasheet

Changes in v3:
- Panel driver renamed to the name of the LCD controller
- Re-organize the driver slightly to more easily support more panels
based on the same controller.
- Add patch to enable the touchscreen to complete the LCD support
on PinePhone.
- Dropped the "DSI fix" patch (the driver seems to work for me without it)
- Improved brightness levels handling:
- PinePhone 1.0 uses default levels generated by the driver
- On PinePhone 1.1 duty cycles < 20% lead to black screen, so
default levels can't be used. Martijn Braam came up with a
list of duty cycle values that lead to perception of linear
brigtness level <-> light intensity on PinePhone 1.1
- There was some feedback on v2 about this being similar to st7701.
It's only similar in name. Most of the "user commands" are different,
so I opted to keep this in a new driver instead of creating st770x.

Anyone who likes to check the differences, here are datasheets:

- https://megous.com/dl/tmp/ST7703_DS_v01_20160128.pdf
- https://megous.com/dl/tmp/ST7701.pdf

Changes in v2:
- DT Example fix.
- DT Format fix.
- Raised copyright info to 2020.
- Sort panel operation functions.
- Sort inclusion.


-- For phone owners: --

There's an open question on how to set the backlight brightness values
on post 1.0 revision phone, since lower duty cycles (< 10-20%) lead
to backlight being black. It would be nice if more people can test
the various backlight levels on 1.1 and 1.2 revision with this change
in dts:

brightness-levels = <0 1000>;
num-interpolated-steps = <1000>;

and report at what brightness level the backlight turns on. So far it
seems this has a wide range. Lowest useable duty cycle for me is ~7%
on 1.2 and for Martijn ~20% on 1.1.

Icenowy Zheng (2):
dt-bindings: vendor-prefixes: Add Xingbangda
arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone

Ondrej Jirman (11):
dt-bindings: panel: Convert rocktech,jh057n00900 to yaml
dt-bindings: panel: Add compatible for Xingbangda XBD599 panel
drm/panel: rocktech-jh057n00900: Rename the driver to st7703
drm/panel: st7703: Rename functions from jh057n prefix to st7703
drm/panel: st7703: Prepare for supporting multiple panels
drm/panel: st7703: Move code specific to jh057n closer together
drm/panel: st7703: Move generic part of init sequence to enable
callback
drm/panel: st7703: Add support for Xingbangda XBD599
drm/panel: st7703: Enter sleep after display off
drm/panel: st7703: Assert reset prior to powering down the regulators
arm64: dts: sun50i-a64-pinephone: Add touchscreen support

.../display/panel/rocktech,jh057n00900.txt | 23 -
.../display/panel/rocktech,jh057n00900.yaml | 70 ++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
.../allwinner/sun50i-a64-pinephone-1.1.dts | 19 +
.../dts/allwinner/sun50i-a64-pinephone.dtsi | 54 ++
drivers/gpu/drm/panel/Kconfig | 26 +-
drivers/gpu/drm/panel/Makefile | 2 +-
.../drm/panel/panel-rocktech-jh057n00900.c | 424 -----------
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 656 ++++++++++++++++++
9 files changed, 815 insertions(+), 461 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
delete mode 100644 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
create mode 100644 drivers/gpu/drm/panel/panel-sitronix-st7703.c

--
2.27.0


2020-07-01 10:34:01

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v6 02/13] dt-bindings: panel: Convert rocktech,jh057n00900 to yaml

Convert Rocktech MIPI DSI panel driver from txt to yaml bindings.

Signed-off-by: Ondrej Jirman <[email protected]>
---
.../display/panel/rocktech,jh057n00900.txt | 23 -------
.../display/panel/rocktech,jh057n00900.yaml | 66 +++++++++++++++++++
2 files changed, 66 insertions(+), 23 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml

diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
deleted file mode 100644
index a372c5d84695..000000000000
--- a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Rocktech jh057n00900 5.5" 720x1440 TFT LCD panel
-
-Required properties:
-- compatible: should be "rocktech,jh057n00900"
-- reg: DSI virtual channel of the peripheral
-- reset-gpios: panel reset gpio
-- backlight: phandle of the backlight device attached to the panel
-- vcc-supply: phandle of the regulator that provides the vcc supply voltage.
-- iovcc-supply: phandle of the regulator that provides the iovcc supply
- voltage.
-
-Example:
-
- &mipi_dsi {
- panel@0 {
- compatible = "rocktech,jh057n00900";
- reg = <0>;
- backlight = <&backlight>;
- reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
- vcc-supply = <&reg_2v8_p>;
- iovcc-supply = <&reg_1v8_p>;
- };
- };
diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
new file mode 100644
index 000000000000..928ba42e7f8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/rocktech,jh057n00900.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rocktech JH057N00900 5.5" 720x1440 TFT LCD panel
+
+maintainers:
+ - Ondrej Jirman <[email protected]>
+
+description: |
+ Rocktech JH057N00900 is a 720x1440 TFT LCD panel
+ connected using a MIPI-DSI video interface.
+
+allOf:
+ - $ref: panel-common.yaml#
+
+properties:
+ compatible:
+ const: rocktech,jh057n00900
+
+ reg:
+ maxItems: 1
+ description: DSI virtual channel
+
+ vcc-supply:
+ description: Panel power supply
+
+ iovcc-supply:
+ description: I/O voltage supply
+
+ reset-gpios:
+ description: GPIO used for the reset pin
+ maxItems: 1
+
+ backlight:
+ description: Backlight used by the panel
+ $ref: "/schemas/types.yaml#/definitions/phandle"
+
+required:
+ - compatible
+ - reg
+ - vcc-supply
+ - iovcc-supply
+ - reset-gpios
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ dsi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ panel@0 {
+ compatible = "rocktech,jh057n00900";
+ reg = <0>;
+ vcc-supply = <&reg_2v8_p>;
+ iovcc-supply = <&reg_1v8_p>;
+ reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
+ backlight = <&backlight>;
+ };
+ };
+...
--
2.27.0

2020-07-01 10:35:16

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v6 09/13] drm/panel: st7703: Add support for Xingbangda XBD599

Xingbangda XBD599 is a 5.99" 720x1440 MIPI-DSI LCD panel used in
PinePhone. Add support for it.

Signed-off-by: Icenowy Zheng <[email protected]>
Signed-off-by: Ondrej Jirman <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
---
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 200 +++++++++++++++++-
1 file changed, 198 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index cdbf7dfb4dd4..5cd5503f894f 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -39,10 +39,11 @@
#define ST7703_CMD_SETEXTC 0xB9
#define ST7703_CMD_SETMIPI 0xBA
#define ST7703_CMD_SETVDC 0xBC
-#define ST7703_CMD_UNKNOWN0 0xBF
+#define ST7703_CMD_UNKNOWN_BF 0xBF
#define ST7703_CMD_SETSCR 0xC0
#define ST7703_CMD_SETPOWER 0xC1
#define ST7703_CMD_SETPANEL 0xCC
+#define ST7703_CMD_UNKNOWN_C6 0xC6
#define ST7703_CMD_SETGAMMA 0xE0
#define ST7703_CMD_SETEQ 0xE3
#define ST7703_CMD_SETGIP1 0xE9
@@ -109,7 +110,7 @@ static int jh057n_init_sequence(struct st7703 *ctx)
msleep(20);

dsi_generic_write_seq(dsi, ST7703_CMD_SETVCOM, 0x3F, 0x3F);
- dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN0, 0x02, 0x11, 0x00);
+ dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00);
dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP1,
0x82, 0x10, 0x06, 0x05, 0x9E, 0x0A, 0xA5, 0x12,
0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38,
@@ -163,6 +164,200 @@ struct st7703_panel_desc jh057n00900_panel_desc = {
.init_sequence = jh057n_init_sequence,
};

+#define dsi_dcs_write_seq(dsi, cmd, seq...) do { \
+ static const u8 d[] = { seq }; \
+ int ret; \
+ ret = mipi_dsi_dcs_write(dsi, cmd, d, ARRAY_SIZE(d)); \
+ if (ret < 0) \
+ return ret; \
+ } while (0)
+
+
+static int xbd599_init_sequence(struct st7703 *ctx)
+{
+ struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+
+ /*
+ * Init sequence was supplied by the panel vendor.
+ */
+
+ /* Magic sequence to unlock user commands below. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETEXTC, 0xF1, 0x12, 0x83);
+
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETMIPI,
+ 0x33, /* VC_main = 0, Lane_Number = 3 (4 lanes) */
+ 0x81, /* DSI_LDO_SEL = 1.7V, RTERM = 90 Ohm */
+ 0x05, /* IHSRX = x6 (Low High Speed driving ability) */
+ 0xF9, /* TX_CLK_SEL = fDSICLK/16 */
+ 0x0E, /* HFP_OSC (min. HFP number in DSI mode) */
+ 0x0E, /* HBP_OSC (min. HBP number in DSI mode) */
+ /* The rest is undocumented in ST7703 datasheet */
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x44, 0x25, 0x00, 0x91, 0x0a, 0x00, 0x00, 0x02,
+ 0x4F, 0x11, 0x00, 0x00, 0x37);
+
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER_EXT,
+ 0x25, /* PCCS = 2, ECP_DC_DIV = 1/4 HSYNC */
+ 0x22, /* DT = 15ms XDK_ECP = x2 */
+ 0x20, /* PFM_DC_DIV = /1 */
+ 0x03 /* ECP_SYNC_EN = 1, VGX_SYNC_EN = 1 */);
+
+ /* RGB I/F porch timing */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETRGBIF,
+ 0x10, /* VBP_RGB_GEN */
+ 0x10, /* VFP_RGB_GEN */
+ 0x05, /* DE_BP_RGB_GEN */
+ 0x05, /* DE_FP_RGB_GEN */
+ /* The rest is undocumented in ST7703 datasheet */
+ 0x03, 0xFF,
+ 0x00, 0x00,
+ 0x00, 0x00);
+
+ /* Source driving settings. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETSCR,
+ 0x73, /* N_POPON */
+ 0x73, /* N_NOPON */
+ 0x50, /* I_POPON */
+ 0x50, /* I_NOPON */
+ 0x00, /* SCR[31,24] */
+ 0xC0, /* SCR[23,16] */
+ 0x08, /* SCR[15,8] */
+ 0x70, /* SCR[7,0] */
+ 0x00 /* Undocumented */);
+
+ /* NVDDD_SEL = -1.8V, VDDD_SEL = out of range (possibly 1.9V?) */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETVDC, 0x4E);
+
+ /*
+ * SS_PANEL = 1 (reverse scan), GS_PANEL = 0 (normal scan)
+ * REV_PANEL = 1 (normally black panel), BGR_PANEL = 1 (BGR)
+ */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0B);
+
+ /* Zig-Zag Type C column inversion. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETCYC, 0x80);
+
+ /* Set display resolution. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETDISP,
+ 0xF0, /* NL = 240 */
+ 0x12, /* RES_V_LSB = 0, BLK_CON = VSSD,
+ * RESO_SEL = 720RGB
+ */
+ 0xF0 /* WHITE_GND_EN = 1 (GND),
+ * WHITE_FRAME_SEL = 7 frames,
+ * ISC = 0 frames
+ */);
+
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETEQ,
+ 0x00, /* PNOEQ */
+ 0x00, /* NNOEQ */
+ 0x0B, /* PEQGND */
+ 0x0B, /* NEQGND */
+ 0x10, /* PEQVCI */
+ 0x10, /* NEQVCI */
+ 0x00, /* PEQVCI1 */
+ 0x00, /* NEQVCI1 */
+ 0x00, /* reserved */
+ 0x00, /* reserved */
+ 0xFF, /* reserved */
+ 0x00, /* reserved */
+ 0xC0, /* ESD_DET_DATA_WHITE = 1, ESD_WHITE_EN = 1 */
+ 0x10 /* SLPIN_OPTION = 1 (no need vsync after sleep-in)
+ * VEDIO_NO_CHECK_EN = 0
+ * ESD_WHITE_GND_EN = 0
+ * ESD_DET_TIME_SEL = 0 frames
+ */);
+
+ /* Undocumented command. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_C6, 0x01, 0x00, 0xFF, 0xFF, 0x00);
+
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER,
+ 0x74, /* VBTHS, VBTLS: VGH = 17V, VBL = -11V */
+ 0x00, /* FBOFF_VGH = 0, FBOFF_VGL = 0 */
+ 0x32, /* VRP */
+ 0x32, /* VRN */
+ 0x77, /* reserved */
+ 0xF1, /* APS = 1 (small),
+ * VGL_DET_EN = 1, VGH_DET_EN = 1,
+ * VGL_TURBO = 1, VGH_TURBO = 1
+ */
+ 0xFF, /* VGH1_L_DIV, VGL1_L_DIV (1.5MHz) */
+ 0xFF, /* VGH1_R_DIV, VGL1_R_DIV (1.5MHz) */
+ 0xCC, /* VGH2_L_DIV, VGL2_L_DIV (2.6MHz) */
+ 0xCC, /* VGH2_R_DIV, VGL2_R_DIV (2.6MHz) */
+ 0x77, /* VGH3_L_DIV, VGL3_L_DIV (4.5MHz) */
+ 0x77 /* VGH3_R_DIV, VGL3_R_DIV (4.5MHz) */);
+
+ /* Reference voltage. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP,
+ 0x07, /* VREF_SEL = 4.2V */
+ 0x07 /* NVREF_SEL = 4.2V */);
+ msleep(20);
+
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM,
+ 0x2C, /* VCOMDC_F = -0.67V */
+ 0x2C /* VCOMDC_B = -0.67V */);
+
+ /* Undocumented command. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00);
+
+ /* This command is to set forward GIP timing. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP1,
+ 0x82, 0x10, 0x06, 0x05, 0xA2, 0x0A, 0xA5, 0x12,
+ 0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38,
+ 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x75, 0x75, 0x31, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x13, 0x88, 0x64,
+ 0x64, 0x20, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x02, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+
+ /* This command is to set backward GIP timing. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP2,
+ 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x02, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x64, 0x88, 0x13,
+ 0x57, 0x13, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x75, 0x88, 0x23, 0x14, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0A,
+ 0xA5, 0x00, 0x00, 0x00, 0x00);
+
+ /* Adjust the gamma characteristics of the panel. */
+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETGAMMA,
+ 0x00, 0x09, 0x0D, 0x23, 0x27, 0x3C, 0x41, 0x35,
+ 0x07, 0x0D, 0x0E, 0x12, 0x13, 0x10, 0x12, 0x12,
+ 0x18, 0x00, 0x09, 0x0D, 0x23, 0x27, 0x3C, 0x41,
+ 0x35, 0x07, 0x0D, 0x0E, 0x12, 0x13, 0x10, 0x12,
+ 0x12, 0x18);
+
+ return 0;
+}
+
+static const struct drm_display_mode xbd599_mode = {
+ .hdisplay = 720,
+ .hsync_start = 720 + 40,
+ .hsync_end = 720 + 40 + 40,
+ .htotal = 720 + 40 + 40 + 40,
+ .vdisplay = 1440,
+ .vsync_start = 1440 + 18,
+ .vsync_end = 1440 + 18 + 10,
+ .vtotal = 1440 + 18 + 10 + 17,
+ .vrefresh = 60,
+ .clock = 69000,
+ .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+ .width_mm = 68,
+ .height_mm = 136,
+};
+
+static const struct st7703_panel_desc xbd599_desc = {
+ .mode = &xbd599_mode,
+ .lanes = 4,
+ .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
+ .format = MIPI_DSI_FMT_RGB888,
+ .init_sequence = xbd599_init_sequence,
+};
+
static int st7703_enable(struct drm_panel *panel)
{
struct st7703 *ctx = panel_to_st7703(panel);
@@ -428,6 +623,7 @@ static int st7703_remove(struct mipi_dsi_device *dsi)

static const struct of_device_id st7703_of_match[] = {
{ .compatible = "rocktech,jh057n00900", .data = &jh057n00900_panel_desc },
+ { .compatible = "xingbangda,xbd599", .data = &xbd599_desc },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, st7703_of_match);
--
2.27.0

2020-07-01 10:35:17

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v6 11/13] drm/panel: st7703: Assert reset prior to powering down the regulators

The reset pin is inverted, so if we don't assert reset, the actual gpio
will be high and may keep driving the IO port of the panel.

Signed-off-by: Ondrej Jirman <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
---
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index 0c4167994d01..e303b7b1a215 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -417,6 +417,7 @@ static int st7703_unprepare(struct drm_panel *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;
--
2.27.0

2020-07-01 10:35:43

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v6 08/13] drm/panel: st7703: Move generic part of init sequence to enable callback

Calling sleep out and display on is a controller specific part
of the initialization process. Move it out of the panel specific
initialization function to the enable callback.

Signed-off-by: Ondrej Jirman <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
---
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 33 ++++++++++---------
1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index d03aab10cfef..cdbf7dfb4dd4 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -84,8 +84,6 @@ static inline struct st7703 *panel_to_st7703(struct drm_panel *panel)
static int jh057n_init_sequence(struct st7703 *ctx)
{
struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
- struct device *dev = ctx->dev;
- int ret;

/*
* Init sequence was supplied by the panel vendor. Most of the commands
@@ -136,20 +134,7 @@ static int jh057n_init_sequence(struct st7703 *ctx)
0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41,
0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10,
0x11, 0x18);
- msleep(20);
-
- ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
- if (ret < 0) {
- DRM_DEV_ERROR(dev, "Failed to exit sleep mode: %d\n", ret);
- return ret;
- }
- /* Panel is operational 120 msec after reset */
- msleep(60);
- ret = mipi_dsi_dcs_set_display_on(dsi);
- if (ret)
- return ret;

- DRM_DEV_DEBUG_DRIVER(dev, "Panel init sequence done\n");
return 0;
}

@@ -181,6 +166,7 @@ struct st7703_panel_desc jh057n00900_panel_desc = {
static int st7703_enable(struct drm_panel *panel)
{
struct st7703 *ctx = panel_to_st7703(panel);
+ struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
int ret;

ret = ctx->desc->init_sequence(ctx);
@@ -190,6 +176,23 @@ static int st7703_enable(struct drm_panel *panel)
return ret;
}

+ msleep(20);
+
+ ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+ if (ret < 0) {
+ DRM_DEV_ERROR(ctx->dev, "Failed to exit sleep mode: %d\n", ret);
+ return ret;
+ }
+
+ /* Panel is operational 120 msec after reset */
+ msleep(60);
+
+ ret = mipi_dsi_dcs_set_display_on(dsi);
+ if (ret)
+ return ret;
+
+ DRM_DEV_DEBUG_DRIVER(ctx->dev, "Panel init sequence done\n");
+
return 0;
}

--
2.27.0

2020-07-01 10:35:59

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v6 04/13] drm/panel: rocktech-jh057n00900: Rename the driver to st7703

This rename is done so that the driver matches the name of the
display controller and in preparation for adding support for more
panels to the driver.

This is just a basic file rename, with no code changes.

Signed-off-by: Ondrej Jirman <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
---
drivers/gpu/drm/panel/Kconfig | 26 +++++++++----------
drivers/gpu/drm/panel/Makefile | 2 +-
...-jh057n00900.c => panel-sitronix-st7703.c} | 0
3 files changed, 14 insertions(+), 14 deletions(-)
rename drivers/gpu/drm/panel/{panel-rocktech-jh057n00900.c => panel-sitronix-st7703.c} (100%)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 39055c1f0e2f..de2f2a452be5 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -283,19 +283,6 @@ config DRM_PANEL_RAYDIUM_RM68200
Say Y here if you want to enable support for Raydium RM68200
720x1280 DSI video mode panel.

-config DRM_PANEL_ROCKTECH_JH057N00900
- tristate "Rocktech JH057N00900 MIPI touchscreen panel"
- depends on OF
- depends on DRM_MIPI_DSI
- depends on BACKLIGHT_CLASS_DEVICE
- help
- Say Y here if you want to enable support for Rocktech JH057N00900
- MIPI DSI panel as e.g. used in the Librem 5 devkit. It has a
- resolution of 720x1440 pixels, a built in backlight and touch
- controller.
- Touch input support is provided by the goodix driver and needs to be
- selected separately.
-
config DRM_PANEL_RONBO_RB070D30
tristate "Ronbo Electronics RB070D30 panel"
depends on OF
@@ -395,6 +382,19 @@ config DRM_PANEL_SITRONIX_ST7701
ST7701 controller for 480X864 LCD panels with MIPI/RGB/SPI
system interfaces.

+config DRM_PANEL_SITRONIX_ST7703
+ tristate "Sitronix ST7703 based MIPI touchscreen panels"
+ depends on OF
+ depends on DRM_MIPI_DSI
+ depends on BACKLIGHT_CLASS_DEVICE
+ help
+ Say Y here if you want to enable support for Sitronix ST7703 based
+ panels, souch as Rocktech JH057N00900 MIPI DSI panel as e.g. used in
+ the Librem 5 devkit. It has a resolution of 720x1440 pixels, a built
+ in backlight and touch controller.
+ Touch input support is provided by the goodix driver and needs to be
+ selected separately.
+
config DRM_PANEL_SITRONIX_ST7789V
tristate "Sitronix ST7789V panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index de74f282c433..e45ceac6286f 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o
obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen.o
obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o
obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
-obj-$(CONFIG_DRM_PANEL_ROCKTECH_JH057N00900) += panel-rocktech-jh057n00900.o
obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o
@@ -41,6 +40,7 @@ obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o
+obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o
obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
obj-$(CONFIG_DRM_PANEL_SONY_ACX424AKP) += panel-sony-acx424akp.o
obj-$(CONFIG_DRM_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o
diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
similarity index 100%
rename from drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
rename to drivers/gpu/drm/panel/panel-sitronix-st7703.c
--
2.27.0

2020-07-01 15:27:06

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v6 00/13] Add support for PinePhone LCD panel

Hi Ondrej.

On Wed, Jul 01, 2020 at 12:31:13PM +0200, Ondrej Jirman wrote:
> This patchset adds support for the LCD panel of PinePhone.
>
> I've tested this on PinePhone 1.0 and 1.2.
>
> Please take a look.
>
> thank you and regards,
> Ondrej Jirman
>
> Changes in v6:
> - Fixed spacing in yaml
> - Fixed wrong vccio->iovcc supply name in the bindings doc
> - I noticed that the original driver uses a delay of 20ms in the init
> function to achieve a combined total of 120ms required from post-reset
> to display_on. I've added a similar delay to xbd599_init, so that
> xbd599 panel also has the right timing. (patch 9)
> - v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
> - Added review/ack tags
> - Learned to run dt_binding_check by myself ;)
The patch-set does not apply clean on top of drm-misc-next - due to
vrefresh removal.
Please re-spin.

Sam

2020-07-01 15:55:08

by Guido Günther

[permalink] [raw]
Subject: Re: [PATCH v6 00/13] Add support for PinePhone LCD panel

Hi,
On Wed, Jul 01, 2020 at 12:31:13PM +0200, Ondrej Jirman wrote:
> This patchset adds support for the LCD panel of PinePhone.

I gave this a quick spin on the Librem5 devkit so

Tested-by: Guido G?nther <[email protected]>

but please also adjust MAINTAINERS so we stay in the loop on driver
changes.
Cheers,
-- Guido

>
> I've tested this on PinePhone 1.0 and 1.2.
>
> Please take a look.
>
> thank you and regards,
> Ondrej Jirman
>
> Changes in v6:
> - Fixed spacing in yaml
> - Fixed wrong vccio->iovcc supply name in the bindings doc
> - I noticed that the original driver uses a delay of 20ms in the init
> function to achieve a combined total of 120ms required from post-reset
> to display_on. I've added a similar delay to xbd599_init, so that
> xbd599 panel also has the right timing. (patch 9)
> - v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
> - Added review/ack tags
> - Learned to run dt_binding_check by myself ;)
>
> Changes in v5:
> - rewritten on top of rocktech-jh057n00900 driver
> - rocktech-jh057n00900 renamed to st7703 (controller name)
> - converted rocktech-jh057n00900 bindings to yaml and extended for xbd599
>
> Changes in v4:
> - use ->type from the mode instead of hardcoding (Samuel)
> - move init_sequence to ->prepare (Samuel)
> - move anti-flicker delay to ->enable, explain it (Samuel)
> - add enter_sleep after display_off (Samuel)
> - drop ->disable (move code to ->unprepare)
> - add ID bytes dumping (Linus)
> (I can't test it since allwinner DSI driver has a broken
> dcs_read function, and I didn't manage to fix it.)
> - document magic bytes (Linus)
> - assert reset during powerup
> - cleanup powerup timings according to the datasheet
>
> Changes in v3:
> - Panel driver renamed to the name of the LCD controller
> - Re-organize the driver slightly to more easily support more panels
> based on the same controller.
> - Add patch to enable the touchscreen to complete the LCD support
> on PinePhone.
> - Dropped the "DSI fix" patch (the driver seems to work for me without it)
> - Improved brightness levels handling:
> - PinePhone 1.0 uses default levels generated by the driver
> - On PinePhone 1.1 duty cycles < 20% lead to black screen, so
> default levels can't be used. Martijn Braam came up with a
> list of duty cycle values that lead to perception of linear
> brigtness level <-> light intensity on PinePhone 1.1
> - There was some feedback on v2 about this being similar to st7701.
> It's only similar in name. Most of the "user commands" are different,
> so I opted to keep this in a new driver instead of creating st770x.
>
> Anyone who likes to check the differences, here are datasheets:
>
> - https://megous.com/dl/tmp/ST7703_DS_v01_20160128.pdf
> - https://megous.com/dl/tmp/ST7701.pdf
>
> Changes in v2:
> - DT Example fix.
> - DT Format fix.
> - Raised copyright info to 2020.
> - Sort panel operation functions.
> - Sort inclusion.
>
>
> -- For phone owners: --
>
> There's an open question on how to set the backlight brightness values
> on post 1.0 revision phone, since lower duty cycles (< 10-20%) lead
> to backlight being black. It would be nice if more people can test
> the various backlight levels on 1.1 and 1.2 revision with this change
> in dts:
>
> brightness-levels = <0 1000>;
> num-interpolated-steps = <1000>;
>
> and report at what brightness level the backlight turns on. So far it
> seems this has a wide range. Lowest useable duty cycle for me is ~7%
> on 1.2 and for Martijn ~20% on 1.1.
>
> Icenowy Zheng (2):
> dt-bindings: vendor-prefixes: Add Xingbangda
> arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone
>
> Ondrej Jirman (11):
> dt-bindings: panel: Convert rocktech,jh057n00900 to yaml
> dt-bindings: panel: Add compatible for Xingbangda XBD599 panel
> drm/panel: rocktech-jh057n00900: Rename the driver to st7703
> drm/panel: st7703: Rename functions from jh057n prefix to st7703
> drm/panel: st7703: Prepare for supporting multiple panels
> drm/panel: st7703: Move code specific to jh057n closer together
> drm/panel: st7703: Move generic part of init sequence to enable
> callback
> drm/panel: st7703: Add support for Xingbangda XBD599
> drm/panel: st7703: Enter sleep after display off
> drm/panel: st7703: Assert reset prior to powering down the regulators
> arm64: dts: sun50i-a64-pinephone: Add touchscreen support
>
> .../display/panel/rocktech,jh057n00900.txt | 23 -
> .../display/panel/rocktech,jh057n00900.yaml | 70 ++
> .../devicetree/bindings/vendor-prefixes.yaml | 2 +
> .../allwinner/sun50i-a64-pinephone-1.1.dts | 19 +
> .../dts/allwinner/sun50i-a64-pinephone.dtsi | 54 ++
> drivers/gpu/drm/panel/Kconfig | 26 +-
> drivers/gpu/drm/panel/Makefile | 2 +-
> .../drm/panel/panel-rocktech-jh057n00900.c | 424 -----------
> drivers/gpu/drm/panel/panel-sitronix-st7703.c | 656 ++++++++++++++++++
> 9 files changed, 815 insertions(+), 461 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
> delete mode 100644 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> create mode 100644 drivers/gpu/drm/panel/panel-sitronix-st7703.c
>
> --
> 2.27.0
>

2020-07-01 15:59:50

by Guido Günther

[permalink] [raw]
Subject: Re: [PATCH v6 02/13] dt-bindings: panel: Convert rocktech,jh057n00900 to yaml

Hi Ondrej,
On Wed, Jul 01, 2020 at 12:31:15PM +0200, Ondrej Jirman wrote:
> Convert Rocktech MIPI DSI panel driver from txt to yaml bindings.
>
> Signed-off-by: Ondrej Jirman <[email protected]>
> ---
> .../display/panel/rocktech,jh057n00900.txt | 23 -------
> .../display/panel/rocktech,jh057n00900.yaml | 66 +++++++++++++++++++
> 2 files changed, 66 insertions(+), 23 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> create mode 100644
> Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml

Thanks for the conversion! Shouldn't we switch to `sitronix-st7703.yaml`
as well in this patch?
Cheers,
-- Guido

>
> diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> deleted file mode 100644
> index a372c5d84695..000000000000
> --- a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -Rocktech jh057n00900 5.5" 720x1440 TFT LCD panel
> -
> -Required properties:
> -- compatible: should be "rocktech,jh057n00900"
> -- reg: DSI virtual channel of the peripheral
> -- reset-gpios: panel reset gpio
> -- backlight: phandle of the backlight device attached to the panel
> -- vcc-supply: phandle of the regulator that provides the vcc supply voltage.
> -- iovcc-supply: phandle of the regulator that provides the iovcc supply
> - voltage.
> -
> -Example:
> -
> - &mipi_dsi {
> - panel@0 {
> - compatible = "rocktech,jh057n00900";
> - reg = <0>;
> - backlight = <&backlight>;
> - reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
> - vcc-supply = <&reg_2v8_p>;
> - iovcc-supply = <&reg_1v8_p>;
> - };
> - };
> diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
> new file mode 100644
> index 000000000000..928ba42e7f8d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
> @@ -0,0 +1,66 @@
> +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/panel/rocktech,jh057n00900.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Rocktech JH057N00900 5.5" 720x1440 TFT LCD panel
> +
> +maintainers:
> + - Ondrej Jirman <[email protected]>
> +
> +description: |
> + Rocktech JH057N00900 is a 720x1440 TFT LCD panel
> + connected using a MIPI-DSI video interface.
> +
> +allOf:
> + - $ref: panel-common.yaml#
> +
> +properties:
> + compatible:
> + const: rocktech,jh057n00900
> +
> + reg:
> + maxItems: 1
> + description: DSI virtual channel
> +
> + vcc-supply:
> + description: Panel power supply
> +
> + iovcc-supply:
> + description: I/O voltage supply
> +
> + reset-gpios:
> + description: GPIO used for the reset pin
> + maxItems: 1
> +
> + backlight:
> + description: Backlight used by the panel
> + $ref: "/schemas/types.yaml#/definitions/phandle"
> +
> +required:
> + - compatible
> + - reg
> + - vcc-supply
> + - iovcc-supply
> + - reset-gpios
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> +
> + dsi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + panel@0 {
> + compatible = "rocktech,jh057n00900";
> + reg = <0>;
> + vcc-supply = <&reg_2v8_p>;
> + iovcc-supply = <&reg_1v8_p>;
> + reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
> + backlight = <&backlight>;
> + };
> + };
> +...
> --
> 2.27.0
>

2020-07-01 16:01:27

by Guido Günther

[permalink] [raw]
Subject: Re: [PATCH v6 04/13] drm/panel: rocktech-jh057n00900: Rename the driver to st7703

Hi,
On Wed, Jul 01, 2020 at 12:31:17PM +0200, Ondrej Jirman wrote:
> This rename is done so that the driver matches the name of the
> display controller and in preparation for adding support for more
> panels to the driver.
>
> This is just a basic file rename, with no code changes.

Reviewed-by: Guido G?nther <[email protected]>
>
> Signed-off-by: Ondrej Jirman <[email protected]>
> Reviewed-by: Linus Walleij <[email protected]>
> ---
> drivers/gpu/drm/panel/Kconfig | 26 +++++++++----------
> drivers/gpu/drm/panel/Makefile | 2 +-
> ...-jh057n00900.c => panel-sitronix-st7703.c} | 0
> 3 files changed, 14 insertions(+), 14 deletions(-)
> rename drivers/gpu/drm/panel/{panel-rocktech-jh057n00900.c => panel-sitronix-st7703.c} (100%)
>
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 39055c1f0e2f..de2f2a452be5 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -283,19 +283,6 @@ config DRM_PANEL_RAYDIUM_RM68200
> Say Y here if you want to enable support for Raydium RM68200
> 720x1280 DSI video mode panel.
>
> -config DRM_PANEL_ROCKTECH_JH057N00900
> - tristate "Rocktech JH057N00900 MIPI touchscreen panel"
> - depends on OF
> - depends on DRM_MIPI_DSI
> - depends on BACKLIGHT_CLASS_DEVICE
> - help
> - Say Y here if you want to enable support for Rocktech JH057N00900
> - MIPI DSI panel as e.g. used in the Librem 5 devkit. It has a
> - resolution of 720x1440 pixels, a built in backlight and touch
> - controller.
> - Touch input support is provided by the goodix driver and needs to be
> - selected separately.
> -
> config DRM_PANEL_RONBO_RB070D30
> tristate "Ronbo Electronics RB070D30 panel"
> depends on OF
> @@ -395,6 +382,19 @@ config DRM_PANEL_SITRONIX_ST7701
> ST7701 controller for 480X864 LCD panels with MIPI/RGB/SPI
> system interfaces.
>
> +config DRM_PANEL_SITRONIX_ST7703
> + tristate "Sitronix ST7703 based MIPI touchscreen panels"
> + depends on OF
> + depends on DRM_MIPI_DSI
> + depends on BACKLIGHT_CLASS_DEVICE
> + help
> + Say Y here if you want to enable support for Sitronix ST7703 based
> + panels, souch as Rocktech JH057N00900 MIPI DSI panel as e.g. used in
> + the Librem 5 devkit. It has a resolution of 720x1440 pixels, a built
> + in backlight and touch controller.
> + Touch input support is provided by the goodix driver and needs to be
> + selected separately.
> +
> config DRM_PANEL_SITRONIX_ST7789V
> tristate "Sitronix ST7789V panel"
> depends on OF && SPI
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index de74f282c433..e45ceac6286f 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -27,7 +27,6 @@ obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o
> obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen.o
> obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o
> obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
> -obj-$(CONFIG_DRM_PANEL_ROCKTECH_JH057N00900) += panel-rocktech-jh057n00900.o
> obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
> obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
> obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o
> @@ -41,6 +40,7 @@ obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
> obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
> obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
> obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o
> +obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o
> obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
> obj-$(CONFIG_DRM_PANEL_SONY_ACX424AKP) += panel-sony-acx424akp.o
> obj-$(CONFIG_DRM_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o
> diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> similarity index 100%
> rename from drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> rename to drivers/gpu/drm/panel/panel-sitronix-st7703.c
> --
> 2.27.0
>

2020-07-01 16:04:18

by Guido Günther

[permalink] [raw]
Subject: Re: [PATCH v6 08/13] drm/panel: st7703: Move generic part of init sequence to enable callback

Hi,
On Wed, Jul 01, 2020 at 12:31:21PM +0200, Ondrej Jirman wrote:
> Calling sleep out and display on is a controller specific part
> of the initialization process. Move it out of the panel specific
> initialization function to the enable callback.

Reviewed-by: Guido G?nther <[email protected]>

>
> Signed-off-by: Ondrej Jirman <[email protected]>
> Reviewed-by: Linus Walleij <[email protected]>
> ---
> drivers/gpu/drm/panel/panel-sitronix-st7703.c | 33 ++++++++++---------
> 1 file changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> index d03aab10cfef..cdbf7dfb4dd4 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> @@ -84,8 +84,6 @@ static inline struct st7703 *panel_to_st7703(struct drm_panel *panel)
> static int jh057n_init_sequence(struct st7703 *ctx)
> {
> struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
> - struct device *dev = ctx->dev;
> - int ret;
>
> /*
> * Init sequence was supplied by the panel vendor. Most of the commands
> @@ -136,20 +134,7 @@ static int jh057n_init_sequence(struct st7703 *ctx)
> 0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41,
> 0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10,
> 0x11, 0x18);
> - msleep(20);
> -
> - ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
> - if (ret < 0) {
> - DRM_DEV_ERROR(dev, "Failed to exit sleep mode: %d\n", ret);
> - return ret;
> - }
> - /* Panel is operational 120 msec after reset */
> - msleep(60);
> - ret = mipi_dsi_dcs_set_display_on(dsi);
> - if (ret)
> - return ret;
>
> - DRM_DEV_DEBUG_DRIVER(dev, "Panel init sequence done\n");
> return 0;
> }
>
> @@ -181,6 +166,7 @@ struct st7703_panel_desc jh057n00900_panel_desc = {
> static int st7703_enable(struct drm_panel *panel)
> {
> struct st7703 *ctx = panel_to_st7703(panel);
> + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
> int ret;
>
> ret = ctx->desc->init_sequence(ctx);
> @@ -190,6 +176,23 @@ static int st7703_enable(struct drm_panel *panel)
> return ret;
> }
>
> + msleep(20);
> +
> + ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
> + if (ret < 0) {
> + DRM_DEV_ERROR(ctx->dev, "Failed to exit sleep mode: %d\n", ret);
> + return ret;
> + }
> +
> + /* Panel is operational 120 msec after reset */
> + msleep(60);
> +
> + ret = mipi_dsi_dcs_set_display_on(dsi);
> + if (ret)
> + return ret;
> +
> + DRM_DEV_DEBUG_DRIVER(ctx->dev, "Panel init sequence done\n");
> +
> return 0;
> }
>
> --
> 2.27.0
>

2020-07-01 16:05:09

by Guido Günther

[permalink] [raw]
Subject: Re: [PATCH v6 09/13] drm/panel: st7703: Add support for Xingbangda XBD599

Hi,
On Wed, Jul 01, 2020 at 12:31:22PM +0200, Ondrej Jirman wrote:
> Xingbangda XBD599 is a 5.99" 720x1440 MIPI-DSI LCD panel used in
> PinePhone. Add support for it.

Reviewed-by: Guido G?nther <[email protected]>

>
> Signed-off-by: Icenowy Zheng <[email protected]>
> Signed-off-by: Ondrej Jirman <[email protected]>
> Reviewed-by: Linus Walleij <[email protected]>
> ---
> drivers/gpu/drm/panel/panel-sitronix-st7703.c | 200 +++++++++++++++++-
> 1 file changed, 198 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> index cdbf7dfb4dd4..5cd5503f894f 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> @@ -39,10 +39,11 @@
> #define ST7703_CMD_SETEXTC 0xB9
> #define ST7703_CMD_SETMIPI 0xBA
> #define ST7703_CMD_SETVDC 0xBC
> -#define ST7703_CMD_UNKNOWN0 0xBF
> +#define ST7703_CMD_UNKNOWN_BF 0xBF
> #define ST7703_CMD_SETSCR 0xC0
> #define ST7703_CMD_SETPOWER 0xC1
> #define ST7703_CMD_SETPANEL 0xCC
> +#define ST7703_CMD_UNKNOWN_C6 0xC6
> #define ST7703_CMD_SETGAMMA 0xE0
> #define ST7703_CMD_SETEQ 0xE3
> #define ST7703_CMD_SETGIP1 0xE9
> @@ -109,7 +110,7 @@ static int jh057n_init_sequence(struct st7703 *ctx)
> msleep(20);
>
> dsi_generic_write_seq(dsi, ST7703_CMD_SETVCOM, 0x3F, 0x3F);
> - dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN0, 0x02, 0x11, 0x00);
> + dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00);
> dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP1,
> 0x82, 0x10, 0x06, 0x05, 0x9E, 0x0A, 0xA5, 0x12,
> 0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38,
> @@ -163,6 +164,200 @@ struct st7703_panel_desc jh057n00900_panel_desc = {
> .init_sequence = jh057n_init_sequence,
> };
>
> +#define dsi_dcs_write_seq(dsi, cmd, seq...) do { \
> + static const u8 d[] = { seq }; \
> + int ret; \
> + ret = mipi_dsi_dcs_write(dsi, cmd, d, ARRAY_SIZE(d)); \
> + if (ret < 0) \
> + return ret; \
> + } while (0)
> +
> +
> +static int xbd599_init_sequence(struct st7703 *ctx)
> +{
> + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
> +
> + /*
> + * Init sequence was supplied by the panel vendor.
> + */
> +
> + /* Magic sequence to unlock user commands below. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETEXTC, 0xF1, 0x12, 0x83);
> +
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETMIPI,
> + 0x33, /* VC_main = 0, Lane_Number = 3 (4 lanes) */
> + 0x81, /* DSI_LDO_SEL = 1.7V, RTERM = 90 Ohm */
> + 0x05, /* IHSRX = x6 (Low High Speed driving ability) */
> + 0xF9, /* TX_CLK_SEL = fDSICLK/16 */
> + 0x0E, /* HFP_OSC (min. HFP number in DSI mode) */
> + 0x0E, /* HBP_OSC (min. HBP number in DSI mode) */
> + /* The rest is undocumented in ST7703 datasheet */
> + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x44, 0x25, 0x00, 0x91, 0x0a, 0x00, 0x00, 0x02,
> + 0x4F, 0x11, 0x00, 0x00, 0x37);
> +
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER_EXT,
> + 0x25, /* PCCS = 2, ECP_DC_DIV = 1/4 HSYNC */
> + 0x22, /* DT = 15ms XDK_ECP = x2 */
> + 0x20, /* PFM_DC_DIV = /1 */
> + 0x03 /* ECP_SYNC_EN = 1, VGX_SYNC_EN = 1 */);
> +
> + /* RGB I/F porch timing */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETRGBIF,
> + 0x10, /* VBP_RGB_GEN */
> + 0x10, /* VFP_RGB_GEN */
> + 0x05, /* DE_BP_RGB_GEN */
> + 0x05, /* DE_FP_RGB_GEN */
> + /* The rest is undocumented in ST7703 datasheet */
> + 0x03, 0xFF,
> + 0x00, 0x00,
> + 0x00, 0x00);
> +
> + /* Source driving settings. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETSCR,
> + 0x73, /* N_POPON */
> + 0x73, /* N_NOPON */
> + 0x50, /* I_POPON */
> + 0x50, /* I_NOPON */
> + 0x00, /* SCR[31,24] */
> + 0xC0, /* SCR[23,16] */
> + 0x08, /* SCR[15,8] */
> + 0x70, /* SCR[7,0] */
> + 0x00 /* Undocumented */);
> +
> + /* NVDDD_SEL = -1.8V, VDDD_SEL = out of range (possibly 1.9V?) */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETVDC, 0x4E);
> +
> + /*
> + * SS_PANEL = 1 (reverse scan), GS_PANEL = 0 (normal scan)
> + * REV_PANEL = 1 (normally black panel), BGR_PANEL = 1 (BGR)
> + */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0B);
> +
> + /* Zig-Zag Type C column inversion. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETCYC, 0x80);
> +
> + /* Set display resolution. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETDISP,
> + 0xF0, /* NL = 240 */
> + 0x12, /* RES_V_LSB = 0, BLK_CON = VSSD,
> + * RESO_SEL = 720RGB
> + */
> + 0xF0 /* WHITE_GND_EN = 1 (GND),
> + * WHITE_FRAME_SEL = 7 frames,
> + * ISC = 0 frames
> + */);
> +
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETEQ,
> + 0x00, /* PNOEQ */
> + 0x00, /* NNOEQ */
> + 0x0B, /* PEQGND */
> + 0x0B, /* NEQGND */
> + 0x10, /* PEQVCI */
> + 0x10, /* NEQVCI */
> + 0x00, /* PEQVCI1 */
> + 0x00, /* NEQVCI1 */
> + 0x00, /* reserved */
> + 0x00, /* reserved */
> + 0xFF, /* reserved */
> + 0x00, /* reserved */
> + 0xC0, /* ESD_DET_DATA_WHITE = 1, ESD_WHITE_EN = 1 */
> + 0x10 /* SLPIN_OPTION = 1 (no need vsync after sleep-in)
> + * VEDIO_NO_CHECK_EN = 0
> + * ESD_WHITE_GND_EN = 0
> + * ESD_DET_TIME_SEL = 0 frames
> + */);
> +
> + /* Undocumented command. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_C6, 0x01, 0x00, 0xFF, 0xFF, 0x00);
> +
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER,
> + 0x74, /* VBTHS, VBTLS: VGH = 17V, VBL = -11V */
> + 0x00, /* FBOFF_VGH = 0, FBOFF_VGL = 0 */
> + 0x32, /* VRP */
> + 0x32, /* VRN */
> + 0x77, /* reserved */
> + 0xF1, /* APS = 1 (small),
> + * VGL_DET_EN = 1, VGH_DET_EN = 1,
> + * VGL_TURBO = 1, VGH_TURBO = 1
> + */
> + 0xFF, /* VGH1_L_DIV, VGL1_L_DIV (1.5MHz) */
> + 0xFF, /* VGH1_R_DIV, VGL1_R_DIV (1.5MHz) */
> + 0xCC, /* VGH2_L_DIV, VGL2_L_DIV (2.6MHz) */
> + 0xCC, /* VGH2_R_DIV, VGL2_R_DIV (2.6MHz) */
> + 0x77, /* VGH3_L_DIV, VGL3_L_DIV (4.5MHz) */
> + 0x77 /* VGH3_R_DIV, VGL3_R_DIV (4.5MHz) */);
> +
> + /* Reference voltage. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP,
> + 0x07, /* VREF_SEL = 4.2V */
> + 0x07 /* NVREF_SEL = 4.2V */);
> + msleep(20);
> +
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM,
> + 0x2C, /* VCOMDC_F = -0.67V */
> + 0x2C /* VCOMDC_B = -0.67V */);
> +
> + /* Undocumented command. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00);
> +
> + /* This command is to set forward GIP timing. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP1,
> + 0x82, 0x10, 0x06, 0x05, 0xA2, 0x0A, 0xA5, 0x12,
> + 0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38,
> + 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x00,
> + 0x03, 0x00, 0x00, 0x00, 0x75, 0x75, 0x31, 0x88,
> + 0x88, 0x88, 0x88, 0x88, 0x88, 0x13, 0x88, 0x64,
> + 0x64, 0x20, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
> + 0x02, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
> +
> + /* This command is to set backward GIP timing. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP2,
> + 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x02, 0x88,
> + 0x88, 0x88, 0x88, 0x88, 0x88, 0x64, 0x88, 0x13,
> + 0x57, 0x13, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
> + 0x75, 0x88, 0x23, 0x14, 0x00, 0x00, 0x02, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0A,
> + 0xA5, 0x00, 0x00, 0x00, 0x00);
> +
> + /* Adjust the gamma characteristics of the panel. */
> + dsi_dcs_write_seq(dsi, ST7703_CMD_SETGAMMA,
> + 0x00, 0x09, 0x0D, 0x23, 0x27, 0x3C, 0x41, 0x35,
> + 0x07, 0x0D, 0x0E, 0x12, 0x13, 0x10, 0x12, 0x12,
> + 0x18, 0x00, 0x09, 0x0D, 0x23, 0x27, 0x3C, 0x41,
> + 0x35, 0x07, 0x0D, 0x0E, 0x12, 0x13, 0x10, 0x12,
> + 0x12, 0x18);
> +
> + return 0;
> +}
> +
> +static const struct drm_display_mode xbd599_mode = {
> + .hdisplay = 720,
> + .hsync_start = 720 + 40,
> + .hsync_end = 720 + 40 + 40,
> + .htotal = 720 + 40 + 40 + 40,
> + .vdisplay = 1440,
> + .vsync_start = 1440 + 18,
> + .vsync_end = 1440 + 18 + 10,
> + .vtotal = 1440 + 18 + 10 + 17,
> + .vrefresh = 60,
> + .clock = 69000,
> + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
> + .width_mm = 68,
> + .height_mm = 136,
> +};
> +
> +static const struct st7703_panel_desc xbd599_desc = {
> + .mode = &xbd599_mode,
> + .lanes = 4,
> + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
> + .format = MIPI_DSI_FMT_RGB888,
> + .init_sequence = xbd599_init_sequence,
> +};
> +
> static int st7703_enable(struct drm_panel *panel)
> {
> struct st7703 *ctx = panel_to_st7703(panel);
> @@ -428,6 +623,7 @@ static int st7703_remove(struct mipi_dsi_device *dsi)
>
> static const struct of_device_id st7703_of_match[] = {
> { .compatible = "rocktech,jh057n00900", .data = &jh057n00900_panel_desc },
> + { .compatible = "xingbangda,xbd599", .data = &xbd599_desc },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, st7703_of_match);
> --
> 2.27.0
>

2020-07-01 16:07:17

by Guido Günther

[permalink] [raw]
Subject: Re: [PATCH v6 11/13] drm/panel: st7703: Assert reset prior to powering down the regulators

Hi,
On Wed, Jul 01, 2020 at 12:31:24PM +0200, Ondrej Jirman wrote:
> The reset pin is inverted, so if we don't assert reset, the actual gpio
> will be high and may keep driving the IO port of the panel.

Reviewed-by: Guido G?nther <[email protected]>

>
> Signed-off-by: Ondrej Jirman <[email protected]>
> Reviewed-by: Linus Walleij <[email protected]>
> ---
> drivers/gpu/drm/panel/panel-sitronix-st7703.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> index 0c4167994d01..e303b7b1a215 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> @@ -417,6 +417,7 @@ static int st7703_unprepare(struct drm_panel *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;
> --
> 2.27.0
>

2020-07-01 16:10:01

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v6 02/13] dt-bindings: panel: Convert rocktech,jh057n00900 to yaml

On Wed, Jul 01, 2020 at 05:58:57PM +0200, Guido G?nther wrote:
> Hi Ondrej,
> On Wed, Jul 01, 2020 at 12:31:15PM +0200, Ondrej Jirman wrote:
> > Convert Rocktech MIPI DSI panel driver from txt to yaml bindings.
> >
> > Signed-off-by: Ondrej Jirman <[email protected]>
> > ---
> > .../display/panel/rocktech,jh057n00900.txt | 23 -------
> > .../display/panel/rocktech,jh057n00900.yaml | 66 +++++++++++++++++++
> > 2 files changed, 66 insertions(+), 23 deletions(-)
> > delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> > create mode 100644
> > Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
>
> Thanks for the conversion! Shouldn't we switch to `sitronix-st7703.yaml`
> as well in this patch?

That would be good if this rename is included.
Otherwise we will just have to do it later.

Sam

2020-07-01 16:32:05

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH v6 00/13] Add support for PinePhone LCD panel

Hello Sam,

On Wed, Jul 01, 2020 at 05:25:32PM +0200, Sam Ravnborg wrote:
> Hi Ondrej.
>
> On Wed, Jul 01, 2020 at 12:31:13PM +0200, Ondrej Jirman wrote:
> > This patchset adds support for the LCD panel of PinePhone.
> >
> > I've tested this on PinePhone 1.0 and 1.2.
> >
> > Please take a look.
> >
> > thank you and regards,
> > Ondrej Jirman
> >
> > Changes in v6:
> > - Fixed spacing in yaml
> > - Fixed wrong vccio->iovcc supply name in the bindings doc
> > - I noticed that the original driver uses a delay of 20ms in the init
> > function to achieve a combined total of 120ms required from post-reset
> > to display_on. I've added a similar delay to xbd599_init, so that
> > xbd599 panel also has the right timing. (patch 9)
> > - v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
> > - Added review/ack tags
> > - Learned to run dt_binding_check by myself ;)
> The patch-set does not apply clean on top of drm-misc-next - due to
> vrefresh removal.
> Please re-spin.

Sorry for that. Rebased and retested.

thank you,
o.

> Sam

2020-07-01 16:33:05

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH v6 02/13] dt-bindings: panel: Convert rocktech,jh057n00900 to yaml

Hello Guido,

On Wed, Jul 01, 2020 at 05:58:57PM +0200, Guido G?nther wrote:
> Hi Ondrej,
> On Wed, Jul 01, 2020 at 12:31:15PM +0200, Ondrej Jirman wrote:
> > Convert Rocktech MIPI DSI panel driver from txt to yaml bindings.
> >
> > Signed-off-by: Ondrej Jirman <[email protected]>
> > ---
> > .../display/panel/rocktech,jh057n00900.txt | 23 -------
> > .../display/panel/rocktech,jh057n00900.yaml | 66 +++++++++++++++++++
> > 2 files changed, 66 insertions(+), 23 deletions(-)
> > delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> > create mode 100644
> > Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
>
> Thanks for the conversion! Shouldn't we switch to `sitronix-st7703.yaml`
> as well in this patch?

Names of yaml files should be according to one of the compatibles.

And thank you for your review of the patches.

regards,
o.

> Cheers,
> -- Guido
>
> >
> > diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> > deleted file mode 100644
> > index a372c5d84695..000000000000
> > --- a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> > +++ /dev/null
> > @@ -1,23 +0,0 @@
> > -Rocktech jh057n00900 5.5" 720x1440 TFT LCD panel
> > -
> > -Required properties:
> > -- compatible: should be "rocktech,jh057n00900"
> > -- reg: DSI virtual channel of the peripheral
> > -- reset-gpios: panel reset gpio
> > -- backlight: phandle of the backlight device attached to the panel
> > -- vcc-supply: phandle of the regulator that provides the vcc supply voltage.
> > -- iovcc-supply: phandle of the regulator that provides the iovcc supply
> > - voltage.
> > -
> > -Example:
> > -
> > - &mipi_dsi {
> > - panel@0 {
> > - compatible = "rocktech,jh057n00900";
> > - reg = <0>;
> > - backlight = <&backlight>;
> > - reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
> > - vcc-supply = <&reg_2v8_p>;
> > - iovcc-supply = <&reg_1v8_p>;
> > - };
> > - };
> > diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
> > new file mode 100644
> > index 000000000000..928ba42e7f8d
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
> > @@ -0,0 +1,66 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/display/panel/rocktech,jh057n00900.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Rocktech JH057N00900 5.5" 720x1440 TFT LCD panel
> > +
> > +maintainers:
> > + - Ondrej Jirman <[email protected]>
> > +
> > +description: |
> > + Rocktech JH057N00900 is a 720x1440 TFT LCD panel
> > + connected using a MIPI-DSI video interface.
> > +
> > +allOf:
> > + - $ref: panel-common.yaml#
> > +
> > +properties:
> > + compatible:
> > + const: rocktech,jh057n00900
> > +
> > + reg:
> > + maxItems: 1
> > + description: DSI virtual channel
> > +
> > + vcc-supply:
> > + description: Panel power supply
> > +
> > + iovcc-supply:
> > + description: I/O voltage supply
> > +
> > + reset-gpios:
> > + description: GPIO used for the reset pin
> > + maxItems: 1
> > +
> > + backlight:
> > + description: Backlight used by the panel
> > + $ref: "/schemas/types.yaml#/definitions/phandle"
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - vcc-supply
> > + - iovcc-supply
> > + - reset-gpios
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + #include <dt-bindings/gpio/gpio.h>
> > +
> > + dsi {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > + panel@0 {
> > + compatible = "rocktech,jh057n00900";
> > + reg = <0>;
> > + vcc-supply = <&reg_2v8_p>;
> > + iovcc-supply = <&reg_1v8_p>;
> > + reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
> > + backlight = <&backlight>;
> > + };
> > + };
> > +...
> > --
> > 2.27.0
> >

2020-07-01 16:38:49

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v6 00/13] Add support for PinePhone LCD panel

On Wed, Jul 1, 2020 at 6:30 PM Ondřej Jirman <[email protected]> wrote:
> On Wed, Jul 01, 2020 at 05:25:32PM +0200, Sam Ravnborg wrote:
> > Hi Ondrej.
> >
> > On Wed, Jul 01, 2020 at 12:31:13PM +0200, Ondrej Jirman wrote:
> > > This patchset adds support for the LCD panel of PinePhone.
> > >
> > > I've tested this on PinePhone 1.0 and 1.2.
> > >
> > > Please take a look.
> > >
> > > thank you and regards,
> > > Ondrej Jirman
> > >
> > > Changes in v6:
> > > - Fixed spacing in yaml
> > > - Fixed wrong vccio->iovcc supply name in the bindings doc
> > > - I noticed that the original driver uses a delay of 20ms in the init
> > > function to achieve a combined total of 120ms required from post-reset
> > > to display_on. I've added a similar delay to xbd599_init, so that
> > > xbd599 panel also has the right timing. (patch 9)
> > > - v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
> > > - Added review/ack tags
> > > - Learned to run dt_binding_check by myself ;)
> > The patch-set does not apply clean on top of drm-misc-next - due to
> > vrefresh removal.
> > Please re-spin.
>
> Sorry for that. Rebased and retested.

Sam will you apply it? I was in the middle of applying and ran into the same
issue :D

Yours,
Linus Walleij

2020-07-01 16:44:50

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH v6 00/13] Add support for PinePhone LCD panel

Hello,

On Wed, Jul 01, 2020 at 05:54:05PM +0200, Guido G?nther wrote:
> Hi,
> On Wed, Jul 01, 2020 at 12:31:13PM +0200, Ondrej Jirman wrote:
> > This patchset adds support for the LCD panel of PinePhone.
>
> I gave this a quick spin on the Librem5 devkit so
>
> Tested-by: Guido G?nther <[email protected]>
>
> but please also adjust MAINTAINERS so we stay in the loop on driver
> changes.

Ah, right. I'll send a quick followup patch[1] after this gets merged,
or add it to v8 if there will be a need for v8. Thanks for noticing.

[1] https://megous.com/dl/tmp/0001-MAINTAINERS-Update-entry-for-st7703-driver-after-the.patch

And thanks for testing, too. :)

regards,
o.

> Cheers,
> -- Guido
>
> >
> > I've tested this on PinePhone 1.0 and 1.2.
> >
> > Please take a look.
> >
> > thank you and regards,
> > Ondrej Jirman
> >
> > Changes in v6:
> > - Fixed spacing in yaml
> > - Fixed wrong vccio->iovcc supply name in the bindings doc
> > - I noticed that the original driver uses a delay of 20ms in the init
> > function to achieve a combined total of 120ms required from post-reset
> > to display_on. I've added a similar delay to xbd599_init, so that
> > xbd599 panel also has the right timing. (patch 9)
> > - v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
> > - Added review/ack tags
> > - Learned to run dt_binding_check by myself ;)
> >
> > Changes in v5:
> > - rewritten on top of rocktech-jh057n00900 driver
> > - rocktech-jh057n00900 renamed to st7703 (controller name)
> > - converted rocktech-jh057n00900 bindings to yaml and extended for xbd599
> >
> > Changes in v4:
> > - use ->type from the mode instead of hardcoding (Samuel)
> > - move init_sequence to ->prepare (Samuel)
> > - move anti-flicker delay to ->enable, explain it (Samuel)
> > - add enter_sleep after display_off (Samuel)
> > - drop ->disable (move code to ->unprepare)
> > - add ID bytes dumping (Linus)
> > (I can't test it since allwinner DSI driver has a broken
> > dcs_read function, and I didn't manage to fix it.)
> > - document magic bytes (Linus)
> > - assert reset during powerup
> > - cleanup powerup timings according to the datasheet
> >
> > Changes in v3:
> > - Panel driver renamed to the name of the LCD controller
> > - Re-organize the driver slightly to more easily support more panels
> > based on the same controller.
> > - Add patch to enable the touchscreen to complete the LCD support
> > on PinePhone.
> > - Dropped the "DSI fix" patch (the driver seems to work for me without it)
> > - Improved brightness levels handling:
> > - PinePhone 1.0 uses default levels generated by the driver
> > - On PinePhone 1.1 duty cycles < 20% lead to black screen, so
> > default levels can't be used. Martijn Braam came up with a
> > list of duty cycle values that lead to perception of linear
> > brigtness level <-> light intensity on PinePhone 1.1
> > - There was some feedback on v2 about this being similar to st7701.
> > It's only similar in name. Most of the "user commands" are different,
> > so I opted to keep this in a new driver instead of creating st770x.
> >
> > Anyone who likes to check the differences, here are datasheets:
> >
> > - https://megous.com/dl/tmp/ST7703_DS_v01_20160128.pdf
> > - https://megous.com/dl/tmp/ST7701.pdf
> >
> > Changes in v2:
> > - DT Example fix.
> > - DT Format fix.
> > - Raised copyright info to 2020.
> > - Sort panel operation functions.
> > - Sort inclusion.
> >
> >
> > -- For phone owners: --
> >
> > There's an open question on how to set the backlight brightness values
> > on post 1.0 revision phone, since lower duty cycles (< 10-20%) lead
> > to backlight being black. It would be nice if more people can test
> > the various backlight levels on 1.1 and 1.2 revision with this change
> > in dts:
> >
> > brightness-levels = <0 1000>;
> > num-interpolated-steps = <1000>;
> >
> > and report at what brightness level the backlight turns on. So far it
> > seems this has a wide range. Lowest useable duty cycle for me is ~7%
> > on 1.2 and for Martijn ~20% on 1.1.
> >
> > Icenowy Zheng (2):
> > dt-bindings: vendor-prefixes: Add Xingbangda
> > arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone
> >
> > Ondrej Jirman (11):
> > dt-bindings: panel: Convert rocktech,jh057n00900 to yaml
> > dt-bindings: panel: Add compatible for Xingbangda XBD599 panel
> > drm/panel: rocktech-jh057n00900: Rename the driver to st7703
> > drm/panel: st7703: Rename functions from jh057n prefix to st7703
> > drm/panel: st7703: Prepare for supporting multiple panels
> > drm/panel: st7703: Move code specific to jh057n closer together
> > drm/panel: st7703: Move generic part of init sequence to enable
> > callback
> > drm/panel: st7703: Add support for Xingbangda XBD599
> > drm/panel: st7703: Enter sleep after display off
> > drm/panel: st7703: Assert reset prior to powering down the regulators
> > arm64: dts: sun50i-a64-pinephone: Add touchscreen support
> >
> > .../display/panel/rocktech,jh057n00900.txt | 23 -
> > .../display/panel/rocktech,jh057n00900.yaml | 70 ++
> > .../devicetree/bindings/vendor-prefixes.yaml | 2 +
> > .../allwinner/sun50i-a64-pinephone-1.1.dts | 19 +
> > .../dts/allwinner/sun50i-a64-pinephone.dtsi | 54 ++
> > drivers/gpu/drm/panel/Kconfig | 26 +-
> > drivers/gpu/drm/panel/Makefile | 2 +-
> > .../drm/panel/panel-rocktech-jh057n00900.c | 424 -----------
> > drivers/gpu/drm/panel/panel-sitronix-st7703.c | 656 ++++++++++++++++++
> > 9 files changed, 815 insertions(+), 461 deletions(-)
> > delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> > create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
> > delete mode 100644 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > create mode 100644 drivers/gpu/drm/panel/panel-sitronix-st7703.c
> >
> > --
> > 2.27.0
> >