From patchwork Mon Oct 3 05:03:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 12997046 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 B1039C433FE for ; Mon, 3 Oct 2022 05:04:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A1A4010E205; Mon, 3 Oct 2022 05:04:03 +0000 (UTC) Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D93410E0D5 for ; Mon, 3 Oct 2022 05:03:57 +0000 (UTC) Received: by mail-pg1-x52c.google.com with SMTP id a23so1089811pgi.10 for ; Sun, 02 Oct 2022 22:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=ztuWh3+lm3Xgyvy8ErwnYqF7ln3RGH0S/A4OyK3wmIE=; b=Hz8TZprhU9xLfxIJDPiq1ixTjaUkHrGur4fPPa52CFjvLABRT995xyhJWJ8w1pt/HX HySMjpKk8DIwly7hIZgDp/G/m5E0OlvM9cErN3xt2UTEUFfpeAkJVSqgtG64B52weKIn 3sJUdQFTYCDzyfRzvyj+a7heHPSPmwzHDY4Zo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=ztuWh3+lm3Xgyvy8ErwnYqF7ln3RGH0S/A4OyK3wmIE=; b=HDI06a01y0TWKHyGBzdOKksvZa9pMh3e8YCuDEdCH2M/9GIBK90BDf5onAaBgzK1+O OGADXQbEFtdvkTXox8ZO4XUP4dJs1jwXwAeOATygRrIRucrx9bwx+wI25E0kfKW/cP49 eARL+PdK5Ao581ImcEZyIHV0gkUrGzrfsK4b+A8za7QldA/LkKO5nFsSAaUYSyM2rJWk 4Rm/qj/cey3h5U4dMul+xGCAO3z9ApPNyaO4l9HSb+hRB6DbeRMfClm6Lqd3EXig06UU MvXcVcc6g4tKjTPhFuy6OOxEuJ5AfzJdQgeAKWZR4nzDuMegdIpZwBeHuVF8612k6N6w mr6g== X-Gm-Message-State: ACrzQf2jSzuljG02u+BZKrt0VL5hv6kxxzgIXZQPLfLeWSeeEU591n4y qhZ3K3aMTkoYVBA+TkasXVhxKw== X-Google-Smtp-Source: AMsMyM7w6djAOyImUB/oWDtW7Wxj/dH2t2EMQ4LGPYCFTqC3FDUnNEPHJfsbQCiA4dt1fFO01grIFg== X-Received: by 2002:a05:6a00:14c4:b0:542:cd3a:591e with SMTP id w4-20020a056a0014c400b00542cd3a591emr20437876pfu.27.1664773436673; Sun, 02 Oct 2022 22:03:56 -0700 (PDT) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:dfa6:5a1a:b35a:db69]) by smtp.gmail.com with ESMTPSA id y8-20020a170902b48800b0017680faa1a8sm6174628plr.112.2022.10.02.22.03.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Oct 2022 22:03:55 -0700 (PDT) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter Subject: [PATCH v2 2/2] drm/bridge: it6505: Add pre_enable/post_disable callback Date: Mon, 3 Oct 2022 13:03:35 +0800 Message-Id: <20221003050335.1007931-3-treapking@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221003050335.1007931-1-treapking@chromium.org> References: <20221003050335.1007931-1-treapking@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: , Cc: Allen Chen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Pin-yen Lin , Hermes Wu , Hsin-Yi Wang , AngeloGioacchino Del Regno Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add atomic_pre_enable and atomic_post_disable callback to make sure the bridge is not powered off until atomic_post_disable is called. This prevents a power leakage when it6505 is powered off, but the upstream DRM bridge is still sending display signals. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Pin-yen Lin Reviewed-by: AngeloGioacchino Del Regno --- (no changes since v1) drivers/gpu/drm/bridge/ite-it6505.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 685d8e750b12..27de6652f842 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2992,6 +2992,28 @@ static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, } } +static void it6505_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_state) +{ + struct it6505 *it6505 = bridge_to_it6505(bridge); + struct device *dev = &it6505->client->dev; + + DRM_DEV_DEBUG_DRIVER(dev, "start"); + + pm_runtime_get_sync(dev); +} + +static void it6505_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_state) +{ + struct it6505 *it6505 = bridge_to_it6505(bridge); + struct device *dev = &it6505->client->dev; + + DRM_DEV_DEBUG_DRIVER(dev, "start"); + + pm_runtime_put_sync(dev); +} + static enum drm_connector_status it6505_bridge_detect(struct drm_bridge *bridge) { @@ -3026,6 +3048,8 @@ static const struct drm_bridge_funcs it6505_bridge_funcs = { .mode_valid = it6505_bridge_mode_valid, .atomic_enable = it6505_bridge_atomic_enable, .atomic_disable = it6505_bridge_atomic_disable, + .atomic_pre_enable = it6505_bridge_atomic_pre_enable, + .atomic_post_disable = it6505_bridge_atomic_post_disable, .detect = it6505_bridge_detect, .get_edid = it6505_bridge_get_edid, };