Skip to contentSkip to conversation

Add support for rm69299 Visionox panel driver and add devicetree bindings for visionox panel

PATCH Superseded Harigovindan P 2 participants 4 messages Mar 9, 2020

Subsystems (5)

v5 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add support for rm69299 Visionox panel driver and add devicetree bindings for visionox panel

Adding support for visionox rm69299 panel driver and adding bindings for the same panel.

Harigovindan P (2):
dt-bindings: display: add visionox rm69299 panel variant drm/panel: add support for rm69299 visionox panel driver

 .../display/panel/visionox,rm69299.yaml       |  85 +++++
 drivers/gpu/drm/panel/Kconfig                 |   8 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-visionox-rm69299.c    | 315 ++++++++++++++++++
 4 files changed, 409 insertions(+)
 create mode 100755 Documentation/devicetree/bindings/display/panel/visionox,rm69299.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-visionox-rm69299.c
Signature · 1 line
2.25.1
#2 lore raw

PATCH v5 2/2 drm/panel: add support for rm69299 visionox panel driver

Add support for Visionox panel driver.

---

Changes in v2:
- Dropping redundant space in Kconfig(Sam Ravnborg).
- Changing structure for include files(Sam Ravnborg).
- Removing backlight related code and functions(Sam Ravnborg).
- Removing repeated printing of error message(Sam Ravnborg).
- Adding drm_connector as an argument for get_modes function.
Changes in v3:
- Adding arguments for drm_panel_init to support against mainline.
Changes in v4:
- Removing error messages from regulator_set_load.
- Removing dev struct entry.
- Removing checks.
- Dropping empty comment lines.
Changes in v5:
- Removing unused struct member variables.
- Removing blank lines.
- Fixed indentation.
- Invoking dsi_detach and panel_remove while early exiting from probe.

 drivers/gpu/drm/panel/Kconfig                 |   8 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-visionox-rm69299.c    | 315 ++++++++++++++++++
 3 files changed, 324 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-visionox-rm69299.c
drivers/gpu/drm/panel/Kconfig +8 -0
index ae44ac2ec106..7b696f304a99 100644
@@ -389,6 +389,14 @@ 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_VISIONOX_RM69299
+	tristate "Visionox RM69299"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	help
+	  Say Y here if you want to enable support for Visionox
+	  RM69299  DSI Video Mode panel.
+
 config DRM_PANEL_XINPENG_XPP055C272
 	tristate "Xinpeng XPP055C272 panel driver"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 7c4d3c581fd4..9f11d067a6b2 100644
@@ -41,4 +41,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_VISIONOX_RM69299) += panel-visionox-rm69299.o
 obj-$(CONFIG_DRM_PANEL_XINPENG_XPP055C272) += panel-xinpeng-xpp055c272.o
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +315 -0

315 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

PATCH v5 1/2 dt-bindings: display: add visionox rm69299 panel variant

In reply to Harigovindan P

Add bindings for visionox rm69299 panel.

---

Changes in v2:
- Removed unwanted properties from description.
- Creating source files without execute permissions(Rob Herring).
Changes in v3:
- Changing txt file into yaml
Changes in v4:
- Updating license identifier.
- Moving yaml file inside panel directory.
- Removing pinctrl entries.
- Adding documentation for reset-gpios.
Changes in v5:
- No changes. Updated 2/2 Patch.

 .../display/panel/visionox,rm69299.yaml       | 85 +++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100755 Documentation/devicetree/bindings/display/panel/visionox,rm69299.yaml
