Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp15761pxb; Wed, 25 Aug 2021 18:34:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjo8zj6B0/dBT4wh2gM8yG9yg6xAjTM44Z13LvXQWOWKBA0zOA05ZH8znFOxp0tSpzLuID X-Received: by 2002:a17:906:b25a:: with SMTP id ce26mr1605568ejb.174.1629941664245; Wed, 25 Aug 2021 18:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629941664; cv=none; d=google.com; s=arc-20160816; b=E5Pjs6F0L8cGHtu/t8Ve7Lm2KCWqiOt9uOJiZfzE8pInEGSxGywKwFsre9izwlIPf7 RO1hj0FBbioCpoUTjt466Qgg3kRcnCo2IMW4Y5D58GNUkMO+etNC/hWFDK3jV1L3TrH1 /uBFopzKZQOjYm6bXwumxQClzRywy6Iq9++PrD+8t2vzO9lAW9zW6nWRz0VEk/o0yJLo nGxeSRv4gyvQ/X+Hg+lDSeZCP6eDw9Ax6pDa0VAh+mXDmh/H6UIA0MNk/Un9b7B5ud7o BasYyiGMMxwuNoRLoTCIqwJkmBboFwulS63WtXv3Rq8au5/Jx+yAO8Md2eRFC9JNMHw8 HKLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=Gg/g05c4UHis1jo3/o9kO4T0lNRRr/zY+8C1O4NlkAo=; b=vnwQC5vZG23/iYzBDsR2iuJbhdRjM/Nt1qMSpsjWyZB7S6Xj1WHmgH3/rleTiRnAVN dJbPsr9qDOblJSt/Yf6fLcKJ85Qtcmsh/7vy8+/aW7cUjvGqn3oq4XxwVIwqWya4ywUg pePkBojUiwEDnqUcF1tZlqxosO8a9IdcgK72vVCnyMzIT9TbKO78wykeXTf5Y9Jp6gVk AlhIuiHYzwY41VgzIHGX7iqyN2FdOS/fVPIwMdEzWkbc1Kgs4BTj+Vr0LZj0oNDeZUkr 1e3DoUk2gwwIOxNuW1iyLuZd85j/dilC3X7DuK5wD9v0eGnWukvxWXoK7VFCouNmqoS3 WGzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MuAvpb4H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si1617667edw.155.2021.08.25.18.33.38; Wed, 25 Aug 2021 18:34:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MuAvpb4H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229514AbhHZBc3 (ORCPT + 99 others); Wed, 25 Aug 2021 21:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235172AbhHZBc3 (ORCPT ); Wed, 25 Aug 2021 21:32:29 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FCA7C0613C1 for ; Wed, 25 Aug 2021 18:31:42 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id q39so2086918oiw.12 for ; Wed, 25 Aug 2021 18:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=Gg/g05c4UHis1jo3/o9kO4T0lNRRr/zY+8C1O4NlkAo=; b=MuAvpb4Hnu812Gso+cfKMYOMAOkd8SRKbrPszY2qFC4onLhQQTr75dfPoV07asaL5a 0e+FwDK2/mZcbp04o3bidjAUL1go52LPs1mnD/6mhCvZtm6Asydvi9ABfQsCV28JnR6y XwoVXUou6hQRhdwox6XFGMUROkYMWNoddlor4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=Gg/g05c4UHis1jo3/o9kO4T0lNRRr/zY+8C1O4NlkAo=; b=nRhNR5hpg+/g+OgRLV+kR7OAccx5tJEmBL3SOKjMGplJ53U9c4LkKhIshg344hxDF8 QCHIVaHVloTp9HNiiO7nKuTWszVdYC1CYRurxC/EUwTpr2/+UgE1a+SWc9nJsQNJ4LuJ QS5zc6ApBI0LZjMqPTYCcwvV0gEyqehMtOecyNvwydvqjA7OgUMnYjHgi47U//5iQQO/ lEG3ZLCdSbs6PkeTcrYgCK8vBjCGlVR6/Ma+zEw+vzDlj7MY8hiSqMm+w2IjTJr92NYl DwtRf9g0y4RkOT+RgzvMzhj28uoYZ8zs0rXLlAjQEA/xGLE29FyPltv7RUFNNnKVj7Rh 1Mmg== X-Gm-Message-State: AOAM5318UNcmIRojrSFOmG/tQd3UwfnGgkxcpTfx+fBuA6RNffURltdV z1pz2BEas/Y2+6ZvXlVKC3FUBdgELDrN5FQ4ii24TA== X-Received: by 2002:a54:468d:: with SMTP id k13mr9218145oic.125.1629941501894; Wed, 25 Aug 2021 18:31:41 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 26 Aug 2021 01:31:41 +0000 MIME-Version: 1.0 In-Reply-To: <20210726231351.655302-1-bjorn.andersson@linaro.org> References: <20210726231351.655302-1-bjorn.andersson@linaro.org> From: Stephen Boyd User-Agent: alot/0.9.1 Date: Thu, 26 Aug 2021 01:31:41 +0000 Message-ID: Subject: Re: [RFC] drm/msm/dp: Allow attaching a drm_panel To: Bjorn Andersson , Daniel Vetter , David Airlie , Rob Clark , Sean Paul Cc: Kuogee Hsieh , Abhinav Kumar , Chandan Uddaraju , Vara Reddy , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Douglas Anderson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Bjorn Andersson (2021-07-26 16:13:51) > eDP panels might need some power sequencing and backlight management, > so make it possible to associate a drm_panel with a DP instance and > prepare and enable the panel accordingly. > > Signed-off-by: Bjorn Andersson > --- > > This solves my immediate problem on my 8cx laptops, of indirectly controlling > the backlight during DPMS. But my panel is powered when I boot it and as such I > get the hpd interrupt and I don't actually have to deal with a power on > sequence - so I'm posting this as an RFC, hoping to get some input on these > other aspects. > > If this is acceptable I'd be happy to write up an accompanying DT binding > change that marks port 2 of the DP controller's of_graph as a reference to the > attached panel. dianders@ mentioned creating a connector (and maybe a bridge) for the DP connector (not eDP)[1]. I'm not sure that's directly related, but I think with the aux bus code the panel isn't managed in the encoder driver. Instead the encoder sees a bridge and tries to power it up and then query things over the aux bus? It's all a little too fuzzy to me right now so I could be spewing nonsense but I think we want to take this bridge route if possible. -Stephen [1] https://lore.kernel.org/r/CAD=FV=Xd9fizYdxfXYOkpJ_1fZcHp3-ROJ7k4iPg0g0RQ_+A3Q@mail.gmail.com/ > > drivers/gpu/drm/msm/dp/dp_display.c | 15 +++++++++++++-- > drivers/gpu/drm/msm/dp/dp_display.h | 1 + > drivers/gpu/drm/msm/dp/dp_parser.c | 19 +++++++++++++++++++ > drivers/gpu/drm/msm/dp/dp_parser.h | 1 + > 4 files changed, 34 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > index 206bf7806f51..1db5a3f752d2 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > > #include "msm_drv.h" > #include "msm_kms.h" > @@ -252,6 +253,8 @@ static int dp_display_bind(struct device *dev, struct device *master, > goto end; > } > > + dp->dp_display.drm_panel = dp->parser->drm_panel; > + > rc = dp_aux_register(dp->aux, drm); > if (rc) { > DRM_ERROR("DRM DP AUX register failed\n"); > @@ -867,8 +870,10 @@ static int dp_display_set_mode(struct msm_dp *dp_display, > return 0; > } > > -static int dp_display_prepare(struct msm_dp *dp) > +static int dp_display_prepare(struct msm_dp *dp_display) > { > + drm_panel_prepare(dp_display->drm_panel); > + > return 0; > } > > @@ -886,6 +891,8 @@ static int dp_display_enable(struct dp_display_private *dp, u32 data) > if (!rc) > dp_display->power_on = true; > > + drm_panel_enable(dp_display->drm_panel); > + > return rc; > } > > @@ -915,6 +922,8 @@ static int dp_display_disable(struct dp_display_private *dp, u32 data) > if (!dp_display->power_on) > return 0; > > + drm_panel_disable(dp_display->drm_panel); > + > /* wait only if audio was enabled */ > if (dp_display->audio_enabled) { > /* signal the disconnect event */ > @@ -939,8 +948,10 @@ static int dp_display_disable(struct dp_display_private *dp, u32 data) > return 0; > } > > -static int dp_display_unprepare(struct msm_dp *dp) > +static int dp_display_unprepare(struct msm_dp *dp_display) > { > + drm_panel_unprepare(dp_display->drm_panel); > + > return 0; > } > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h > index 8b47cdabb67e..ce337824c95d 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.h > +++ b/drivers/gpu/drm/msm/dp/dp_display.h > @@ -15,6 +15,7 @@ struct msm_dp { > struct device *codec_dev; > struct drm_connector *connector; > struct drm_encoder *encoder; > + struct drm_panel *drm_panel; > bool is_connected; > bool audio_enabled; > bool power_on; > diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c > index fc8a6452f641..e6a6e9007bfd 100644 > --- a/drivers/gpu/drm/msm/dp/dp_parser.c > +++ b/drivers/gpu/drm/msm/dp/dp_parser.c > @@ -6,6 +6,7 @@ > #include > #include > > +#include > #include > > #include "dp_parser.h" > @@ -276,6 +277,20 @@ static int dp_parser_clock(struct dp_parser *parser) > return 0; > } > > +static int dp_parser_find_panel(struct dp_parser *parser) > +{ > + struct device_node *np = parser->pdev->dev.of_node; > + int rc; > + > + rc = drm_of_find_panel_or_bridge(np, 2, 0, &parser->drm_panel, NULL); > + if (rc == -ENODEV) > + rc = 0; > + else if (rc) > + DRM_ERROR("failed to acquire DRM panel: %d\n", rc); > + > + return rc; > +} > + > static int dp_parser_parse(struct dp_parser *parser) > { > int rc = 0; > @@ -297,6 +312,10 @@ static int dp_parser_parse(struct dp_parser *parser) > if (rc) > return rc; > > + rc = dp_parser_find_panel(parser); > + if (rc) > + return rc; > + > /* Map the corresponding regulator information according to > * version. Currently, since we only have one supported platform, > * mapping the regulator directly. > diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h > index 3266b529c090..994ca9336acd 100644 > --- a/drivers/gpu/drm/msm/dp/dp_parser.h > +++ b/drivers/gpu/drm/msm/dp/dp_parser.h > @@ -122,6 +122,7 @@ struct dp_parser { > struct dp_display_data disp_data; > const struct dp_regulator_cfg *regulator_cfg; > u32 max_dp_lanes; > + struct drm_panel *drm_panel; > > int (*parse)(struct dp_parser *parser); > }; > --