From patchwork Tue May 25 00:01:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 446510 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.1 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 E4431C47084 for ; Tue, 25 May 2021 00:02:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7335613E6 for ; Tue, 25 May 2021 00:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbhEYAEN (ORCPT ); Mon, 24 May 2021 20:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbhEYAEI (ORCPT ); Mon, 24 May 2021 20:04:08 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50E18C06138E for ; Mon, 24 May 2021 17:02:38 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id f22so13799510pfn.0 for ; Mon, 24 May 2021 17:02:38 -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=W6ypAeNUyTw13+ot10ZJQCb7zwm92rirhMuMnGlmdIU=; b=FFPgxCLKPIvWnLs03iIgcyr6GE8zQUZQ8sRvcNzu/YD7cj4TPN4zWLQ3tH6so65zkb vJQaqSDWEWJD9nuU1vz0F+NdT65YWQM54V+JBtu3Ft2hIkfFeseFYai001oLOoRBfQ1F yreunhpuNrtcArkMUGoQaiZc8CD5Gi/QCl/ko= 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=W6ypAeNUyTw13+ot10ZJQCb7zwm92rirhMuMnGlmdIU=; b=P9a3p7vHQfyFZsBTGj3P/72ufCHYDIyLiDmWoqnslIz6TQplb+Abh98hDdLd/9l5pn O1CqvFJNgfLB7ntbVOpwwf5gZrCBAfnEJewwbyGu79YG/8vratMTKaKNWacw4/NIHpYX I0bWswk6JBmfIxHav2BwKhwHaOGJP3VnhLIQ2KeSDTH8h8ZVmQB2ocK7Mx7CC+1xJWAl KmRv1fuIypR6v6cZHleSCCjOgUM6FIq5gaUl//hrrSTf4iz/r+Tl5yD1YxqH9gMbP1HX wT5aSMmpi9GwaiY5+TnzY2ChPEbUkTpIV+tcOz0M39XcwnKpEOzouyKV+UkCvCo+z3O0 pmCw== X-Gm-Message-State: AOAM533KfVuL4mX5EQcwf8yNYDm3bsNBQLscPHLptkOzgUHlSvwM7d8z NapTkpUCrbM06R5oOULE8N0xlQ== X-Google-Smtp-Source: ABdhPJz+LC13pDsPvIBJY/vfn0G6QTA8D2JN1gmx11Mo7iFbBxGuzCfte4L/NJ0jWk9GQJjvTVI8vw== X-Received: by 2002:aa7:8556:0:b029:2e2:45aa:d01e with SMTP id y22-20020aa785560000b02902e245aad01emr25395634pfn.14.1621900957855; Mon, 24 May 2021 17:02:37 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:37 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Rob Herring , Thierry Reding , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 01/11] dt-bindings: display: simple: List hpd properties in panel-simple Date: Mon, 24 May 2021 17:01:49 -0700 Message-Id: <20210524165920.v8.1.Ieb731d23680db4700cc41fe51ccc73ba0b785fb7@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The HPD (Hot Plug Detect) signal is present in many (probably even "most") eDP panels. For eDP, this signal isn't actually used for detecting hot-plugs of the panel but is more akin to a "panel ready" signal. After you provide power to the panel, panel timing diagrams typically say that you should wait for HPD to be asserted (or wait a fixed amount of time) before talking to the panel. The panel-simple bindings describes many eDP panels and many of these panels provide the HPD signal. We should add the HPD-related properties to the panel-simple bindings. The HPD properties are actually defined in panel-common.yaml, so adding them here just documents that they are OK for panels handled by the panel-simple bindings. NOTE: whether or not we'd include HPD properties in the panel node is more a property of the board design than the panel itself. For most boards using these eDP panels everything "magically" works without specifying any HPD properties and that's been why we haven't needed to allow the HPD properties earlier. On these boards the HPD signal goes directly to a dedicated "HPD" input to the eDP controller and this connection doesn't need to be described in the device tree. The only time the HPD properties are needed in the device tree are if HPD is hooked up to a GPIO or if HPD is normally on the panel but isn't used on a given board. That means that if we don't allow the HPD properties in panel-simple then one could argue that we've got to boot all eDP panels (or at least all those that someone could conceivably put on a system where HPD goes to a GPIO or isn't hooked up) from panel-simple. Signed-off-by: Douglas Anderson Reviewed-by: Rob Herring --- Changes in v8: - Explain better why HPD needs to be in panel-simple in commit msg. Changes in v7: - List hpd properties bindings patch new for v7. .../devicetree/bindings/display/panel/panel-simple.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml index b3797ba2698b..4a0a5e1ee252 100644 --- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml @@ -298,6 +298,8 @@ properties: enable-gpios: true port: true power-supply: true + no-hpd: true + hpd-gpios: true additionalProperties: false From patchwork Tue May 25 00:01:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 447436 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.1 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 C4120C47085 for ; Tue, 25 May 2021 00:02:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 929816142C for ; Tue, 25 May 2021 00:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229978AbhEYAEP (ORCPT ); Mon, 24 May 2021 20:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbhEYAEJ (ORCPT ); Mon, 24 May 2021 20:04:09 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2687AC061342 for ; Mon, 24 May 2021 17:02:40 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id q67so5122893pfb.4 for ; Mon, 24 May 2021 17:02:40 -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=aS2FXtbqE5xTeUczZX5p4dHrNjJBACW91SRGxxJRtNE=; b=lzpSd5rWPmHUsOwDcrWP2v3NS9aQ3jxCxECSbeE1gdkyj2kgaPc82gmiEoUIdAaTu6 nasPFE6JUYsDPQ5FrdRV93gW8cbba2QWfhYx+ybG6BPxXhPx2by4izujhsspt1vHyG1W hV4w2me2ESliNawtPsnpHKdEfJzfv1zLp1Xnk= 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=aS2FXtbqE5xTeUczZX5p4dHrNjJBACW91SRGxxJRtNE=; b=PAMi7ycZ39pEQKAnch0VTgcSEmTZYGj29vkR/GNUFRdTHJ7asowR+uzA2Szk6s2jtE nn3+qfP64GP4EYSqjBb7PJKhUuDU38ZcsJhlzclwT31KM/RiRlD7ead9xB75GpvX+P+k BqzFXzqZHO7MaRJRToZgq92xg6AcsLItWvZVrXV8wyiE9wP95it2E4OGKRvBMomCaAbT XSd4RIdgBptyCy+b7lNewLAzFXrHtBlYNdSk26Kpil/ZfxKSMSEZSeyT8aCNyqGNQQTW +sQ4ZbxOaW942ab8gEwA63uk2ra+z9ta8WiujMLsVTXU3XrSyzo7/DsAy3q9YVWrToJy mClg== X-Gm-Message-State: AOAM533Rwz7LROkVfFboxmGiX4dPirNAjlZzDN/dRAyyip39Nj3fpNg7 sKm1//l7wNkJaRxz8pCMH+QLag== X-Google-Smtp-Source: ABdhPJw/K4Ffsq5mJ1xUQPdTUkUfGUtNdW7pXLVPCAvIecDthB8kfmRjrEffJtTweMb5rHEKnvwxZg== X-Received: by 2002:a62:7f51:0:b029:2dc:e1c9:ef71 with SMTP id a78-20020a627f510000b02902dce1c9ef71mr27204538pfd.33.1621900959554; Mon, 24 May 2021 17:02:39 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:39 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 02/11] dt-bindings: drm: Introduce the DP AUX bus Date: Mon, 24 May 2021 17:01:50 -0700 Message-Id: <20210524165920.v8.2.Id3c048d22e72a9f90084a543b5b4e3f43bc9ab62@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We want to be able to list an eDP panel as a child of an eDP controller node to represent the fact that the panel is connected to the controller's DP AUX bus. Though the panel and the controller are connected in several ways, the DP AUX bus is the primary control interface between the two and thus makes the most sense to model in device tree hierarchy. Listing a panel in this way makes it possible for the panel driver to easily get access to the DP AUX bus that it resides on, which can be useful to help in auto-detecting the panel and for turning on various bits. NOTE: historically eDP panels were _not_ listed under their controller but were listed at the top level of the device tree. This will still be supported for backward compatibility (and while DP controller drivers are adapted to support the new DT syntax) but should be considered deprecated since there is no downside to listing the panel under the controller. For now, the DP AUX bus bindings will only support an eDP panel underneath. It's possible it could be extended to allow having a DP connector under it in the future. The idea for this bus's design was hashed out over IRC [1]. [1] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2021-05-11 Signed-off-by: Douglas Anderson Reviewed-by: Rob Herring --- My DT yaml-fu is still weak. If I did something stupid, please help me learn how to do this better! NOTE: there is no "Example" in this bindings file. Yikes! This is because I wanted to keep this patch separate from the one that enables the first eDP controller. See the patch ("dt-bindings: drm/aux-bus: Add an example") for the example. ALSO: if anyone else would like to be listed as a "Maintainer" in this file then please shout! Changes in v8: - Separate DP AUX bus binding is new for v8. .../bindings/display/dp-aux-bus.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/dp-aux-bus.yaml diff --git a/Documentation/devicetree/bindings/display/dp-aux-bus.yaml b/Documentation/devicetree/bindings/display/dp-aux-bus.yaml new file mode 100644 index 000000000000..5e4afe9f98fb --- /dev/null +++ b/Documentation/devicetree/bindings/display/dp-aux-bus.yaml @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/dp-aux-bus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: DisplayPort AUX bus + +maintainers: + - Douglas Anderson + +description: + DisplayPort controllers provide a control channel to the sinks that + are hooked up to them. This is the DP AUX bus. Over the DP AUX bus + we can query properties about a sink and also configure it. In + particular, DP sinks support DDC over DP AUX which allows tunneling + a standard I2C DDC connection over the AUX channel. + + To model this relationship, DP sinks should be placed as children + of the DP controller under the "aux-bus" node. + + At the moment, this binding only handles the eDP case. It is + possible it will be extended in the future to handle the DP case. + For DP, presumably a connector would be listed under the DP AUX + bus instead of a panel. + +properties: + $nodename: + const: "aux-bus" + + panel: + $ref: panel/panel-common.yaml# + +additionalProperties: false + +required: + - panel From patchwork Tue May 25 00:01:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 446509 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.1 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 9BB27C2B9F8 for ; Tue, 25 May 2021 00:02:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D6866141B for ; Tue, 25 May 2021 00:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230014AbhEYAEQ (ORCPT ); Mon, 24 May 2021 20:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbhEYAEL (ORCPT ); Mon, 24 May 2021 20:04:11 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4B2CC06138C for ; Mon, 24 May 2021 17:02:41 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id q67so5122936pfb.4 for ; Mon, 24 May 2021 17:02:41 -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=frU/MIzwrtJawHtHpJ2wMhHOm//TNBEwf1FFx7azP48=; b=RmPVDYwmFaVUEaUke1HUVctixj/lUivUYphXkuYDtAk2my9OzGNqfTwHBMTLZMNOpk FThVamNIUDasehzHdFesXrMfpwPU/okm50gJ8OvAN9rDUM0qs9FXPfeR9vSh50LvQc48 d5KOkGBjoOibcmUz6TNVaZHIQBk3BKVIvqTk8= 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=frU/MIzwrtJawHtHpJ2wMhHOm//TNBEwf1FFx7azP48=; b=HlRKhCwRg+GP0JKWP2epCqexXlhMwOKwFFoTgHdZAJji2Kvzr1IvBUTOUUpxcgfNSs fzZdm0Ht9he9C9ff8pmOpG8ss9FfsnCbmdIjOuzfZ9I05H62RA7CxWbBb23vV7l7ZmIq EZYFUVtYgtnEG5AJKcpFN9WbCpr/xl02hFAsUhkHb3uzTSXLMfAcfZArsO+n6cNUWTMO 63s8K2D8pQJBwDfVHWePCOG0vErWl4pkG13Imr6xYOIOQPG5PvIK5+XtcA+sxYl1mI8v 8KGrKf0ZZ5Wwra4e359dL6M5Okg40c9mUnjDdMS1VzJfu4jj0rAkvgEHLpVx2zmKyKnl KYTQ== X-Gm-Message-State: AOAM530AC+UcdWE8MrAsv1weLMPlL7XF47DtMmMdUohhyWeuBQN+Nh4X pE5herADHWOxfgIogESNxhJLwQ== X-Google-Smtp-Source: ABdhPJz7TwoVvVpbGA4bqbTOwnQj4Q0UDCsunLiUBQEUrWd8K6cpvy/AslaHNQRurgVp+feNQF2Vow== X-Received: by 2002:aa7:8201:0:b029:27b:9b59:8676 with SMTP id k1-20020aa782010000b029027b9b598676mr26655853pfi.47.1621900961353; Mon, 24 May 2021 17:02:41 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:41 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Laurent Pinchart , Rob Herring , Sandeep Panda , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 03/11] dt-bindings: drm/bridge: ti-sn65dsi86: Add aux-bus child Date: Mon, 24 May 2021 17:01:51 -0700 Message-Id: <20210524165920.v8.3.I98bf729846c37c4c143f6ab88b1e299280e2fe26@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The patch ("dt-bindings: drm: Introduce the DP AUX bus") talks about how using the DP AUX bus is better than learning how to slice bread. Let's add it to the ti-sn65dsi86 bindings. Signed-off-by: Douglas Anderson Reviewed-by: Rob Herring --- Changes in v8: - ti-sn65dsi86 references the new aux bus bindings. Changes in v7: - ti-sn65dsi86: Add aux-bus child patch new for v7. .../bindings/display/bridge/ti,sn65dsi86.yaml | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml index 26932d2e86ab..4007f36d04ba 100644 --- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml @@ -70,6 +70,9 @@ properties: const: 1 description: See ../../pwm/pwm.yaml for description of the cell formats. + aux-bus: + $ref: ../dp-aux-bus.yaml# + ports: $ref: /schemas/graph.yaml#/properties/ports @@ -201,11 +204,26 @@ examples: port@1 { reg = <1>; - endpoint { + sn65dsi86_out: endpoint { remote-endpoint = <&panel_in_edp>; }; }; }; + + aux-bus { + panel { + compatible = "boe,nv133fhm-n62"; + power-supply = <&pp3300_dx_edp>; + backlight = <&backlight>; + hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>; + + port { + panel_in_edp: endpoint { + remote-endpoint = <&sn65dsi86_out>; + }; + }; + }; + }; }; }; - | From patchwork Tue May 25 00:01:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 447435 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.1 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 0D7E9C47087 for ; Tue, 25 May 2021 00:02:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4C9E6141F for ; Tue, 25 May 2021 00:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbhEYAET (ORCPT ); Mon, 24 May 2021 20:04:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229983AbhEYAEM (ORCPT ); Mon, 24 May 2021 20:04:12 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FE05C06138A for ; Mon, 24 May 2021 17:02:43 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id 69so15445936plc.5 for ; Mon, 24 May 2021 17:02:43 -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=W9Fdpfj9PL4rvEigmb2QGhmwBANHPAlZSGnNvCdFiZM=; b=ZPl93bbbxQFUkDwjKcmU98GmeBrylXCNPRli/XHIx3pbVK62kq/iQdMuWLu6LZFEnf zRqfB+dYNMxsnhABbMeRlPT4j9wT29e5h54MD2dwAa9cZptK1E98OWj9Td7NExrV0yJM IktKCVr6X1wGQXA9YvDNTr6sDvOI8BYtm1Jlc= 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=W9Fdpfj9PL4rvEigmb2QGhmwBANHPAlZSGnNvCdFiZM=; b=BeQ1dcHkLa6/TKsNvEGYGe04QsdP8MWIVEwxHuz+YS8c96o1nkeSuHZlcQls0ADvO5 x5fp5ywm4JSLOTmPyHMKW3+iHqpCU673aBS+Dc4dw8GoomV6uVnaKIZHYd67JTW64Xgl regOq+jfMJPT8lIhMmpwKfZ4yDXB6zXjooMkZ6+N0LJ3qhRmQ/2YycXCESyrb3IGESY6 z8rixP8ZH3T7+NkYqnni+n5FVua/kVhW7Lxo5iMjv5hmPOcUhHKOaiaPPYbBLZxE93d8 tnJz0lLF0K67YSDtMX2sJtE1oyu4bSDvP9s1ER4b1QkWzwTAytZJMVp+lc6KFpEPrbuI ik/Q== X-Gm-Message-State: AOAM531BnWYOSpXoPa3L0r11eY0S2KA/LscMqYru6YpRwe5bDBpWbnn5 BIIcNGLmLGMRhKupkygSIRDung== X-Google-Smtp-Source: ABdhPJzEA6lrzK1TzhErfu2B21yXgIxTQg8HxrClwB7kEktuahte8BwRcwy/TibwPGUVkNDM7PvZAw== X-Received: by 2002:a17:902:d643:b029:ef:62cd:eeed with SMTP id y3-20020a170902d643b02900ef62cdeeedmr28061200plh.42.1621900963170; Mon, 24 May 2021 17:02:43 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:42 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 04/11] dt-bindings: drm/aux-bus: Add an example Date: Mon, 24 May 2021 17:01:52 -0700 Message-Id: <20210524165920.v8.4.I79c7ed8815a07d285dd3b38e680e980d1024dbf1@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-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 an eDP controller that lists aux-bus, we can safely add an example to the aux-bus bindings. NOTE: this example is just a copy of the one in the 'ti-sn65dsi86' one. It feels useful to have the example in both places simply because it's important to document the interaction between the two bindings in both places. Signed-off-by: Douglas Anderson Reviewed-by: Linus Walleij --- Changes in v8: - Separate DP AUX bus binding is new for v8. .../bindings/display/dp-aux-bus.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/Documentation/devicetree/bindings/display/dp-aux-bus.yaml b/Documentation/devicetree/bindings/display/dp-aux-bus.yaml index 5e4afe9f98fb..43494d2a32a1 100644 --- a/Documentation/devicetree/bindings/display/dp-aux-bus.yaml +++ b/Documentation/devicetree/bindings/display/dp-aux-bus.yaml @@ -35,3 +35,68 @@ additionalProperties: false required: - panel + +examples: + - | + #include + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + bridge@2d { + compatible = "ti,sn65dsi86"; + reg = <0x2d>; + + interrupt-parent = <&tlmm>; + interrupts = <10 IRQ_TYPE_LEVEL_HIGH>; + + enable-gpios = <&tlmm 102 GPIO_ACTIVE_HIGH>; + + vpll-supply = <&src_pp1800_s4a>; + vccio-supply = <&src_pp1800_s4a>; + vcca-supply = <&src_pp1200_l2a>; + vcc-supply = <&src_pp1200_l2a>; + + clocks = <&rpmhcc RPMH_LN_BB_CLK2>; + clock-names = "refclk"; + + no-hpd; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + endpoint { + remote-endpoint = <&dsi0_out>; + }; + }; + + port@1 { + reg = <1>; + sn65dsi86_out: endpoint { + remote-endpoint = <&panel_in_edp>; + }; + }; + }; + + aux-bus { + panel { + compatible = "boe,nv133fhm-n62"; + power-supply = <&pp3300_dx_edp>; + backlight = <&backlight>; + hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>; + + port { + panel_in_edp: endpoint { + remote-endpoint = <&sn65dsi86_out>; + }; + }; + }; + }; + }; + }; From patchwork Tue May 25 00:01:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 446508 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.1 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 EEF16C2B9F8 for ; Tue, 25 May 2021 00:03:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5C7B6141F for ; Tue, 25 May 2021 00:03:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbhEYAE0 (ORCPT ); Mon, 24 May 2021 20:04:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbhEYAEP (ORCPT ); Mon, 24 May 2021 20:04:15 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9915FC061347 for ; Mon, 24 May 2021 17:02:45 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id 22so21777765pfv.11 for ; Mon, 24 May 2021 17:02:45 -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=bqTY4tqGjayWhY/DXUsczhAheRtXBqL5Ex8LDoNIfzQ=; b=e+SMWIrYJyeNXzUgh+zEBel83TEDszwP5MpQ13btqhW1YV+4H25dMNWiDMm43Gj2df Bm1XDSByltQH3UYJxiNZGo+qUnUX8QmykOGQRFyMlqF4ya9gseIsgENiUPAJC6myncwy 7sNSuM04EAxSFjkUjXYyHZx8ZA9F8b5iPUb+E= 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=bqTY4tqGjayWhY/DXUsczhAheRtXBqL5Ex8LDoNIfzQ=; b=Ie0Ao56BcGyCSycWGFdhgzKesfbMWU2oeS0xeS6fKj6ucn+V+oK6J/sl42Ec6pQNn0 C/6IFXENpM/WbOZ15jKNRdXpZcL8vze2YBbuisNrx/yYaU3alJz9Jq4JbPT5jvjd+3p5 KtL6mmV+mc/3Q+o/g34b4yRCrR9w/9fSx6S/dy47qDTiCPQzJl7Sizkyoc+981SigASL BTlaRQljkjYcrFbQnnBtrRDRART7RnJGewUxgAb2r4BqSD2bOpPUnS0HsbQf5rbjkPUp EltA5cv43Mz4q+muv1voQepQsLZA4+XDZUSlHozHzpjvmSvfaxOl3EdB3bvL96TsH/1T xU2Q== X-Gm-Message-State: AOAM5313wEqkGo4yQatPP0vzBhgB8xzWZ6Rq5naLMcM+mri5Qr4Y39CA bKLdi7cGKHX3RJ9lX3FZSJpkug== X-Google-Smtp-Source: ABdhPJx3To4mWmdLgnPfyZ/KaZwqs/m8VhltZTUBRfaxIzB5R52MMVcPEAC77+FIVhrfi3rqguL5NA== X-Received: by 2002:a62:7652:0:b029:2d9:4602:7292 with SMTP id r79-20020a6276520000b02902d946027292mr27702259pfc.52.1621900965090; Mon, 24 May 2021 17:02:45 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:44 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Laurent Pinchart , Rajeev Nandan , Daniel Vetter , David Airlie , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v8 05/11] drm: Introduce the DP AUX bus Date: Mon, 24 May 2021 17:01:53 -0700 Message-Id: <20210524165920.v8.5.I787c9ba09ed5ce12500326ded73a4f7c9265b1b3@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Historically "simple" eDP panels have been handled by panel-simple which is a basic platform_device. In the device tree, the panel node was at the top level and not connected to anything else. Let's change it so that, instead, panels can be represented as being children of the "DP AUX bus". Essentially we're saying that the hierarchy that we're going to represent is the "control" connections between devices. The DP AUX bus is a control bus provided by an eDP controller (the parent) and consumed by a device like a panel (the child). The primary incentive here is to cleanly provide the panel driver the ability to communicate over the AUX bus while handling lifetime issues properly. The panel driver may want the AUX bus for controlling the backlight or querying the panel's EDID. The idea for this bus's design was hashed out over IRC [1]. [1] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2021-05-11 Cc: Laurent Pinchart Cc: Lyude Paul Cc: Rajeev Nandan Suggested-by: Laurent Pinchart Signed-off-by: Douglas Anderson Acked-by: Linus Walleij --- There's a whole lot of boilerplate code here. I've tried my best to grok what all of it should be, drawing inspiration from other similar bus drivers (auxiliary, i2c, serdev, platform) and I've tried to test several of the corner cases, but I can't actually believe that I've touched every code path. Please yell if you see something dumb. Changes in v8: - Allow dp-aux-bus to be a module to fix allmodconfig builds Changes in v7: - Patch introducing the DP AUX bus is new for v7. drivers/gpu/drm/Kconfig | 5 + drivers/gpu/drm/Makefile | 2 + drivers/gpu/drm/drm_dp_aux_bus.c | 326 +++++++++++++++++++++++++++++++ include/drm/drm_dp_aux_bus.h | 57 ++++++ 4 files changed, 390 insertions(+) create mode 100644 drivers/gpu/drm/drm_dp_aux_bus.c create mode 100644 include/drm/drm_dp_aux_bus.h diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index d3a9ca4b1cec..be5c82e55ef6 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -35,6 +35,11 @@ config DRM_MIPI_DSI bool depends on DRM +config DRM_DP_AUX_BUS + tristate + depends on DRM + depends on OF + config DRM_DP_AUX_CHARDEV bool "DRM DP AUX Interface" depends on DRM diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index a91cc7684904..0cff2ad2973b 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -33,6 +33,8 @@ drm-$(CONFIG_PCI) += drm_pci.o drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o +obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o + drm_vram_helper-y := drm_gem_vram_helper.o obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o diff --git a/drivers/gpu/drm/drm_dp_aux_bus.c b/drivers/gpu/drm/drm_dp_aux_bus.c new file mode 100644 index 000000000000..d0e44de287d4 --- /dev/null +++ b/drivers/gpu/drm/drm_dp_aux_bus.c @@ -0,0 +1,326 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2021 Google Inc. + * + * The DP AUX bus is used for devices that are connected over a DisplayPort + * AUX bus. The devices on the far side of the bus are referred to as + * endpoints in this code. + * + * Commonly there is only one device connected to the DP AUX bus: a panel. + * Though historically panels (even DP panels) have been modeled as simple + * platform devices, putting them under the DP AUX bus allows the panel driver + * to perform transactions on that bus. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + + +/** + * dp_aux_ep_match() - The match function for the dp_aux_bus. + * @dev: The device to match. + * @drv: The driver to try to match against. + * + * At the moment, we just match on device tree. + * + * Return: True if this driver matches this device; false otherwise. + */ +static int dp_aux_ep_match(struct device *dev, struct device_driver *drv) +{ + return !!of_match_device(drv->of_match_table, dev); +} + +/** + * dp_aux_ep_probe() - The probe function for the dp_aux_bus. + * @dev: The device to probe. + * + * Calls through to the endpoint driver probe. + * + * Return: 0 if no error or negative error code. + */ +static int dp_aux_ep_probe(struct device *dev) +{ + struct dp_aux_ep_driver *aux_ep_drv = to_dp_aux_ep_drv(dev->driver); + struct dp_aux_ep_device *aux_ep = to_dp_aux_ep_dev(dev); + int ret; + + ret = dev_pm_domain_attach(dev, true); + if (ret) + return dev_err_probe(dev, ret, "Failed to attach to PM Domain\n"); + + ret = aux_ep_drv->probe(aux_ep); + if (ret) + dev_pm_domain_detach(dev, true); + + return ret; +} + +/** + * dp_aux_ep_remove() - The remove function for the dp_aux_bus. + * @dev: The device to remove. + * + * Calls through to the endpoint driver remove. + * + * Return: 0 if no error or negative error code. + */ +static int dp_aux_ep_remove(struct device *dev) +{ + struct dp_aux_ep_driver *aux_ep_drv = to_dp_aux_ep_drv(dev->driver); + struct dp_aux_ep_device *aux_ep = to_dp_aux_ep_dev(dev); + + if (aux_ep_drv->remove) + aux_ep_drv->remove(aux_ep); + dev_pm_domain_detach(dev, true); + + return 0; +} + +/** + * dp_aux_ep_shutdown() - The shutdown function for the dp_aux_bus. + * @dev: The device to shutdown. + * + * Calls through to the endpoint driver shutdown. + */ +static void dp_aux_ep_shutdown(struct device *dev) +{ + struct dp_aux_ep_driver *aux_ep_drv; + + if (!dev->driver) + return; + + aux_ep_drv = to_dp_aux_ep_drv(dev->driver); + if (aux_ep_drv->shutdown) + aux_ep_drv->shutdown(to_dp_aux_ep_dev(dev)); +} + +static struct bus_type dp_aux_bus_type = { + .name = "dp-aux", + .match = dp_aux_ep_match, + .probe = dp_aux_ep_probe, + .remove = dp_aux_ep_remove, + .shutdown = dp_aux_ep_shutdown, +}; + +static ssize_t modalias_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return of_device_modalias(dev, buf, PAGE_SIZE); +} +static DEVICE_ATTR_RO(modalias); + +static struct attribute *dp_aux_ep_dev_attrs[] = { + &dev_attr_modalias.attr, + NULL, +}; +ATTRIBUTE_GROUPS(dp_aux_ep_dev); + +/** + * dp_aux_ep_dev_release() - Free memory for the dp_aux_ep device + * @dev: The device to free. + * + * Return: 0 if no error or negative error code. + */ +static void dp_aux_ep_dev_release(struct device *dev) +{ + kfree(to_dp_aux_ep_dev(dev)); +} + +static struct device_type dp_aux_device_type_type = { + .groups = dp_aux_ep_dev_groups, + .uevent = of_device_uevent_modalias, + .release = dp_aux_ep_dev_release, +}; + +/** + * of_dp_aux_ep_destroy() - Destroy an DP AUX endpoint device + * @dev: The device to destroy. + * @data: Not used + * + * This is just used as a callback by of_dp_aux_depopulate_ep_devices() and + * is called for _all_ of the child devices of the device providing the AUX bus. + * We'll only act on those that are of type "dp_aux_bus_type". + * + * This function is effectively an inverse of what's in the loop + * in of_dp_aux_populate_ep_devices(). + * + * Return: 0 if no error or negative error code. + */ +static int of_dp_aux_ep_destroy(struct device *dev, void *data) +{ + struct device_node *np = dev->of_node; + + if (dev->bus != &dp_aux_bus_type) + return 0; + + if (!of_node_check_flag(np, OF_POPULATED)) + return 0; + + of_node_clear_flag(np, OF_POPULATED); + of_node_put(np); + + device_unregister(dev); + + return 0; +} + +/** + * of_dp_aux_depopulate_ep_devices() - Undo of_dp_aux_populate_ep_devices + * @aux: The AUX channel whose devices we want to depopulate + * + * This will destroy all devices that were created + * by of_dp_aux_populate_ep_devices(). + */ +void of_dp_aux_depopulate_ep_devices(struct drm_dp_aux *aux) +{ + device_for_each_child_reverse(aux->dev, NULL, of_dp_aux_ep_destroy); +} +EXPORT_SYMBOL_GPL(of_dp_aux_depopulate_ep_devices); + +/** + * of_dp_aux_populate_ep_devices() - Populate the endpoint devices on the DP AUX + * @aux: The AUX channel whose devices we want to populate. It is required that + * drm_dp_aux_init() has already been called for this AUX channel. + * + * This will populate all the devices under the "aux-bus" node of the device + * providing the AUX channel (AKA aux->dev). + * + * When this function finishes, it is _possible_ (but not guaranteed) that + * our sub-devices will have finished probing. It should be noted that if our + * sub-devices return -EPROBE_DEFER that we will not return any error codes + * ourselves but our sub-devices will _not_ have actually probed successfully + * yet. There may be other cases (maybe added in the future?) where sub-devices + * won't have been probed yet when this function returns, so it's best not to + * rely on that. + * + * If this function succeeds you should later make sure you call + * of_dp_aux_depopulate_ep_devices() to undo it, or just use the devm version + * of this function. + * + * Return: 0 if no error or negative error code. + */ +int of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux) +{ + struct device_node *bus, *np; + struct dp_aux_ep_device *aux_ep; + int ret; + + /* drm_dp_aux_init() should have been called already; warn if not */ + WARN_ON_ONCE(!aux->ddc.algo); + + if (!aux->dev->of_node) + return 0; + + bus = of_get_child_by_name(aux->dev->of_node, "aux-bus"); + if (!bus) + return 0; + + for_each_available_child_of_node(bus, np) { + if (of_node_test_and_set_flag(np, OF_POPULATED)) + continue; + + aux_ep = kzalloc(sizeof(*aux_ep), GFP_KERNEL); + aux_ep->aux = aux; + + aux_ep->dev.parent = aux->dev; + aux_ep->dev.bus = &dp_aux_bus_type; + aux_ep->dev.type = &dp_aux_device_type_type; + aux_ep->dev.of_node = of_node_get(np); + dev_set_name(&aux_ep->dev, "aux-%s", dev_name(aux->dev)); + + ret = device_register(&aux_ep->dev); + if (ret) { + dev_err(aux->dev, "Failed to create AUX EP for %pOF: %d\n", np, ret); + of_node_clear_flag(np, OF_POPULATED); + of_node_put(np); + + /* + * As per docs of device_register(), call this instead + * of kfree() directly for error cases. + */ + put_device(&aux_ep->dev); + + /* + * Following in the footsteps of of_i2c_register_devices(), + * we won't fail the whole function here--we'll just + * continue registering any other devices we find. + */ + } + } + + of_node_put(bus); + + return 0; +} + +static void of_dp_aux_depopulate_ep_devices_void(void *data) +{ + of_dp_aux_depopulate_ep_devices(data); +} + +/** + * devm_of_dp_aux_populate_ep_devices() - devm wrapper for of_dp_aux_populate_ep_devices() + * @aux: The AUX channel whose devices we want to populate + * + * Handles freeing w/ devm on the device "aux->dev". + * + * Return: 0 if no error or negative error code. + */ +int devm_of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux) +{ + int ret; + + ret = of_dp_aux_populate_ep_devices(aux); + if (ret) + return ret; + + return devm_add_action_or_reset(aux->dev, + of_dp_aux_depopulate_ep_devices_void, + aux); +} +EXPORT_SYMBOL_GPL(devm_of_dp_aux_populate_ep_devices); + +int __dp_aux_dp_driver_register(struct dp_aux_ep_driver *drv, struct module *owner) +{ + drv->driver.owner = owner; + drv->driver.bus = &dp_aux_bus_type; + + return driver_register(&drv->driver); + +} +EXPORT_SYMBOL_GPL(__dp_aux_dp_driver_register); + +void dp_aux_dp_driver_unregister(struct dp_aux_ep_driver *drv) +{ + driver_unregister(&drv->driver); +} +EXPORT_SYMBOL_GPL(dp_aux_dp_driver_unregister); + +static int __init dp_aux_bus_init(void) +{ + int ret; + + ret = bus_register(&dp_aux_bus_type); + if (ret) + return ret; + + return 0; +} + +static void __exit dp_aux_bus_exit(void) +{ + bus_unregister(&dp_aux_bus_type); +} + +subsys_initcall(dp_aux_bus_init); +module_exit(dp_aux_bus_exit); + +MODULE_AUTHOR("Douglas Anderson "); +MODULE_DESCRIPTION("DRM DisplayPort AUX bus"); +MODULE_LICENSE("GPL v2"); diff --git a/include/drm/drm_dp_aux_bus.h b/include/drm/drm_dp_aux_bus.h new file mode 100644 index 000000000000..4f19b20b1dd6 --- /dev/null +++ b/include/drm/drm_dp_aux_bus.h @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2021 Google Inc. + * + * The DP AUX bus is used for devices that are connected over a DisplayPort + * AUX bus. The devices on the far side of the bus are referred to as + * endpoints in this code. + */ + +#ifndef _DP_AUX_BUS_H_ +#define _DP_AUX_BUS_H_ + +#include +#include + +/** + * struct dp_aux_ep_device - Main dev structure for DP AUX endpoints + * + * This is used to instantiate devices that are connected via a DP AUX + * bus. Usually the device is a panel, but conceivable other devices could + * be hooked up there. + */ +struct dp_aux_ep_device { + /** @dev: The normal dev pointer */ + struct device dev; + /** @aux: Pointer to the aux bus */ + struct drm_dp_aux *aux; +}; + +struct dp_aux_ep_driver { + int (*probe)(struct dp_aux_ep_device *aux_ep); + void (*remove)(struct dp_aux_ep_device *aux_ep); + void (*shutdown)(struct dp_aux_ep_device *aux_ep); + struct device_driver driver; +}; + +static inline struct dp_aux_ep_device *to_dp_aux_ep_dev(struct device *dev) +{ + return container_of(dev, struct dp_aux_ep_device, dev); +} + +static inline struct dp_aux_ep_driver *to_dp_aux_ep_drv(struct device_driver *drv) +{ + return container_of(drv, struct dp_aux_ep_driver, driver); +} + +int of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux); +void of_dp_aux_depopulate_ep_devices(struct drm_dp_aux *aux); +int devm_of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux); + +#define dp_aux_dp_driver_register(aux_ep_drv) \ + __dp_aux_dp_driver_register(aux_ep_drv, THIS_MODULE) +int __dp_aux_dp_driver_register(struct dp_aux_ep_driver *aux_ep_drv, + struct module *owner); +void dp_aux_dp_driver_unregister(struct dp_aux_ep_driver *aux_ep_drv); + +#endif /* _DP_AUX_BUS_H_ */ From patchwork Tue May 25 00:01:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 447434 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.1 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 12E5FC2B9F8 for ; Tue, 25 May 2021 00:03:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBC0561400 for ; Tue, 25 May 2021 00:03:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbhEYAE3 (ORCPT ); Mon, 24 May 2021 20:04:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbhEYAER (ORCPT ); Mon, 24 May 2021 20:04:17 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AACBC061342 for ; Mon, 24 May 2021 17:02:47 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id j12so21302739pgh.7 for ; Mon, 24 May 2021 17:02:47 -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=ONlP6+gSkJuweEz0JsYlBcsxQlrl6J2nKtwaKsr8Z8Y=; b=YcuBLrvkRDE0AgUOrrBPNrOpBX2u2k1iQqa9PfHwvLAViUvOXdYNa30Kbmvt2Xdfwg ApnJHOW/E0Irt7iOdqGcPT3NUn4YFRVnu08pcEF9EQ1hgYDMOE8m+AOIiE21oX57NcZV PuiZ5APw0zluZB63VOpFg1o/W6Qv8dzW4fsnk= 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=ONlP6+gSkJuweEz0JsYlBcsxQlrl6J2nKtwaKsr8Z8Y=; b=Mm40vNpfRB+Uj4usSNcWyjTOTOSeBPlEFO991cF6z6jJlI9312SitntrN+H/eQk6Sy orlFQKNMTz9+L99RFZQXV/BAlUaCEufX1oXyGaZIhoAtLWVLwUVd0i3RWSfmV1luVuS5 3urXErOiWRjVCJD/DSlel6TiUuy278z09I2+5/n86payuFP6HcErQWqGH5YlKaVKKUlV yfnESRPp5HhXbK4nduVTMrUFpAdrAQ0DQfsxVCXGoFazpOqAAn1MUnDik4ER8qsrXG54 1FgPwK6FL/GO90YAGnZ8sx1Iz5S3M7WiJ8ED3GOKudepZexNAdxgQEnZY1zfTIjbjF0N FfEQ== X-Gm-Message-State: AOAM533/I1qetmT0B9UEv/koNvOufGIFYMjhYVyysfxBKU0aC9WNyNXs yNspGoXxlNkk0GnZPbHvBnVkLQ== X-Google-Smtp-Source: ABdhPJy4NR41GJd99X4lvXJNC6dficjAkNhXr9PFTIDipvOLbS4rEl5uyT19pS0//YLxOPyUNm7x4Q== X-Received: by 2002:aa7:8b56:0:b029:2b9:77be:d305 with SMTP id i22-20020aa78b560000b02902b977bed305mr27588027pfd.61.1621900966895; Mon, 24 May 2021 17:02:46 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:46 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Thierry Reding , linux-kernel@vger.kernel.org Subject: [PATCH v8 06/11] drm/panel: panel-simple: Allow panel-simple be a DP AUX endpoint device Date: Mon, 24 May 2021 17:01:54 -0700 Message-Id: <20210524165920.v8.6.Iada41f76a7342354bae929d0bb3ceba40f27f0ea@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The panel-simple driver can already have devices instantiated as platform devices or MIPI DSI devices. Let's add a 3rd way to instantiate it: as DP AUX endpoint devices. At the moment there is no benefit to instantiating it in this way, but: - In the next patch we'll give it access to the DDC channel via the DP AUX bus. - Possibly in the future we may use this channel to configure the backlight. Signed-off-by: Douglas Anderson Reviewed-by: Lyude Paul --- (no changes since v7) Changes in v7: - Patch to allow panel-simple to be DP AUX EP new for v7. drivers/gpu/drm/panel/Kconfig | 1 + drivers/gpu/drm/panel/panel-simple.c | 52 +++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index ef87d92cdf49..b1ea86d9fdaf 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -82,6 +82,7 @@ config DRM_PANEL_SIMPLE depends on BACKLIGHT_CLASS_DEVICE depends on PM select VIDEOMODE_HELPERS + select DRM_DP_AUX_BUS help DRM panel driver for dumb panels that need at most a regulator and a GPIO to be powered up. Optionally a backlight can be attached so diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 21939d4352cf..d3b5ae22d939 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -4957,6 +4958,38 @@ static struct mipi_dsi_driver panel_simple_dsi_driver = { .shutdown = panel_simple_dsi_shutdown, }; +static int panel_simple_dp_aux_ep_probe(struct dp_aux_ep_device *aux_ep) +{ + const struct of_device_id *id; + + id = of_match_node(platform_of_match, aux_ep->dev.of_node); + if (!id) + return -ENODEV; + + return panel_simple_probe(&aux_ep->dev, id->data); +} + +static void panel_simple_dp_aux_ep_remove(struct dp_aux_ep_device *aux_ep) +{ + panel_simple_remove(&aux_ep->dev); +} + +static void panel_simple_dp_aux_ep_shutdown(struct dp_aux_ep_device *aux_ep) +{ + panel_simple_shutdown(&aux_ep->dev); +} + +static struct dp_aux_ep_driver panel_simple_dp_aux_ep_driver = { + .driver = { + .name = "panel-simple-dp-aux", + .of_match_table = platform_of_match, /* Same as platform one! */ + .pm = &panel_simple_pm_ops, + }, + .probe = panel_simple_dp_aux_ep_probe, + .remove = panel_simple_dp_aux_ep_remove, + .shutdown = panel_simple_dp_aux_ep_shutdown, +}; + static int __init panel_simple_init(void) { int err; @@ -4965,15 +4998,25 @@ static int __init panel_simple_init(void) if (err < 0) return err; + err = dp_aux_dp_driver_register(&panel_simple_dp_aux_ep_driver); + if (err < 0) + goto err_did_platform_register; + if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) { err = mipi_dsi_driver_register(&panel_simple_dsi_driver); - if (err < 0) { - platform_driver_unregister(&panel_simple_platform_driver); - return err; - } + if (err < 0) + goto err_did_aux_ep_register; } return 0; + +err_did_aux_ep_register: + dp_aux_dp_driver_unregister(&panel_simple_dp_aux_ep_driver); + +err_did_platform_register: + platform_driver_unregister(&panel_simple_platform_driver); + + return err; } module_init(panel_simple_init); @@ -4982,6 +5025,7 @@ static void __exit panel_simple_exit(void) if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) mipi_dsi_driver_unregister(&panel_simple_dsi_driver); + dp_aux_dp_driver_unregister(&panel_simple_dp_aux_ep_driver); platform_driver_unregister(&panel_simple_platform_driver); } module_exit(panel_simple_exit); From patchwork Tue May 25 00:01:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 446507 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.1 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 6470EC47084 for ; Tue, 25 May 2021 00:03:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46B8961400 for ; Tue, 25 May 2021 00:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230130AbhEYAEb (ORCPT ); Mon, 24 May 2021 20:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbhEYAES (ORCPT ); Mon, 24 May 2021 20:04:18 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05755C061756 for ; Mon, 24 May 2021 17:02:49 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id s4so13886678plg.12 for ; Mon, 24 May 2021 17:02:49 -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=cqAqRwR7SBxsh+J9doi3iCRwS47/W3pRYFT204VDP/E=; b=aky6HgwCtGIDItfr6KuzoZ0upAjHVKrEh+JvfnvsApKOugQWciumDUofZfKG1VsRXq hcqM/cTRtEc4o/W1Hzg+xWqziOn9l6ZI/rxCYqWNblFGhJAVxFSSkuoKp+rcNf7bRrrk 6pon/cL1JVkTyLF4oFbq3yflzkshG8WmCaJgE= 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=cqAqRwR7SBxsh+J9doi3iCRwS47/W3pRYFT204VDP/E=; b=knb8KHx0KxegQ568cmmQ//OhmfPHlR7V4DPIMg9a19MVLu9dZx/4PaddkzaJdE+TIk vnpR1dLf17kKuSkOiyEU7a0hcXxJak5cWU7MeaNsvhE2MtysBWUPvWcWoQG7XROJJ1OY +t7IjnCfc8YL+0J46rOes7Vke0KZ0Kp7QAVbW29DFQ6GWugmFoslEcldj4unT7J9Ndv4 Dftj0nZFr7ATcTDHB7pIPd6QOfP9l61b6x7rxhSnoqMecHi6t8/MNbMr7Cqh8sLjcfX3 nVYHBkftb3Wr0EvUPEXqMeGr4cq3IHfeUC9anYgyPCIjrychlMelYcyi7nYfVfZpSzX7 LvVw== X-Gm-Message-State: AOAM532Yn2+GclOtSVTVLk6lzn/PkB8VnJ9iAIUmruRp80H7+Pe9OTjD 87jEczxCz6dY3tklydVHI0yT6g== X-Google-Smtp-Source: ABdhPJwQurHGtBCZA9D6tZv5jfTQYbLsPFJeovBlZ7boNrmn1dHU7MRixgj/HpmlaV+hMrViAbGKDg== X-Received: by 2002:a17:90b:1e43:: with SMTP id pi3mr27838723pjb.51.1621900968554; Mon, 24 May 2021 17:02:48 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:48 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Thierry Reding , linux-kernel@vger.kernel.org Subject: [PATCH v8 07/11] drm/panel: panel-simple: Stash DP AUX bus; allow using it for DDC Date: Mon, 24 May 2021 17:01:55 -0700 Message-Id: <20210524165920.v8.7.I18e60221f6d048d14d6c50a770b15f356fa75092@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org If panel-simple is instantiated as a DP AUX bus endpoint then we have access to the DP AUX bus. Let's stash it in the panel-simple structure, leaving it NULL for the cases where the panel is instantiated in other ways. If we happen to have access to the DP AUX bus and we weren't provided the ddc-i2c-bus in some other manner, let's use the DP AUX bus for it. Signed-off-by: Douglas Anderson Reviewed-by: Lyude Paul --- (no changes since v7) Changes in v7: - Patch using the DP AUX for DDC new for v7. drivers/gpu/drm/panel/panel-simple.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index d3b5ae22d939..b09be6e5e147 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -186,6 +187,7 @@ struct panel_simple { struct regulator *supply; struct i2c_adapter *ddc; + struct drm_dp_aux *aux; struct gpio_desc *enable_gpio; struct gpio_desc *hpd_gpio; @@ -658,7 +660,8 @@ static void panel_simple_parse_panel_timing_node(struct device *dev, dev_err(dev, "Reject override mode: No display_timing found\n"); } -static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) +static int panel_simple_probe(struct device *dev, const struct panel_desc *desc, + struct drm_dp_aux *aux) { struct panel_simple *panel; struct display_timing dt; @@ -674,6 +677,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) panel->enabled = false; panel->prepared_time = 0; panel->desc = desc; + panel->aux = aux; panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd"); if (!panel->no_hpd) { @@ -708,6 +712,8 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) if (!panel->ddc) return -EPROBE_DEFER; + } else if (aux) { + panel->ddc = &aux->ddc; } if (desc == &panel_dpi) { @@ -4633,7 +4639,7 @@ static int panel_simple_platform_probe(struct platform_device *pdev) if (!id) return -ENODEV; - return panel_simple_probe(&pdev->dev, id->data); + return panel_simple_probe(&pdev->dev, id->data, NULL); } static int panel_simple_platform_remove(struct platform_device *pdev) @@ -4913,7 +4919,7 @@ static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi) desc = id->data; - err = panel_simple_probe(&dsi->dev, &desc->desc); + err = panel_simple_probe(&dsi->dev, &desc->desc, NULL); if (err < 0) return err; @@ -4966,7 +4972,7 @@ static int panel_simple_dp_aux_ep_probe(struct dp_aux_ep_device *aux_ep) if (!id) return -ENODEV; - return panel_simple_probe(&aux_ep->dev, id->data); + return panel_simple_probe(&aux_ep->dev, id->data, aux_ep->aux); } static void panel_simple_dp_aux_ep_remove(struct dp_aux_ep_device *aux_ep) From patchwork Tue May 25 00:01:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 447433 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.1 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 B37C8C47085 for ; Tue, 25 May 2021 00:03:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97083613E6 for ; Tue, 25 May 2021 00:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbhEYAEr (ORCPT ); Mon, 24 May 2021 20:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbhEYAEU (ORCPT ); Mon, 24 May 2021 20:04:20 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57C36C06134B for ; Mon, 24 May 2021 17:02:51 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id c17so22180322pfn.6 for ; Mon, 24 May 2021 17:02:51 -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=bVacWw+pBV6N4cjEwJbiSogxDZYj5fQG/Su+kSxhHCA=; b=AFV3vqi3gRL0IKPhBeQ1YpTOZfMUxaf3LMGZonJ7Qrhu4/iIPu7xpYsNH1jJTLmZJN xtbaS2xwn7Gkv8ROhyMvF3S5cjcrF36swbQP9XBbcgSDuDcPfTSGp2zvR2Xc7TIaN8CC Mctw8w1CStWyk0vBW9D6++SSnntEHh2vsIN3c= 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=bVacWw+pBV6N4cjEwJbiSogxDZYj5fQG/Su+kSxhHCA=; b=nFladVegJzCuVOfqwujCo9ZP7yxdOnKn484qVBaHouCIPsvxkic45/qDvvlZL+h+ki BUfaDPAz/rYZcvqtoa/SwADuaIo2nfF0vwQP9nfQ7moyH8iEYEwFTUgxKBNn4ANOeb3+ 9w0gppDtZTue95eo8opvTPI9w7cPu6gMy8Z+im4bCofZfV4VjWB4jc5iMyYQjrzpDHG4 wwPy0nck8QIuW78yyw44+9wFJNxV+xCEHbuDrUHN+7aOvFS2tQeSYycMv/Ag7PyXdkNl E0e8Ey+FDxthT4jqLf0P/dqTshgJ0lkGfWJXHylbjIAZhkgNGBvA1cTD/a/PiC2uhxP7 HKEg== X-Gm-Message-State: AOAM533LjmJDuAbs05f7IwkOL3MXtnXi/h19vlUuznSTpks0eZZRTXll xlgyMLmx2VdYC5oRj+b8lNiIxA== X-Google-Smtp-Source: ABdhPJxUdEUlDqNe7VfwhydKx8e3HYaLyTbJUXsL4q7sdb45KMmazYR5/1p8aAA3TeDWVXIUHiWdPg== X-Received: by 2002:a63:1054:: with SMTP id 20mr15897823pgq.120.1621900970498; Mon, 24 May 2021 17:02:50 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:50 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Jernej Skrabec , Robert Foss , linux-kernel@vger.kernel.org Subject: [PATCH v8 08/11] drm/bridge: ti-sn65dsi86: Promote the AUX channel to its own sub-dev Date: Mon, 24 May 2021 17:01:56 -0700 Message-Id: <20210524165920.v8.8.If89144992cb9d900f8c91a8d1817dbe00f543720@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On its own, this change looks a little strange and doesn't do too much useful. To understand why we're doing this we need to look forward to future patches where we're going to probe our panel using the new DP AUX bus. See the patch ("drm/bridge: ti-sn65dsi86: Add support for the DP AUX bus"). Let's think about the set of steps we'll want to happen when we have the DP AUX bus: 1. We'll create the DP AUX bus. 2. We'll populate the devices on the DP AUX bus (AKA our panel). 3. For setting up the bridge-related functions of ti-sn65dsi86 we'll need to get a reference to the panel. If we do #1 - #3 in a single probe call things _mostly_ will work, but it won't be massively robust. Let's explore. First let's think of the easy case of no -EPROBE_DEFER. In that case in step #2 when we populate the devices on the DP AUX bus it will actually try probing the panel right away. Since the panel probe doesn't defer then in step #3 we'll get a reference to the panel and we're golden. Second, let's think of the case when the panel returns -EPROBE_DEFER. In that case step #2 won't synchronously create the panel (it'll just add the device to the defer list to do it later). Step #3 will fail to get the panel and the bridge sub-device will return -EPROBE_DEFER. We'll depopulate the DP AUX bus. Later we'll try the whole sequence again. Presumably the panel will eventually stop returning -EPROBE_DEFER and we'll go back to the first case where things were golden. So this case is OK too even if it's a bit ugly that we have to keep creating / deleting the AUX bus over and over. So where is the problem? As I said, it's mostly about robustness. I don't believe that step #2 (creating the sub-devices) is really guaranteed to be synchronous. This is evidenced by the fact that it's allowed to "succeed" by just sticking the device on the deferred list. If anything about the process changes in Linux as a whole and step #2 just kicks off the probe of the DP AUX endpoints (our panel) in the background then we'd be in trouble because we might never get the panel in step #3. Adding an extra sub-device means we just don't need to worry about it. We'll create the sub-device for the DP AUX bus and it won't go away until the whole ti-sn65dsi86 driver goes away. If the bridge sub-device defers (maybe because it can't find the panel) that won't depopulate the DP AUX bus and so we don't need to worry about it. NOTE: there's a little bit of a trick here. Though the AUX channel can run without the MIPI-to-eDP bits of the code, the MIPI-to-eDP bits can't run without the AUX channel. We could come up a complicated signaling scheme (have the MIPI-to-eDP bits return EPROBE_DEFER for a while or wait on some sort of completion), but it seems simple enough to just not even bother creating the bridge device until the AUX channel probes. That's what we'll do. Signed-off-by: Douglas Anderson Reviewed-by: Lyude Paul --- (no changes since v7) Changes in v7: - Beefed up commit message in context of the DP AUX bus. - Remove use of now-dropped drm_dp_aux_register_ddc() call. - Set the proper sub-device "dev" pointer in the AUX structure. Changes in v6: - Use new drm_dp_aux_register_ddc() calls. drivers/gpu/drm/bridge/ti-sn65dsi86.c | 80 +++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 45a2969afb2b..1ea07d704705 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -116,6 +116,7 @@ * struct ti_sn65dsi86 - Platform data for ti-sn65dsi86 driver. * @bridge_aux: AUX-bus sub device for MIPI-to-eDP bridge functionality. * @gpio_aux: AUX-bus sub device for GPIO controller functionality. + * @aux_aux: AUX-bus sub device for eDP AUX channel functionality. * * @dev: Pointer to the top level (i2c) device. * @regmap: Regmap for accessing i2c. @@ -148,6 +149,7 @@ struct ti_sn65dsi86 { struct auxiliary_device bridge_aux; struct auxiliary_device gpio_aux; + struct auxiliary_device aux_aux; struct device *dev; struct regmap *regmap; @@ -1333,11 +1335,6 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev, if (ret) return ret; - pdata->aux.name = "ti-sn65dsi86-aux"; - pdata->aux.dev = pdata->dev; - pdata->aux.transfer = ti_sn_aux_transfer; - drm_dp_aux_init(&pdata->aux); - pdata->bridge.funcs = &ti_sn_bridge_funcs; pdata->bridge.of_node = np; @@ -1432,6 +1429,53 @@ static int ti_sn65dsi86_add_aux_device(struct ti_sn65dsi86 *pdata, return ret; } +static int ti_sn_aux_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) +{ + struct ti_sn65dsi86 *pdata = dev_get_drvdata(adev->dev.parent); + int ret; + + /* + * We couldn't do this pre-probe because it would confuse pinctrl. + * It would have tried to grab the same pins that the main device had. + * Set it now so that we can put the proper (sub) device in the aux + * structure and it will have the right node. + */ + adev->dev.of_node = pdata->dev->of_node; + + pdata->aux.name = "ti-sn65dsi86-aux"; + pdata->aux.dev = &adev->dev; + pdata->aux.transfer = ti_sn_aux_transfer; + drm_dp_aux_init(&pdata->aux); + + /* + * The eDP to MIPI bridge parts don't work until the AUX channel is + * setup so we don't add it in the main driver probe, we add it now. + */ + ret = ti_sn65dsi86_add_aux_device(pdata, &pdata->bridge_aux, "bridge"); + + /* + * Clear of_node on any errors. Really this only matters if the error + * is -EPROBE_DEFER to avoid (again) keep pinctrl from claiming when + * it tries the probe again, but it shouldn't hurt on any error. + */ + if (ret) + adev->dev.of_node = NULL; + + return ret; +} + +static const struct auxiliary_device_id ti_sn_aux_id_table[] = { + { .name = "ti_sn65dsi86.aux", }, + {}, +}; + +static struct auxiliary_driver ti_sn_aux_driver = { + .name = "aux", + .probe = ti_sn_aux_probe, + .id_table = ti_sn_aux_id_table, +}; + static int ti_sn65dsi86_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1490,10 +1534,11 @@ static int ti_sn65dsi86_probe(struct i2c_client *client, * motiviation here is to solve the chicken-and-egg problem of probe * ordering. The bridge wants the panel to be there when it probes. * The panel wants its HPD GPIO (provided by sn65dsi86 on some boards) - * when it probes. There will soon be other devices (DDC I2C bus, PWM) - * that have the same problem. Having sub-devices allows the some sub - * devices to finish probing even if others return -EPROBE_DEFER and - * gets us around the problems. + * when it probes. The panel and maybe backlight might want the DDC + * bus. Soon the PWM provided by the bridge chip will have the same + * problem. Having sub-devices allows the some sub devices to finish + * probing even if others return -EPROBE_DEFER and gets us around the + * problems. */ if (IS_ENABLED(CONFIG_OF_GPIO)) { @@ -1502,7 +1547,13 @@ static int ti_sn65dsi86_probe(struct i2c_client *client, return ret; } - return ti_sn65dsi86_add_aux_device(pdata, &pdata->bridge_aux, "bridge"); + /* + * NOTE: At the end of the AUX channel probe we'll add the aux device + * for the bridge. This is because the bridge can't be used until the + * AUX channel is there and this is a very simple solution to the + * dependency problem. + */ + return ti_sn65dsi86_add_aux_device(pdata, &pdata->aux_aux, "aux"); } static struct i2c_device_id ti_sn65dsi86_id[] = { @@ -1539,12 +1590,18 @@ static int __init ti_sn65dsi86_init(void) if (ret) goto err_main_was_registered; - ret = auxiliary_driver_register(&ti_sn_bridge_driver); + ret = auxiliary_driver_register(&ti_sn_aux_driver); if (ret) goto err_gpio_was_registered; + ret = auxiliary_driver_register(&ti_sn_bridge_driver); + if (ret) + goto err_aux_was_registered; + return 0; +err_aux_was_registered: + auxiliary_driver_unregister(&ti_sn_aux_driver); err_gpio_was_registered: ti_sn_gpio_unregister(); err_main_was_registered: @@ -1557,6 +1614,7 @@ module_init(ti_sn65dsi86_init); static void __exit ti_sn65dsi86_exit(void) { auxiliary_driver_unregister(&ti_sn_bridge_driver); + auxiliary_driver_unregister(&ti_sn_aux_driver); ti_sn_gpio_unregister(); i2c_del_driver(&ti_sn65dsi86_driver); } From patchwork Tue May 25 00:01:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 446506 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.1 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 7CAF2C47084 for ; Tue, 25 May 2021 00:03:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 678CC61057 for ; Tue, 25 May 2021 00:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230265AbhEYAEx (ORCPT ); Mon, 24 May 2021 20:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhEYAEX (ORCPT ); Mon, 24 May 2021 20:04:23 -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 D9D0AC06134F for ; Mon, 24 May 2021 17:02:52 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id n6-20020a17090ac686b029015d2f7aeea8so12203930pjt.1 for ; Mon, 24 May 2021 17:02:52 -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=/T35r9H/xYdI5Daj3afSSqWpMxR8pN+3BRmstBRd2eo=; b=XtJTTLAFoWjzdg0MeNYuiQac377tNakIga9O2eo1eKTa8+hf0jzBkj7TfYpMGXT/9c yWVh9Bqh6rd4c6lQvUcja9C8SSi70125WPI0n8Z+OZqxjVDyPZZZarT+YdaE/J5/4EI0 QChngXtryr++KD3aFI4F4hISiVpW27jfctnlg= 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=/T35r9H/xYdI5Daj3afSSqWpMxR8pN+3BRmstBRd2eo=; b=jLfEm20epq4JNjP1W++kiDLePCss/Moc7zqkK5CQ3qxgyMKRPEcQnSycxCuwzdJn+m zjmFDOYrFgmHKCVNPpjJnisUeCwJwGSsnIzkQO0Bd5F5aRWyeKgeBiKpytn9a2JRx2Iw 1/iBwFM6NTbfE3wWu2liMWbDkSJxUjxXg3B78DhfaylC0317lxVHJe3yI4kxzl3GF22u DIMVrNYDv1TKSTfRZZIGTxcLoB+t+cvESiM62Up3wKzFmYosp7Lz6hjk25phd0WurVfm qK4IFOxdBKqLSjIUjK5/DqkWWrK4MSi02+q7mRP7NPqv4ehduQhNitJGWya04R18s5d4 2u1A== X-Gm-Message-State: AOAM533O1spg6BifS8P9MEJYJWH4MDkmOYyfeK5xTqdlwSvu1rKK49FU 043ivWkkmUbPKUw3PKyCVeU+gQ== X-Google-Smtp-Source: ABdhPJygsw79I/6gDgsXc111IivaKqoEq603iWbw3jkbei76BrFXoUYpIE1evcNNxFoe9oHbDOi/Mw== X-Received: by 2002:a17:903:2312:b029:f0:cd8e:c843 with SMTP id d18-20020a1709032312b02900f0cd8ec843mr27708566plh.6.1621900972211; Mon, 24 May 2021 17:02:52 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:51 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Jernej Skrabec , Robert Foss , linux-kernel@vger.kernel.org Subject: [PATCH v8 09/11] drm/bridge: ti-sn65dsi86: Add support for the DP AUX bus Date: Mon, 24 May 2021 17:01:57 -0700 Message-Id: <20210524165920.v8.9.Ib5fe0638da85800141ce141bb8e441c5f25438d4@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We want to provide our panel with access to the DP AUX channel. The way to do this is to let our panel be a child of ours using the fancy new DP AUX bus support. Signed-off-by: Douglas Anderson Acked-by: Linus Walleij Reviewed-by: Lyude Paul --- (no changes since v7) Changes in v7: - Patch to support for DP AUX bus on ti-sn65dsi86 new for v7. drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/ti-sn65dsi86.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 7e7f28eb9546..a82952a85db4 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -292,6 +292,7 @@ config DRM_TI_SN65DSI86 select DRM_PANEL select DRM_MIPI_DSI select AUXILIARY_BUS + select DRM_DP_AUX_BUS help Texas Instruments SN65DSI86 DSI to eDP Bridge driver diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 1ea07d704705..5263206792f6 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1448,19 +1449,27 @@ static int ti_sn_aux_probe(struct auxiliary_device *adev, pdata->aux.transfer = ti_sn_aux_transfer; drm_dp_aux_init(&pdata->aux); + ret = devm_of_dp_aux_populate_ep_devices(&pdata->aux); + if (ret) + goto err; + /* * The eDP to MIPI bridge parts don't work until the AUX channel is * setup so we don't add it in the main driver probe, we add it now. */ ret = ti_sn65dsi86_add_aux_device(pdata, &pdata->bridge_aux, "bridge"); + if (ret) + goto err; + + return 0; +err: /* * Clear of_node on any errors. Really this only matters if the error * is -EPROBE_DEFER to avoid (again) keep pinctrl from claiming when * it tries the probe again, but it shouldn't hurt on any error. */ - if (ret) - adev->dev.of_node = NULL; + adev->dev.of_node = NULL; return ret; } From patchwork Tue May 25 00:01:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 447432 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.1 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 A1C95C2B9F8 for ; Tue, 25 May 2021 00:03:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81875613E6 for ; Tue, 25 May 2021 00:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230081AbhEYAFI (ORCPT ); Mon, 24 May 2021 20:05:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbhEYAE2 (ORCPT ); Mon, 24 May 2021 20:04:28 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4704CC06138F for ; Mon, 24 May 2021 17:02:54 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id ml1-20020a17090b3601b029015f9b1ebce0so2881044pjb.5 for ; Mon, 24 May 2021 17:02:54 -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=VG642XiPIrhSg91dKUHe6+GLs0ckaFTMQhwL7tvY4bg=; b=OkY29HZHat0AQRtLGeI/MZdbdm3GktcgWCM1ev4YHbx9Uow4RWiKsrboV2UWSY2bxi CrLb7CxaZFlYz25pyFwTAQb8IGSRw1EHN53sU/+e2sNW65F7kTFFeWPJzwQrENggUmZs fZV9A9uSSuTkzyL/OF2KlzCDJBJ4l17224jIA= 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=VG642XiPIrhSg91dKUHe6+GLs0ckaFTMQhwL7tvY4bg=; b=TLSU5fFmoYeFM2MSl4b5j1+W4DBRVMCkivoIW64A6B1EtEyLrIeO4NV3vJtzVCXsvH 45waVmXmIAok1Bsc3A76bYzsGK8+BD5PRGgu/U2HegoukeV34rrZ3UpsxybfU/f57ifJ BWYaMuorg4fbLXgY71vY8BgkS5QnwAdo/pxsqDvfTXpp2Xrgd0XW3br3T4fZ39kuf1Iv GQT5IEgssWwCIWbGv5EMC23Ej1wdcM2Hi2cwesU6AUfV9w1otPXieYN9KA85ed2rqVUE lC+I/ia8HwNHfQJkkAw7a+a7kLsgvTo0EKti3fcE2hQYqvbng+wt3EtW+ooasznrLhry hOXg== X-Gm-Message-State: AOAM532KaWagk0YsYEsErrBYsIFVpNwhsC2ZPPo0+x4JuGNe2nc7DwCt ZsSrx5XwXIagOFzr2Up6i7yQrA== X-Google-Smtp-Source: ABdhPJzt/q1SLUdgusC9g9GEJBytN/RWLJqF9WjNI2gRCXP+2W0YnOA9khIloFbX/FNQnvOXQ+mS4g== X-Received: by 2002:a17:90a:5d8e:: with SMTP id t14mr27224704pji.85.1621900973923; Mon, 24 May 2021 17:02:53 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:53 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Jernej Skrabec , Robert Foss , linux-kernel@vger.kernel.org Subject: [PATCH v8 10/11] drm/bridge: ti-sn65dsi86: Don't read EDID blob over DDC Date: Mon, 24 May 2021 17:01:58 -0700 Message-Id: <20210524165920.v8.10.I9330684c25f65bb318eff57f0616500f83eac3cc@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This is really just a revert of commit 58074b08c04a ("drm/bridge: ti-sn65dsi86: Read EDID blob over DDC"), resolving conflicts. The old code failed to read the EDID properly in a very important case: before the bridge's pre_enable() was called. The way things need to work: 1. Read the EDID. 2. Based on the EDID, decide on video settings and pixel clock. 3. Enable the bridge w/ the desired settings. The way things were working: 1. Try to read the EDID but fail; fall back to hardcoded values. 2. Based on hardcoded values, decide on video settings and pixel clock. 3. Enable the bridge w/ the desired settings. 4. Try again to read the EDID, it works now! 5. Realize that the hardcoded settings weren't quite right. 6. Disable / reenable the bridge w/ the right settings. The reasons for the failures were twofold: a) 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. b) Even if we fixed things to ignore HPD, the EDID still wouldn't read if the panel wasn't on. Instead of reverting the code, we could fix it to set the HPD bit and also power on the panel. However, it also works nicely to just let the panel code read the EDID. Now that we've split the driver up we can expose the DDC AUX channel bus to the panel node. The panel can take charge of reading the EDID. NOTE: in order for things to work, anyone that needs to read the EDID will need to instantiate their panel using the new DP AUX bus (AKA by listing their panel under the "aux-bus" node of the bridge chip in the device tree). In the future if we want to use the bridge chip to provide a full external DP port (which won't have a panel) then we will have to conditinally add EDID reading back in. Suggested-by: Andrzej Hajda Signed-off-by: Douglas Anderson Reviewed-by: Bjorn Andersson --- (no changes since v7) Changes in v7: - Adjusted commit message to talk about DP AUX bus. drivers/gpu/drm/bridge/ti-sn65dsi86.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 5263206792f6..b7453c80cdb8 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -126,7 +126,6 @@ * @connector: Our connector. * @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. @@ -157,7 +156,6 @@ struct ti_sn65dsi86 { struct drm_dp_aux aux; struct drm_bridge bridge; struct drm_connector connector; - struct edid *edid; struct device_node *host_node; struct mipi_dsi_device *dsi; struct clk *refclk; @@ -406,24 +404,6 @@ connector_to_ti_sn65dsi86(struct drm_connector *connector) static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector) { struct ti_sn65dsi86 *pdata = connector_to_ti_sn65dsi86(connector); - struct edid *edid = pdata->edid; - int num, ret; - - if (!edid) { - pm_runtime_get_sync(pdata->dev); - edid = pdata->edid = drm_get_edid(connector, &pdata->aux.ddc); - pm_runtime_put_autosuspend(pdata->dev); - } - - 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; - } - } - return drm_panel_get_modes(pdata->panel, connector); } @@ -1356,8 +1336,6 @@ static void ti_sn_bridge_remove(struct auxiliary_device *adev) mipi_dsi_device_unregister(pdata->dsi); } - kfree(pdata->edid); - drm_bridge_remove(&pdata->bridge); of_node_put(pdata->host_node); From patchwork Tue May 25 00:01:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 446505 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.1 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 61A77C2B9F8 for ; Tue, 25 May 2021 00:03:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CF6E61057 for ; Tue, 25 May 2021 00:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbhEYAFT (ORCPT ); Mon, 24 May 2021 20:05:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbhEYAEi (ORCPT ); Mon, 24 May 2021 20:04:38 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41319C061347 for ; Mon, 24 May 2021 17:02:56 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id q67so5123363pfb.4 for ; Mon, 24 May 2021 17:02:56 -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=3qFLOaUCi0WYGUyCmLqrEif6mRJ8u8fFU7Zgh2OGms8=; b=mG7J209zaQCJJxhHTB1kgkaUN3lotKNwZl1qpb1B/7puBZWLYE/M/Qfnt2cDUWNCig nQOFY4Tftu9/1Xin+yQPRW+462ofrPtvfh28OYEXR3PCHAZc0rU+82eOZNUDK/1bTBdB MCazDzs5CjxFNsJfJlRr+KIhYqs55qaaH5NAY= 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=3qFLOaUCi0WYGUyCmLqrEif6mRJ8u8fFU7Zgh2OGms8=; b=EpJjlmTyNFrRKjGRiQuRaaeXwylkcvcgdWA7SVWFXnFeyNmAr58oryu/DyQBEsIFQi mWlDNqvS1ZELCZ10KAGQZ8i3insdhW2waDdxDoj6G+D8KzuOLN+ffiSL/LC+cbQuWKmV tK8hfrmIKwt5GVjOrMu7Ef11U2DnOjxPxXmC1JM3oFwxc4YxJhT0y3Alzb3YkMDaghKi CJu58ierAKdHV5oeh7W/67/+Ry9F+VaFn4pEuhFcK8G2ZvveAVdAQ5f7FmfJGDGNNNDN 2fzX6eAWtrArFKtx9z3hgTBI2Av06yZBkkE76DHKTS8XJzI1y75C1UILR289K4gcRulr ad5Q== X-Gm-Message-State: AOAM531zX8MykByuMcUC4Vz/s1XO0gHVnaST0T1Pn4vA4EUyxgi9gMei 5tGPdaZHyHnENBiUwdOslR1LXg== X-Google-Smtp-Source: ABdhPJx5C+8zTuLTjxVJMS4EPDr7rRNr7Ky/FS6RudZXZZvp+t4FXELkMogHFv7NbjC/xJ97iP4p3w== X-Received: by 2002:a63:6f4e:: with SMTP id k75mr16304849pgc.434.1621900975692; Mon, 24 May 2021 17:02:55 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:26d1:4df0:7cdf:ce13]) by smtp.gmail.com with ESMTPSA id f18sm10696741pjh.55.2021.05.24.17.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 17:02:55 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: linux-arm-msm@vger.kernel.org, Linus W , Lyude Paul , Bjorn Andersson , Steev Klimaszewski , robdclark@chromium.org, Maarten Lankhorst , Thierry Reding , dri-devel@lists.freedesktop.org, Stanislav Lisovskiy , Stephen Boyd , Douglas Anderson , Andy Gross , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 11/11] arm64: dts: qcom: sc7180-trogdor: Move panel under the bridge chip Date: Mon, 24 May 2021 17:01:59 -0700 Message-Id: <20210524165920.v8.11.Ibdb7735fb1844561b902252215a69526a14f9abd@changeid> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210525000159.3384921-1-dianders@chromium.org> References: <20210525000159.3384921-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Putting the panel under the bridge chip (under the aux-bus node) allows the panel driver to get access to the DP AUX bus, enabling all sorts of fabulous new features. While we're at this, get rid of a level of hierarchy for the panel node. It doesn't need "ports / port" and can just have a "port" child. For Linux, this patch has a hard requirement on the patches adding DP AUX bus support to the ti-sn65dsi86 bridge chip driver. See the patch ("drm/bridge: ti-sn65dsi86: Add support for the DP AUX bus"). Signed-off-by: Douglas Anderson Acked-by: Linus Walleij --- (no changes since v7) Changes in v7: - Panel now under bridge chip instead of getting a link to ddc-i2c arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi index 24d293ef56d7..c76afd857b54 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi @@ -260,21 +260,6 @@ max98357a: audio-codec-0 { #sound-dai-cells = <0>; }; - panel: panel { - /* Compatible will be filled in per-board */ - power-supply = <&pp3300_dx_edp>; - backlight = <&backlight>; - hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>; - - ports { - port { - panel_in_edp: endpoint { - remote-endpoint = <&sn65dsi86_out>; - }; - }; - }; - }; - pwmleds { compatible = "pwm-leds"; keyboard_backlight: keyboard-backlight { @@ -674,6 +659,21 @@ sn65dsi86_out: endpoint { }; }; }; + + aux-bus { + panel: panel { + /* Compatible will be filled in per-board */ + power-supply = <&pp3300_dx_edp>; + backlight = <&backlight>; + hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>; + + port { + panel_in_edp: endpoint { + remote-endpoint = <&sn65dsi86_out>; + }; + }; + }; + }; }; };