From patchwork Tue Mar 30 02:53:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171525 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3D98C433C1 for ; Tue, 30 Mar 2021 02:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EA756192B for ; Tue, 30 Mar 2021 02:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbhC3CyR (ORCPT ); Mon, 29 Mar 2021 22:54:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230506AbhC3CyD (ORCPT ); Mon, 29 Mar 2021 22:54:03 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA959C061762 for ; Mon, 29 Mar 2021 19:54:02 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id h25so10697009pgm.3 for ; Mon, 29 Mar 2021 19:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qI/3Hs2aK5j95IIJ6CXgbrMKhpGuwzEJEjubXc02oD4=; b=XVP5azCVkEZItoAwFhpabdgCE8YXvf2qCEpXn6Xgov2pwKSL15Y4UHoC05ptJsLGKx kEtelr+AEbMj7ivpuDloxY5vjyCH7q7CXiqDGjOvSdJnxhx1w41xPHavLLmnWDgXtNJB xf7gMchT4RbZOOtz0mslmlsxDTRC1wWZZ1otA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qI/3Hs2aK5j95IIJ6CXgbrMKhpGuwzEJEjubXc02oD4=; b=CkKnHpDWzVoEpM7T1TSKBbk8zYWyMNvQKNsxYvaysMq1stpndvR990BWiLIGUHMnGa edmWmVOIdjb35v4elRwaxy7EDo9ttzPJOBpnK63JwZufto6W4Hz6MicKkcJDjeuHr8co +aiMpJ7lF3O2wgtqSPs0yH1+oaOn+z7rUy+6ClNOGZFCETQffX+62cJ4bXMTCHkJHc0R knMvYUvhXroR2SJbFmkA7TMI8lCMtHHPM+nQESQ21qdhdgkmyC4EU6YV0mk9zr/Dq5rg rDaQ7/XHyHj16NR+2zqXrxMeSQ700uj7+e+E9crQUVnOugxa96fhgSWASaZbtvEV8bOC gikw== X-Gm-Message-State: AOAM5306qGEdk37pBpM6Tqj60PjW413bcu9fy2uH41rT9ScmDIBS0TIM qh+uYa7A09fcHcszZSsFIUW3Qg== X-Google-Smtp-Source: ABdhPJyZiJrPuAbzqL8NKVXxk3Sum/s/UcvHx89hqsPS7SaR6LwBWLGagqLg79BtkIOOhi/X2lPw2Q== X-Received: by 2002:a65:56cc:: with SMTP id w12mr26587564pgs.354.1617072842326; Mon, 29 Mar 2021 19:54:02 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:02 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Boris Brezillon , Daniel Vetter , David Airlie , Laurent Pinchart , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/14] drm/bridge: Fix the stop condition of drm_bridge_chain_pre_enable() Date: Mon, 29 Mar 2021 19:53:32 -0700 Message-Id: <20210329195255.v2.1.If62a003f76a2bc4ccc6c53565becc05d2aad4430@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The drm_bridge_chain_pre_enable() is not the proper opposite of drm_bridge_chain_post_disable(). It continues along the chain to _before_ the starting bridge. Let's fix that. Fixes: 05193dc38197 ("drm/bridge: Make the bridge chain a double-linked list") Signed-off-by: Douglas Anderson Reviewed-by: Andrzej Hajda --- (no changes since v1) drivers/gpu/drm/drm_bridge.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 64f0effb52ac..044acd07c153 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -522,6 +522,9 @@ void drm_bridge_chain_pre_enable(struct drm_bridge *bridge) list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { if (iter->funcs->pre_enable) iter->funcs->pre_enable(iter); + + if (iter == bridge) + break; } } EXPORT_SYMBOL(drm_bridge_chain_pre_enable); From patchwork Tue Mar 30 02:53:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 212D5C433E1 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0794E6192C for ; Tue, 30 Mar 2021 02:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230506AbhC3CyS (ORCPT ); Mon, 29 Mar 2021 22:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230523AbhC3CyF (ORCPT ); Mon, 29 Mar 2021 22:54:05 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5122C061762 for ; Mon, 29 Mar 2021 19:54:04 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id w10so6349045pgh.5 for ; Mon, 29 Mar 2021 19:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v0a82Fvj95xpPBe4qqrq7QwDbwlHgP+SSdPbPFDe0q8=; b=CVcj4Vw20yH89xN07Z6BhprfbML7ZL5HUvCtvJwTUB3wWjw/+M0p1pBa875Ap1fZJx 4kAqftRj9MPjSe8yPMhTJmaW5VZDybBxwSyhywGaMBO9hvyfusHZglZF9EPF+I8Vy6uH mX5aECtiRVrVMN7I6lTJ1fj9R9af5yBJaMo60= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v0a82Fvj95xpPBe4qqrq7QwDbwlHgP+SSdPbPFDe0q8=; b=IkQlv/MjX+wQDACof8op21F9ECwm9VAlh43IxeM1Mr9TrRrGzNJW8xqvfIJ9jIU+dJ nooy0mvoK8ndMVYyngqST4AG4YXBqpJuEl+CnyNi/2Bn7MkEJtxPzdxePdwvFwzJCoM7 cGGHNYGslq3hKXvmReZbr+FOorx8ch9NXjIZirYtJw6dZYui3lXWx31FVS5FaMsLSfU+ sVhwdxDs0vuXu+3ToFVl7J6idSA5KU0WVukd7UmG/OwV1sjSMHHHiu44etzmjkheNElP t3spmC1s/tqp2BLV/eINJm+7HCwd8esia3ud9eBb0QEW9C3wjeb1KG1sVi2CBVvp2ONZ Purg== X-Gm-Message-State: AOAM532mY+nnxXvYEEGAMD8cowB1YtGV+qfK9534yEBJdR3VAm56WCyO 6KBu7zgNdg2MhTXw74WN25+X5Q== X-Google-Smtp-Source: ABdhPJzYHHI11ASL6+sqBEqRntEX4mX3gGBjkpvTlBS2HCIxzcLVie16h9UEbsEDFRdBJqvUhgWQ7w== X-Received: by 2002:a65:4986:: with SMTP id r6mr1027046pgs.392.1617072844237; Mon, 29 Mar 2021 19:54:04 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:03 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Robert Foss , Laurent Pinchart , Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 02/14] drm/bridge: ti-sn65dsi86: Simplify refclk handling Date: Mon, 29 Mar 2021 19:53:33 -0700 Message-Id: <20210329195255.v2.2.Ic9c04f960190faad5290738b2a35d73661862735@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The clock framework makes it simple to deal with an optional clock. You can call clk_get_optional() and if the clock isn't specified it'll just return NULL without complaint. It's valid to pass NULL to enable/disable/prepare/unprepare. Let's make use of this to simplify things a tiny bit. Signed-off-by: Douglas Anderson Reviewed-by: Robert Foss Reviewed-by: Bjorn Andersson Reviewed-by: Stephen Boyd Reviewed-by: Laurent Pinchart Reviewed-by: Andrzej Hajda --- Changes in v2: - Removed 2nd paragraph in commit message. drivers/gpu/drm/bridge/ti-sn65dsi86.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 88df4dd0f39d..96fe8f2c0ea9 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -1275,14 +1275,9 @@ static int ti_sn_bridge_probe(struct i2c_client *client, return ret; } - pdata->refclk = devm_clk_get(pdata->dev, "refclk"); - if (IS_ERR(pdata->refclk)) { - ret = PTR_ERR(pdata->refclk); - if (ret == -EPROBE_DEFER) - return ret; - DRM_DEBUG_KMS("refclk not found\n"); - pdata->refclk = NULL; - } + pdata->refclk = devm_clk_get_optional(pdata->dev, "refclk"); + if (IS_ERR(pdata->refclk)) + return PTR_ERR(pdata->refclk); ret = ti_sn_bridge_parse_dsi_host(pdata); if (ret) From patchwork Tue Mar 30 02:53:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29626C433C1 for ; Tue, 30 Mar 2021 02:54:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF30B6192C for ; Tue, 30 Mar 2021 02:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbhC3CyS (ORCPT ); Mon, 29 Mar 2021 22:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231134AbhC3CyG (ORCPT ); Mon, 29 Mar 2021 22:54:06 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FDA6C061762 for ; Mon, 29 Mar 2021 19:54:06 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d8so5394697plh.11 for ; Mon, 29 Mar 2021 19:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TcXAfPKa+Tcs9m08emwoREb3+u87BPiPwkXmewbCSKM=; b=PYRlolbxkd9TiHB1PoLA1tTvNQtWjiMSVuapm4tc4c/3Cw3kU22e41yyfvS7GrhTeD pvSMf0sZb4cNX6SBnm2+0kzt5ZlJkW6VC/BpP+KWxQ1+INxTNVYlTGtpdONMwEHHEWsw 3G06wk9pwKuuWCSWQWggeX+7vLwVHzxXeLkGU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TcXAfPKa+Tcs9m08emwoREb3+u87BPiPwkXmewbCSKM=; b=rW1d96zC3ILnVbnHz9Gb5em50EcfXyGlnEuW86W6kcjshUsfao/7cnYJfvJlhBAH6J R1WcLBIRW+bmdpRls1iFmwP4VmgbqykmQWzAvn2n1Kx/nGcXoYKkf874Im8LyVHufExN ipCRmT3sK/mLyTywHs3csJMcS9wSDX1ZoUtL8T4czsJID1w+u+7i9F9Wj1vn5xHm/NQj RqioHFvcNQ/U5vMRmleE0E7CJ61+jj95U8nCkIYimTzxf4kEC9N7Gl6ispdsHsXr+y/g HI5mIBnIDz/uQ+X2UW/Nah7AYP0YGnF7nxfZwK6h+48PoeDy3XvzPzEeGykIMuFuAI3p PTHw== X-Gm-Message-State: AOAM5304RzN8vvt82i/ugXAkn+1gSi8tTLaNgxI6ndlXO1Qbr0U4Osh9 l76MGMMgIiEiLb+ksq4lsJ9usQ== X-Google-Smtp-Source: ABdhPJw7wjhR3bYBB6XuXoFKaK/PAbcUoH2xgh0Za5Qj0NYFEPc9Uc9V94+9eeGBo8/VwNei/h7VmA== X-Received: by 2002:a17:90a:a88d:: with SMTP id h13mr2030265pjq.61.1617072845929; Mon, 29 Mar 2021 19:54:05 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:05 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 03/14] drm/bridge: ti-sn65dsi86: Remove incorrectly tagged kerneldoc comment Date: Mon, 29 Mar 2021 19:53:34 -0700 Message-Id: <20210329195255.v2.3.I167766eeaf4c4646a3934c4dd5332decbab6bd68@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org A random comment inside a function had "/**" in front of it. That doesn't make sense. Remove. Signed-off-by: Douglas Anderson Reviewed-by: Andrzej Hajda --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 96fe8f2c0ea9..76f43af6735d 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -788,7 +788,7 @@ static void ti_sn_bridge_enable(struct drm_bridge *bridge) /* set dsi clk frequency value */ ti_sn_bridge_set_dsi_rate(pdata); - /** + /* * The SN65DSI86 only supports ASSR Display Authentication method and * this method is enabled by default. An eDP panel must support this * authentication method. We need to enable this method in the eDP panel From patchwork Tue Mar 30 02:53:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07EBAC433E2 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF3316192B for ; Tue, 30 Mar 2021 02:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbhC3CyT (ORCPT ); Mon, 29 Mar 2021 22:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbhC3CyI (ORCPT ); Mon, 29 Mar 2021 22:54:08 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F017C061762 for ; Mon, 29 Mar 2021 19:54:08 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id x26so11207560pfn.0 for ; Mon, 29 Mar 2021 19:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OPXUOmfQRekvQeQvsP70z1DtiDzMfmRzBeh0Ag8UFxM=; b=OaZPcHG+xa8TmTWZTA0Hwp0y/rk+j9Ba1UMowY1egymnOB4p+aNxLcC2BSvqDs9q5q 4alN2gzkfnk3Pm8vKeca7tvK6mDFvMGmm43+hA3Wj3N4MWwTz4FQMcOux+jyfjfXcW7v cVWAmDIe8H4TDNqiSVKQWU3ft/UkzrUp2AksE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OPXUOmfQRekvQeQvsP70z1DtiDzMfmRzBeh0Ag8UFxM=; b=piO7yXf/ggAVNTtNxhkRiSkmCyUlVt4aVpTxE5n7nbGEKFNwPvQAOXzxH1/TPVlhWC 4d/Lj9Kmo3DipKtJjjKwpb2kfvfxGVba72dVNwIppA8bwHLfnYSwTqEsQGNL34YszdSA 2ZZNkD1CNW3uEftu1ypZ+C02CZdDLje5afSDNGvQjFR2GIlSXHCvxfbqNTskTadBPbV4 jPKpHeW18mg6aRIUcoHYECeFy2Gwiuk6oKkxc+Tr68VcUU2zfKO8hxy7c2nBiZ86Ytzq sFpCtkOAUWUDZkufe3QGc81TUwy8QUB68qp22HOeU9pkKpq+mBp2mYaiTuN8bQdxHRtA 6ubw== X-Gm-Message-State: AOAM533wk4spB3fe693AxGZToxPDJYDvUxJbt/hlqewjzlcT9rKVhsWy bHmgcrfSPNNQp+OsdY6HGBL7Gg== X-Google-Smtp-Source: ABdhPJzNB5xuvOvavd2lC2JLfMQFcwfveLVKJQBZBZzHvrCJVMqsfbDPgPl2Nyg9excKNq+Ek1sJvw== X-Received: by 2002:a63:2265:: with SMTP id t37mr14590832pgm.452.1617072847654; Mon, 29 Mar 2021 19:54:07 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:07 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/14] drm/bridge: ti-sn65dsi86: Reorder remove() Date: Mon, 29 Mar 2021 19:53:35 -0700 Message-Id: <20210329195255.v2.4.Ifcf1deaa372eba7eeb4f8eb516c5d15b77a657a9@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Let's make the remove() function strictly the reverse of the probe() function so it's easier to reason about. NOTES: - The MIPI calls probably belong in detach() but will be moved in a separate patch. - The cached EDID freeing isn't actually part of probe but needs to be in remove to avoid orphaning memory until better handling of the EDID happens. This patch was created by code inspection and should move us closer to a proper remove. Signed-off-by: Douglas Anderson Reviewed-by: Andrzej Hajda --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 76f43af6735d..c006678c9921 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -1315,20 +1315,21 @@ static int ti_sn_bridge_remove(struct i2c_client *client) if (!pdata) return -EINVAL; - kfree(pdata->edid); - ti_sn_debugfs_remove(pdata); - - of_node_put(pdata->host_node); - - pm_runtime_disable(pdata->dev); - if (pdata->dsi) { mipi_dsi_detach(pdata->dsi); mipi_dsi_device_unregister(pdata->dsi); } + kfree(pdata->edid); + + ti_sn_debugfs_remove(pdata); + drm_bridge_remove(&pdata->bridge); + pm_runtime_disable(pdata->dev); + + of_node_put(pdata->host_node); + return 0; } From patchwork Tue Mar 30 02:53:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7893AC433E5 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 607E5619C1 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231144AbhC3CyT (ORCPT ); Mon, 29 Mar 2021 22:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbhC3CyK (ORCPT ); Mon, 29 Mar 2021 22:54:10 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B37BAC061764 for ; Mon, 29 Mar 2021 19:54:09 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id ha17so6994485pjb.2 for ; Mon, 29 Mar 2021 19:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I36IxPptwcREtpot0iJCH+3WfYFhSmpYp5deLinpPgg=; b=kPzNiByEkfsePsfPtj6S5YnMKlXu7wXISif9REAqYuFnbIttV4HEzv66lzECdNerwv 7caDpqP6eV3Ii4qxlTPIHhsdUFLm2GnOWAFy+MOBzjGH9Nz8Z0o0lMCvIAbizAOKHaOR PbfqnEFWer573aC3LXsoSyid2BQ7sYqn9l95U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I36IxPptwcREtpot0iJCH+3WfYFhSmpYp5deLinpPgg=; b=rPOs5aICGeG9W6Kz/2pNLRQ+ALbptBc/B4EQVXGqGbWLdLygD1mR7J85QKT/K2PCfz y5WvKkN33EsXhoEUv9wvi9XQtn5tTv9oA40/LUTmLRyIAZU+vWk/ZrH/2sQ0EYzX1Z2a 2WaGG+kduGBMH936SVHVa9/HjFtt+zUmmGNkHG2W6cWCUjpxdsZGxuHCUYpVUPnKl8C3 MxgH8ADygThTpH1E7b/2dOYEVFAa/wF49l52uc6KLz/9j/CC1Wot+QrtZUabmDJOZApL mGtsuf0kbpHEve/FClYgj9ddP+tZiML8jmfEuaGxGTSl+KzTdB2XQi4lY0jKwqGdPn2R pzFw== X-Gm-Message-State: AOAM532/nPZvarwFlrICMcLph+ICf26QvLBjkcbfSd5kF/+MF7OeMYUX 6wspYvYEq/Pz6AfoIrjjZEiCuw== X-Google-Smtp-Source: ABdhPJzao4hv+1lRc1IJmNX9LkjQKMN0rQjB/u4FznRywuq7j6sWJCoD2wfDN9s9896IQSi9E/Bnug== X-Received: by 2002:a17:90a:c20a:: with SMTP id e10mr2008412pjt.221.1617072849314; Mon, 29 Mar 2021 19:54:09 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:09 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/14] drm/bridge: ti-sn65dsi86: Move MIPI detach() / unregister() to detach() Date: Mon, 29 Mar 2021 19:53:36 -0700 Message-Id: <20210329195255.v2.5.I1a9275ffbde1d33ad7a3af819f5fbc0941b7ee02@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The register() / attach() for MIPI happen in the bridge's attach(). That means that the inverse belongs in the bridge's detach(). Signed-off-by: Douglas Anderson --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index c006678c9921..e8e523b3a16b 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -437,7 +437,15 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, static void ti_sn_bridge_detach(struct drm_bridge *bridge) { - drm_dp_aux_unregister(&bridge_to_ti_sn_bridge(bridge)->aux); + struct ti_sn_bridge *pdata = bridge_to_ti_sn_bridge(bridge); + + + if (pdata->dsi) { + mipi_dsi_detach(pdata->dsi); + mipi_dsi_device_unregister(pdata->dsi); + } + + drm_dp_aux_unregister(&pdata->aux); } static void ti_sn_bridge_disable(struct drm_bridge *bridge) @@ -1315,11 +1323,6 @@ static int ti_sn_bridge_remove(struct i2c_client *client) if (!pdata) return -EINVAL; - if (pdata->dsi) { - mipi_dsi_detach(pdata->dsi); - mipi_dsi_device_unregister(pdata->dsi); - } - kfree(pdata->edid); ti_sn_debugfs_remove(pdata); From patchwork Tue Mar 30 02:53:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68342C433E6 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 519B5619C0 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231213AbhC3CyT (ORCPT ); Mon, 29 Mar 2021 22:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbhC3CyL (ORCPT ); Mon, 29 Mar 2021 22:54:11 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CEAEC061764 for ; Mon, 29 Mar 2021 19:54:11 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id x21-20020a17090a5315b029012c4a622e4aso6168906pjh.2 for ; Mon, 29 Mar 2021 19:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QPcvkA/+dPL4qhz8ZVLSjs9HCv03yetPJyqdMPURwCo=; b=B6I0RdTPrj/Kd0yWPFWFp7fM6GGADE1pQB4GI4+cT4PpmL1jrqfnU23r9DZsNA9cCC 8B1Ncdn4LITdp9OXNRxjzZloCU/Tn+MJYiz+ZIXz2YvablWJWfTCgytCaBnoaU4z2oMG kydPHSSVE+8fV1KAWnE3ApTeoCFWh5pu82DL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QPcvkA/+dPL4qhz8ZVLSjs9HCv03yetPJyqdMPURwCo=; b=IRPTRCRk6huFb+ejyei+4ImT+XCD3V+g6kZa5eNYF7CKeCluqZWzadYdACgpPEKf7t XQQsmPCB7b6Hjtje4ju/ZqJ8/aIj7Ofeza/8fybmiNN6eR2b4TFOsUQKq7iYpUUSzo71 VRIqwZ+UPknijrmM9O2+LME5FluuCbDvQNzNYathBZZ4H3QmyJymHzolhf2dCqCzBoz3 JTxxwCQMmvV8LYwcdA7m2NoiimnW8zfh+BGAkoqIsKgnnKBJ+lCaqg90lVjxREi4rZ2A AISoIXQ2mD5YTkqk4ntqpXQTbnUkbc+K3JdUwJ+Qu4TxMo9sRf1SBAMfiU/jSqlWz2RV PDxw== X-Gm-Message-State: AOAM531j5BshZ8rqkcyFA0pofwlcpWdt/ME4FosAF2db7urDpvPF5Hrk 2FEQuarpoUXyMfzRpyN2FKYLUQ== X-Google-Smtp-Source: ABdhPJxuu4EYsqmrXz954R1Z5YP+cOJ4Ifd+QvOTnbBflnQYIsWzLuv5y6G5f6GnwB1lH22aCko55w== X-Received: by 2002:a17:90a:9385:: with SMTP id q5mr2098018pjo.121.1617072851012; Mon, 29 Mar 2021 19:54:11 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:10 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 06/14] drm/bridge: ti-sn65dsi86: Move drm_panel_unprepare() to post_disable() Date: Mon, 29 Mar 2021 19:53:37 -0700 Message-Id: <20210329195255.v2.6.Ia75c9ffe2a2582393a8532d244da86f18b4c9b21@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We prepared the panel in pre_enable() so we should unprepare it in post_disable() to match. This becomes important once we start using pre_enable() and post_disable() to make sure things are powered on (and then off again) when reading the EDID. Signed-off-by: Douglas Anderson Reviewed-by: Andrzej Hajda --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index e8e523b3a16b..50a52af8e39f 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -460,8 +460,6 @@ static void ti_sn_bridge_disable(struct drm_bridge *bridge) regmap_write(pdata->regmap, SN_ML_TX_MODE_REG, 0); /* disable DP PLL */ regmap_write(pdata->regmap, SN_PLL_ENABLE_REG, 0); - - drm_panel_unprepare(pdata->panel); } static u32 ti_sn_bridge_get_dsi_freq(struct ti_sn_bridge *pdata) @@ -877,6 +875,8 @@ static void ti_sn_bridge_post_disable(struct drm_bridge *bridge) { struct ti_sn_bridge *pdata = bridge_to_ti_sn_bridge(bridge); + drm_panel_unprepare(pdata->panel); + clk_disable_unprepare(pdata->refclk); pm_runtime_put_sync(pdata->dev); From patchwork Tue Mar 30 02:53:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5112BC433E4 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28145619A9 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231235AbhC3CyU (ORCPT ); Mon, 29 Mar 2021 22:54:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230122AbhC3CyN (ORCPT ); Mon, 29 Mar 2021 22:54:13 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 586C8C061764 for ; Mon, 29 Mar 2021 19:54:13 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id s21so6996599pjq.1 for ; Mon, 29 Mar 2021 19:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RTm+OMgZlY4S4hMjr1yPchfjYIhYww8IVvy3C+UG5OA=; b=T1ak2WvHBXzGIQK+L+Lq+8Ydsiyy7SAzW87e3YZAJR0P9M2cVBxpRS3kXSX/3+bAS0 TyMOb6na5z7J4n+mnK9vwZIY4JmI8LfiedI1xE35JhEQDHzTm2Lv0g/CEOrM11JzFBPi J7Pzn6F79MaPYrGkaO7mXaxVycYLvdbRyGHns= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RTm+OMgZlY4S4hMjr1yPchfjYIhYww8IVvy3C+UG5OA=; b=ZchhxVDwJPuFGvnmAbQ2CDdTAgdtdv1T6oTGYoCom+tqXYdmqk+wAQSciC3iACwa7K 7SuB3zBAeDFPj1R38PS1FL6yUnsAPmhjswgc00Lw1PV5k6sMPpVynJ2/wOXqFA8PTdKS ikdjiBFrkp3au1cXqA8PxYBZv4uAmDh6FmS1gxgGYKKT1ONZG0qwY0oW0HbDu4m9sDsV F349D947gNGNo2zr10KxSQJJZlq6nBPW8EkM9WPMwmnIId//eQkkBECW0WSbe8E+bfqC e47w7mH1GPG0YVLCqyKMNnw8EZZLKlBrdYaMM2xa6ggFsbVetKP4O7o20oGKSHvvhnCx YP1w== X-Gm-Message-State: AOAM533jzfzUejTZ+DA8B8142H7M5S5oDfXJRga6KcX8Z2Zjjj4oQcbg o9ZRDdmIRzylPjI1Ifm8nRTKzw== X-Google-Smtp-Source: ABdhPJxPN8enXp1e4HwIU+ZMKYwa4F8Gz+UNfz2Bce7f22QcfvvT37KnbBqNKoBBqjiwxVL9mJjXCA== X-Received: by 2002:a17:902:f54e:b029:e6:3d74:eb3 with SMTP id h14-20020a170902f54eb02900e63d740eb3mr31652296plf.14.1617072852935; Mon, 29 Mar 2021 19:54:12 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:12 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/14] drm/bridge: ti-sn65dsi86: Get rid of the useless detect() function Date: Mon, 29 Mar 2021 19:53:38 -0700 Message-Id: <20210329195255.v2.7.I826adf4faeb7f39f560b387f6b380e639c6986c8@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org If we just leave the detect() function as NULL then the upper layers assume we're always connected. There's no reason for a stub. Signed-off-by: Douglas Anderson Reviewed-by: Andrzej Hajda --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 50a52af8e39f..a0a00dd1187c 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -306,20 +306,8 @@ static struct drm_connector_helper_funcs ti_sn_bridge_connector_helper_funcs = { .mode_valid = ti_sn_bridge_connector_mode_valid, }; -static enum drm_connector_status -ti_sn_bridge_connector_detect(struct drm_connector *connector, bool force) -{ - /** - * TODO: Currently if drm_panel is present, then always - * return the status as connected. Need to add support to detect - * device state for hot pluggable scenarios. - */ - return connector_status_connected; -} - static const struct drm_connector_funcs ti_sn_bridge_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, - .detect = ti_sn_bridge_connector_detect, .destroy = drm_connector_cleanup, .reset = drm_atomic_helper_connector_reset, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, From patchwork Tue Mar 30 02:53:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F2A8C433E8 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 752E0619C0 for ; Tue, 30 Mar 2021 02:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbhC3CyU (ORCPT ); Mon, 29 Mar 2021 22:54:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbhC3CyP (ORCPT ); Mon, 29 Mar 2021 22:54:15 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DA7AC061764 for ; Mon, 29 Mar 2021 19:54:15 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id y32so9531204pga.11 for ; Mon, 29 Mar 2021 19:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H9aZHg1XmzeEuWmP1Y9k5kwByteme6M7NQeVtbNkUCU=; b=C/RrhmHfFql2N/xoLubh0lDEHxjw4L7AWTRv0UuWixsW8lQIMBgwB+8VXVga1+vPpx tTauyVTEvRbcQpp9YFiGpINDqXOWBUqidzrOyuJk85ZUjFx8jlv8GVRroTOH154PGPGa 8rKSWGuzQ6BYuBnDPUdGSqpTe/cxZfw84Xumo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H9aZHg1XmzeEuWmP1Y9k5kwByteme6M7NQeVtbNkUCU=; b=EdUbFjlnJ1AXmAt51nPF9lJPpUh/qcasp2TNa5Eru2aGTiw1nj/GepIK8Z9XcUT2lV BfMvoCg2+r9BI2XeDxUUSBOkyP+fhoqa2qgsLwYqBtx7LLMWfHiWpwvE8m9mF55qD5AK EaxAMJBP8d9kVg+qRw5VOyCvheNWBfDQvaGyIcHZ/2poihFw0tZwRRbngf+EwnYBRQuv boz5xjekrC71aLYRmX+SiwshthRT3mmzb7VSGf66IFw1mlhTs4maZLxvx6JKwlXGyyXR Y2rOkjvaLWIoDfDshKb4+6eZxylV+Tw0hXEbSJRuv7La+wnKTz6NLJ1fo3L+Z5kTzvJt GLiw== X-Gm-Message-State: AOAM531XpjmSJZ/kUFkSjjZqiwzcFYj2YdAA4yGI/AEpsWmmDHZytLZJ fym/E5PWlI0+/o7PpiOt60c1Cg== X-Google-Smtp-Source: ABdhPJxr8EyEo9d+F9iFHOxEgEe5cO7TbKD9tvtR+Kk8T89iLex2MLCh1rb01WF9K+Rd1+GvPT8R+A== X-Received: by 2002:aa7:8a4d:0:b029:211:92f2:658c with SMTP id n13-20020aa78a4d0000b029021192f2658cmr28475860pfa.29.1617072854696; Mon, 29 Mar 2021 19:54:14 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:14 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 08/14] drm/bridge: ti-sn65dsi86: Remove extra call: drm_connector_update_edid_property() Date: Mon, 29 Mar 2021 19:53:39 -0700 Message-Id: <20210329195255.v2.8.Ic14a7ab8035df89e19a25ad4fbf2004f9673f167@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org As of commit 5186421cbfe2 ("drm: Introduce epoch counter to drm_connector") the drm_get_edid() function calls drm_connector_update_edid_property() for us. There's no reason for us to call it again. Signed-off-by: Douglas Anderson Reviewed-by: Andrzej Hajda --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index a0a00dd1187c..9577ebd58c4c 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -270,7 +270,7 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) { struct ti_sn_bridge *pdata = connector_to_ti_sn_bridge(connector); struct edid *edid = pdata->edid; - int num, ret; + int num; if (!edid) { pm_runtime_get_sync(pdata->dev); @@ -279,12 +279,9 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) } if (edid && drm_edid_is_valid(edid)) { - ret = drm_connector_update_edid_property(connector, edid); - if (!ret) { - num = drm_add_edid_modes(connector, edid); - if (num) - return num; - } + num = drm_add_edid_modes(connector, edid); + if (num) + return num; } return drm_panel_get_modes(pdata->panel, connector); From patchwork Tue Mar 30 02:53:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2358C433DB for ; Tue, 30 Mar 2021 02:55:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86E48619A6 for ; Tue, 30 Mar 2021 02:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231196AbhC3Cyt (ORCPT ); Mon, 29 Mar 2021 22:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230089AbhC3CyR (ORCPT ); Mon, 29 Mar 2021 22:54:17 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA0F3C061762 for ; Mon, 29 Mar 2021 19:54:16 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id v10so10654078pgs.12 for ; Mon, 29 Mar 2021 19:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BEKsKLyxs1+v0ZxDrM7HVhKxECDMgvUxXPP2eTukK2o=; b=Uw2K3tYxkMnEPqt9yGgUQVzYBYDnNm7MC9I+61puu5TEYXLVh24tHZAbiDeW4v1ABO lGkIdnuwHF0cQokbjkRoWcjmjEpKlc+ph12Sbqo9gTn+ejwL7NFFjLPfpJMnv4EcGtdv 3qKfSmbEv4ZtmHx9pqTWLHJJl9zjCYxw5Y7Io= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BEKsKLyxs1+v0ZxDrM7HVhKxECDMgvUxXPP2eTukK2o=; b=AQHlMUL2QNtZOq6ndzEK21/mhhjgx6qVwn7JtwlFH6on4fIUzDME5yAYheOshC5zwm F0z1sx3yGuMk00b/+QyAaJG+tIng/XNIpo/QU8gnOdRSwA4zFMzVJOtPf8VyK4WHh/uG iI6Q13fxWcvmtinhJQKoI0u549zj6b0o/lY4S2/JlP8CraSS/qudLArGvZt6PttnUe0S 3M9hYLxJGh4gGG5M+2TUG12Z5nsafnPcsq/jnva0eZ7dnPx5xumjhK7/BXfguY2b8X1Q fwBz9/anDWvPnMUTUAk7hvmTIPf2aOmj/FVUJqI8d/OJclNOGVhKyx1DEys/aZM8JCZH tAFg== X-Gm-Message-State: AOAM531eHNz4f6okucc4Vhb0gyRPDxIvL3u+4F4PJfuvZ/fZqlgRO24W 7QxpeXgPpWeQu7AYeglSFGgSMA== X-Google-Smtp-Source: ABdhPJzP+ZMH9J8DCQEoQQe/Ka+R8gqStepZzM0+mhog7QnppOBoLReWVZeyJe79x2EaqFdRcRVrZA== X-Received: by 2002:a05:6a00:1585:b029:203:6bc9:3ca6 with SMTP id u5-20020a056a001585b02902036bc93ca6mr27842566pfk.79.1617072856430; Mon, 29 Mar 2021 19:54:16 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:16 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/14] drm/edid: Use the cached EDID in drm_get_edid() if eDP Date: Mon, 29 Mar 2021 19:53:40 -0700 Message-Id: <20210329195255.v2.9.Ia7e9bb7cf6c51d960b9455fb0fa447cc68ece99d@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Each time we call drm_get_edid() we: 1. Go out to the bus and ask for the EDID. 2. Cache the EDID. We can improve this to actually use the cached EDID so that if drm_get_edid() is called multiple times then we don't need to go out to the bus over and over again. In normal DP/HDMI cases reading the EDID over and over again isn't _that_ expensive so, presumably, this wasn't that critical in the past. However for eDP going out to the bus can be expensive. This is because eDP panels might be powered off before the EDID was requested so we need to do power sequencing in addition to the transfer. In theory we should be able to cache the EDID for all types of displays. There is already code throwing the cache away when we detect that a display was unplugged. However, it can be noted that it's _extra_ safe to cache the EDID for eDP since eDP isn't a hot-pluggable interface. If we get the EDID once then we've got the EDID and we should never need to read it again. For now we'll only use the cache for eDP both because it's more important and extra safe. Signed-off-by: Douglas Anderson --- (no changes since v1) drivers/gpu/drm/drm_edid.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index c2bbe7bee7b6..fcbf468d73c9 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2049,15 +2049,39 @@ struct edid *drm_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) { struct edid *edid; + size_t old_edid_size; + const struct edid *old_edid; if (connector->force == DRM_FORCE_OFF) return NULL; - if (connector->force == DRM_FORCE_UNSPECIFIED && !drm_probe_ddc(adapter)) - return NULL; + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP && + connector->edid_blob_ptr) { + /* + * eDP devices are non-removable, or at least not something + * that's expected to be hot-pluggable. We can freely use + * the cached EDID. + * + * NOTE: technically we could probably even use the cached + * EDID even for non-eDP because the cached EDID should be + * cleared if we ever notice a display is not connected, but + * we'll use an abundance of caution and only do it for eDP. + * It's more important for eDP anyway because the EDID may not + * always be readable, like when the panel is powered down. + */ + old_edid = (const struct edid *)connector->edid_blob_ptr->data; + old_edid_size = ksize(old_edid); + edid = kmalloc(old_edid_size, GFP_KERNEL); + if (edid) + memcpy(edid, old_edid, old_edid_size); + } else { + if (connector->force == DRM_FORCE_UNSPECIFIED && !drm_probe_ddc(adapter)) + return NULL; + + edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter); + drm_connector_update_edid_property(connector, edid); + } - edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter); - drm_connector_update_edid_property(connector, edid); return edid; } EXPORT_SYMBOL(drm_get_edid); From patchwork Tue Mar 30 02:53:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171543 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E150C433E1 for ; Tue, 30 Mar 2021 02:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D1D5C619A6 for ; Tue, 30 Mar 2021 02:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231460AbhC3Cyv (ORCPT ); Mon, 29 Mar 2021 22:54:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231133AbhC3CyS (ORCPT ); Mon, 29 Mar 2021 22:54:18 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7815AC061764 for ; Mon, 29 Mar 2021 19:54:18 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id e14so5393960plj.2 for ; Mon, 29 Mar 2021 19:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kdhUcLdKGZws4bIuWNvM669I98WfYUeDRQetYvWjfOc=; b=LDZDXTvfo3j5zkAAyZvvJ/TwJjrnnhB8tUjrsrG4YoMmDxgEqWxtMmOOU845+GlpgF Y5/H79kEPuVKJcsebB97HKStI3DjVZ8RrcyJewIbVWJwaUqfsfLHVU/SFTqNsSNZJ4Yn QmvAj2FIF9WmWGMPOXaIO86aY+8+ydg3ggjVE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kdhUcLdKGZws4bIuWNvM669I98WfYUeDRQetYvWjfOc=; b=FGcc00OZnZkU/MqMrbjwwBlj0d/OYVSPdthjXSPt7zQXkza1+j5zV4PlEkLJNa99DV 1VpMzqgEN6HRlRhQA0/+ZEo0oh6ed9KlDEWQeOEM9/EAvkTpmkCQqz3xEaH2kSDRauj5 Yw23x0d7sXa3rcP4VAtTP+bClVnEmei7s5KD2KufdEvwp85TsD+8ABQvNaHDvR5TGdeY 01ixy93Be00SA5VQV2XOaRyaS+r2cakL7iB1h4bwlMU9dKEweR2Nyanzna6z96dmoA8X EGoh1/FCZJRcztHix/AjB6IrEAnGKdRaHZFCowx1QESNlCEYD0UO4J5a1iuG3mkS0QtX OXRA== X-Gm-Message-State: AOAM532fzppSX3judQMZsVWnUcXCDMOdmWJjEijlrLSsjdBCczsoIFRj 3fQYK9H+Dgc9HBYDhxZGWLEYDw== X-Google-Smtp-Source: ABdhPJyRbP9Dg9rng94Tm6dgBkHfUuioCdrW0smh7o8Ei4c+MuOLyUrICxVQG1NgRYkZK5JqSBmmvg== X-Received: by 2002:a17:902:ed84:b029:e7:1f2b:1eb4 with SMTP id e4-20020a170902ed84b02900e71f2b1eb4mr19897667plj.74.1617072858078; Mon, 29 Mar 2021 19:54:18 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:17 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/14] drm/bridge: ti-sn65dsi86: Stop caching the EDID ourselves Date: Mon, 29 Mar 2021 19:53:41 -0700 Message-Id: <20210329195255.v2.10.Ida6151df6bfc71df77afee1d72bb7eb0a443f327@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now that we have the patch ("drm/edid: Use the cached EDID in drm_get_edid() if eDP") we no longer need to maintain our own cache. Drop this code. Signed-off-by: Douglas Anderson Reviewed-by: Andrzej Hajda --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 9577ebd58c4c..c0398daaa4a6 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -121,7 +121,6 @@ * @debugfs: Used for managing our debugfs. * @host_node: Remote DSI node. * @dsi: Our MIPI DSI source. - * @edid: Detected EDID of eDP panel. * @refclk: Our reference clock. * @panel: Our panel. * @enable_gpio: The GPIO we toggle to enable the bridge. @@ -147,7 +146,6 @@ struct ti_sn_bridge { struct drm_bridge bridge; struct drm_connector connector; struct dentry *debugfs; - struct edid *edid; struct device_node *host_node; struct mipi_dsi_device *dsi; struct clk *refclk; @@ -269,17 +267,17 @@ connector_to_ti_sn_bridge(struct drm_connector *connector) static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) { struct ti_sn_bridge *pdata = connector_to_ti_sn_bridge(connector); - struct edid *edid = pdata->edid; - int num; + struct edid *edid; + int num = 0; - if (!edid) { - pm_runtime_get_sync(pdata->dev); - edid = pdata->edid = drm_get_edid(connector, &pdata->aux.ddc); - pm_runtime_put(pdata->dev); - } + pm_runtime_get_sync(pdata->dev); + edid = drm_get_edid(connector, &pdata->aux.ddc); + pm_runtime_put(pdata->dev); - if (edid && drm_edid_is_valid(edid)) { - num = drm_add_edid_modes(connector, edid); + if (edid) { + if (drm_edid_is_valid(edid)) + num = drm_add_edid_modes(connector, edid); + kfree(edid); if (num) return num; } @@ -1308,8 +1306,6 @@ static int ti_sn_bridge_remove(struct i2c_client *client) if (!pdata) return -EINVAL; - kfree(pdata->edid); - ti_sn_debugfs_remove(pdata); drm_bridge_remove(&pdata->bridge); From patchwork Tue Mar 30 02:53:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AE0CC433E0 for ; Tue, 30 Mar 2021 02:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6921619A7 for ; Tue, 30 Mar 2021 02:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231133AbhC3Cyw (ORCPT ); Mon, 29 Mar 2021 22:54:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbhC3CyU (ORCPT ); Mon, 29 Mar 2021 22:54:20 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38E8DC061762 for ; Mon, 29 Mar 2021 19:54:20 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id x21-20020a17090a5315b029012c4a622e4aso6169065pjh.2 for ; Mon, 29 Mar 2021 19:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JAIxLRBaavWcAcK9SSbll47MTaBI4ukNSin+ics3K28=; b=al+6PytDBZ2jbp7v2fVxXLPHoZdiwhHJtJHRMEn4787KijhZrKruMEs3D2NL9JnRVY +RT/KeOGEVqPY4nECULrGBkmmyDt8T/xSfiTy1izZson6ZGCZxAQqAGa+rQAUhsBhXCm HGy0YLGpp7Bap63ecOQ/LYjXZIYA47UvFYZxE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JAIxLRBaavWcAcK9SSbll47MTaBI4ukNSin+ics3K28=; b=qwMHCXLnRIF7J2UK9DXcLdNIa3Lyk+SCDlHPoQ9ICY/HCb7jMRBsm6qunsZAcFCyZt NkmQ33qTbY8zKqAxmJp34hKvVBUzMBtaaxwZ40GNoBkkuKNGevkuRkCpxi7Ulyp9dxxp f5mGaD7ECX+X4UUYamHT1dRbOgXXsGr2cSBZFS9iit0eFG6QRr97d5Nhy5yEXi7xi4/m U4T/LzDMVYyFJbcB1siRzowDyJm8qf4ReJ+ykKilY/y0EuFbNFyJ6yRFj8ymHDn/qwt6 nCafFsCWc0sxqXD5fFEpCZ5oPQRrdtiL9D8DHkZJ5jmK8f6e4UUTc87GYp2t+Utv9jpr Go6w== X-Gm-Message-State: AOAM530B5mUGxZ08qEdBYSzCVmNGmVqTYeEndsMVt8FDcxqIIEJacByP h4038oN/4jnKogjl1m4bS90rtg== X-Google-Smtp-Source: ABdhPJxTC0xfEa3OIjJ6J8E3qWj+ePa35e+igWNb4t2QmRZmmmta+5oUiZgXYVhSNZvV/6N3FWSh0A== X-Received: by 2002:a17:902:56c:b029:e7:1052:a7c6 with SMTP id 99-20020a170902056cb02900e71052a7c6mr30855319plf.75.1617072859762; Mon, 29 Mar 2021 19:54:19 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:19 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/14] drm/bridge: ti-sn65dsi86: Power things properly for reading the EDID Date: Mon, 29 Mar 2021 19:53:42 -0700 Message-Id: <20210329195255.v2.11.Ied721dc895156046ac523baa55a71da241cd09c7@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org eDP panels won't provide their EDID unless they're powered on. Let's chain a power-on before we read the EDID. This roughly matches what was done in 'parade-ps8640.c'. NOTE: The old code attempted to call pm_runtime_get_sync() before reading the EDID. While that was enough to power the bridge chip on, it wasn't enough to talk to the panel for two reasons: 1. Since we never ran the bridge chip's pre-enable then we never set the bit to ignore HPD. This meant the bridge chip didn't even _try_ to go out on the bus and communicate with the panel. 2. Even if we fixed things to ignore HPD, the EDID still wouldn't read if the panel wasn't on. One thing that's a bit odd here is taking advantage of the EDID that the core might have cached for us. See the patch ("drm/edid: Use the cached EDID in drm_get_edid() if eDP"). We manage to get at the cache by: - Instantly failing aux transfers if we're not powered. - If the first read of the EDID fails we try again after powering. Fixes: 58074b08c04a ("drm/bridge: ti-sn65dsi86: Read EDID blob over DDC") Signed-off-by: Douglas Anderson --- Depending on what people think of the other patches in this series, some of this could change. - If everyone loves the "runtime PM" in the panel driver then we could, in theory, put the pre-enable chaining straight in the "aux transfer" function. - If everyone hates the EDID cache moving to the core then we can avoid some of the awkward flow of things and keep the EDID cache in the sn65dsi86 driver. (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 39 +++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index c0398daaa4a6..673c9f1c2d8e 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -128,6 +128,7 @@ * @dp_lanes: Count of dp_lanes we're using. * @ln_assign: Value to program to the LN_ASSIGN register. * @ln_polrs: Value for the 4-bit LN_POLRS field of SN_ENH_FRAME_REG. + * @pre_enabled: If true then pre_enable() has run. * * @gchip: If we expose our GPIOs, this is used. * @gchip_output: A cache of whether we've set GPIOs to output. This @@ -155,6 +156,7 @@ struct ti_sn_bridge { int dp_lanes; u8 ln_assign; u8 ln_polrs; + bool pre_enabled; #if defined(CONFIG_OF_GPIO) struct gpio_chip gchip; @@ -268,11 +270,33 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) { struct ti_sn_bridge *pdata = connector_to_ti_sn_bridge(connector); struct edid *edid; + bool was_enabled; int num = 0; - pm_runtime_get_sync(pdata->dev); + /* + * Try to get the EDID first without anything special. There are + * three things that could happen with this call. + * a) It might just return from its cache. + * b) It might try to initiate an AUX transfer which might work. + * c) It might try to initiate an AUX transfer which might fail because + * we're not powered up. + * + * If we get a failure we'll assume case c) and try again. NOTE: we + * don't want to power up every time because that's slow and we don't + * have visibility into whether the data has already been cached. + */ edid = drm_get_edid(connector, &pdata->aux.ddc); - pm_runtime_put(pdata->dev); + if (!edid) { + was_enabled = pdata->pre_enabled; + + if (!was_enabled) + drm_bridge_chain_pre_enable(&pdata->bridge); + + edid = drm_get_edid(connector, &pdata->aux.ddc); + + if (!was_enabled) + drm_bridge_chain_post_disable(&pdata->bridge); + } if (edid) { if (drm_edid_is_valid(edid)) @@ -852,12 +876,16 @@ static void ti_sn_bridge_pre_enable(struct drm_bridge *bridge) HPD_DISABLE); drm_panel_prepare(pdata->panel); + + pdata->pre_enabled = true; } static void ti_sn_bridge_post_disable(struct drm_bridge *bridge) { struct ti_sn_bridge *pdata = bridge_to_ti_sn_bridge(bridge); + pdata->pre_enabled = false; + drm_panel_unprepare(pdata->panel); clk_disable_unprepare(pdata->refclk); @@ -891,6 +919,13 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, int ret; u8 addr_len[SN_AUX_LENGTH_REG + 1 - SN_AUX_ADDR_19_16_REG]; + /* + * Things just won't work if the panel isn't powered. Return failure + * right away. + */ + if (!pdata->pre_enabled) + return -EIO; + if (len > SN_AUX_MAX_PAYLOAD_BYTES) return -EINVAL; From patchwork Tue Mar 30 02:53:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42346C433E2 for ; Tue, 30 Mar 2021 02:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1876B60241 for ; Tue, 30 Mar 2021 02:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231241AbhC3Cyx (ORCPT ); Mon, 29 Mar 2021 22:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbhC3CyW (ORCPT ); Mon, 29 Mar 2021 22:54:22 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D608EC061764 for ; Mon, 29 Mar 2021 19:54:21 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id ot17-20020a17090b3b51b0290109c9ac3c34so8692567pjb.4 for ; Mon, 29 Mar 2021 19:54:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OznxYj+eRPVb4um1OhPEH9Y2bcONmP2iXcQsa3vKzmU=; b=UJOk7rBZBFF9I7lwYBJmw01yx2yHeWcw5z0zsYmSrIAxjHV4hx3YLLroFJWN0TA7m2 kx7hnYCBA3g6fJWfnrNU46vi6abv2rwjis0Lq4iRzRXn4GgWfff5PwW9SbAfzzAZg5oI p6jjD0bmPxC/qMblO48yxz/gnwV4iUqORCAwA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OznxYj+eRPVb4um1OhPEH9Y2bcONmP2iXcQsa3vKzmU=; b=UXS8OZHH38alomNZdMckC5/EDKDDKuIGmwn9nndQFSFL3COPJFNOBDib8XG3KIUkBA q590Ug2Kk1V/Ko9FknCEtxuhosNegSokUEHGH+Da+LMrF3MtnLf44ut3XYZnrl7x4wlC 0nCR/D+5aY0+7OwvLgT5Geyqsen6pBTgDmW7NOE7IzAPWokxvh7yj4axPTYN2tTgkF5b SC6m5vj9IB/gqiqMun2gC1/Aux2EHKNQ/fEJ70i60flE/0i/MF+4hVfIhH3dFJNAYY5G qXsBDFu5Vmg+wUZJC9xxs7ZRTDBauIZmrfCRmoOA84z8ExCObNG+S4lztH2MUE4izD4J j+Gw== X-Gm-Message-State: AOAM531pS/Z9n4S21SPrM2faeI4/gC5Mf31YCZBiDvteUyLyvrdz/EHz VilcV8jbRWAbFhPTukx8Z9MLKQ== X-Google-Smtp-Source: ABdhPJwdMyAMlvJ4erQw/GS0vAMriU7o2o3SCbSml2tS9OvV/G56Q2R8aTmlnqks8jfOmrfPN47vwQ== X-Received: by 2002:a17:902:bd45:b029:e7:1490:9db5 with SMTP id b5-20020a170902bd45b02900e714909db5mr25817051plx.45.1617072861413; Mon, 29 Mar 2021 19:54:21 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:21 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 12/14] drm/bridge: ti-sn65dsi86: Read the EDID only if refclk was provided Date: Mon, 29 Mar 2021 19:53:43 -0700 Message-Id: <20210329195255.v2.12.I7a8708139ae993f30f51eec7d065a1906c31a4bc@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Though I don't have access to any hardware that uses ti-sn65dsi86 and _doesn't_ provide a "refclk", I believe that we'll have trouble reading the EDID at bootup in that case. Specifically I believe that if there's no "refclk" we need the MIPI source clock to be active before we can successfully read the EDID. My evidence here is that, in testing, I couldn't read the EDID until I turned on the DPPLL in the bridge chip and that the DPPLL needs the input clock to be active. Since this is hard to support, let's punt trying to read the EDID if there's no "refclk". I don't believe there are any users of the ti-sn65dsi86 bridge chip that _don't_ use "refclk". The bridge chip is _very_ inflexible in that mode. The only time I've seen that mode used was for some really early prototype hardware that was thrown in the e-waste bin years ago when we realized how inflexible it was. Even if someone is using the bridge chip without the "refclk" they're in no worse shape than they were before the (fairly recent) commit 58074b08c04a ("drm/bridge: ti-sn65dsi86: Read EDID blob over DDC"). Signed-off-by: Douglas Anderson --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 673c9f1c2d8e..92498900c58d 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -273,6 +273,18 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) bool was_enabled; int num = 0; + /* + * Don't try to read the EDID if no refclk. In theory it is possible + * to make this work but it's tricky. I believe that we need to get + * our upstream MIPI source to provide a pixel clock before we can + * do AUX transations but we need to be able to read the EDID before + * we've picked a display mode. The bridge is already super limited + * if you try to use it without a refclk so presumably limiting to + * the fixed modes our downstream panel reports is fine. + */ + if (!pdata->refclk) + goto exit; + /* * Try to get the EDID first without anything special. There are * three things that could happen with this call. @@ -306,6 +318,7 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) return num; } +exit: return drm_panel_get_modes(pdata->panel, connector); } From patchwork Tue Mar 30 02:53:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42B06C433E4 for ; Tue, 30 Mar 2021 02:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06165619C7 for ; Tue, 30 Mar 2021 02:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231465AbhC3Cyx (ORCPT ); Mon, 29 Mar 2021 22:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231318AbhC3CyX (ORCPT ); Mon, 29 Mar 2021 22:54:23 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7845DC061764 for ; Mon, 29 Mar 2021 19:54:23 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id j6-20020a17090adc86b02900cbfe6f2c96so6921082pjv.1 for ; Mon, 29 Mar 2021 19:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qYK7VrB9zh1nJosxOHMeXf6pgnTeHfrprZk+pogrvOE=; b=Gc6dqK9kmETo+Nhx6WAnosO6l6Pe4N4Cqli441GiQUT9ff2Xr0mlCXlLX6zzUM2cd4 LjzpG4qVSmYxPdvz0fL9cz8HRyyWHusIDXOzBiqGI/fX0TePOdFugaUwLbb39DagvxDI PyF2+19s9Frn5Yq4n6ToLHNOkTbxE9nBksZv8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qYK7VrB9zh1nJosxOHMeXf6pgnTeHfrprZk+pogrvOE=; b=AVy3Hl9BzA95TuEYaypDFsmcv4XIKpqHhtWV/dZXDNd4L74jdbWSzpKixPe6ep6qxn YnBFo0CPor7Aa5he3+IB4z1pJBH+Fz0Ka+mOYFSjhKmQiqEuce/8x8vFs8FpR8uZ3tpF b2IWuFKv522D0MDMnukdS9WwiSNHgpnpjSuRWQjK0ePEHpoT/q1v55JSpXbjyQ6/tvjb 6aZvENG3Be0A7BGK+VVfEQrj6SrbBgyc24jqxklszAIiXYehkusdbw1PseS4oEz7lCgK p/iV6yQYC9pHPOmc1U4ZbMzddXz3E8VLsy+ZH/9Z9qyR9ZT2LQFnzWTCXvmYm1lZc1+F kXOQ== X-Gm-Message-State: AOAM530RF7k3iBwdrNLuy+sJjF4j37J0WDSaWNfTzd0amfY/jY+GBIOQ UIzhGBKQzaE37Vmt/fBieoaTzA== X-Google-Smtp-Source: ABdhPJzp+H901r/w9Tl3yZlkxjUAYJrtNugSXQZRWimDt36JIwcL8mivHva4TYJaIp+QJ1HcRxCFSg== X-Received: by 2002:a17:90a:9a91:: with SMTP id e17mr2109663pjp.218.1617072863117; Mon, 29 Mar 2021 19:54:23 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:22 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 13/14] drm/bridge: ti-sn65dsi86: Print an error if we fallback to panel modes Date: Mon, 29 Mar 2021 19:53:44 -0700 Message-Id: <20210329195255.v2.13.Ib4183a04e8698f60b67558f363fddbbaf33dd445@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now that we can properly read the EDID for modes there should be no reason to fallback to the fixed modes that our downstream panel driver provides us. Let's make that clear by: - Putting an error message in the logs if we fall back. - Putting a comment in saying what's going on. Signed-off-by: Douglas Anderson --- (no changes since v1) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 92498900c58d..20c3b13939c2 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -318,6 +318,13 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) return num; } + /* + * Ideally this should never happen and we could remove the fallback + * but let's preserve old behavior. + */ + DRM_DEV_ERROR(pdata->dev, + "Failed to read EDID; falling back to panel modes"); + exit: return drm_panel_get_modes(pdata->panel, connector); } From patchwork Tue Mar 30 02:53:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12171551 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67CA0C433E8 for ; Tue, 30 Mar 2021 02:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39107619A6 for ; Tue, 30 Mar 2021 02:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231472AbhC3Cyy (ORCPT ); Mon, 29 Mar 2021 22:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231382AbhC3CyZ (ORCPT ); Mon, 29 Mar 2021 22:54:25 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FA6EC061764 for ; Mon, 29 Mar 2021 19:54:25 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id gb6so7011370pjb.0 for ; Mon, 29 Mar 2021 19:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Jys6treQLmtovHh8Q5PKz6NZS9rseP3crP7Ti/ybCsA=; b=etvJfy76jSeT8orrEcP21zK3SyGBHJ4mxUKIcAWBYkeAKj9R3EZgaRTrONfP7DVgYf 46ORMDHwSJu0PWv9KN3cGSkQGBp7Gc3S8z/V1F7xQ8NaY05TLvZ2vQ6IZR1hDGHMJ8WO sTuUPgt9knV7cvgKTDADChchQIs9AUiWeJ8fM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jys6treQLmtovHh8Q5PKz6NZS9rseP3crP7Ti/ybCsA=; b=T5xR8BQHmz/7an+irCIN+5+KcITdjOsoHbQ5bwO13aEzDA7kpnkLR5c+JYWgkMqtXw suodlU+1ZPKYMql4DgfSS+svu8I/dkwfXyfMBnN5Hp0rafosxqh0BnTOEg36okX9W2Ty Itn/UGggjUhld3zItjSeNawXFFB7KTIhKwHHMYbyfjUtjEAghB0r/v44Ci/P0N0of2Oh nY0LO+fhsYWGHYp30RX7c5dLzsRkk2Lc87pLE3suA7QHHWGzQJnV8STtYWdk+k94HKyf /f2waliTr1YQPU+/QMEV7iPanBPB2/JCKOo3MlDcGqqA5/NyrFIhhJSvt5XCcMzyOf4/ t0bA== X-Gm-Message-State: AOAM533+dBodAHWXDhcFWduobrEuZaq0vwi0NpvGqdXKp/FgROrCzqHz npRL6IVxGfPhmP3aaEkgI1kjeQ== X-Google-Smtp-Source: ABdhPJwq9QwwXvd0fal4fYZ4mL+jy3vC9ElZiF9K7ExdiAIYFEvxidieWObuFhJukDRYGXM16i3zpg== X-Received: by 2002:a17:902:ff01:b029:e7:147f:193 with SMTP id f1-20020a170902ff01b02900e7147f0193mr25884988plj.82.1617072864844; Mon, 29 Mar 2021 19:54:24 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f599:1ca7:742d:6b50]) by smtp.gmail.com with ESMTPSA id t17sm19152706pgk.25.2021.03.29.19.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 19:54:24 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Bjorn Andersson , Stephen Boyd , Maarten Lankhorst , robdclark@chromium.org, Stanislav Lisovskiy , linux-arm-msm@vger.kernel.org, Steev Klimaszewski , Linus W , Douglas Anderson , Daniel Vetter , David Airlie , Thierry Reding , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 14/14] drm/panel: panel-simple: Use runtime pm to avoid excessive unprepare / prepare Date: Mon, 29 Mar 2021 19:53:45 -0700 Message-Id: <20210329195255.v2.14.I9e8bd33b49c496745bfac58ea9ab418bd3b6f5ce@changeid> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210330025345.3980086-1-dianders@chromium.org> References: <20210330025345.3980086-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Unpreparing and re-preparing a panel can be a really heavy operation. Panels datasheets often specify something on the order of 500ms as the delay you should insert after turning off the panel before turning it on again. In addition, turning on a panel can have delays on the order of 100ms - 200ms before the panel will assert HPD (AKA "panel ready"). The above means that we should avoid turning a panel off if we're going to turn it on again shortly. The above becomes a problem when we want to read the EDID of a panel. The way that ordering works is that userspace wants to read the EDID of the panel _before_ fully enabling it so that it can set the initial mode correctly. However, we can't read the EDID until we power it up. This leads to code that does this dance (like ps8640_bridge_get_edid()): 1. When userspace requests EDID / the panel modes (through an ioctl), we power on the panel just enough to read the EDID and then power it off. 2. Userspace then turns the panel on. There's likely not much time between step #1 and #2 and so we want to avoid powering the panel off and on again between those two steps. Let's use Runtime PM to help us. We'll move the existing prepare() and unprepare() to be runtime resume() and runtime suspend(). Now when we want to prepare() or unprepare() we just increment or decrement the refcount. We'll default to a 1 second autosuspend delay which seems sane given the typical delays we see for panels. A few notes: - It seems the existing unprepare() and prepare() are defined to be no-ops if called extra times. We'll preserve that behavior. - This is a slight change in the ABI of simple panel. If something was absolutely relying on the unprepare() to happen instantly that simply won't be the case anymore. I'm not aware of anyone relying on that behavior, but if there is someone then we'll need to figure out how to enable (or disable) this new delayed behavior selectively. - In order for this to work we now have a hard dependency on "PM". From memory this is a legit thing to assume these days and we don't have to find some fallback to keep working if someone wants to build their system without "PM". Signed-off-by: Douglas Anderson --- (no changes since v1) drivers/gpu/drm/panel/Kconfig | 1 + drivers/gpu/drm/panel/panel-simple.c | 93 +++++++++++++++++++++------- 2 files changed, 73 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 4894913936e9..ef87d92cdf49 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -80,6 +80,7 @@ config DRM_PANEL_SIMPLE tristate "support for simple panels" depends on OF depends on BACKLIGHT_CLASS_DEVICE + depends on PM select VIDEOMODE_HELPERS help DRM panel driver for dumb panels that need at most a regulator and diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index be312b5c04dd..6b22872b3281 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include