Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp96840lqh; Fri, 3 May 2024 14:45:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUlflXIm+D2DsiQnQEpAuR6xVy7P+91fGvRf5me9nlo5GKflWOoG7yCB0DEtEfi9yzr/lZ57ZThCdliOBokibuWoItI3jdq/omTWhgqLA== X-Google-Smtp-Source: AGHT+IF3nz0HmcJGoPnuFQSvkpd6Bn9TgDrazmnzLtfWAIP77ecm8qaO7GznyMPYMMUn+L32zcfs X-Received: by 2002:ad4:5962:0:b0:6a0:b905:95ca with SMTP id eq2-20020ad45962000000b006a0b90595camr4009409qvb.44.1714772754269; Fri, 03 May 2024 14:45:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714772754; cv=pass; d=google.com; s=arc-20160816; b=ER9F+ClAxH/k7OgOl5zv1Zqs7WmEmKbnerxMvbi/eoTpg26zMpzFGfP6bjpH/jyAa3 s3e8WoC06rKGbJKtYv+EIHIptJAm7UrBvuTzCHVM9cgpB44Xy0QL6tJprwEGQOLtb7oo 3NCIR2d9WzyK4sjB3MMGsEQd0mgLarSXUTLMBNuRU1absKelLLxehLAEQowot9m0oya8 pd73/auz70KDmvRf5IWbINTePNpxuVz4RuxOrFYjZd7+7tgTS3uUbHgxIXyXWZ3nuzX4 qhlSzoecBY21J+uTDMuY6Efic/1IWG709mlj5inMX3HAzCz/0TYjSiVczrhhALYh9TvW O3yA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LOvFNgXxe6qEzRRoKPzkEzJ39gwB1A9FbXbUkRknuEw=; fh=Cvf5n+y4y/K9YPWc8oLsNgXKZ5xz3czxBGjxs+s2uiQ=; b=vekKsBJkRX1h50gBkfFxm3Qwkw49SC20Qq1t2wgEbb3V9X+1lC53QrsjMW+3rzc6uU QiiFSdNUkdQ7FyEDH5TDAFRIV4AKEckrhpIzWPaKQkm/P9e1KvzyFZtvA4psezClPKJK 5wHh7yuSM+LrHQhLbniyzc0kFDvr0ef8d+Ww5otoxGW01+RjwANeyzLKPUX/B9lUM/+e j6OhL8eKM7SyeVB00dY00ezKbYT3UPk4XYZTZv0W/XnI2mriYru4yC2gh48R7fu1P2Nl ugWLfLGTTn9nvi10IyDpram4JXQbEZTQvwe1HI+FdOGEb0yR4mk0mLxO7IJW5M8ItkH8 +eTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Wt7wtQzG; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-168307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l4-20020a05620a28c400b0078ef418ec3fsi4642371qkp.229.2024.05.03.14.45.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:45:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Wt7wtQzG; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-168307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C4F1D1C21276 for ; Fri, 3 May 2024 21:45:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C957136E2B; Fri, 3 May 2024 21:38:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Wt7wtQzG" Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEB56136E11 for ; Fri, 3 May 2024 21:38:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714772283; cv=none; b=CKHCKyuSMgjl/Zbn5Uf2NgFiFiyz7NqORTJ4MTENfQftfSqGIWvWUqreWu4i3YJAhTbVh/jQnzHPq1rdUNbm/02Y5/rxfGJzCxAME+Ujua0qGSAO8FCQjHXFVU1d3dR1AxCY1Iu7BKK1HXe3CT9yt7ln4Woi75c919yUMrCTaV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714772283; c=relaxed/simple; bh=p2r3mEXPVq4U9AmL2VfNexuyR3rhW1JY39L1T4gDQwA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JldSM3EVCSRtJX3Ut1nArGpskvefMPpvQJLttlSVueXzYvRM34EeWeuF92EQikhFJ7iVWiI4dfSgXrjiB66J3H877MdZhLDjr/jrDumL34KRUQbA99oRL1OT5BgdJSe30zaWWtynD5AuONCBcnIt7nfpMyU8rJrJXXRXRKMaODY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Wt7wtQzG; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1ec69e3dbe5so1229475ad.0 for ; Fri, 03 May 2024 14:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772281; x=1715377081; darn=vger.kernel.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=LOvFNgXxe6qEzRRoKPzkEzJ39gwB1A9FbXbUkRknuEw=; b=Wt7wtQzGDvK67/PxUMmf/aMBIQ7IgpIhA6djyCoAobXGV+Ak9nDiFRq0AjmDEeLmdC jpPe5BbLVFohJsmQbk7onue2NepTLTUrRbYi7e/N3BDxum7Fp4ZkNmmkp/4SooYaaOKB o55k3e978ZlgYwovqEitAzWuRiUeCUEFlGxdY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772281; x=1715377081; 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=LOvFNgXxe6qEzRRoKPzkEzJ39gwB1A9FbXbUkRknuEw=; b=XmCpqOdItBdwxt72BIjUS0yU25e00vfJ18kZsIBeuOW+VkuHSyWK8KdCvFE6PtNLuD ErBbbxf0UaafKCIZ+ZTYs+f3DelYWbYZge83Ds8vYJmA7HCPim+ImvQVOUr++Vzz6adN R7rEXZ+Vpdv/JXo112tCVPC6f/hWc2ktccCjcJ8YKDCU8vclaqZzGTL4DD8FFEP4Jqph jdWMEYGlYXw5HSP9BHFIyVUOWUXhf9SMQwZGDs6tScDBDyitScvvvkSmZJ1IMPzL334y DPogMTkxDK1nag8wJ8FwmCWfAmEjlYAmWt97S65WWjOFhaNO+Rtin9BUScyL+8jIkvPk P9mQ== X-Forwarded-Encrypted: i=1; AJvYcCVKWD2ZvJiXI/B0Znf0Z37q92EGflRlysUcQyLjfkKtic6dECxfIgLEHMFTJZuZZVjbmhljOTxQF6zrsdCMtuYUsPau3XlJ5wz4zw0y X-Gm-Message-State: AOJu0YyTk2eL6GSoCxQVDvq9DtZu+aZuJK4Jr4qHsagC4kbKqlEKfBkH CH+ca/YKcZKNRpIwb2CJVFBKCXGNErxTtp60/A9t/hixTMySBhU8wuZr8FwvRA== X-Received: by 2002:a17:902:f70b:b0:1ec:ad62:fe87 with SMTP id h11-20020a170902f70b00b001ecad62fe87mr4441606plo.56.1714772281144; Fri, 03 May 2024 14:38:01 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:38:00 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?UTF-8?q?Guido=20G=C3=BCnther?= , =?UTF-8?q?Ond=C5=99ej=20Jirman?= , Frank Oltmanns , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Purism Kernel Team , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 42/48] drm/panel: sitronix-st7703: Stop tracking prepared Date: Fri, 3 May 2024 14:33:23 -0700 Message-ID: <20240503143327.RFT.v2.42.Ifc436b262d72f1a33ddef10adfd7578d4acb60d8@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. One thing to note for st7703 is that it has a special "allpixelson" debugfs file. When this file is written the driver hacks a disable/unprepare and then a prepare/enable to try to reset the panel. Potentially that might have been relying on the old booleans we removed. It'll still "work" because of the checks in the core but it deserves a comment. This debugfs file didn't appear to be particularly safe to use even before this patch since it would cause a disabled/unprepared panel to become prepared/enabled. Cc: "Guido Günther" Cc: "Ondřej Jirman" Cc: Chris Morgan Cc: Frank Oltmanns Signed-off-by: Douglas Anderson --- Changes in v2: - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-sitronix-st7703.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index 7d8302cca091..6b2d940640ca 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -58,7 +58,6 @@ struct st7703 { struct gpio_desc *reset_gpio; struct regulator *vcc; struct regulator *iovcc; - bool prepared; struct dentry *debugfs; const struct st7703_panel_desc *desc; @@ -752,13 +751,9 @@ static int st7703_unprepare(struct drm_panel *panel) { struct st7703 *ctx = panel_to_st7703(panel); - if (!ctx->prepared) - return 0; - gpiod_set_value_cansleep(ctx->reset_gpio, 1); regulator_disable(ctx->iovcc); regulator_disable(ctx->vcc); - ctx->prepared = false; return 0; } @@ -768,9 +763,6 @@ static int st7703_prepare(struct drm_panel *panel) struct st7703 *ctx = panel_to_st7703(panel); int ret; - if (ctx->prepared) - return 0; - dev_dbg(ctx->dev, "Resetting the panel\n"); gpiod_set_value_cansleep(ctx->reset_gpio, 1); @@ -793,8 +785,6 @@ static int st7703_prepare(struct drm_panel *panel) gpiod_set_value_cansleep(ctx->reset_gpio, 0); usleep_range(15000, 20000); - ctx->prepared = true; - return 0; } @@ -854,7 +844,13 @@ static int allpixelson_set(void *data, u64 val) dev_dbg(ctx->dev, "Setting all pixels on\n"); mipi_dsi_generic_write_seq(dsi, ST7703_CMD_ALL_PIXEL_ON); msleep(val * 1000); - /* Reset the panel to get video back */ + + /* + * Reset the panel to get video back. NOTE: This isn't a + * particularly safe thing to do in general because it assumes + * that the screen was on to begin with, but this is just a + * debugfs file so it's not a huge deal. + */ drm_panel_disable(&ctx->panel); drm_panel_unprepare(&ctx->panel); drm_panel_prepare(&ctx->panel); -- 2.45.0.rc1.225.g2a3ae87e7f-goog