From patchwork Fri May 17 21:36:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13667404 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 8A9FDC04FFE for ; Fri, 17 May 2024 21:37:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D31B10E036; Fri, 17 May 2024 21:37:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cntTaHwd"; dkim-atps=neutral Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7D27E10E036 for ; Fri, 17 May 2024 21:37:37 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1edf506b216so22080395ad.2 for ; Fri, 17 May 2024 14:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981857; x=1716586657; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2eNLlQcUGr08ustxm7tjWdAeIcGj6aFrRwLzzw2mxSA=; b=cntTaHwdobCqeUdpe5WGlbbPlOEoyCAfUGZoyRl1nPhzdZm/egKe/oAvu/7eiAvDaM RORqcNcHg2qTWL1mzvKD9jOADVYXenNFCJEo5N60cpGpfZq6UGLj5rSD0P/CYUgBZ6t5 CavxQkkn257qL+E+lvlYhyosoOu0HAd6/L9IA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981857; x=1716586657; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2eNLlQcUGr08ustxm7tjWdAeIcGj6aFrRwLzzw2mxSA=; b=fbxZovsi/qAKn3ecy4ycgi/FxUI5kIRtXBB3Q1tmphyacyXbzStzUeBNshaufF64we yhfL3xST/1RoODnlaMdNvh/cr3tfaAEWCk78O5LtM19zokoAERNbML7MeJzv1u35bBcG EbuLhnV2auYE8K9WTcxEKQOr47dMPyhSXK36tXdUKw5HDLhrTYLXBacmtyiYztCoVx51 3uit/yC8dHxOF2tI/+Q8+wWapG4nGCqElbG25iehuFr+wRFfJYvLjn9aInCIhEC6i2bt y32Wk2zXoH8SupRqpmRh5C9ESEctk44yjWVJTy5upmfb1wto0OjLK+1aU3pn7biWc6s3 a6Ug== X-Forwarded-Encrypted: i=1; AJvYcCVv/5sxAR/E7EFx22nVf1J0sXDKvvKt0MD7IId8q5tY53iJW3/32ZcDYkgz7sP4Uv3cK1UMdmrT/IJKL62+cxGigEgEMfSV2WLew2l/7OGS X-Gm-Message-State: AOJu0Yxl99wSGAPmBz6KatP7dRRxw4Uo1bS36/DW1jYZE3wc5OH0ctaS EVVVHf11Fddv7DgAgYKHkZA8qna1luWzbLNZt/m/C2arEvr2C/UZE8HUktPleg== X-Google-Smtp-Source: AGHT+IGbq1YgMmj1OEV+ca51a5Lig67cuHTnRuhRUs861294NoqU+mz1Ch3XQAPqjZMe6AS7fFAHkQ== X-Received: by 2002:a05:6a20:3d81:b0:1af:e649:6f4 with SMTP id adf61e73a8af0-1afe649086amr21555290637.57.1715981856849; Fri, 17 May 2024 14:37:36 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:26de:b1dd:5:771c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2f8b3sm15168736b3a.211.2024.05.17.14.37.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:37:36 -0700 (PDT) From: Douglas Anderson To: Neil Armstrong , Jessica Zhang , Sam Ravnborg Cc: Linus Walleij , Dmitry Baryshkov , Douglas Anderson , Daniel Vetter , David Airlie , Javier Martinez Canillas , =?utf-8?q?Kamil_Trzci=C5=84s?= =?utf-8?q?ki?= , Maarten Lankhorst , Maxime Ripard , Ondrej Jirman , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/8] drm/panel: himax-hx8394: Handle errors from mipi_dsi_dcs_set_display_on() better Date: Fri, 17 May 2024 14:36:36 -0700 Message-ID: <20240517143643.1.I0a6836fffd8d7620f353becb3df2370d2898f803@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240517213712.3135166-1-dianders@chromium.org> References: <20240517213712.3135166-1-dianders@chromium.org> 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" If mipi_dsi_dcs_set_display_on() returned an error then we'd store that in the "ret" variable and jump to error handling. We'd then attempt an orderly poweroff. Unfortunately we then blew away the value stored in "ret". That means that if the orderly poweroff actually worked then we're return 0 (no error) from hx8394_enable() even though the panel wasn't enabled. Fix this by not blowing away "ret". Found by code inspection. Fixes: 65dc9360f741 ("drm: panel: Add Himax HX8394 panel controller driver") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-himax-hx8394.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-himax-hx8394.c b/drivers/gpu/drm/panel/panel-himax-hx8394.c index ff0dc08b9829..cb9f46e853de 100644 --- a/drivers/gpu/drm/panel/panel-himax-hx8394.c +++ b/drivers/gpu/drm/panel/panel-himax-hx8394.c @@ -370,8 +370,7 @@ static int hx8394_enable(struct drm_panel *panel) sleep_in: /* This will probably fail, but let's try orderly power off anyway. */ - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); - if (!ret) + if (!mipi_dsi_dcs_enter_sleep_mode(dsi)) msleep(50); return ret; From patchwork Fri May 17 21:36:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13667405 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 0937FC04FFE for ; Fri, 17 May 2024 21:37:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F9C810E0B0; Fri, 17 May 2024 21:37:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Thp8/NTm"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2830210E036 for ; Fri, 17 May 2024 21:37:39 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1edfc57ac0cso21852965ad.3 for ; Fri, 17 May 2024 14:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981858; x=1716586658; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=otBGDKVA9IXvnt4HBmF8aixiY7lsB5c27hifCvrdcgw=; b=Thp8/NTmYWMSbwT++JX3ka2e+R0gRCbkKQCTyPT5PlJ1uBgeFdHrFVfBiGEI136K3K 57bRcrTgrf7615aYByN9qNLw9DLAcuaDxczwcd9/Ulk314W7nkPCXqKIC04qV+2l/7f9 2VFKLv5AeRHkZ4MP967LFkrPysGH2K3kA61Sw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981858; x=1716586658; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=otBGDKVA9IXvnt4HBmF8aixiY7lsB5c27hifCvrdcgw=; b=Ol0yTcaJ4sEfMtHPWlwjOCCSZJHjrA8MvWjM95O9ikXKlZfNBtkJPTaumQyZC4fVAJ AQG0cKCywhDLTBIlgnVGWI8By+ENjFmBIUKaQmVw5fLpLNQ7zD31EuHiyUxDw7mMJhgn HZeq+r26KF4zrgYKYdMbufTYg9mDv3qqGXghVC+kf+7ViCvZ5BZFF+dtS4wUpTAW4cp5 MhbiW/sCtVfNzewhSjr11jkJshyj57UVSeNTQRbN+lE50sp6avhtnluiID1TnRqNcAvb PHwe3f7NcFuVsgPtC5vXDOyUIV2Q6c4behS8u6UCELtAwId7M6sJS6b/KLaAqjFvKe1j 4Vmw== X-Forwarded-Encrypted: i=1; AJvYcCW2EbDiZh1qgMjFVSE7UfBXcrNrG/FxXrS/lEPpBNlAmI/OoWR9zD4t+1S//kUBkO6fc8eqrNKAiTqm8AGuDApoEO4v24KG64tljS3+uqLg X-Gm-Message-State: AOJu0YwOfy95LmGqh6pzaYq9iRZrEh6URKiUS20I69sQpexzlfYK1pJ8 QMwadppEWw4A6fLhkq9PaZvNAcKP4HVFtLz9UlrkVaxs2ltVMJ1TCHR2z58xWg== X-Google-Smtp-Source: AGHT+IG9oTcMCg7rkDReYhIwGehOkT+PViM2X4yuDk+pejmeAywc0nLdIrwyw2PSTgQN8mmuXIRQ6g== X-Received: by 2002:a05:6a00:1953:b0:6e7:32a0:806a with SMTP id d2e1a72fcca58-6f4e039bc12mr23778076b3a.28.1715981858605; Fri, 17 May 2024 14:37:38 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:26de:b1dd:5:771c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2f8b3sm15168736b3a.211.2024.05.17.14.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:37:38 -0700 (PDT) From: Douglas Anderson To: Neil Armstrong , Jessica Zhang , Sam Ravnborg Cc: Linus Walleij , Dmitry Baryshkov , Douglas Anderson , Daniel Vetter , David Airlie , Jitao Shi , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/8] drm/panel: boe-tv101wum-nl6: If prepare fails, disable GPIO before regulators Date: Fri, 17 May 2024 14:36:37 -0700 Message-ID: <20240517143643.2.Ieac346cd0f1606948ba39ceea06b55359fe972b6@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240517213712.3135166-1-dianders@chromium.org> References: <20240517213712.3135166-1-dianders@chromium.org> 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" The enable GPIO should clearly be set low before turning off regulators. That matches both the inverse order that things were enabled and also the order in unprepare(). Fixes: a869b9db7adf ("drm/panel: support for boe tv101wum-nl6 wuxga dsi video mode panel") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index 8e839a1749e4..028625d2d37d 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -1475,13 +1475,13 @@ static int boe_panel_prepare(struct drm_panel *panel) return 0; poweroff: + gpiod_set_value(boe->enable_gpio, 0); regulator_disable(boe->avee); poweroffavdd: regulator_disable(boe->avdd); poweroff1v8: usleep_range(5000, 7000); regulator_disable(boe->pp1800); - gpiod_set_value(boe->enable_gpio, 0); return ret; } From patchwork Fri May 17 21:36:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13667408 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 5E529C25B7A for ; Fri, 17 May 2024 21:37:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FD9610E12E; Fri, 17 May 2024 21:37:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="D2QwmvNn"; dkim-atps=neutral Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id E49A810E036 for ; Fri, 17 May 2024 21:37:40 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1ee12baa01cso24315315ad.0 for ; Fri, 17 May 2024 14:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981860; x=1716586660; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m6V1DTOaoA4qH0IIompQM1ktLyB9pQcF5OQ8P3nV8rs=; b=D2QwmvNnnehNJgFZRP5qkPdab4wmose19Hp22sryIiC7+pnadETpvPfOURQ5lxMxkG TuIifn53PdXLWk4zZ5XWgnSDqQaOp9Sl5laOq6wQhQ9sDg5+fVqtYOtItV2FUwQTR9QO F9CUlK5qu6T3J4zpFSpeEpUUtlBS7sGrLFPm8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981860; x=1716586660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m6V1DTOaoA4qH0IIompQM1ktLyB9pQcF5OQ8P3nV8rs=; b=UnjWX230e28vxoAqxesFpIBEHjLG7Nw8/8S1KmaFTh9b32PgFRVQesG7GbeaNryG7u 93BZUiLPs8mYtVnfLgGbJ3GVJWlsL37yo8DQtgmdV6Tk/O2mipv6K084vWqcxZ04gHOK Q68UT9QDSy6HhDpn2qrbFhdt3Sw2Xgb2QNJJrYRULC06YWnUlGOEIyhk/1pv4/3jZFZm RYsD6Jx1JThvPAqVtqT2L8/6917UKdhpP/Ym91kjwbxzY0KOzqk6AdWo/1/KWpFsooBs 5UC1z96RB3dkCgNnDxxenz1DwB3DgHr5V3G4RE7uW5EjMH8gvitJChAQqTpK452pAnNA FN6A== X-Forwarded-Encrypted: i=1; AJvYcCUw879Hcc+9ZWhvow9N5/sU5X3YoMigyCi59FdpcKwFxpB6ryxw4gXc+hHDy70hY0QK8nlrLa7ylAWkQaC9egYj7hAVjza8iSt7ch1CYWVk X-Gm-Message-State: AOJu0YzHalrq31qPvI0gVx12hHC0l1N0avqdRjjXZDwKYpSjLQvli76v R2MhXafnzrw8H4NjBnxLx+LWAalGYOvZeGOdAk8pO77hn/YjMX8aBSIk8wM9eQ== X-Google-Smtp-Source: AGHT+IHm5RdVFjZ89P0T1AzZMKaNsfexwf2EZJjaYa/Kewivy7mYMercZQ/c+BtdjQ/LoSpevWMT2w== X-Received: by 2002:a05:6a00:3996:b0:6ec:ceb4:49b8 with SMTP id d2e1a72fcca58-6f4e01ba036mr25987075b3a.0.1715981860345; Fri, 17 May 2024 14:37:40 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:26de:b1dd:5:771c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2f8b3sm15168736b3a.211.2024.05.17.14.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:37:39 -0700 (PDT) From: Douglas Anderson To: Neil Armstrong , Jessica Zhang , Sam Ravnborg Cc: Linus Walleij , Dmitry Baryshkov , Douglas Anderson , AngeloGioacchino Del Regno , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Shuijing Li , Thomas Zimmermann , Xinlei Lee , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] drm/panel: boe-tv101wum-nl6: Check for errors on the NOP in prepare() Date: Fri, 17 May 2024 14:36:38 -0700 Message-ID: <20240517143643.3.Ibffbaa5b4999ac0e55f43bf353144433b099d727@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240517213712.3135166-1-dianders@chromium.org> References: <20240517213712.3135166-1-dianders@chromium.org> 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" The mipi_dsi_dcs_nop() function returns an error but we weren't checking it in boe_panel_prepare(). Add a check. This is highly unlikely to matter in practice. If the NOP failed then likely later MIPI commands would fail too. Found by code inspection. Fixes: 812562b8d881 ("drm/panel: boe-tv101wum-nl6: Fine tune the panel power sequence") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index 028625d2d37d..f7beace455c3 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -1456,7 +1456,11 @@ static int boe_panel_prepare(struct drm_panel *panel) usleep_range(10000, 11000); if (boe->desc->lp11_before_reset) { - mipi_dsi_dcs_nop(boe->dsi); + ret = mipi_dsi_dcs_nop(boe->dsi); + if (ret < 0) { + dev_err(&boe->dsi->dev, "Failed to send NOP: %d\n", ret); + goto poweroff; + } usleep_range(1000, 2000); } gpiod_set_value(boe->enable_gpio, 1); From patchwork Fri May 17 21:36:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13667406 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 0E17AC25B77 for ; Fri, 17 May 2024 21:37:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4BE7410E0AD; Fri, 17 May 2024 21:37:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HW+vCt/E"; dkim-atps=neutral Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8626C10E0A0 for ; Fri, 17 May 2024 21:37:42 +0000 (UTC) Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6f4603237e0so480281b3a.0 for ; Fri, 17 May 2024 14:37:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981862; x=1716586662; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qdxmCQIjRAvO8BCfViIMJHCflXvR2bqDUxHByEsJNv0=; b=HW+vCt/ELzJDp0lH4raD86sG23Gyvs3a4ibU3np83eqbvNVjh1Y88W7CkDDQa0Z3ZE R9gSRS0+xg3E3KihC9kcqvvIu70au4v94PDU9QxdyYMtX0BIYLMo7lubKsMxnyK/m1Vt D/cESDuUrR3KdOlQnVvxNTKV895k/YSxfsxxQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981862; x=1716586662; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qdxmCQIjRAvO8BCfViIMJHCflXvR2bqDUxHByEsJNv0=; b=VNX8dEFrhuojG7w1uI1UpZWVqJDRw2bKElAH8EDN3UwV+WYKtVRPzEWOhmzt0R/9u3 3mHuRyZR/qO4nkyhcgunFgAlfkIqYCkn42qdsqP8BAA/ksGp+p0Ul+zBpttEqQEeGiNf oGCxOkeA6f9AULnhmdqKiYZwtgVb2ciTDAxyPVW+IbA/UPBKI4sk1vL3o6V3rc8O48y5 6XQqD6cCClll848Lt6YFHkF9dv7yRtqh+YfMnheQfRqr1rSFExRqKWSt0t5n8xFfbo6P jZ4IkjsvcBjucCN0/mkaF0kjD8w/RY771CPgQ+xHisTf8avdsfKhv2lpCBGtOzrYlVew nS9w== X-Forwarded-Encrypted: i=1; AJvYcCU2IPOk561i+Kf5YMS6v0hPpOavI3tkNjKhHsBwHaiposCt4U9cceUnkMLSZ7AnoBsGO60jNyfX4MZ4ucCyUxi1oQEquW75ohHhfuF7lgR1 X-Gm-Message-State: AOJu0YwtMnNrAxzgin1QeVIBLvDuwrj8Fnq6RL6PazgM3E3vO+vlKG8B zkYp3A6qlAUGP6K35ltljoj8sWvXkhr7iR6+A20cZYpfXr8RF2nXiml8ZchcEQ== X-Google-Smtp-Source: AGHT+IHX2L9EVLQc886otDLXwIh9pr9UtYuwXLoQCTn5ubCeZ2plNpUi+ivhbdW42Vwp09Y6f6yc9w== X-Received: by 2002:a05:6a20:d80b:b0:1af:37bf:d7de with SMTP id adf61e73a8af0-1b1ca3bca44mr433294637.7.1715981862038; Fri, 17 May 2024 14:37:42 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:26de:b1dd:5:771c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2f8b3sm15168736b3a.211.2024.05.17.14.37.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:37:41 -0700 (PDT) From: Douglas Anderson To: Neil Armstrong , Jessica Zhang , Sam Ravnborg Cc: Linus Walleij , Dmitry Baryshkov , Douglas Anderson , Cong Yang , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/8] drm/panel: ilitek-ili9882t: If prepare fails, disable GPIO before regulators Date: Fri, 17 May 2024 14:36:39 -0700 Message-ID: <20240517143643.4.Ieb0179065847972a0f13e9a8574a80a5f65f3338@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240517213712.3135166-1-dianders@chromium.org> References: <20240517213712.3135166-1-dianders@chromium.org> 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" The enable GPIO should clearly be set low before turning off regulators. That matches both the inverse order that things were enabled and also the order in unprepare(). Fixes: e2450d32e5fb ("drm/panel: ili9882t: Break out as separate driver") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-ilitek-ili9882t.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c index 830d7cfbe857..a2ea25bb6624 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c @@ -495,13 +495,13 @@ static int ili9882t_prepare(struct drm_panel *panel) return 0; poweroff: + gpiod_set_value(ili->enable_gpio, 0); regulator_disable(ili->avee); poweroffavdd: regulator_disable(ili->avdd); poweroff1v8: usleep_range(5000, 7000); regulator_disable(ili->pp1800); - gpiod_set_value(ili->enable_gpio, 0); return ret; } From patchwork Fri May 17 21:36:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13667407 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 7E362C04FFE for ; Fri, 17 May 2024 21:37:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD5F610E0A0; Fri, 17 May 2024 21:37:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="awt7eiQU"; dkim-atps=neutral Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3941110E0A0 for ; Fri, 17 May 2024 21:37:44 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1eeabda8590so21119895ad.0 for ; Fri, 17 May 2024 14:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981864; x=1716586664; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VOCpqzi3HqgLjpNBxA0mBkV791uaa9LyaeXWVqamirw=; b=awt7eiQUlSzQgE+PZSZl3YWgZMJVErnSBM9jIY58Q1MVGMDmiCpDbK2JKmnYrfW0jE hFw95330C2nD4Ab08+wguQOdN4vkhaZ/S95Qb5yzNMqi50cqWi8VZxvfl21jv5ErQImv MPRbWgFHOJLeYPGLtT/9RcS/IUEgQOmyV9VY0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981864; x=1716586664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VOCpqzi3HqgLjpNBxA0mBkV791uaa9LyaeXWVqamirw=; b=ormlRizC1d6tLhEaGSNMfzwdtMswY1pnBnCxyGC3olFvuGbBzCxkQuXVuRrSdp/XW1 lhAmq3q3cM+K6ns8QyrwNTx36PxXSycbHflPm6XDG5a8GygzGaIubO+FOkXbvQJpOA14 KebV9NJVZgGvLdQLggD7GOeA9c/N4CMEB6J/QLyZpAdbxgiflBelTXvT7jC9FPt3Hfo3 GclWLsfLFIEGP/+2zEStQdhKZthwRwgEt7vbfi/Mz+1ncpWZ8GecFaN3/h0a29pH0wUJ kPalG79feEn3lfYV/vNwr4LfSGOKjB4ACVacMGBvGxCxs1LU5t7hpecEg3i7BVbDx9f/ uzBA== X-Forwarded-Encrypted: i=1; AJvYcCUFKFS24+UeeH8pr5VabAaDbT7xPZqTFln8rwwWJ/VFbzoHrGAzkuO1bAG5F3tkm6LmTmHuiHRIkrp0MgFXXNBOtpY3tDIhfVrlwuj+jzfO X-Gm-Message-State: AOJu0YwbwCnVcDjVE/vzHE+6XjGKb6p4uMyoI3yN+NtUAg1Bn0Dd8oXq vdv1XfTiNfjD6vsdwCNjWdre09Gf4hIpRAeLp9NkGqpHDEUdie6iyPz7CaOEnA== X-Google-Smtp-Source: AGHT+IHQeVpOpHuWwPDHwj5Y2EyRQy9AOFOGAMnBVeq9k04cNJAbxX1fcU7hJFn6i0+Z3n4aXjp8KA== X-Received: by 2002:a05:6a00:1ad0:b0:6e6:9f47:c18c with SMTP id d2e1a72fcca58-6f4e03858b3mr27717561b3a.33.1715981863806; Fri, 17 May 2024 14:37:43 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:26de:b1dd:5:771c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2f8b3sm15168736b3a.211.2024.05.17.14.37.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:37:43 -0700 (PDT) From: Douglas Anderson To: Neil Armstrong , Jessica Zhang , Sam Ravnborg Cc: Linus Walleij , Dmitry Baryshkov , Douglas Anderson , Cong Yang , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/8] drm/panel: ilitek-ili9882t: Check for errors on the NOP in prepare() Date: Fri, 17 May 2024 14:36:40 -0700 Message-ID: <20240517143643.5.I323476ba9fa8cc7a5adee4c1ec95202785cc5686@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240517213712.3135166-1-dianders@chromium.org> References: <20240517213712.3135166-1-dianders@chromium.org> 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" The mipi_dsi_dcs_nop() function returns an error but we weren't checking it in ili9882t_prepare(). Add a check. This is highly unlikely to matter in practice. If the NOP failed then likely later MIPI commands would fail too. Found by code inspection. Fixes: e2450d32e5fb ("drm/panel: ili9882t: Break out as separate driver") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-ilitek-ili9882t.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c index a2ea25bb6624..266a087fe14c 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c @@ -478,7 +478,11 @@ static int ili9882t_prepare(struct drm_panel *panel) usleep_range(10000, 11000); // MIPI needs to keep the LP11 state before the lcm_reset pin is pulled high - mipi_dsi_dcs_nop(ili->dsi); + ret = mipi_dsi_dcs_nop(ili->dsi); + if (ret < 0) { + dev_err(&ili->dsi->dev, "Failed to send NOP: %d\n", ret); + goto poweroff; + } usleep_range(1000, 2000); gpiod_set_value(ili->enable_gpio, 1); From patchwork Fri May 17 21:36:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13667411 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 CAA62C04FFE for ; Fri, 17 May 2024 21:38:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 10D8A10E19C; Fri, 17 May 2024 21:38:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="AcBGNuIy"; dkim-atps=neutral Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id C8C5D10E0CD for ; Fri, 17 May 2024 21:37:47 +0000 (UTC) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6f457853950so426359b3a.0 for ; Fri, 17 May 2024 14:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981867; x=1716586667; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wMrmoliKPswHzuEojIBGChDP268r8lDTpqZYT1tgrB0=; b=AcBGNuIyswLkJq9adE7wFbgK2cgEKLpMFDoQy8eKwEsLHXgRWYP6vaLi4z/C4lgFxx uvBfeW2SxXGVlBmZbR4UGa3CIn6mmWTMBlGJnF560fhR/sEF0ieax5uQn7Ly1S6iETvm fzxwvA5rRdov80UeGOnj9UGvyWydD4gkiwIA8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981867; x=1716586667; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wMrmoliKPswHzuEojIBGChDP268r8lDTpqZYT1tgrB0=; b=sD/y3XDBOu9jByekYEcO2LCK8Pvth7VT9VyJwe/EWpQP2PKvXav/L0GZsQW37Pw2HI xuDplqdQrCWl98XmP7t4eMS1w3spIzw2layGcz2Rilh93/5+a1LgH9zhLUCMKYW2nYDy k3p4YGUXDx9549nS4pgMcBikQhA+HYWrpkRUCGk8UjPZIQqZGcIcH9xFgy5WXGf5Fn1k iymw4vD1WFFbAfOer4gYmEuwHgvd11YeLq3p4yAjrgGOqNhhMkoIoRUn77bJdaWesH3n SKhUAlfht9x98OC7WuR3EKk6mBtFp0Q3b7tVUPkaLXbeo+R8HK/InCZjVSLC6o8sstve x1oQ== X-Forwarded-Encrypted: i=1; AJvYcCWbTy0N1+XOY9KmB89waDj9eyfjFoSCE/DP09pdlHNtOF4h5VH5jBtbdVS0Jb9sKIkMmbVixqaafvNxbvIkb2JA+7xjiTMku/SYowIjcE2C X-Gm-Message-State: AOJu0YwfC5678ufafhJS2X8K6JQuGXcI5BvG7SAVtghDk+b3a49QFjsf HwyQyEJ2TBYzQRGAzURtKY3vGHKs4yO7pg5Ann3oG8GiH5vcetZNT2UZVA4TZz/yKveVW7EEWes = X-Google-Smtp-Source: AGHT+IG0DV+RQTrF64BGZMxIPU0+NC5JzIe/lzMpLQ15ksBfa6Z15kVlWjTAgXqC398NIEA3infXfw== X-Received: by 2002:a05:6a21:9988:b0:1ad:886e:ef5a with SMTP id adf61e73a8af0-1b1ca42879dmr436290637.19.1715981867162; Fri, 17 May 2024 14:37:47 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:26de:b1dd:5:771c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2f8b3sm15168736b3a.211.2024.05.17.14.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:37:46 -0700 (PDT) From: Douglas Anderson To: Neil Armstrong , Jessica Zhang , Sam Ravnborg Cc: Linus Walleij , Dmitry Baryshkov , Douglas Anderson , Cong Yang , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/8] drm/panel: himax-hx83102: If prepare fails, disable GPIO before regulators Date: Fri, 17 May 2024 14:36:41 -0700 Message-ID: <20240517143643.6.Id0659a80147cf51e0ebb8fe7fee18db86851960d@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240517213712.3135166-1-dianders@chromium.org> References: <20240517213712.3135166-1-dianders@chromium.org> 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" The enable GPIO should clearly be set low before turning off regulators. That matches both the inverse order that things were enabled and also the order in unprepare(). Fixes: 0ef94554dc40 ("drm/panel: himax-hx83102: Break out as separate driver") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-himax-hx83102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c index 1a6975937f30..4ac7f9d8b232 100644 --- a/drivers/gpu/drm/panel/panel-himax-hx83102.c +++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c @@ -578,13 +578,13 @@ static int hx83102_prepare(struct drm_panel *panel) return 0; poweroff: + gpiod_set_value(ctx->enable_gpio, 0); regulator_disable(ctx->avee); poweroffavdd: regulator_disable(ctx->avdd); poweroff1v8: usleep_range(5000, 7000); regulator_disable(ctx->pp1800); - gpiod_set_value(ctx->enable_gpio, 0); return ret; } From patchwork Fri May 17 21:36:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13667409 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 B3568C04FFE for ; Fri, 17 May 2024 21:37:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F16010E0CD; Fri, 17 May 2024 21:37:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bBNzsGz7"; dkim-atps=neutral Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4509210E0CD for ; Fri, 17 May 2024 21:37:49 +0000 (UTC) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6f4603237e0so480325b3a.0 for ; Fri, 17 May 2024 14:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981869; x=1716586669; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=We3AVE4aBq1trFIRy44WPUFQ73H18cpHtn0h/NL3Rck=; b=bBNzsGz7m6HFZbRsJInC2YYEsH91U9HR1oTk/fePwJx1YLem1kJLD7/UzyI9nzCGlG 9SeLIEBf/20z2m5Grv2jvu7QsCc5IdYnKjdP6U/Ly8IbrpbjAAnBGNjm0hg6AJpTf1ZL NOX0xDt/1S7s7E/j5kvoZBhKGnubg4F4Kx5xk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981869; x=1716586669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=We3AVE4aBq1trFIRy44WPUFQ73H18cpHtn0h/NL3Rck=; b=l3j90iO1Tw/JevucRpHOUkhZx7+46a2j/Jnzdxe+FLhJ5NM2fdfvqrlnt5cY3edSuQ MCcXaPJSDA2blQ/avtYshlD/4AWPBN7tOX7Z529QIuifqSIIxZBKTpUrFUDrKWOBPTzt fMxGYfu/Zfwz5ek1heyz6ychvmriWMd16/1mAOqRwhUqWL8sR1rHTBccjTsencktC13w Qn32z/D0nLAZvL9o9Z3CETyDiNdWtfBCxQ0ZjQ0gpo/y2axBKLryZj8+Uw/nDUUJbLeR 1q/ISBhF0URE/TpSlRQjKFgAd4wCInDCHRJooNYMwAuMeSPc2oNl8E6b5jrSCLBOW6Gh 0QKw== X-Forwarded-Encrypted: i=1; AJvYcCW1COOTZ8Abh1eVw44QBBvSR0b8YCCmajpdtUjkZWABpIR30NpLlu4yFpoLYIh2TnBWlwX1y74LJCmMJPZbK53XEiKO0CrLeVGi4xafa9vT X-Gm-Message-State: AOJu0YyDcqIcKcvTap33UAwS+MtJeK192uMnsEarsa4WOUGlW3IDRzsZ pFo8xr/xF9pEwbhnCgFwzS1kTy8a0o48o1O4/xYzH2NkjlH0guaeXV4kgkTIBg== X-Google-Smtp-Source: AGHT+IGUAJ0geG1QhMmA+VAZ/fh/fy6SVd3BRKxWlKL+B9mtqySrLgU3R4/FIsipR79u5pNyrBi07w== X-Received: by 2002:a05:6a00:3b05:b0:6f4:463f:af87 with SMTP id d2e1a72fcca58-6f69fbe02bfmr353213b3a.10.1715981868854; Fri, 17 May 2024 14:37:48 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:26de:b1dd:5:771c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2f8b3sm15168736b3a.211.2024.05.17.14.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:37:48 -0700 (PDT) From: Douglas Anderson To: Neil Armstrong , Jessica Zhang , Sam Ravnborg Cc: Linus Walleij , Dmitry Baryshkov , Douglas Anderson , Cong Yang , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/8] drm/panel: himax-hx83102: Check for errors on the NOP in prepare() Date: Fri, 17 May 2024 14:36:42 -0700 Message-ID: <20240517143643.7.I3fae28745bf2cacd8dac04d7a06daea50e233f46@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240517213712.3135166-1-dianders@chromium.org> References: <20240517213712.3135166-1-dianders@chromium.org> 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" The mipi_dsi_dcs_nop() function returns an error but we weren't checking it in hx83102_prepare(). Add a check. This is highly unlikely to matter in practice. If the NOP failed then likely later MIPI commands would fail too. Found by code inspection. Fixes: 0ef94554dc40 ("drm/panel: himax-hx83102: Break out as separate driver") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-himax-hx83102.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c index 4ac7f9d8b232..1ba623e41924 100644 --- a/drivers/gpu/drm/panel/panel-himax-hx83102.c +++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c @@ -547,7 +547,11 @@ static int hx83102_prepare(struct drm_panel *panel) usleep_range(10000, 11000); - mipi_dsi_dcs_nop(ctx->dsi); + ret = mipi_dsi_dcs_nop(ctx->dsi); + if (ret < 0) { + dev_err(dev, "Failed to send NOP: %d\n", ret); + goto poweroff; + } usleep_range(1000, 2000); gpiod_set_value(ctx->enable_gpio, 1); From patchwork Fri May 17 21:36:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13667410 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 1DBB9C25B77 for ; Fri, 17 May 2024 21:37:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D3D410E137; Fri, 17 May 2024 21:37:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gXr0ElPu"; dkim-atps=neutral Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 335A610E137 for ; Fri, 17 May 2024 21:37:51 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1f082d92864so23076575ad.1 for ; Fri, 17 May 2024 14:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715981870; x=1716586670; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6Idck8NJaJ/+Vpl/CRWABV0vclOOqdIkStHcxSg1So4=; b=gXr0ElPuS5wEBTzWuK3vmrD8Ir0BkDRkWfbzSBtrJtzlYBznIKDOgF0FpvvNvp6y34 F5R2jBsEZY8pzJiHIidEdL9VaBJgL9OY8krDoHR5HR8dvFJrgSzQ/IdO+V6X2kZeeET+ /ugFyx9e5oylSTyNPbe/P9fsSUZ2MSLD5cY9U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715981870; x=1716586670; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Idck8NJaJ/+Vpl/CRWABV0vclOOqdIkStHcxSg1So4=; b=stMM00/RFbNTACiesXAXE95Of4iHn84XL1u/bMU8Vk9Zv6YBAMifowgrpxSZZS5n2O p/QZbWqyIhNazjIp2myXrkfFhPSu2pRnN9psUEPQbFjKm25pZ/6kEjtJrahEJD2KMRLe PHTqtzUhEyZg+HtwREuyQS8IoTu76Pfwgj+CTXhhlJTgybw8cyW1UbkhezvVSVzbNKSV AC6ZyZRh3NP3wMhcYA66bS/7XxWHxun417Wg9Nb6oqU0W4StEYtQ8AvSZp80YYBWZaTV raTQ5ZvAgZXhIjlm9CcIq6uM06jHjZAVgQmZg/1txS8Tj/uemWtPjsJgBwEHCcjafNvM zG1g== X-Forwarded-Encrypted: i=1; AJvYcCW+De9udTj6R1NRnOMWamCOP+r9vQPaNOJe7jJzY3hVspRxK/MBy2K4E705sgRlPnzEb6VAQB+esZijtvlJ5xJNiwDQjFeR1fU9N4X3XLz7 X-Gm-Message-State: AOJu0YzpAXo/9UQOXtNvGYPzsqNgRc1mWVstJOA/iTayUAJWF/uzj+/5 8yGItyYGoRlDs57Y0/WCNs+MMK5ONE1ndeX3b8qbHJbEHsX/412qrkFJBkabxQ== X-Google-Smtp-Source: AGHT+IFTf9mztHoG3W0qKI9PMVLR156uygC1Rq1UbvG0b5tcufO2fDgf17EUnFOGEMDC1IYVyFm+4g== X-Received: by 2002:a05:6a00:14cb:b0:6f3:ea39:a56a with SMTP id d2e1a72fcca58-6f4e0299776mr26311621b3a.1.1715981870627; Fri, 17 May 2024 14:37:50 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:26de:b1dd:5:771c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2f8b3sm15168736b3a.211.2024.05.17.14.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:37:50 -0700 (PDT) From: Douglas Anderson To: Neil Armstrong , Jessica Zhang , Sam Ravnborg Cc: Linus Walleij , Dmitry Baryshkov , Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 8/8] drm/panel: himax-hx83102: use wrapped MIPI DCS functions Date: Fri, 17 May 2024 14:36:43 -0700 Message-ID: <20240517143643.8.If761d37b5d511867ac8207fe8220ae48d444a04f@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240517213712.3135166-1-dianders@chromium.org> References: <20240517213712.3135166-1-dianders@chromium.org> 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" Take advantage of some of the new wrapped routines introduced by commit f79d6d28d8fe ("drm/mipi-dsi: wrap more functions for streamline handling") to simplify the himax-hx83102 driver a bit more. This gets rid of some extra error prints (since the _multi functions all print errors for you) and simplifies the code a bit. One thing here that isn't just refactoring is that in a few places we now check with errors with "if (err)" instead of "if (err < 0)". All errors are expected to be negative so this is not expected to have any impact. The _multi code internally considers anything non-zero to be an error so this just makes things consistent. It can also be noted that hx83102_prepare() has a mix of things that can take advantage of _multi calls and things that can't. The cleanest seemed to be to use the multi_ctx still but consistently use the "accum_err" variable for error returns, though that's definitely a style decision with pros and cons. Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/panel/panel-himax-hx83102.c | 92 +++++++-------------- 1 file changed, 28 insertions(+), 64 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c index 1ba623e41924..6009a3fe1b8f 100644 --- a/drivers/gpu/drm/panel/panel-himax-hx83102.c +++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c @@ -285,12 +285,10 @@ static int boe_nv110wum_init(struct hx83102 *ctx) mipi_dsi_dcs_write_seq_multi(&dsi_ctx, HX83102_SETSPCCMD, 0x3f); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, HX83102_SETBANK, 0x00); hx83102_enable_extended_cmds(&dsi_ctx, false); - if (dsi_ctx.accum_err) - return dsi_ctx.accum_err; - msleep(50); + mipi_dsi_msleep(dsi_ctx, 50); - return 0; + return dsi_ctx.accum_err; }; static int ivo_t109nw41_init(struct hx83102 *ctx) @@ -392,12 +390,10 @@ static int ivo_t109nw41_init(struct hx83102 *ctx) mipi_dsi_dcs_write_seq_multi(&dsi_ctx, HX83102_SETSPCCMD, 0x3f); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, HX83102_SETBANK, 0x00); hx83102_enable_extended_cmds(&dsi_ctx, false); - if (dsi_ctx.accum_err) - return dsi_ctx.accum_err; - msleep(60); + mipi_dsi_msleep(dsi_ctx, 60); - return 0; + return dsi_ctx.accum_err; }; static const struct drm_display_mode starry_mode = { @@ -472,40 +468,20 @@ static int hx83102_enable(struct drm_panel *panel) return 0; } -static int hx83102_panel_enter_sleep_mode(struct hx83102 *ctx) -{ - struct mipi_dsi_device *dsi = ctx->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 hx83102_disable(struct drm_panel *panel) { struct hx83102 *ctx = panel_to_hx83102(panel); struct mipi_dsi_device *dsi = ctx->dsi; - struct device *dev = &dsi->dev; - int ret; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; - ret = hx83102_panel_enter_sleep_mode(ctx); - if (ret < 0) { - dev_err(dev, "failed to set panel off: %d\n", ret); - return ret; - } + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - msleep(150); + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); - return 0; + mipi_dsi_msleep(&dsi_ctx, 150); + + return dsi_ctx.accum_err; } static int hx83102_unprepare(struct drm_panel *panel) @@ -526,32 +502,30 @@ static int hx83102_prepare(struct drm_panel *panel) { struct hx83102 *ctx = panel_to_hx83102(panel); struct mipi_dsi_device *dsi = ctx->dsi; - struct device *dev = &dsi->dev; - int ret; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; gpiod_set_value(ctx->enable_gpio, 0); usleep_range(1000, 1500); - ret = regulator_enable(ctx->pp1800); - if (ret < 0) - return ret; + dsi_ctx.accum_err = regulator_enable(ctx->pp1800); + if (dsi_ctx.accum_err) + return dsi_ctx.accum_err; usleep_range(3000, 5000); - ret = regulator_enable(ctx->avdd); - if (ret < 0) + dsi_ctx.accum_err = regulator_enable(ctx->avdd); + if (dsi_ctx.accum_err) goto poweroff1v8; - ret = regulator_enable(ctx->avee); - if (ret < 0) + dsi_ctx.accum_err = regulator_enable(ctx->avee); + if (dsi_ctx.accum_err) goto poweroffavdd; usleep_range(10000, 11000); - ret = mipi_dsi_dcs_nop(ctx->dsi); - if (ret < 0) { - dev_err(dev, "Failed to send NOP: %d\n", ret); + mipi_dsi_dcs_nop_multi(&dsi_ctx); + if (dsi_ctx.accum_err) goto poweroff; - } + usleep_range(1000, 2000); gpiod_set_value(ctx->enable_gpio, 1); @@ -561,23 +535,13 @@ static int hx83102_prepare(struct drm_panel *panel) gpiod_set_value(ctx->enable_gpio, 1); usleep_range(6000, 10000); - ret = ctx->desc->init(ctx); - if (ret < 0) - goto poweroff; - - ret = mipi_dsi_dcs_exit_sleep_mode(dsi); - if (ret) { - dev_err(dev, "Failed to exit sleep mode: %d\n", ret); - goto poweroff; - } - - msleep(120); + dsi_ctx.accum_err = ctx->desc->init(ctx); - ret = mipi_dsi_dcs_set_display_on(dsi); - if (ret) { - dev_err(dev, "Failed to turn on the display: %d\n", ret); + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(dsi_ctx, 120); + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); + if (dsi_ctx.accum_err) goto poweroff; - } return 0; @@ -590,7 +554,7 @@ static int hx83102_prepare(struct drm_panel *panel) usleep_range(5000, 7000); regulator_disable(ctx->pp1800); - return ret; + return dsi_ctx.accum_err; } static int hx83102_get_modes(struct drm_panel *panel,