Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp810794iof; Mon, 6 Jun 2022 12:57:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5qASYr6HwO0l8S6JaE7Ed4Wnm9pOaizhDTETIHY+X/OyxBxR28yYhDliLseX2gmmT6/zH X-Received: by 2002:a63:6384:0:b0:3fc:68a8:b1ca with SMTP id x126-20020a636384000000b003fc68a8b1camr22186194pgb.597.1654545448239; Mon, 06 Jun 2022 12:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654545448; cv=none; d=google.com; s=arc-20160816; b=cCBdx5EONYwZlU6geM+6M3uRTnIryoLVfXIJ9HzoJeW/6y+Xod+lBt53KrFIvAKvd3 FD8niA7d2pgcf0lvt46ZJ7Fep8rsnbORfLYeWjcCJCM/wtDQDz6iDYTPGZ3zlyuV0YKW cEh4uQ6V02s+OsNQMN0xC4B7VihIuL95223fiw7Syyrfh+/CPOX60BocmUMkZyw3Gek7 uhXB2yNGaA0Cw6yiMwV28F1ai0cvvi0PB56Uxe9Y4jMI8sThvKZO4sh9B/WRuxnUpFSQ fP77SEBATaUjfkC3fIoyXcZOEFR+vnsVVYmtkNZJ1sVjWQ4i+heqlCp+pKbBKbn/GduK 4Q1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=wCRPXxH3TgL7AtKRIM4kQGYE5THJ1u4cAVHFfmnp23I=; b=m6XmvN98/ddVSTYIjj88STss6fZP/mOz9vu8so9t2e3c4jqR9kJph912w9kMm7sokh vRj+liTF6oNV8cm6yo3biH2brYebN6ZhJz1F8U2+cPd4Bdin8N+Gp6YXIx71uy6NykFn d09Ry26yItfE+w6OKce2FrcJ9O40Vq2ZRw5AmTZVP0gXoZzHpXaSaJHzv+E0i49/9jg7 Bzk6bhd7wPFKdPy0NMg44JnkJN0AhlJHkoykYyKX4JViiV4hAOofNySw0u350T9R2pVH j4YqUqXorAne8sBEWXzJffLwTdchNItlxGdX7YM2MR6znL03G7h6SYDrDYJfa6OjqAsG zhoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ravnborg.org header.s=rsa1 header.b=SF0ovNOO; dkim=neutral (no key) header.i=@ravnborg.org header.s=ed1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ch16-20020a17090af41000b001e323b3e810si19724885pjb.152.2022.06.06.12.57.16; Mon, 06 Jun 2022 12:57:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ravnborg.org header.s=rsa1 header.b=SF0ovNOO; dkim=neutral (no key) header.i=@ravnborg.org header.s=ed1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232382AbiFFTbj (ORCPT + 99 others); Mon, 6 Jun 2022 15:31:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232321AbiFFTbh (ORCPT ); Mon, 6 Jun 2022 15:31:37 -0400 Received: from mailrelay2-1.pub.mailoutpod1-cph3.one.com (mailrelay2-1.pub.mailoutpod1-cph3.one.com [46.30.210.183]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 469CCC6A for ; Mon, 6 Jun 2022 12:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=in-reply-to:content-type:mime-version:references:message-id:subject:cc:to: from:date:from; bh=wCRPXxH3TgL7AtKRIM4kQGYE5THJ1u4cAVHFfmnp23I=; b=SF0ovNOODl+ysB/CTvSKPbEriSHX/CRcfHRXG7MwzpxRCOlXVl2RHxnESjLDrzS2aGC2EVVbE3rvy XZ/tqcXYkX+0ZVagpfEWkXAhjQLKX8wOsJsVUOPk8s9aRpUr/97pTCnpXLo4fpiRYe0foBikXx/6wv NN2t48g57sOU2tYk0V2FI5M27BHRrdYwE5HBqO6qkmvjy8q+Gayyf2Lk8HpdH42OjJfPyAYX3E1nd4 H5k3a4/An1fRWJW31BA/jmYggXs4eD1ATWFbX9xTE1B/L4LYiEvY2T/pkQAvuCk82vqt3nEMKQKix0 tXx+TGTXm7eOjCZVneJFXhXkl5L7gLA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=in-reply-to:content-type:mime-version:references:message-id:subject:cc:to: from:date:from; bh=wCRPXxH3TgL7AtKRIM4kQGYE5THJ1u4cAVHFfmnp23I=; b=1F+wwMxDLCppDOU47omnaGMHoNwunuSPx33O8NmEVcVnFC/y171hv+XSeRzP12e3EInOVRzuZeNRm 1Dgt8V3Cg== X-HalOne-Cookie: 2bafee458b238af5551c965e6954a36589d2a2e0 X-HalOne-ID: 45c8e030-e5cf-11ec-a911-d0431ea8a290 Received: from mailproxy3.cst.dirpod3-cph3.one.com (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) by mailrelay2.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 45c8e030-e5cf-11ec-a911-d0431ea8a290; Mon, 06 Jun 2022 19:31:33 +0000 (UTC) Date: Mon, 6 Jun 2022 21:31:32 +0200 From: Sam Ravnborg To: Hsin-Yi Wang Cc: Chun-Kuang Hu , Hans de Goede , Thierry Reding , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it Message-ID: References: <20220606152431.1889185-1-hsinyi@chromium.org> <20220606152431.1889185-9-hsinyi@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220606152431.1889185-9-hsinyi@chromium.org> X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hsin-Yi, On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang wrote: > Panel orientation property should be set before drm_dev_register(). > Mediatek drm driver calls drm_dev_register() in .bind(). However, most > panels sets orientation property relatively late, mostly in .get_modes() > callback, since this is when they are able to get the connector and > binds the orientation property to it, though the value should be known > when the panel is probed. > > Let the drm driver check if the remote end point is a panel and if it > contains the orientation property. If it does, set it before > drm_dev_register() is called. I do not know the best way to do what you need to do here. But it seems wrong to introduce a deprecated function (drm_of_find_panel_or_bridge), to set the rotation property early. I think you need to find a way to do this utilising the panel_bridge or something. Sam > > Signed-off-by: Hsin-Yi Wang > Reviewed-by: Hans de Goede > Reviewed-by: AngeloGioacchino Del Regno > --- > drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index d9f10a33e6fa..c56282412bfa 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -185,6 +185,7 @@ struct mtk_dsi { > struct drm_encoder encoder; > struct drm_bridge bridge; > struct drm_bridge *next_bridge; > + struct drm_panel *panel; > struct drm_connector *connector; > struct phy *phy; > > @@ -822,6 +823,12 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) > ret = PTR_ERR(dsi->connector); > goto err_cleanup_encoder; > } > + > + /* Read panel orientation */ > + if (dsi->panel) > + drm_connector_set_panel_orientation(dsi->connector, > + drm_panel_get_orientation(dsi->panel)); > + > drm_connector_attach_encoder(dsi->connector, &dsi->encoder); > > return 0; > @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) > struct drm_device *drm = data; > struct mtk_dsi *dsi = dev_get_drvdata(dev); > > + /* Get panel if existed */ > + drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL); > + > ret = mtk_dsi_encoder_init(drm, dsi); > if (ret) > return ret; > -- > 2.36.1.255.ge46751e96f-goog