mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-19 10:11:56 -05:00
drm/panel: sharp-ls060t1sx01: transition to mipi_dsi wrapped functions
Changes the sharp-ls060t1sx01 panel to use multi style functions for improved error handling. Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20250201185439.157613-1-tejasvipin76@gmail.com
This commit is contained in:
committed by
Douglas Anderson
parent
0e1daf2b32
commit
7e3bf00047
@@ -44,60 +44,39 @@ static void sharp_ls060_reset(struct sharp_ls060 *ctx)
|
||||
static int sharp_ls060_on(struct sharp_ls060 *ctx)
|
||||
{
|
||||
struct mipi_dsi_device *dsi = ctx->dsi;
|
||||
struct device *dev = &dsi->dev;
|
||||
int ret;
|
||||
struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
|
||||
|
||||
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
|
||||
|
||||
mipi_dsi_dcs_write_seq(dsi, 0xbb, 0x13);
|
||||
mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_MEMORY_START);
|
||||
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xbb, 0x13);
|
||||
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_MEMORY_START);
|
||||
|
||||
ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
msleep(120);
|
||||
mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
|
||||
mipi_dsi_msleep(&dsi_ctx, 120);
|
||||
|
||||
ret = mipi_dsi_dcs_set_display_on(dsi);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to set display on: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
msleep(50);
|
||||
mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
|
||||
mipi_dsi_msleep(&dsi_ctx, 50);
|
||||
|
||||
return 0;
|
||||
return dsi_ctx.accum_err;
|
||||
}
|
||||
|
||||
static int sharp_ls060_off(struct sharp_ls060 *ctx)
|
||||
static void sharp_ls060_off(struct sharp_ls060 *ctx)
|
||||
{
|
||||
struct mipi_dsi_device *dsi = ctx->dsi;
|
||||
struct device *dev = &dsi->dev;
|
||||
int ret;
|
||||
struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
|
||||
|
||||
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
|
||||
|
||||
ret = mipi_dsi_dcs_set_display_off(dsi);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to set display off: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
usleep_range(2000, 3000);
|
||||
mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
|
||||
mipi_dsi_usleep_range(&dsi_ctx, 2000, 3000);
|
||||
|
||||
ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to enter sleep mode: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
msleep(121);
|
||||
|
||||
return 0;
|
||||
mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
|
||||
mipi_dsi_msleep(&dsi_ctx, 121);
|
||||
}
|
||||
|
||||
static int sharp_ls060_prepare(struct drm_panel *panel)
|
||||
{
|
||||
struct sharp_ls060 *ctx = to_sharp_ls060(panel);
|
||||
struct device *dev = &ctx->dsi->dev;
|
||||
int ret;
|
||||
|
||||
ret = regulator_enable(ctx->vddi_supply);
|
||||
@@ -125,10 +104,8 @@ static int sharp_ls060_prepare(struct drm_panel *panel)
|
||||
sharp_ls060_reset(ctx);
|
||||
|
||||
ret = sharp_ls060_on(ctx);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to initialize panel: %d\n", ret);
|
||||
if (ret < 0)
|
||||
goto err_on;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -154,12 +131,8 @@ static int sharp_ls060_prepare(struct drm_panel *panel)
|
||||
static int sharp_ls060_unprepare(struct drm_panel *panel)
|
||||
{
|
||||
struct sharp_ls060 *ctx = to_sharp_ls060(panel);
|
||||
struct device *dev = &ctx->dsi->dev;
|
||||
int ret;
|
||||
|
||||
ret = sharp_ls060_off(ctx);
|
||||
if (ret < 0)
|
||||
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
|
||||
sharp_ls060_off(ctx);
|
||||
|
||||
regulator_disable(ctx->vddh_supply);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user