From patchwork Mon Jun 6 15:24:31 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: 12870583 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 A835FC43334 for ; Mon, 6 Jun 2022 15:29:24 +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=M3HSTsf7uO/Jn7ofZtqiB3fo5f6MMm689bPDZWz7eKg=; b=HTTJ6z1paXaKus 0q3gdhP4w6QPROue7gK38C+FTyv4DzUUK60gWJAq1U1HoYcDlYrrgu8f+mTGpbWl8CvfZ7/y+L6+l HkUNOpHQ62nX+4p6oEyGzDyHSfQL7Abtl1XYmVpJsrdzbc3SzZrRclLc5t7MSsxzbRsy9ADQiokAb V7Fm2htKCQxXOQFvbnmxZR3Vs/xH9Znp8t0L56VV+/dkXH/+N9+n63JYJfgjRzJWR0LdcBgLdztbL HcNCO0TKNX0N0+3nPKm9ynMdOfVn2MRaXs86HT9nWYAJ5znkNJveQcdm40HFXBRLV+pAogKl2eVWk MJJHWxWBambLYjmJCZSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEe4-001o1i-EG; Mon, 06 Jun 2022 15:27:56 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEbN-001mS6-9w for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:25:10 +0000 Received: by mail-pf1-x42b.google.com with SMTP id j6so12937537pfe.13 for ; Mon, 06 Jun 2022 08:25:05 -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=i0tXsXMGjaecgqX3jWpPhbYuXc4NjomTM5fJCVscSk0=; b=a/ZhaRa9zo0Z+8UTqr4oxABM0QmsWfKwzfWfEdvvhnN7Kt79x0XsK9jl0J5IM9yQgp b7jru9uewrcIzSerXlyuYqTRy1pNQeDmmpu5FQRcXa3YM8E55k+kbzDJQHWPunqxd7vA uWSj9XuO4JXDZUEQ94DhrV+B3k8FRVN8nJIUk= 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=i0tXsXMGjaecgqX3jWpPhbYuXc4NjomTM5fJCVscSk0=; b=ITtpOmhCG7j1fTpkemTYYnH1gomy3gKLnroelWZCu6T0s/qvgMvJM6+Wm45CSZric1 xq9kF1QptZhBV3erYsR9h+1WToQFQIvbpTHQNk2Zz4by23jSRo9KISUqGSB7YpqMcRpE peANJpBrrcQnOhbriIzrGFLAVU72mqSd5Hi7slxtamCPytKbylnwiEjV96B/pnOYF+p4 DCgY19uawEsiki4VYGpBqMdCcqx5yjAfGIFe7ck/IUs5uKn5MphEUnoEjGXIEcHR8u0t a9QTszJmqqcmajk1JQ06IIqQP0PDo1NGrNGGBolCUPWFus9iJPn6XiBvWbW10MM7jVqM Tf4g== X-Gm-Message-State: AOAM532zdQJ5VdQBVGeWfrgooSkv+W+OjjiOj2I6bRLyzRdxKFTBuu6q 29JEjmGL5n2UIRgQZhe8vEosnA== X-Google-Smtp-Source: ABdhPJwqPPpmDUkcXjmB6V/bMm8g+iVPCzngOYGUAR97PXSflEMdb1TJJvgiKirHO/VjPQebLdJxnw== X-Received: by 2002:a62:d101:0:b0:51b:eed5:8c91 with SMTP id z1-20020a62d101000000b0051beed58c91mr14876270pfg.32.1654529104777; Mon, 06 Jun 2022 08:25:04 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:a0a:5e4:e24:c8c4]) by smtp.gmail.com with ESMTPSA id h1-20020a655181000000b003fbaae74971sm10749306pgq.72.2022.06.06.08.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:25:04 -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 v4 8/8] drm/mediatek: Config orientation property if panel provides it Date: Mon, 6 Jun 2022 23:24:31 +0800 Message-Id: <20220606152431.1889185-9-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606152431.1889185-1-hsinyi@chromium.org> References: <20220606152431.1889185-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082509_354231_44FF7F89 X-CRM114-Status: GOOD ( 18.06 ) 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 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;