From patchwork Sun Mar 30 15:13:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejas Vipin X-Patchwork-Id: 14032943 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 31D28C28B20 for ; Sun, 30 Mar 2025 15:13:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 22C2F10E220; Sun, 30 Mar 2025 15:13:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Amn8YstM"; dkim-atps=neutral Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7BC010E220 for ; Sun, 30 Mar 2025 15:13:21 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-22580c9ee0aso75947675ad.2 for ; Sun, 30 Mar 2025 08:13:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743347601; x=1743952401; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=dlVLtOXTk2IyM0Aka9pHJk9+dLoQ8r5FHHUbG7LJJhg=; b=Amn8YstMtTxgY5IxvR75jdBOvzE5OFiOu5yAOcK0GUoC10L0GbrhWaXpJSnaStmZ9W 2pNzZUN7PHIiz5OxAG7+lyTqX2F+SZSy1eAqucRXdkylF7s+e7IF2vk87fWuOgLT7FXr 76FXoJrRKTqFli17zb4ovsK/CRgbWJlTrqjRe8OmPKlnJK0pJjEJpVxi6e0ZRVYw/yf5 IahYm6fw918md5Rz5VJ9jcY4xU/osqQXoF105k1NXA70qrgVZSa45QfA2Ev22cPaDXT6 YieLPk2Sa33NGrY191wrt1spBeQ7N5IVpWaZXSRBPSKZDtyvdxpUNidO0dtxFzVjrphg PCUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743347601; x=1743952401; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dlVLtOXTk2IyM0Aka9pHJk9+dLoQ8r5FHHUbG7LJJhg=; b=FbXVP+dXGscOCsOfGf8tzXDy+JbTkCXyC1ps/FEBDP/6K1+z1zvrSgxZH+WQKug0/R cAZVJG9DkNFgGOgUURo7Pr/Wny+Lul7a92XAfigfokdkCjl9sEK0enf3Aumhvn6An+nv 0Juwo6EWk2YbmqB4io3Y8QjlbxHbUUH/YYF9ncGINCOSjkD9SwB++N1X1KWzVNu9Nrhw Z9oOvecix8c38njepSdQCzMYhQATopv30ekg85APHtcIZu84lYlnjFVLdmNUyzTuGPIz hpgwa+gudJOj2e1ffcJ714P3G98WFAvjuUFDTLChQwfpoeBPqV5fI4WvhXOW5GmuLbVl Nauw== X-Forwarded-Encrypted: i=1; AJvYcCWYwqzL19NmptSWu743MNMSJ0NAhShs9OipkkTyzxEOYzeK5C/RIcM1ImweEbiSjeuGIg/6iCb8TnM=@lists.freedesktop.org X-Gm-Message-State: AOJu0YyKXGFR8Z0KakxhP5Cl/1gmsU9zddAYK5jwWIkoKK00Cfe1Uvtk Bjv//8N7pNzarNIXPZPMFTBogPTv0iK6rPCQAdyM8GMP7CPcw5PZ X-Gm-Gg: ASbGnct/6S22C3rPixjI18estW2jRZJ3H/61mVemt+t8meWrrE0Za9BzYOQpxhjJv+2 py0OlyizZG+LPlswtFCxShhCcQZOkJ2Xp2QZI2utvGUup/PCSO4b9BGH/toCFsMS+qM5XHZTSAq LVPwSR+Mo4FkC3GSNdpU6Z5c6EEFzmJkZ9zxi8bGKLErN7/vqny6yfdYMISLBxi2sFBnosPkDxv 3EYXvA1DAk6xJqRAqYeiyQwBUVO+ksrpyaCXMVcENIWQuWiLSQvGZ6Zz9XyRSqmU0vUPTfPKktL O7VW7z4E8v96jF3fM9i4VYina5Ls/2iJ99IEV5wbgwmb84h/uwKgPB6NixIbJqtS X-Google-Smtp-Source: AGHT+IFhkVjZEtZZiDR/lIq7Xt06caYzDaHpT1YLwfNEV7T0glEpa/c6E7kzVsqz8dSB9FmG2yDuYw== X-Received: by 2002:a17:902:ebd1:b0:223:3630:cd32 with SMTP id d9443c01a7336-2292fa162abmr98837035ad.53.1743347601318; Sun, 30 Mar 2025 08:13:21 -0700 (PDT) Received: from distilledx.SRMIST.EDU.IN ([103.4.220.252]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2291f1dee68sm52840595ad.205.2025.03.30.08.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Mar 2025 08:13:21 -0700 (PDT) From: Tejas Vipin To: neil.armstrong@linaro.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch Cc: quic_jesszhan@quicinc.com, dianders@chromium.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, asrivats@redhat.com, Tejas Vipin Subject: [PATCH] drm/panel: boe-bf060y8m-aj0: transition to mipi_dsi wrapped functions Date: Sun, 30 Mar 2025 20:43:04 +0530 Message-ID: <20250330151304.128417-1-tejasvipin76@gmail.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Changes the boe-bf060y8m-aj0 panel to use multi style functions for improved error handling. Signed-off-by: Tejas Vipin Reviewed-by: Dmitry Baryshkov --- .../gpu/drm/panel/panel-boe-bf060y8m-aj0.c | 112 +++++++----------- 1 file changed, 43 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c index 7e66db4a88bb..d017f9c00d69 100644 --- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c +++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c @@ -55,71 +55,52 @@ static void boe_bf060y8m_aj0_reset(struct boe_bf060y8m_aj0 *boe) static int boe_bf060y8m_aj0_on(struct boe_bf060y8m_aj0 *boe) { struct mipi_dsi_device *dsi = boe->dsi; - struct device *dev = &dsi->dev; - int ret; - - mipi_dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x00, 0x4c); - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_3D_CONTROL, 0x10); - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, DCS_ALLOW_HBM_RANGE); - mipi_dsi_dcs_write_seq(dsi, 0xf8, - 0x00, 0x08, 0x10, 0x00, 0x22, 0x00, 0x00, 0x2d); - - ret = mipi_dsi_dcs_exit_sleep_mode(dsi); - if (ret < 0) { - dev_err(dev, "Failed to exit sleep mode: %d\n", ret); - return ret; - } - msleep(30); - - mipi_dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xc0, - 0x08, 0x48, 0x65, 0x33, 0x33, 0x33, - 0x2a, 0x31, 0x39, 0x20, 0x09); - mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x00, 0x00, 0x00, 0x1f, 0x1f, - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); - mipi_dsi_dcs_write_seq(dsi, 0xe2, 0x20, 0x04, 0x10, 0x12, 0x92, - 0x4f, 0x8f, 0x44, 0x84, 0x83, 0x83, 0x83, - 0x5c, 0x5c, 0x5c); - mipi_dsi_dcs_write_seq(dsi, 0xde, 0x01, 0x2c, 0x00, 0x77, 0x3e); - - msleep(30); - - ret = mipi_dsi_dcs_set_display_on(dsi); - if (ret < 0) { - dev_err(dev, "Failed to set display on: %d\n", ret); - return ret; - } - msleep(50); - - return 0; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; + + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb0, 0xa5, 0x00); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb2, 0x00, 0x4c); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_SET_3D_CONTROL, 0x10); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, DCS_ALLOW_HBM_RANGE); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf8, + 0x00, 0x08, 0x10, 0x00, 0x22, 0x00, 0x00, 0x2d); + + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 30); + + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb0, 0xa5, 0x00); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc0, + 0x08, 0x48, 0x65, 0x33, 0x33, 0x33, + 0x2a, 0x31, 0x39, 0x20, 0x09); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc1, 0x00, 0x00, 0x00, 0x1f, 0x1f, + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xe2, 0x20, 0x04, 0x10, 0x12, 0x92, + 0x4f, 0x8f, 0x44, 0x84, 0x83, 0x83, 0x83, + 0x5c, 0x5c, 0x5c); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xde, 0x01, 0x2c, 0x00, 0x77, 0x3e); + + mipi_dsi_msleep(&dsi_ctx, 30); + + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 50); + + return dsi_ctx.accum_err; } -static int boe_bf060y8m_aj0_off(struct boe_bf060y8m_aj0 *boe) +static void boe_bf060y8m_aj0_off(struct boe_bf060y8m_aj0 *boe) { struct mipi_dsi_device *dsi = boe->dsi; - struct device *dev = &dsi->dev; - int ret; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; /* OFF commands sent in HS mode */ dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - ret = mipi_dsi_dcs_set_display_off(dsi); - if (ret < 0) { - dev_err(dev, "Failed to set display off: %d\n", ret); - return ret; - } - msleep(20); - - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); - if (ret < 0) { - dev_err(dev, "Failed to enter sleep mode: %d\n", ret); - return ret; - } - usleep_range(1000, 2000); - dsi->mode_flags |= MIPI_DSI_MODE_LPM; + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 20); - return 0; + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); + mipi_dsi_usleep_range(&dsi_ctx, 1000, 2000); + if (!(dsi_ctx.accum_err)) + dsi->mode_flags |= MIPI_DSI_MODE_LPM; } static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel) @@ -157,7 +138,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel) ret = boe_bf060y8m_aj0_on(boe); if (ret < 0) { - dev_err(dev, "Failed to initialize panel: %d\n", ret); gpiod_set_value_cansleep(boe->reset_gpio, 1); return ret; } @@ -178,15 +158,11 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel) static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel) { struct boe_bf060y8m_aj0 *boe = to_boe_bf060y8m_aj0(panel); - struct device *dev = &boe->dsi->dev; - int ret; - ret = boe_bf060y8m_aj0_off(boe); - if (ret < 0) - dev_err(dev, "Failed to un-initialize panel: %d\n", ret); + boe_bf060y8m_aj0_off(boe); gpiod_set_value_cansleep(boe->reset_gpio, 1); - ret = regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs); + regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs); return 0; } @@ -234,13 +210,11 @@ static int boe_bf060y8m_aj0_bl_update_status(struct backlight_device *bl) { struct mipi_dsi_device *dsi = bl_get_data(bl); u16 brightness = backlight_get_brightness(bl); - int ret; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; - ret = mipi_dsi_dcs_set_display_brightness(dsi, brightness); - if (ret < 0) - return ret; + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, brightness); - return 0; + return dsi_ctx.accum_err; } static int boe_bf060y8m_aj0_bl_get_brightness(struct backlight_device *bl)