From patchwork Sun Aug 18 06:08:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejas Vipin X-Patchwork-Id: 13767335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBCF8C52D7C for ; Sun, 18 Aug 2024 06:08:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CD8010E055; Sun, 18 Aug 2024 06:08:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZqR18yEn"; dkim-atps=neutral Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id D85DF10E055 for ; Sun, 18 Aug 2024 06:08:31 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2d3bc043e81so2491085a91.2 for ; Sat, 17 Aug 2024 23:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723961311; x=1724566111; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UnhRO8oIbYzeyc2+UcIe5cCUCjnBIooF0x4NCKcs5c0=; b=ZqR18yEnVKhIOYdIKCT9asoasbK6Tk6JcFxAPIfV/M10WE9sCM+Ms2z4xmRfAQTJVY mWCXCmtG3IrLcFHflHENY9L8ENJ1ThCNPKMfvnO67H0z1h5f5RikzZYYaFrnXck0tZUH SV6QrvvnOHjXP+QCJp/ho1j6/gAc4BU6YM/f3jRN3gF72iSCkbmYLjccPS0xdiCM0Dbr m+myCL/la3Vrrj5YaLQfTvGdcaFyLBLatOiWq3+gWBYeZxxWH7qO9NdIoOnZUkPPakFp C9atXDQAlrAmJsI7oeqd9Z2o+GSm7VJpBPaGra4DtyT4OKgAMMsjqYL4cBa7YC4ujU6O XY0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723961311; x=1724566111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UnhRO8oIbYzeyc2+UcIe5cCUCjnBIooF0x4NCKcs5c0=; b=afOUeYH4SbuYlaYfJjOj38x4DgYrmARwz8GY3+R3AwT6xlh7nlo9GvnuBjyU29DGSL ZWMYHtZXUBccAaQVzZGm8o09PQAVcrtSnmjfiP8QLcTQjVFYUP40gYaNe9DyBc0MubvE /TkoxWCbpkD1sN67u6TsQvZ/rBHKT9jd7i7YZsU2taqOneCiUdl2gZSlsjrcgjeKv6Z6 nxl8L1Nx1KgAlsDZGHIm4tJyzpuAV3oQwD6APgnT1SyhByl9GEAuzuuXOgHIL/0QRGxM nY5/wpM8I7u5th7XdTB4kE63LN2ibW9gVpa5OyBCVteWNVAAfIAAKD6q8V1qQNlWxskn zxfg== X-Forwarded-Encrypted: i=1; AJvYcCXhz9kL1FsGPpONwzxtLzaUs5tPfpnZTJ+SeKziwTxv0JlcOjaEdtUgRMUbRQejkfqJ/G6QrFU28t/PilHwemt9u7a/dLK2+1dgdrgWaeFs X-Gm-Message-State: AOJu0Yy3tRIRJxgwMcVFPWwDDY6kVzDL1NgyWsHxWbeLo+ImXEQbVyzQ B1x9KOckWjMyRs/qNHWo1ysuLAyW3LHLAV7I16ABBjh/sdedpL+G X-Google-Smtp-Source: AGHT+IFKX+dkBN6/eSiq0VUEAhavDIJd0EypI+SXpKA6+P2rIe7RILckQEXPojZOkD0j1gGj5WjfXA== X-Received: by 2002:a17:90a:a787:b0:2cb:3306:b2cc with SMTP id 98e67ed59e1d1-2d3dfc2aa4amr8742078a91.1.1723961311044; Sat, 17 Aug 2024 23:08:31 -0700 (PDT) Received: from distilledx.srmu.edu.in ([2401:4900:6322:f541:ea23:e535:a48c:3c88]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d4394e01b4sm236228a91.46.2024.08.17.23.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2024 23:08:30 -0700 (PDT) From: Tejas Vipin To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, neil.armstrong@linaro.org, quic_jesszhan@quicinc.com Cc: dianders@chromium.org, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tejas Vipin Subject: [PATCH v3 1/2] drm/mipi-dsi: Add mipi_dsi_dcs_set_tear_scanline_multi Date: Sun, 18 Aug 2024 11:38:15 +0530 Message-ID: <20240818060816.848784-2-tejasvipin76@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240818060816.848784-1-tejasvipin76@gmail.com> References: <20240818060816.848784-1-tejasvipin76@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" mipi_dsi_dcs_set_tear_scanline_multi can heavily benefit from being converted to a multi style function as it is often called in the context of similar functions. Reviewed-by: Douglas Anderson Signed-off-by: Tejas Vipin --- drivers/gpu/drm/drm_mipi_dsi.c | 31 +++++++++++++++++++++++++++++++ include/drm/drm_mipi_dsi.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 8d0a866cf1e0..b7ad18c148c2 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -1339,6 +1339,9 @@ EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format); * @dsi: DSI peripheral device * @scanline: scanline to use as trigger * + * This function is deprecated. Use mipi_dsi_dcs_set_tear_scanline_multi() + * instead. + * * Return: 0 on success or a negative error code on failure */ int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline) @@ -1833,6 +1836,34 @@ void mipi_dsi_dcs_set_page_address_multi(struct mipi_dsi_multi_context *ctx, } EXPORT_SYMBOL(mipi_dsi_dcs_set_page_address_multi); +/** + * mipi_dsi_dcs_set_tear_scanline_multi() - set the scanline to use as trigger for + * the Tearing Effect output signal of the display module + * @ctx: Context for multiple DSI transactions + * @scanline: scanline to use as trigger + * + * Like mipi_dsi_dcs_set_tear_scanline() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_dcs_set_tear_scanline_multi(struct mipi_dsi_multi_context *ctx, + u16 scanline) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + int ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_dcs_set_tear_scanline(dsi, scanline); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "Failed to set tear scanline: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_scanline_multi); + static int mipi_dsi_drv_probe(struct device *dev) { struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 602be6ce081a..c823cc13ad1f 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -375,6 +375,8 @@ void mipi_dsi_dcs_set_column_address_multi(struct mipi_dsi_multi_context *ctx, u16 start, u16 end); void mipi_dsi_dcs_set_page_address_multi(struct mipi_dsi_multi_context *ctx, u16 start, u16 end); +void mipi_dsi_dcs_set_tear_scanline_multi(struct mipi_dsi_multi_context *ctx, + u16 scanline); /** * mipi_dsi_generic_write_seq - transmit data using a generic write packet From patchwork Sun Aug 18 06:08:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejas Vipin X-Patchwork-Id: 13767336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06327C5320E for ; Sun, 18 Aug 2024 06:08:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5545910E066; Sun, 18 Aug 2024 06:08:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HPf6GF4K"; dkim-atps=neutral Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id F098810E066 for ; Sun, 18 Aug 2024 06:08:35 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2d41b082aecso363495a91.0 for ; Sat, 17 Aug 2024 23:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723961315; x=1724566115; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q7ad08V9dWOOHyWHL258V3QEERYZAETpc4J3fM7chOc=; b=HPf6GF4KK7aLQd6dLtMF8ma/EIsdfsCoZo+xNZlzeYN93FluYOVbdRizKy8tvAZN7Z kvRPQmfRVzhlfnYLed+3GknF03xNlbClR4LVOLTUwACMX0+9sOYsXTg/7PRzsxO9NXOY eSbn8XuvA4TtEdZSvfWeFsZfY5/ZohJxW5QYKYrQ+O+E1pIBoFAYokJVGb6VXk/ErR5Z mObIF98CQsrJ4Z5uE9ZfzEFsD45su0M9Rq0sT0zPyHuPBrL/DVINWzAWD02ARXmGyQEw CuJEjlvqiAaE2Ll8hhWgS5IXyPpRupIHaBhEyM0aFUpBOho2rEL0cvU49HmQ7Fa9DQNu TR1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723961315; x=1724566115; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q7ad08V9dWOOHyWHL258V3QEERYZAETpc4J3fM7chOc=; b=Us26LmNORxRwCez21vLo+7hnh5x9sJT7ApmIS9LIRBMfIAw10TYB7vj85BsCzxspnR FdxVpvKciKnTIqjCChT/YXdhDT7c5iZf7NhV31KlnVSY5BpF2NW644QhXN+0hD8kUEpy SWaX1ZvxTMGz1tSdMgWEw6y+qChz9QY2wBSO21tf1Tok0Vwq0yq2x7ChDnJnmfpPXLlY loT/ACHzo484d1TZ/zYF7S76SNZAeUI2XOWASe6iTSTtBpAWtzlpISZtXj+PhjWRO4lD onc2ibfwkP7Q5KDxa3gJPKJCPCF3mGYR1/nYZd9LkZh3R5HAACSnPcWn6H8ECU8Z9rqw U2pw== X-Forwarded-Encrypted: i=1; AJvYcCUZXk2/1NXnmZEkIbSHO2O1nP08qm1XD4xGItsQBSt4l2mk2kBNfarbkhFtebEtWR6sXbVhxW0T1amVRj9PwqgVlorD6X5byoLMT8lkWACd X-Gm-Message-State: AOJu0YwbSt5J4QdtIqP3l5NPSN9zS4/xvcXmG4JjuKAFsOqcsnL3BZLi HNB4njqeIHqePpb6jn9QZsOq5g63D3ymM1jdzjFE4JOufIX4Sy+Y X-Google-Smtp-Source: AGHT+IFRtCSERfuy675a0jOJLl4KWwWGVGXXS4VlR/U2FYPHZXXE4rpb1RZGXKMSWZ1kKar/w+HVqA== X-Received: by 2002:a17:90b:124b:b0:2d3:ad05:7240 with SMTP id 98e67ed59e1d1-2d3c3aa98bbmr16548494a91.22.1723961315162; Sat, 17 Aug 2024 23:08:35 -0700 (PDT) Received: from distilledx.srmu.edu.in ([2401:4900:6322:f541:ea23:e535:a48c:3c88]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d4394e01b4sm236228a91.46.2024.08.17.23.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2024 23:08:34 -0700 (PDT) From: Tejas Vipin To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, neil.armstrong@linaro.org, quic_jesszhan@quicinc.com Cc: dianders@chromium.org, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tejas Vipin Subject: [PATCH v3 2/2] drm/panel: jdi-fhd-r63452: transition to mipi_dsi wrapped functions Date: Sun, 18 Aug 2024 11:38:16 +0530 Message-ID: <20240818060816.848784-3-tejasvipin76@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240818060816.848784-1-tejasvipin76@gmail.com> References: <20240818060816.848784-1-tejasvipin76@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Changes the jdi-fhd-r63452 panel to use multi style functions for improved error handling. Reviewed-by: Douglas Anderson Signed-off-by: Tejas Vipin --- drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 149 ++++++------------- 1 file changed, 48 insertions(+), 101 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c index 483dc88d16d8..4eb71e85e9e9 100644 --- a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c +++ b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c @@ -41,142 +41,89 @@ static void jdi_fhd_r63452_reset(struct jdi_fhd_r63452 *ctx) static int jdi_fhd_r63452_on(struct jdi_fhd_r63452 *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_generic_write_seq(dsi, 0xb0, 0x00); - mipi_dsi_generic_write_seq(dsi, 0xd6, 0x01); - mipi_dsi_generic_write_seq(dsi, 0xec, - 0x64, 0xdc, 0xec, 0x3b, 0x52, 0x00, 0x0b, 0x0b, - 0x13, 0x15, 0x68, 0x0b, 0xb5); - mipi_dsi_generic_write_seq(dsi, 0xb0, 0x03); - - ret = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); - if (ret < 0) { - dev_err(dev, "Failed to set tear on: %d\n", ret); - return ret; - } - - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb0, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xd6, 0x01); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xec, + 0x64, 0xdc, 0xec, 0x3b, 0x52, 0x00, 0x0b, 0x0b, + 0x13, 0x15, 0x68, 0x0b, 0xb5); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb0, 0x03); - ret = mipi_dsi_dcs_set_pixel_format(dsi, 0x77); - if (ret < 0) { - dev_err(dev, "Failed to set pixel format: %d\n", ret); - return ret; - } - - ret = mipi_dsi_dcs_set_column_address(dsi, 0x0000, 0x0437); - if (ret < 0) { - dev_err(dev, "Failed to set column address: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_tear_on_multi(&dsi_ctx, MIPI_DSI_DCS_TEAR_MODE_VBLANK); - ret = mipi_dsi_dcs_set_page_address(dsi, 0x0000, 0x077f); - if (ret < 0) { - dev_err(dev, "Failed to set page address: %d\n", ret); - return ret; - } + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00); - ret = mipi_dsi_dcs_set_tear_scanline(dsi, 0x0000); - if (ret < 0) { - dev_err(dev, "Failed to set tear scanline: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_pixel_format_multi(&dsi_ctx, 0x77); + mipi_dsi_dcs_set_column_address_multi(&dsi_ctx, 0x0000, 0x0437); + mipi_dsi_dcs_set_page_address_multi(&dsi_ctx, 0x0000, 0x077f); + mipi_dsi_dcs_set_tear_scanline_multi(&dsi_ctx, 0x0000); + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x00ff); - ret = mipi_dsi_dcs_set_display_brightness(dsi, 0x00ff); - if (ret < 0) { - dev_err(dev, "Failed to set display brightness: %d\n", ret); - return ret; - } + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_SET_CABC_MIN_BRIGHTNESS, 0x00); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x84, 0x00); - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24); - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_CABC_MIN_BRIGHTNESS, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x84, 0x00); + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 20); + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 80); - 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(20); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb0, 0x04); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x84, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xc8, 0x11); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb0, 0x03); - 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(80); - - mipi_dsi_generic_write_seq(dsi, 0xb0, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x84, 0x00); - mipi_dsi_generic_write_seq(dsi, 0xc8, 0x11); - mipi_dsi_generic_write_seq(dsi, 0xb0, 0x03); - - return 0; + return dsi_ctx.accum_err; } -static int jdi_fhd_r63452_off(struct jdi_fhd_r63452 *ctx) +static void jdi_fhd_r63452_off(struct jdi_fhd_r63452 *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_generic_write_seq(dsi, 0xb0, 0x00); - mipi_dsi_generic_write_seq(dsi, 0xd6, 0x01); - mipi_dsi_generic_write_seq(dsi, 0xec, - 0x64, 0xdc, 0xec, 0x3b, 0x52, 0x00, 0x0b, 0x0b, - 0x13, 0x15, 0x68, 0x0b, 0x95); - mipi_dsi_generic_write_seq(dsi, 0xb0, 0x03); - - 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); - - 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(120); - - return 0; + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb0, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xd6, 0x01); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xec, + 0x64, 0xdc, 0xec, 0x3b, 0x52, 0x00, 0x0b, 0x0b, + 0x13, 0x15, 0x68, 0x0b, 0x95); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb0, 0x03); + + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); + mipi_dsi_usleep_range(&dsi_ctx, 2000, 3000); + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 120); } static int jdi_fhd_r63452_prepare(struct drm_panel *panel) { struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel); - struct device *dev = &ctx->dsi->dev; int ret; jdi_fhd_r63452_reset(ctx); ret = jdi_fhd_r63452_on(ctx); - if (ret < 0) { - dev_err(dev, "Failed to initialize panel: %d\n", ret); + if (ret < 0) gpiod_set_value_cansleep(ctx->reset_gpio, 1); - return ret; - } - return 0; + return ret; } static int jdi_fhd_r63452_unprepare(struct drm_panel *panel) { struct jdi_fhd_r63452 *ctx = to_jdi_fhd_r63452(panel); - struct device *dev = &ctx->dsi->dev; - int ret; - ret = jdi_fhd_r63452_off(ctx); - if (ret < 0) - dev_err(dev, "Failed to un-initialize panel: %d\n", ret); + /* + * NOTE: We don't return an error here as while the panel won't have + * been cleanly turned off at least we've asserted the reset signal + * so it should be safe to power it back on again later + */ + jdi_fhd_r63452_off(ctx); gpiod_set_value_cansleep(ctx->reset_gpio, 1);