[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240628181238.169681-4-tejasvipin76@gmail.com>
Date: Fri, 28 Jun 2024 23:42:38 +0530
From: Tejas Vipin <tejasvipin76@...il.com>
To: tejasvipin76@...il.com,
neil.armstrong@...aro.org,
quic_jesszhan@...cinc.com
Cc: dianders@...omium.org,
maarten.lankhorst@...ux.intel.com,
mripard@...nel.org,
tzimmermann@...e.de,
airlied@...il.com,
daniel@...ll.ch,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] drm/panel: asus-z00t-tm5p5-n35596: transition to mipi_dsi wrapped functions
Use functions introduced in commit 966e397e4f60 ("drm/mipi-dsi:
Introduce mipi_dsi_*_write_seq_multi()") and commit f79d6d28d8fe
("drm/mipi-dsi: wrap more functions for streamline handling") for the
asus-z00t-tm5p5-n35596 panel.
Signed-off-by: Tejas Vipin <tejasvipin76@...il.com>
---
.../drm/panel/panel-asus-z00t-tm5p5-n35596.c | 140 ++++++++----------
1 file changed, 59 insertions(+), 81 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
index bcaa63d1955f..b05a663c134c 100644
--- a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
+++ b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
@@ -33,119 +33,97 @@ static void tm5p5_nt35596_reset(struct tm5p5_nt35596 *ctx)
usleep_range(15000, 16000);
}
-static int tm5p5_nt35596_on(struct tm5p5_nt35596 *ctx)
+static void tm5p5_nt35596_on(struct mipi_dsi_multi_context *dsi_ctx)
{
- struct mipi_dsi_device *dsi = ctx->dsi;
-
- mipi_dsi_generic_write_seq(dsi, 0xff, 0x05);
- mipi_dsi_generic_write_seq(dsi, 0xfb, 0x01);
- mipi_dsi_generic_write_seq(dsi, 0xc5, 0x31);
- mipi_dsi_generic_write_seq(dsi, 0xff, 0x04);
- mipi_dsi_generic_write_seq(dsi, 0x01, 0x84);
- mipi_dsi_generic_write_seq(dsi, 0x05, 0x25);
- mipi_dsi_generic_write_seq(dsi, 0x06, 0x01);
- mipi_dsi_generic_write_seq(dsi, 0x07, 0x20);
- mipi_dsi_generic_write_seq(dsi, 0x08, 0x06);
- mipi_dsi_generic_write_seq(dsi, 0x09, 0x08);
- mipi_dsi_generic_write_seq(dsi, 0x0a, 0x10);
- mipi_dsi_generic_write_seq(dsi, 0x0b, 0x10);
- mipi_dsi_generic_write_seq(dsi, 0x0c, 0x10);
- mipi_dsi_generic_write_seq(dsi, 0x0d, 0x14);
- mipi_dsi_generic_write_seq(dsi, 0x0e, 0x14);
- mipi_dsi_generic_write_seq(dsi, 0x0f, 0x14);
- mipi_dsi_generic_write_seq(dsi, 0x10, 0x14);
- mipi_dsi_generic_write_seq(dsi, 0x11, 0x14);
- mipi_dsi_generic_write_seq(dsi, 0x12, 0x14);
- mipi_dsi_generic_write_seq(dsi, 0x17, 0xf3);
- mipi_dsi_generic_write_seq(dsi, 0x18, 0xc0);
- mipi_dsi_generic_write_seq(dsi, 0x19, 0xc0);
- mipi_dsi_generic_write_seq(dsi, 0x1a, 0xc0);
- mipi_dsi_generic_write_seq(dsi, 0x1b, 0xb3);
- mipi_dsi_generic_write_seq(dsi, 0x1c, 0xb3);
- mipi_dsi_generic_write_seq(dsi, 0x1d, 0xb3);
- mipi_dsi_generic_write_seq(dsi, 0x1e, 0xb3);
- mipi_dsi_generic_write_seq(dsi, 0x1f, 0xb3);
- mipi_dsi_generic_write_seq(dsi, 0x20, 0xb3);
- mipi_dsi_generic_write_seq(dsi, 0xfb, 0x01);
- mipi_dsi_generic_write_seq(dsi, 0xff, 0x00);
- mipi_dsi_generic_write_seq(dsi, 0xfb, 0x01);
- mipi_dsi_generic_write_seq(dsi, 0x35, 0x01);
- mipi_dsi_generic_write_seq(dsi, 0xd3, 0x06);
- mipi_dsi_generic_write_seq(dsi, 0xd4, 0x04);
- mipi_dsi_generic_write_seq(dsi, 0x5e, 0x0d);
- mipi_dsi_generic_write_seq(dsi, 0x11, 0x00);
- msleep(100);
- mipi_dsi_generic_write_seq(dsi, 0x29, 0x00);
- mipi_dsi_generic_write_seq(dsi, 0x53, 0x24);
-
- return 0;
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xff, 0x05);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xc5, 0x31);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xff, 0x04);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x01, 0x84);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x05, 0x25);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x06, 0x01);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x07, 0x20);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x08, 0x06);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x09, 0x08);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x0a, 0x10);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x0b, 0x10);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x0c, 0x10);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x0d, 0x14);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x0e, 0x14);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x0f, 0x14);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x10, 0x14);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x11, 0x14);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x12, 0x14);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x17, 0xf3);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x18, 0xc0);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x19, 0xc0);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x1a, 0xc0);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x1b, 0xb3);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x1c, 0xb3);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x1d, 0xb3);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x1e, 0xb3);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x1f, 0xb3);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x20, 0xb3);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xff, 0x00);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x35, 0x01);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xd3, 0x06);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0xd4, 0x04);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x5e, 0x0d);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x11, 0x00);
+
+ mipi_dsi_msleep(dsi_ctx, 100);
+
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x29, 0x00);
+ mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x53, 0x24);
}
-static int tm5p5_nt35596_off(struct tm5p5_nt35596 *ctx)
+static void tm5p5_nt35596_off(struct mipi_dsi_multi_context *dsi_ctx)
{
- struct mipi_dsi_device *dsi = ctx->dsi;
- struct device *dev = &dsi->dev;
- int ret;
-
- ret = mipi_dsi_dcs_set_display_off(dsi);
- if (ret < 0) {
- dev_err(dev, "Failed to set display off: %d\n", ret);
- return ret;
- }
- msleep(60);
+ mipi_dsi_dcs_set_display_off_multi(dsi_ctx);
- ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
- if (ret < 0) {
- dev_err(dev, "Failed to enter sleep mode: %d\n", ret);
- return ret;
- }
+ mipi_dsi_msleep(dsi_ctx, 60);
- mipi_dsi_dcs_write_seq(dsi, 0x4f, 0x01);
+ mipi_dsi_dcs_enter_sleep_mode_multi(dsi_ctx);
- return 0;
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x4f, 0x01);
}
static int tm5p5_nt35596_prepare(struct drm_panel *panel)
{
struct tm5p5_nt35596 *ctx = to_tm5p5_nt35596(panel);
- struct device *dev = &ctx->dsi->dev;
- int ret;
+ struct mipi_dsi_multi_context dsi_ctx = {.dsi = ctx->dsi};
- ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
- if (ret < 0) {
- dev_err(dev, "Failed to enable regulators: %d\n", ret);
- return ret;
- }
+ dsi_ctx.accum_err = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
+ if (dsi_ctx.accum_err)
+ return dsi_ctx.accum_err;
tm5p5_nt35596_reset(ctx);
- ret = tm5p5_nt35596_on(ctx);
- if (ret < 0) {
- dev_err(dev, "Failed to initialize panel: %d\n", ret);
+ tm5p5_nt35596_on(&dsi_ctx);
+
+ if (dsi_ctx.accum_err) {
gpiod_set_value_cansleep(ctx->reset_gpio, 0);
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies),
ctx->supplies);
- return ret;
}
- return 0;
+ return dsi_ctx.accum_err;
}
static int tm5p5_nt35596_unprepare(struct drm_panel *panel)
{
struct tm5p5_nt35596 *ctx = to_tm5p5_nt35596(panel);
- struct device *dev = &ctx->dsi->dev;
- int ret;
+ struct mipi_dsi_multi_context dsi_ctx = {.dsi = ctx->dsi};
- ret = tm5p5_nt35596_off(ctx);
- if (ret < 0)
- dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
+ tm5p5_nt35596_off(&dsi_ctx);
gpiod_set_value_cansleep(ctx->reset_gpio, 0);
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies),
ctx->supplies);
- return 0;
+ return dsi_ctx.accum_err;
}
static const struct drm_display_mode tm5p5_nt35596_mode = {
--
2.45.2
Powered by blists - more mailing lists