Skip to content
Snippets Groups Projects
Verified Commit 5bc6a220 authored by minute's avatar minute
Browse files

pocket panel: v2 of display recognition that works on imx8mp+rk3588

parent 10d393e2
No related branches found
No related tags found
Loading
......@@ -825,6 +825,9 @@
// actually backlight enable
enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
burst-mode;
// the dsi mode for this controller while
// recognizing display v1 vs v2
probe-mode-lpm;
port {
panel_in: endpoint {
......
commit 756b9cc53f10c5e2b179a11c032c09155ffd20dc
commit d789b6fd747fd6d921c90532e4decc1bd5034b45
Author: Lukas F. Hartmann <lukas@mntre.com>
Date: Fri Nov 29 14:48:42 2024 +0100
Date: Tue Dec 3 00:25:28 2024 +0100
Add multi display panel driver for MNT Pocket Reform based on old JDI driver
V2: Add multi display panel driver for MNT Pocket Reform based on old JDI driver
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 9f49b01..6a80933 100644
......@@ -40,10 +40,10 @@ index 5581387..9058011 100644
obj-$(CONFIG_DRM_PANEL_NEWVISION_NV3052C) += panel-newvision-nv3052c.o
diff --git a/drivers/gpu/drm/panel/panel-mnt-pocket-reform.c b/drivers/gpu/drm/panel/panel-mnt-pocket-reform.c
new file mode 100644
index 0000000..4f3ba3c
index 0000000..2054ae5
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-mnt-pocket-reform.c
@@ -0,0 +1,779 @@
@@ -0,0 +1,798 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2016 InforceComputing
......@@ -97,9 +97,26 @@ index 0000000..4f3ba3c
+ struct jdi_panel *jdi = (struct jdi_panel *)dev_get_drvdata(dev);
+ return sprintf(buf, "%d\n", jdi->panel_version);
+}
+static ssize_t panel_dcs_read_attr_show(struct device *dev, struct device_attribute *attr, char *buf) {
+ return sprintf(buf, "%d\n", 0);
+}
+static ssize_t panel_dcs_read_attr_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
+ struct jdi_panel *jdi = (struct jdi_panel *)dev_get_drvdata(dev);
+ long command;
+ int ret = (int)kstrtol(buf, 10, &command);
+ u8 readval = 0;
+ if (ret == 0 && command > 0) {
+ jdi->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
+ mipi_dsi_dcs_read(jdi->dsi, (int)command, &readval, sizeof(readval));
+ dev_err(dev, "[mnt pocket reform display] DCS command %d read result: 0x%x\n", (int)command, (int)readval);
+ }
+ return count;
+}
+static DEVICE_ATTR(mnt_pocket_reform_panel_version, 0444, panel_version_attr_show, NULL);
+static DEVICE_ATTR(mnt_pocket_reform_panel_dcs_read, 0644, panel_dcs_read_attr_show, panel_dcs_read_attr_store);
+static struct attribute *mnt_pocket_reform_panel_attrs[] = {
+ &dev_attr_mnt_pocket_reform_panel_version.attr,
+ &dev_attr_mnt_pocket_reform_panel_dcs_read.attr,
+ NULL
+};
+static const struct attribute_group mnt_pocket_reform_panel_attr_group = {
......@@ -495,25 +512,38 @@ index 0000000..4f3ba3c
+ struct mipi_dsi_device *dsi = jdi->dsi;
+ struct device *dev = &jdi->dsi->dev;
+ int ret;
+ u16 readval;
+ u8 readval = 0;
+
+ dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+ msleep(20);
+ if (of_property_present(dsi->dev.of_node, "probe-mode-lpm")) {
+ // imx8mplus
+ dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+ } else {
+ // rk3588
+ dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
+ }
+
+ mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_ID, &readval, sizeof(readval));
+ dev_err(dev, "[mnt pocket reform display] DCS display id: 0x%x\n", (int)readval);
+ if (!jdi->panel_version) {
+ mipi_dsi_dcs_read(dsi, 12, &readval, sizeof(readval));
+ dev_err(dev, "[mnt pocket reform display] read register 12: 0x%x\n", (int)readval);
+
+ if (readval == 0x84e8) {
+ jdi->panel_version = 2;
+ __global_mnt_pocket_reform_panel_version = 2;
+ if (readval == 0x77) {
+ jdi->panel_version = 1;
+ __global_mnt_pocket_reform_panel_version = 1;
+ } else {
+ jdi->panel_version = 2;
+ __global_mnt_pocket_reform_panel_version = 2;
+ }
+ }
+
+ if (jdi->panel_version == 2) {
+ dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+ // panel v2 doesn't like HSE
+ dsi->mode_flags &= ~MIPI_DSI_MODE_VIDEO_HSE;
+ dsi->mode_flags &= ~(MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_NO_HFP | MIPI_DSI_MODE_VIDEO_NO_HBP | MIPI_DSI_MODE_VIDEO_NO_HSA);
+
+ pocket_display_v2_init(jdi);
+ } else {
+ jdi->panel_version = 1;
+ __global_mnt_pocket_reform_panel_version = 1;
+ pocket_display_v1_init(jdi);
+
+ if (!jdi->backlight) {
+ jdi->backlight = drm_panel_create_dsi_backlight(jdi);
+ if (IS_ERR(jdi->backlight))
......@@ -529,17 +559,6 @@ index 0000000..4f3ba3c
+{
+ struct jdi_panel *jdi = to_jdi_panel(panel);
+
+ mipi_dsi_dcs_set_display_off(jdi->dsi);
+ if (jdi->panel_version < 2) {
+ mipi_dsi_dcs_enter_sleep_mode(jdi->dsi);
+ }
+
+ msleep(100);
+
+ if (jdi->backlight) {
+ backlight_disable(jdi->backlight);
+ }
+
+ jdi->enabled = false;
+
+ return 0;
......
......@@ -988,6 +988,7 @@
&dsi1 {
status = "okay";
rockchip,lane-rate = <972000>;
panel {
compatible = "jdi,lt070me05000";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment