Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp236875lqf; Fri, 26 Apr 2024 05:32:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXFAy4RRKsjXq2nb8eRem2sCMlouOPh8D+aZBVLb/SPV9vApTRSISFmjR6IYstY3YrMykVF7suwbDdTAhPf4KuiPqaUS7Xb6XWACVvC6g== X-Google-Smtp-Source: AGHT+IFLwkU3I8l51/1j4M2LzE+qYhqo0dZ0UTDGK7K/5CezHmWI6VD26LIoQhlwmIn+VFoBmrUP X-Received: by 2002:adf:f2c9:0:b0:345:663f:cd79 with SMTP id d9-20020adff2c9000000b00345663fcd79mr2347150wrp.14.1714134730209; Fri, 26 Apr 2024 05:32:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714134730; cv=pass; d=google.com; s=arc-20160816; b=ORkhZPJazVCpndTFAbkGPpr+DzpW5CAu31VvXOgREjb5fG9assRMwoRCfDqIX9ye// Pm6dCoM69JMLRe+p2Raga37Sa9B4aqcdMSqZF0X/GfFhCzK0Y84aa2XKjplVa1Ct1Y2J wV54cPO0CjETj4WVMVljBATbHqQyg9J8AktgPu/F9E7HKBBtNZ971X5IY26c2faT+Nl6 XRm6kuaNdIq+E+5hQxfD0vljDwEypDVrkKJXUx4pK0+5PqxM3AICtYALgTwfIBzoXZd2 vXN4n0KTTWtPaaF/csWMmRlbWqBe0TJA5SCnqU9zbs/m9DbIohO/DzVYk+xXAVjXHEyZ IX/w== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=25H8oLPo2hioXDZa3XWQH6r/1CP1DR1BEzXpdCWRmVg=; fh=FkDxYe7K23Gd7yXTxJDQyeOYjNXAjWdB4IMG0oXd7sY=; b=hIa/2m/bimmTYDVE7k1d5E1/YL0+bRO12kvd9cqNV2htxn0IuyoZ+IbUNWE/AsMVFg KZqPQniH06UhA8RuYa4sFbOVVEqehntd1WS07fGOL2HOEPaqRAbaj5cWzTvUkwQxgv4d oRHxzlzHKNVWuUsZaXg84+8nUJOM5FLNERPY1sXv3RwL3obOT7TenYyI4Z/+heo8HkcG JWzxdZ22Nf8DS7aY15i44j3kBXW5vNXts/xwGz/k8IVr76YbH1iFWVITyauJEleidny8 syg8N46gHYyB1JZvHWNdY81UWYyvrZgR9KQuTsA2vhWNWa4fjORW3UkjDe3iRE4WZclu i/sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=SwK1fSt3; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-159983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gl14-20020a170906e0ce00b00a588891e6desi3779859ejb.439.2024.04.26.05.32.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:32:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=SwK1fSt3; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-159983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6EE491F232B0 for ; Fri, 26 Apr 2024 12:23:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D91AC145B23; Fri, 26 Apr 2024 12:23:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="SwK1fSt3" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A83D41C6D for ; Fri, 26 Apr 2024 12:23:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714134198; cv=none; b=q9nJy4KLPm+fdLS5uakylfDw3sf++vfCEPjlrkTP0dXqcJGPyDUZjUItK37/VV9OHGGOA49BQ3xzNKEX/IxKzKSBqNbuXvAMZVD9Vx0GGyE0nj7aFq7Sf5O7pCh3ajk6149uzhp03u75Q4CKWeNAKvEdIgIPjt4dYsBEOoFG1Uo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714134198; c=relaxed/simple; bh=q42ZCwD8moewXvOv6K4b7tvJjnbBkSMb/0B0m28m9GA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZjVT+CA2sbVrz8BV8DJmnPcx4ri+r7trbG+B6JS0xgxOGZdLRaz/XKBq/YPoga8DnFSVuGc5ciP30EHgl1+PvmnVli03g1TKkeUvNMfpTHrvD7wTl47FE9IHGf1Kuw7Nf8vUXLI9G/6e27UB+vlzql7FXgTcXtod/Su8ZkdKE4U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=SwK1fSt3; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 85CDAC0002; Fri, 26 Apr 2024 12:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1714134194; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=25H8oLPo2hioXDZa3XWQH6r/1CP1DR1BEzXpdCWRmVg=; b=SwK1fSt3RJW3evyI512a5q9PmIwv5tsY1bymwqWDRRDtAGvPSDL2/h9KMq+9OfynodgMPU Gvb2n7wT/uglFzdrOm/Fk6g1AszGMWrQlleJ5JD1LQSp36p9CPB6DSQrIDw42uNSh/fFfa OC5jEfW5VEtOBl8CFeH606tTYdFxia6zCiICxr+9xCsNcXpNLzQ4GR986y52wBn4ssw61E jbKgI0WejgtL0EO1X5Fa9h4hhZY20Q7uNOcai3bNCEa7m3Apc4G5nGJaJ4M5JGhPVakDwr jQKYR5846+ximv+zpUlTXiCI9aU49sWMIm9lTYaLQHx4Og3cEsrgZKQTYIZ+cA== From: Luca Ceresoli To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Alexander Stein Cc: Luca Ceresoli , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] Revert "drm/bridge: ti-sn65dsi83: Fix enable error path" Date: Fri, 26 Apr 2024 14:22:59 +0200 Message-Id: <20240426122259.46808-1-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: luca.ceresoli@bootlin.com This reverts commit 8a91b29f1f50ce7742cdbe5cf11d17f128511f3f. The regulator_disable() added by the original commit solves one kind of regulator imbalance but adds another one as it allows the regulator to be disabled one more time than it is enabled in the following scenario: 1. Start video pipeline -> sn65dsi83_atomic_pre_enable -> regulator_enable 2. PLL lock fails -> regulator_disable 3. Stop video pipeline -> sn65dsi83_atomic_disable -> regulator_disable The reason is clear from the code flow, which looks like this (after removing unrelated code): static void sn65dsi83_atomic_pre_enable() { regulator_enable(ctx->vcc); if (PLL failed locking) { regulator_disable(ctx->vcc); <---- added by patch being reverted return; } } static void sn65dsi83_atomic_disable() { regulator_disable(ctx->vcc); } The use case for introducing the additional regulator_disable() was removing the module for debugging (see link below for the discussion). If the module is removed after a .atomic_pre_enable, i.e. with an active pipeline from the DRM point of view, .atomic_disable is not called and thus the regulator would not be disabled. According to the discussion however there is no actual use case for removing the module with an active pipeline, except for debugging/development. On the other hand, the occurrence of a PLL lock failure is possible due to any physical reason (e.g. a temporary hardware failure for electrical reasons) so handling it gracefully should be supported. As there is no way for .atomic[_pre]_enable to report an error to the core, the only clean way to support it is calling regulator_disabled() only in .atomic_disable, unconditionally, as it was before. Link: https://lore.kernel.org/all/15244220.uLZWGnKmhe@steina-w/ Fixes: 8a91b29f1f50 ("drm/bridge: ti-sn65dsi83: Fix enable error path") Reviewed-by: Alexander Stein Signed-off-by: Luca Ceresoli --- Many thanks to Alexander for the discussion. --- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c index 4814b7b6d1fd..57a7ed13f996 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -478,7 +478,6 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge, dev_err(ctx->dev, "failed to lock PLL, ret=%i\n", ret); /* On failure, disable PLL again and exit. */ regmap_write(ctx->regmap, REG_RC_PLL_EN, 0x00); - regulator_disable(ctx->vcc); return; } -- 2.34.1