Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3772942rwb; Mon, 3 Oct 2022 22:11:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gUtDM1wUdgJYD67WRSuq6l3OgJs3yRmdgm0sxhW3MY+Euk+VUtmioMcNW/dny3JN/eXz3 X-Received: by 2002:a17:907:7f05:b0:781:e579:46b5 with SMTP id qf5-20020a1709077f0500b00781e57946b5mr17505653ejc.102.1664860270197; Mon, 03 Oct 2022 22:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664860270; cv=none; d=google.com; s=arc-20160816; b=jjqf6b1v+0UH6mm5zmXJknWM+QscWZNXUroQUsS1f43ANQvzjuyxTvBgK8JMleKRze z/rFrHauu5OTS2j6NKQZjejvhSdWc0rDYBCTVvjACKCvVvEH/zadGOWR7PRkBLnctYPW LYXM9/UcTqCI678RpJ7ipzMoAD/zEsScq0f0aishrjyVlLG0WhQQ4M8qVbyyDiblpKUj gDT6NQ8HZpT1wBUJaFOywu90Q1q/q9KC9oXbmI0+n0q8I6NyKg8m5JWe67t13iIQBrMW e1THrWTtkv/DuHwqTBQAEARxfwn9y41JxPAJYrKucYF5+4KBZO8IhhP6fgtJQtFJTk4E frwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6rx+SIB5qyaNNqvePOxH/VVXvkvOQPlultnrgr/9WBk=; b=ulOxeb1/YRFB8mrjC3kTNu5nO2YRZELd70X2aKDasDeBWyno8yNeZzlEw3SHtzBF0H sA6HWxyecLceykXJQYwtt6nvUDooBmhH1hzLja6h2ndN+OW5tTVCOpWn0gRN2MFRbqLD 6OTmD/Hjp7e2DPYnG99IWkw74lhB0zqW35MXfVTiLHoaawBIEkORvRl87YLCgCMp0mgn a8zOAi+vZl2Ap5mFiMRHLpXmdyKlBWNmbD9J9/XvlKHOokvHf8MZCcy5kCmyS0HGcoFp dZGF2AtSMumMekuBjoABTa6CVPTGbBCNMVN66NuRalhhoj8SN5pRFljr6Mpf88tfGlNc 8JNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gLGYEgNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a509b47000000b00451a9bc10casi8955300edj.196.2022.10.03.22.10.45; Mon, 03 Oct 2022 22:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gLGYEgNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229576AbiJDEuI (ORCPT + 99 others); Tue, 4 Oct 2022 00:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbiJDEuC (ORCPT ); Tue, 4 Oct 2022 00:50:02 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA84E033 for ; Mon, 3 Oct 2022 21:49:59 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id x6so6415344pll.11 for ; Mon, 03 Oct 2022 21:49:59 -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=6rx+SIB5qyaNNqvePOxH/VVXvkvOQPlultnrgr/9WBk=; b=gLGYEgNEm1k0Ctu79S1ja4IaXh59wOmABV1jWdHjEbgedZEQzeIDzDBbD1qAmzhWbG +pOdKXHnrAj5muXLm6SQeZeGtUbxGWqcDI+Ts7dloblRb2Y5kaWPkAIPYNXVLHPv2GIJ WUTRAIr1Xjg0hzxo7X++xRMfkVvQ31BsFnOaw= 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=6rx+SIB5qyaNNqvePOxH/VVXvkvOQPlultnrgr/9WBk=; b=Pq5YN2eedQxaqG5OPfJnk+n0XsejWOnje8pHpnVFcac5QTtmwNbDESVrdgClKofsw1 /DQQ8MEa6ZCjgfDseS4GuNMhI019yBIvIxDDCxgi5GSuenHgJD2k1aChhRIwnEZNPH0/ W1/aEiDjcSzXWviz+Dt4i4KAcJnb/qUsX7JUApYtm/HoyJWwXFOmFvkHyenYMrBBT5ix kt73kyzBTmJ++YgSTeNJodTkZ7wLMclMM6LBjtA4hh4/idZSpqFP13cxjXibTL4+mnoR 5WaRE/zWc6Tk+oOKeGk3McSPwSNP/LQZ61h+2y3ZIGigmyWHnLD2zWGXxreBurrDeYyO UcQw== X-Gm-Message-State: ACrzQf1ShmXivW0+QyQueQsXhJXVmqRLrhZvSj4xaaRSOBDAntNlpLEk BwKPLWXtt1awhCiwzQLtcZkqQQ== X-Received: by 2002:a17:902:b092:b0:17b:833e:74f7 with SMTP id p18-20020a170902b09200b0017b833e74f7mr23318315plr.149.1664858998744; Mon, 03 Oct 2022 21:49:58 -0700 (PDT) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:5713:ccf0:f1dd:69d2]) by smtp.gmail.com with ESMTPSA id gl1-20020a17090b120100b0020ab3f9c27dsm1095051pjb.55.2022.10.03.21.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 21:49:58 -0700 (PDT) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter Cc: Hsin-Yi Wang , dri-devel@lists.freedesktop.org, AngeloGioacchino Del Regno , linux-kernel@vger.kernel.org, Hermes Wu , Allen Chen , Pin-yen Lin Subject: [PATCH v3 2/2] drm/bridge: it6505: Add pre_enable/post_disable callback Date: Tue, 4 Oct 2022 12:49:43 +0800 Message-Id: <20221004044943.2407781-3-treapking@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221004044943.2407781-1-treapking@chromium.org> References: <20221004044943.2407781-1-treapking@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v3: - Collect review tag 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 050f3be9adbc..922e1f2b7a35 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2991,6 +2991,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) { @@ -3025,6 +3047,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, }; -- 2.38.0.rc1.362.ged0d419d3c-goog