Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp218287ybg; Tue, 28 Jul 2020 04:20:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdsCzggkQdo7l+4yysTmT7PLQQt+xz4L+RjLx9sfONEEkGviEQYMP+R4Sq1c6XYBDkw5ca X-Received: by 2002:a17:906:a399:: with SMTP id k25mr9641442ejz.467.1595935207731; Tue, 28 Jul 2020 04:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595935207; cv=none; d=google.com; s=arc-20160816; b=jyQRN11tRj42X6zV6mfJUWFc7PvBXDQm7h+xA1/hJChH73dpHdf1QqiXdiuvi3UuN+ 3uqyboJrnNetuOaFueMqS94iSQMeV5ZNU3AfdkH1AjgMrXbe9E7reLqjGOc/qgIaX6IW MKcvo5V2+CArKakpiZ13ykStk8+YtlNlrRHUjrN1zczOr+IV2zhnSDntzlbrSn+gk8vW tUwArwmiSY2PwL2iXr8w96aL7GGAEML1L5yU7aEBhIjjaIj0FyAv/PMs5SL+qyRXLarf W0eo781GGT3TD614+grSQVW1OyyT6857JQ1HqgFpMMY2dIbegM7szOdNdWxjVyfCc+Au xO+Q== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=czZeFHWGKfZCJHYWed4DWREg8EcyOnWJNjpEooRgZ7U=; b=DMN3QaXgVFIdQ9tPy/6dRYs1zKNJeVKbYVxx9b+VwOioEZxKzGGZ/CVbefvVVGtP8Z UYp5YzdRt69XViYgAytGGpughz5W+2LYsp1wNVQ2Env8Ig/L/9lQSXBqCI/gdoBsMoIf G6UlKPEvcXQHHgZ9lsaI2VCVUeMgIPQjp1ddBI3ohlSBl9TjjosZOGE95DEBaUaVtvJJ Z5WqPuJCHPHMA151KtumliABXORobZuf08iXrNBauuslcEqxmHO9SE/gZ+JBUQ7nz9dX 5R9NEk+9zF6i9r4r4nx1tIgUSC22ga6q2OgncU6rpRzFIgbqbSLY6AKOkWPG2dqKVBPD lQVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="PqTJVT5/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si7724571edj.540.2020.07.28.04.19.45; Tue, 28 Jul 2020 04:20:07 -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=@gmx.net header.s=badeba3b8450 header.b="PqTJVT5/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729042AbgG1LSy (ORCPT + 99 others); Tue, 28 Jul 2020 07:18:54 -0400 Received: from mout.gmx.net ([212.227.17.22]:41917 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729029AbgG1LSw (ORCPT ); Tue, 28 Jul 2020 07:18:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1595935101; bh=RjztiQu8bvOyUz2B8+6Y6utG8fBygRMWzsrfRLxaT28=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=PqTJVT5/1DKAUPspO4Fwvu8KXxLwmZT9gxvwKOC/sayrFfCYOGUrAt1kKuLyuV+/2 rmV1oZj9libk8OmI/vr47fgm+vwLQ9bE5YsWg4W6ypd68ap6fz8Ixo+NsECqvMjLde DmhoS6b7PQ36PJy1dHsMVQb+2gyklriznJ4flhAk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([80.208.215.239]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mr9Bu-1kX1XH0BMs-00oDrD; Tue, 28 Jul 2020 13:18:21 +0200 From: Frank Wunderlich To: linux-mediatek@lists.infradead.org Cc: Frank Wunderlich , Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bibby Hsieh Subject: [PATCH v2 1/5] drm/mediatek: config component output by device node port Date: Tue, 28 Jul 2020 13:17:56 +0200 Message-Id: <20200728111800.77641-2-frank-w@public-files.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200728111800.77641-1-frank-w@public-files.de> References: <20200728111800.77641-1-frank-w@public-files.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:YvbDIbRpFNRzU9CUvTdpvNUkk08xUKy8rbwWD1rLNM8UXAoQuK4 eICt8UcylHTRfOGkjEX9jjTApIMznChQZ6JLB0JrsjiMAAUXmWoZWVa1uKNNAGYRlIyVrTC IKSqIDP+H57GVEHxo0RDq9SNxAHZIaXwDCy1xq9aaTm2FrJdcG2UEvxzlv5POKDx0mQCuV4 VCgz/4H4bnhMAao7exzPA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:5JI92cNImiA=:IU9/AVKV/YriZTpTu1OE0e O8SnTBpFQJaIKnhNf0ENVS71qiHFJW6fi77esT8+iPhPmyguNpqEi200P15DE396vcSD6HaRy jkK+um62hHmvGVD413t3Td/MBamGeZ0K/OHMaCWx9ZlhRNV3p5ddO85KGWDGbKGl3mIQy1ZDO gYTMhu1k/shkkXPexV8oBEFwrK1sjylI3UcDJhmVj0v7MvmpjrGSfLohzyhggLMiQrWtSXj1s F5lH69pJPnG6XDc6RTp9zCPFR+88z8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-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bibby Hsieh We can select output component by decive node port. Main path default output component is DSI. External path default output component is DPI. without this Patch i get this warning: WARNING: CPU: 3 PID: 70 at drivers/gpu/drm/drm_mode_config.c:621 drm_mode_= config_validate+0x1d8/0x258 Signed-off-by: Bibby Hsieh added small fixes for warnings Signed-off-by: Frank Wunderlich Tested-by: Frank Wunderlich =2D-- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 46 ++++++++++++++++++++++---- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 4 +-- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/medi= atek/mtk_drm_drv.c index 6bd369434d9d..ce7abf2743d9 100644 =2D-- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -24,6 +24,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include "mtk_drm_crtc.h" #include "mtk_drm_ddp.h" @@ -61,7 +68,7 @@ static const struct drm_mode_config_funcs mtk_drm_mode_c= onfig_funcs =3D { .atomic_commit =3D drm_atomic_helper_commit, }; -static const enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] =3D { +static enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] =3D { DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0, DDP_COMPONENT_COLOR0, @@ -69,12 +76,12 @@ static const enum mtk_ddp_comp_id mt2701_mtk_ddp_main[= ] =3D { DDP_COMPONENT_DSI0, }; -static const enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] =3D { +static enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] =3D { DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI0, }; -static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] =3D { +static enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] =3D { DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0, DDP_COMPONENT_AAL0, @@ -84,7 +91,7 @@ static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = =3D { DDP_COMPONENT_PWM0, }; -static const enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] =3D { +static enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] =3D { DDP_COMPONENT_OVL1, DDP_COMPONENT_COLOR1, DDP_COMPONENT_AAL1, @@ -100,7 +107,7 @@ static const enum mtk_ddp_comp_id mt2712_mtk_ddp_third= [] =3D { DDP_COMPONENT_PWM2, }; -static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] =3D { +static enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] =3D { DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0, DDP_COMPONENT_AAL0, @@ -111,7 +118,7 @@ static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[= ] =3D { DDP_COMPONENT_PWM0, }; -static const enum mtk_ddp_comp_id mt8173_mtk_ddp_ext[] =3D { +static enum mtk_ddp_comp_id mt8173_mtk_ddp_ext[] =3D { DDP_COMPONENT_OVL1, DDP_COMPONENT_COLOR1, DDP_COMPONENT_GAMMA, @@ -459,6 +466,7 @@ static int mtk_drm_probe(struct platform_device *pdev) /* Iterate over sibling DISP function blocks */ for_each_child_of_node(phandle->parent, node) { + struct device_node *port, *ep, *remote; const struct of_device_id *of_id; enum mtk_ddp_comp_type comp_type; int comp_id; @@ -522,6 +530,32 @@ static int mtk_drm_probe(struct platform_device *pdev= ) private->ddp_comp[comp_id] =3D comp; } + + if (comp_type !=3D MTK_DSI && comp_type !=3D MTK_DPI) { + port =3D of_graph_get_port_by_id(node, 0); + if (!port) + continue; + ep =3D of_get_child_by_name(port, "endpoint"); + of_node_put(port); + if (!ep) + continue; + remote =3D of_graph_get_remote_port_parent(ep); + of_node_put(ep); + if (!remote) + continue; + of_id =3D of_match_node(mtk_ddp_comp_dt_ids, remote); + if (!of_id) + continue; + comp_type =3D (enum mtk_ddp_comp_type)of_id->data; + for (i =3D 0; i < private->data->main_len - 1; i++) + if (private->data->main_path[i] =3D=3D comp_id) + private->data->main_path[i + 1] =3D + mtk_ddp_comp_get_id(node, comp_type); + for (i =3D 0; i < private->data->ext_len - 1; i++) + if (private->data->ext_path[i] =3D=3D comp_id) + private->data->ext_path[i + 1] =3D + mtk_ddp_comp_get_id(node, comp_type); + } } if (!private->mutex_node) { diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/medi= atek/mtk_drm_drv.h index b5be63e53176..7fcaab648bf1 100644 =2D-- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -21,9 +21,9 @@ struct drm_property; struct regmap; struct mtk_mmsys_driver_data { - const enum mtk_ddp_comp_id *main_path; + enum mtk_ddp_comp_id *main_path; unsigned int main_len; - const enum mtk_ddp_comp_id *ext_path; + enum mtk_ddp_comp_id *ext_path; unsigned int ext_len; const enum mtk_ddp_comp_id *third_path; unsigned int third_len; =2D- 2.25.1