From patchwork Mon Jun 7 17:05: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: 455449 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, 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 F2760C4743F for ; Mon, 7 Jun 2021 17:06:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D96DA6101A for ; Mon, 7 Jun 2021 17:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbhFGRI1 (ORCPT ); Mon, 7 Jun 2021 13:08:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231448AbhFGRIZ (ORCPT ); Mon, 7 Jun 2021 13:08:25 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BACCAC06178B for ; Mon, 7 Jun 2021 10:06:17 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id r1so14295517pgk.8 for ; Mon, 07 Jun 2021 10:06:17 -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=VRXNe2oDJn4wT5OJBJOLyBxBuxZlGLcl9ENnPPgLKPk=; b=OkmdLJvhXIXLKJoCVrXVxc5RYkvyMAg6zmrUupVVH9E3Nk2c1btyz7zDhEXOdXdRXT UWGdAmIejGafSF/IyTVHP4NNEnLRLkS1+Mkba2wv94LbN54WPOfdwsUq2NNaVa0R6NL6 zt2SCUbiHtjBTafVOoGoA96E1mIxBsLpWZq74= 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=VRXNe2oDJn4wT5OJBJOLyBxBuxZlGLcl9ENnPPgLKPk=; b=s7yYKfjvQAe2dl84OV1o5A6gWGYwVh6vvyWAIB6i5GMrFQCmXqbEQoUP33Sv04xyvc pHuNRA9XFWrEez5IjZmFCulnqCGucbqN8G/B7PWC5M/a5h7xI6Fzmd9g2/skKda1zIn+ eARpNKfgjk5L1iyMJngGcuoL3fRxC56cHnMhXO5tyfDEZzazNi22UakpYwfdNMB3C0MY kkZzA7r/hUITDr5IaWpKmlISjkqQUEtKbnNZW1VgKjnx4YAi38dqcDaiybBSFH31/BXC GzjCpgkAB1HvBATwfvRMmBhw6euRbzLEeAOz+s4OqRSBieJ4dFR7xlnkRtPGic2PAf5w xB2w== X-Gm-Message-State: AOAM531WK0Fem6/68kkrzMy/DS/caY1ginbHOd6TqKeWJhQTI6bUAIvE yb0ZZRfjLJUWp/j5MnVtwmfMBA== X-Google-Smtp-Source: ABdhPJxpq6X9P7SHMiEyqIpwGb/2S/gW3Uc2YoygXu+i/ugFbz64zcZ/cRusfBngEATD2ksy5s1VKA== X-Received: by 2002:a65:6a07:: with SMTP id m7mr18475877pgu.294.1623085577248; Mon, 07 Jun 2021 10:06:17 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f656:ffce:6348:a42a]) by smtp.gmail.com with ESMTPSA id fs24sm12897639pjb.6.2021.06.07.10.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:06:16 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: Linus W , robdclark@chromium.org, Maarten Lankhorst , Stanislav Lisovskiy , Steev Klimaszewski , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Thierry Reding , Lyude Paul , dri-devel@lists.freedesktop.org, Stephen Boyd , Douglas Anderson , Rob Herring , Daniel Vetter , David Airlie , Rob Herring , Thierry Reding , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 01/11] dt-bindings: display: simple: List hpd properties in panel-simple Date: Mon, 7 Jun 2021 10:05:45 -0700 Message-Id: <20210607100234.v9.1.Ieb731d23680db4700cc41fe51ccc73ba0b785fb7@changeid> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210607170555.4006050-1-dianders@chromium.org> References: <20210607170555.4006050-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 --- (no changes since v8) 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 Mon Jun 7 17:05:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 455447 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, 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 9EB07C4743F for ; Mon, 7 Jun 2021 17:07:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89EC460FF2 for ; Mon, 7 Jun 2021 17:07:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231685AbhFGRJK (ORCPT ); Mon, 7 Jun 2021 13:09:10 -0400 Received: from mail-pl1-f173.google.com ([209.85.214.173]:41888 "EHLO mail-pl1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231656AbhFGRJK (ORCPT ); Mon, 7 Jun 2021 13:09:10 -0400 Received: by mail-pl1-f173.google.com with SMTP id o12so5678416plk.8 for ; Mon, 07 Jun 2021 10:07: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=dQE2oc4ck1yBx8OjbWi1jB5697iDZ6Jcz+Jq90YnWDE=; b=BRHM24dXb9WdBH3AF7IEEdq5qZGZPbGeXoUVu78XEfchuxuyufLLfG7W4v0ZiQA8Dy i7nO9xhzjYiBMja5Zr43QEFJeeeqyYZErxY2sVXgFe8yqkhc4x4+r662ossOOHA56BS1 pRzPqoE6FFJ22C3liFwTJKwnKLckezI1tsHck= 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=dQE2oc4ck1yBx8OjbWi1jB5697iDZ6Jcz+Jq90YnWDE=; b=aZhrrIcGBESA2TvtEtSedYFH34nIwmq9IgLvfgFDUUPw2RYncUDtgKXLwm4DamAjG6 XzUxkQ4LdAuZbf7ij4vX4/BvZCM/TPr46cXYC3LD40qjg6g7Rz1JQdbTKx4DNHO4Utze ferQ/HXcTet2HSMZgMcNompFjTS0EMgMQpQ2se81mQA+BgdKnXJMVO+yyUs8p3uVp9Tb 7uk4NVoF0r3lnv70En0+AZ7sCEuCZ3YVIiD8oJA1ptDgkkUUvlOwgOcCltxuJczI2kdL lfKfHt83O0/y6cYP5pV3cZRKZBtf8YQkqI5RStVrH75U/pJCkwhz8OI8jAeclMYfCp0Z HkYA== X-Gm-Message-State: AOAM533hFthpAX9+ADGYG0d/TJ8CFM7sCj5YaG1+CZd6n+lr0OWu0ibG DdHQTHtLB2RxJB9EN4dJ1yK2rw== X-Google-Smtp-Source: ABdhPJyWrV1oYCT31s6fWz03UksAA2NhnlHdmI7OV5MP8ziAx7Ta1SgfnVY80ymWu7sQMnlDsAomtQ== X-Received: by 2002:a17:90a:1641:: with SMTP id x1mr139302pje.114.1623085578464; Mon, 07 Jun 2021 10:06:18 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f656:ffce:6348:a42a]) by smtp.gmail.com with ESMTPSA id fs24sm12897639pjb.6.2021.06.07.10.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:06:18 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: Linus W , robdclark@chromium.org, Maarten Lankhorst , Stanislav Lisovskiy , Steev Klimaszewski , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Thierry Reding , Lyude Paul , dri-devel@lists.freedesktop.org, Stephen Boyd , Douglas Anderson , Rob Herring , Daniel Vetter , David Airlie , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 02/11] dt-bindings: drm: Introduce the DP AUX bus Date: Mon, 7 Jun 2021 10:05:46 -0700 Message-Id: <20210607100234.v9.2.Id3c048d22e72a9f90084a543b5b4e3f43bc9ab62@changeid> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210607170555.4006050-1-dianders@chromium.org> References: <20210607170555.4006050-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. NOTE: there is no "Example" in this bindings file. Yikes! This avoids duplicating the same example lots of places. See users of the aux bus (like ti-sn65dsi86) for examples. 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 Reviewed-by: Linus Walleij --- Changes in v9: - Commit message now notes aux-bus yaml won't have an "Example". 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 Mon Jun 7 17:05:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 455445 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, 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 2F404C47095 for ; Mon, 7 Jun 2021 17:07:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C3816101A for ; Mon, 7 Jun 2021 17:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231805AbhFGRJ2 (ORCPT ); Mon, 7 Jun 2021 13:09:28 -0400 Received: from mail-pj1-f53.google.com ([209.85.216.53]:46883 "EHLO mail-pj1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231826AbhFGRJZ (ORCPT ); Mon, 7 Jun 2021 13:09:25 -0400 Received: by mail-pj1-f53.google.com with SMTP id pi6-20020a17090b1e46b029015cec51d7cdso430919pjb.5 for ; Mon, 07 Jun 2021 10:07: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=fP6yyMrOxlowleWVIKvrc8DjWvcGHG8K7xtH5ir8+78=; b=f/U4BkDZp1VuKwYRQ1mAkZCh6VRutVSCEutT+zDKlMpa8ZQ6jiBjOcSz1JzSTipMr2 E7Q0w16H5Uh1fdnMYxr5/d/yUx+DEs4WGmBPTHV2TKNuSH5q3gmvb2liIMDjZZE0rERO MQ1pKmJ3vsJZJ1ONfo9ZgWRpEy0y2HuslfEs4= 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=fP6yyMrOxlowleWVIKvrc8DjWvcGHG8K7xtH5ir8+78=; b=DUCe46TKE7kwzq/Yzs+nuQX/ZkG1aP+0zJGctuyg37V69M+vH8hQbpehWMHse6lghY zBXqfob0lTQkIcUZTx4iLQ08h/vfUbOrYFrtYdWPhqbVjzHnoktCFclvGPykuMyDRKjY NR3VamY02Nzzs17Nj8PT0bczyjz22/bhPYX8hXG5dDTN1FeDYdj9R2HI3uFFfCA94/XP KC5/i90B1zZobGcNdIkCRzA/VFlmFojuvRFZFexa+w+qcr4bkmt/lfYq+NAwPGck/M7P wcQQgNmkNYkUXDccFliIt/OGwMt2XCNjT1Enr87Xnj1NAMwgrzsRLcreJYeKGfkTXvi5 JUJg== X-Gm-Message-State: AOAM5328u1qHIsU3b70dufEFds/mQ0XHo1wo0xVFAQcPYhbaSPqKm/dA 8+d2tDPsiaUwYLJ7FUETpEoApw== X-Google-Smtp-Source: ABdhPJxf2FNb6iO/UZpz0gLz0a8MML3KIy46rwiBHC2JHkl3jtWREZv5Jfy5DtxHVXe0oCUbFSoVhw== X-Received: by 2002:a17:90a:af8b:: with SMTP id w11mr21480873pjq.228.1623085581080; Mon, 07 Jun 2021 10:06:21 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f656:ffce:6348:a42a]) by smtp.gmail.com with ESMTPSA id fs24sm12897639pjb.6.2021.06.07.10.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:06:20 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: Linus W , robdclark@chromium.org, Maarten Lankhorst , Stanislav Lisovskiy , Steev Klimaszewski , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Thierry Reding , Lyude Paul , dri-devel@lists.freedesktop.org, Stephen Boyd , Douglas Anderson , Laurent Pinchart , Rajeev Nandan , Daniel Vetter , David Airlie , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v9 04/11] drm: Introduce the DP AUX bus Date: Mon, 7 Jun 2021 10:05:48 -0700 Message-Id: <20210607100234.v9.4.I787c9ba09ed5ce12500326ded73a4f7c9265b1b3@changeid> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210607170555.4006050-1-dianders@chromium.org> References: <20210607170555.4006050-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. (no changes since v8) 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 7ff89690a976..1366d8d4610a 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 a118692a6df7..12e6f4e485ed 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 Mon Jun 7 17:05: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: 455446 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, 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 39D79C47082 for ; Mon, 7 Jun 2021 17:07:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FA2161029 for ; Mon, 7 Jun 2021 17:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231693AbhFGRJP (ORCPT ); Mon, 7 Jun 2021 13:09:15 -0400 Received: from mail-pl1-f179.google.com ([209.85.214.179]:41900 "EHLO mail-pl1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231699AbhFGRJP (ORCPT ); Mon, 7 Jun 2021 13:09:15 -0400 Received: by mail-pl1-f179.google.com with SMTP id o12so5678542plk.8 for ; Mon, 07 Jun 2021 10:07: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=fZQLp2TUFZKexGG0lnWAUoM5CvTjZ8F6nfEFxMTeutA=; b=ZD14vGliFbqNsHPHvfHeRxS9FPyE71wQLfbAH69UHzdRNLhXe7m61TX2hMGPYFCHP3 bviaYWzSLplcbSIge6WqH/zvtQ47Ih2ccxy+ywC0dANvoCrqrZ7ZReGwdQ4JjbdJRYBh SNt/NQEi9Yix8fthhwnZXmR0DMPTQGiMJF+Lg= 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=fZQLp2TUFZKexGG0lnWAUoM5CvTjZ8F6nfEFxMTeutA=; b=B70ZGLimPrNEcNICJEJlQizckyA2wDdr/+kCbRmLrdP3WKEELWQE92KqQGd6hOaNtQ 8kOeCTgEyDiTQQV5XFjqexUD9Ylw0DFoTbWeXrKsxbxwEvEwNloWrYwADSDm4XSdTr0p YAHQVZfVnXEHgnnmmj9RGz50J63XMwdhsjoHvsQhguzL0qrc4HMyomlnuz2w0w9DUG5W Du7DiHecHkpo5TsjJOYfNWRDzR7yKEO32FGUyx79dxRyPQXFz3JPVRchD/VRHFBBTKKf +L8MIK2jr9kcfh4DV+R/7vB1/QcAsPLRq2EeZELBYh08XrESFKzb1q3hfSBicnrGX7Bu pjZw== X-Gm-Message-State: AOAM533GKhdIXbTu05RJ/AWdUPEFw/sb34BAtMbtSTkHipYJUpEvMx9Q ZxicDo9m0MlHThM9di/PtKlVkQ== X-Google-Smtp-Source: ABdhPJwtOOUFau0bbyzoo6a5rslIQuZ9iVmD6u79b/abK7sPARBs8pjJJe7aZ/NhzTdcRPQCFWMqdQ== X-Received: by 2002:a17:90a:1f47:: with SMTP id y7mr21372790pjy.171.1623085583586; Mon, 07 Jun 2021 10:06:23 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f656:ffce:6348:a42a]) by smtp.gmail.com with ESMTPSA id fs24sm12897639pjb.6.2021.06.07.10.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:06:23 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: Linus W , robdclark@chromium.org, Maarten Lankhorst , Stanislav Lisovskiy , Steev Klimaszewski , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Thierry Reding , Lyude Paul , dri-devel@lists.freedesktop.org, Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Thierry Reding , linux-kernel@vger.kernel.org Subject: [PATCH v9 06/11] drm/panel: panel-simple: Stash DP AUX bus; allow using it for DDC Date: Mon, 7 Jun 2021 10:05:50 -0700 Message-Id: <20210607100234.v9.6.I18e60221f6d048d14d6c50a770b15f356fa75092@changeid> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210607170555.4006050-1-dianders@chromium.org> References: <20210607170555.4006050-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 Reviewed-by: Linus Walleij --- Changes in v9: - Fix error handling / remove case when using AUX bus for DDC. Changes in v7: - Patch using the DP AUX for DDC new for v7. drivers/gpu/drm/panel/panel-simple.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index d3b5ae22d939..df6fbd19e6fc 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) { @@ -802,7 +808,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); free_ddc: - if (panel->ddc) + if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc)) put_device(&panel->ddc->dev); return err; @@ -818,7 +824,7 @@ static int panel_simple_remove(struct device *dev) pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); - if (panel->ddc) + if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc)) put_device(&panel->ddc->dev); return 0; @@ -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 Mon Jun 7 17:05: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: 455450 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, 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 03248C48BCF for ; Mon, 7 Jun 2021 17:06:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAA0161078 for ; Mon, 7 Jun 2021 17:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231282AbhFGRIX (ORCPT ); Mon, 7 Jun 2021 13:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230525AbhFGRIW (ORCPT ); Mon, 7 Jun 2021 13:08:22 -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 CC217C061280 for ; Mon, 7 Jun 2021 10:06:26 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id c12so13593605pfl.3 for ; Mon, 07 Jun 2021 10:06:26 -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=QFddLOHKMkDWCo/3CJ6wD0VeACMC/xRkHRaz1DXreL4=; b=VUYMkHkOdCN0d9Kzmy6/vVCz4a+LAxY0BdwuAOSzLNJqvbgmWJqXOQLjZPftDM/hFA S4sKnmI3ocXTQZ7wYLwrOSH9jg491VW9QKj9matJ/vZQJfuwtnvtxYsexmODKmy1v7cn m9RJtgRs3BMDFegVPavrzKA20e2ng0ZkRXfyk= 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=QFddLOHKMkDWCo/3CJ6wD0VeACMC/xRkHRaz1DXreL4=; b=hj/9dhywFZXp1V6HZn6I7H/l+wHqJJGP3Oi8nX/LsjIHOXCiDHVcK2p3lgttGC2Bqt +yl0g28OrNbZ7gIdaXMRsynoYwT8E3KAVFJbRbArN6/MSHj6YLhahBvYGekIA1IPpbi8 JexgrTMVEl7X3BiCyPP3u4XmI/ridQ9LA0/CS3xLbIhc//OnQgTsy+c8LJM03XtjgPrU jbp+tUe+ZT6nqD8veVgmXcsqIPobbJmVRIN+tVpAThUdJ1aNLUACmio1HDrza7WoKY8i GIPjtLeC9EtyHD7tLDFws/nxZDN42Tau0uDj7EK/uEr4RJd0vnQ2j7+HSTKIKyTIYXhA dBhA== X-Gm-Message-State: AOAM5331bJw0n4FQiEciDaskQVjtQm/L+sVfhtYmLg2oschOAjSB6PWd 9u4bMESKGJpcOkxXYUFC870WNA== X-Google-Smtp-Source: ABdhPJzGbsmGgNdYrdMCYElyKRxtwRKUm08v3yvz8uRp/WDjLVgv0nkTYzOdWrjU9NDZEuLzFn7CEw== X-Received: by 2002:a05:6a00:882:b029:24b:afda:acfa with SMTP id q2-20020a056a000882b029024bafdaacfamr17889560pfj.72.1623085586388; Mon, 07 Jun 2021 10:06:26 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f656:ffce:6348:a42a]) by smtp.gmail.com with ESMTPSA id fs24sm12897639pjb.6.2021.06.07.10.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:06:25 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: Linus W , robdclark@chromium.org, Maarten Lankhorst , Stanislav Lisovskiy , Steev Klimaszewski , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Thierry Reding , Lyude Paul , dri-devel@lists.freedesktop.org, Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Jernej Skrabec , Robert Foss , linux-kernel@vger.kernel.org Subject: [PATCH v9 08/11] drm/bridge: ti-sn65dsi86: Add support for the DP AUX bus Date: Mon, 7 Jun 2021 10:05:52 -0700 Message-Id: <20210607100234.v9.8.Ib5fe0638da85800141ce141bb8e441c5f25438d4@changeid> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210607170555.4006050-1-dianders@chromium.org> References: <20210607170555.4006050-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 --- Changes in v9: - Rebased atop v9 ("Promote the AUX channel") patch. 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 | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index c96e4b38d1d3..5e1e28d4520f 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -293,6 +293,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 8e61005cf4ad..32bd35c98d95 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 @@ -1426,12 +1427,17 @@ 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; pdata->aux.name = "ti-sn65dsi86-aux"; pdata->aux.dev = &adev->dev; 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) + return ret; + /* * 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. From patchwork Mon Jun 7 17:05: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: 455448 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, 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 3D022C47095 for ; Mon, 7 Jun 2021 17:06:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 297256102A for ; Mon, 7 Jun 2021 17:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231535AbhFGRIk (ORCPT ); Mon, 7 Jun 2021 13:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231553AbhFGRIj (ORCPT ); Mon, 7 Jun 2021 13:08:39 -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 0F425C06124A for ; Mon, 7 Jun 2021 10:06:28 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id c12so13593658pfl.3 for ; Mon, 07 Jun 2021 10:06:28 -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=yWRx1OKzT29X81tph92xntyHt6dSqLpn80j/NSCtjqQ=; b=mUbAV3XTHXVa67kS0a38rl1Ampc0n278s3JcVNPrE1VppcfMkdmIM4JlcB6ttv1FhL hu1+qkdMPq+lhRpoLCQ+u0PQ0HyyHF/y9WWd4/n53+eg2lpXLBrwSr6rxUBHkDMxOp1R fVXLun4IS64h/Xp1uxSmmSje6cLIwI52A2BzA= 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=yWRx1OKzT29X81tph92xntyHt6dSqLpn80j/NSCtjqQ=; b=d7Q4SAJqF6lMUqF1+f0W38nRR5od0tQHIB6xHsmY2+jrox+81cLF1TlCnSPKfzmsmH f515gJv+6ociffw31yiFBA9a7oaKQuCMeJbOjHaB2D/KxT0EQz+hrfX7AHoRHQaZyBN8 Cu6FnPP3TFDH7TnwTaREWisC9RofkACBrwdUaEr6zwY9lj1PAQH5jkuBC0Mqzupt4tfa Isxt8ZSmAersNR8XPI5U1aL/AsOgXZzN1yPzHLqWUKFmprvCNg/4T2mPD4nY5OkyDa76 5lHixJX3tN9ySkiWG/vWtbXMTEDDDF6zD0yNg/x6qv7gbzYCa/wuFmniZ3MK8sWC/iDK phKg== X-Gm-Message-State: AOAM532/7iY2RCL1M+ZCKedQIHv7uwQeAAxT2nd4O8cd66tCJmRGStEh 2W6UYqz7Xn6YZBdYdEFqxKXGMA== X-Google-Smtp-Source: ABdhPJx8YPCCcqzU3d/cK8JLYHv5jAjGtOZzm7LoVzlJHhRRzYs2F+z74WTi5agGkOsoKZaSPAWOSw== X-Received: by 2002:a65:5a08:: with SMTP id y8mr18694727pgs.199.1623085587574; Mon, 07 Jun 2021 10:06:27 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:f656:ffce:6348:a42a]) by smtp.gmail.com with ESMTPSA id fs24sm12897639pjb.6.2021.06.07.10.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:06:27 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Sam Ravnborg Cc: Linus W , robdclark@chromium.org, Maarten Lankhorst , Stanislav Lisovskiy , Steev Klimaszewski , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Thierry Reding , Lyude Paul , dri-devel@lists.freedesktop.org, Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Jernej Skrabec , Robert Foss , linux-kernel@vger.kernel.org Subject: [PATCH v9 09/11] drm/bridge: ti-sn65dsi86: Don't read EDID blob over DDC Date: Mon, 7 Jun 2021 10:05:53 -0700 Message-Id: <20210607100234.v9.9.I9330684c25f65bb318eff57f0616500f83eac3cc@changeid> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210607170555.4006050-1-dianders@chromium.org> References: <20210607170555.4006050-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 32bd35c98d95..b544cbce7fdd 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);