Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1035319lqs; Wed, 6 Mar 2024 04:39:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkncYZlzxD2emV95Z5ZbJxoK7KdeokYizMV3cjBgetnurwCn5/0CYrnCrMI0pJmIhglxuIgLuDfS7vA276w15LRdoF+DrJDfZveLk4Jg== X-Google-Smtp-Source: AGHT+IE0QPX8RT3PgK3mMKipZ6vhWd4ziUNVHziEpBDFvDBxfCS8w318eZgcwBNvUf80ZcarnhHF X-Received: by 2002:a05:620a:88c:b0:787:ea8a:d048 with SMTP id b12-20020a05620a088c00b00787ea8ad048mr5115066qka.46.1709728774872; Wed, 06 Mar 2024 04:39:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709728774; cv=pass; d=google.com; s=arc-20160816; b=nt64TY8LlWFb63BdXAeADrVTqqoF56ZdoQY7rmpyO9SGIAWz4TbgtKKk39InSjS5g8 jXvQvw82Pe7y3za/IgJrPMfJ32UUxz11AveDTDC1Jvt2+mmWoESmr8e/9CXx9h9rBHsF yW3Hq5Ym+cmsmD7dJjuw9Jv0/eeddNjb8F8XmLmOyr262na8T+KpAjBaUtGI5n6QnFmK c/8FZTUH4oyC7OvvTD94J7y6c9KO6hWBkCaO+LoitGq56qFh6RYlffL/xLiOA0PKVD7C Q+/1RfcpCTdNM71yu1ZLZvEzoE3REJLo0RHa4WV9hip8SH4GfKsHd2mXtTs6VvuMFeCO 81GQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=elkd8DsFZS5LmKpv07wv9/YlAnCVft4QUXCwGUZen9k=; fh=pHDSOqrds2HISpicr7UpTSxdp7l5H+IgOBhjH6RmFBk=; b=Sa1xcfC+5uYz46IzqsXXGu0k4am0O8q5bgnfgLa6eSuaaoJpTYhLnj83UZWJ163T62 BogkROSMC35qCHjW9UggkV5Q/2PAjeW7yl8b+luMCKJOjB/UFsS6/7gvDNlXGdasxQKF 11uwF/KTqW7IuqvgXZEI+H3iZyUc4wpBPqCXyezlyXR6rRozkqkWzmDGTUy2svQQrnhf A1NDzvG+lJoRWm6tX/tnPp1sfo4Sn2yOO9iDrV5a7Q+Hm2LkIkx0aHei1hxhpWWV3tjd CnBKpRUbtJVsmqT6dfzDk2LJGP1o3OmBGrRSzia47NokbB3TzQh6+RQ8osHYY0OApPCH soqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WcGASoc1; 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-93907-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93907-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u17-20020a05620a121100b0078822165dc3si8149484qkj.774.2024.03.06.04.39.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 04:39:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93907-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=@bootlin.com header.s=gm1 header.b=WcGASoc1; 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-93907-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93907-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6F09B1C22970 for ; Wed, 6 Mar 2024 12:39:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 270D91272B9; Wed, 6 Mar 2024 12:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="WcGASoc1" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (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 3D3FB1E519 for ; Wed, 6 Mar 2024 12:39:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709728768; cv=none; b=uzMlHPw8MSwSC5RiI9L0YzJQY9OwBtgpLrJf3eA36NLTG7ht49nnBoEpGVb/sF6bIME+2hVsp/e/kPibus14mQKgVY+Z9VGXt4DJBVDJN+3Zpxwynb/p2DyB4meol3IKkuOiEqygOj2gCoIbsEEEuiWl1vbapm2FnMgTslFRLBM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709728768; c=relaxed/simple; bh=DyNIMG5zL0ui6GMf73JDrA/3Viho9HpORxGOnZWybHY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=B1Qc9duhgHR+V0q/+Bv/QXvS2rJiw/BlzTf48SXWOS3hN2TlRFv1xkkfEP+25iz5gZrCQwz5oFNUcH20t4bmJDnDfMQ6jZwzk+oHdeGSRvI7V/crwYwe9b3AbGP6WuZk4/gAgfjP4e3cWHT+Y2xzd5RL8miLwU7RR+bMZnHld7o= 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=WcGASoc1; arc=none smtp.client-ip=217.70.183.194 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 4E34940008; Wed, 6 Mar 2024 12:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709728764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=elkd8DsFZS5LmKpv07wv9/YlAnCVft4QUXCwGUZen9k=; b=WcGASoc1KG0VbPwmMfiT95+0rpCtDVoXHW6AJ82VN7BMBrhC0n0M0ft/A5ZE91It8UhKsr 4PEuag7MjK0qJjoCnqoUEcGAL8eF0axOME4/bJe2SaiTDeM/tnPn+jlow/uN37ta/sNlkz MsCKorGBGR/SrP8+FZm5Y386BgqIQn9G44GIPw6O9OxPMjBcPHashdFxBOJWN/ohM06hrl 4iwT+Q//4XCfbzPAvkGllT6wcFxkiB1d7dxy2MlXIuER/KnArACdYph/Ac787FvLyqRy9Y YZ9Rg5C5piEiVvjvIsoit5FmWw7TsvEasEvOHVmmd4OOHoNVQyUhROBxEiqE4g== From: Luca Ceresoli Date: Wed, 06 Mar 2024 13:39:20 +0100 Subject: [PATCH] Revert "drm/bridge: ti-sn65dsi83: Fix enable error path" 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: 7bit Message-Id: <20240306-ti-sn65dsi83-regulator-imbalance-v1-1-a3cea5f3e5b3@bootlin.com> X-B4-Tracking: v=1; b=H4sIAPdj6GUC/x3NwQqDMAyA4VeRnBdI202HrzI8dG3UgKuSuDEQ3 31lx+/y/wcYq7BB3xyg/BGTtVS4SwNpjmVilFwNnvyVArW4C1ppb9nkHlB5ei9xXxXl9YxLLIn REXvXjTmQT1Azm/Io3//iMZznDzvwTRRyAAAA 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: Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.13.0 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") 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 e3501608aef9..12fb22d4cd23 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -499,7 +499,6 @@ printk(KERN_ERR "%s: LVDS in fallback (24/SPWG)\n", __func__); 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; } --- base-commit: a71e4adac20bfe852d269addfef340923ce23a4c change-id: 20240306-ti-sn65dsi83-regulator-imbalance-10e217fd302c Best regards, -- Luca Ceresoli