From patchwork Wed Jun 1 09:46:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12866617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7BCCAC433EF for ; Wed, 1 Jun 2022 10:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ngVTA6jkk7Jb1RkwFv9DhkXCV/dwDOgZIq3wTIPjk50=; b=J16/E/o0O0YZuL gBy8nlbj93A42zy5Tee9MGgjDpXOrcKQ4vOdcE9+bsUQifZHsSUGpoe+UXDdH3mgN53SDIRxeQ6l4 3iJw4gJ02A+s7rR5zfzvuhjYfAubpca3BOMHUiHodrQT2RDyiClyDFxjSKHSUNWhO8Uf8R8hLDRlG KjEEm9Hdu11pI6I6kThxOtv4PufZcUK4zlLLrNemnpB68Yqz9AWrNfdjK9Nm4DlQARiBP6c8HKlVt 4hg+JB1NYtoCrQo+g4cj5V3VGtcwU2mk7ctRvSFQeUHbvBME7b+RGhbbmJ8exhqe57yWCRfabhWHJ ta+qSKYih95ufXK/NKcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwLGN-00F9a1-Gx; Wed, 01 Jun 2022 10:07:40 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwKwc-00F1XU-4k for linux-arm-kernel@lists.infradead.org; Wed, 01 Jun 2022 09:47:16 +0000 Received: by mail-pj1-x1029.google.com with SMTP id nn3-20020a17090b38c300b001e0e091cf03so3479661pjb.1 for ; Wed, 01 Jun 2022 02:47:12 -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=kFnswbSxGwrRy/NQADQjmmMBaytsFgRzRtZUq2P5fVw=; b=ErjYVzHSMtL2UomTsVi7tibDCfhMwLbxBslThaP44wqh4DHChnKrN++NI5RhSZPYfC Gm3RRstEdhV4L3kxlolN40Nsg9TYKbIF6sbCjvLhWMacNHii7EhOCl8zF8PssLNTP/fS YGFNj0OxIkbV3RMUocdQHadyiWO87CoS4BxS8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kFnswbSxGwrRy/NQADQjmmMBaytsFgRzRtZUq2P5fVw=; b=np5oQ/Ew0SKApZnugxZJfkjoHkPOOIDZleAnrrY3Ry9AGGdLeihG6LD+iwH9+NEbRr zlLBw6VCxCFekTZOg2+2QWfQ6cuG91gKQpSkoPJLsIL91DYe6bWFXmnsKkRFkVtUV/pf duKB3lbVlUhEqMZOSGQxJjfBn6BVz2w2Dqtjp1tfHy7D+LLB9zZfZwDkUymeU5yZtCWI EI4AvG2A/zZiXCdDAbDElCZdHyCu8I17ZpSRc2cWGFkcEaSyOgCx68PTErrivpRBQZbE XEuzl7sj5UkQfAdxxuxvOKX79yDdGTMdKJjdn+C82yON/Is8o8D50uxGo6tJHwqsWGAM WpMw== X-Gm-Message-State: AOAM531iu3SjEqtVhmcnCvW0STSPaGqYMGcaN4ssqAjSV77VEuTFUGCt MtG+G5JPw6vYo5fOV/6UKz/lcg== X-Google-Smtp-Source: ABdhPJxrRTUbKi5bPBa/fX0MOFI2Wb3mwKyCfpA3888E4QDVRu2YuRIzrg8baKhCW1q9srQYrEq3/w== X-Received: by 2002:a17:902:aa04:b0:163:c204:f41 with SMTP id be4-20020a170902aa0400b00163c2040f41mr17751950plb.172.1654076831401; Wed, 01 Jun 2022 02:47:11 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:dc30:e75c:ae95:f2d6]) by smtp.gmail.com with ESMTPSA id x42-20020a056a0018aa00b0050dc762815esm1039494pfh.56.2022.06.01.02.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 02:47:11 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , 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: [PATCH v2 8/8] drm/mediatek: Config orientation property if panel provides it Date: Wed, 1 Jun 2022 17:46:37 +0800 Message-Id: <20220601094637.1200634-9-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220601094637.1200634-1-hsinyi@chromium.org> References: <20220601094637.1200634-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220601_024714_266974_F7C32083 X-CRM114-Status: GOOD ( 19.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. Signed-off-by: Hsin-Yi Wang --- v1->v2: remove unused checks. --- 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 bd3f5b485085..86613360d2d9 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;