From patchwork Fri Nov 26 00:32:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 519674 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp1643641imj; Thu, 25 Nov 2021 16:32:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3qRxNjybKuARBXxb7xhVAGAcXLOe3uOcbMzg8xPCqAYdJsnyFkwosJFj5YoA/bgqkwia+ X-Received: by 2002:a17:90a:8043:: with SMTP id e3mr11805436pjw.130.1637886754908; Thu, 25 Nov 2021 16:32:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637886754; cv=none; d=google.com; s=arc-20160816; b=v0bOIthOvUprg1+ldYZRoOORBTdTyNUHA3k7/Xv2tO4xR4kfT5eC8I8697XnrnlXIa t1ZEkASIqqiYB4DjbEcYcCw0V8IZgfQJZd91cNeqvob5vy2YS8merKgWz1dVjSrESf6M BLcmU+1ic/3loRJ+wwJQDi+SKhSuuNbt9S7oYm3f8vXlaYhkBHFq5YwPHoK/rlvvqXqS JOETJsf8M3p2OqwQ0UhusL81TLrq+TCRZ84Zo3qAhisTxwJrtLCkGPIYhrC80e4ea+Yv OkDGhJKGZ/qnHvE30rKnbOZmkxjSlZcvySwCcKWC6hpSYjxNsjYZLOY5gwzf/kv0f/yC W6Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :delivered-to; bh=O1wJ1nsI24XrxYxVwGXZg9+kPz7FeJME7p8v2K+2gfg=; b=vV2wGOaBTdN1YqkRPOTDsQVuLja7UUDNW6N9sblhnLNi65C/sFIcZa9/CNLxLijGVo Tu5BWY3rM5r8sHMd9EFAiGxpyy6yHrmvFBrnJvsMrN8LSWavl+N8hKHDj3d1rlDNeAaq c7KPequnkXWsAsCf08V6ZjN+CdF+3relRYDhlGmE8lVOzImTfNbeU6H6PeBF15e1Lmlx 1ihd0BIsRpzt9OyZn/zC9dMhc3Z/uhga2VwZH7SplQhKH/wiTRHek1+09NXgMR/qmzE2 W2HJM+lLwwVlXDhZvo+G8+SNRZUMdU3PYWRqNrhKQ1kKIEU9lOJuUa3sV3Kdba1SEfJt pHCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XHc0x7ce; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id p5si6252941plw.423.2021.11.25.16.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 16:32:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XHc0x7ce; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E13E6E19A; Fri, 26 Nov 2021 00:32:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by gabe.freedesktop.org (Postfix) with ESMTPS id B75DD6E19A for ; Fri, 26 Nov 2021 00:32:29 +0000 (UTC) Received: by mail-lf1-x12a.google.com with SMTP id bi37so19982728lfb.5 for ; Thu, 25 Nov 2021 16:32:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=O1wJ1nsI24XrxYxVwGXZg9+kPz7FeJME7p8v2K+2gfg=; b=XHc0x7ceky8JSlNWRv1dZqZ6c9SrjN3nFtQpgzZ6dXVUppQnrYuOHe3XKSvKdaC1wO mijzH3DZgFKwgtsEO4k7thYMpDoV357vO9NarJ/+cq3euJeixv2A7WEispaY2ThzEH1R HF99H03cci+3ZGfAIvMKtBlYj7axRpJXl9kn3qk+xys8HCVYVRQW43aPOJ+YjZ4viO1R DGIhT/o/AnLtJa2a2a88clApEi+ioL3m8Iwg7gNvyqIFpYnhECPe7Z7NHH1iGNtSC7SA THMK8enfz510+zOMjkB5o7wPfJe8lUIgROP+DqOi545cQJh1nh6VTwoxaWcXKVsgmBcq rrnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=O1wJ1nsI24XrxYxVwGXZg9+kPz7FeJME7p8v2K+2gfg=; b=2ILHpPAE/TD/dSnHhdVOPtSJe7Fbao0hciVfOlqpsKs+lEcWee5lYfvUA3xLHCNKox F0PaEzUwNdwSsNp7+clXhNkyvRCaIjVqZzZaAgOfHTFPNzk6KX8YWzVOSJoJswx7wYIy yHdyUKrqdkcT+2YjaU/i+0sNnLVB9CIcXfbsjNZn8xvrsZ4Uhc7g54Ez5zz2VaxHGPN3 HLyQTdx1E4OR5Tvl2Bbjt6n/31fwZvBSAVGT1Nrc788KgEdBn+M3qfmWThOoRuod3/JL YsvEB8Mh4Uv32TqoYPFIVcUy4aGteKDTDA/dZWXUX9nL/O5hWXZWH4r6VQi7mCi6Gk1I XAyA== X-Gm-Message-State: AOAM530eBO3jkBTEA9K448cmNS1YUhmvkl8XqWj65SmfPrnx5prz/Z38 c8bRDXHzpkKAMcvQkYKmkWtotA== X-Received: by 2002:a19:3844:: with SMTP id d4mr25546116lfj.64.1637886748118; Thu, 25 Nov 2021 16:32:28 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id k13sm417812lfo.300.2021.11.25.16.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 16:32:27 -0800 (PST) From: Dmitry Baryshkov To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Subject: [PATCH 1/2] drm/ bridge: tc358762: move bridge init to enable callback Date: Fri, 26 Nov 2021 03:32:26 +0300 Message-Id: <20211126003227.1031347-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.33.0 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: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" During the pre_enable time the previous bridge (e.g. DSI host) might be not initialized yet. Move the regulator enablement and bridge init to te enable callback (and consequently regulator disblement to disable). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/tc358762.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c index 7104828024fd..ebdf771a1e49 100644 --- a/drivers/gpu/drm/bridge/tc358762.c +++ b/drivers/gpu/drm/bridge/tc358762.c @@ -64,7 +64,7 @@ struct tc358762 { struct drm_connector connector; struct regulator *regulator; struct drm_bridge *panel_bridge; - bool pre_enabled; + bool enabled; int error; }; @@ -125,26 +125,26 @@ static int tc358762_init(struct tc358762 *ctx) return tc358762_clear_error(ctx); } -static void tc358762_post_disable(struct drm_bridge *bridge) +static void tc358762_disable(struct drm_bridge *bridge) { struct tc358762 *ctx = bridge_to_tc358762(bridge); int ret; /* - * The post_disable hook might be called multiple times. + * The disable hook might be called multiple times. * We want to avoid regulator imbalance below. */ - if (!ctx->pre_enabled) + if (!ctx->enabled) return; - ctx->pre_enabled = false; + ctx->enabled = false; ret = regulator_disable(ctx->regulator); if (ret < 0) dev_err(ctx->dev, "error disabling regulators (%d)\n", ret); } -static void tc358762_pre_enable(struct drm_bridge *bridge) +static void tc358762_enable(struct drm_bridge *bridge) { struct tc358762 *ctx = bridge_to_tc358762(bridge); int ret; @@ -157,7 +157,7 @@ static void tc358762_pre_enable(struct drm_bridge *bridge) if (ret < 0) dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); - ctx->pre_enabled = true; + ctx->enabled = true; } static int tc358762_attach(struct drm_bridge *bridge, @@ -170,8 +170,8 @@ static int tc358762_attach(struct drm_bridge *bridge, } static const struct drm_bridge_funcs tc358762_bridge_funcs = { - .post_disable = tc358762_post_disable, - .pre_enable = tc358762_pre_enable, + .disable = tc358762_disable, + .enable = tc358762_enable, .attach = tc358762_attach, }; @@ -218,7 +218,7 @@ static int tc358762_probe(struct mipi_dsi_device *dsi) mipi_dsi_set_drvdata(dsi, ctx); ctx->dev = dev; - ctx->pre_enabled = false; + ctx->enabled = false; /* TODO: Find out how to get dual-lane mode working */ dsi->lanes = 1;