From patchwork Tue Apr 16 14:58:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 10903313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD65413B5 for ; Tue, 16 Apr 2019 15:06:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF6D928988 for ; Tue, 16 Apr 2019 15:06:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B20B92898B; Tue, 16 Apr 2019 15:06:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3C37228988 for ; Tue, 16 Apr 2019 15:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Wic8sdbNjimckohceFkWWtv6Fz1ThIidiBkpMG7XwLM=; b=pnMtEtaCFCtti6 rIPbWEh2qkO+QyrlEJB3sXa/ARoslS1QfNZ7aDMQ8ocMVugY7hhdTN4GhHXlrHfVGV0/UBTz5r77i w4/mJXYnA/2l6d0Vv3mYnwDEiOHZouKCsoiJNAsaun6aVw2UTE1fj34naol/htcYfKAjYdhDzTukk FAv+4ZxbJ+0p9v6jK/frP9qBkznt0oIvbRqA0NGQHeWj19vJhW+XwhEYl1do4NpjLyNykzTSyx8Nr xjv3q8Gn3K09NMHSIrNcgBFklRwGLCCmFHtsmWnwZ20ev8+hs8mGOftmNWi55DUV7Ad+C4rYssMWk Ib0PSfEqCnklEdgFYGlg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGPfH-0004EF-3y; Tue, 16 Apr 2019 15:06:27 +0000 Received: from mout.gmx.net ([212.227.17.22]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGPei-0003Uj-K7; Tue, 16 Apr 2019 15:05:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1555427150; bh=vb89RwI58hI4Muw6KGF7jp8e4/iof1jiOcMOYSRKE5s=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=Ovr+q6rIOepBuBVfZBkyydM6SzbNOfkXMIDbI3BDlfYNWMK3VRSH9bg5n56LW79dE mT6qtqTgzdr3h21GOiXhZsITL/6h4Ph2Zso+8Hln3zb2Rqcf1SgGk3/q/2RTaxwvZc P3vLhb5KoRUUoIdD0O7r8v9k2/K2RaZeaH8AI7O0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([185.53.43.193]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MQdAP-1hPv0g3zR7-00U6nL; Tue, 16 Apr 2019 16:59:08 +0200 From: Frank Wunderlich To: CK Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , Mark Rutland , devicetree@vger.kernel.org, chunhui dai , Ryder Lee , Bibby Hsieh Subject: [PATCH v1 1/4] drm/mediatek: config component output by device node port Date: Tue, 16 Apr 2019 16:58:45 +0200 Message-Id: <20190416145848.11932-2-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190416145848.11932-1-frank-w@public-files.de> References: <20190416145848.11932-1-frank-w@public-files.de> X-Provags-ID: V03:K1:kF6Fe8nmXqHsGRsCBMzwIHxJsQ4jrJQeH0U7ChtBG+ENZtnMU4P mzP3fZ6LmMQ9wzkXLEtxyhTug7mVNnZ5aRzOFtDq+bXEq6StIN1HuPxF+cEbqgUyw0rBmgQ Grs0BXCKVhhEvUQ8wh8nQ0gJs1jDIDs0wbAfatxsea8E+iWDx3z9vtBnYDPza0MyYsJ+W/X muRpCNbF5TU+fI8/fFP2w== X-UI-Out-Filterresults: notjunk:1;V03:K0:u7ngln1HOEk=:C61x0Riqdh+033hf/ve/gl bfjdwJXpq0WBDVqrDYDHy+c9WTf7vMS7YgKQzZ1a52FZ8SizwMlNR2LyliRNBugSTUmfhT+/q MfceLHrNP0NLk6b/ogQrzVFk/x4obpvUvtMEGvjgcskpaPu5avl1aV6YDlFLrsnW8AFU03rKv 2xCE0zurC+IIetM/IqtYukW3hADGV3dVtOGViIWcTI5hLMGR/aaGvqSy+8wI8H7UNBTmxSA9R tlGSI/RynYUdX25jyaB53QHOnuSff6S3RpooNopQF4EOxgSSK95VenJmJTFyZTwLbJ6VYQMlV z3ciKPK2wB4+oH8rITOSkkRDs22TtGDOYX9vTHjJO5SJd5Ux6Q01f/a9EPiTZqqnGoEufePQ2 9ifpGZAQD05L0cSfCXcRSyFHPiwFXiryuYQfJ/VKAJk9PZ+tQwC6058x2jJuAYUwcUPaU6PiG kSY1t9ujZNfKdlvvNcapqEygLToNdxbCztDA8XXSwBtPo+PwYKopmHl6K+Jtbfp6FXeqNWjoi 0fOcyBN6lt3gI7oQHEl/ILLIa2U6gQ6B+WmGMUKdRVn60UjcaQsgbRqqhgbDiKhnPMcZlToNM DbFiGL1cG1kdUx95Ua0fTjD0/YGbvC5x11oZojWH1qr7A2kPuXRMThAAlYfrQ5TqHrhIxp3Tl 245pPWg7p/YH1b35wEeDyOtK14lSmORHTJnXPnOQLsj1RDEK0J9nKrg56MjSkwEGT/JGFXrv8 5V25zP0in+LEW/G5oZJQEOgjrAFUEPpD+YMtHTFcuNvB88LtBZPVFxH6icD1ZrU+I9nECVLLo zO+HP4CL/+b8lYyFCP9Ei/EdEiQnvrR3ML6UeIWK5va/WnsGriOWRU8HE3J/7Ihm67K/MyYrs aMJFFzvN1CXcHhNsdEqTJKEtNDJHgi/ieFF1OK6ekpul3D5W10nedvURZc836h X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190416_080552_956491_AD7A9134 X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Bibby Hsieh --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 41 ++++++++++++++++++++++---- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 4 +-- 2 files changed, 37 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 57ce4708ef1b..d3e86426dc65 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -22,7 +22,9 @@ #include #include #include +#include #include +#include #include #include @@ -134,7 +136,7 @@ static const struct drm_mode_config_funcs mtk_drm_mode_config_funcs = { .atomic_commit = mtk_atomic_commit, }; -static const enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = { +static enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = { DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0, DDP_COMPONENT_COLOR0, @@ -142,12 +144,12 @@ static const enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = { DDP_COMPONENT_DSI0, }; -static const enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = { +static enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = { DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI0, }; -static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = { +static enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = { DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0, DDP_COMPONENT_AAL0, @@ -157,7 +159,7 @@ static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = { DDP_COMPONENT_PWM0, }; -static const enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] = { +static enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] = { DDP_COMPONENT_OVL1, DDP_COMPONENT_COLOR1, DDP_COMPONENT_AAL1, @@ -173,7 +175,7 @@ static const enum mtk_ddp_comp_id mt2712_mtk_ddp_third[] = { DDP_COMPONENT_PWM2, }; -static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = { +static enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = { DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0, DDP_COMPONENT_AAL0, @@ -184,7 +186,7 @@ static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = { DDP_COMPONENT_PWM0, }; -static const enum mtk_ddp_comp_id mt8173_mtk_ddp_ext[] = { +static enum mtk_ddp_comp_id mt8173_mtk_ddp_ext[] = { DDP_COMPONENT_OVL1, DDP_COMPONENT_COLOR1, DDP_COMPONENT_GAMMA, @@ -479,6 +481,7 @@ static int mtk_drm_probe(struct platform_device *pdev) /* Iterate over sibling DISP function blocks */ for_each_child_of_node(dev->of_node->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; @@ -538,6 +541,32 @@ static int mtk_drm_probe(struct platform_device *pdev) private->ddp_comp[comp_id] = comp; } + + if (comp_type != MTK_DSI && comp_type != MTK_DPI) { + port = of_graph_get_port_by_id(node, 0); + if (!port) + continue; + ep = of_get_child_by_name(port, "endpoint"); + of_node_put(port); + if (!ep) + continue; + remote = of_graph_get_remote_port_parent(ep); + of_node_put(ep); + if (!remote) + continue; + of_id = of_match_node(mtk_ddp_comp_dt_ids, remote); + if (!of_id) + continue; + comp_type = (enum mtk_ddp_comp_type)of_id->data; + for (i = 0; i < private->data->main_len - 1; i++) + if (private->data->main_path[i] == comp_id) + private->data->main_path[i + 1] = + mtk_ddp_comp_get_id(node, comp_type); + for (i = 0; i < private->data->ext_len - 1; i++) + if (private->data->ext_path[i] == comp_id) + private->data->ext_path[i + 1] = + 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/mediatek/mtk_drm_drv.h index ecc00ca3221d..256a3ff2e66e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -29,9 +29,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;