Documentation/devicetree/bindings/display/panel/visionox,rm69299.yaml new file +85 -0
new file mode 100755
index 000000000000..052d87f8fadd
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/visionox,rm69299.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Visionox model RM69299 Panels Device Tree Bindings.
+
+maintainers:
+ - Harigovindan P <[email protected]>
+
+description: |
+ This binding is for display panels using a Visionox RM692999 panel.
+
+allOf:
+ - $ref: panel-common.yaml#
+
+patternProperties:
+  "^(panel|panel-dsi)@[0-9]$":
+    type: object
+    properties:
+      compatible:
+        const: visionox,rm69299-1080p-display
+
+      reg:
+        maxItems: 1
+
+      vdda-supply:
+        description:
+          Phandle of the regulator that provides the vdda supply voltage.
+
+      vdd3p3-supply:
+        description:
+          Phandle of the regulator that provides the vdd3p3 supply voltage.
+
+      ports:
+        type: object
+        description:
+          A node containing DSI input & output port nodes with endpoint
+          definitions as documented in
+          Documentation/devicetree/bindings/media/video-interfaces.txt
+          Documentation/devicetree/bindings/graph.txt
+        properties:
+          port@0:
+            type: object
+            description:
+              DSI input port node.
+
+      reset-gpios:
+        description:
+          a GPIO spec for the reset pin.
+
+required:
+  - compatible
+  - reg
+  - vdda-supply
+  - vdd3p3-supply
+  - reset-gpios
+
+additionalProperties: false
+
+examples:
+- |
+    dsi@ae94000 {
+        panel@0 {
+            compatible = "visionox,rm69299-1080p-display";
+
+            vdda-supply = <&src_pp1800_l8c>;
+            vdd3p3-supply = <&src_pp2800_l18a>;
+
+            reset-gpios = <&pm6150l_gpio 3 0>;
+            ports {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+                    port@0 {
+                            reg = <0>;
+                            panel0_in: endpoint {
+                                remote-endpoint = <&dsi0_out>;
+                            };
+                    };
+            };
+        };
+    };
+...
+
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH v5 2/2] drm/panel: add support for rm69299 visionox panel driver

In reply to Harigovindan P

Hi,

Quoted 37 lines · Harigovindan P

Add support for Visionox panel driver.

---

Changes in v2:
- Dropping redundant space in Kconfig(Sam Ravnborg).
- Changing structure for include files(Sam Ravnborg).
- Removing backlight related code and functions(Sam Ravnborg).
- Removing repeated printing of error message(Sam Ravnborg).
- Adding drm_connector as an argument for get_modes function.
Changes in v3:
- Adding arguments for drm_panel_init to support against mainline.
Changes in v4:
- Removing error messages from regulator_set_load.
- Removing dev struct entry.
- Removing checks.
- Dropping empty comment lines.
Changes in v5:
- Removing unused struct member variables.
- Removing blank lines.
- Fixed indentation.
- Invoking dsi_detach and panel_remove while early exiting from probe.

 drivers/gpu/drm/panel/Kconfig                 |   8 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-visionox-rm69299.c    | 315 ++++++++++++++++++
 3 files changed, 324 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-visionox-rm69299.c

...

drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +0 -0
new file mode 100644
index 000000000000..2bd3af46d933

drivers/gpu/drm/panel/panel-visionox-rm69299.c line 41

Quoted 5 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +2 -0
 
...
 
