From d19abae7155d267175b3103a2804fa9034738b47 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sun, 28 Jun 2020 19:50:27 +0100 Subject: Updates for Pine64 devices, inc new rev of panel driver for PinePhone --- ...nner-dts-a64-add-LCD-related-device-nodes.patch | 81 ---- 0001-drm-panel-add-Xingbangda-XBD599-panel.patch | 423 --------------------- ...un6i_mipi_dsi-fix-horizontal-timing-calcu.patch | 59 --- ...-bindings-Add-doc-for-Pine64-Pinebook-Pro.patch | 32 -- ...-panel-add-binding-for-Xingbangda-XBD599-.patch | 74 ---- ...t-bindings-vendor-prefixes-Add-Xingbangda.patch | 33 ++ ...b-fusb302-Convert-to-use-GPIO-descriptors.patch | 162 ++++++++ ...-panel-Convert-rocktech-jh057n00900-to-ya.patch | 120 ++++++ ...-panel-Add-compatible-for-Xingbangda-XBD5.patch | 37 ++ ...ocktech-jh057n00900-Rename-the-driver-to-.patch | 91 +++++ ...t7703-Rename-functions-from-jh057n-prefix.patch | 265 +++++++++++++ ...t7703-Prepare-for-supporting-multiple-pan.patch | 129 +++++++ ...t7703-Move-code-specific-to-jh057n-closer.patch | 84 ++++ ...t7703-Move-generic-part-of-init-sequence-.patch | 84 ++++ ...-st7703-Add-support-for-Xingbangda-XBD599.patch | 251 ++++++++++++ ...anel-st7703-Enter-sleep-after-display-off.patch | 41 ++ ...t7703-Assert-reset-prior-to-powering-down.patch | 29 ++ ...un50i-a64-pinephone-Enable-LCD-support-on.patch | 112 ++++++ ...un50i-a64-pinephone-Add-touchscreen-suppo.patch | 47 +++ .../generic/CONFIG_DRM_PANEL_ROCKTECH_JH057N00900 | 1 - .../generic/CONFIG_DRM_PANEL_SITRONIX_ST7703 | 1 + .../generic/CONFIG_DRM_PANEL_XINGBANGDA_XBD599 | 1 - .../arm/aarch64/CONFIG_DRM_PANEL_XINGBANGDA_XBD599 | 1 - kernel-aarch64-debug-fedora.config | 3 +- kernel-aarch64-fedora.config | 3 +- kernel-armv7hl-debug-fedora.config | 3 +- kernel-armv7hl-fedora.config | 3 +- kernel-armv7hl-lpae-debug-fedora.config | 3 +- kernel-armv7hl-lpae-fedora.config | 3 +- kernel-i686-debug-fedora.config | 3 +- kernel-i686-fedora.config | 3 +- kernel-ppc64le-debug-fedora.config | 3 +- kernel-ppc64le-fedora.config | 3 +- kernel-s390x-debug-fedora.config | 3 +- kernel-s390x-fedora.config | 3 +- kernel-x86_64-debug-fedora.config | 3 +- kernel-x86_64-fedora.config | 3 +- kernel.spec | 22 +- 38 files changed, 1517 insertions(+), 705 deletions(-) delete mode 100644 0001-arm64-allwinner-dts-a64-add-LCD-related-device-nodes.patch delete mode 100644 0001-drm-panel-add-Xingbangda-XBD599-panel.patch delete mode 100644 0001-drm-sun4i-sun6i_mipi_dsi-fix-horizontal-timing-calcu.patch delete mode 100644 0001-dt-bindings-Add-doc-for-Pine64-Pinebook-Pro.patch delete mode 100644 0001-dt-bindings-panel-add-binding-for-Xingbangda-XBD599-.patch create mode 100644 0001-dt-bindings-vendor-prefixes-Add-Xingbangda.patch create mode 100644 0001-usb-fusb302-Convert-to-use-GPIO-descriptors.patch create mode 100644 0002-dt-bindings-panel-Convert-rocktech-jh057n00900-to-ya.patch create mode 100644 0003-dt-bindings-panel-Add-compatible-for-Xingbangda-XBD5.patch create mode 100644 0004-drm-panel-rocktech-jh057n00900-Rename-the-driver-to-.patch create mode 100644 0005-drm-panel-st7703-Rename-functions-from-jh057n-prefix.patch create mode 100644 0006-drm-panel-st7703-Prepare-for-supporting-multiple-pan.patch create mode 100644 0007-drm-panel-st7703-Move-code-specific-to-jh057n-closer.patch create mode 100644 0008-drm-panel-st7703-Move-generic-part-of-init-sequence-.patch create mode 100644 0009-drm-panel-st7703-Add-support-for-Xingbangda-XBD599.patch create mode 100644 0010-drm-panel-st7703-Enter-sleep-after-display-off.patch create mode 100644 0011-drm-panel-st7703-Assert-reset-prior-to-powering-down.patch create mode 100644 0012-arm64-dts-sun50i-a64-pinephone-Enable-LCD-support-on.patch create mode 100644 0013-arm64-dts-sun50i-a64-pinephone-Add-touchscreen-suppo.patch delete mode 100644 configs/fedora/generic/CONFIG_DRM_PANEL_ROCKTECH_JH057N00900 create mode 100644 configs/fedora/generic/CONFIG_DRM_PANEL_SITRONIX_ST7703 delete mode 100644 configs/fedora/generic/CONFIG_DRM_PANEL_XINGBANGDA_XBD599 delete mode 100644 configs/fedora/generic/arm/aarch64/CONFIG_DRM_PANEL_XINGBANGDA_XBD599 diff --git a/0001-arm64-allwinner-dts-a64-add-LCD-related-device-nodes.patch b/0001-arm64-allwinner-dts-a64-add-LCD-related-device-nodes.patch deleted file mode 100644 index e3b07c2bb..000000000 --- a/0001-arm64-allwinner-dts-a64-add-LCD-related-device-nodes.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Icenowy Zheng -Date: Mon, 16 Mar 2020 21:35:03 +0800 -Subject: [PATCH] arm64: allwinner: dts: a64: add LCD-related device nodes for - PinePhone - -PinePhone uses PWM backlight and a XBD599 LCD panel over DSI for -display. - -Add its device nodes. - -Signed-off-by: Icenowy Zheng ---- - .../dts/allwinner/sun50i-a64-pinephone.dtsi | 37 +++++++++++++++++++ - 1 file changed, 37 insertions(+) - -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi -index cefda145c3c9..96d9150423e0 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi -+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi -@@ -16,6 +16,15 @@ aliases { - serial0 = &uart0; - }; - -+ backlight: backlight { -+ compatible = "pwm-backlight"; -+ pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>; -+ brightness-levels = <0 16 18 20 22 24 26 29 32 35 38 42 46 51 56 62 68 75 83 91 100>; -+ default-brightness-level = <15>; -+ enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */ -+ power-supply = <®_ldo_io0>; -+ }; -+ - chosen { - stdout-path = "serial0:115200n8"; - }; -@@ -84,6 +93,30 @@ &dai { - status = "okay"; - }; - -+&de { -+ status = "okay"; -+}; -+ -+&dphy { -+ status = "okay"; -+}; -+ -+&dsi { -+ vcc-dsi-supply = <®_dldo1>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ panel@0 { -+ compatible = "xingbangda,xbd599"; -+ reg = <0>; -+ reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */ -+ iovcc-supply = <®_dldo2>; -+ vcc-supply = <®_ldo_io0>; -+ backlight = <&backlight>; -+ }; -+}; -+ - &ehci0 { - status = "okay"; - }; -@@ -188,6 +221,10 @@ &r_pio { - */ - }; - -+&r_pwm { -+ status = "okay"; -+}; -+ - &r_rsb { - status = "okay"; - --- -2.26.2 - diff --git a/0001-drm-panel-add-Xingbangda-XBD599-panel.patch b/0001-drm-panel-add-Xingbangda-XBD599-panel.patch deleted file mode 100644 index ae0850b8a..000000000 --- a/0001-drm-panel-add-Xingbangda-XBD599-panel.patch +++ /dev/null @@ -1,423 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Icenowy Zheng -Date: Mon, 16 Mar 2020 21:35:01 +0800 -Subject: [PATCH] drm: panel: add Xingbangda XBD599 panel - -Xingbangda XBD599 is a 5.99" 720x1440 MIPI-DSI IPS LCD panel made by -Xingbangda, which is used on PinePhone final assembled phones. - -Add support for it. - -Signed-off-by: Icenowy Zheng ---- - drivers/gpu/drm/panel/Kconfig | 9 + - drivers/gpu/drm/panel/Makefile | 1 + - .../gpu/drm/panel/panel-xingbangda-xbd599.c | 366 ++++++++++++++++++ - 3 files changed, 376 insertions(+) - create mode 100644 drivers/gpu/drm/panel/panel-xingbangda-xbd599.c - -diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig -index a1723c1b5fbf..cf0c59015a44 100644 ---- a/drivers/gpu/drm/panel/Kconfig -+++ b/drivers/gpu/drm/panel/Kconfig -@@ -433,6 +433,15 @@ config DRM_PANEL_TRULY_NT35597_WQXGA - Say Y here if you want to enable support for Truly NT35597 WQXGA Dual DSI - Video Mode panel - -+config DRM_PANEL_XINGBANGDA_XBD599 -+ tristate "Xingbangda XBD599 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 the Xingbangda XBD599 -+ MIPI DSI Video Mode panel. -+ - config DRM_PANEL_XINPENG_XPP055C272 - tristate "Xinpeng XPP055C272 panel driver" - depends on OF -diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile -index 96a883cd6630..c84ed5215984 100644 ---- a/drivers/gpu/drm/panel/Makefile -+++ b/drivers/gpu/drm/panel/Makefile -@@ -46,4 +46,5 @@ obj-$(CONFIG_DRM_PANEL_TPO_TD028TTEC1) += panel-tpo-td028ttec1.o - obj-$(CONFIG_DRM_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o - obj-$(CONFIG_DRM_PANEL_TPO_TPG110) += panel-tpo-tpg110.o - obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o -+obj-$(CONFIG_DRM_PANEL_XINGBANGDA_XBD599) += panel-xingbangda-xbd599.o - obj-$(CONFIG_DRM_PANEL_XINPENG_XPP055C272) += panel-xinpeng-xpp055c272.o -diff --git a/drivers/gpu/drm/panel/panel-xingbangda-xbd599.c b/drivers/gpu/drm/panel/panel-xingbangda-xbd599.c -new file mode 100644 -index 000000000000..b483f96ee1db ---- /dev/null -+++ b/drivers/gpu/drm/panel/panel-xingbangda-xbd599.c -@@ -0,0 +1,366 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Xingbangda XBD599 MIPI-DSI panel driver -+ * -+ * Copyright (C) 2019-2020 Icenowy Zheng -+ * -+ * Based on panel-rocktech-jh057n00900.c, which is: -+ * Copyright (C) Purism SPC 2019 -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+/* Manufacturer specific Commands send via DSI */ -+#define ST7703_CMD_ALL_PIXEL_OFF 0x22 -+#define ST7703_CMD_ALL_PIXEL_ON 0x23 -+#define ST7703_CMD_SETDISP 0xB2 -+#define ST7703_CMD_SETRGBIF 0xB3 -+#define ST7703_CMD_SETCYC 0xB4 -+#define ST7703_CMD_SETBGP 0xB5 -+#define ST7703_CMD_SETVCOM 0xB6 -+#define ST7703_CMD_SETOTP 0xB7 -+#define ST7703_CMD_SETPOWER_EXT 0xB8 -+#define ST7703_CMD_SETEXTC 0xB9 -+#define ST7703_CMD_SETMIPI 0xBA -+#define ST7703_CMD_SETVDC 0xBC -+#define ST7703_CMD_SETSCR 0xC0 -+#define ST7703_CMD_SETPOWER 0xC1 -+#define ST7703_CMD_UNK_C6 0xC6 -+#define ST7703_CMD_SETPANEL 0xCC -+#define ST7703_CMD_SETGAMMA 0xE0 -+#define ST7703_CMD_SETEQ 0xE3 -+#define ST7703_CMD_SETGIP1 0xE9 -+#define ST7703_CMD_SETGIP2 0xEA -+ -+static const char * const regulator_names[] = { -+ "iovcc", -+ "vcc", -+}; -+ -+struct xbd599 { -+ struct device *dev; -+ struct drm_panel panel; -+ struct gpio_desc *reset_gpio; -+ struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)]; -+ bool prepared; -+}; -+ -+static inline struct xbd599 *panel_to_xbd599(struct drm_panel *panel) -+{ -+ return container_of(panel, struct xbd599, panel); -+} -+ -+#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 xbd599 *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. -+ */ -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETEXTC, -+ 0xF1, 0x12, 0x83); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETMIPI, -+ 0x33, 0x81, 0x05, 0xF9, 0x0E, 0x0E, 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, 0x22, 0x20, 0x03); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETRGBIF, -+ 0x10, 0x10, 0x05, 0x05, 0x03, 0xFF, 0x00, 0x00, -+ 0x00, 0x00); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETSCR, -+ 0x73, 0x73, 0x50, 0x50, 0x00, 0xC0, 0x08, 0x70, -+ 0x00); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETVDC, 0x4E); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0B); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETCYC, 0x80); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETDISP, 0xF0, 0x12, 0xF0); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETEQ, -+ 0x00, 0x00, 0x0B, 0x0B, 0x10, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0xFF, 0x00, 0xC0, 0x10); -+ dsi_dcs_write_seq(dsi, 0xC6, 0x01, 0x00, 0xFF, 0xFF, 0x00); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER, -+ 0x74, 0x00, 0x32, 0x32, 0x77, 0xF1, 0xFF, 0xFF, -+ 0xCC, 0xCC, 0x77, 0x77); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP, 0x07, 0x07); -+ dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM, 0x2C, 0x2C); -+ dsi_dcs_write_seq(dsi, 0xBF, 0x02, 0x11, 0x00); -+ -+ 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); -+ 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); -+ 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); -+ msleep(20); -+ -+ ret = mipi_dsi_dcs_exit_sleep_mode(dsi); -+ if (ret < 0) { -+ DRM_DEV_ERROR(dev, "Failed to exit sleep mode\n"); -+ return ret; -+ } -+ msleep(250); -+ -+ ret = mipi_dsi_dcs_set_display_on(dsi); -+ if (ret) -+ return ret; -+ msleep(50); -+ -+ DRM_DEV_DEBUG_DRIVER(dev, "Panel init sequence done\n"); -+ return 0; -+} -+ -+static int xbd599_prepare(struct drm_panel *panel) -+{ -+ struct xbd599 *ctx = panel_to_xbd599(panel); -+ int ret; -+ -+ if (ctx->prepared) -+ return 0; -+ -+ ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); -+ if (ret) -+ return ret; -+ -+ DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n"); -+ gpiod_set_value_cansleep(ctx->reset_gpio, 1); -+ usleep_range(20, 40); -+ gpiod_set_value_cansleep(ctx->reset_gpio, 0); -+ msleep(20); -+ -+ ctx->prepared = true; -+ -+ return 0; -+} -+ -+static int xbd599_enable(struct drm_panel *panel) -+{ -+ struct xbd599 *ctx = panel_to_xbd599(panel); -+ int ret; -+ -+ ret = xbd599_init_sequence(ctx); -+ if (ret < 0) { -+ DRM_DEV_ERROR(ctx->dev, "Panel init sequence failed: %d\n", -+ ret); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int xbd599_disable(struct drm_panel *panel) -+{ -+ struct xbd599 *ctx = panel_to_xbd599(panel); -+ struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); -+ -+ return mipi_dsi_dcs_set_display_off(dsi); -+} -+ -+static int xbd599_unprepare(struct drm_panel *panel) -+{ -+ struct xbd599 *ctx = panel_to_xbd599(panel); -+ -+ if (!ctx->prepared) -+ return 0; -+ -+ gpiod_set_value_cansleep(ctx->reset_gpio, 1); -+ regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); -+ ctx->prepared = false; -+ -+ return 0; -+} -+ -+static const struct drm_display_mode xbd599_default_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, -+ .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, -+}; -+ -+static int xbd599_get_modes(struct drm_panel *panel, -+ struct drm_connector *connector) -+{ -+ struct xbd599 *ctx = panel_to_xbd599(panel); -+ struct drm_display_mode *mode; -+ -+ mode = drm_mode_duplicate(connector->dev, &xbd599_default_mode); -+ if (!mode) { -+ DRM_DEV_ERROR(ctx->dev, "Failed to add mode\n"); -+ return -ENOMEM; -+ } -+ -+ drm_mode_set_name(mode); -+ -+ mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; -+ connector->display_info.width_mm = mode->width_mm; -+ connector->display_info.height_mm = mode->height_mm; -+ drm_mode_probed_add(connector, mode); -+ -+ return 1; -+} -+ -+static const struct drm_panel_funcs xbd599_drm_funcs = { -+ .prepare = xbd599_prepare, -+ .enable = xbd599_enable, -+ .disable = xbd599_disable, -+ .unprepare = xbd599_unprepare, -+ .get_modes = xbd599_get_modes, -+}; -+ -+static int xbd599_probe(struct mipi_dsi_device *dsi) -+{ -+ struct device *dev = &dsi->dev; -+ struct xbd599 *ctx; -+ int i, ret; -+ -+ ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); -+ if (!ctx) -+ return -ENOMEM; -+ -+ for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) -+ ctx->supplies[i].supply = regulator_names[i]; -+ -+ ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), -+ ctx->supplies); -+ if (ret < 0) { -+ DRM_DEV_ERROR(&dsi->dev, "cannot get regulators\n"); -+ return ret; -+ } -+ -+ ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); -+ if (IS_ERR(ctx->reset_gpio)) { -+ DRM_DEV_ERROR(dev, "cannot get reset gpio\n"); -+ return PTR_ERR(ctx->reset_gpio); -+ } -+ -+ mipi_dsi_set_drvdata(dsi, ctx); -+ -+ ctx->dev = dev; -+ -+ dsi->lanes = 4; -+ dsi->format = MIPI_DSI_FMT_RGB888; -+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE; -+ -+ drm_panel_init(&ctx->panel, &dsi->dev, &xbd599_drm_funcs, -+ DRM_MODE_CONNECTOR_DSI); -+ -+ ret = drm_panel_of_backlight(&ctx->panel); -+ if (ret) -+ return ret; -+ -+ drm_panel_add(&ctx->panel); -+ -+ ret = mipi_dsi_attach(dsi); -+ if (ret < 0) { -+ DRM_DEV_ERROR(dev, "mipi_dsi_attach failed. Is host ready?\n"); -+ drm_panel_remove(&ctx->panel); -+ return ret; -+ } -+ -+ DRM_DEV_INFO(dev, "%ux%u@%u %ubpp dsi %udl - ready\n", -+ xbd599_default_mode.hdisplay, -+ xbd599_default_mode.vdisplay, -+ xbd599_default_mode.vrefresh, -+ mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); -+ -+ return 0; -+} -+ -+static void xbd599_shutdown(struct mipi_dsi_device *dsi) -+{ -+ struct xbd599 *ctx = mipi_dsi_get_drvdata(dsi); -+ int ret; -+ -+ ret = drm_panel_unprepare(&ctx->panel); -+ if (ret < 0) -+ DRM_DEV_ERROR(&dsi->dev, "Failed to unprepare panel: %d\n", -+ ret); -+} -+ -+static int xbd599_remove(struct mipi_dsi_device *dsi) -+{ -+ struct xbd599 *ctx = mipi_dsi_get_drvdata(dsi); -+ int ret; -+ -+ xbd599_shutdown(dsi); -+ -+ ret = mipi_dsi_detach(dsi); -+ if (ret < 0) -+ DRM_DEV_ERROR(&dsi->dev, "Failed to detach from DSI host: %d\n", -+ ret); -+ -+ drm_panel_remove(&ctx->panel); -+ -+ return 0; -+} -+ -+static const struct of_device_id xbd599_of_match[] = { -+ { .compatible = "xingbangda,xbd599", }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, xbd599_of_match); -+ -+static struct mipi_dsi_driver xbd599_driver = { -+ .probe = xbd599_probe, -+ .remove = xbd599_remove, -+ .shutdown = xbd599_shutdown, -+ .driver = { -+ .name = "panel-xingbangda-xbd599", -+ .of_match_table = xbd599_of_match, -+ }, -+}; -+module_mipi_dsi_driver(xbd599_driver); -+ -+MODULE_AUTHOR("Icenowy Zheng "); -+MODULE_DESCRIPTION("DRM driver for Xingbangda XBD599 MIPI DSI panel"); -+MODULE_LICENSE("GPL v2"); --- -2.26.2 - diff --git a/0001-drm-sun4i-sun6i_mipi_dsi-fix-horizontal-timing-calcu.patch b/0001-drm-sun4i-sun6i_mipi_dsi-fix-horizontal-timing-calcu.patch deleted file mode 100644 index f61b5490f..000000000 --- a/0001-drm-sun4i-sun6i_mipi_dsi-fix-horizontal-timing-calcu.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Icenowy Zheng -Date: Mon, 16 Mar 2020 21:35:02 +0800 -Subject: [PATCH] drm/sun4i: sun6i_mipi_dsi: fix horizontal timing calculation - -The max() function call in horizontal timing calculation shouldn't pad a -length already subtracted with overhead to overhead, instead it should -only prevent the set timing to underflow. - -Signed-off-by: Icenowy Zheng ---- - drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c -index 3eb89f1eb0e1..4e415793d155 100644 ---- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c -+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c -@@ -555,7 +555,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, - */ - #define HSA_PACKET_OVERHEAD 10 - hsa = max((unsigned int)HSA_PACKET_OVERHEAD, -- (mode->hsync_end - mode->hsync_start) * Bpp - HSA_PACKET_OVERHEAD); -+ (mode->hsync_end - mode->hsync_start) * Bpp) - HSA_PACKET_OVERHEAD; - - /* - * The backporch is set using a blanking packet (4 -@@ -564,7 +564,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, - */ - #define HBP_PACKET_OVERHEAD 6 - hbp = max((unsigned int)HBP_PACKET_OVERHEAD, -- (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD); -+ (mode->htotal - mode->hsync_end) * Bpp) - HBP_PACKET_OVERHEAD; - - /* - * The frontporch is set using a sync event (4 bytes) -@@ -574,7 +574,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, - */ - #define HFP_PACKET_OVERHEAD 16 - hfp = max((unsigned int)HFP_PACKET_OVERHEAD, -- (mode->hsync_start - mode->hdisplay) * Bpp - HFP_PACKET_OVERHEAD); -+ (mode->hsync_start - mode->hdisplay) * Bpp) - HFP_PACKET_OVERHEAD; - - /* - * The blanking is set using a sync event (4 bytes) -@@ -583,8 +583,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, - */ - #define HBLK_PACKET_OVERHEAD 10 - hblk = max((unsigned int)HBLK_PACKET_OVERHEAD, -- (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp - -- HBLK_PACKET_OVERHEAD); -+ (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp) - -+ HBLK_PACKET_OVERHEAD; - - /* - * And I'm not entirely sure what vblk is about. The driver in --- -2.26.2 - diff --git a/0001-dt-bindings-Add-doc-for-Pine64-Pinebook-Pro.patch b/0001-dt-bindings-Add-doc-for-Pine64-Pinebook-Pro.patch deleted file mode 100644 index f212fb501..000000000 --- a/0001-dt-bindings-Add-doc-for-Pine64-Pinebook-Pro.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Emmanuel Vadot -Date: Wed, 4 Mar 2020 22:30:22 +0100 -Subject: [PATCH] dt-bindings: Add doc for Pine64 Pinebook Pro - -Add a compatible for Pine64 Pinebook Pro - -Signed-off-by: Emmanuel Vadot -Reviewed-by: Rob Herring ---- - Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml -index 715586dea9bb..fff0439c6b78 100644 ---- a/Documentation/devicetree/bindings/arm/rockchip.yaml -+++ b/Documentation/devicetree/bindings/arm/rockchip.yaml -@@ -420,6 +420,11 @@ properties: - - const: pine64,rockpro64 - - const: rockchip,rk3399 - -+ - description: Pine64 PinebookPro -+ items: -+ - const: pine64,pinebook-pro -+ - const: rockchip,rk3399 -+ - - description: Radxa Rock - items: - - const: radxa,rock --- -2.26.2 - diff --git a/0001-dt-bindings-panel-add-binding-for-Xingbangda-XBD599-.patch b/0001-dt-bindings-panel-add-binding-for-Xingbangda-XBD599-.patch deleted file mode 100644 index 8e6808fdc..000000000 --- a/0001-dt-bindings-panel-add-binding-for-Xingbangda-XBD599-.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Icenowy Zheng -Date: Mon, 16 Mar 2020 21:35:00 +0800 -Subject: [PATCH] dt-bindings: panel: add binding for Xingbangda XBD599 panel - -Xingbangda XBD599 is a 5.99" 720x1440 MIPI-DSI LCD panel. - -Add its device tree binding. - -Signed-off-by: Icenowy Zheng ---- - .../display/panel/xingbangda,xbd599.yaml | 50 +++++++++++++++++++ - 1 file changed, 50 insertions(+) - create mode 100644 Documentation/devicetree/bindings/display/panel/xingbangda,xbd599.yaml - -diff --git a/Documentation/devicetree/bindings/display/panel/xingbangda,xbd599.yaml b/Documentation/devicetree/bindings/display/panel/xingbangda,xbd599.yaml -new file mode 100644 -index 000000000000..b27bcf11198f ---- /dev/null -+++ b/Documentation/devicetree/bindings/display/panel/xingbangda,xbd599.yaml -@@ -0,0 +1,50 @@ -+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/display/panel/xingbangda,xbd599.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Xingbangda XBD599 5.99in MIPI-DSI LCD panel -+ -+maintainers: -+ - Icenowy Zheng -+ -+allOf: -+ - $ref: panel-common.yaml# -+ -+properties: -+ compatible: -+ const: xingbangda,xbd599 -+ reg: true -+ backlight: true -+ reset-gpios: true -+ vcc-supply: -+ description: regulator that supplies the VCC voltage -+ iovcc-supply: -+ description: regulator that supplies the IOVCC voltage -+ -+required: -+ - compatible -+ - reg -+ - backlight -+ - vcc-supply -+ - iovcc-supply -+ -+additionalProperties: false -+ -+examples: -+ - | -+ dsi { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ panel@0 { -+ compatible = "xingbangda,xbd599"; -+ reg = <0>; -+ backlight = <&backlight>; -+ iovcc-supply = <®_dldo2>; -+ vcc-supply = <®_ldo_io0>; -+ }; -+ }; -+ -+... --- -2.26.2 - diff --git a/0001-dt-bindings-vendor-prefixes-Add-Xingbangda.patch b/0001-dt-bindings-vendor-prefixes-Add-Xingbangda.patch new file mode 100644 index 000000000..eef72a211 --- /dev/null +++ b/0001-dt-bindings-vendor-prefixes-Add-Xingbangda.patch @@ -0,0 +1,33 @@ +From 025eb2eb927d2c3020882ea0ed3af28d65321763 Mon Sep 17 00:00:00 2001 +From: Icenowy Zheng +Date: Fri, 26 Jun 2020 02:55:49 +0200 +Subject: [PATCH 01/13] dt-bindings: vendor-prefixes: Add Xingbangda + +Shenzhen Xingbangda Display Technology Co., Ltd is a company which +produces LCD modules. It supplies the LCD panels for the PinePhone. + +Add the vendor prefix of it. + +Signed-off-by: Icenowy Zheng +Signed-off-by: Ondrej Jirman +Acked-by: Rob Herring +--- + Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml +index d3891386d6710..a558ef87ee5b0 100644 +--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml ++++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml +@@ -1121,6 +1121,8 @@ patternProperties: + description: Xiaomi Technology Co., Ltd. + "^xillybus,.*": + description: Xillybus Ltd. ++ "^xingbangda,.*": ++ description: Shenzhen Xingbangda Display Technology Co., Ltd + "^xinpeng,.*": + description: Shenzhen Xinpeng Technology Co., Ltd + "^xlnx,.*": +-- +2.26.2 + diff --git a/0001-usb-fusb302-Convert-to-use-GPIO-descriptors.patch b/0001-usb-fusb302-Convert-to-use-GPIO-descriptors.patch new file mode 100644 index 000000000..40732340c --- /dev/null +++ b/0001-usb-fusb302-Convert-to-use-GPIO-descriptors.patch @@ -0,0 +1,162 @@ +From 2c36867719d93db8d7f365310587578ab980762c Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Wed, 15 Apr 2020 21:24:48 +0200 +Subject: [PATCH] usb: fusb302: Convert to use GPIO descriptors + +This converts the FUSB302 driver to use GPIO descriptors. +The conversion to descriptors per se is pretty straight-forward. + +In the process I discovered that: + +1. The driver uses a completely undocumented device tree binding + for the interrupt GPIO line, "fcs,int_n". Ooops. + +2. The undocumented binding, presumably since it has not seen + review, is just "fcs,int_n", lacking the compulsory "-gpios" + suffix and also something that is not a good name because + the "_n" implies the line is inverted which is something we + handle with flags in the device tree. Ooops. + +3. Possibly the driver should not be requesting the line as a + GPIO and request the corresponding interrupt line by open + coding, the GPIO chip is very likely doubleing as an IRQ + controller and can probably provide an interrupt directly + for this line with interrupts-extended = <&gpio0 ...>; + +4. Possibly the IRQ should just be tagged on the I2C client node + in the device tree like apparently ACPI does, as it overrides + this IRQ with client->irq if that exists. + +But now it is too late to do much about that and as I can see +this is used like this in the Pinebook which is a shipping product +so let'a just contain the mess and move on. + +The property currently appears in: +arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts + +Create a quirk in the GPIO OF library to allow this property +specifically to be specified without the "-gpios" suffix, we have +other such bindings already. + +Cc: Tobias Schramm +Cc: Heikki Krogerus +Cc: Yueyao Zhu +Cc: Guenter Roeck +Cc: devicetree@vger.kernel.org +Signed-off-by: Linus Walleij +Link: https://lore.kernel.org/r/20200415192448.305257-1-linus.walleij@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpio/gpiolib-of.c | 21 +++++++++++++++++++++ + drivers/usb/typec/tcpm/fusb302.c | 32 +++++++++----------------------- + 2 files changed, 30 insertions(+), 23 deletions(-) + +diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c +index ccc449df3792a..20c2c428168e4 100644 +--- a/drivers/gpio/gpiolib-of.c ++++ b/drivers/gpio/gpiolib-of.c +@@ -460,6 +460,24 @@ static struct gpio_desc *of_find_arizona_gpio(struct device *dev, + return of_get_named_gpiod_flags(dev->of_node, con_id, 0, of_flags); + } + ++static struct gpio_desc *of_find_usb_gpio(struct device *dev, ++ const char *con_id, ++ enum of_gpio_flags *of_flags) ++{ ++ /* ++ * Currently this USB quirk is only for the Fairchild FUSB302 host which is using ++ * an undocumented DT GPIO line named "fcs,int_n" without the compulsory "-gpios" ++ * suffix. ++ */ ++ if (!IS_ENABLED(CONFIG_TYPEC_FUSB302)) ++ return ERR_PTR(-ENOENT); ++ ++ if (!con_id || strcmp(con_id, "fcs,int_n")) ++ return ERR_PTR(-ENOENT); ++ ++ return of_get_named_gpiod_flags(dev->of_node, con_id, 0, of_flags); ++} ++ + struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, + unsigned int idx, unsigned long *flags) + { +@@ -504,6 +522,9 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, + if (PTR_ERR(desc) == -ENOENT) + desc = of_find_arizona_gpio(dev, con_id, &of_flags); + ++ if (PTR_ERR(desc) == -ENOENT) ++ desc = of_find_usb_gpio(dev, con_id, &of_flags); ++ + if (IS_ERR(desc)) + return desc; + +diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c +index b498960ff72b5..b28facece43c4 100644 +--- a/drivers/usb/typec/tcpm/fusb302.c ++++ b/drivers/usb/typec/tcpm/fusb302.c +@@ -9,14 +9,13 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include + #include + #include + #include +-#include + #include + #include + #include +@@ -83,7 +82,7 @@ struct fusb302_chip { + struct work_struct irq_work; + bool irq_suspended; + bool irq_while_suspended; +- int gpio_int_n; ++ struct gpio_desc *gpio_int_n; + int gpio_int_n_irq; + struct extcon_dev *extcon; + +@@ -1618,30 +1617,17 @@ static void fusb302_irq_work(struct work_struct *work) + + static int init_gpio(struct fusb302_chip *chip) + { +- struct device_node *node; ++ struct device *dev = chip->dev; + int ret = 0; + +- node = chip->dev->of_node; +- chip->gpio_int_n = of_get_named_gpio(node, "fcs,int_n", 0); +- if (!gpio_is_valid(chip->gpio_int_n)) { +- ret = chip->gpio_int_n; +- dev_err(chip->dev, "cannot get named GPIO Int_N, ret=%d", ret); +- return ret; +- } +- ret = devm_gpio_request(chip->dev, chip->gpio_int_n, "fcs,int_n"); +- if (ret < 0) { +- dev_err(chip->dev, "cannot request GPIO Int_N, ret=%d", ret); +- return ret; +- } +- ret = gpio_direction_input(chip->gpio_int_n); +- if (ret < 0) { +- dev_err(chip->dev, +- "cannot set GPIO Int_N to input, ret=%d", ret); +- return ret; ++ chip->gpio_int_n = devm_gpiod_get(dev, "fcs,int_n", GPIOD_IN); ++ if (IS_ERR(chip->gpio_int_n)) { ++ dev_err(dev, "failed to request gpio_int_n\n"); ++ return PTR_ERR(chip->gpio_int_n); + } +- ret = gpio_to_irq(chip->gpio_int_n); ++ ret = gpiod_to_irq(chip->gpio_int_n); + if (ret < 0) { +- dev_err(chip->dev, ++ dev_err(dev, + "cannot request IRQ for GPIO Int_N, ret=%d", ret); + return ret; + } +-- +2.26.2 + diff --git a/0002-dt-bindings-panel-Convert-rocktech-jh057n00900-to-ya.patch b/0002-dt-bindings-panel-Convert-rocktech-jh057n00900-to-ya.patch new file mode 100644 index 000000000..0d05e02e0 --- /dev/null +++ b/0002-dt-bindings-panel-Convert-rocktech-jh057n00900-to-ya.patch @@ -0,0 +1,120 @@ +From 789d3f52a1cf675ba68c3578fe2b259bc44caba2 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:50 +0200 +Subject: [PATCH 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 +--- + .../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 a372c5d846956..0000000000000 +--- 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 = <®_2v8_p>; +- iovcc-supply = <®_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 0000000000000..f97c48550741c +--- /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 ++ ++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 ++ ++ vccio-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 ++ - vccio-supply ++ - reset-gpios ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ ++ dsi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ panel@0 { ++ compatible = "rocktech,jh057n00900"; ++ reg = <0>; ++ vcc-supply = <®_2v8_p>; ++ iovcc-supply = <®_1v8_p>; ++ reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; ++ backlight = <&backlight>; ++ }; ++ }; ++... +-- +2.26.2 + diff --git a/0003-dt-bindings-panel-Add-compatible-for-Xingbangda-XBD5.patch b/0003-dt-bindings-panel-Add-compatible-for-Xingbangda-XBD5.patch new file mode 100644 index 000000000..a7099de05 --- /dev/null +++ b/0003-dt-bindings-panel-Add-compatible-for-Xingbangda-XBD5.patch @@ -0,0 +1,37 @@ +From 12146093602e0dedb7ee431224fc4a58d40697f8 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:51 +0200 +Subject: [PATCH 03/13] dt-bindings: panel: Add compatible for Xingbangda + XBD599 panel + +Xingbangda XBD599 is a 5.99" 720x1440 MIPI-DSI LCD panel. It is based on +Sitronix ST7703 LCD controller just like rocktech,jh057n00900. It is +used in PinePhone. + +Add a compatible for it. + +Signed-off-by: Ondrej Jirman +--- + .../bindings/display/panel/rocktech,jh057n00900.yaml | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml +index f97c48550741c..4d43a1b36d7c7 100644 +--- a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml ++++ b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml +@@ -18,7 +18,11 @@ allOf: + + properties: + compatible: +- const: rocktech,jh057n00900 ++ enum: ++ # Rocktech JH057N00900 5.5" 720x1440 TFT LCD panel ++ - rocktech,jh057n00900 ++ # Xingbangda XBD599 5.99" 720x1440 TFT LCD panel ++ - xingbangda,xbd599 + + reg: + maxItems: 1 +-- +2.26.2 + diff --git a/0004-drm-panel-rocktech-jh057n00900-Rename-the-driver-to-.patch b/0004-drm-panel-rocktech-jh057n00900-Rename-the-driver-to-.patch new file mode 100644 index 000000000..c4c947641 --- /dev/null +++ b/0004-drm-panel-rocktech-jh057n00900-Rename-the-driver-to-.patch @@ -0,0 +1,91 @@ +From e82044df3332199c63904d86b4b1ad0963a6f8e0 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:52 +0200 +Subject: [PATCH 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 +--- + 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 a1723c1b5fbf8..7cf1f160fdd51 100644 +--- a/drivers/gpu/drm/panel/Kconfig ++++ b/drivers/gpu/drm/panel/Kconfig +@@ -262,19 +262,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 +@@ -374,6 +361,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 96a883cd66305..0519fdf0710d5 100644 +--- a/drivers/gpu/drm/panel/Makefile ++++ b/drivers/gpu/drm/panel/Makefile +@@ -25,7 +25,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 +@@ -39,6 +38,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.26.2 + diff --git a/0005-drm-panel-st7703-Rename-functions-from-jh057n-prefix.patch b/0005-drm-panel-st7703-Rename-functions-from-jh057n-prefix.patch new file mode 100644 index 000000000..5432e1bba --- /dev/null +++ b/0005-drm-panel-st7703-Rename-functions-from-jh057n-prefix.patch @@ -0,0 +1,265 @@ +From 6fad8493b27ade51f37d88acc7ce6fd7dbc9da69 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:53 +0200 +Subject: [PATCH 05/13] drm/panel: st7703: Rename functions from jh057n prefix + to st7703 + +This is done so that code that's not specific to a particular +jh057n panel is named after the controller. Functions specific +to the panel are kept named after the panel. + +Signed-off-by: Ondrej Jirman +--- + drivers/gpu/drm/panel/panel-sitronix-st7703.c | 90 ++++++++++--------- + 1 file changed, 46 insertions(+), 44 deletions(-) + +diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +index 38ff742bc1209..511af659f273b 100644 +--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c ++++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +@@ -1,6 +1,8 @@ + // SPDX-License-Identifier: GPL-2.0 + /* +- * Rockteck jh057n00900 5.5" MIPI-DSI panel driver ++ * Driver for panels based on Sitronix ST7703 controller, souch as: ++ * ++ * - Rocktech jh057n00900 5.5" MIPI-DSI panel + * + * Copyright (C) Purism SPC 2019 + */ +@@ -21,7 +23,7 @@ + #include + #include + +-#define DRV_NAME "panel-rocktech-jh057n00900" ++#define DRV_NAME "panel-sitronix-st7703" + + /* Manufacturer specific Commands send via DSI */ + #define ST7703_CMD_ALL_PIXEL_OFF 0x22 +@@ -45,7 +47,7 @@ + #define ST7703_CMD_SETGIP1 0xE9 + #define ST7703_CMD_SETGIP2 0xEA + +-struct jh057n { ++struct st7703 { + struct device *dev; + struct drm_panel panel; + struct gpio_desc *reset_gpio; +@@ -56,9 +58,9 @@ struct jh057n { + struct dentry *debugfs; + }; + +-static inline struct jh057n *panel_to_jh057n(struct drm_panel *panel) ++static inline struct st7703 *panel_to_st7703(struct drm_panel *panel) + { +- return container_of(panel, struct jh057n, panel); ++ return container_of(panel, struct st7703, panel); + } + + #define dsi_generic_write_seq(dsi, seq...) do { \ +@@ -69,7 +71,7 @@ static inline struct jh057n *panel_to_jh057n(struct drm_panel *panel) + return ret; \ + } while (0) + +-static int jh057n_init_sequence(struct jh057n *ctx) ++static int jh057n_init_sequence(struct st7703 *ctx) + { + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); + struct device *dev = ctx->dev; +@@ -141,9 +143,9 @@ static int jh057n_init_sequence(struct jh057n *ctx) + return 0; + } + +-static int jh057n_enable(struct drm_panel *panel) ++static int st7703_enable(struct drm_panel *panel) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + int ret; + + ret = jh057n_init_sequence(ctx); +@@ -156,17 +158,17 @@ static int jh057n_enable(struct drm_panel *panel) + return 0; + } + +-static int jh057n_disable(struct drm_panel *panel) ++static int st7703_disable(struct drm_panel *panel) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); + + return mipi_dsi_dcs_set_display_off(dsi); + } + +-static int jh057n_unprepare(struct drm_panel *panel) ++static int st7703_unprepare(struct drm_panel *panel) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + + if (!ctx->prepared) + return 0; +@@ -178,9 +180,9 @@ static int jh057n_unprepare(struct drm_panel *panel) + return 0; + } + +-static int jh057n_prepare(struct drm_panel *panel) ++static int st7703_prepare(struct drm_panel *panel) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + int ret; + + if (ctx->prepared) +@@ -230,10 +232,10 @@ static const struct drm_display_mode default_mode = { + .height_mm = 130, + }; + +-static int jh057n_get_modes(struct drm_panel *panel, ++static int st7703_get_modes(struct drm_panel *panel, + struct drm_connector *connector) + { +- struct jh057n *ctx = panel_to_jh057n(panel); ++ struct st7703 *ctx = panel_to_st7703(panel); + struct drm_display_mode *mode; + + mode = drm_mode_duplicate(connector->dev, &default_mode); +@@ -254,17 +256,17 @@ static int jh057n_get_modes(struct drm_panel *panel, + return 1; + } + +-static const struct drm_panel_funcs jh057n_drm_funcs = { +- .disable = jh057n_disable, +- .unprepare = jh057n_unprepare, +- .prepare = jh057n_prepare, +- .enable = jh057n_enable, +- .get_modes = jh057n_get_modes, ++static const struct drm_panel_funcs st7703_drm_funcs = { ++ .disable = st7703_disable, ++ .unprepare = st7703_unprepare, ++ .prepare = st7703_prepare, ++ .enable = st7703_enable, ++ .get_modes = st7703_get_modes, + }; + + static int allpixelson_set(void *data, u64 val) + { +- struct jh057n *ctx = data; ++ struct st7703 *ctx = data; + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); + + DRM_DEV_DEBUG_DRIVER(ctx->dev, "Setting all pixels on\n"); +@@ -282,7 +284,7 @@ static int allpixelson_set(void *data, u64 val) + DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL, + allpixelson_set, "%llu\n"); + +-static void jh057n_debugfs_init(struct jh057n *ctx) ++static void st7703_debugfs_init(struct st7703 *ctx) + { + ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL); + +@@ -290,16 +292,16 @@ static void jh057n_debugfs_init(struct jh057n *ctx) + &allpixelson_fops); + } + +-static void jh057n_debugfs_remove(struct jh057n *ctx) ++static void st7703_debugfs_remove(struct st7703 *ctx) + { + debugfs_remove_recursive(ctx->debugfs); + ctx->debugfs = NULL; + } + +-static int jh057n_probe(struct mipi_dsi_device *dsi) ++static int st7703_probe(struct mipi_dsi_device *dsi) + { + struct device *dev = &dsi->dev; +- struct jh057n *ctx; ++ struct st7703 *ctx; + int ret; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); +@@ -340,7 +342,7 @@ static int jh057n_probe(struct mipi_dsi_device *dsi) + return ret; + } + +- drm_panel_init(&ctx->panel, dev, &jh057n_drm_funcs, ++ drm_panel_init(&ctx->panel, dev, &st7703_drm_funcs, + DRM_MODE_CONNECTOR_DSI); + + ret = drm_panel_of_backlight(&ctx->panel); +@@ -363,13 +365,13 @@ static int jh057n_probe(struct mipi_dsi_device *dsi) + default_mode.vrefresh, + mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); + +- jh057n_debugfs_init(ctx); ++ st7703_debugfs_init(ctx); + return 0; + } + +-static void jh057n_shutdown(struct mipi_dsi_device *dsi) ++static void st7703_shutdown(struct mipi_dsi_device *dsi) + { +- struct jh057n *ctx = mipi_dsi_get_drvdata(dsi); ++ struct st7703 *ctx = mipi_dsi_get_drvdata(dsi); + int ret; + + ret = drm_panel_unprepare(&ctx->panel); +@@ -383,12 +385,12 @@ static void jh057n_shutdown(struct mipi_dsi_device *dsi) + ret); + } + +-static int jh057n_remove(struct mipi_dsi_device *dsi) ++static int st7703_remove(struct mipi_dsi_device *dsi) + { +- struct jh057n *ctx = mipi_dsi_get_drvdata(dsi); ++ struct st7703 *ctx = mipi_dsi_get_drvdata(dsi); + int ret; + +- jh057n_shutdown(dsi); ++ st7703_shutdown(dsi); + + ret = mipi_dsi_detach(dsi); + if (ret < 0) +@@ -397,28 +399,28 @@ static int jh057n_remove(struct mipi_dsi_device *dsi) + + drm_panel_remove(&ctx->panel); + +- jh057n_debugfs_remove(ctx); ++ st7703_debugfs_remove(ctx); + + return 0; + } + +-static const struct of_device_id jh057n_of_match[] = { ++static const struct of_device_id st7703_of_match[] = { + { .compatible = "rocktech,jh057n00900" }, + { /* sentinel */ } + }; +-MODULE_DEVICE_TABLE(of, jh057n_of_match); ++MODULE_DEVICE_TABLE(of, st7703_of_match); + +-static struct mipi_dsi_driver jh057n_driver = { +- .probe = jh057n_probe, +- .remove = jh057n_remove, +- .shutdown = jh057n_shutdown, ++static struct mipi_dsi_driver st7703_driver = { ++ .probe = st7703_probe, ++ .remove = st7703_remove, ++ .shutdown = st7703_shutdown, + .driver = { + .name = DRV_NAME, +- .of_match_table = jh057n_of_match, ++ .of_match_table = st7703_of_match, + }, + }; +-module_mipi_dsi_driver(jh057n_driver); ++module_mipi_dsi_driver(st7703_driver); + + MODULE_AUTHOR("Guido Günther "); +-MODULE_DESCRIPTION("DRM driver for Rocktech JH057N00900 MIPI DSI panel"); ++MODULE_DESCRIPTION("DRM driver for Sitronix ST7703 based MIPI DSI panels"); + MODULE_LICENSE("GPL v2"); +-- +2.26.2 + diff --git a/0006-drm-panel-st7703-Prepare-for-supporting-multiple-pan.patch b/0006-drm-panel-st7703-Prepare-for-supporting-multiple-pan.patch new file mode 100644 index 000000000..8436ea3cb --- /dev/null +++ b/0006-drm-panel-st7703-Prepare-for-supporting-multiple-pan.patch @@ -0,0 +1,129 @@ +From 19802e031428f7cf967259fdf8794a971164a44a Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Fri, 26 Jun 2020 02:55:54 +0200 +Subject: [PATCH 06/13] drm/panel: st7703: Prepare for supporting multiple + panels + +Parametrize the driver so that it can support more panels based +on st7703 controller. + +Signed-off-by: Ondrej Jirman +--- + drivers/gpu/drm/panel/panel-sitronix-st7703.c | 43 +++++++++++++------ + 1 file changed, 31 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +index 511af659f273b..08cbc316266c1 100644 +--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c ++++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + + #include