From patchwork Sat May 11 23:00:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13662552 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 9B07EC04FFE for ; Sat, 11 May 2024 23:00:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B688710E0CB; Sat, 11 May 2024 23:00:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="wZBgef1t"; dkim-atps=neutral Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 61ACA10E045 for ; Sat, 11 May 2024 23:00:29 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-5206a5854adso3320549e87.0 for ; Sat, 11 May 2024 16:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715468427; x=1716073227; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7ItR8Il0wZKComYTOQXyrvGGchY2JbpvV93y+cdGZEE=; b=wZBgef1tAhw/L7VP35o9LI5Q6L39BL892bI01Ky+nC8L0f+A7qhLpQmWEfPsX2GsMK PPYmvMWbI2qw0glqLZpqIVrAWVUvspwe8Hu9nmrfdwHBr1b7jJqyPqZNCdaDR+3CCpBy hfXa4gyr/c78owE3V3vqNnXcdgeIMFk73SkBa+dpOQIW2ou2fB6zgZCOfC2Km5AMtGFT peJkG9DnzHf/S8p/bUuid1NgiaCFeieN8Rx3dKNQPlk3XkxzCI8LAHZ1U+L5SmZi8YoO 2ry1mCAm9bl4s3ndS+ZeeE34CJJdlardCVp4i0yqnphE0bmiv3l434VPPyRVUgQObnPT S4wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715468427; x=1716073227; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7ItR8Il0wZKComYTOQXyrvGGchY2JbpvV93y+cdGZEE=; b=Exhux9W69NfoXP+D8vDwPcytLi11ef+nzWA5x/rrG0HKpEnZRmsqEzDhwUdmVe+ZE0 xRE41DO/mudul/PmV6wMrC+ZtjgSP5GtvE08PZgdTtFQB6MIaOeCxls/9OFKTKHTLvs9 2Lo2C5PoLFkw0/MHvOhJC9rJ6+ZoNc6uqXxD4lujeMduuhyszuNqbHqrfVFmnDOwIHeJ seUNDZ7iocq+Iw0KxuoNIZM9ff2TdPMMweKpb5lST2H2baCM9UKkikheD3hNIp4D3yHd 3JgqIi9no0fgETibw4b/cbH58sO85WJtyG13NJ0u3RarUyDCWgELzNK3TGFTbCy0qoNs tkFA== X-Forwarded-Encrypted: i=1; AJvYcCWt1ObCYioQQne8WT0pOKvfqoWzUJCdLbEsKP2RqExS/w6sUor3T8P632q/foSU+CV/VzdznMVJCVxZeFtVTTdd3apLFVw/5+wh5WL3fX9M X-Gm-Message-State: AOJu0Yw47PyC8NveAJGYD+ll4XA0P2NU1yW9yntgTE575DJe8oewQ9bt gcdVUjz4m88lQop/0KkGiJxD062mlPHb4irl4bmwL1sBu9BkZyXEwcvH6LEpry8= X-Google-Smtp-Source: AGHT+IGupD6xSF5z3LDxw5fpnNiXEVPwrXMtCUrN+VFBtOrmIH4ipNMQ9NazLPourMk+7YDo207urw== X-Received: by 2002:a05:6512:ba3:b0:518:8d15:8810 with SMTP id 2adb3069b0e04-5220fc7354cmr5061661e87.14.1715468427451; Sat, 11 May 2024 16:00:27 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f38d3717sm1134222e87.173.2024.05.11.16.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 16:00:26 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 12 May 2024 02:00:18 +0300 Subject: [PATCH v2 1/7] drm/panel: lg-sw43408: add missing error handling MIME-Version: 1.0 Message-Id: <20240512-dsi-panels-upd-api-v2-1-e31ca14d102e@linaro.org> References: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> In-Reply-To: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> To: Douglas Anderson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Sumit Semwal , Caleb Connolly , Marijn Suijten , Vinod Koul Cc: Cong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2884; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=sjNwNWt1lktWQrmL6beKWmXl2L8FICi4sYx1xY8LX/4=; b=owEBbAGT/pANAwAKAYs8ij4CKSjVAcsmYgBmP/iIq2PSj7Y1vez6Rc2QseG7HDNb8trfZ6GFD fbOLvZ4cmeJATIEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZj/4iAAKCRCLPIo+Aiko 1RPRB/iPkeSgZV6o0AQqVNOnA/LGZ26CD5knxYfdT6mUpksmIdzNgz51P7eJqFplreJORm+ki18 Ak5BJgGG1G/Le90JBUp2AAfXsWY8Qyc4blaMEuaiR7idSxNgE3dIMdrdKAxvV+Y8Km3qAquwJXw XX1uW/CIGcFwAkWYummz3BUUcQvximQ8c1502Q2MWhPeH/LD/Eb3qLSn9gzcXWL90IZXsQqaMrd TADER+4+U8OhlF9N29/espaXx4aqOR7cgeJ812G0t+TXDhqUA/nD2ptzrzxANloKyaGOrI1Qnfm fPGdECpiiVL/ErgtxppPVEIEBME0FKNDHgTZbbRHeR1R0T4= X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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" Add missing error handling for the mipi_dsi_ functions that actually return error code instead of silently ignoring it. Fixes: 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver") Reviewed-by: Douglas Anderson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-lg-sw43408.c | 33 ++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c index 2b3a73696dce..67a98ac508f8 100644 --- a/drivers/gpu/drm/panel/panel-lg-sw43408.c +++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c @@ -62,16 +62,25 @@ static int sw43408_program(struct drm_panel *panel) { struct sw43408_panel *ctx = to_panel_info(panel); struct drm_dsc_picture_parameter_set pps; + int ret; mipi_dsi_dcs_write_seq(ctx->link, MIPI_DCS_SET_GAMMA_CURVE, 0x02); - mipi_dsi_dcs_set_tear_on(ctx->link, MIPI_DSI_DCS_TEAR_MODE_VBLANK); + ret = mipi_dsi_dcs_set_tear_on(ctx->link, MIPI_DSI_DCS_TEAR_MODE_VBLANK); + if (ret < 0) { + dev_err(panel->dev, "Failed to set tearing: %d\n", ret); + return ret; + } mipi_dsi_dcs_write_seq(ctx->link, 0x53, 0x0c, 0x30); mipi_dsi_dcs_write_seq(ctx->link, 0x55, 0x00, 0x70, 0xdf, 0x00, 0x70, 0xdf); mipi_dsi_dcs_write_seq(ctx->link, 0xf7, 0x01, 0x49, 0x0c); - mipi_dsi_dcs_exit_sleep_mode(ctx->link); + ret = mipi_dsi_dcs_exit_sleep_mode(ctx->link); + if (ret < 0) { + dev_err(panel->dev, "Failed to exit sleep mode: %d\n", ret); + return ret; + } msleep(135); @@ -97,14 +106,22 @@ static int sw43408_program(struct drm_panel *panel) mipi_dsi_dcs_write_seq(ctx->link, 0x55, 0x04, 0x61, 0xdb, 0x04, 0x70, 0xdb); mipi_dsi_dcs_write_seq(ctx->link, 0xb0, 0xca); - mipi_dsi_dcs_set_display_on(ctx->link); + ret = mipi_dsi_dcs_set_display_on(ctx->link); + if (ret < 0) { + dev_err(panel->dev, "Failed to set display on: %d\n", ret); + return ret; + } msleep(50); ctx->link->mode_flags &= ~MIPI_DSI_MODE_LPM; drm_dsc_pps_payload_pack(&pps, ctx->link->dsc); - mipi_dsi_picture_parameter_set(ctx->link, &pps); + ret = mipi_dsi_picture_parameter_set(ctx->link, &pps); + if (ret < 0) { + dev_err(panel->dev, "Failed to set PPS: %d\n", ret); + return ret; + } ctx->link->mode_flags |= MIPI_DSI_MODE_LPM; @@ -113,8 +130,12 @@ static int sw43408_program(struct drm_panel *panel) * PPS 1 if pps_identifier is 0 * PPS 2 if pps_identifier is 1 */ - mipi_dsi_compression_mode_ext(ctx->link, true, - MIPI_DSI_COMPRESSION_DSC, 1); + ret = mipi_dsi_compression_mode_ext(ctx->link, true, + MIPI_DSI_COMPRESSION_DSC, 1); + if (ret < 0) { + dev_err(panel->dev, "Failed to set compression mode: %d\n", ret); + return ret; + } return 0; } From patchwork Sat May 11 23:00:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13662554 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 0E1A9C25B75 for ; Sat, 11 May 2024 23:00:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E624110E0A3; Sat, 11 May 2024 23:00:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PlF9Cwla"; dkim-atps=neutral Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 33D1710E0A3 for ; Sat, 11 May 2024 23:00:30 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-52232d0e5ceso1313463e87.0 for ; Sat, 11 May 2024 16:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715468428; x=1716073228; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4BS3LNsIzlA8pD9hWWnKhxqZdHat5J4SEHWcVJTYiOg=; b=PlF9CwlaVIjdBLLZCsGd5WcLzFBPwUvFDMxTHMVOTJycGtfc6PUjvvsN9vEwLhbmdT L9zWxQAxXVQ144PkiasUFupYeg55MGd/keAwuAFW+mGuEcbXt4cOGaPiIN+4R1LOcUgB 3Dhk9ugDK4wQkfwO7ZVgbq/pMu7mYX7QjbdBhVJv8IEcXTTz29ibfZvBAsc35mcIvWgL WShbJpu4uIONSndxCpTq5k9qgQmpNe16PlY78j4z7uYuEPOw+OMSSmIlwJZu0HqqZplf 7rcn8J+Bw+S4CA+sj9oXEbssrbVYx9ayKVj8I8mD3/X6W+YL43jdZ75VKOJ147U4AfKV 7iwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715468428; x=1716073228; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4BS3LNsIzlA8pD9hWWnKhxqZdHat5J4SEHWcVJTYiOg=; b=a0ekyjCDNbJVVmao2Heji1hOh5QAmRLH2OSzb488PBYsKVpI7La02iGysUdfzptFsJ zqPfM3qFf6sOTRm79Ro3zNGkvL8yk4GBPrkxFD2K+lEw0nxXQU7q62x/QA5iiLTHknaK tnybyz1ZzMdPD/4lM5pKd5p0cm7u9YR9adjjbdgip3U413sO74fatDYT6xx6V3Lzv+Ka TU8Xgacg5HQoOdNHwdpQse+vF2q6pGhZr05YHFFQ6qTafLMpgaG5Vk+IRHLpbJI74m9n psELm5Quu986v+ib6d8J44RmKPgpJLlHDSTWOjHg0qNlVg0Nub7Ri5ksVTpw5YmAcyeC 3fHw== X-Forwarded-Encrypted: i=1; AJvYcCVaYDRtP3fk25QsD+04h8u6q4V0dlw0yHVxbpzxX5JgkbapxETVmIa1H54Ig9YJf/QvtVRIdqAoCsogUbfy+D3Md+uXrIivUuhgocziqs3d X-Gm-Message-State: AOJu0Yw6pzN0nV3mmy2XZzdwNoXPXbhXqUiULUBn78qQvqbpEsSOsv6T +V4iJTTiJscGEs7HbdIlf07DArMsLAYluvhJV0uLj9+MRzZkSIiIhWfEGaKyRfw= X-Google-Smtp-Source: AGHT+IGq3Q77PQC8pmuzZ6UbAb6S/DSxzj2GbGKSeMaal6d2Z8qeLT1e0EII0XLJJoahQXmtJxYm6w== X-Received: by 2002:a05:6512:33c5:b0:522:2a2c:759e with SMTP id 2adb3069b0e04-5222a2c76c2mr3462466e87.6.1715468428300; Sat, 11 May 2024 16:00:28 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f38d3717sm1134222e87.173.2024.05.11.16.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 16:00:27 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 12 May 2024 02:00:19 +0300 Subject: [PATCH v2 2/7] drm/mipi-dsi: wrap more functions for streamline handling MIME-Version: 1.0 Message-Id: <20240512-dsi-panels-upd-api-v2-2-e31ca14d102e@linaro.org> References: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> In-Reply-To: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> To: Douglas Anderson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Sumit Semwal , Caleb Connolly , Marijn Suijten , Vinod Koul Cc: Cong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=9508; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=xi5U71kz8T87h4VViIeLZOLRoolhq+/AdfXL3EWovWo=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmP/iILRHsslbO7N+jkxp9j4cFntTv96XBqLvLi sJVcR2kvcaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZj/4iAAKCRCLPIo+Aiko 1Z9DB/0SiooYtozFy/Si/1cRF+TFzLyCUNPoKFTkvKu71M6eLqaVvGWGYZRJ5Djj2A2Wr6dh5OJ 04lXqSIRYYlGMZJn0TZ4gByg2Ta3ZQafWiYOCAQSt92HyF8sk0JMCDHrSDOVwgnxElRgrwpC+vm QhGAijjacI42OHeCidtyTb+1exey8sb5eYYkve013ZUe1uzDA2EUgSp+Os/rRoVCpv++MsBdT7R 9GJ18MvwTzNpQUC7EL/i8aTAXUgccXL1laDgdkFu7QN9xG3HSj1h901jpKDsCBdFVPZi810GmwF 6JonyQp5VKjq0WcXTE1IZyH7DpnkaXVeUZeYzASgXZYNbB+y X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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" Follow the pattern of mipi_dsi_dcs_*_multi() and wrap several existing MIPI DSI functions to use the context for processing. This simplifies and streamlines driver code to use simpler code pattern. Note, msleep function is also wrapped in this way as it is frequently called inbetween other mipi_dsi_dcs_*() functions. Signed-off-by: Dmitry Baryshkov Reviewed-by: Douglas Anderson Reviewed-by: Neil Armstrong --- drivers/gpu/drm/drm_mipi_dsi.c | 210 +++++++++++++++++++++++++++++++++++++++++ include/drm/drm_mipi_dsi.h | 21 +++++ 2 files changed, 231 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index d2957cb692d3..8721edd06c06 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -1429,6 +1429,216 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, } EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness_large); +/** + * mipi_dsi_picture_parameter_set_multi() - transmit the DSC PPS to the peripheral + * @ctx: Context for multiple DSI transactions + * @pps: VESA DSC 1.1 Picture Parameter Set + * + * Like mipi_dsi_picture_parameter_set() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_picture_parameter_set_multi(struct mipi_dsi_multi_context *ctx, + const struct drm_dsc_picture_parameter_set *pps) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_picture_parameter_set(dsi, pps); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending PPS failed: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_picture_parameter_set_multi); + +/** + * mipi_dsi_compression_mode_ext_multi() - enable/disable DSC on the peripheral + * @ctx: Context for multiple DSI transactions + * @enable: Whether to enable or disable the DSC + * @algo: Selected compression algorithm + * @pps_selector: Select PPS from the table of pre-stored or uploaded PPS entries + * + * Like mipi_dsi_compression_mode_ext() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_compression_mode_ext_multi(struct mipi_dsi_multi_context *ctx, + bool enable, + enum mipi_dsi_compression_algo algo, + unsigned int pps_selector) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_compression_mode_ext(dsi, enable, algo, pps_selector); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending COMPRESSION_MODE failed: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_compression_mode_ext_multi); + +/** + * mipi_dsi_dcs_nop_multi() - send DCS NOP packet + * @ctx: Context for multiple DSI transactions + * + * Like mipi_dsi_dcs_nop() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_dcs_nop_multi(struct mipi_dsi_multi_context *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_dcs_nop(dsi); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending DCS NOP failed: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_dcs_nop_multi); + +/** + * mipi_dsi_dcs_enter_sleep_mode_multi() - send DCS ENTER_SLEEP_MODE packet + * @ctx: Context for multiple DSI transactions + * + * Like mipi_dsi_dcs_enter_sleep_mode() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_dcs_enter_sleep_mode_multi(struct mipi_dsi_multi_context *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_dcs_enter_sleep_mode(dsi); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending DCS ENTER_SLEEP_MODE failed: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_dcs_enter_sleep_mode_multi); + +/** + * mipi_dsi_dcs_exit_sleep_mode_multi() - send DCS EXIT_SLEEP_MODE packet + * @ctx: Context for multiple DSI transactions + * + * Like mipi_dsi_dcs_exit_sleep_mode() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_dcs_exit_sleep_mode_multi(struct mipi_dsi_multi_context *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_dcs_exit_sleep_mode(dsi); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending DCS EXIT_SLEEP_MODE failed: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_dcs_exit_sleep_mode_multi); + +/** + * mipi_dsi_dcs_set_display_off_multi() - send DCS SET_DISPLAY_OFF packet + * @ctx: Context for multiple DSI transactions + * + * Like mipi_dsi_dcs_set_display_off() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_dcs_set_display_off_multi(struct mipi_dsi_multi_context *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_dcs_set_display_off(dsi); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending DCS SET_DISPLAY_OFF failed: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_dcs_set_display_off_multi); + +/** + * mipi_dsi_dcs_set_display_on_multi() - send DCS SET_DISPLAY_ON packet + * @ctx: Context for multiple DSI transactions + * + * Like mipi_dsi_dcs_set_display_on() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_dcs_set_display_on_multi(struct mipi_dsi_multi_context *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_dcs_set_display_on(dsi); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending DCS SET_DISPLAY_ON failed: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_dcs_set_display_on_multi); + +/** + * mipi_dsi_dcs_set_tear_on_multi() - send DCS SET_TEAR_ON packet + * @ctx: Context for multiple DSI transactions + * @mode: the Tearing Effect Output Line mode + * + * Like mipi_dsi_dcs_set_tear_on() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_dcs_set_tear_on_multi(struct mipi_dsi_multi_context *ctx, + enum mipi_dsi_dcs_tear_mode mode) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_dcs_set_tear_on(dsi, mode); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending DCS SET_TEAR_ON failed: %d\n", + ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_on_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 5e9cad541bd6..bd5a0b6d0711 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -275,6 +275,13 @@ int mipi_dsi_compression_mode_ext(struct mipi_dsi_device *dsi, bool enable, int mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi, const struct drm_dsc_picture_parameter_set *pps); +void mipi_dsi_compression_mode_ext_multi(struct mipi_dsi_multi_context *ctx, + bool enable, + enum mipi_dsi_compression_algo algo, + unsigned int pps_selector); +void mipi_dsi_picture_parameter_set_multi(struct mipi_dsi_multi_context *ctx, + const struct drm_dsc_picture_parameter_set *pps); + ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload, size_t size); int mipi_dsi_generic_write_chatty(struct mipi_dsi_device *dsi, @@ -284,6 +291,12 @@ void mipi_dsi_generic_write_multi(struct mipi_dsi_multi_context *ctx, ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, size_t num_params, void *data, size_t size); +#define mipi_dsi_msleep(ctx, delay) \ + do { \ + if (!ctx.accum_err) \ + msleep(delay); \ + } while (0) + /** * enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode * @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking @@ -338,6 +351,14 @@ int mipi_dsi_dcs_set_display_brightness_large(struct mipi_dsi_device *dsi, int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, u16 *brightness); +void mipi_dsi_dcs_nop_multi(struct mipi_dsi_multi_context *ctx); +void mipi_dsi_dcs_enter_sleep_mode_multi(struct mipi_dsi_multi_context *ctx); +void mipi_dsi_dcs_exit_sleep_mode_multi(struct mipi_dsi_multi_context *ctx); +void mipi_dsi_dcs_set_display_off_multi(struct mipi_dsi_multi_context *ctx); +void mipi_dsi_dcs_set_display_on_multi(struct mipi_dsi_multi_context *ctx); +void mipi_dsi_dcs_set_tear_on_multi(struct mipi_dsi_multi_context *ctx, + enum mipi_dsi_dcs_tear_mode mode); + /** * mipi_dsi_generic_write_seq - transmit data using a generic write packet * From patchwork Sat May 11 23:00:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13662555 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 514D5C04FFE for ; Sat, 11 May 2024 23:00:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A912310E12D; Sat, 11 May 2024 23:00:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Vc87N9F+"; dkim-atps=neutral Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB8B010E0A3 for ; Sat, 11 May 2024 23:00:30 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-51f40b5e059so3530611e87.0 for ; Sat, 11 May 2024 16:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715468429; x=1716073229; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Hu0NGC1822F78E4qEEGMD+epvzx8Hq6ZdfvN33IsmMQ=; b=Vc87N9F+7tvD/RAcoAI1MRMgV7rtPjk5Bt8uPHAzFpL8XqtNAZE/8R/LPZx7OIRpHQ USSmvE1PIzY/eA0qePT7jPpqmIMo9L+V72l196cvwL/grbt9Yyo0Diy5ErLP9AY4w80m VXNR4aR1pOrtGfutTKhpo/ysvQg7fxYLpYz6lKUrCl0BoLgBCG5IWPJNahHnB4m1b07n VXL4GGDqjzVj5k7xA7sJtaX3ZXvhxmD4PLIOTGsAAewH/I4gqA2TuaTo895pjXbAr1id pHRtb1DjHyGMa9EMjKb0RF+j/J+QgbiL40JlawblsK2hrchvh7QT6xPA39+KOjcBddGG cQ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715468429; x=1716073229; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hu0NGC1822F78E4qEEGMD+epvzx8Hq6ZdfvN33IsmMQ=; b=om4IHMFpqsvxjFwFXm0e3h/Im42VvvInwPTlOT94GQNwy/eVpqBEp4O7srbsuqEICI E7YRvQ0/AUsTLVgusI1MlcmEDUqtruuAmkXcqehrtqvSBeAc6IaT6WGFG1LCJA53X6oH 4XSe1Mfzik2TGDEtzgsQ5tXeg0y4N7QxUL1BJV5O2rBnt3K8QQa/BItFK6ibEs0QFjUB N9l8Kj9p7muV0GAii/+atBh/yyBD/27dEfUwRtdtab3Ga2iEhZkNrIEZg3Pmjnj/o7Sk Vh2TxwWSvFxyP0UooMDaS60ylaQ2galeIQ1Ckcsg/TnpCMSz/PfIISIiFdpRZNaovlTw Ti6g== X-Forwarded-Encrypted: i=1; AJvYcCUPXjE1NrEB/PD5LpdzMD1lU2/nQ53H2bha+cIJbwrmCBluYegYCFdMZQ6LkqXAQiYpfbRolgc0wAYXUBh56aXFSZNTi8p9pVYKHFibPdrd X-Gm-Message-State: AOJu0YwZC5N7HcYOQc658MThHebB4ZRHeAxOe9U3mtJzNMpSyT3ma+zu gl4KqbntKJYN1YUQodM1XRS0R6mkZFrW1WMeGskxHZJpSMYa5dB7h4TgH4b7ooM= X-Google-Smtp-Source: AGHT+IFr3JJ2vBf6ZQy+IfFzBDbsVRhgW4zc3ltkOgtdnJYsgPSuJLiHSVasG/nFGY1o3ezKQcVUvQ== X-Received: by 2002:ac2:4437:0:b0:519:2d60:d71b with SMTP id 2adb3069b0e04-5220fb748e2mr3750214e87.22.1715468428990; Sat, 11 May 2024 16:00:28 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f38d3717sm1134222e87.173.2024.05.11.16.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 16:00:28 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 12 May 2024 02:00:20 +0300 Subject: [PATCH v2 3/7] drm/panel: boe-tv101wum-nl6: use wrapped MIPI DCS functions MIME-Version: 1.0 Message-Id: <20240512-dsi-panels-upd-api-v2-3-e31ca14d102e@linaro.org> References: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> In-Reply-To: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> To: Douglas Anderson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Sumit Semwal , Caleb Connolly , Marijn Suijten , Vinod Koul Cc: Cong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4693; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Nb2j0chWOl3K4obprfCylvl2x756Dew7S8N3+vA9f8A=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmP/iJPUx6S2iov6pW2UiDrNkON3xTRY9bGzjD5 M6NaOHeuR6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZj/4iQAKCRCLPIo+Aiko 1eFkB/9JXBh7kAEoKU1ZGODiXQ9dFDltFasZEZd5OcbnNrPxpevLyXu0CWhZj2Bn6+lGaZ/TfUR Psn26XBaBBlqancXr61dMYJfulvUJkDEqsWiAg0/KHwm82Z7aWBd5y7I52BR00EI5g/CMYIuTDP o628o7vV2AmVFLEAXfuoisFcYBbeAXsbhIf0SpvmwmMo3ovCgtkm1LbuVhz1uEcfNkeQyaXgzro AXUmpdFU72BV6AkBvd3T+g4gyTJjiEfNCxt7jV4A+2VG+E/Ug+WcPe63OOJyurrC2x6V7Gbpw2M LPoIuKd5xUrtL1U/xgk6pNCXKJN/r1iyGExMS2bjIZZ2NyOw X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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" Remove conditional code and always use mipi_dsi_dcs_*multi() wrappers to simplify driver's init/exit code. Reviewed-by: Douglas Anderson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 81 ++++++-------------------- 1 file changed, 19 insertions(+), 62 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index 4b4b125a6c6b..8e839a1749e4 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -448,22 +448,16 @@ static int boe_tv110c9m_init(struct boe_panel *boe) mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x00); mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x13); mipi_dsi_dcs_write_seq_multi(&ctx, 0x3b, 0x03, 0x96, 0x1a, 0x04, 0x04); - if (ctx.accum_err) - return ctx.accum_err; - msleep(100); + mipi_dsi_msleep(&ctx, 100); mipi_dsi_dcs_write_seq_multi(&ctx, 0x11); - if (ctx.accum_err) - return ctx.accum_err; - msleep(200); + mipi_dsi_msleep(&ctx, 200); mipi_dsi_dcs_write_seq_multi(&ctx, 0x29); - if (ctx.accum_err) - return ctx.accum_err; - msleep(100); + mipi_dsi_msleep(&ctx, 100); return 0; }; @@ -893,22 +887,16 @@ static int inx_hj110iz_init(struct boe_panel *boe) mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x01); mipi_dsi_dcs_write_seq_multi(&ctx, 0x35, 0x00); mipi_dsi_dcs_write_seq_multi(&ctx, 0x3b, 0x03, 0xae, 0x1a, 0x04, 0x04); - if (ctx.accum_err) - return ctx.accum_err; - msleep(100); + mipi_dsi_msleep(&ctx, 100); mipi_dsi_dcs_write_seq_multi(&ctx, 0x11); - if (ctx.accum_err) - return ctx.accum_err; - msleep(200); + mipi_dsi_msleep(&ctx, 200); mipi_dsi_dcs_write_seq_multi(&ctx, 0x29); - if (ctx.accum_err) - return ctx.accum_err; - msleep(100); + mipi_dsi_msleep(&ctx, 100); return 0; }; @@ -1207,10 +1195,8 @@ static int boe_init(struct boe_panel *boe) mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x08); mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x04); mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x68); - if (ctx.accum_err) - return ctx.accum_err; - msleep(150); + mipi_dsi_msleep(&ctx, 150); return 0; }; @@ -1222,16 +1208,12 @@ static int auo_kd101n80_45na_init(struct boe_panel *boe) msleep(24); mipi_dsi_dcs_write_seq_multi(&ctx, 0x11); - if (ctx.accum_err) - return ctx.accum_err; - msleep(120); + mipi_dsi_msleep(&ctx, 120); mipi_dsi_dcs_write_seq_multi(&ctx, 0x29); - if (ctx.accum_err) - return ctx.accum_err; - msleep(120); + mipi_dsi_msleep(&ctx, 120); return 0; }; @@ -1283,10 +1265,8 @@ static int auo_b101uan08_3_init(struct boe_panel *boe) mipi_dsi_dcs_write_seq_multi(&ctx, 0xe5, 0x4f); mipi_dsi_dcs_write_seq_multi(&ctx, 0xe6, 0x41); mipi_dsi_dcs_write_seq_multi(&ctx, 0xe7, 0x41); - if (ctx.accum_err) - return ctx.accum_err; - msleep(150); + mipi_dsi_msleep(&ctx, 150); return 0; }; @@ -1385,16 +1365,12 @@ static int starry_qfh032011_53g_init(struct boe_panel *boe) mipi_dsi_dcs_write_seq_multi(&ctx, 0xe1, 0x23); mipi_dsi_dcs_write_seq_multi(&ctx, 0xe2, 0x07); mipi_dsi_dcs_write_seq_multi(&ctx, 0X11); - if (ctx.accum_err) - return ctx.accum_err; - msleep(120); + mipi_dsi_msleep(&ctx, 120); mipi_dsi_dcs_write_seq_multi(&ctx, 0X29); - if (ctx.accum_err) - return ctx.accum_err; - msleep(80); + mipi_dsi_msleep(&ctx, 80); return 0; }; @@ -1404,38 +1380,19 @@ static inline struct boe_panel *to_boe_panel(struct drm_panel *panel) return container_of(panel, struct boe_panel, base); } -static int boe_panel_enter_sleep_mode(struct boe_panel *boe) -{ - struct mipi_dsi_device *dsi = boe->dsi; - int ret; - - dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - - ret = mipi_dsi_dcs_set_display_off(dsi); - if (ret < 0) - return ret; - - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); - if (ret < 0) - return ret; - - return 0; -} - static int boe_panel_disable(struct drm_panel *panel) { struct boe_panel *boe = to_boe_panel(panel); - int ret; + struct mipi_dsi_multi_context ctx = { .dsi = boe->dsi }; - ret = boe_panel_enter_sleep_mode(boe); - if (ret < 0) { - dev_err(panel->dev, "failed to set panel off: %d\n", ret); - return ret; - } + boe->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - msleep(150); + mipi_dsi_dcs_set_display_off_multi(&ctx); + mipi_dsi_dcs_enter_sleep_mode_multi(&ctx); - return 0; + mipi_dsi_msleep(&ctx, 150); + + return ctx.accum_err; } static int boe_panel_unprepare(struct drm_panel *panel) From patchwork Sat May 11 23:00:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13662557 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 48FB7C04FFE for ; Sat, 11 May 2024 23:00:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61BAE10E19E; Sat, 11 May 2024 23:00:43 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NXhSm97W"; dkim-atps=neutral Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94B5710E0A3 for ; Sat, 11 May 2024 23:00:31 +0000 (UTC) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2e43c481b53so38810521fa.2 for ; Sat, 11 May 2024 16:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715468429; x=1716073229; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/qHpoqYTUuOwsjGMAXRWRB1z/cT96H3/x5oO5XeWouE=; b=NXhSm97WZtjsXhkR6S696odQtHLaoCLbVsq6PD2SPfa2Y0n4ZT5q10ZEzGs8MoThzH Sxqml+LokEDaVsjLFUhaw8z75SSUhFctr/MexocU7LhFwOrToOSWAjrN2fxyWCyO5Qu0 v62oeslOCgQl0+Kj4p2SaOvr6XDqWfr/CDZTvsYCOIu7p+uflovNwMhge/WgVe0jLiA2 T8rlAaahWG6LMUCAw2pKqIqSLqe4rpu8ubXIKJlzVPK3z3AQwkGzn47lL8jkHoeOvTg6 6GJ0KTYZzWiWaYxHPGZpoH41H8XBuxMitcPD8uD1VZAsapBQM9LOox9IkoFma5nvvmY0 CBaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715468429; x=1716073229; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/qHpoqYTUuOwsjGMAXRWRB1z/cT96H3/x5oO5XeWouE=; b=Q7BkbSii7GsTl3GU8HMgY7Yu4owm0DJOic4jWcz21kHkKD2EAJkMqVXPnbCDVFQnMg venluXZ8iWa5nkf3qkyDFuxwMy6LAf7M4CljRbHg334TUB0D4IJm8Xtt7G4eCBgjIs2S EYfosY5rUx6TZjFXjSabspBTIvV0X016Ji/qaeNEuJ18MgkJ9aZ7kOBSFIftf4ODQZ6Z mpYdMaP5YE4HSvqQvjuQXUpUF0SzN/OvNrDShOdifnsPiTOljG4WcsEshA6nbzzEqvqB iQLLE2AYimQkwEdIoocd7hhvZEqjd0Xhyi4sSg9OtNOkvzdNzg1BhRc9emT1+qUXx3I7 2MmQ== X-Forwarded-Encrypted: i=1; AJvYcCWwSjK02lKqWodkHH2mvBSxWLQk8zbF81AXzZQ9WE7KGAf0M8uN7nZVadowI21sy+tlaAJOIRe33jSrI7171yilO2y65EtOb8lU7bbwFrJ6 X-Gm-Message-State: AOJu0YwxKZjZgfccB+zw4SpbqDVOcM19RJWOddhdx54S/7YmV6xlr66S Cc/HgO3wfjO4/dKHlW4XQP8BdJyk3+wYMHv0gKO+RK3VHoD5TwvErJCGLccm510= X-Google-Smtp-Source: AGHT+IE59BTbplb1hjthCMm6iJl5mfrsnrvXEpw54uV1KjAjRpehYXJtF5g8OLkmTkJPEP9brZ7nKA== X-Received: by 2002:ac2:454b:0:b0:51d:8283:cf72 with SMTP id 2adb3069b0e04-5221017e670mr3705647e87.57.1715468429712; Sat, 11 May 2024 16:00:29 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f38d3717sm1134222e87.173.2024.05.11.16.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 16:00:29 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 12 May 2024 02:00:21 +0300 Subject: [PATCH v2 4/7] drm/panel: ilitek-ili9882t: use wrapped MIPI DCS functions MIME-Version: 1.0 Message-Id: <20240512-dsi-panels-upd-api-v2-4-e31ca14d102e@linaro.org> References: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> In-Reply-To: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> To: Douglas Anderson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Sumit Semwal , Caleb Connolly , Marijn Suijten , Vinod Koul Cc: Cong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2547; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=DOHrqeOiwanjV11JDXphoCFUegn+i/jlXSehEJEsJf0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmP/iJCMI0EmGQFpfABnhOIgzvW0Z2hfEur/bwd ugzH9cTMtOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZj/4iQAKCRCLPIo+Aiko 1dm6B/9UyHT0uKo3SGYHl3YEsREl/QK/u8yxWXXZGGKUeL6QEasG5JyllkZFtnO+imD5Ymx3bp0 qDxkn2q9eZXR15gVxhb6zBJo2I7vwAcY8iANJFj8e2Pb33sUuH7xK7WaAsC4fHTQ8TrCB0foybd AXinWoceTGIIzNIAG2YcxkdD7c9LCgNsXa1L60Id9fx6sO2rzZTs2EypVKAM7Jl7cTx0vuOSHp0 sdupSoLMb0KAfvMc6kykz1/IsflTSETD0/ajwNsvk4jceIGjbYFsMWrve54LRZBczwLnqUm9Q+q EzQ+nDtBl+of7NvZPFyDPxftwjiqewsCCf20OlCe6uhIxVou X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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" Remove conditional code and always use mipi_dsi_dcs_*multi() wrappers to simplify driver's init/exit code. Reviewed-by: Douglas Anderson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-ilitek-ili9882t.c | 48 ++++++--------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c index 58fc1d799371..830d7cfbe857 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c @@ -402,19 +402,15 @@ static int starry_ili9882t_init(struct ili9882t *ili) mipi_dsi_dcs_write_seq_multi(&ctx, 0x92, 0x22); ili9882t_switch_page(&ctx, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_EXIT_SLEEP_MODE); - if (ctx.accum_err) - return ctx.accum_err; + mipi_dsi_dcs_exit_sleep_mode_multi(&ctx); - msleep(120); + mipi_dsi_msleep(&ctx, 120); - mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_DISPLAY_ON); - if (ctx.accum_err) - return ctx.accum_err; + mipi_dsi_dcs_set_display_on_multi(&ctx); - msleep(20); + mipi_dsi_msleep(&ctx, 20); - return 0; + return ctx.accum_err; }; static inline struct ili9882t *to_ili9882t(struct drm_panel *panel) @@ -422,43 +418,21 @@ static inline struct ili9882t *to_ili9882t(struct drm_panel *panel) return container_of(panel, struct ili9882t, base); } -static int ili9882t_enter_sleep_mode(struct ili9882t *ili) -{ - struct mipi_dsi_device *dsi = ili->dsi; - int ret; - - dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - - ret = mipi_dsi_dcs_set_display_off(dsi); - if (ret < 0) - return ret; - - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); - if (ret < 0) - return ret; - - return 0; -} - static int ili9882t_disable(struct drm_panel *panel) { struct ili9882t *ili = to_ili9882t(panel); struct mipi_dsi_multi_context ctx = { .dsi = ili->dsi }; - int ret; ili9882t_switch_page(&ctx, 0x00); - if (ctx.accum_err) - return ctx.accum_err; - ret = ili9882t_enter_sleep_mode(ili); - if (ret < 0) { - dev_err(panel->dev, "failed to set panel off: %d\n", ret); - return ret; - } + ili->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - msleep(150); + mipi_dsi_dcs_set_display_off_multi(&ctx); + mipi_dsi_dcs_enter_sleep_mode_multi(&ctx); - return 0; + mipi_dsi_msleep(&ctx, 150); + + return ctx.accum_err; } static int ili9882t_unprepare(struct drm_panel *panel) From patchwork Sat May 11 23:00:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13662556 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 CE05EC25B75 for ; Sat, 11 May 2024 23:00:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD74710E0DD; Sat, 11 May 2024 23:00:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="B3TaAf9n"; dkim-atps=neutral Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2733610E0A3 for ; Sat, 11 May 2024 23:00:32 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-51f0b6b682fso3250954e87.1 for ; Sat, 11 May 2024 16:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715468430; x=1716073230; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3nGZSIFjpA7hWloLyPIcqlN98kQdeAEpnzUWGCLT48U=; b=B3TaAf9nktcCLVHR6v1oWmrlfhuDNi/kxez91nRR5QXcrGAaxb41rJ9ijcVVRHs0KR V9FrDrREvgmJ3nb0GKVFJZkDCaptCw/1NflcLZfT/XLh4jD5vLcdjH0YmMWX80yppbmh +Wjoh8+wESS2EGk7NCyw6n4JwkDduNCwPtpxOWVF9GB9fVFfZTGV+sRKiZFOWffSWbwN 3ZQbsy8kC/GI7mMouXe/OCInJhs2wCIbr2BYAXBnUncm7MCbK/35mULYo2UEhuxSMeuh TPf3gacy1ICldYnE0gph3nd/GNrIw+A34NSm2BJs/lcw8+pnp0IWKkcDYXk+3HlPK1lq anaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715468430; x=1716073230; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3nGZSIFjpA7hWloLyPIcqlN98kQdeAEpnzUWGCLT48U=; b=gHtWRmy+j1CtryJUANKY293BYV+fhPyyTHOydJLbREv7oiSmxdsEsK1YmhOqvGAzrZ rMME47RNRpyjvvzZM31zPeiVL1KakS5qr2TPmhw7ldSiH2EDRIcWpUTH8dwwQvYFmnSs 5xs4uU5Vl2kmNgUKK14H11NCV8COeoWhH4IMyCWbRwLMQwGSE7DlcnWH5k8fQChbucCt QQn1YtqSlXkZwRWOQLyRBMXo1zZJqQ+e7y3bREHh/QlFYGAZaG/CRJzS2iOh3VpJjHU3 5NNt6DZ7XMByDdVCxGP/Uv2x+meCSMqHQqnSACPP+IhTeiJu0lXSzDtuIWq0Kq0jGfSs sBuA== X-Forwarded-Encrypted: i=1; AJvYcCXR0sRSyOtrdy2FnPIqmO5iwVRiL9+bV+rnasaycNOULfHi+ptiKP5fmL1naDgMvAytJTGHXsAO3boO60GDeSBGLSOf/q8bjZvgONGCOkfw X-Gm-Message-State: AOJu0YwY+U7Q8HDx5t7apedduCKakxTsZd+9r5O6n6jLBwe4UEeAuQSJ BfOGrrJaNaLCWBjfHwtZ3O81frnPv+PCyYPkreQUh2sq3pAHh9CBOL610bpdOGs= X-Google-Smtp-Source: AGHT+IFN8eHZ/0IbW58SHvJPhPsmpX0SzkQZ4t3TEmoTUno0Y/oeyw/EDzIQKLC65rQedkw3MXcf1w== X-Received: by 2002:a19:6410:0:b0:51b:ce76:7813 with SMTP id 2adb3069b0e04-522102779cfmr4901016e87.58.1715468430358; Sat, 11 May 2024 16:00:30 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f38d3717sm1134222e87.173.2024.05.11.16.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 16:00:30 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 12 May 2024 02:00:22 +0300 Subject: [PATCH v2 5/7] drm/panel: innolux-p079zca: use mipi_dsi_dcs_nop_multi() MIME-Version: 1.0 Message-Id: <20240512-dsi-panels-upd-api-v2-5-e31ca14d102e@linaro.org> References: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> In-Reply-To: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> To: Douglas Anderson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Sumit Semwal , Caleb Connolly , Marijn Suijten , Vinod Koul Cc: Cong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1404; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=TlWCMSv/jiIpOAhYCOFQPYQOX5V6nOBAcUqCISh5VBk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmP/iJ3hmcn4EtNeWFrKpLrPvOewe6cnuQ7sp9E 0aeMTNOOoKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZj/4iQAKCRCLPIo+Aiko 1byICACRic7Hv3T681Ko0ZMoic2jYP4/lNy59Ox1wuPogwymz/YevHKOtV7wpqvZq2B5Z09txZE PS9NErQ8qcnj0FIUnrVL0gk8eD4BngE2qtqB+W26m02Snw2Vf1r/yljaS1zjbkFdFioD73Nvi6n m5eDY29Uqx4tWFgEJSpza1ztnCCUDuV+uCYrC/MIjgjAVvBdr7tBiTzh75clucUXL82kgUVSly/ zu81FiBlcCL8u3Qs9LxZZH6xW4UNfCAwTRCsaRpTLz90KKDetFOouiOXfD7LzsgA5gICO77VJlM 2ujcztYjWv0s6ESj54AhS+GoE0ZVKIJOgTZrWi+JDdOW3ECC X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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" Remove conditional code and use mipi_dsi_dcs_nop_multi() wrapper to simplify driver code. Reviewed-by: Douglas Anderson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c index ade8bf7491ee..0691a27a0daa 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -224,21 +224,14 @@ static const struct drm_display_mode innolux_p097pfg_mode = { static void innolux_panel_write_multi(struct mipi_dsi_multi_context *ctx, const void *payload, size_t size) { - struct mipi_dsi_device *dsi = ctx->dsi; - struct device *dev = &dsi->dev; - mipi_dsi_generic_write_multi(ctx, payload, size); - if (ctx->accum_err) - return; /* * Included by random guessing, because without this * (or at least, some delay), the panel sometimes * didn't appear to pick up the command sequence. */ - ctx->accum_err = mipi_dsi_dcs_nop(ctx->dsi); - if (ctx->accum_err) - dev_err(dev, "failed to send DCS nop: %d\n", ctx->accum_err); + mipi_dsi_dcs_nop_multi(ctx); } #define innolux_panel_init_cmd_multi(ctx, seq...) \ From patchwork Sat May 11 23:00:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13662553 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 F361CC04FFE for ; Sat, 11 May 2024 23:00:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D3A310E0D8; Sat, 11 May 2024 23:00:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="fG5aRyMB"; dkim-atps=neutral Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBD6B10E0A3 for ; Sat, 11 May 2024 23:00:32 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-51f1e8eaee5so3855305e87.1 for ; Sat, 11 May 2024 16:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715468431; x=1716073231; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZlbS5jh0b75ZrT/x4A6CRj77uyalyI20zpVsXXitLV8=; b=fG5aRyMBhskoJgKpCpV9W0Q3/+CokdwWrglbeGXEvOZJkRUTk6dz9/4bV7dmkKwsit I3VZHdKZwOiQETslWLwutGJfFuHwoJddGSmQXB48Y4PXKyMDF4A6OGIHjBAKEyIQILcz OM1cVU/RgV5tPLHoqoTiGXCh6HRNm40LyqnmzEsEmxhsiZM5JJKo2R8cyDFmbaCOT7z0 go92R1otVvuQkD0vqrd44Ehy1z6u6DtmMecvBKrsmbPKAqb0zhCpINP+APO42X7NOLlL bss2WEvnVTcvVnDxAt4G+6GBllMESdBP9OfOS/Zu/tvFQLea/NWOmtkpk9V2fDkS2Khu IsUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715468431; x=1716073231; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZlbS5jh0b75ZrT/x4A6CRj77uyalyI20zpVsXXitLV8=; b=jRPBBZWsa57tv1NZsfeP710rgv3VE3jzzMRMGarkiwuwSkgPaICvYWS1eCT1Kex2vh H1iHUeHkG+f6GS8GKjaM35LAmZhiThjJhhNuEzNmBQNRDPIUi1us+zvuMODrLuPmbd6Y L5N9Yi7K9vLYXjZVi334BvG3lydYQIe6/+ne6PyqMNQFHh5MsCrmNuHF5xhgdB+8iJr2 WvxwlszkY7COKEKGViOX9uGDMkE5QwftBI2iZepnZvpOJOrmfdYorDRmOGOS1AXzev0A WH465PZeFirUzsdwMPvVRFJEOHHO2YtBpk57pDXvtl8KVHz8ztvkgxsBfyiZ0P2CmTYh lwvw== X-Forwarded-Encrypted: i=1; AJvYcCUY7tLCR9jZa6V97Js2TKpA3xM24CstpdbPAMSi7Lm/TGz7V0+aTf2c1/KWxGkFXCYw53EcooNMjpWaDqDmoDmZf8oXca9+2sUSb9/AOcKS X-Gm-Message-State: AOJu0YyNJt4tTZ2R8OtznwpltjMw5q/3PrlPSCoDnbJKLU2UDC0KRRFY lsTBJZVKvov/gXNANf80/scK/UaDuKqqGBkPWoxqPnqr+ezc7XjwzgG3vxSOJwc= X-Google-Smtp-Source: AGHT+IFNzxKw6iznXtIrDqlhQ3yjMCMA9hbD0Cg+4mxcMiwkTWIsHs8HJvAAZ4q/qs1+E6pHglQqGw== X-Received: by 2002:a05:6512:201a:b0:51b:ab9f:6b5c with SMTP id 2adb3069b0e04-521e0954cc2mr2628895e87.1.1715468431034; Sat, 11 May 2024 16:00:31 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f38d3717sm1134222e87.173.2024.05.11.16.00.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 16:00:30 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 12 May 2024 02:00:23 +0300 Subject: [PATCH v2 6/7] drm/panel: novatek-nt36672e: use wrapped MIPI DCS functions MIME-Version: 1.0 Message-Id: <20240512-dsi-panels-upd-api-v2-6-e31ca14d102e@linaro.org> References: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> In-Reply-To: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> To: Douglas Anderson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Sumit Semwal , Caleb Connolly , Marijn Suijten , Vinod Koul Cc: Cong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=34017; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=9/zvkUgD43YQx4k7ykLUOx127ZL/GCUMmr7Dr4RAWtU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmP/iJPrlaJleLgc0PscuUtk4TOgqbR6Jpazd9V LoeWFb8hJmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZj/4iQAKCRCLPIo+Aiko 1SPvB/9tYnp+yqpR9eb4t8p+mMFdoYT1259c/1ROd2arnuLS4CJsqogjNVqHD+hcsR0fg0CHqZO rmKxRBeolY/GUxl1vEYlI+bAECgmn6JNwjhz49xsq1YhmVVE+ElSiYfGc+ZufkhQnQiMTPio07t MpgaMxY0n3uklsZmLR3sLsncse6Kms0W+dCKp8YJUBl41/l3hXTxChV+92mzuObm5+flIeVNqNJ AlNarnisr/+ZCTxCiLy08gdpgiEw+BnZDWnbQz+pZSKMug37HDSdqQ5xshiXrerR65K28kzQT44 YKuSA+TNHElqnBIt1PncfxiGDUGlJQ/DXPtAhv2rXWu0ilzn X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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" Remove conditional code and always use mipi_dsi_dcs_*multi() wrappers to simplify driver's init/exit code. This also includes passing context to the init_sequence() function instead of passing the DSI device. Reviewed-by: Douglas Anderson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-novatek-nt36672e.c | 597 ++++++++++++------------- 1 file changed, 284 insertions(+), 313 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c index 9ce8df455232..e81a70147259 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c @@ -33,7 +33,7 @@ struct panel_desc { enum mipi_dsi_pixel_format format; unsigned int lanes; const char *panel_name; - int (*init_sequence)(struct mipi_dsi_device *dsi); + void (*init_sequence)(struct mipi_dsi_multi_context *ctx); }; struct nt36672e_panel { @@ -49,297 +49,293 @@ static inline struct nt36672e_panel *to_nt36672e_panel(struct drm_panel *panel) return container_of(panel, struct nt36672e_panel, panel); } -static int nt36672e_1080x2408_60hz_init(struct mipi_dsi_device *dsi) +static void nt36672e_1080x2408_60hz_init(struct mipi_dsi_multi_context *ctx) { - struct mipi_dsi_multi_context ctx = { .dsi = dsi }; - - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x10); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xc1, 0x89, 0x28, 0x00, 0x08, 0x00, 0xaa, 0x02, + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x10); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0xb0, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0xc0, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0xc1, 0x89, 0x28, 0x00, 0x08, 0x00, 0xaa, 0x02, 0x0e, 0x00, 0x2b, 0x00, 0x07, 0x0d, 0xb7, 0x0c, 0xb7); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xc2, 0x1b, 0xa0); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x20); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x01, 0x66); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x06, 0x40); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x38); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x2f, 0x83); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x69, 0x91); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x95, 0xd1); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x96, 0xd1); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf2, 0x64); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf3, 0x54); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf4, 0x64); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf5, 0x54); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf6, 0x64); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf7, 0x54); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf8, 0x64); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf9, 0x54); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x24); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x01, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x03, 0x0c); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x05, 0x1d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x08, 0x2f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x09, 0x2e); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x0a, 0x2d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x0b, 0x2c); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x11, 0x17); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x12, 0x13); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x13, 0x15); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x15, 0x14); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x16, 0x16); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x17, 0x18); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x1b, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x1d, 0x1d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x2f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x2e); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x22, 0x2d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x23, 0x2c); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x29, 0x17); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x2a, 0x13); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x2b, 0x15); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x2f, 0x14); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x30, 0x16); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x31, 0x18); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x32, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x34, 0x10); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x35, 0x1f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x36, 0x1f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x4d, 0x14); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x4e, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x4f, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x71, 0x30); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x79, 0x11); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7a, 0x82); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7b, 0x8f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7d, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x80, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x81, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x82, 0x13); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x84, 0x31); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x85, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x86, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x87, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x90, 0x13); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x92, 0x31); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x93, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x94, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x95, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x9c, 0xf4); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x9d, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xa0, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xa2, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xa3, 0x02); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xa4, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xa5, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xc6, 0xc0); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xc9, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xd9, 0x80); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xe9, 0x02); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x25); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x18, 0x22); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x19, 0xe4); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x40); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x66, 0xd8); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x68, 0x50); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x69, 0x10); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6b, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6d, 0x0d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6e, 0x48); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x72, 0x41); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x73, 0x4a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x74, 0xd0); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x77, 0x62); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x79, 0x7e); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7d, 0x03); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7e, 0x15); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7f, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x84, 0x4d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xcf, 0x80); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xd6, 0x80); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xd7, 0x80); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xef, 0x20); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xf0, 0x84); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x26); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x81, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x83, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x84, 0x03); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x85, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x86, 0x03); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x87, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x88, 0x05); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8a, 0x1a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8b, 0x11); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8c, 0x24); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8e, 0x42); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8f, 0x11); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x90, 0x11); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x91, 0x11); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x9a, 0x80); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x9b, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x9c, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x9d, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x9e, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x27); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x01, 0x68); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x81); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x6a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x25, 0x81); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x26, 0x94); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6e, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6f, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x70, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x71, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x72, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x75, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x76, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x77, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7d, 0x09); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7e, 0x67); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x80, 0x23); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x82, 0x09); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x83, 0x67); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x88, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x89, 0x10); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xa5, 0x10); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xa6, 0x23); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xa7, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x40); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xe5, 0x02); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xe6, 0xd3); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xeb, 0x03); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xec, 0x28); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x2a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x00, 0x91); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x03, 0x20); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x50); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x0a, 0x70); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x0c, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x0d, 0x40); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x0f, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x11, 0xe0); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x15, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x16, 0xa4); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x19, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x1a, 0x78); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x1b, 0x23); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x1d, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x1e, 0x3e); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x1f, 0x3e); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x3e); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x28, 0xfd); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x29, 0x12); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x2a, 0xe1); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x2d, 0x0a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x30, 0x49); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x33, 0x96); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x34, 0xff); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x35, 0x40); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x36, 0xde); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x37, 0xf9); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x38, 0x45); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x39, 0xd9); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x3a, 0x49); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x4a, 0xf0); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7a, 0x09); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7b, 0x40); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7f, 0xf0); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x83, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x84, 0xa4); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x87, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x88, 0x78); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x89, 0x23); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8b, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8c, 0x7d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8d, 0x7d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x8e, 0x7d); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x20); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00, 0x00, 0x00, 0x17, 0x00, 0x49, 0x00, + mipi_dsi_dcs_write_seq_multi(ctx, 0xc2, 0x1b, 0xa0); + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x20); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x01, 0x66); + mipi_dsi_dcs_write_seq_multi(ctx, 0x06, 0x40); + mipi_dsi_dcs_write_seq_multi(ctx, 0x07, 0x38); + mipi_dsi_dcs_write_seq_multi(ctx, 0x2f, 0x83); + mipi_dsi_dcs_write_seq_multi(ctx, 0x69, 0x91); + mipi_dsi_dcs_write_seq_multi(ctx, 0x95, 0xd1); + mipi_dsi_dcs_write_seq_multi(ctx, 0x96, 0xd1); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf2, 0x64); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf3, 0x54); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf4, 0x64); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf5, 0x54); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf6, 0x64); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf7, 0x54); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf8, 0x64); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf9, 0x54); + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x24); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x01, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x03, 0x0c); + mipi_dsi_dcs_write_seq_multi(ctx, 0x05, 0x1d); + mipi_dsi_dcs_write_seq_multi(ctx, 0x08, 0x2f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x09, 0x2e); + mipi_dsi_dcs_write_seq_multi(ctx, 0x0a, 0x2d); + mipi_dsi_dcs_write_seq_multi(ctx, 0x0b, 0x2c); + mipi_dsi_dcs_write_seq_multi(ctx, 0x11, 0x17); + mipi_dsi_dcs_write_seq_multi(ctx, 0x12, 0x13); + mipi_dsi_dcs_write_seq_multi(ctx, 0x13, 0x15); + mipi_dsi_dcs_write_seq_multi(ctx, 0x15, 0x14); + mipi_dsi_dcs_write_seq_multi(ctx, 0x16, 0x16); + mipi_dsi_dcs_write_seq_multi(ctx, 0x17, 0x18); + mipi_dsi_dcs_write_seq_multi(ctx, 0x1b, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x1d, 0x1d); + mipi_dsi_dcs_write_seq_multi(ctx, 0x20, 0x2f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x21, 0x2e); + mipi_dsi_dcs_write_seq_multi(ctx, 0x22, 0x2d); + mipi_dsi_dcs_write_seq_multi(ctx, 0x23, 0x2c); + mipi_dsi_dcs_write_seq_multi(ctx, 0x29, 0x17); + mipi_dsi_dcs_write_seq_multi(ctx, 0x2a, 0x13); + mipi_dsi_dcs_write_seq_multi(ctx, 0x2b, 0x15); + mipi_dsi_dcs_write_seq_multi(ctx, 0x2f, 0x14); + mipi_dsi_dcs_write_seq_multi(ctx, 0x30, 0x16); + mipi_dsi_dcs_write_seq_multi(ctx, 0x31, 0x18); + mipi_dsi_dcs_write_seq_multi(ctx, 0x32, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x34, 0x10); + mipi_dsi_dcs_write_seq_multi(ctx, 0x35, 0x1f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x36, 0x1f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x4d, 0x14); + mipi_dsi_dcs_write_seq_multi(ctx, 0x4e, 0x36); + mipi_dsi_dcs_write_seq_multi(ctx, 0x4f, 0x36); + mipi_dsi_dcs_write_seq_multi(ctx, 0x53, 0x36); + mipi_dsi_dcs_write_seq_multi(ctx, 0x71, 0x30); + mipi_dsi_dcs_write_seq_multi(ctx, 0x79, 0x11); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7a, 0x82); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7b, 0x8f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7d, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x80, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x81, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x82, 0x13); + mipi_dsi_dcs_write_seq_multi(ctx, 0x84, 0x31); + mipi_dsi_dcs_write_seq_multi(ctx, 0x85, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x86, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x87, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x90, 0x13); + mipi_dsi_dcs_write_seq_multi(ctx, 0x92, 0x31); + mipi_dsi_dcs_write_seq_multi(ctx, 0x93, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x94, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x95, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x9c, 0xf4); + mipi_dsi_dcs_write_seq_multi(ctx, 0x9d, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0xa0, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0xa2, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0xa3, 0x02); + mipi_dsi_dcs_write_seq_multi(ctx, 0xa4, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0xa5, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0xc6, 0xc0); + mipi_dsi_dcs_write_seq_multi(ctx, 0xc9, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0xd9, 0x80); + mipi_dsi_dcs_write_seq_multi(ctx, 0xe9, 0x02); + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x25); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x18, 0x22); + mipi_dsi_dcs_write_seq_multi(ctx, 0x19, 0xe4); + mipi_dsi_dcs_write_seq_multi(ctx, 0x21, 0x40); + mipi_dsi_dcs_write_seq_multi(ctx, 0x66, 0xd8); + mipi_dsi_dcs_write_seq_multi(ctx, 0x68, 0x50); + mipi_dsi_dcs_write_seq_multi(ctx, 0x69, 0x10); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6b, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6d, 0x0d); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6e, 0x48); + mipi_dsi_dcs_write_seq_multi(ctx, 0x72, 0x41); + mipi_dsi_dcs_write_seq_multi(ctx, 0x73, 0x4a); + mipi_dsi_dcs_write_seq_multi(ctx, 0x74, 0xd0); + mipi_dsi_dcs_write_seq_multi(ctx, 0x77, 0x62); + mipi_dsi_dcs_write_seq_multi(ctx, 0x79, 0x7e); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7d, 0x03); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7e, 0x15); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7f, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x84, 0x4d); + mipi_dsi_dcs_write_seq_multi(ctx, 0xcf, 0x80); + mipi_dsi_dcs_write_seq_multi(ctx, 0xd6, 0x80); + mipi_dsi_dcs_write_seq_multi(ctx, 0xd7, 0x80); + mipi_dsi_dcs_write_seq_multi(ctx, 0xef, 0x20); + mipi_dsi_dcs_write_seq_multi(ctx, 0xf0, 0x84); + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x26); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x81, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x83, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x84, 0x03); + mipi_dsi_dcs_write_seq_multi(ctx, 0x85, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x86, 0x03); + mipi_dsi_dcs_write_seq_multi(ctx, 0x87, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x88, 0x05); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8a, 0x1a); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8b, 0x11); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8c, 0x24); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8e, 0x42); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8f, 0x11); + mipi_dsi_dcs_write_seq_multi(ctx, 0x90, 0x11); + mipi_dsi_dcs_write_seq_multi(ctx, 0x91, 0x11); + mipi_dsi_dcs_write_seq_multi(ctx, 0x9a, 0x80); + mipi_dsi_dcs_write_seq_multi(ctx, 0x9b, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x9c, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x9d, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x9e, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x27); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x01, 0x68); + mipi_dsi_dcs_write_seq_multi(ctx, 0x20, 0x81); + mipi_dsi_dcs_write_seq_multi(ctx, 0x21, 0x6a); + mipi_dsi_dcs_write_seq_multi(ctx, 0x25, 0x81); + mipi_dsi_dcs_write_seq_multi(ctx, 0x26, 0x94); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6e, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6f, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x70, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x71, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x72, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x75, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x76, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x77, 0x00); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7d, 0x09); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7e, 0x67); + mipi_dsi_dcs_write_seq_multi(ctx, 0x80, 0x23); + mipi_dsi_dcs_write_seq_multi(ctx, 0x82, 0x09); + mipi_dsi_dcs_write_seq_multi(ctx, 0x83, 0x67); + mipi_dsi_dcs_write_seq_multi(ctx, 0x88, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x89, 0x10); + mipi_dsi_dcs_write_seq_multi(ctx, 0xa5, 0x10); + mipi_dsi_dcs_write_seq_multi(ctx, 0xa6, 0x23); + mipi_dsi_dcs_write_seq_multi(ctx, 0xa7, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0xb6, 0x40); + mipi_dsi_dcs_write_seq_multi(ctx, 0xe5, 0x02); + mipi_dsi_dcs_write_seq_multi(ctx, 0xe6, 0xd3); + mipi_dsi_dcs_write_seq_multi(ctx, 0xeb, 0x03); + mipi_dsi_dcs_write_seq_multi(ctx, 0xec, 0x28); + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x2a); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x00, 0x91); + mipi_dsi_dcs_write_seq_multi(ctx, 0x03, 0x20); + mipi_dsi_dcs_write_seq_multi(ctx, 0x07, 0x50); + mipi_dsi_dcs_write_seq_multi(ctx, 0x0a, 0x70); + mipi_dsi_dcs_write_seq_multi(ctx, 0x0c, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x0d, 0x40); + mipi_dsi_dcs_write_seq_multi(ctx, 0x0f, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x11, 0xe0); + mipi_dsi_dcs_write_seq_multi(ctx, 0x15, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x16, 0xa4); + mipi_dsi_dcs_write_seq_multi(ctx, 0x19, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x1a, 0x78); + mipi_dsi_dcs_write_seq_multi(ctx, 0x1b, 0x23); + mipi_dsi_dcs_write_seq_multi(ctx, 0x1d, 0x36); + mipi_dsi_dcs_write_seq_multi(ctx, 0x1e, 0x3e); + mipi_dsi_dcs_write_seq_multi(ctx, 0x1f, 0x3e); + mipi_dsi_dcs_write_seq_multi(ctx, 0x20, 0x3e); + mipi_dsi_dcs_write_seq_multi(ctx, 0x28, 0xfd); + mipi_dsi_dcs_write_seq_multi(ctx, 0x29, 0x12); + mipi_dsi_dcs_write_seq_multi(ctx, 0x2a, 0xe1); + mipi_dsi_dcs_write_seq_multi(ctx, 0x2d, 0x0a); + mipi_dsi_dcs_write_seq_multi(ctx, 0x30, 0x49); + mipi_dsi_dcs_write_seq_multi(ctx, 0x33, 0x96); + mipi_dsi_dcs_write_seq_multi(ctx, 0x34, 0xff); + mipi_dsi_dcs_write_seq_multi(ctx, 0x35, 0x40); + mipi_dsi_dcs_write_seq_multi(ctx, 0x36, 0xde); + mipi_dsi_dcs_write_seq_multi(ctx, 0x37, 0xf9); + mipi_dsi_dcs_write_seq_multi(ctx, 0x38, 0x45); + mipi_dsi_dcs_write_seq_multi(ctx, 0x39, 0xd9); + mipi_dsi_dcs_write_seq_multi(ctx, 0x3a, 0x49); + mipi_dsi_dcs_write_seq_multi(ctx, 0x4a, 0xf0); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7a, 0x09); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7b, 0x40); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7f, 0xf0); + mipi_dsi_dcs_write_seq_multi(ctx, 0x83, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x84, 0xa4); + mipi_dsi_dcs_write_seq_multi(ctx, 0x87, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x88, 0x78); + mipi_dsi_dcs_write_seq_multi(ctx, 0x89, 0x23); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8b, 0x36); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8c, 0x7d); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8d, 0x7d); + mipi_dsi_dcs_write_seq_multi(ctx, 0x8e, 0x7d); + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x20); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0xb0, 0x00, 0x00, 0x00, 0x17, 0x00, 0x49, 0x00, 0x6a, 0x00, 0x89, 0x00, 0x9f, 0x00, 0xb6, 0x00, 0xc8); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0xd9, 0x01, 0x10, 0x01, 0x3a, 0x01, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb1, 0x00, 0xd9, 0x01, 0x10, 0x01, 0x3a, 0x01, 0x7a, 0x01, 0xa9, 0x01, 0xf2, 0x02, 0x2d, 0x02, 0x2e); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x02, 0x64, 0x02, 0xa3, 0x02, 0xca, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb2, 0x02, 0x64, 0x02, 0xa3, 0x02, 0xca, 0x03, 0x00, 0x03, 0x1e, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb3, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb4, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, 0x71, 0x00, 0x90, 0x00, 0xa7, 0x00, 0xbf, 0x00, 0xd1); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x00, 0xe2, 0x01, 0x1a, 0x01, 0x43, 0x01, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb5, 0x00, 0xe2, 0x01, 0x1a, 0x01, 0x43, 0x01, 0x83, 0x01, 0xb2, 0x01, 0xfa, 0x02, 0x34, 0x02, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x02, 0x6b, 0x02, 0xa8, 0x02, 0xd0, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb6, 0x02, 0x6b, 0x02, 0xa8, 0x02, 0xd0, 0x03, 0x03, 0x03, 0x21, 0x03, 0x4d, 0x03, 0x5b, 0x03, 0x6b); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb7, 0x03, 0x7e, 0x03, 0x94, 0x03, 0xac, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb7, 0x03, 0x7e, 0x03, 0x94, 0x03, 0xac, 0x03, 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, 0x72, 0x00, 0x92, 0x00, 0xa8, 0x00, 0xbf, 0x00, 0xd1); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0x00, 0xe2, 0x01, 0x18, 0x01, 0x42, 0x01, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb9, 0x00, 0xe2, 0x01, 0x18, 0x01, 0x42, 0x01, 0x81, 0x01, 0xaf, 0x01, 0xf5, 0x02, 0x2f, 0x02, 0x31); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02, 0x68, 0x02, 0xa6, 0x02, 0xcd, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xba, 0x02, 0x68, 0x02, 0xa6, 0x02, 0xcd, 0x03, 0x01, 0x03, 0x1f, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xbb, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x21); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00, 0x00, 0x00, 0x17, 0x00, 0x49, 0x00, + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x21); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0xb0, 0x00, 0x00, 0x00, 0x17, 0x00, 0x49, 0x00, 0x6a, 0x00, 0x89, 0x00, 0x9f, 0x00, 0xb6, 0x00, 0xc8); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0xd9, 0x01, 0x10, 0x01, 0x3a, 0x01, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb1, 0x00, 0xd9, 0x01, 0x10, 0x01, 0x3a, 0x01, 0x7a, 0x01, 0xa9, 0x01, 0xf2, 0x02, 0x2d, 0x02, 0x2e); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x02, 0x64, 0x02, 0xa3, 0x02, 0xca, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb2, 0x02, 0x64, 0x02, 0xa3, 0x02, 0xca, 0x03, 0x00, 0x03, 0x1e, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb3, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb4, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, 0x71, 0x00, 0x90, 0x00, 0xa7, 0x00, 0xbf, 0x00, 0xd1); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x00, 0xe2, 0x01, 0x1a, 0x01, 0x43, 0x01, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb5, 0x00, 0xe2, 0x01, 0x1a, 0x01, 0x43, 0x01, 0x83, 0x01, 0xb2, 0x01, 0xfa, 0x02, 0x34, 0x02, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x02, 0x6b, 0x02, 0xa8, 0x02, 0xd0, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb6, 0x02, 0x6b, 0x02, 0xa8, 0x02, 0xd0, 0x03, 0x03, 0x03, 0x21, 0x03, 0x4d, 0x03, 0x5b, 0x03, 0x6b); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb7, 0x03, 0x7e, 0x03, 0x94, 0x03, 0xac, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb7, 0x03, 0x7e, 0x03, 0x94, 0x03, 0xac, 0x03, 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, 0x72, 0x00, 0x92, 0x00, 0xa8, 0x00, 0xbf, 0x00, 0xd1); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0x00, 0xe2, 0x01, 0x18, 0x01, 0x42, 0x01, + mipi_dsi_dcs_write_seq_multi(ctx, 0xb9, 0x00, 0xe2, 0x01, 0x18, 0x01, 0x42, 0x01, 0x81, 0x01, 0xaf, 0x01, 0xf5, 0x02, 0x2f, 0x02, 0x31); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02, 0x68, 0x02, 0xa6, 0x02, 0xcd, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xba, 0x02, 0x68, 0x02, 0xa6, 0x02, 0xcd, 0x03, 0x01, 0x03, 0x1f, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, + mipi_dsi_dcs_write_seq_multi(ctx, 0xbb, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x2c); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x61, 0x1f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x62, 0x1f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x7e, 0x03); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6a, 0x14); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6b, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6c, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x6d, 0x36); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x54, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x04); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x56, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x58, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x59, 0x0f); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0xf0); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x5a, 0x00); - - mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x10); - mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x51, 0xff); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x24); - mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x01); - - return ctx.accum_err; + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x2c); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x61, 0x1f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x62, 0x1f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x7e, 0x03); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6a, 0x14); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6b, 0x36); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6c, 0x36); + mipi_dsi_dcs_write_seq_multi(ctx, 0x6d, 0x36); + mipi_dsi_dcs_write_seq_multi(ctx, 0x53, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x54, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x55, 0x04); + mipi_dsi_dcs_write_seq_multi(ctx, 0x56, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x58, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0x59, 0x0f); + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0xf0); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x5a, 0x00); + + mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0x10); + mipi_dsi_dcs_write_seq_multi(ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(ctx, 0x51, 0xff); + mipi_dsi_dcs_write_seq_multi(ctx, 0x53, 0x24); + mipi_dsi_dcs_write_seq_multi(ctx, 0x55, 0x01); } static int nt36672e_power_on(struct nt36672e_panel *ctx) @@ -381,68 +377,46 @@ static int nt36672e_power_off(struct nt36672e_panel *ctx) return ret; } -static int nt36672e_on(struct nt36672e_panel *ctx) +static int nt36672e_on(struct nt36672e_panel *nt36672e) { - struct mipi_dsi_device *dsi = ctx->dsi; - const struct panel_desc *desc = ctx->desc; - int ret = 0; + struct mipi_dsi_multi_context ctx = { .dsi = nt36672e->dsi }; + const struct panel_desc *desc = nt36672e->desc; - dsi->mode_flags |= MIPI_DSI_MODE_LPM; + nt36672e->dsi->mode_flags |= MIPI_DSI_MODE_LPM; - if (desc->init_sequence) { - ret = desc->init_sequence(dsi); - if (ret < 0) { - dev_err(&dsi->dev, "panel init sequence failed: %d\n", ret); - return ret; - } - } + if (desc->init_sequence) + desc->init_sequence(&ctx); - ret = mipi_dsi_dcs_exit_sleep_mode(dsi); - if (ret < 0) { - dev_err(&dsi->dev, "Failed to exit sleep mode: %d\n", ret); - return ret; - } - msleep(120); + mipi_dsi_dcs_exit_sleep_mode_multi(&ctx); + mipi_dsi_msleep(&ctx, 120); - ret = mipi_dsi_dcs_set_display_on(dsi); - if (ret < 0) { - dev_err(&dsi->dev, "Failed to set display on: %d\n", ret); - return ret; - } - msleep(100); + mipi_dsi_dcs_set_display_on_multi(&ctx); - return 0; + mipi_dsi_msleep(&ctx, 100); + + return ctx.accum_err; } -static int nt36672e_off(struct nt36672e_panel *ctx) +static int nt36672e_off(struct nt36672e_panel *panel) { - struct mipi_dsi_device *dsi = ctx->dsi; - int ret = 0; + struct mipi_dsi_multi_context ctx = { .dsi = panel->dsi }; - dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + panel->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - ret = mipi_dsi_dcs_set_display_off(dsi); - if (ret < 0) { - dev_err(&dsi->dev, "Failed to set display off: %d\n", ret); - return ret; - } - msleep(20); + mipi_dsi_dcs_set_display_off_multi(&ctx); + mipi_dsi_msleep(&ctx, 20); - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); - if (ret < 0) { - dev_err(&dsi->dev, "Failed to enter sleep mode: %d\n", ret); - return ret; - } - msleep(60); + mipi_dsi_dcs_enter_sleep_mode_multi(&ctx); + mipi_dsi_msleep(&ctx, 60); - return 0; + return ctx.accum_err; } static int nt36672e_panel_prepare(struct drm_panel *panel) { struct nt36672e_panel *ctx = to_nt36672e_panel(panel); struct mipi_dsi_device *dsi = ctx->dsi; - int ret = 0; + int ret; ret = nt36672e_power_on(ctx); if (ret < 0) @@ -450,7 +424,6 @@ static int nt36672e_panel_prepare(struct drm_panel *panel) ret = nt36672e_on(ctx); if (ret < 0) { - dev_err(&dsi->dev, "Failed to initialize panel: %d\n", ret); if (nt36672e_power_off(ctx)) dev_err(&dsi->dev, "power off failed\n"); return ret; @@ -463,11 +436,9 @@ static int nt36672e_panel_unprepare(struct drm_panel *panel) { struct nt36672e_panel *ctx = to_nt36672e_panel(panel); struct mipi_dsi_device *dsi = ctx->dsi; - int ret = 0; + int ret; - ret = nt36672e_off(ctx); - if (ret < 0) - dev_err(&dsi->dev, "Failed to un-initialize panel: %d\n", ret); + nt36672e_off(ctx); ret = nt36672e_power_off(ctx); if (ret < 0) From patchwork Sat May 11 23:00:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13662558 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 936A8C25B5F for ; Sat, 11 May 2024 23:00:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA25410E17A; Sat, 11 May 2024 23:00:43 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iSUo36Ea"; dkim-atps=neutral Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 937AF10E0A3 for ; Sat, 11 May 2024 23:00:33 +0000 (UTC) Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5210684cee6so3531598e87.0 for ; Sat, 11 May 2024 16:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715468432; x=1716073232; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Z4uNGOso+NPooLyBvhY0LTdeJRmp7LUENjYu60WmKgo=; b=iSUo36EaGeJZsAhQFvBq/CYY/+PM2C/ZAoInK3PeXtMsblvHLllRr1O8cFzaXzxEX3 +mnddODctXVMxlIbOTNdPvyEfj8LEvciIlKFt5lmkR15XAlhBNFGgBsTerhCIlp9Oyxs +ZuKsA8bQvj4AR1gMD0pF7Zo3gB/+h04Q/qFyz4rc+do+2ZrRMxAdSi/O+gb6HNkEg8J mSxzkMG2dAabd7KycM0HtDpZn95SlpLkzu9pcoN4n5sCGlIfji9S0cNSmEibysiPRL0M GHwJkl2aay8kkhAZuOa+GQX5n1evvDWIE1XmJJvFhEPo/YT7TBxTghyu7kLS5Ixe+TFd o9vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715468432; x=1716073232; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z4uNGOso+NPooLyBvhY0LTdeJRmp7LUENjYu60WmKgo=; b=VzSdeoXZje2l4zTeKqtI0Jwl3trSIgqWJBWai1TGgm4Tqv7aSLtYA8NhWTyN1CNDLk ezfA/5NTdR0vDaAepz/5blAYp5wdXbPic9E90S1N/NPeduivryUGMbuRUCALzAdsnE1T qnchfGSdAjT7zVOutZBDeC+vjltqLxYvAD5pDdHlgA3yJrKlSeiq5PfdGxCGi6n7tenl C7+kRJsJAKp9LOElcCdi2qKhau4e1U+AsAi/pxtpA/wllyyUP3/doIilRftRh/YXC5bk +gUiJT3Kcmo3h4sytBEgMG/FezakrC68OOHd0kjqp2q2PvQ14MgJxzLepXtC6pzyNvyU BE/g== X-Forwarded-Encrypted: i=1; AJvYcCVNtzWBZxAPG41CAaw2IX0HccH6OQDGhwICw0+cWbdPNAYbvXJnvcgI4wwi6d9PyV12TYcm6yN7gjB2lmk2iMS0Mgj4FtYX8BHOjbI5oYy1 X-Gm-Message-State: AOJu0YxPkVuRnHQdeJGRXP3iix8T/Vxm6u3sIBNYdPXFYten9q10OkCG FC9kz9CbW2HpeNI+e/Rqu9ib7ZCmWFbLUgkHipWBwl8/R79d2oo9xXcgr+orV4k= X-Google-Smtp-Source: AGHT+IEb7pyVhy/kijEx2pcpLZpwZVbb1O1ml8VR743ch3WEd0/dsCMJWxyegjkwaoXS0wdRD4FqZg== X-Received: by 2002:ac2:41d3:0:b0:51c:fd0a:7e34 with SMTP id 2adb3069b0e04-5220fb72d61mr3603209e87.22.1715468431830; Sat, 11 May 2024 16:00:31 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f38d3717sm1134222e87.173.2024.05.11.16.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 16:00:31 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 12 May 2024 02:00:24 +0300 Subject: [PATCH v2 7/7] drm/panel: lg-sw43408: use new streamlined MIPI DSI API MIME-Version: 1.0 Message-Id: <20240512-dsi-panels-upd-api-v2-7-e31ca14d102e@linaro.org> References: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> In-Reply-To: <20240512-dsi-panels-upd-api-v2-0-e31ca14d102e@linaro.org> To: Douglas Anderson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Sumit Semwal , Caleb Connolly , Marijn Suijten , Vinod Koul Cc: Cong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5815; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=OgCl745YGNA8tkD2Ib/h4hAsQgMXN7Ouw6Gh4P8Oqr4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmP/iJ9AtO2NUiQ/shLEjW1FgXeYS1lB99HJoMX gT0ERuhktKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZj/4iQAKCRCLPIo+Aiko 1bAYB/0em0c6mMAcvfItGDeSx6pM4OR2pgT65OKPxu1eIMWRA/SqpP/q596FmVGhhe1gBFRDdXw IDlpEQpE3qucx1ZM0pQXEULCVLaN52/h60g5xS8WOZASORELPpe+l3tuClkTofsOpnQ0LvnBz51 UrCttNK9iuJMpj97rSHsufpaQHDQsgaFr34fMdBAq2kIAEEVPJPE4uo7vq57RJORyWEZLRNgcxf 2B+MB7OvFIHzfzelPJhTGAKK4KmLnT9/PXiDphOeR4vRVAhQaSeFnZXSC6RsDpMUdM7rFbKAXga EZALKYcIlSJ6iUYXgVLU72da7nQi81w9CjUy0SmFcnlWB/cr X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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" Use newer mipi_dsi_*_multi() functions in order to simplify and cleanup panel's prepare() and unprepare() functions. Reviewed-by: Douglas Anderson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-lg-sw43408.c | 95 +++++++++++++------------------- 1 file changed, 37 insertions(+), 58 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c index 67a98ac508f8..f3dcc39670ea 100644 --- a/drivers/gpu/drm/panel/panel-lg-sw43408.c +++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c @@ -40,104 +40,83 @@ static inline struct sw43408_panel *to_panel_info(struct drm_panel *panel) static int sw43408_unprepare(struct drm_panel *panel) { - struct sw43408_panel *ctx = to_panel_info(panel); + struct sw43408_panel *sw43408 = to_panel_info(panel); + struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link }; int ret; - ret = mipi_dsi_dcs_set_display_off(ctx->link); - if (ret < 0) - dev_err(panel->dev, "set_display_off cmd failed ret = %d\n", ret); + mipi_dsi_dcs_set_display_off_multi(&ctx); - ret = mipi_dsi_dcs_enter_sleep_mode(ctx->link); - if (ret < 0) - dev_err(panel->dev, "enter_sleep cmd failed ret = %d\n", ret); + mipi_dsi_dcs_enter_sleep_mode_multi(&ctx); - msleep(100); + mipi_dsi_msleep(&ctx, 100); - gpiod_set_value(ctx->reset_gpio, 1); + gpiod_set_value(sw43408->reset_gpio, 1); + + ret = regulator_bulk_disable(ARRAY_SIZE(sw43408->supplies), sw43408->supplies); - return regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + return ret ? : ctx.accum_err; } static int sw43408_program(struct drm_panel *panel) { - struct sw43408_panel *ctx = to_panel_info(panel); + struct sw43408_panel *sw43408 = to_panel_info(panel); + struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link }; struct drm_dsc_picture_parameter_set pps; - int ret; - mipi_dsi_dcs_write_seq(ctx->link, MIPI_DCS_SET_GAMMA_CURVE, 0x02); + mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_GAMMA_CURVE, 0x02); - ret = mipi_dsi_dcs_set_tear_on(ctx->link, MIPI_DSI_DCS_TEAR_MODE_VBLANK); - if (ret < 0) { - dev_err(panel->dev, "Failed to set tearing: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_tear_on_multi(&ctx, MIPI_DSI_DCS_TEAR_MODE_VBLANK); - mipi_dsi_dcs_write_seq(ctx->link, 0x53, 0x0c, 0x30); - mipi_dsi_dcs_write_seq(ctx->link, 0x55, 0x00, 0x70, 0xdf, 0x00, 0x70, 0xdf); - mipi_dsi_dcs_write_seq(ctx->link, 0xf7, 0x01, 0x49, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x0c, 0x30); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x00, 0x70, 0xdf, 0x00, 0x70, 0xdf); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf7, 0x01, 0x49, 0x0c); - ret = mipi_dsi_dcs_exit_sleep_mode(ctx->link); - if (ret < 0) { - dev_err(panel->dev, "Failed to exit sleep mode: %d\n", ret); - return ret; - } + mipi_dsi_dcs_exit_sleep_mode_multi(&ctx); - msleep(135); + mipi_dsi_msleep(&ctx, 135); /* COMPRESSION_MODE moved after setting the PPS */ - mipi_dsi_dcs_write_seq(ctx->link, 0xb0, 0xac); - mipi_dsi_dcs_write_seq(ctx->link, 0xe5, + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0xac); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xe5, 0x00, 0x3a, 0x00, 0x3a, 0x00, 0x0e, 0x10); - mipi_dsi_dcs_write_seq(ctx->link, 0xb5, + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x75, 0x60, 0x2d, 0x5d, 0x80, 0x00, 0x0a, 0x0b, 0x00, 0x05, 0x0b, 0x00, 0x80, 0x0d, 0x0e, 0x40, 0x00, 0x0c, 0x00, 0x16, 0x00, 0xb8, 0x00, 0x80, 0x0d, 0x0e, 0x40, 0x00, 0x0c, 0x00, 0x16, 0x00, 0xb8, 0x00, 0x81, 0x00, 0x03, 0x03, 0x03, 0x01, 0x01); - msleep(85); - mipi_dsi_dcs_write_seq(ctx->link, 0xcd, + mipi_dsi_msleep(&ctx, 85); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xcd, 0x00, 0x00, 0x00, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x16, 0x16); - mipi_dsi_dcs_write_seq(ctx->link, 0xcb, 0x80, 0x5c, 0x07, 0x03, 0x28); - mipi_dsi_dcs_write_seq(ctx->link, 0xc0, 0x02, 0x02, 0x0f); - mipi_dsi_dcs_write_seq(ctx->link, 0x55, 0x04, 0x61, 0xdb, 0x04, 0x70, 0xdb); - mipi_dsi_dcs_write_seq(ctx->link, 0xb0, 0xca); - - ret = mipi_dsi_dcs_set_display_on(ctx->link); - if (ret < 0) { - dev_err(panel->dev, "Failed to set display on: %d\n", ret); - return ret; - } + mipi_dsi_dcs_write_seq_multi(&ctx, 0xcb, 0x80, 0x5c, 0x07, 0x03, 0x28); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x02, 0x02, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x04, 0x61, 0xdb, 0x04, 0x70, 0xdb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0xca); - msleep(50); + mipi_dsi_dcs_set_display_on_multi(&ctx); - ctx->link->mode_flags &= ~MIPI_DSI_MODE_LPM; + mipi_dsi_msleep(&ctx, 50); - drm_dsc_pps_payload_pack(&pps, ctx->link->dsc); - ret = mipi_dsi_picture_parameter_set(ctx->link, &pps); - if (ret < 0) { - dev_err(panel->dev, "Failed to set PPS: %d\n", ret); - return ret; - } + sw43408->link->mode_flags &= ~MIPI_DSI_MODE_LPM; + + drm_dsc_pps_payload_pack(&pps, sw43408->link->dsc); - ctx->link->mode_flags |= MIPI_DSI_MODE_LPM; + mipi_dsi_picture_parameter_set_multi(&ctx, &pps); + + sw43408->link->mode_flags |= MIPI_DSI_MODE_LPM; /* * This panel uses PPS selectors with offset: * PPS 1 if pps_identifier is 0 * PPS 2 if pps_identifier is 1 */ - ret = mipi_dsi_compression_mode_ext(ctx->link, true, + mipi_dsi_compression_mode_ext_multi(&ctx, true, MIPI_DSI_COMPRESSION_DSC, 1); - if (ret < 0) { - dev_err(panel->dev, "Failed to set compression mode: %d\n", ret); - return ret; - } - - return 0; + return ctx.accum_err; } static int sw43408_prepare(struct drm_panel *panel)