+static int visionox_35597_power_on(struct visionox_rm69299 *ctx)
+{

s/35597/rm69299/ ?

drivers/gpu/drm/panel/panel-visionox-rm69299.c line 218

Quoted 5 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +5 -0
+static const struct rm69299_config rm69299_dir = {
+	.width_mm = 74,
+	.height_mm = 131,
+	.dm = &visionox_rm69299_1080x2248_60hz,
+};

Are there actually variants of the panel with different sizes? So far the driver supports a single type of panel, so I would say struct rm69299_config is not needed. It can be added later if the driver ever gets support for other panel variants. For now just assign the values directly in 'visionox_rm69299_get_modes'.

Quoted 7 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +7 -0
+static int visionox_rm69299_probe(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	struct visionox_rm69299 *ctx;
+	int ret;
+
+	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);

drivers/gpu/drm/panel/panel-visionox-rm69299.c line 236

Quoted 10 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +10 -0
+	if (!ctx)
+		return -ENOMEM;
+
+	mipi_dsi_set_drvdata(dsi, ctx);
+
+	ctx->supplies[0].supply = "vdda";
+	ctx->supplies[1].supply = "vdd3p3";
+
+	ret = devm_regulator_bulk_get(ctx->panel.dev, ARRAY_SIZE(ctx->supplies),
+								ctx->supplies);

nit: alignment is odd, either align with a tab after 'devm_regulator_bulk_get' or with 'ctx->panel.dev'.

Quoted 20 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +20 -0
+	if (ret < 0)
+		return ret;
+
+	ctx->reset_gpio = devm_gpiod_get(ctx->panel.dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(ctx->reset_gpio)) {
+		DRM_DEV_ERROR(dev, "cannot get reset gpio %ld\n",
+			PTR_ERR(ctx->reset_gpio));
+		return PTR_ERR(ctx->reset_gpio);
+	}
+
+	drm_panel_init(&ctx->panel, dev, &visionox_rm69299_drm_funcs,
+		       DRM_MODE_CONNECTOR_DSI);
+	ctx->panel.dev = dev;
+	ctx->panel.funcs = &visionox_rm69299_drm_funcs;
+	drm_panel_add(&ctx->panel);
+
+	dsi->lanes = 4;
+	dsi->format = MIPI_DSI_FMT_RGB888;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM |
+		MIPI_DSI_CLOCK_NON_CONTINUOUS;

drivers/gpu/drm/panel/panel-visionox-rm69299.c line 266

Quoted 10 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +10 -0
+	ret = mipi_dsi_attach(dsi);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "dsi attach failed ret = %d\n", ret);
+		goto err_dsi_attach;
+	}
+
+	ret = regulator_set_load(ctx->supplies[0].consumer, 32000);
+	if (ret) {
+		mipi_dsi_detach(dsi);
+		drm_panel_remove(&ctx->panel);

that's technically correct, but since you have the 'goto' above and do the same unwinding for the other 'regulator_set_load' call below it would be better to use a 'goto' here (and below) too. Actually the 'goto' above only makes sense if 'goto' is also used for the other cases.

Quoted 37 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +37 -0
+		return ret;
+	}
+
+	ret = regulator_set_load(ctx->supplies[1].consumer, 13200);
+	if (ret) {
+		mipi_dsi_detach(dsi);
+		drm_panel_remove(&ctx->panel);
+		return ret;
+	}
+
+	return 0;
+
+err_dsi_attach:
+	drm_panel_remove(&ctx->panel);
+	return ret;
+}
+
+static int visionox_rm69299_remove(struct mipi_dsi_device *dsi)
+{
+	struct visionox_rm69299 *ctx = mipi_dsi_get_drvdata(dsi);
+
+	mipi_dsi_detach(ctx->dsi);
+	mipi_dsi_device_unregister(ctx->dsi);
+
+	drm_panel_remove(&ctx->panel);
+	return 0;
+}
+
+static const struct of_device_id visionox_rm69299_of_match[] = {
+	{
+		.compatible = "visionox,rm69299-1080p-display",
+		.data = &rm69299_dir,
+	},
+};
+MODULE_DEVICE_TABLE(of, visionox_rm69299_of_match);
+
+static struct mipi_dsi_driver visionox_rm69299_driver = {

drivers/gpu/drm/panel/panel-visionox-rm69299.c line 313

Quoted 10 lines
drivers/gpu/drm/panel/panel-visionox-rm69299.c new file +10 -0
+	.driver = {
+		.name = "panel-visionox-rm69299",
+		.of_match_table = visionox_rm69299_of_match,
+	},
+	.probe = visionox_rm69299_probe,
+	.remove = visionox_rm69299_remove,
+};
+module_mipi_dsi_driver(visionox_rm69299_driver);
+
+MODULE_DESCRIPTION("VISIONOX RM69299 DSI Panel Driver");

As commented on v4, this should be 'Visionox'.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel