From patchwork Mon May 17 20:08: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: 12263081 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=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 4E463C43461 for ; Mon, 17 May 2021 20:09:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E4896128E for ; Mon, 17 May 2021 20:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237584AbhEQULH (ORCPT ); Mon, 17 May 2021 16:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236853AbhEQULG (ORCPT ); Mon, 17 May 2021 16:11:06 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E083C061756 for ; Mon, 17 May 2021 13:09:48 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id i5so5446420pgm.0 for ; Mon, 17 May 2021 13:09:48 -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=+Od89iO9K7b3a0mIXVinRw4ty+isZRxmi2wE6XqdNOk=; b=TtUzhEsImHEcyrdQGMv96nCuysYgEsi3cNO4UegmgRhdA1F8TACbuVBLqp/QdKqQaf UAtp6s4WuAUNwtNHz8bz9UudmLTCHxM6xHX4DvbM/OUI/MRDYHTHfgOj3vROVbiMG17d UARJMKUM6A4voepduG2ek9sL/YpvPRkECaI7o= 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=+Od89iO9K7b3a0mIXVinRw4ty+isZRxmi2wE6XqdNOk=; b=Mm4wujVQEqlkURxEpmS672Ad8eZCHfwWqPkmH+3vkjYPY4tvCS+ImHh8uJjzYFQ4s9 3YbPW7Ef2R9Yb8LfnEQXyLZILc3/JhHIo03a7CwQcE2DkkspPozXUMhp6LgtXPr9Kojw 5t5HTBtNaq8nTQIspX1HkN6u7RdboC5r2CY/N9Qkt0JYvNlD6fg8rqqaxShEGBtU91ZP o54ZVshpBxg4JDQHrwwNThBjw/6e44IhzqiW3jwOSwl1NzX6jHfkziZh3yOEPBkk4O9j 5Q0bvBK8R1K79+QCQ82Xsk+Y0wkgN1XFwQhjdKXpyUwHMph5MRB1wkQ1GAGn+4ER9/eY jRxw== X-Gm-Message-State: AOAM531gBbNJ7e2FAmej1xo1VXOsdRo3nCQ1/m8D9a1l52akzmXTt5Jg fqN3MXvp8Yq4KAYCGVeWVsntpw== X-Google-Smtp-Source: ABdhPJzM48ZbURkxPit3OBuzXEszo4hQUmrav6Fobpm8X3kMTwn8gRXetNU7W9BoueB/crKw8VmEDg== X-Received: by 2002:a63:36c1:: with SMTP id d184mr1219542pga.47.1621282188016; Mon, 17 May 2021 13:09:48 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:47 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Daniel Vetter , David Airlie , Laurent Pinchart , Thierry Reding , linux-kernel@vger.kernel.org Subject: [PATCH v7 01/10] drm/panel: panel-simple: Add missing pm_runtime_dont_use_autosuspend() calls Date: Mon, 17 May 2021 13:08:58 -0700 Message-Id: <20210517130450.v7.1.I9e947183e95c9bd067c9c1d51208ac6a96385139@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The PM Runtime docs specifically call out the need to call pm_runtime_dont_use_autosuspend() in the remove() callback if pm_runtime_use_autosuspend() was called in probe(): > Drivers in ->remove() callback should undo the runtime PM changes done > in ->probe(). Usually this means calling pm_runtime_disable(), > pm_runtime_dont_use_autosuspend() etc. We should do this. This fixes a warning splat that I saw when I was testing out the panel-simple's remove(). Fixes: 3235b0f20a0a ("drm/panel: panel-simple: Use runtime pm to avoid excessive unprepare / prepare") Signed-off-by: Douglas Anderson Reviewed-by: Laurent Pinchart --- Changes in v7: - pm_runtime_dont_use_autosuspend() fix new for v7. drivers/gpu/drm/panel/panel-simple.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 9be050ab372f..21939d4352cf 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -798,6 +798,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) return 0; disable_pm_runtime: + pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); free_ddc: if (panel->ddc) @@ -814,6 +815,7 @@ static int panel_simple_remove(struct device *dev) drm_panel_disable(&panel->base); drm_panel_unprepare(&panel->base); + pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); if (panel->ddc) put_device(&panel->ddc->dev); From patchwork Mon May 17 20:08: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: 12263083 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 BDD96C43460 for ; Mon, 17 May 2021 20:09:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A27FF61004 for ; Mon, 17 May 2021 20:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236705AbhEQULH (ORCPT ); Mon, 17 May 2021 16:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236794AbhEQULH (ORCPT ); Mon, 17 May 2021 16:11:07 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84A95C061573 for ; Mon, 17 May 2021 13:09:49 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id t11so4310663pjm.0 for ; Mon, 17 May 2021 13:09: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=+urYn/auWJUjc3W4sdmPucnZoewzDoUKh0jwgsir+nQ=; b=RJIYA2O4giqjYO66q0SQpXcr1odgBXvF0aQ7MZWxCqHVao92mTCpdHiAQvvuOvnWb0 VZxZOmXubCqnouWsB4I/kkQdT1Im1eoL3aSwrMtqJyVTC9wk2bixTA8YpNXujs3ebJNq UgdlMPwUrXlBTiOUWlGJKj96af58fxXxVUckM= 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=+urYn/auWJUjc3W4sdmPucnZoewzDoUKh0jwgsir+nQ=; b=fjZn6ugd1nyc9DeHgboJe40UTRgagyHsDXzHQ1EFZ89k3jI/JIAM/3M8UV/Pks76kw 3iFLOXpK8yzF9QStkndcio78Ar17P5OuKenMwi958ibtCXQZFHQW9z/tEnYKA//iCzI7 +v5Hin1OuncAOYFV+8jRBb2vBt2khW42HQ/pm6zL/VdtQTMN0jxEXD927ZgnLE5NgVOR PjtezPJCGi8Pu8QGdyoXuFfFOmoCS1luV9iJLGH0C6Fm88shQoPNGeGc32FsR4eDB73y 2kyOBMqDwFTa427TWDow1erMQpuk/rh2QkKf2BSZj/GfK5eQ42m2d8nsHFQ/Vpiow3ND tOhA== X-Gm-Message-State: AOAM531anCMBZk99ZDIeSEfuYTtbR5pu8u7Czfn8c7FNCKH/iZ+L6cM9 uAOCfBIeACyVvqoDuRM57LbRow== X-Google-Smtp-Source: ABdhPJzqYY2WqAKQmfMbYwBASkiXd/jkLCuXy99v9JmQQ8Cmyq311d8LnPThMxqgk98rM3Md4cOG2w== X-Received: by 2002:a17:90b:188f:: with SMTP id mn15mr1153919pjb.219.1621282189154; Mon, 17 May 2021 13:09:49 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:48 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Daniel Vetter , David Airlie , Rob Herring , Thierry Reding , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 02/10] dt-bindings: display: simple: List hpd properties in panel-simple Date: Mon, 17 May 2021 13:08:59 -0700 Message-Id: <20210517130450.v7.2.Ieb731d23680db4700cc41fe51ccc73ba0b785fb7@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org These are described in panel-common.yaml but if I don't list them in panel-simple then I get yells when running 'dt_binding_check' in a future patch. List them along with other properties that seem to be listed in panel-simple for similar reasons. Signed-off-by: Douglas Anderson --- I didn't spend tons of time digging to see if there was supposed to be a better way of doing this. If there is, feel free to yell. 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 May 17 20:09:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12263085 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=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 57FDEC43462 for ; Mon, 17 May 2021 20:09:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A6FA6128E for ; Mon, 17 May 2021 20:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236794AbhEQULI (ORCPT ); Mon, 17 May 2021 16:11:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237605AbhEQULH (ORCPT ); Mon, 17 May 2021 16:11:07 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B6EC061760 for ; Mon, 17 May 2021 13:09:50 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id q6so4292386pjj.2 for ; Mon, 17 May 2021 13:09:50 -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=ibC0JQ1noBgZMhZpAkhp6+LWFKsRlOrZ8j0drDGOJUc=; b=WuNlzNsceu7te8upmYnD24kk4Zbrbvf7LBNU1IGaOZTNfldtXzy8SP5gxoJmy31Ztw WqEQK49yIrFEDP5WcTNE1gQVxI2bG2TMmxPeQQGgwqNPO9i1CziftTYOrUqT4zaaon7n m3/NL/6XIwHL0CmYhCmu/ETlm0QbHatWt1e9Q= 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=ibC0JQ1noBgZMhZpAkhp6+LWFKsRlOrZ8j0drDGOJUc=; b=S6qaGXktd1+E3Do6kTBIfabtbQiF8lNG2I8ypjXGclaTvKg+/RntrBK8iI4uFLU2Af whOg9F7J3uNa9M8g581llEEeVxw4rwslc3CsHDEmrN7uGSzjpeHR6Uq0eEbFAUXyKbnl MQvkbdGueeE2WRTARiOV4jZ/bPP9vyakmH+DLoA0I+0FS7ImchfVHA9l20gPSUdmh6Nl Q8Ue3YDUXbmpCtd01msx7S9wtaRF/SdQYoEniGP06YiceJffKi8QQVfTkeWFwR4qp/QV BHQrYh/I/UnpBeooQcsXCUq1GV+y61CzuxCRtMrk11VeQknkf3BTLDjQXBQWRQAvE5MU Fskg== X-Gm-Message-State: AOAM531r0LCph+7Z7oOPVldm6+WTbQ5f6DISDsV9WVovEiOgoUxTG2vR mPVrlLyUxyRwamCKJqT9fIzo4A== X-Google-Smtp-Source: ABdhPJzFA78VI2ZxClv8Expyof7VKru3oLqIN3yVSmvQaS6IsPGGiLHBrJQRCZ1MDayUfdlmXlfQsA== X-Received: by 2002:a17:90b:1bd2:: with SMTP id oa18mr1241491pjb.72.1621282190331; Mon, 17 May 2021 13:09:50 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:49 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Daniel Vetter , David Airlie , Laurent Pinchart , Rob Herring , Sandeep Panda , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 03/10] dt-bindings: drm/bridge: ti-sn65dsi86: Add aux-bus child Date: Mon, 17 May 2021 13:09:00 -0700 Message-Id: <20210517130450.v7.3.I98bf729846c37c4c143f6ab88b1e299280e2fe26@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-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 a ti-sn65dsi86 node to represent the fact that the panel is connected to the bridge's DP AUX bus. Though the panel and the bridge chip 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: it's still possible to continue using the bridge chip and point to a panel that _isn't_ listed as a child of the bridge chip (since it's worked that way previously), but that should be deprecated since there is no downside to listing the panel under the bridge chip. 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 --- Possibly we might want something fancier that could be included by other eDP controller bindings. If we want to do this, I'd love to be pointed at a good example to follow. Changes in v7: - ti-sn65dsi86: Add aux-bus child patch new for v7. .../bindings/display/bridge/ti,sn65dsi86.yaml | 22 ++++++++++++++++++- 1 file changed, 21 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..51f5a29e216c 100644 --- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml @@ -70,6 +70,11 @@ properties: const: 1 description: See ../../pwm/pwm.yaml for description of the cell formats. + aux-bus: + description: + It is recommended that you place your panel under the aux-bus node + here to represent the control hierarchy. + ports: $ref: /schemas/graph.yaml#/properties/ports @@ -201,11 +206,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 Mon May 17 20:09:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12263087 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=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 47E30C43462 for ; Mon, 17 May 2021 20:09:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D06061004 for ; Mon, 17 May 2021 20:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237627AbhEQULM (ORCPT ); Mon, 17 May 2021 16:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237857AbhEQULK (ORCPT ); Mon, 17 May 2021 16:11:10 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99DBEC061573 for ; Mon, 17 May 2021 13:09:52 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id ep16-20020a17090ae650b029015d00f578a8so278423pjb.2 for ; Mon, 17 May 2021 13:09: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=fYiLctBaEsq7KvqbRNNn3gMCDRk49bZ7c9H9zDpezBI=; b=M8tBv9JpPKZSr3/qlN8pVmhQmkodIpmr8B+QQ3bRCX011z+lYeP2Lrm5dXgItf7JmB nZd+QQa3jSw6cL2wPDhI+sQjb5lgAVS8C2dnAAbnWscrY6U1e7w2Ar+BLTl4kyOhdFWO QZ5S81EqrMldTP0WnuQwSS+QIL23ebfbmT4aI= 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=fYiLctBaEsq7KvqbRNNn3gMCDRk49bZ7c9H9zDpezBI=; b=mrE3PPS+W+7+7RC35uHq82mhM1ObJwGduRyScicuIvqb1hle9PFG1cEvPahzjZTG7M 9XUb/rcp6LTQI1hCzP9HeErZzACRin25EvsO5MndDn/svboBe2vYqrUmFVNJ5cc7mOT7 A7blTkC4pvGvho3g8x+C0uAGq3uSx2bEC4AcRnV8pGFOhA/vKMkGiDUcPIAiuLajpz6r PknAUxR7pKyFSY/zAgWuHxLNdBRZFNJNe5Cs3FtdN+wU5l95fM1+ZAP3KhFEb0J7oyyg KY/HvC8GAIlmT/ALTElRaVsD8BmHeJ0QRu0ecpFKVCT6l6xi+Z803MJ4brLj87wLZAiU UFbQ== X-Gm-Message-State: AOAM530K58Fg7jK8Gb/1dDGJMsefHk+1CaLL5wYWD7l9BmQv2Bv/Camw ZvsWzOgsCj3QafqHgI8EYqv9eQ== X-Google-Smtp-Source: ABdhPJydxjdiEZRYcNOobrCu86EApqc9n0+tLWi3GI8VZMsoP2gDAJXHnavZFoPzqGBsmh7WKdEeew== X-Received: by 2002:a17:902:b70f:b029:ed:36ed:299d with SMTP id d15-20020a170902b70fb02900ed36ed299dmr232620pls.48.1621282192169; Mon, 17 May 2021 13:09:52 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:51 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Laurent Pinchart , Rajeev Nandan , Daniel Vetter , David Airlie , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v7 04/10] drm: Introduce the DP AUX bus Date: Mon, 17 May 2021 13:09:01 -0700 Message-Id: <20210517130450.v7.4.I787c9ba09ed5ce12500326ded73a4f7c9265b1b3@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-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 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 | 322 +++++++++++++++++++++++++++++++ include/drm/drm_dp_aux_bus.h | 57 ++++++ 4 files changed, 386 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..307a6487c8fd 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 + bool + 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..e1a295e550ea 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 +drm-$(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..2046fef323e6 --- /dev/null +++ b/drivers/gpu/drm/drm_dp_aux_bus.c @@ -0,0 +1,322 @@ +// 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); 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 May 17 20:09:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12263089 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 9429DC433B4 for ; Mon, 17 May 2021 20:09:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74F2A61004 for ; Mon, 17 May 2021 20:09:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237776AbhEQULO (ORCPT ); Mon, 17 May 2021 16:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237957AbhEQULL (ORCPT ); Mon, 17 May 2021 16:11:11 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A61FBC061760 for ; Mon, 17 May 2021 13:09:53 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id b15-20020a17090a550fb029015dad75163dso299451pji.0 for ; Mon, 17 May 2021 13:09:53 -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=tOZl2a0Xn+Y+oYoBUp55w9Z29a1A4HjFAvDLzhVhkqE=; b=eU6UxXe8TD0o/QUCV0Yy+MMbIQLPLTHNNbNuBTC7DkWQuRoGhqVm3tGDTzB4qDOYxD yETi1jd/D3yEQbqMMpM1nEQ/RTTc80vMdtggULBTBM76/Ei21a5xS7ByOrfe3aPvJAcN Dqaz34kIW4/3TYsbnViDkSpc2yP55yNrbq1s8= 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=tOZl2a0Xn+Y+oYoBUp55w9Z29a1A4HjFAvDLzhVhkqE=; b=cqq6pwNet0i6NatINZM4HhDhEHetTi88hnvvZz/Y+5BOxSNBtqrlBSri6//3MtYu3f wrkiwU9KboEtXeDABhwvCRk42rj31T7h+xbq1GjtJs4K0a+k1QVUzwsP64t7Q2Uq2Ghb Ju8CHZYLQeu062SKr81lp2AjFn7TWNgIYRPMxf4XLiYxxvLwZOfMVaf5eBikDB1GoWxV wdBEr9zVR42YjE9JsjY5qIGFsUee9unSEEoP5kAfDBE10BX7ZBj6X03cQY1JyXB4zFvt k4OuJSZxglxxzOYv08OzaJfDluGbOWtaEPpdy6wNuSq/MSmQfIBqYoGyIZXrr3Q9KM+5 Uu6w== X-Gm-Message-State: AOAM530Wy5k2KHJV9n4/BTXV7WMWax/3jxoODA1YQMiEdG9RoxAvilwx j0Vg94T5evKC4sU2PwcKZTUT2g== X-Google-Smtp-Source: ABdhPJyTrQXjfhuuJoM4Ts7rTF2Cm+pFj01Va4cSrUA6KTyHc0dawC5/JzLBe/tqlu792cBM94O5kA== X-Received: by 2002:a17:90b:1949:: with SMTP id nk9mr838329pjb.220.1621282193248; Mon, 17 May 2021 13:09:53 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:52 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Daniel Vetter , David Airlie , Thierry Reding , linux-kernel@vger.kernel.org Subject: [PATCH v7 05/10] drm/panel: panel-simple: Allow panel-simple be a DP AUX endpoint device Date: Mon, 17 May 2021 13:09:02 -0700 Message-Id: <20210517130450.v7.5.Iada41f76a7342354bae929d0bb3ceba40f27f0ea@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-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 --- 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 Mon May 17 20:09:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12263091 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=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 759A9C43462 for ; Mon, 17 May 2021 20:10:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BA416128E for ; Mon, 17 May 2021 20:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238334AbhEQULQ (ORCPT ); Mon, 17 May 2021 16:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238164AbhEQULM (ORCPT ); Mon, 17 May 2021 16:11:12 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06CD1C06138C for ; Mon, 17 May 2021 13:09:55 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d16so5718892pfn.12 for ; Mon, 17 May 2021 13:09:55 -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=L1nKDGF6pGJe0IpKS5C/RodzguTsVg0ZIzYR3jS4u4k=; b=fWtS/TP40LqAlfZ78nEJ1PtGoPOzEu9gxI8cBuKOzb3ckduQ8M34kJrg774jQAOf/y JIQLcpDk8HU/9Fu1vgLxJk+O0CxqxE8UNHL0YKIpuErycVwSIn+InsXfScFEg6ztd0Ru tAuBqLmQGLn3HJF6PdAncObwhOeO1jWcf5rMA= 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=L1nKDGF6pGJe0IpKS5C/RodzguTsVg0ZIzYR3jS4u4k=; b=TRAam4w4it5wuu7Zzxka4ElF9/h3W1BAQYcIZ7z3WMrcYObuBVUqW7Ek3FrpaJ/+h2 E+b7tBip/vxM+3p1EmpgX3FnsE5rrH+f2c74+UV5ybpTBw8B1CzlU7696dIT3BqRcdmi 5vI9x/jijwWz4ey38uBZzx0SwH4j7wfE6Nj+NRc4XtoCXGQfwq/3Qk08JITKr3tTXYjn BaM208sqJo19WedFML+TtOt3BxzMd/Zsm1iN8pbhVg9bgwMAT+9AMdgtVNNhkZVTE968 4MRet4tGMn74qtV/AyxYRyq3K9RLVBH1OYfVzjFpBasnwa0uXcfnrlUXCz2D4QwmfvwW zyeg== X-Gm-Message-State: AOAM532DB2JFTo5aN/3GQbuJ1EW7Fgb6v8MMDx4aAJDbNs+CGMzYl8Yq wGTlDO7ekqRPNvPaQSEu2592LQ== X-Google-Smtp-Source: ABdhPJwufsQmvr4lrG28XiJcm5hpjG/jAsvaoyX7ibGY6ATt/3lk8A+H8Ck46X0LCGgEvfbtITbFBg== X-Received: by 2002:a63:8f15:: with SMTP id n21mr1212991pgd.366.1621282194627; Mon, 17 May 2021 13:09:54 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:53 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Daniel Vetter , David Airlie , Thierry Reding , linux-kernel@vger.kernel.org Subject: [PATCH v7 06/10] drm/panel: panel-simple: Stash DP AUX bus; allow using it for DDC Date: Mon, 17 May 2021 13:09:03 -0700 Message-Id: <20210517130450.v7.6.I18e60221f6d048d14d6c50a770b15f356fa75092@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-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 --- 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 Mon May 17 20:09:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12263093 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 3DC98C433B4 for ; Mon, 17 May 2021 20:10:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20E5661002 for ; Mon, 17 May 2021 20:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238164AbhEQULS (ORCPT ); Mon, 17 May 2021 16:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238228AbhEQULO (ORCPT ); Mon, 17 May 2021 16:11:14 -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 716D1C061573 for ; Mon, 17 May 2021 13:09:56 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id c17so5737979pfn.6 for ; Mon, 17 May 2021 13:09: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=/mS11Z0kbSk6qEboWlHw1p+/EDLHyeDBKjM4PClv7j8=; b=c5ifKI8KmAYJ66SeSUlxUUQhu64duVpy9fg4dXadGjHWfSM92qGFigU+z18qPs6Qum LNlJdRWIWWc1JPzV/I1v6XslJ5E9FjEFX8yQ+4NAX9iwYTJsMB8C24joHi63DSL4WsnW 7y6b5t6dyKc9LAPTCV05Ty7Qo/f9OPlLLCoc8= 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=/mS11Z0kbSk6qEboWlHw1p+/EDLHyeDBKjM4PClv7j8=; b=mBwsrmNKo7yKfXP8QDCKD2tqb6Z/OB3Wuj8Mdkwbo+FAE+BaJZQFlotplIpSzAIaUR gOyp+VG3vnEuObwj9DBLmrpHziciDv32tvxrWVjTxaJdbyQiQSvQl+Skv9CX6aCCxLLe jA/GsrmrAwk77aC3YurPZqaKJuUrjq4O4AONWlKqy1SBQuvdURuzlW4V0X3qmmyqcp21 mJD8Rd22JhXz7q8xhxaylN21dcNrJw56LWTTviHa/TKItF0gckTCTNA6pJoCNz1tGJSN mMFitYyfPmiAgxHO1+xN0y1+O3vDYSt/2bbDky29HFsjXL0cgtHEyu1E7mYfPM1VTBE7 03Gg== X-Gm-Message-State: AOAM532lcOIrKfcyQ2MGfcoFrhoEd7A8c+ZAlBCYyhrcav0bx4a1QN4t lqEWpjfwBB0WGb2D2D6RyOp3iVe4IAouWR3K X-Google-Smtp-Source: ABdhPJxIENp/fs0NuBlrxX+CEbfgd1a1pBbQ0HyOmbTWi8qpOFgfQzp1KTzmTxdLw6PxSp9N7bn63w== X-Received: by 2002:a05:6a00:2296:b029:28e:e91a:299d with SMTP id f22-20020a056a002296b029028ee91a299dmr1315552pfe.22.1621282195899; Mon, 17 May 2021 13:09:55 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:55 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , linux-kernel@vger.kernel.org Subject: [PATCH v7 07/10] drm/bridge: ti-sn65dsi86: Promote the AUX channel to its own sub-dev Date: Mon, 17 May 2021 13:09:04 -0700 Message-Id: <20210517130450.v7.7.If89144992cb9d900f8c91a8d1817dbe00f543720@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-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 --- Changes in v7: - Remove use of now-dropped drm_dp_aux_register_ddc() call. - Beefed up commit message in context of the DP AUX bus. - 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 bb0a0e1c6341..42a55d13864b 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; @@ -1331,11 +1333,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; @@ -1430,6 +1427,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) { @@ -1488,10 +1532,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)) { @@ -1500,7 +1545,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[] = { @@ -1537,12 +1588,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: @@ -1555,6 +1612,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 Mon May 17 20:09:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12263095 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=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 0C3AFC43460 for ; Mon, 17 May 2021 20:10:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6A1D60FF2 for ; Mon, 17 May 2021 20:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238252AbhEQULW (ORCPT ); Mon, 17 May 2021 16:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237957AbhEQULP (ORCPT ); Mon, 17 May 2021 16:11:15 -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 7744EC061761 for ; Mon, 17 May 2021 13:09:57 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id x188so5737081pfd.7 for ; Mon, 17 May 2021 13:09:57 -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=psrH5M+NKV5li8bg6y5czsIFhDiniap4e0rpHCeiOC0=; b=Kj0juLGE90KylFNjeKIBQWJhYQnqQajv49nog8fBiWQ74nF3gqXNIRB2q8pFC4SIiz DXZp6M7cW/hT7FjNmU3uhgs7jsetbUyEz4gySKqYKXWJK+hJPbR3GoaFLQTIohJ+3UlH IgvlcHZJht/jiHEdYAOnSnqsdclztTOVExBWo= 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=psrH5M+NKV5li8bg6y5czsIFhDiniap4e0rpHCeiOC0=; b=hMag1k8exnIcrJ1J+j6+yJkf3dEITciSFVtr79eOCikXyDFRHEfM4qkSKAvPKm2c9u W/S1WZB3iJ6x2nP40IOgUYhZ7szADZ05gpZ5Tmkifcjqke10CygSW2dd68+JaKVT5YOG DnFhQuJqs4hnk9/dOXnCEzgILu9uFHULbvRKkS5T1huBmDpWUUkwSBewKeMqdwm0hQQs gZhR6/kL5YbDrzJRGMbn+ulEojsNmT2n3odxd/o/8rpFHEUIklriPcJHhlFvO4lh0GNw 32YTicU+e7dedihezrrx/7+uf4RiI2IWDVxxWYtgtE9ghflC6tdNedPyQ9aZHQl4Q5le FZ/g== X-Gm-Message-State: AOAM531nXEuVslnPRFoHH/9FitwDcYI82o3Ij02Wsd2opeGdXDPcjCJI zR7ZWkrTXnLUuKvFMZ2cEAJBGg== X-Google-Smtp-Source: ABdhPJzNbrqMJ/kDp4vIoU2Elz4dbseH3ovLFsuUJF7+OVsGm8tUuMb+B26vxpXZ9ruhoL0qtGmgow== X-Received: by 2002:a63:185c:: with SMTP id 28mr1257849pgy.158.1621282197075; Mon, 17 May 2021 13:09:57 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:56 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , linux-kernel@vger.kernel.org Subject: [PATCH v7 08/10] drm/bridge: ti-sn65dsi86: Add support for the DP AUX bus Date: Mon, 17 May 2021 13:09:05 -0700 Message-Id: <20210517130450.v7.8.Ib5fe0638da85800141ce141bb8e441c5f25438d4@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-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 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 d25e900f07ef..294d0bdd4cbe 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -280,6 +280,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 42a55d13864b..a59497f7e504 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 @@ -1446,19 +1447,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 Mon May 17 20:09:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12263097 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=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 75E05C433B4 for ; Mon, 17 May 2021 20:10:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E12061002 for ; Mon, 17 May 2021 20:10:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237957AbhEQULX (ORCPT ); Mon, 17 May 2021 16:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238128AbhEQULP (ORCPT ); Mon, 17 May 2021 16:11:15 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85F47C061756 for ; Mon, 17 May 2021 13:09:58 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id l70so5421497pga.1 for ; Mon, 17 May 2021 13:09:58 -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=WlNMhXEMVlZjVUXqmHsr4gjek/M5L9VF2F3wmQwU67I=; b=cFRgeXV8NlsiS1oD3xuRnGX2XdP/0u/Kfh3xQWMNBi0KIswi1XczxBDDe4cB0Dbkbq Kdak7ghVHhJTL2Jn0niy+ac3uD0OnZQ1KJFuHlQOrBCCMMbiB1NS0QTrfqn9e4OxLATN TvogIgE0Q4ZS5kdq7VJwctsxLa5CRIb8fbWGA= 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=WlNMhXEMVlZjVUXqmHsr4gjek/M5L9VF2F3wmQwU67I=; b=mz+YOR0MRr5KQgVKubIu7sMgaSGhbP15QNlkmlc5ue3Q1kOPjLg8ou06Q/44joRyBB oHYePCY1CjyY55sMLsPgPNG8dbh006gRrPFwX1iXsyd8Ff+spVFurGA2qgei+b5SugA2 umyp4mpwPLFCXLCZSrSJxFfoXweYc0gU7t/h/YY5ExY7ZKFgt7JzAtYWBdtk/SvbbpLX U+zqUy41erCgzywKGVMe6ws+LyXVjJVlronES2rpQh4kIYCSMQjTgsrJIvTzlb5VRZ6m U5PHwM1DRC+aF8OedTaF9u63hRRlY+8HTy5XH8SL7mAj6C8DMW6iNIoe8LmpCowtbvFx sRlw== X-Gm-Message-State: AOAM5317tCww6OQGlm/SSWVBYSijY0/LNtVlN+tVChp859q2rjwXwk5j bVV2mefiqhoLI9OmDxw9u1MjkQ== X-Google-Smtp-Source: ABdhPJzi1KCO1xj+wYDwMfBGJlV4IAZi3JbQkP29/R/2HZ+M6izq2Ry4gf+aiumrkOUg3ubgLkAhWQ== X-Received: by 2002:aa7:8a87:0:b029:27d:a1e:bc71 with SMTP id a7-20020aa78a870000b029027d0a1ebc71mr1205648pfc.14.1621282198096; Mon, 17 May 2021 13:09:58 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:57 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Daniel Vetter , David Airlie , Robert Foss , linux-kernel@vger.kernel.org Subject: [PATCH v7 09/10] drm/bridge: ti-sn65dsi86: Don't read EDID blob over DDC Date: Mon, 17 May 2021 13:09:06 -0700 Message-Id: <20210517130450.v7.9.I9330684c25f65bb318eff57f0616500f83eac3cc@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-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 --- 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 a59497f7e504..c9311e6e3799 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); } @@ -1354,8 +1334,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 Mon May 17 20:09:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12263099 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 853FAC433ED for ; Mon, 17 May 2021 20:10:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6575361359 for ; Mon, 17 May 2021 20:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238572AbhEQUL2 (ORCPT ); Mon, 17 May 2021 16:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238154AbhEQULR (ORCPT ); Mon, 17 May 2021 16:11:17 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC9BC0613ED for ; Mon, 17 May 2021 13:09:59 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id i5so5446737pgm.0 for ; Mon, 17 May 2021 13:09:59 -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=1UwU9EkWrODMcI+U3WAgeVuEyP427IMNTKjMOHdxTM0=; b=g3WODAH2i+aU+cIRqG6vWZWK6LQgC1mekg1RDZdIZDKEeUXLHcvmDCqvKlfaD7S6rV JZ+Qxs96T0EbefFWIa/JHdYoMv+YpZRS1o9PjVIdQoFMpJ/H7/rctpfzO7ERO9Rd51Ac FZBndcyste7QBFWzJ5dgIIzdbdVzmdxR+iguM= 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=1UwU9EkWrODMcI+U3WAgeVuEyP427IMNTKjMOHdxTM0=; b=X9Ve0ZprtHDpMk7XeMs5fz8F6To2F5Ca6bJO5mGEnMN7kSUM7+4cNv2WN4ON5BZ0jo yEKuxlv4sUc9z+99dADSvzN4r1X1EJkNhGXQWqgfIC+NX2sYGKW57WKdVPk7x2hj70qH xwLaBhtGh3hVqQNsoAsSRctUs4GzloIqN1Zlt1tUsb1xiABF3R6Y5U/o7Xwmu2aOG7b9 mpYtqnXRzyeNhPBa0hUtAZjcKwqQI81suYHQl5eGapIMIyu6qAmfX9e8l4RLlg+6rwAk e8PPH/6jESFiA18LOrgtYRv8ymMpZOfIf8IFm/w4bMZSuUg5JfXIGkbHuaECAphcxUB9 krUA== X-Gm-Message-State: AOAM533LcTzzo63j/v5Nhg0XPOML12QSeiog5qgF4np77hUKdECYCcnE 5+srMpzziRPlmBlbUpx5z0GVpw== X-Google-Smtp-Source: ABdhPJxyl3CVtWgAW9niHq8RrZzZop7XLx8u0xYbliB0AtmGj6fTylsaoI37vUp6/6aPr25KW3J3vw== X-Received: by 2002:a63:a019:: with SMTP id r25mr1198145pge.139.1621282199381; Mon, 17 May 2021 13:09:59 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:bc91:c597:ded0:7930]) by smtp.gmail.com with ESMTPSA id x19sm9078941pgj.66.2021.05.17.13.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 13:09:59 -0700 (PDT) From: Douglas Anderson To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sam Ravnborg Cc: Stanislav Lisovskiy , Lyude Paul , Thierry Reding , Stephen Boyd , Bjorn Andersson , linux-arm-msm@vger.kernel.org, Maarten Lankhorst , Linus W , dri-devel@lists.freedesktop.org, robdclark@chromium.org, Steev Klimaszewski , Douglas Anderson , Andy Gross , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 10/10] arm64: dts: qcom: sc7180-trogdor: Move panel under the bridge chip Date: Mon, 17 May 2021 13:09:07 -0700 Message-Id: <20210517130450.v7.10.Ibdb7735fb1844561b902252215a69526a14f9abd@changeid> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210517200907.1459182-1-dianders@chromium.org> References: <20210517200907.1459182-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 --- 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>; + }; + }; + }; + }; }; };