* [PATCH v1 0/4] drm: panel: add support for panels used in LG P880/P895
@ 2025-04-13 11:23 Svyatoslav Ryhel
2025-04-13 11:23 ` [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel Svyatoslav Ryhel
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Svyatoslav Ryhel @ 2025-04-13 11:23 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Svyatoslav Ryhel
Cc: dri-devel, devicetree, linux-kernel
Add support for panels used in LG P880/P895 which are based on Renesas IC
(not related to Renesas RISC-V architecture just the same manufacturer).
Maxim Schwalm (1):
drm: panel: Add support for Renesas R69328 based MIPI DSI panel
Svyatoslav Ryhel (3):
dt-bindings: display: panel: Document Renesas R61307 based DSI panel
drm: panel: Add support for Renesas R61307 based MIPI DSI panel
dt-bindings: display: panel: Document Renesas R69328 based DSI panel
.../display/panel/renesas,r61307.yaml | 93 +++++
.../display/panel/renesas,r69328.yaml | 72 ++++
drivers/gpu/drm/panel/Kconfig | 26 ++
drivers/gpu/drm/panel/Makefile | 2 +
drivers/gpu/drm/panel/panel-renesas-r61307.c | 326 ++++++++++++++++++
drivers/gpu/drm/panel/panel-renesas-r69328.c | 282 +++++++++++++++
6 files changed, 801 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r69328.yaml
create mode 100644 drivers/gpu/drm/panel/panel-renesas-r61307.c
create mode 100644 drivers/gpu/drm/panel/panel-renesas-r69328.c
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel
2025-04-13 11:23 [PATCH v1 0/4] drm: panel: add support for panels used in LG P880/P895 Svyatoslav Ryhel
@ 2025-04-13 11:23 ` Svyatoslav Ryhel
2025-04-15 21:55 ` Rob Herring
2025-04-13 11:23 ` [PATCH v1 2/4] drm: panel: Add support for Renesas R61307 based MIPI " Svyatoslav Ryhel
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Svyatoslav Ryhel @ 2025-04-13 11:23 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Svyatoslav Ryhel
Cc: dri-devel, devicetree, linux-kernel
R61307 is liquid crystal driver for high-definition amorphous silicon
(a-Si) panels and is ideal for tablets and smartphones.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
.../display/panel/renesas,r61307.yaml | 93 +++++++++++++++++++
1 file changed, 93 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
diff --git a/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml b/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
new file mode 100644
index 000000000000..a98d2d2e02d2
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
@@ -0,0 +1,93 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/renesas,r61307.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas R61307 based DSI Display Panel
+
+maintainers:
+ - Svyatoslav Ryhel <clamor95@gmail.com>
+
+description:
+ The Renesas R61307 is a generic DSI Panel IC used to control LCD panels.
+
+allOf:
+ - $ref: panel-common.yaml#
+
+properties:
+ compatible:
+ enum:
+ # KOE/HITACHI TX13D100VM0EAA 5.0" XGA TFT LCD panel
+ - hit,tx13d100vm0eaa
+ - koe,tx13d100vm0eaa
+
+ reg:
+ maxItems: 1
+
+ vcc-supply:
+ description: Regulator for main power supply.
+
+ iovcc-supply:
+ description: Regulator for 1.8V IO power supply.
+
+ backlight: true
+
+ renesas,gamma:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ 0 - disabled
+ 1-3 - gamma setting A presets
+ enum: [0, 1, 2, 3]
+
+ renesas,inversion:
+ type: boolean
+ description: switch between line and column inversion. The line
+ inversion is set by default.
+
+ renesas,contrast:
+ type: boolean
+ description: digital contrast adjustment
+
+ reset-gpios: true
+ port: true
+
+required:
+ - compatible
+ - port
+ - backlight
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ dsi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ panel@1 {
+ compatible = "koe,tx13d100vm0eaa";
+ reg = <1>;
+
+ reset-gpios = <&gpio 176 GPIO_ACTIVE_LOW>;
+
+ renesas,gamma = <3>;
+ renesas,inversion;
+ renesas,contrast;
+
+ vcc-supply = <&vcc_3v0_lcd>;
+ iovcc-supply = <&iovcc_1v8_lcd>;
+
+ backlight = <&backlight>;
+
+ port {
+ panel_in: endpoint {
+ remote-endpoint = <&dsi_out>;
+ };
+ };
+ };
+ };
+
+...
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v1 2/4] drm: panel: Add support for Renesas R61307 based MIPI DSI panel
2025-04-13 11:23 [PATCH v1 0/4] drm: panel: add support for panels used in LG P880/P895 Svyatoslav Ryhel
2025-04-13 11:23 ` [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel Svyatoslav Ryhel
@ 2025-04-13 11:23 ` Svyatoslav Ryhel
2025-04-13 11:24 ` [PATCH v1 3/4] dt-bindings: display: panel: Document Renesas R69328 based " Svyatoslav Ryhel
2025-04-13 11:24 ` [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI " Svyatoslav Ryhel
3 siblings, 0 replies; 9+ messages in thread
From: Svyatoslav Ryhel @ 2025-04-13 11:23 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Svyatoslav Ryhel
Cc: dri-devel, devicetree, linux-kernel
R61307 is liquid crystal driver for high-definition amorphous silicon
(a-Si) panels and is ideal for tablets and smartphones.
Supported compatibles are:
- hit,tx13d100vm0eaa
- koe,tx13d100vm0eaa
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/gpu/drm/panel/Kconfig | 13 +
drivers/gpu/drm/panel/Makefile | 1 +
drivers/gpu/drm/panel/panel-renesas-r61307.c | 326 +++++++++++++++++++
3 files changed, 340 insertions(+)
create mode 100644 drivers/gpu/drm/panel/panel-renesas-r61307.c
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index d7469c565d1d..e8723f42cafb 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -605,6 +605,19 @@ config DRM_PANEL_RAYDIUM_RM69380
This panel controller can be found in the Lenovo Xiaoxin Pad Pro 2021
in combination with an EDO OLED panel.
+config DRM_PANEL_RENESAS_R61307
+ tristate "Renesas R61307 DSI video mode 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 KOE tx13d100vm0eaa
+ IPS-LCD module with Renesas R69328 IC. The panel has a 1024x768
+ resolution and uses 24 bit RGB per pixel.
+
+ This panel controller can be found in LG Optimus Vu P895 smartphone
+ in combination with LCD panel.
+
config DRM_PANEL_RONBO_RB070D30
tristate "Ronbo Electronics RB070D30 panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 7dcf72646cac..61d8853df1a7 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o
obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
+obj-$(CONFIG_DRM_PANEL_RENESAS_R61307) += panel-renesas-r61307.o
obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS581VF01) += panel-samsung-ams581vf01.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS639RQ08) += panel-samsung-ams639rq08.o
diff --git a/drivers/gpu/drm/panel/panel-renesas-r61307.c b/drivers/gpu/drm/panel/panel-renesas-r61307.c
new file mode 100644
index 000000000000..7277541edb16
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-renesas-r61307.c
@@ -0,0 +1,326 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/array_size.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/gpio/consumer.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/property.h>
+#include <linux/regulator/consumer.h>
+
+#include <video/mipi_display.h>
+
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
+#include <drm/drm_panel.h>
+
+#define R61307_MACP 0xb0 /* Manufacturer CMD Protect */
+#define R61307_MACP_ON 0x03
+#define R61307_MACP_OFF 0x04
+
+#define R61307_INVERSION 0xc1
+#define R61307_GAMMA_SET_A 0xc8 /* Gamma Setting A */
+#define R61307_GAMMA_SET_B 0xc9 /* Gamma Setting B */
+#define R61307_GAMMA_SET_C 0xca /* Gamma Setting C */
+#define R61307_CONTRAST_SET 0xcc
+
+struct renesas_r61307 {
+ struct drm_panel panel;
+ struct mipi_dsi_device *dsi;
+
+ struct regulator *vcc_supply;
+ struct regulator *iovcc_supply;
+
+ struct gpio_desc *reset_gpio;
+
+ bool prepared;
+
+ bool dig_cont_adj;
+ bool inversion;
+ u32 gamma;
+};
+
+static const u8 gamma_setting[][25] = {
+ { /* sentinel */ },
+ {
+ R61307_GAMMA_SET_A,
+ 0x00, 0x06, 0x0a, 0x0f,
+ 0x14, 0x1f, 0x1f, 0x17,
+ 0x12, 0x0c, 0x09, 0x06,
+ 0x00, 0x06, 0x0a, 0x0f,
+ 0x14, 0x1f, 0x1f, 0x17,
+ 0x12, 0x0c, 0x09, 0x06
+ },
+ {
+ R61307_GAMMA_SET_A,
+ 0x00, 0x05, 0x0b, 0x0f,
+ 0x11, 0x1d, 0x20, 0x18,
+ 0x18, 0x09, 0x07, 0x06,
+ 0x00, 0x05, 0x0b, 0x0f,
+ 0x11, 0x1d, 0x20, 0x18,
+ 0x18, 0x09, 0x07, 0x06
+ },
+ {
+ R61307_GAMMA_SET_A,
+ 0x0b, 0x0d, 0x10, 0x14,
+ 0x13, 0x1d, 0x20, 0x18,
+ 0x12, 0x09, 0x07, 0x06,
+ 0x0a, 0x0c, 0x10, 0x14,
+ 0x13, 0x1d, 0x20, 0x18,
+ 0x12, 0x09, 0x07, 0x06
+ },
+};
+
+static inline struct renesas_r61307 *to_renesas_r61307(struct drm_panel *panel)
+{
+ return container_of(panel, struct renesas_r61307, panel);
+}
+
+static void renesas_r61307_reset(struct renesas_r61307 *priv)
+{
+ gpiod_set_value_cansleep(priv->reset_gpio, 1);
+ usleep_range(10000, 11000);
+ gpiod_set_value_cansleep(priv->reset_gpio, 0);
+ usleep_range(2000, 3000);
+}
+
+static int renesas_r61307_prepare(struct drm_panel *panel)
+{
+ struct renesas_r61307 *priv = to_renesas_r61307(panel);
+ struct device *dev = &priv->dsi->dev;
+ int ret;
+
+ if (priv->prepared)
+ return 0;
+
+ ret = regulator_enable(priv->vcc_supply);
+ if (ret) {
+ dev_err(dev, "failed to enable vcc power supply\n");
+ return ret;
+ }
+
+ usleep_range(2000, 3000);
+
+ ret = regulator_enable(priv->iovcc_supply);
+ if (ret) {
+ dev_err(dev, "failed to enable iovcc power supply\n");
+ return ret;
+ }
+
+ usleep_range(2000, 3000);
+
+ renesas_r61307_reset(priv);
+
+ priv->prepared = true;
+ return 0;
+}
+
+static int renesas_r61307_enable(struct drm_panel *panel)
+{
+ struct renesas_r61307 *priv = to_renesas_r61307(panel);
+ struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
+
+ mipi_dsi_dcs_exit_sleep_mode_multi(&ctx);
+ mipi_dsi_msleep(&ctx, 80);
+
+ mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
+ mipi_dsi_msleep(&ctx, 20);
+
+ mipi_dsi_dcs_set_pixel_format_multi(&ctx, MIPI_DCS_PIXEL_FMT_24BIT << 4);
+
+ /* MACP Off */
+ mipi_dsi_generic_write_seq_multi(&ctx, R61307_MACP, R61307_MACP_OFF);
+
+ if (priv->dig_cont_adj)
+ mipi_dsi_generic_write_seq_multi(&ctx, R61307_CONTRAST_SET,
+ 0xdc, 0xb4, 0xff);
+
+ if (priv->gamma)
+ mipi_dsi_generic_write_multi(&ctx, gamma_setting[priv->gamma],
+ sizeof(gamma_setting[priv->gamma]));
+
+ if (priv->inversion)
+ mipi_dsi_generic_write_seq_multi(&ctx, R61307_INVERSION,
+ 0x00, 0x50, 0x03, 0x22,
+ 0x16, 0x06, 0x60, 0x11);
+ else
+ mipi_dsi_generic_write_seq_multi(&ctx, R61307_INVERSION,
+ 0x00, 0x10, 0x03, 0x22,
+ 0x16, 0x06, 0x60, 0x01);
+
+ /* MACP On */
+ mipi_dsi_generic_write_seq_multi(&ctx, R61307_MACP, R61307_MACP_ON);
+
+ mipi_dsi_dcs_set_display_on_multi(&ctx);
+ mipi_dsi_msleep(&ctx, 50);
+
+ return 0;
+}
+
+static int renesas_r61307_disable(struct drm_panel *panel)
+{
+ struct renesas_r61307 *priv = to_renesas_r61307(panel);
+ struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
+
+ mipi_dsi_dcs_set_display_off_multi(&ctx);
+ mipi_dsi_msleep(&ctx, 100);
+ mipi_dsi_dcs_enter_sleep_mode_multi(&ctx);
+
+ return 0;
+}
+
+static int renesas_r61307_unprepare(struct drm_panel *panel)
+{
+ struct renesas_r61307 *priv = to_renesas_r61307(panel);
+
+ if (!priv->prepared)
+ return 0;
+
+ usleep_range(10000, 11000);
+
+ gpiod_set_value_cansleep(priv->reset_gpio, 1);
+ usleep_range(5000, 6000);
+
+ regulator_disable(priv->iovcc_supply);
+ usleep_range(2000, 3000);
+ regulator_disable(priv->vcc_supply);
+
+ priv->prepared = false;
+ return 0;
+}
+
+static const struct drm_display_mode renesas_r61307_mode = {
+ .clock = (768 + 116 + 81 + 5) * (1024 + 24 + 8 + 2) * 60 / 1000,
+ .hdisplay = 768,
+ .hsync_start = 768 + 116,
+ .hsync_end = 768 + 116 + 81,
+ .htotal = 768 + 116 + 81 + 5,
+ .vdisplay = 1024,
+ .vsync_start = 1024 + 24,
+ .vsync_end = 1024 + 24 + 8,
+ .vtotal = 1024 + 24 + 8 + 2,
+ .width_mm = 76,
+ .height_mm = 101,
+};
+
+static int renesas_r61307_get_modes(struct drm_panel *panel,
+ struct drm_connector *connector)
+{
+ struct drm_display_mode *mode;
+
+ mode = drm_mode_duplicate(connector->dev, &renesas_r61307_mode);
+ if (!mode)
+ 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 renesas_r61307_panel_funcs = {
+ .prepare = renesas_r61307_prepare,
+ .enable = renesas_r61307_enable,
+ .disable = renesas_r61307_disable,
+ .unprepare = renesas_r61307_unprepare,
+ .get_modes = renesas_r61307_get_modes,
+};
+
+static int renesas_r61307_probe(struct mipi_dsi_device *dsi)
+{
+ struct device *dev = &dsi->dev;
+ struct renesas_r61307 *priv;
+ int ret;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ priv->vcc_supply = devm_regulator_get(dev, "vcc");
+ if (IS_ERR(priv->vcc_supply))
+ return dev_err_probe(dev, PTR_ERR(priv->vcc_supply),
+ "Failed to get vcc-supply\n");
+
+ priv->iovcc_supply = devm_regulator_get(dev, "iovcc");
+ if (IS_ERR(priv->iovcc_supply))
+ return dev_err_probe(dev, PTR_ERR(priv->iovcc_supply),
+ "Failed to get iovcc-supply\n");
+
+ priv->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+ GPIOD_OUT_HIGH);
+ if (IS_ERR(priv->reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(priv->reset_gpio),
+ "Failed to get reset gpios\n");
+
+ if (device_property_read_bool(dev, "renesas,inversion"))
+ priv->inversion = true;
+
+ if (device_property_read_bool(dev, "renesas,contrast"))
+ priv->dig_cont_adj = true;
+
+ priv->gamma = 0;
+ device_property_read_u32(dev, "renesas,gamma", &priv->gamma);
+
+ priv->dsi = dsi;
+ mipi_dsi_set_drvdata(dsi, priv);
+
+ dsi->lanes = 4;
+ dsi->format = MIPI_DSI_FMT_RGB888;
+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+ MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM;
+
+ drm_panel_init(&priv->panel, dev, &renesas_r61307_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ ret = drm_panel_of_backlight(&priv->panel);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to get backlight\n");
+
+ drm_panel_add(&priv->panel);
+
+ ret = mipi_dsi_attach(dsi);
+ if (ret) {
+ dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
+ drm_panel_remove(&priv->panel);
+ return ret;
+ }
+
+ return 0;
+}
+
+static void renesas_r61307_remove(struct mipi_dsi_device *dsi)
+{
+ struct renesas_r61307 *priv = mipi_dsi_get_drvdata(dsi);
+ int ret;
+
+ ret = mipi_dsi_detach(dsi);
+ if (ret)
+ dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
+
+ drm_panel_remove(&priv->panel);
+}
+
+static const struct of_device_id renesas_r61307_of_match[] = {
+ { .compatible = "hit,tx13d100vm0eaa" },
+ { .compatible = "koe,tx13d100vm0eaa" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, renesas_r61307_of_match);
+
+static struct mipi_dsi_driver renesas_r61307_driver = {
+ .probe = renesas_r61307_probe,
+ .remove = renesas_r61307_remove,
+ .driver = {
+ .name = "panel-renesas-r61307",
+ .of_match_table = renesas_r61307_of_match,
+ },
+};
+module_mipi_dsi_driver(renesas_r61307_driver);
+
+MODULE_AUTHOR("Svyatoslav Ryhel <clamor95@gmail.com>");
+MODULE_DESCRIPTION("Renesas R61307-based panel driver");
+MODULE_LICENSE("GPL");
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v1 3/4] dt-bindings: display: panel: Document Renesas R69328 based DSI panel
2025-04-13 11:23 [PATCH v1 0/4] drm: panel: add support for panels used in LG P880/P895 Svyatoslav Ryhel
2025-04-13 11:23 ` [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel Svyatoslav Ryhel
2025-04-13 11:23 ` [PATCH v1 2/4] drm: panel: Add support for Renesas R61307 based MIPI " Svyatoslav Ryhel
@ 2025-04-13 11:24 ` Svyatoslav Ryhel
2025-04-13 11:24 ` [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI " Svyatoslav Ryhel
3 siblings, 0 replies; 9+ messages in thread
From: Svyatoslav Ryhel @ 2025-04-13 11:24 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Svyatoslav Ryhel
Cc: dri-devel, devicetree, linux-kernel
R69328 is liquid crystal driver for high-definition amorphous silicon
(a-Si) panels and is ideal for tablets and smartphones.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
.../display/panel/renesas,r69328.yaml | 72 +++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r69328.yaml
diff --git a/Documentation/devicetree/bindings/display/panel/renesas,r69328.yaml b/Documentation/devicetree/bindings/display/panel/renesas,r69328.yaml
new file mode 100644
index 000000000000..1c1ce5ed6f2f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/renesas,r69328.yaml
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/renesas,r69328.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas R69328 based DSI Display Panel
+
+maintainers:
+ - Svyatoslav Ryhel <clamor95@gmail.com>
+
+description:
+ The Renesas R69328 is a generic DSI Panel IC used to control LCD panels.
+
+allOf:
+ - $ref: panel-common.yaml#
+
+properties:
+ compatible:
+ enum:
+ # JDI DX12D100VM0EAA 4.7" WXGA TFT LCD panel
+ - jdi,dx12d100vm0eaa
+
+ reg:
+ maxItems: 1
+
+ vdd-supply:
+ description: Regulator for main power supply.
+
+ vddio-supply:
+ description: Regulator for 1.8V IO power supply.
+
+ backlight: true
+
+ reset-gpios: true
+ port: true
+
+required:
+ - compatible
+ - port
+ - backlight
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ dsi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ panel@1 {
+ compatible = "jdi,dx12d100vm0eaa";
+ reg = <1>;
+
+ reset-gpios = <&gpio 176 GPIO_ACTIVE_LOW>;
+
+ vdd-supply = <&vdd_3v0_lcd>;
+ vddio-supply = <&vdd_1v8_io>;
+
+ backlight = <&backlight>;
+
+ port {
+ panel_in: endpoint {
+ remote-endpoint = <&dsi_out>;
+ };
+ };
+ };
+ };
+
+...
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI DSI panel
2025-04-13 11:23 [PATCH v1 0/4] drm: panel: add support for panels used in LG P880/P895 Svyatoslav Ryhel
` (2 preceding siblings ...)
2025-04-13 11:24 ` [PATCH v1 3/4] dt-bindings: display: panel: Document Renesas R69328 based " Svyatoslav Ryhel
@ 2025-04-13 11:24 ` Svyatoslav Ryhel
2025-04-13 16:50 ` ALOK TIWARI
3 siblings, 1 reply; 9+ messages in thread
From: Svyatoslav Ryhel @ 2025-04-13 11:24 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Svyatoslav Ryhel
Cc: dri-devel, devicetree, linux-kernel
From: Maxim Schwalm <maxim.schwalm@gmail.com>
Driver adds support for panels with Renesas R69328 IC
Currently supported compatible is:
- jdi,dx12d100vm0eaa
Co-developed-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Maxim Schwalm <maxim.schwalm@gmail.com>
---
drivers/gpu/drm/panel/Kconfig | 13 +
drivers/gpu/drm/panel/Makefile | 1 +
drivers/gpu/drm/panel/panel-renesas-r69328.c | 282 +++++++++++++++++++
3 files changed, 296 insertions(+)
create mode 100644 drivers/gpu/drm/panel/panel-renesas-r69328.c
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index e8723f42cafb..86c66f818a11 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -618,6 +618,19 @@ config DRM_PANEL_RENESAS_R61307
This panel controller can be found in LG Optimus Vu P895 smartphone
in combination with LCD panel.
+config DRM_PANEL_RENESAS_R69328
+ tristate "Renesas R69328 720x1280 DSI video mode 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 JDI dx12d100vm0eaa
+ IPS-LCD module with Renesas R69328 IC. The panel has a 720x1280
+ resolution and uses 24 bit RGB per pixel.
+
+ This panel controller can be found in LG Optimus 4X P895 smartphone
+ in combination with LCD panel.
+
config DRM_PANEL_RONBO_RB070D30
tristate "Ronbo Electronics RB070D30 panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 61d8853df1a7..37e4e13165a9 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
obj-$(CONFIG_DRM_PANEL_RENESAS_R61307) += panel-renesas-r61307.o
+obj-$(CONFIG_DRM_PANEL_RENESAS_R69328) += panel-renesas-r69328.o
obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS581VF01) += panel-samsung-ams581vf01.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS639RQ08) += panel-samsung-ams639rq08.o
diff --git a/drivers/gpu/drm/panel/panel-renesas-r69328.c b/drivers/gpu/drm/panel/panel-renesas-r69328.c
new file mode 100644
index 000000000000..207067b29473
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-renesas-r69328.c
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/array_size.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/gpio/consumer.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/property.h>
+#include <linux/regulator/consumer.h>
+
+#include <video/mipi_display.h>
+
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
+#include <drm/drm_panel.h>
+
+#define R69328_MACP 0xb0 /* Manufacturer Access CMD Protect */
+#define R69328_MACP_ON 0x03
+#define R69328_MACP_OFF 0x04
+
+#define R69328_GAMMA_SET_A 0xc8 /* Gamma Setting A */
+#define R69328_GAMMA_SET_B 0xc9 /* Gamma Setting B */
+#define R69328_GAMMA_SET_C 0xca /* Gamma Setting C */
+
+#define R69328_POWER_SET 0xd1
+
+struct renesas_r69328 {
+ struct drm_panel panel;
+ struct mipi_dsi_device *dsi;
+
+ struct regulator *vdd_supply;
+ struct regulator *vddio_supply;
+ struct gpio_desc *reset_gpio;
+
+ bool prepared;
+};
+
+static inline struct renesas_r69328 *to_renesas_r69328(struct drm_panel *panel)
+{
+ return container_of(panel, struct renesas_r69328, panel);
+}
+
+static void renesas_r69328_reset(struct renesas_r69328 *priv)
+{
+ gpiod_set_value_cansleep(priv->reset_gpio, 1);
+ usleep_range(10000, 11000);
+ gpiod_set_value_cansleep(priv->reset_gpio, 0);
+ usleep_range(2000, 3000);
+}
+
+static int renesas_r69328_prepare(struct drm_panel *panel)
+{
+ struct renesas_r69328 *priv = to_renesas_r69328(panel);
+ struct device *dev = &priv->dsi->dev;
+ int ret;
+
+ if (priv->prepared)
+ return 0;
+
+ ret = regulator_enable(priv->vdd_supply);
+ if (ret) {
+ dev_err(dev, "failed to enable vdd power supply\n");
+ return ret;
+ }
+
+ usleep_range(10000, 11000);
+
+ ret = regulator_enable(priv->vddio_supply);
+ if (ret < 0) {
+ dev_err(dev, "failed to enable vddio power supply\n");
+ return ret;
+ }
+
+ usleep_range(10000, 11000);
+
+ renesas_r69328_reset(priv);
+
+ priv->prepared = true;
+ return 0;
+}
+
+static int renesas_r69328_enable(struct drm_panel *panel)
+{
+ struct renesas_r69328 *priv = to_renesas_r69328(panel);
+ struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
+
+ /* Set address mode */
+ mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
+ mipi_dsi_dcs_set_pixel_format_multi(&ctx, MIPI_DCS_PIXEL_FMT_24BIT << 4);
+ mipi_dsi_dcs_exit_sleep_mode_multi(&ctx);
+
+ mipi_dsi_msleep(&ctx, 100);
+
+ /* MACP Off */
+ mipi_dsi_generic_write_seq_multi(&ctx, R69328_MACP, R69328_MACP_OFF);
+
+ mipi_dsi_generic_write_seq_multi(&ctx, R69328_POWER_SET, 0x14, 0x1d,
+ 0x21, 0x67, 0x11, 0x9a);
+
+ mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_A, 0x00, 0x1a,
+ 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+ 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
+ 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+ 0x11, 0x18, 0x1e, 0x1c, 0x00);
+
+ mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_B, 0x00, 0x1a,
+ 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+ 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
+ 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+ 0x11, 0x18, 0x1e, 0x1c, 0x00);
+
+ mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_C, 0x00, 0x1a,
+ 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+ 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
+ 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+ 0x11, 0x18, 0x1e, 0x1c, 0x00);
+
+ /* MACP On */
+ mipi_dsi_generic_write_seq_multi(&ctx, R69328_MACP, R69328_MACP_ON);
+
+ mipi_dsi_dcs_set_display_on_multi(&ctx);
+ mipi_dsi_msleep(&ctx, 50);
+
+ return 0;
+}
+
+static int renesas_r69328_disable(struct drm_panel *panel)
+{
+ struct renesas_r69328 *priv = to_renesas_r69328(panel);
+ struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
+
+ mipi_dsi_dcs_set_display_off_multi(&ctx);
+ mipi_dsi_msleep(&ctx, 60);
+ mipi_dsi_dcs_enter_sleep_mode_multi(&ctx);
+
+ return 0;
+}
+
+static int renesas_r69328_unprepare(struct drm_panel *panel)
+{
+ struct renesas_r69328 *priv = to_renesas_r69328(panel);
+
+ if (!priv->prepared)
+ return 0;
+
+ gpiod_set_value_cansleep(priv->reset_gpio, 1);
+
+ usleep_range(5000, 6000);
+
+ regulator_disable(priv->vddio_supply);
+ regulator_disable(priv->vdd_supply);
+
+ priv->prepared = false;
+ return 0;
+}
+
+static const struct drm_display_mode renesas_r69328_mode = {
+ .clock = (720 + 92 + 62 + 4) * (1280 + 6 + 3 + 1) * 60 / 1000,
+ .hdisplay = 720,
+ .hsync_start = 720 + 92,
+ .hsync_end = 720 + 92 + 62,
+ .htotal = 720 + 92 + 62 + 4,
+ .vdisplay = 1280,
+ .vsync_start = 1280 + 6,
+ .vsync_end = 1280 + 6 + 3,
+ .vtotal = 1280 + 6 + 3 + 1,
+ .width_mm = 59,
+ .height_mm = 105,
+};
+
+static int renesas_r69328_get_modes(struct drm_panel *panel,
+ struct drm_connector *connector)
+{
+ struct drm_display_mode *mode;
+
+ mode = drm_mode_duplicate(connector->dev, &renesas_r69328_mode);
+ if (!mode)
+ 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 renesas_r69328_panel_funcs = {
+ .prepare = renesas_r69328_prepare,
+ .enable = renesas_r69328_enable,
+ .disable = renesas_r69328_disable,
+ .unprepare = renesas_r69328_unprepare,
+ .get_modes = renesas_r69328_get_modes,
+};
+
+static int renesas_r69328_probe(struct mipi_dsi_device *dsi)
+{
+ struct device *dev = &dsi->dev;
+ struct renesas_r69328 *priv;
+ int ret;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ priv->vdd_supply = devm_regulator_get(dev, "vdd");
+ if (IS_ERR(priv->vdd_supply))
+ return dev_err_probe(dev, PTR_ERR(priv->vdd_supply),
+ "Failed to get vdd-supply\n");
+
+ priv->vddio_supply = devm_regulator_get(dev, "vddio");
+ if (IS_ERR(priv->vddio_supply))
+ return dev_err_probe(dev, PTR_ERR(priv->vddio_supply),
+ "Failed to get vddio-supply\n");
+
+ priv->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(priv->reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(priv->reset_gpio),
+ "Failed to get reset-gpios\n");
+
+ priv->dsi = dsi;
+ mipi_dsi_set_drvdata(dsi, priv);
+
+ dsi->lanes = 4;
+ dsi->format = MIPI_DSI_FMT_RGB888;
+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+ MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM;
+
+ drm_panel_init(&priv->panel, dev, &renesas_r69328_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ ret = drm_panel_of_backlight(&priv->panel);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to get backlight\n");
+
+ drm_panel_add(&priv->panel);
+
+ ret = mipi_dsi_attach(dsi);
+ if (ret) {
+ dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
+ drm_panel_remove(&priv->panel);
+ return ret;
+ }
+
+ return 0;
+}
+
+static void renesas_r69328_remove(struct mipi_dsi_device *dsi)
+{
+ struct renesas_r69328 *priv = mipi_dsi_get_drvdata(dsi);
+ int ret;
+
+ ret = mipi_dsi_detach(dsi);
+ if (ret)
+ dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
+
+ drm_panel_remove(&priv->panel);
+}
+
+static const struct of_device_id renesas_r69328_of_match[] = {
+ { .compatible = "jdi,dx12d100vm0eaa" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, renesas_r69328_of_match);
+
+static struct mipi_dsi_driver renesas_r69328_driver = {
+ .probe = renesas_r69328_probe,
+ .remove = renesas_r69328_remove,
+ .driver = {
+ .name = "panel-renesas-r69328",
+ .of_match_table = renesas_r69328_of_match,
+ },
+};
+module_mipi_dsi_driver(renesas_r69328_driver);
+
+MODULE_AUTHOR("Maxim Schwalm <maxim.schwalm@gmail.com>");
+MODULE_AUTHOR("Svyatoslav Ryhel <clamor95@gmail.com>");
+MODULE_DESCRIPTION("Renesas R69328-based panel driver");
+MODULE_LICENSE("GPL");
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI DSI panel
2025-04-13 11:24 ` [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI " Svyatoslav Ryhel
@ 2025-04-13 16:50 ` ALOK TIWARI
2025-04-13 16:57 ` ALOK TIWARI
0 siblings, 1 reply; 9+ messages in thread
From: ALOK TIWARI @ 2025-04-13 16:50 UTC (permalink / raw)
To: Svyatoslav Ryhel, Neil Armstrong, Jessica Zhang,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: dri-devel, devicetree, linux-kernel
On 13-04-2025 16:54, Svyatoslav Ryhel wrote:
> From: Maxim Schwalm <maxim.schwalm@gmail.com>
>
> Driver adds support for panels with Renesas R69328 IC
>
> Currently supported compatible is:
> - jdi,dx12d100vm0eaa
>
> Co-developed-by: Svyatoslav Ryhel <clamor95@gmail.com>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> Signed-off-by: Maxim Schwalm <maxim.schwalm@gmail.com>
> ---
> drivers/gpu/drm/panel/Kconfig | 13 +
> drivers/gpu/drm/panel/Makefile | 1 +
> drivers/gpu/drm/panel/panel-renesas-r69328.c | 282 +++++++++++++++++++
> 3 files changed, 296 insertions(+)
> create mode 100644 drivers/gpu/drm/panel/panel-renesas-r69328.c
>
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index e8723f42cafb..86c66f818a11 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -618,6 +618,19 @@ config DRM_PANEL_RENESAS_R61307
> This panel controller can be found in LG Optimus Vu P895 smartphone
> in combination with LCD panel.
>
> +config DRM_PANEL_RENESAS_R69328
> + tristate "Renesas R69328 720x1280 DSI video mode 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 JDI dx12d100vm0eaa
> + IPS-LCD module with Renesas R69328 IC. The panel has a 720x1280
> + resolution and uses 24 bit RGB per pixel.
> +
> + This panel controller can be found in LG Optimus 4X P895 smartphone
> + in combination with LCD panel.
> +
> config DRM_PANEL_RONBO_RB070D30
> tristate "Ronbo Electronics RB070D30 panel"
> depends on OF
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 61d8853df1a7..37e4e13165a9 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -62,6 +62,7 @@ obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
> obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
> obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
> obj-$(CONFIG_DRM_PANEL_RENESAS_R61307) += panel-renesas-r61307.o
> +obj-$(CONFIG_DRM_PANEL_RENESAS_R69328) += panel-renesas-r69328.o
> obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
> obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS581VF01) += panel-samsung-ams581vf01.o
> obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS639RQ08) += panel-samsung-ams639rq08.o
> diff --git a/drivers/gpu/drm/panel/panel-renesas-r69328.c b/drivers/gpu/drm/panel/panel-renesas-r69328.c
> new file mode 100644
> index 000000000000..207067b29473
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-renesas-r69328.c
> @@ -0,0 +1,282 @@
> +// SPDX-License-Identifier: GPL-2.0
add Blank line
> +#include <linux/array_size.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/property.h>
> +#include <linux/regulator/consumer.h>
> +
> +#include <video/mipi_display.h>
> +
> +#include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_modes.h>
> +#include <drm/drm_panel.h>
> +
> +#define R69328_MACP 0xb0 /* Manufacturer Access CMD Protect */
> +#define R69328_MACP_ON 0x03
> +#define R69328_MACP_OFF 0x04
remove extra ' ' after #define
> +
> +#define R69328_GAMMA_SET_A 0xc8 /* Gamma Setting A */
> +#define R69328_GAMMA_SET_B 0xc9 /* Gamma Setting B */
> +#define R69328_GAMMA_SET_C 0xca /* Gamma Setting C */
> +
> +#define R69328_POWER_SET 0xd1
> +
> +struct renesas_r69328 {
> + struct drm_panel panel;
> + struct mipi_dsi_device *dsi;
> +
> + struct regulator *vdd_supply;
> + struct regulator *vddio_supply;
> + struct gpio_desc *reset_gpio;
> +
> + bool prepared;
> +};
> +
> +static inline struct renesas_r69328 *to_renesas_r69328(struct drm_panel *panel)
> +{
> + return container_of(panel, struct renesas_r69328, panel);
> +}
> +
> +static void renesas_r69328_reset(struct renesas_r69328 *priv)
> +{
> + gpiod_set_value_cansleep(priv->reset_gpio, 1);
> + usleep_range(10000, 11000);
> + gpiod_set_value_cansleep(priv->reset_gpio, 0);
> + usleep_range(2000, 3000);
> +}
> +
> +static int renesas_r69328_prepare(struct drm_panel *panel)
> +{
> + struct renesas_r69328 *priv = to_renesas_r69328(panel);
> + struct device *dev = &priv->dsi->dev;
> + int ret;
> +
> + if (priv->prepared)
> + return 0;
> +
> + ret = regulator_enable(priv->vdd_supply);
> + if (ret) {
> + dev_err(dev, "failed to enable vdd power supply\n");
> + return ret;
> + }
> +
> + usleep_range(10000, 11000);
> +
> + ret = regulator_enable(priv->vddio_supply);
> + if (ret < 0) {
> + dev_err(dev, "failed to enable vddio power supply\n");
> + return ret;
> + }
> +
> + usleep_range(10000, 11000);
> +
> + renesas_r69328_reset(priv);
> +
> + priv->prepared = true;
a '\n' before return
> + return 0;
> +}
> +
> +static int renesas_r69328_enable(struct drm_panel *panel)
> +{
> + struct renesas_r69328 *priv = to_renesas_r69328(panel);
> + struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
> +
> + /* Set address mode */
> + mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
> + mipi_dsi_dcs_set_pixel_format_multi(&ctx, MIPI_DCS_PIXEL_FMT_24BIT << 4);
> + mipi_dsi_dcs_exit_sleep_mode_multi(&ctx);
> +
> + mipi_dsi_msleep(&ctx, 100);
> +
> + /* MACP Off */
> + mipi_dsi_generic_write_seq_multi(&ctx, R69328_MACP, R69328_MACP_OFF);
> +
> + mipi_dsi_generic_write_seq_multi(&ctx, R69328_POWER_SET, 0x14, 0x1d,
> + 0x21, 0x67, 0x11, 0x9a);
> +
> + mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_A, 0x00, 0x1a,
> + 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
> + 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
> + 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
> + 0x11, 0x18, 0x1e, 0x1c, 0x00);
> +
> + mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_B, 0x00, 0x1a,
> + 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
> + 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
> + 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
> + 0x11, 0x18, 0x1e, 0x1c, 0x00);
> +
> + mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_C, 0x00, 0x1a,
> + 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
> + 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
> + 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
> + 0x11, 0x18, 0x1e, 0x1c, 0x00);
> +
> + /* MACP On */
> + mipi_dsi_generic_write_seq_multi(&ctx, R69328_MACP, R69328_MACP_ON);
> +
> + mipi_dsi_dcs_set_display_on_multi(&ctx);
> + mipi_dsi_msleep(&ctx, 50);
> +
> + return 0;
> +}
> +
> +static int renesas_r69328_disable(struct drm_panel *panel)
> +{
> + struct renesas_r69328 *priv = to_renesas_r69328(panel);
> + struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
> +
> + mipi_dsi_dcs_set_display_off_multi(&ctx);
> + mipi_dsi_msleep(&ctx, 60);
> + mipi_dsi_dcs_enter_sleep_mode_multi(&ctx);
> +
> + return 0;
> +}
> +
> +static int renesas_r69328_unprepare(struct drm_panel *panel)
> +{
> + struct renesas_r69328 *priv = to_renesas_r69328(panel);
> +
> + if (!priv->prepared)
> + return 0;
> +
> + gpiod_set_value_cansleep(priv->reset_gpio, 1);
> +
> + usleep_range(5000, 6000);
> +
> + regulator_disable(priv->vddio_supply);
> + regulator_disable(priv->vdd_supply);
> +
> + priv->prepared = false;
a '\n' before return
> + return 0;
> +}
> +
> +static const struct drm_display_mode renesas_r69328_mode = {
> + .clock = (720 + 92 + 62 + 4) * (1280 + 6 + 3 + 1) * 60 / 1000,
> + .hdisplay = 720,
> + .hsync_start = 720 + 92,
> + .hsync_end = 720 + 92 + 62,
> + .htotal = 720 + 92 + 62 + 4,
> + .vdisplay = 1280,
> + .vsync_start = 1280 + 6,
> + .vsync_end = 1280 + 6 + 3,
> + .vtotal = 1280 + 6 + 3 + 1,
> + .width_mm = 59,
> + .height_mm = 105,
> +};
> +
> +static int renesas_r69328_get_modes(struct drm_panel *panel,
> + struct drm_connector *connector)
> +{
> + struct drm_display_mode *mode;
> +
> + mode = drm_mode_duplicate(connector->dev, &renesas_r69328_mode);
> + if (!mode)
> + 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 renesas_r69328_panel_funcs = {
> + .prepare = renesas_r69328_prepare,
> + .enable = renesas_r69328_enable,
> + .disable = renesas_r69328_disable,
> + .unprepare = renesas_r69328_unprepare,
> + .get_modes = renesas_r69328_get_modes,
> +};
> +
> +static int renesas_r69328_probe(struct mipi_dsi_device *dsi)
> +{
> + struct device *dev = &dsi->dev;
> + struct renesas_r69328 *priv;
> + int ret;
> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->vdd_supply = devm_regulator_get(dev, "vdd");
> + if (IS_ERR(priv->vdd_supply))
> + return dev_err_probe(dev, PTR_ERR(priv->vdd_supply),
> + "Failed to get vdd-supply\n");
> +
> + priv->vddio_supply = devm_regulator_get(dev, "vddio");
> + if (IS_ERR(priv->vddio_supply))
> + return dev_err_probe(dev, PTR_ERR(priv->vddio_supply),
> + "Failed to get vddio-supply\n");
> +
> + priv->reset_gpio = devm_gpiod_get_optional(dev, "reset",
> + GPIOD_OUT_LOW);
> + if (IS_ERR(priv->reset_gpio))
> + return dev_err_probe(dev, PTR_ERR(priv->reset_gpio),
> + "Failed to get reset-gpios\n");
> +
> + priv->dsi = dsi;
> + mipi_dsi_set_drvdata(dsi, priv);
> +
> + dsi->lanes = 4;
> + dsi->format = MIPI_DSI_FMT_RGB888;
> + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
> + MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM;
> +
> + drm_panel_init(&priv->panel, dev, &renesas_r69328_panel_funcs,
> + DRM_MODE_CONNECTOR_DSI);
> +
> + ret = drm_panel_of_backlight(&priv->panel);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to get backlight\n");
drm_panel_of_backlight, 0 on success, or a negative error code on failure so
if( ret > 0)
> +
> + drm_panel_add(&priv->panel);
> +
> + ret = mipi_dsi_attach(dsi);
if ( ret > 0) it return negative error code
> + if (ret) {
> + dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
> + drm_panel_remove(&priv->panel);
> + return ret;
use return dev_err_probe
> + }
> +
> + return 0;
> +}
> +
> +static void renesas_r69328_remove(struct mipi_dsi_device *dsi)
> +{
> + struct renesas_r69328 *priv = mipi_dsi_get_drvdata(dsi);
> + int ret;
> +
> + ret = mipi_dsi_detach(dsi);
if ( ret > 0) it return negative error code
> + if (ret)
> + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
> +
> + drm_panel_remove(&priv->panel);
> +}
> +
> +static const struct of_device_id renesas_r69328_of_match[] = {
> + { .compatible = "jdi,dx12d100vm0eaa" },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, renesas_r69328_of_match);
> +
> +static struct mipi_dsi_driver renesas_r69328_driver = {
> + .probe = renesas_r69328_probe,
> + .remove = renesas_r69328_remove,
> + .driver = {
> + .name = "panel-renesas-r69328",
> + .of_match_table = renesas_r69328_of_match,
> + },
> +};
> +module_mipi_dsi_driver(renesas_r69328_driver);
> +
> +MODULE_AUTHOR("Maxim Schwalm <maxim.schwalm@gmail.com>");
> +MODULE_AUTHOR("Svyatoslav Ryhel <clamor95@gmail.com>");
> +MODULE_DESCRIPTION("Renesas R69328-based panel driver");
> +MODULE_LICENSE("GPL");
Thanks
Alok
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI DSI panel
2025-04-13 16:50 ` ALOK TIWARI
@ 2025-04-13 16:57 ` ALOK TIWARI
0 siblings, 0 replies; 9+ messages in thread
From: ALOK TIWARI @ 2025-04-13 16:57 UTC (permalink / raw)
To: Svyatoslav Ryhel, Neil Armstrong, Jessica Zhang,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: dri-devel, devicetree, linux-kernel
On 13-04-2025 22:20, ALOK TIWARI wrote:
>> + mipi_dsi_set_drvdata(dsi, priv);
>> +
>> + dsi->lanes = 4;
>> + dsi->format = MIPI_DSI_FMT_RGB888;
>> + dsi->mode_flags = MIPI_DSI_MODE_VIDEO |
>> MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
>> + MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM;
>> +
>> + drm_panel_init(&priv->panel, dev, &renesas_r69328_panel_funcs,
>> + DRM_MODE_CONNECTOR_DSI);
>> +
>> + ret = drm_panel_of_backlight(&priv->panel);
>> + if (ret)
>> + return dev_err_probe(dev, ret, "Failed to get backlight\n");
>
>
> drm_panel_of_backlight, 0 on success, or a negative error code on
> failure so
> if( ret > 0)
ie if( ret < 0)
>
>> +
>> + drm_panel_add(&priv->panel);
>> +
>> + ret = mipi_dsi_attach(dsi);
>
> if ( ret > 0) it return negative error code
ie if( ret < 0)
>
>> + if (ret) {
>> + dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
>> + drm_panel_remove(&priv->panel);
>> + return ret;
>
> use return dev_err_probe
>
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static void renesas_r69328_remove(struct mipi_dsi_device *dsi)
>> +{
>> + struct renesas_r69328 *priv = mipi_dsi_get_drvdata(dsi);
>> + int ret;
>> +
>> + ret = mipi_dsi_detach(dsi);
>
> if ( ret > 0) it return negative error code
ie if( ret < 0)
>
>> + if (ret)
>> + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
>> +
Thanks,
Alok
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel
2025-04-13 11:23 ` [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel Svyatoslav Ryhel
@ 2025-04-15 21:55 ` Rob Herring
2025-04-16 6:40 ` Svyatoslav Ryhel
0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2025-04-15 21:55 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter,
Krzysztof Kozlowski, Conor Dooley, dri-devel, devicetree,
linux-kernel
On Sun, Apr 13, 2025 at 02:23:58PM +0300, Svyatoslav Ryhel wrote:
> R61307 is liquid crystal driver for high-definition amorphous silicon
> (a-Si) panels and is ideal for tablets and smartphones.
>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
> .../display/panel/renesas,r61307.yaml | 93 +++++++++++++++++++
> 1 file changed, 93 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
>
> diff --git a/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml b/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
> new file mode 100644
> index 000000000000..a98d2d2e02d2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
> @@ -0,0 +1,93 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/panel/renesas,r61307.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Renesas R61307 based DSI Display Panel
> +
> +maintainers:
> + - Svyatoslav Ryhel <clamor95@gmail.com>
> +
> +description:
> + The Renesas R61307 is a generic DSI Panel IC used to control LCD panels.
> +
> +allOf:
> + - $ref: panel-common.yaml#
> +
> +properties:
> + compatible:
> + enum:
> + # KOE/HITACHI TX13D100VM0EAA 5.0" XGA TFT LCD panel
> + - hit,tx13d100vm0eaa
> + - koe,tx13d100vm0eaa
Usuually when the display IC is known, there's a fallback compatible for
it. Then 'renesas' vendor prefix on the properties makes more sense.
> +
> + reg:
> + maxItems: 1
> +
> + vcc-supply:
> + description: Regulator for main power supply.
> +
> + iovcc-supply:
> + description: Regulator for 1.8V IO power supply.
> +
> + backlight: true
> +
> + renesas,gamma:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + 0 - disabled
> + 1-3 - gamma setting A presets
> + enum: [0, 1, 2, 3]
> +
> + renesas,inversion:
> + type: boolean
> + description: switch between line and column inversion. The line
> + inversion is set by default.
The property name is odd since there's always some sort of
inversion. Perhaps renesas,column-inversion?
> +
> + renesas,contrast:
> + type: boolean
> + description: digital contrast adjustment
I would have expected contrast to be more than boolean. Is this
something any a-Si panel would support or somehow Renesas specific?
> +
> + reset-gpios: true
> + port: true
> +
> +required:
> + - compatible
> + - port
> + - backlight
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> +
> + dsi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + panel@1 {
> + compatible = "koe,tx13d100vm0eaa";
> + reg = <1>;
> +
> + reset-gpios = <&gpio 176 GPIO_ACTIVE_LOW>;
> +
> + renesas,gamma = <3>;
> + renesas,inversion;
> + renesas,contrast;
> +
> + vcc-supply = <&vcc_3v0_lcd>;
> + iovcc-supply = <&iovcc_1v8_lcd>;
> +
> + backlight = <&backlight>;
> +
> + port {
> + panel_in: endpoint {
> + remote-endpoint = <&dsi_out>;
> + };
> + };
> + };
> + };
> +
> +...
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel
2025-04-15 21:55 ` Rob Herring
@ 2025-04-16 6:40 ` Svyatoslav Ryhel
0 siblings, 0 replies; 9+ messages in thread
From: Svyatoslav Ryhel @ 2025-04-16 6:40 UTC (permalink / raw)
To: Rob Herring
Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter,
Krzysztof Kozlowski, Conor Dooley, dri-devel, devicetree,
linux-kernel
ср, 16 квіт. 2025 р. о 00:55 Rob Herring <robh@kernel.org> пише:
>
> On Sun, Apr 13, 2025 at 02:23:58PM +0300, Svyatoslav Ryhel wrote:
> > R61307 is liquid crystal driver for high-definition amorphous silicon
> > (a-Si) panels and is ideal for tablets and smartphones.
> >
> > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > ---
> > .../display/panel/renesas,r61307.yaml | 93 +++++++++++++++++++
> > 1 file changed, 93 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml b/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
> > new file mode 100644
> > index 000000000000..a98d2d2e02d2
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
> > @@ -0,0 +1,93 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/display/panel/renesas,r61307.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Renesas R61307 based DSI Display Panel
> > +
> > +maintainers:
> > + - Svyatoslav Ryhel <clamor95@gmail.com>
> > +
> > +description:
> > + The Renesas R61307 is a generic DSI Panel IC used to control LCD panels.
> > +
> > +allOf:
> > + - $ref: panel-common.yaml#
> > +
> > +properties:
> > + compatible:
> > + enum:
> > + # KOE/HITACHI TX13D100VM0EAA 5.0" XGA TFT LCD panel
> > + - hit,tx13d100vm0eaa
> > + - koe,tx13d100vm0eaa
>
> Usuually when the display IC is known, there's a fallback compatible for
> it. Then 'renesas' vendor prefix on the properties makes more sense.
>
Acknowledged, thank you.
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + vcc-supply:
> > + description: Regulator for main power supply.
> > +
> > + iovcc-supply:
> > + description: Regulator for 1.8V IO power supply.
> > +
> > + backlight: true
> > +
> > + renesas,gamma:
> > + $ref: /schemas/types.yaml#/definitions/uint32
> > + description:
> > + 0 - disabled
> > + 1-3 - gamma setting A presets
> > + enum: [0, 1, 2, 3]
> > +
> > + renesas,inversion:
> > + type: boolean
> > + description: switch between line and column inversion. The line
> > + inversion is set by default.
>
> The property name is odd since there's always some sort of
> inversion. Perhaps renesas,column-inversion?
>
Acknowledged, thank you.
> > +
> > + renesas,contrast:
> > + type: boolean
> > + description: digital contrast adjustment
>
> I would have expected contrast to be more than boolean. Is this
> something any a-Si panel would support or somehow Renesas specific?
>
ATM there is only one known set of commands regards digital contrast
adjustment and it application is optional, hence bool. However, panel
which my device uses refuses to work properly without this
configuration applied. Since there is no specific programming guide
regards this IC I cannot say for sure if this is panel specific or a
Renesas IC feature. When/if there will be any additional data
available this property can by adjusted or dropped.
> > +
> > + reset-gpios: true
> > + port: true
> > +
> > +required:
> > + - compatible
> > + - port
> > + - backlight
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + #include <dt-bindings/gpio/gpio.h>
> > +
> > + dsi {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > +
> > + panel@1 {
> > + compatible = "koe,tx13d100vm0eaa";
> > + reg = <1>;
> > +
> > + reset-gpios = <&gpio 176 GPIO_ACTIVE_LOW>;
> > +
> > + renesas,gamma = <3>;
> > + renesas,inversion;
> > + renesas,contrast;
> > +
> > + vcc-supply = <&vcc_3v0_lcd>;
> > + iovcc-supply = <&iovcc_1v8_lcd>;
> > +
> > + backlight = <&backlight>;
> > +
> > + port {
> > + panel_in: endpoint {
> > + remote-endpoint = <&dsi_out>;
> > + };
> > + };
> > + };
> > + };
> > +
> > +...
> > --
> > 2.43.0
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-04-16 6:40 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-13 11:23 [PATCH v1 0/4] drm: panel: add support for panels used in LG P880/P895 Svyatoslav Ryhel
2025-04-13 11:23 ` [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel Svyatoslav Ryhel
2025-04-15 21:55 ` Rob Herring
2025-04-16 6:40 ` Svyatoslav Ryhel
2025-04-13 11:23 ` [PATCH v1 2/4] drm: panel: Add support for Renesas R61307 based MIPI " Svyatoslav Ryhel
2025-04-13 11:24 ` [PATCH v1 3/4] dt-bindings: display: panel: Document Renesas R69328 based " Svyatoslav Ryhel
2025-04-13 11:24 ` [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI " Svyatoslav Ryhel
2025-04-13 16:50 ` ALOK TIWARI
2025-04-13 16:57 ` ALOK TIWARI
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).