Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2883673ybk; Mon, 18 May 2020 10:14:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvHylq7VCN3gBcKCARQZtPPTlkgqesh/qbNd0ce00DP/Fk0zBqtd/nkX57Y7QFnh9oAcMA X-Received: by 2002:a50:ec83:: with SMTP id e3mr14676087edr.349.1589822044276; Mon, 18 May 2020 10:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589822044; cv=none; d=google.com; s=arc-20160816; b=FAZ6/mEGLAbekBQgWgMHe7asTeQaYCk4yUyUckPJa7upKRhMHjCfPIqFxhlH4W65lJ Ihk3XWZwhpIUbUpekB2fMUMnETGKKem4S9l+WeC/5ylj0aGFiHjYZA9RQTbnUfnQZCKz bcuPx1J7ahXuVhd6prb0llv4Zmsl6E3bS1GX1Vcu8xrWlyOM/+Mog+W5expXHTtWJ0k9 S4HE1RmZnPQqGnHUzbQphiDl4l5DuE9aTOJoKMKEU/2FqcpQAqZruhP1MoRosfDijQdC 04sUh5mMXUHvQsPz+uDg+ZzfoUffTuE6og40I0+pq58EGxa7JLOB0K99rnLRrsrTpH1Q WCVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yijTSszOmirrN4dcf+zjcxVlnR23zFrRY84RCRmsEHc=; b=J/MYkqNXITC+9+uWBjx7tp9eiRfdIzBC9cm0t21xD1GS7pZTw38q+Z2BkpH5f8oEuM dABvHDXpTFc+PrAPvpMXC50tZTsWURd8qGQPVySi3fnd7JR1VJkkYszItjuDfpwSOjyl LczNJBBWrvnttmJvIcFCS5Dyjwwp+sXi5xAnAjJPQP1hE2pLf22gq9+4j7Wtq4+2O6LN xkhG1d7Wt4bWhWv476dtmyh35CN4yYAbKXo+RcsJOSG8IZp4s4yNNIDc4OUwC+rPok3M n9Pj6Cln8LENhoZehArLoLIFlbVfSmLCEvksvh6P/jCSrWxa8njEPqrmDfl2lGVLCJ67 WX/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="X/0XbD1l"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x16si7422173edi.31.2020.05.18.10.13.40; Mon, 18 May 2020 10:14:04 -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=@gmail.com header.s=20161025 header.b="X/0XbD1l"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728293AbgERRMC (ORCPT + 99 others); Mon, 18 May 2020 13:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727006AbgERRMB (ORCPT ); Mon, 18 May 2020 13:12:01 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E47D4C061A0C for ; Mon, 18 May 2020 10:12:00 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id v15so5071204qvr.8 for ; Mon, 18 May 2020 10:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=yijTSszOmirrN4dcf+zjcxVlnR23zFrRY84RCRmsEHc=; b=X/0XbD1lQ13+eZr52dRelGxdLfX0hNxu9gqDRuBIKnHVBfXNSmt3sr1StzGjNq3ATp nNh6rUAGrIWX/x8hE4jWd2RRAgmPmlycThUeU8WIYZRIWTUwYWY3TxwHbq+YkmRJwRRk kgWuQwZQHzcHXftWPvc4bYAjMMueXFM7Jh79R7dekcaUAq+bGIvla3ClJIsDD4sSoiRi fTxxRnS9jpIqpBEAFH5DlPgeG1zILA1j4M6xBkYJXfmVBspw9MxlDEVkgHinl5JK3JsM JcUj6sPSahs04snUCY6B7x0tA5ueFI7SLNXkbQBMtbEIYhtnCmjztw4yuQtTitFPU7WJ 9wqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=yijTSszOmirrN4dcf+zjcxVlnR23zFrRY84RCRmsEHc=; b=Dzo1Req3MuX/eQKjaSRBPM1uPT6yT4oVnWrVehTHT5nMsk9iTSlbuwLHmmvPkTL9R9 Qu902xyoMV6fAf+0upbJXCes+0zGh2kPXA3KJtwo10XOdGsjNnlFmb3MnrIC8KLpqqy0 qU8W37ja+epa/iOjvnZIbDodtfUZOv1yMowCKX750Zpt7XZhLtKV8p2e63fnslJjO3hM 4fMdhf4bOt+AeeT+6ch5n9nCVCgyTwY1Mav7J8nEgf3veoIFQrQVUJ0woi9VmkeInNv7 uEVAD7V7ZN13OZbW6dAHAdxRNkxiWzOoFofEfqpQf/IK+ckbECxFOC6N2AGzzYjIlwoP gfRQ== X-Gm-Message-State: AOAM532VyaicGseIefksc3oHZ+LVk1wNjSGMryvD4Zcbjbn/if9D+6V4 aWX7U0JpPFlEg7ahndEKBlyDknB62kFXgINfPJI= X-Received: by 2002:a05:6214:370:: with SMTP id t16mr11194223qvu.197.1589821920011; Mon, 18 May 2020 10:12:00 -0700 (PDT) MIME-Version: 1.0 References: <20200501152335.1805790-1-enric.balletbo@collabora.com> <20200501152335.1805790-8-enric.balletbo@collabora.com> <53683f2d-23c7-57ab-2056-520c50795ffe@collabora.com> <37191700-5832-2931-5764-7f7fddd023b9@collabora.com> In-Reply-To: From: Enric Balletbo Serra Date: Mon, 18 May 2020 19:11:48 +0200 Message-ID: Subject: Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges To: Chun-Kuang Hu Cc: Enric Balletbo i Serra , linux-kernel , Collabora Kernel ML , Nicolas Boichat , Philipp Zabel , David Airlie , dri-devel , "moderated list:ARM/Mediatek SoC support" , Laurent Pinchart , Daniel Vetter , Hsin-Yi Wang , Matthias Brugger , Sam Ravnborg , Linux ARM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chun-Kuang, Missatge de Chun-Kuang Hu del dia ds., 16 de maig 2020 a les 12:11: > > Hi, Enric: > > Enric Balletbo i Serra =E6=96=BC 2020=E5= =B9=B45=E6=9C=8815=E6=97=A5 =E9=80=B1=E4=BA=94 =E4=B8=8A=E5=8D=881:35=E5=AF= =AB=E9=81=93=EF=BC=9A > > > > Hi again, > > > > On 14/5/20 19:12, Enric Balletbo i Serra wrote: > > > Hi Chun-Kuang, > > > > > > On 14/5/20 18:44, Chun-Kuang Hu wrote: > > >> Hi, Enric: > > >> > > >> Enric Balletbo i Serra =E6=96=BC 2020= =E5=B9=B45=E6=9C=8814=E6=97=A5 =E9=80=B1=E5=9B=9B =E4=B8=8B=E5=8D=8811:42= =E5=AF=AB=E9=81=93=EF=BC=9A > > >>> > > >>> Hi Chun-Kuang, > > >>> > > >>> On 14/5/20 16:28, Chun-Kuang Hu wrote: > > >>>> Hi, Enric: > > >>>> > > >>>> Enric Balletbo Serra =E6=96=BC 2020=E5=B9=B4= 5=E6=9C=8814=E6=97=A5 =E9=80=B1=E5=9B=9B =E4=B8=8A=E5=8D=8812:41=E5=AF=AB= =E9=81=93=EF=BC=9A > > >>>>> > > >>>>> Hi Chun-Kuang, > > >>>>> > > >>>>> Missatge de Enric Balletbo i Serra = del > > >>>>> dia dv., 1 de maig 2020 a les 17:25: > > >>>>>> > > >>>>>> Use the drm_bridge_connector helper to create a connector for pi= pelines > > >>>>>> that use drm_bridge. This allows splitting connector operations = across > > >>>>>> multiple bridges when necessary, instead of having the last brid= ge in > > >>>>>> the chain creating the connector and handling all connector oper= ations > > >>>>>> internally. > > >>>>>> > > >>>>>> Signed-off-by: Enric Balletbo i Serra > > >>>>>> Acked-by: Sam Ravnborg > > >>>>> > > >>>>> A gentle ping on this, I think that this one is the only one that > > >>>>> still needs a review in the series. > > >>>> > > >>>> This is what I reply in patch v3: > > >>>> > > >>> > > >>> Sorry for missing this. > > >>> > > >>>> I think the panel is wrapped into next_bridge here, > > >>>> > > >>> > > >>> Yes, you can have for example: > > >>> > > >>> 1. drm_bridge (mtk_dsi) -> drm_bridge (ps8640 - dsi-to-edp) -> drm_= panel_bridge > > >>> (edp panel) > > >>> > > >>> or a > > >>> > > >>> 2. drm_bridge (mtk_dsi)-> drm_panel_bridge (dsi panel) > > >>> > > >>> The _first_ one is my use case > > >>> > > >>>> if (panel) { > > >>> > > >>> This handles the second case, where you attach a dsi panel. > > >>> > > >>>> dsi->next_bridge =3D devm_drm_panel_bridge_add(dev, panel); > > >>>> > > >>>> so the next_bridge is a panel_bridge, in its attach function > > >>>> panel_bridge_attach(), > > >>>> according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist= , > > >>>> it would create connector and attach connector to panel. > > >>>> > > >>>> I'm not sure this flag would exist or not, but for both case, it's= strange. > > >>>> If exist, you create connector in this patch but no where to attac= h > > >>>> connector to panel. > > >>> > > >>> Yes, in fact, this is transitional patch needed, as once I converte= d mtk_dpi, > > >>> mtk_dsi and mtk_hdmi to the new drm_bridge API the drm_bridge_conne= ctor_init() > > >>> will be done in mtk_drm_drv. We will need to call drm_bridge_connec= tor_init for > > >>> dpi and dsi pipes and remove that call from mtk_dsi and mtk_dpi dri= vers. The > > >>> graphic controller driver should create connectors and CRTCs, as ex= ample you can > > >>> take a look at drivers/gpu/drm/omapdrm/omap_drv.c > > >>> > > >> > > >> I have such question because I've reviewed omap's driver. In omap's > > >> driver, after it call drm_bridge_connector_init(), it does this: > > >> > > >> if (pipe->output->panel) { > > >> ret =3D drm_panel_attach(pipe->output->panel, > > >> pipe->connector); > > >> if (ret < 0) > > >> return ret; > > >> } > > >> > > >> In this patch, you does not do this. > > >> > > > > > > I see, so yes, I am probably missing call drm_panel_attach in case th= ere is a > > > direct panel attached. Thanks for pointing it. > > > > > > I'll send a new version adding the drm_panel_attach call. > > > > > > > Wait, shouldn't panel be attached on the call of mtk_dsi_bridge_attach = as > > next_bridge points to a bridge or a panel? > > > > static int mtk_dsi_bridge_attach(struct drm_bridge *bridge, > > enum drm_bridge_attach_flags flags) > > { > > struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); > > > > /* Attach the panel or bridge to the dsi bridge */ > > return drm_bridge_attach(bridge->encoder, dsi->next_bridge, > > &dsi->bridge, flags); > > } > > > > Or I am continuing misunderstanding all this? > > > > My point is: when do you attach panel to a connector? > In this patch, > > ret =3D drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, > DRM_BRIDGE_ATTACH_NO_CONNECTOR)= ; > > it would call into mtk_dsi_bridge_attach() with > DRM_BRIDGE_ATTACH_NO_CONNECTOR, and call into panel_bridge_attach() > with DRM_BRIDGE_ATTACH_NO_CONNECTOR. My understanding is that the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag is to ease transition between the old and the new model. The drivers that support the new model shall set that flag. > If you does not pass DRM_BRIDGE_ATTACH_NO_CONNECTOR into > panel_bridge_attach(), it would create a connector and attach panel to > that connector. Yes, and create a connector an attach the panel is the old model, I guess. Hence we are passing DRM_BRIDGE_ATTACH_NO_CONNECTOR. > And you pass DRM_BRIDGE_ATTACH_NO_CONNECTOR into > panel_bridge_attach(), so I thiink you need to create connector and > attach panel to that connector by yourself (this is what omap does). > Yes, omap driver supports both models the old and the new. For mtk_dsi I expect all the drivers in the chain use the new model. IIUC create the connector here and attach to the panel is only needed to support also the old model. drm_panel_attach() is called in panel_bridge_attach() which is the drm_brige_funcs.attach() handler for the panel bridge. As we're using the panel bridge dsi->next_bridge =3D devm_drm_panel_bridge_add(dev, panel); there should be no need to call drm_panel_attach(). My point is, do we need to support the old model for mtk_dsi driver even we don't have users for the old model, or can we migrate unconditionally? Please correct me if I'm still misunderstanding the problem. Regards, Enric > Regards, > Chun-Kuang. > > > >>>> If not exist, the next_brige would create one connector and this b= rige > > >>>> would create another connector. > > >>>> > > >>>> I think in your case, mtk_dsi does not directly connect to a panel= , so > > >>> > > >>> Exactly > > >>> > > >>>> I need a exact explain. Or someone could test this on a > > >>>> directly-connect-panel platform. > > >>> > > >>> I don't think I am breaking this use case but AFAICS there is no us= ers in > > >>> mainline that directly connect a panel using the mediatek driver. A= s I said my > > >>> use case is the other so I can't really test. Do you know anyone th= at can test this? > > >> > > >> I'm not sure who can test this, but [1], which is sent by YT Shen in= a > > >> series, is a patch to support dsi command mode so dsi could directly > > >> connect to panel. > > >> > > >> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.g= it/commit/drivers/gpu/drm/mediatek?h=3Dv5.7-rc5&id=3D21898816831fc60c92dd63= 4ab4316a24da7eb4af > > >> > > >> It's better that someone could test this case, but if no one would > > >> test this, I could also accept a good-look patch. > > >> > > >> Regards, > > >> Chun-Kuang. > > >> > > >>> > > >>> Thanks, > > >>> Enric > > >>> > > >>>> > > >>>> Regards, > > >>>> Chun-Kuang. > > >>>> > > >>>>> > > >>>>> Thanks, > > >>>>> Enric > > >>>>> > > >>>>>> --- > > >>>>>> > > >>>>>> Changes in v4: None > > >>>>>> Changes in v3: > > >>>>>> - Move the bridge.type line to the patch that adds drm_bridge su= pport. (Laurent Pinchart) > > >>>>>> > > >>>>>> Changes in v2: None > > >>>>>> > > >>>>>> drivers/gpu/drm/mediatek/mtk_dsi.c | 13 ++++++++++++- > > >>>>>> 1 file changed, 12 insertions(+), 1 deletion(-) > > >>>>>> > > >>>>>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/dr= m/mediatek/mtk_dsi.c > > >>>>>> index 4f3bd095c1ee..471fcafdf348 100644 > > >>>>>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > > >>>>>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > > >>>>>> @@ -17,6 +17,7 @@ > > >>>>>> > > >>>>>> #include > > >>>>>> #include > > >>>>>> +#include > > >>>>>> #include > > >>>>>> #include > > >>>>>> #include > > >>>>>> @@ -183,6 +184,7 @@ struct mtk_dsi { > > >>>>>> struct drm_encoder encoder; > > >>>>>> struct drm_bridge bridge; > > >>>>>> struct drm_bridge *next_bridge; > > >>>>>> + struct drm_connector *connector; > > >>>>>> struct phy *phy; > > >>>>>> > > >>>>>> void __iomem *regs; > > >>>>>> @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm= _device *drm, struct mtk_dsi *dsi) > > >>>>>> */ > > >>>>>> dsi->encoder.possible_crtcs =3D 1; > > >>>>>> > > >>>>>> - ret =3D drm_bridge_attach(&dsi->encoder, &dsi->bridge, N= ULL, 0); > > >>>>>> + ret =3D drm_bridge_attach(&dsi->encoder, &dsi->bridge, N= ULL, > > >>>>>> + DRM_BRIDGE_ATTACH_NO_CONNECTOR); > > >>>>>> if (ret) > > >>>>>> goto err_cleanup_encoder; > > >>>>>> > > >>>>>> + dsi->connector =3D drm_bridge_connector_init(drm, &dsi->= encoder); > > >>>>>> + if (IS_ERR(dsi->connector)) { > > >>>>>> + DRM_ERROR("Unable to create bridge connector\n")= ; > > >>>>>> + ret =3D PTR_ERR(dsi->connector); > > >>>>>> + goto err_cleanup_encoder; > > >>>>>> + } > > >>>>>> + drm_connector_attach_encoder(dsi->connector, &dsi->encod= er); > > >>>>>> + > > >>>>>> return 0; > > >>>>>> > > >>>>>> err_cleanup_encoder: > > >>>>>> -- > > >>>>>> 2.26.2 > > >>>>>> > > >>>>>> > > >>>>>> _______________________________________________ > > >>>>>> Linux-mediatek mailing list > > >>>>>> Linux-mediatek@lists.infradead.org > > >>>>>> http://lists.infradead.org/mailman/listinfo/linux-mediatek > > >