From patchwork Wed Mar 17 03:42:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 403405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E164DC4332B for ; Wed, 17 Mar 2021 03:57:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2BE264F99 for ; Wed, 17 Mar 2021 03:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbhCQD4o (ORCPT ); Tue, 16 Mar 2021 23:56:44 -0400 Received: from mail-eopbgr80048.outbound.protection.outlook.com ([40.107.8.48]:9307 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229807AbhCQD4Z (ORCPT ); Tue, 16 Mar 2021 23:56:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5GrPrL3NhCVn2bsl+tMD3f9p8VcW/0dgVuxB8vQAllkqiHhnwiH8yFpNLhqt9lR6zqZUn3e4TT+bricLZdYZO63Gfp7BtGLEUhNMCiYVq7OaM5R+rxngK7dVFPouFMKwBebsqu66DytIapMJApWJ1QrGZ5+2DgIh5aDq9PXb6vgigyLM6DGkdD51lcLEHdPvXt68I5mB86cM7QeDgfhQoz9lOD3wjJ3DKcjzvMAJQ+N7DB84Gfdb1JEZMISuZ9NH5dI7CLboMv6JgwtsyG5ZAFfun3pQwnAFv7AfVCY1sbka1K8JpIuoLnO53KGoVep3yPlYFKi+QgFSX1ebxQsRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ci8rK3VRiEO5u5VqUZEUp+R2RaPHM1B0q9Fb3iCW0I4=; b=nXJn23kSWLv9+7TYGgoSHBRHDeMWCPBStkBvLBQpp9DW46Ir3XNg11VYRnsGJa0KN8w+KocnvqykTLBvGO5XEo6JiPdx5f9xOFwB1GsOl4yO5jR7fO7ImUXHAQ1tENqgSfluATuvJO2WtwGXHpoIlUbA4nJO7gT2jIhDVEfhl97Fp2IP4p2qMkIi67zLmaLRKKGo1eDvvCvk0WUTc1jtJgWb6u9khb0EGrmXErlB1CRCWSiATuZPNl6FDFNZHlATz/M19OZV23oC2BwG+LRReFjd03hxRB/g1dZYOOgAG59TyoR5aoNhvg1kMB3ypVXH79QQNxiLSV6Bk1LqIPL2Ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ci8rK3VRiEO5u5VqUZEUp+R2RaPHM1B0q9Fb3iCW0I4=; b=ZzvTWNky85doXY31wKRkT2mD8PQThUfmwJYewaB4bf/gKZPNvHIldD9Y4RFylbLBpMUxGHiwakjetqK/rVhXYHnPF5trH9MR1LZq9NYVTzx+uW5yLUlfninzOGCxnxkd6T+V415pgzvnoA4rVk4VGiQC86jsKrJs9jaNhZPaN8E= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB6991.eurprd04.prod.outlook.com (2603:10a6:803:12d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Wed, 17 Mar 2021 03:56:23 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0%5]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 03:56:23 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org, a.hajda@samsung.com, narmstrong@baylibre.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org, robert.foss@linaro.org, lee.jones@linaro.org Subject: [PATCH v6 01/14] media: uapi: Add some RGB bus formats for i.MX8qm/qxp pixel combiner Date: Wed, 17 Mar 2021 11:42:36 +0800 Message-Id: <1615952569-4711-2-git-send-email-victor.liu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> References: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 03:56:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 90779de6-3728-45fa-d29a-08d8e8f8a13c X-MS-TrafficTypeDiagnostic: VI1PR04MB6991: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:326; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zRXmZ0HK9KWzNko/LtnQMW2/rC0eXY0cspDedSQZcdLBMlHplmeurAWkgPi0WH9f6wFpz9RGibKC3p3kdKnk6NwykEke1CzUpr5NX//2TTi16f81iB9OYPGdmr4EbgdQ1Sy0qhKYVMDLn5Vgxwejpyy5xZF6la2CNBEHW88Cm8Zh2s2uv9vV+CP4shghEZgRiI+a1s+fulfdW7fkMnEPS3k3fZ0b1PIw4A2m7H01twAqmxMYeAYMxpENoKYNSTEY6n0eoPQgDXcsuD8fejPyaMFuu/lAORkPDtIGtj5hembygzkTJvAxzd2/3o5QAusfuHHqTdrQnVkctZRIUzd9wB+YEeUhzuI/TosnBvYLoIvwzk+MOqLmqQ3eA5jIF7D7db890b0TEX17gU/Jv7/pm916Dm5lvZ+EYavu2e+DSHa9os1YvFIvSKLr1gvvyBN8qVhw3sNlyjCerQaEwPJTZRD6uXe5v6sE3RaLwVb0LqrY6a0it9tVcoebJezHkQGnyVwgUf5RMB9DmvRBOfNTFJLt1qU8w1wdlQCP700QIkbKG7BiEZZ0akl2B1sAR7AYpqjHUSUVcYEHiywREXbtusZ3fqwSimlm3jyofR42PRE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3983.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(136003)(39860400002)(396003)(376002)(6506007)(36756003)(2616005)(6512007)(86362001)(6486002)(478600001)(69590400012)(52116002)(186003)(66556008)(66946007)(4326008)(66476007)(6666004)(8676002)(956004)(5660300002)(83380400001)(316002)(26005)(2906002)(16526019)(8936002)(7416002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: I6nQy5wXa2i/zzPwxo2ysrqfV5lTbQhNALvdfnJqjfN7mbmsSvqOam2LvSki0BZaTuEma9G8ZDtnmhWUbhm6AkUebPtJRffvt+cYeBnJEPGQC4dqmMFrh5szuxWcfPOh3k4YAaCP7qTZ70C/PpG2sH3qcjQsaeDe8efiqIDhl0Nr24ade1QZkR8Oot7ekFTx60yu5gB/gyG3d6bOQPHSv7VYE7eS5Cr9YHGvPZROBczMemzpS23PYRdjx6y1vWN6a0ScufEAJQ2+fQaNTfuQZr90n/2Alj6vxetJ6m37+PPABif9oROGtIilPBtaLvfF2BkbZgxI+Gd66k93hmorIjL5mLYbtHg7cix3M2P4cl0PL3j2mQUqkxWzZlLmdBRTYEgDbUjKRUHRkeywvxShjvBSjkjWWTA8xYDcXdJunCyweRrn1CsodUmrlGSoE52wiKKBf7RGDr+/yMBD9A3X5pfBJjZxswfFfpufY9dC59aYBukNm4yuZGxuATYlgpEkMcctewzPooA7SbYhiNK0YO5RPKDxV8ItfFy4GgIaUYmFibfaaKO8l4Vb3ViGNJdHORQBGwA0mwFRIbTsccAvbq/soFD1Id/DaN4o4gP5zK2s/PJB7dyp0ijSEfLjtrMy+GkD4jNvEevmcd9xTjjPiIXChjgiYuCJnOxfioCIKp4szUQs6hsACH3qZVRUSmDXYGR3s/169ACX0kUrohjAC/Fah0vOOoq0d6vwGSEUGqHrAyAgjCml4YtA3VCIz+zk6+/u/n42RAHa+5ZSdWMaKYG6Iryrf0zEfDQeu5LM0ndUrdQgB7nJpWhrjI9fRmsa7E/Bx/ndSL5Ps3HUtU4lYOhqV9vLJQk+YrDOJYi6jvfCxV7GsMR39JWhFhLJo6lN02yPRxGOf6/La4hlIcztF6JxpcoJmdZY7ec9DbvSGDepAxsFGLAL8CxQ+X6gp/ozem3bnLRLzidJ3cUkwdvVGSWzoo3oIzaHIDkrjVM65UkYY6k602IWeiWabyQasnE0J85gMMF6ltbOys5+lPYf0j9X5lr1I8E8/ERsfhc+ufSCIZM0pMyrjfAmKsPtb0fg6I8Yuhev4LgxGiyy93gKJZ4mXg4E8WA4y9AZIC+JhY5/0WG+VVxM5S0VQeevROAZHB5FQ4rxTt/xcG1tLv1YuymjSWDCa7/DPLrHd+vIj1g2YEEw8f4khjCP06WkbmLIRD06PJbqaVHzW8YA0Hgst1w7YRHDJnfLNPWlEnWoDLeYrEKSkM1g+ANiRaI7yIhRXQS4KOSy6JB7ye8GBINxW2bXjWJx2Iirirb1nV0mWi9OydGniWtyuef8X1hwRIHL X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90779de6-3728-45fa-d29a-08d8e8f8a13c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 03:56:22.9765 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3bmrggAPn9x/qmTNtWGld/tKOITSJpkRPXrp8zMTYlE+pebkvwraS4lIfh3Wkblm4/vDK13G3qveHF3qKeORTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6991 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds RGB666_1X30_CPADLO, RGB888_1X30_CPADLO, RGB666_1X36_CPADLO and RGB888_1X36_CPADLO bus formats used by i.MX8qm/qxp pixel combiner. The RGB pixels with padding low per component are transmitted on a 30-bit input bus(10-bit per component) from a display controller or a 36-bit output bus(12-bit per component) to a pixel link. Reviewed-by: Robert Foss Reviewed-by: Laurent Pinchart Signed-off-by: Liu Ying --- v5->v6: * Add Laurent's R-b tag. v4->v5: * Add Robert's R-b tag. v3->v4: * No change. v2->v3: * No change. v1->v2: * No change. include/uapi/linux/media-bus-format.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h index 0dfc11e..ec3323d 100644 --- a/include/uapi/linux/media-bus-format.h +++ b/include/uapi/linux/media-bus-format.h @@ -34,7 +34,7 @@ #define MEDIA_BUS_FMT_FIXED 0x0001 -/* RGB - next is 0x101e */ +/* RGB - next is 0x1022 */ #define MEDIA_BUS_FMT_RGB444_1X12 0x1016 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 @@ -59,9 +59,13 @@ #define MEDIA_BUS_FMT_RGB888_3X8_DELTA 0x101d #define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG 0x1011 #define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA 0x1012 +#define MEDIA_BUS_FMT_RGB666_1X30_CPADLO 0x101e +#define MEDIA_BUS_FMT_RGB888_1X30_CPADLO 0x101f #define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d #define MEDIA_BUS_FMT_RGB888_1X32_PADHI 0x100f #define MEDIA_BUS_FMT_RGB101010_1X30 0x1018 +#define MEDIA_BUS_FMT_RGB666_1X36_CPADLO 0x1020 +#define MEDIA_BUS_FMT_RGB888_1X36_CPADLO 0x1021 #define MEDIA_BUS_FMT_RGB121212_1X36 0x1019 #define MEDIA_BUS_FMT_RGB161616_1X48 0x101a From patchwork Wed Mar 17 03:42:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 403406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 983A3C433E6 for ; Wed, 17 Mar 2021 03:57:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55FBE64F92 for ; Wed, 17 Mar 2021 03:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbhCQD4p (ORCPT ); Tue, 16 Mar 2021 23:56:45 -0400 Received: from mail-eopbgr80082.outbound.protection.outlook.com ([40.107.8.82]:33901 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229871AbhCQD4j (ORCPT ); Tue, 16 Mar 2021 23:56:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GdtcZU2U0tfthlgF7GTTv8G4jfICLJW/6q4pSA46EIIoG0sOcoAgnQv+Q5eg6mztCOiIeKQMwS/SVA32/HHRbSpJFryunq+2kFvqSdFW7OZO+leg7n+JTy4c4peDFLqjdLLvI9es8Q7DNW7eAgy1o2zMuR+a3vz+Y0CeG38lu13mbXxYzRHwpasKkUVRd66lXdW296EmlSmar5I7gHLmP0wjQF65JWo/NIeiysDbtKQDPpd1rXwCCkTErY6LQd3NPks/rfAoa+7rAnWW7k8YYTDfzUZ6SppEYaOwLKf2J56JkBs+vHOJWI82WFKEjeKX7mAjOOq9mY1fO9zmshvXIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lTblj47XDiM8RhiLf0oxGWcs1MrldZv/sUQ8Wh2ZSsQ=; b=RGrPjdzquxN9sbqny3inLbn0/9XuKrH3rk9zIXcnUjVW7XBo4oJpPSGNSPTEuPVBIJG4VykARr+F782fFCuKEiXquW5z2B7zg20yiXuBouIJGrHq+aqkgh7RA1JGfxjqRYKmn5FS4vDMxtQiF3cY4GagamqqhRBmPmzluxUQ2d0acwI/lcQrGm8TXlW1Cf0LTZAZLLbC5xYztRQ2hd+TkdcQdY2b+jHvB3kB6hCc9OZZ1yhA14sPpClbL6/ZA5MeeSaFmXGmOIVqsESNQYsvwqWTitTzn4tQJOy5a0wFtzr3gxZe55czZipMBNAztuPJLku/H96ngGy0e2xpRh9eoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lTblj47XDiM8RhiLf0oxGWcs1MrldZv/sUQ8Wh2ZSsQ=; b=ZGfgeA5eeJnv6/aqjCqy2+LuZ0wbzBcxyDLLZ9KdeckaCel6NC8s2gopIqqLZgzMQRFRXeTL7CrtF/sMpj9e9g04h8pAe2aZVzWlLn/RQC1+8Cug/k2KV0xqiki0S+k0qkP/kwQR1cGhVzQw/w7NqBvsgIIOLeWr07lKFPWFMus= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB6141.eurprd04.prod.outlook.com (2603:10a6:803:f9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Wed, 17 Mar 2021 03:56:29 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0%5]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 03:56:29 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org, a.hajda@samsung.com, narmstrong@baylibre.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org, robert.foss@linaro.org, lee.jones@linaro.org Subject: [PATCH v6 02/14] media: docs: Add some RGB bus formats for i.MX8qm/qxp pixel combiner Date: Wed, 17 Mar 2021 11:42:37 +0800 Message-Id: <1615952569-4711-3-git-send-email-victor.liu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> References: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 03:56:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 59993908-4a37-44d6-2881-08d8e8f8a51b X-MS-TrafficTypeDiagnostic: VI1PR04MB6141: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nu9bnRP81aeZb7GLk78RYifedTsL2x++FYYgif4CVsH03NIgmDPwx7WJqGX13XfttFkdAJ96aDp3JcUTCscHHwkOL8bledmWr13hfDNv4qCRiYttz6t7+8ofVSUfBvYHiDF9SVYf8n5hGqgLani4Rej0dp/oP8UELKIOtzyMAzkAyQ6PUl8b4oKCxcWomwwPV7vxq+anTjjQh1OIO/j97vb5JY/Tcn1vhU9Yz6/fy5uAkeOGYd81Z4nUrhv/9czARkYUKm2sY79U1WCpakY5nXGAx42QHbK+QQqv3PH5CukR9uSsSEYPDRdHVUvgtMcw9N+5lp6ad1kfh4oRP1vmScg79dtr5Ibf7mGJx+5lEFAgIr/Jt8VLrdJvaoOAYEUW7GR/h1xq9AICv+kscB3ZaMEvnVQu58xqSD7CEAX1NkrR+d4lyGyzWsC/ZTgDJoiz2/hUi7OywvTdBdwTCqT2e2z7uGlXacX5XDCA/j5FvSmx0GgG/Mtz0Eto0uyznBOZi/51ICDxMMqmLMyAaoS0rgRbFdbN4anQCezA9mU9VirR/3tz8e5n1c34+6SHi548g73z8Hej/01cwIOkqqHXut+B1VM5UZC1sFOdkeJMQut6hJwyBdvnBo9l09N/ri1f X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3983.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(396003)(39860400002)(136003)(376002)(8676002)(5660300002)(316002)(36756003)(16526019)(186003)(8936002)(69590400012)(4326008)(956004)(2616005)(2906002)(52116002)(6486002)(6512007)(6666004)(478600001)(6506007)(66556008)(66476007)(66946007)(7416002)(26005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 92rwX29U0nE+9zxl70Nl0PgVnzlz0mWSa1qWqXyNKLKwosSNwTWezBVXW6iLKnvOBU5+vwuF1qNJWsCNKLVUK/Z832c3j75YYCsF+dSqDu4bNrCoS/5MBjaePGpBkD5pGL96+DA9H3//Ir/PW11eTbJ7ZYcqJRH33vWwyd7Y4UlW7RzyaFJ5xiO8HpKKg/fwyGS9xAsa2Nm2B5hJpYMKaPUh4tj8516TmfTWBxFk9zadjVISrYD9qqtXCbFhvlMt5/wK5KrBMbvXyZOiXDBQyQCKJelGCV8xGr+xH1G23Ge5YcmjSKdHbbTwIF+5gf1sSZ4abvjI1Tv1nmwE6OOMAo04TLgRpZoofmCK94xLPlOEhq0Gj74tjdkCERi5cMTm2erm8XGDXmEHOPcC+sczHOgPQotMrjRgkFi2puPy/2yn1Pgz+MPIZFxqdATDipk+q+XdXspEAunI6IgOHUklXElYBMfDzmZNvSz1W4ZdDsC4A3j8/YXiXte8K8IRGEtCSqbtJ66kYIHApZJPKvuCmVnlJqG0+5T7LIUMN5xNGvrcJA85+JzwGBZwcFURFpMFj1f7qZvk9dGGiLo+wRQ60N8Mr2dR3hyPNy77C02xq69i5hJ8UcDBLsEtkUPlVb7LdAhK1SQeeujPI7JQrjO8W9w4r0WgE9bOMUOcXvJZ7sLUvA8CsQYOJoos4efyvLT2iYdH+hn0IJk+8wsRXrsR6wQ2gDNOmT6gg8G79KL5gi24lraqoMU6lpAJ1hpJsiPqR45l+MUIYNo1bcPvQCCCmeKmKjxGy4vMJreqIowu85lyR+Qp2+LHYKkkEvvK34rxFAwOr6mC8U7Pi0PYZs1cx8bD6T4rzE47/IGYredrordIWFRvGhCUgCdj5puiAhSgzbpT5iP8oOpjQoJYSecYQVgfGH0JqvLWAwaG/FfJAGCUGRDEWs5YsDwzrmP8rVOkMh2pPE4/jyPYejD+dTA+CsuFGIjR2DVSV41nDD4yMIcwd9rGDX0cENX8GXy1gCfm4D7wmkUxlwldTkVHKlcKLDqiND6nyJ1HVCtJmUbcCc4oWZNO0jywyhyr2DsYN9i5oe2PF1ypWsCpAHfVwXcRXOKnP7SKZpM9HDrUaztO0gKc9+CjDJWZWd0cLMUwhFliXs3pHXVbkrpofBMwEr69LmrHk58r1FsRLKCv9Dv1WripIFUIDok14j9c1PX3hbVDYTL1y/09rjL6V7fv3rH8k5dAxRGCABRonKG7NnkgHFYn0epbzUkrgLwX6EzU1TBrsRhcT0n4RN/+OXFicXNLqCLmKETd8FH3foM/f4LS03LzAxntroOC9KMCe3r9jIUQ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59993908-4a37-44d6-2881-08d8e8f8a51b X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 03:56:29.4547 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5TuX+Lwv6Np+E2v7QT5zKpY8X2MjIWZP4cxqPZZZar2rW1d4sSkiwZufxaM25ydWLGDZwS3w1FOYbvBCJNIeEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6141 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds documentations for RGB666_1X30_CPADLO, RGB888_1X30_CPADLO, RGB666_1X36_CPADLO and RGB888_1X36_CPADLO bus formats used by i.MX8qm/qxp pixel combiner. The RGB pixels with padding low per component are transmitted on a 30-bit input bus(10-bit per component) from a display controller or a 36-bit output bus(12-bit per component) to a pixel link. Reviewed-by: Robert Foss Reviewed-by: Laurent Pinchart Signed-off-by: Liu Ying --- Robert, I keep your R-b tag from v5. Let me know if you want me to drop it, as v6 contains a fix. v5->v6: * Fix data organizations of MEDIA_BUS_FMT_RGB{666,888}_1X30-CPADLO. (Laurent) * Add Laurent's R-b tag. v4->v5: * Add Robert's R-b tag. v3->v4: * No change. v2->v3: * No change. v1->v2: * No change. .../userspace-api/media/v4l/subdev-formats.rst | 156 +++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/subdev-formats.rst b/Documentation/userspace-api/media/v4l/subdev-formats.rst index 7f16cbe..1402e18 100644 --- a/Documentation/userspace-api/media/v4l/subdev-formats.rst +++ b/Documentation/userspace-api/media/v4l/subdev-formats.rst @@ -1488,6 +1488,80 @@ The following tables list existing packed RGB formats. - b\ :sub:`2` - b\ :sub:`1` - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB666-1X30-CPADLO: + + - MEDIA_BUS_FMT_RGB666_1X30-CPADLO + - 0x101e + - + - + - + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + * .. _MEDIA-BUS-FMT-RGB888-1X30-CPADLO: + + - MEDIA_BUS_FMT_RGB888_1X30-CPADLO + - 0x101f + - + - + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - 0 + - 0 + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - 0 + - 0 + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - 0 + - 0 * .. _MEDIA-BUS-FMT-ARGB888-1X32: - MEDIA_BUS_FMT_ARGB888_1X32 @@ -1665,6 +1739,88 @@ The following table list existing packed 36bit wide RGB formats. - 2 - 1 - 0 + * .. _MEDIA-BUS-FMT-RGB666-1X36-CPADLO: + + - MEDIA_BUS_FMT_RGB666_1X36_CPADLO + - 0x1020 + - + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + * .. _MEDIA-BUS-FMT-RGB888-1X36-CPADLO: + + - MEDIA_BUS_FMT_RGB888_1X36_CPADLO + - 0x1021 + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - 0 + - 0 + - 0 + - 0 * .. _MEDIA-BUS-FMT-RGB121212-1X36: - MEDIA_BUS_FMT_RGB121212_1X36 From patchwork Wed Mar 17 03:42:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 403403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 721B3C4332D for ; Wed, 17 Mar 2021 03:57:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C4DC64F9F for ; Wed, 17 Mar 2021 03:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229657AbhCQD5Q (ORCPT ); Tue, 16 Mar 2021 23:57:16 -0400 Received: from mail-eopbgr60041.outbound.protection.outlook.com ([40.107.6.41]:2750 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229875AbhCQD4u (ORCPT ); Tue, 16 Mar 2021 23:56:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BU64PC3aB0eTzHqNIoUuza6h90Fhbjm7tfzxXzsuAlHhOJHa7uB7zhmMZ6qdXoTIVZ1v8L59DLCXR5xk8v56L771NZIvEvI1JQeL5JcrL2iGywEgITDKNay15lHQpDixmKvQzDyWbbtjm/eNlATibPXRIyFZpiRw9Qoa9EfFFU2GjzsRrj3YBWJM65cdwKc6HN9Zx6JmxXRhilGoLWlKJ3uPGBHXSDipdGpaZwp4lfWEMpRAZhbDYuKPTbuzho4KJnyj82HC+B/KpPLBcnF498AAhE5b9U38zu4LtynX9vQTYntjNaSN4NzFiCgZ6uPBscMIYZHaUh2HBfyIBHWZ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MLLd7CsPT7wJImoalKGc4scNZMMS1M71z8zpb6QtFe4=; b=MRAwWN1nLaeiB+J8L5HzJzUVCJj/pswA4jo8mgXH2VKbA/B0/4ADAEPjbCe0sQ8w7OA6RlqQy9Dn8euf3tzXZnWhCpFoymx77eaQ6zetZpPqpmQUXnt+oWTgDr/Dm5O9DvAtMdMnBCYK3A1S01KgW/xNhxAvS1eAZmNpa8BWzeLMB171u/AlyaRAHeMY0n9dEbGWDTXX8U4guL5nZ1JyV1kKp3b2+YLVuI3HH76vUf/IGO24bcuSqDGysDPpDXa52cI0fZo+1GGBJBpGD7lRJ7b/7Iv/WXScU1BSmt8tIWZY/bNRirfdfyQG7w53bznyrf1jNpUrxip8p2nx5076Lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MLLd7CsPT7wJImoalKGc4scNZMMS1M71z8zpb6QtFe4=; b=pN63ou+bxLS+A0R4h+ir+afPujaEDb1ZYzn0cBT6b0eR2hoetlIlerl0sJrWiZ5fKWtATxtPjmNBaoBsxUfIXVpr00DVkufzd307evD6mzrOqJxdVYA++kNnvEo48podP2vBfZT4QHHD7L6cPw5b490GH3nzjsrxuWXs0vkDEL8= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB6141.eurprd04.prod.outlook.com (2603:10a6:803:f9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Wed, 17 Mar 2021 03:56:48 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0%5]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 03:56:48 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org, a.hajda@samsung.com, narmstrong@baylibre.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org, robert.foss@linaro.org, lee.jones@linaro.org Subject: [PATCH v6 05/14] dt-bindings: display: bridge: Add i.MX8qm/qxp display pixel link binding Date: Wed, 17 Mar 2021 11:42:40 +0800 Message-Id: <1615952569-4711-6-git-send-email-victor.liu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> References: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 03:56:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a090e1ba-ea9f-490a-68f4-08d8e8f8b05d X-MS-TrafficTypeDiagnostic: VI1PR04MB6141: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1775; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R3Ka4h/gux5cPxry5l+wf4BBc0eKDRhwoTNP86KmZxbtenhiL2YCKZ5Co+9FFCzeLEg/GMbQT6/MwI5WUTo1lUKSI/SDtSh9+iyz6nXPTDEXL365DQ7Og7WT4LxA/rQiqeSTkfrYMSDgdxYwTwhuAViOMYDgl6Vajlac6TA/da4kyVSPzQOkZcvimFPOfy6FocCdp2AzNTSvgMrwrxx2Y/znowqFtLSb4WvvHbQJ2Su+mt2KHscdcN/9njTYaTSS4GoEoAQWBWOjLoJ8EToFzA0K+IsrLqU97cARdtRvkMa76E7BGxLmPBVSZ+f9ucGqWdBmsOz6E8ypnbe+RukM1YbNDuZ1sqE7oLQmHGVvgC299GoICs4Pye7CB/0B68ANxVxgyJkVMs/8INzh6aCnEj0kQYrT9oj/S3algBbajXcLETpclnVks+cDQj0TTAV5qUJvZx6G9RlObDjl97bQKWB6NHvTAM+dpdRt9u0mlE3wAOGujsjJT/GlZfnvqzc6qSBd7fh+AzILpQwi8eKFa79adpQn5g1S8a6xvq/pUv9TX0N8vZk4P5xOf2ZBmLa5ARpQJQ/lwKQ3RqBqQM4BBTplaYPwDfyzuhWP6U1OUkab/8qNeM3Qxi6ZG1tMl4Q4QSti594+Z+tNFT7UCNw11RHKdS9w97ma0fcvqvJzjEQBF0HnVC6PRj3CFWDpQN5D X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3983.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(396003)(39860400002)(136003)(376002)(8676002)(5660300002)(316002)(36756003)(16526019)(186003)(8936002)(69590400012)(83380400001)(4326008)(956004)(2616005)(2906002)(52116002)(6486002)(6512007)(478600001)(966005)(6506007)(66556008)(66476007)(66946007)(7416002)(26005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: pS59JhtePg5rZdZ+Fsb70ytgrP28ZLTyE0wpGD97Wy9n4PkrvsSQsgMsbWBZclZZBa9OMKNXGVjz51C68Z5pIt5kPZ9ra+4IkNK8TdYMxo51N2E62cLi4lKtBQzebLV6OoFcnvSZNTFGLO3rZ9AeJE1Mw6rtCfQ7TpKAn4JtxYmKhJh8xmAzTHUfuOJRXB+7SSL5ndefeeu1arAvgLtS+HY/1FvmhDKwNprmCKmeW0GnTBTd80rJuciv9Bv6mQ8UaXjN1pycYnCM6qhMXsEj9EJ5NVvCIXrBzuN/hAb8T4vt55lN45UoM22Fpse9v70xrxw5Vo+7Ui3Ita08GicHHQGj2EFUDXarJ1z9OIbCQkJM/P9wL8TOg8wfsFzpVNsD33ImTtp1Gxbp1O3jnYGZSdNt4JaWgG7IWJQrnJce1lkJuB87y1OF92kWKqVi/VXeyGihAC9zXp9GOIQVL7icTEt5NxGCigIkeB90R9dw8P9Q5+cqTaMcigA3bDf/yrzdzLycVTocxESB/lhEgUgGHuEzB3p4EKum6SwByENHkpvFd7RJDQT0G6JJEp6jajt1DbLHt8s0t2+phsXgfb7O3Rd7LM6O57VENoyyl3Ge9NATZa+QUdgBrBrWhfDeagy8P6yfk2pfHO9cMYjGmEzDdB+M7wCYfEKXQZyEbFM1SZH7/ELyaV8zQubF1V1Hf/l3Qj/4BBohZ+b66XNK5sifOYpFCERH+UDLP+z6pjuGBAuPijPlTfg8l5JPUGtzndsMHelEs5TW0qgZUgEnQcaWqlT0K/Rb5Bdkk3fVeHeILLsfTx9Q2ichYgNRpB7hulk5mzL5dqzq1h9ljQXKsmwx5SlLLcRHZDXoTqFPlbjRhoLmfqOBdm54XvnP+seaKgqcGboda91XjyXS/dqbPsmsS8QDAKss0+k13JPK27zd4iulYdUxLeAt9h2ayvn3Jn3K3AY0XBYedHUSYFoBzsK/QC8+T+iqPau8h4zDfTR/vCTX7+R7MQSYkHXVN75vHaaTef4sF9wp+F5jHMJZNmCw5dAY/HDZznogvlQPlTqDr1jSKnAdxW6SS5/osgAfce+8GxY/s1nGAcoqYLp3vvjMkdbrCme3ldkXXEHOVUUsONXI24FSZyCDf+/0ezsoI/XaPF3Hm6t6vo3L6r9mjMUNUDyQHHLSVyAaF8bsecBdFQokjB114Gsjl+KIQEOFgn6KKDhfkZ0iIePOVwi1Y5qOcsvxAa91wUxZeWY8q0pmtvSgdOLKUhSMZO2zeL3meWfpnA42+OLGTWG0rTDiTSmd2PslECejmH1ccUaEgLQj0ZqAJgkwktG0c/CyNz/y68zN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a090e1ba-ea9f-490a-68f4-08d8e8f8b05d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 03:56:48.3279 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XnhHJuw7GRyqlXSi3u9bu5Wmgkn4qNVtoewf943LV+EHXOVPRhkUuG/gQ0ictQQlEWiMSOfi8cW1qvmxegAcEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6141 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds bindings for i.MX8qm/qxp display pixel link. Reviewed-by: Rob Herring Signed-off-by: Liu Ying --- v5->v6: * No change. v4->v5: * No change. v3->v4: * No change. v2->v3: * Add Rob's R-b tag. v1->v2: * Use graph schema. (Laurent) * Require all four pixel link output ports. (Laurent) * Mention pixel link is accessed via SCU firmware. (Rob) .../display/bridge/fsl,imx8qxp-pixel-link.yaml | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-link.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-link.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-link.yaml new file mode 100644 index 00000000..3af67cc --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-link.yaml @@ -0,0 +1,106 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/fsl,imx8qxp-pixel-link.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX8qm/qxp Display Pixel Link + +maintainers: + - Liu Ying + +description: | + The Freescale i.MX8qm/qxp Display Pixel Link(DPL) forms a standard + asynchronous linkage between pixel sources(display controller or + camera module) and pixel consumers(imaging or displays). + It consists of two distinct functions, a pixel transfer function and a + control interface. Multiple pixel channels can exist per one control channel. + This binding documentation is only for pixel links whose pixel sources are + display controllers. + + The i.MX8qm/qxp Display Pixel Link is accessed via System Controller Unit(SCU) + firmware. + +properties: + compatible: + enum: + - fsl,imx8qm-dc-pixel-link + - fsl,imx8qxp-dc-pixel-link + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: The pixel link input port node from upstream video source. + + patternProperties: + "^port@[1-4]$": + $ref: /schemas/graph.yaml#/properties/port + description: The pixel link output port node to downstream bridge. + + required: + - port@0 + - port@1 + - port@2 + - port@3 + - port@4 + +required: + - compatible + - ports + +additionalProperties: false + +examples: + - | + dc0-pixel-link0 { + compatible = "fsl,imx8qxp-dc-pixel-link"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + /* from dc0 pixel combiner channel0 */ + port@0 { + reg = <0>; + + dc0_pixel_link0_dc0_pixel_combiner_ch0: endpoint { + remote-endpoint = <&dc0_pixel_combiner_ch0_dc0_pixel_link0>; + }; + }; + + /* to PXL2DPIs in MIPI/LVDS combo subsystems */ + port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + dc0_pixel_link0_mipi_lvds_0_pxl2dpi: endpoint@0 { + reg = <0>; + remote-endpoint = <&mipi_lvds_0_pxl2dpi_dc0_pixel_link0>; + }; + + dc0_pixel_link0_mipi_lvds_1_pxl2dpi: endpoint@1 { + reg = <1>; + remote-endpoint = <&mipi_lvds_1_pxl2dpi_dc0_pixel_link0>; + }; + }; + + /* unused */ + port@2 { + reg = <2>; + }; + + /* unused */ + port@3 { + reg = <3>; + }; + + /* to imaging subsystem */ + port@4 { + reg = <4>; + }; + }; + }; From patchwork Wed Mar 17 03:42:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 403404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40455C433E9 for ; Wed, 17 Mar 2021 03:57:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1778A64F92 for ; Wed, 17 Mar 2021 03:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230080AbhCQD5S (ORCPT ); Tue, 16 Mar 2021 23:57:18 -0400 Received: from mail-eopbgr60042.outbound.protection.outlook.com ([40.107.6.42]:12928 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230159AbhCQD5D (ORCPT ); Tue, 16 Mar 2021 23:57:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iaF47kBiv3E2rdb1dntbpRmL6YicPsO8+cn+HLtCo/F+sHJT/AAuHAApHZLqVw5tMnFZgsLeeffczEbiFilt7n+VZo86mf7DEHo3C4uzCKEmmPOTpI3sn0sChVcVWsiIjWnElW9e/KancVsa1xD8qLo3fQriSST9cqJ9sNoOdoDaBT6+uGYT2h3OrJBRJWm1xV2tJQNItElHjE/j1c+lxpkG59OSpzgWQych5SWtSAjqEV971kkFK6r/Zdehbz5AY9qd74doKyq/Fy+r4wq8OXiYHiFQwTBAy3VDGv5jHf1+BU46LjgBJSEehOf8IFSL57dkP0uIcTQKUhRTCOojUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s5wB+Vex7i1rpMrbY8RjOhfpob9H7t8tBtwI4yJq5uE=; b=AuOLEUzgIQ4DmAe3Xluhm6OdBjIHaIf3RfYBbgrPefkQVR7Zny5oaoHsSs32vSCPUiEhespzASRJ2u/2iTlWmGN8NuXywOnRV2XpoBLIIL0VuiKNTeRkKVFVS2rAJmca8xzprExVSPfS3TEeI7pNEKRRqxylzHVVo3DInuI0TwRCBXg9CD1RbEpiC/ddl9h0VBT4PTZKbeVVh8Tny/xWwqi5EGmVqY/XEOcrT8s8PtWIV/HRuPI2IkBuNXlU+xxO+y6bY7nJr0B8K32cVT78iSGcqni5NaLVK/zjNhCBzlPlfcysYgIxpeTRmpsoIeyebRvNLsRYcqP7txi/GWu85A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s5wB+Vex7i1rpMrbY8RjOhfpob9H7t8tBtwI4yJq5uE=; b=h6FAKSNkJlCjSJ88ARDQCwESxtHvxwcz7sUM1PbAO+J21KZ+NreZUqfQaof8cyOEOcPG9bQi1anw6ao/KRk8aUIinSlAFCpL880CRM5Edj1JgGRzhEAs49lQWIOwKMc3EviTBYD6/twKLafRUgtM8LwTPnd58Vj4BpXupce0K8Q= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB6141.eurprd04.prod.outlook.com (2603:10a6:803:f9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Wed, 17 Mar 2021 03:57:01 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0%5]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 03:57:01 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org, a.hajda@samsung.com, narmstrong@baylibre.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org, robert.foss@linaro.org, lee.jones@linaro.org Subject: [PATCH v6 07/14] dt-bindings: mfd: Add i.MX8qm/qxp Control and Status Registers module binding Date: Wed, 17 Mar 2021 11:42:42 +0800 Message-Id: <1615952569-4711-8-git-send-email-victor.liu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> References: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 03:56:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ab1d52b7-1bbb-4145-fc73-08d8e8f8b801 X-MS-TrafficTypeDiagnostic: VI1PR04MB6141: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IcQHRo6DpmdkcSidYAvJGz6MSsE78vmoTQ0iOPdzyUUiHRzELB9tEgzqKs8sbLxP2kBQFMGbPxfdlVB1wDZcx3xJrIbRIbZ1Vkrb9hRNfwX30071Z37xdxvuy/q08+Tim0y4XbzWOLv1i3mPhp7QC0xCL3yM6KnJf1gfR6vd3AKwl0fa20KLhDtf7qoeTCHLgscrfk22HYNQOxXHUNh3IqDWqzN6DdSWrBY+dlzNAHiamW/HmeRKzxNeQ7Tb5jjJAANdWjEfmqqOMEgNirSzO2HYbclWRWnSQf43gR7QS/5mfP9msU3PK7HLLYfQCBkp9ONQDtekXOYlAZZPKYfSHnA6tmyExG9xHyVzR12vMJW/qNIysOebF0MC1ZSKwJy8jUhIxPK1wLpFnoAHScOmzKvRDzUdfBkEe8iEPk6lXaKcvUKJvqm+H3fYL6Im851CVY+FYEowXUx/0fabGsUiUdgQyJxC90UMSEKanmJ2ENgcWFOV/KpiRLKGZy8DvQmNePlwdCUCwetuiPpO7R67nY8SMwl5aAJ0As8/lQYs1mFCVL/pJ4sjv9YHxRnxsjTJTv034PKKt+HUyUUs3iBap7u0cXSotlNoSSupbbDTOnaAMCqpAk9fC4cfGbKrXVo3tavN+HluhcXzNm+q0CHlax95SxAw3mO5ZYLPq7gB55tRopMI3GVkvlCWGKa+/dJJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3983.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(396003)(39860400002)(136003)(376002)(8676002)(5660300002)(316002)(36756003)(16526019)(186003)(8936002)(69590400012)(83380400001)(4326008)(956004)(2616005)(2906002)(52116002)(6486002)(6512007)(6666004)(478600001)(966005)(6506007)(66556008)(66476007)(66946007)(7416002)(26005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HX8QdAK2YitAiLJIrg/n3BGBPkg9dvyshyU2+tX67bVCnORPn3mqfeE6PHqET8qgNUxw+pb30URl2CFY6cDVjKaJOtZkS8zEqVlEAaslCg2Ipc5yrDLJzLU1voSVzmugi773EUXxMbA0rARzX3vZ3E395lZ+PmXihB94EoDUUp/FIfzfL8MxKA9QV71SI+jUEBpJ4hie2Dw+sy/4/uPiB4sKJhdBD5X4EafluUmk5E8E3bemHZltaGBVEHIEvJy+FHwm40YIrvbvqVAw4H63ye1lfLgvVxzfYrZRmxsvFlsVGadKhcAQIqJJVtpg2zKhpDfO0Q5lNaODrvukFoFLXwmqIWMs/FaIhlVC/MT8Yw8KtGCWqwvjpdFFJrcUC1/MFvFUI8KDq5MMjzJczo+Y23fLrz8o8XIlM3rk1v+B9+gdvKBo3mthVhE+C8PPFHtNpURoseg5vMsFiFf19ijLo8CmTta8gLRMHuvPk2xXSxUYMWS5CQ77ncGWBU3Sn5EbpJQbLGcHxDE8GeIESXOp8CfBMiqcGd44pJ3jEYuA2blEzTT2EJs3X2i9YliwdllvIdLBFRQi+R7XpsATw2EGjY2UCOfRRW6qmsuVpyYKoJhO71JKKsEaHxmEBB6nAc3mqrc2ouKNZpF4m1sxdQq12KD/V3OSPrPWQ1NMms/jB6sM2EiqN61tQzN+HGXl26i0xeBeDB4odkqFIaJEPxX72M58xIcWkymTSZ3OU3PSLUrfsKJqsDKv4DYqyYcKnPEDUSRhC1OL29h+Q4Cxw2zboGarSMUDAUhkdKTZhzJZJnFCxSVVAZ7xUChiaMyyNsM8TuYsl+z/5PNQ3NnXLo7rojDaoePZdfzb2Ffq+nWh1EsRYRnqby5GxcgBMEuRtykoKioRz++oNAPt+ZohxwF4l21LDgROCQBGO0fA689El2X/ZJNhXW2WU7jiPN1CxKPkp7q2JE56YpTZW/ndDXbAO8im5LBPKWI6/tjT12m68PdcJeFN4ZeRr1AHHA1hJjrvAI4rRxb7vKYvBPSHqnYPsXz1hFlF21Hk7KWo5JRBiXzuA9kXaoCBhXB93J+drNYzlb5FODAlRgRe8WXtimtyXJDwX4vlt0YLtzTpoF19nugX623naXu1r0h+oRts2InI+feuYcMjF3cHZpmdKVxkmkR8/nROwrjHSMNUme0Aq4uSuugC72zy1bPuMlTsilba8sbvrB8hLy1aX3xRsELzDDGqKZYGdAiDu9l+fJy3wVmNyHZeNoFmq7s31fvNlN9yiAMJThB2RcZhdV36wVhTyWoU+uBkJ62ck3oKQRnb2Jmm4QtDG7tuzoMNsTHQTS1a X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab1d52b7-1bbb-4145-fc73-08d8e8f8b801 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 03:57:01.1585 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r5IgLwkRilUsvDL/TrTXhZzwYUQVdtRNeEwqg+yo4WWvBKPcFr54gq+Qj/hqrdwaN5klYymnhw6DQdAA7TCgSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6141 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds bindings for i.MX8qm/qxp Control and Status Registers module. Signed-off-by: Liu Ying Reviewed-by: Rob Herring --- v5->v6: * Drop 'select' schema. (Rob) v4->v5: * Newly introduced in v5. (Rob) .../devicetree/bindings/mfd/fsl,imx8qxp-csr.yaml | 192 +++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/fsl,imx8qxp-csr.yaml diff --git a/Documentation/devicetree/bindings/mfd/fsl,imx8qxp-csr.yaml b/Documentation/devicetree/bindings/mfd/fsl,imx8qxp-csr.yaml new file mode 100644 index 00000000..f095771 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/fsl,imx8qxp-csr.yaml @@ -0,0 +1,192 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/fsl,imx8qxp-csr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX8qm/qxp Control and Status Registers Module Bindings + +maintainers: + - Liu Ying + +description: | + As a system controller, the Freescale i.MX8qm/qxp Control and Status + Registers(CSR) module represents a set of miscellaneous registers of a + specific subsystem. It may provide control and/or status report interfaces + to a mix of standalone hardware devices within that subsystem. One typical + use-case is for some other nodes to acquire a reference to the syscon node + by phandle, and the other typical use-case is that the operating system + should consider all subnodes of the CSR module as separate child devices. + +properties: + $nodename: + pattern: "^syscon@[0-9a-f]+$" + + compatible: + items: + - enum: + - fsl,imx8qxp-mipi-lvds-csr + - fsl,imx8qm-lvds-csr + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + const: ipg + +patternProperties: + "^(ldb|phy|pxl2dpi)$": + type: object + description: The possible child devices of the CSR module. + +required: + - compatible + - reg + - clocks + - clock-names + +allOf: + - if: + properties: + compatible: + contains: + const: fsl,imx8qxp-mipi-lvds-csr + then: + required: + - pxl2dpi + - ldb + + - if: + properties: + compatible: + contains: + const: fsl,imx8qm-lvds-csr + then: + required: + - phy + - ldb + +additionalProperties: false + +examples: + - | + #include + #include + mipi_lvds_0_csr: syscon@56221000 { + compatible = "fsl,imx8qxp-mipi-lvds-csr", "syscon", "simple-mfd"; + reg = <0x56221000 0x1000>; + clocks = <&mipi_lvds_0_di_mipi_lvds_regs_lpcg IMX_LPCG_CLK_4>; + clock-names = "ipg"; + + mipi_lvds_0_pxl2dpi: pxl2dpi { + compatible = "fsl,imx8qxp-pxl2dpi"; + fsl,sc-resource = ; + power-domains = <&pd IMX_SC_R_MIPI_0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + mipi_lvds_0_pxl2dpi_dc0_pixel_link0: endpoint@0 { + reg = <0>; + remote-endpoint = <&dc0_pixel_link0_mipi_lvds_0_pxl2dpi>; + }; + + mipi_lvds_0_pxl2dpi_dc0_pixel_link1: endpoint@1 { + reg = <1>; + remote-endpoint = <&dc0_pixel_link1_mipi_lvds_0_pxl2dpi>; + }; + }; + + port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + mipi_lvds_0_pxl2dpi_mipi_lvds_0_ldb_ch0: endpoint@0 { + reg = <0>; + remote-endpoint = <&mipi_lvds_0_ldb_ch0_mipi_lvds_0_pxl2dpi>; + }; + + mipi_lvds_0_pxl2dpi_mipi_lvds_0_ldb_ch1: endpoint@1 { + reg = <1>; + remote-endpoint = <&mipi_lvds_0_ldb_ch1_mipi_lvds_0_pxl2dpi>; + }; + }; + }; + }; + + mipi_lvds_0_ldb: ldb { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,imx8qxp-ldb"; + clocks = <&clk IMX_SC_R_LVDS_0 IMX_SC_PM_CLK_MISC2>, + <&clk IMX_SC_R_LVDS_0 IMX_SC_PM_CLK_BYPASS>; + clock-names = "pixel", "bypass"; + power-domains = <&pd IMX_SC_R_LVDS_0>; + + channel@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + phys = <&mipi_lvds_0_phy>; + phy-names = "lvds_phy"; + + port@0 { + reg = <0>; + + mipi_lvds_0_ldb_ch0_mipi_lvds_0_pxl2dpi: endpoint { + remote-endpoint = <&mipi_lvds_0_pxl2dpi_mipi_lvds_0_ldb_ch0>; + }; + }; + + port@1 { + reg = <1>; + + /* ... */ + }; + }; + + channel@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + phys = <&mipi_lvds_0_phy>; + phy-names = "lvds_phy"; + + port@0 { + reg = <0>; + + mipi_lvds_0_ldb_ch1_mipi_lvds_0_pxl2dpi: endpoint { + remote-endpoint = <&mipi_lvds_0_pxl2dpi_mipi_lvds_0_ldb_ch1>; + }; + }; + + port@1 { + reg = <1>; + + /* ... */ + }; + }; + }; + }; + + mipi_lvds_0_phy: phy@56228300 { + compatible = "fsl,imx8qxp-mipi-dphy"; + reg = <0x56228300 0x100>; + clocks = <&clk IMX_SC_R_LVDS_0 IMX_SC_PM_CLK_PHY>; + clock-names = "phy_ref"; + #phy-cells = <0>; + fsl,syscon = <&mipi_lvds_0_csr>; + power-domains = <&pd IMX_SC_R_MIPI_0>; + }; From patchwork Wed Mar 17 03:42:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 403402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEEC3C433DB for ; Wed, 17 Mar 2021 03:58:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C34FD64F7F for ; Wed, 17 Mar 2021 03:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230171AbhCQD5r (ORCPT ); Tue, 16 Mar 2021 23:57:47 -0400 Received: from mail-eopbgr60044.outbound.protection.outlook.com ([40.107.6.44]:53735 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230175AbhCQD5Q (ORCPT ); Tue, 16 Mar 2021 23:57:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MYA8hbLlWv7CsC6t7OBRta26ae7EhfFRooxrk5W2p25pKH6aQJZaDyMRtd0uLZ0XgDGcY+7bizc4aQ8HmC1URYqAD5ExpX2sYLieyAr6snhCL4OYHPoOiIGPGHC7QsVI/u0fCks6iuYXcdzrZAiu3GZNu+wpYisi3QmpONkwli335KZOx8xIV3st+gSF3yY/XDjELaGJoPUV+XWHHMK/wtN7c3ahL/L/bdZFKcvWyLlfqA59L2xnHE+xqB9xEjHfZa+Trr1XK4GN3I3+3nwVfYtXSeam0JpfcCLu1ECZJLuFIf81iNnV33wxjTzYtlnBXOscpmdo3xayyQLgtNkBvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i+Xdz8iQKlhTWBbwNzzfEs+Tt3m4EwqFf6aLnJyTP9Q=; b=Ixk4TIX4sgR+w3aLU6W5yveKmds3Qghng7s0lQMdA7/I3up5YtON3W3jLv3UbZ2peftwGSPadisKI5eesmqknYPidTrwgfLNjaaTtAjWxtn47va/Dtttr04oIud62EEXCJyhhgKNwQrs0gm7u8/ba1aDHatHB9bsm7vaZB+Usn5YyOAaCLz3aofevnRbEcuywgEeY+ijdNZ4nGuz4O1FkbXF64puR/vpl0/perlwGY6YWe4zoaJdeVCesG+eae/V41j8Vcvtp9ct4p5uUXiIzt0W2zmjnf4N77FZ3i75+XYSRSMHhuZ0fKIqUkd+Rs1vf4s15LJ2OPLnU9f74kS4KQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i+Xdz8iQKlhTWBbwNzzfEs+Tt3m4EwqFf6aLnJyTP9Q=; b=Hid2KEyOPuD1gC3QKT2TuYLMn59iGmoZa0zjjRQyTW+2Yw4IuXwIMeA3f8AwQiA37A+iP5fiXfanDWEQkLepC8+3xXJn7dXGWSOLDFVSHBMGg2EsbGsuOEGgKQcDQ0iOo3iI6iKysHHNeFyqgRPZiFyPiHt2+hysSUVSq9HuRZE= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB6141.eurprd04.prod.outlook.com (2603:10a6:803:f9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Wed, 17 Mar 2021 03:57:14 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0%5]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 03:57:14 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org, a.hajda@samsung.com, narmstrong@baylibre.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org, robert.foss@linaro.org, lee.jones@linaro.org Subject: [PATCH v6 09/14] drm/bridge: imx: Add i.MX8qxp pixel link to DPI support Date: Wed, 17 Mar 2021 11:42:44 +0800 Message-Id: <1615952569-4711-10-git-send-email-victor.liu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> References: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 03:57:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dc3abef8-414f-477b-a097-08d8e8f8bf73 X-MS-TrafficTypeDiagnostic: VI1PR04MB6141: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yXrfjOI/4OTdfCKovI0gm0mqA/G4NkKuEwnJXf+XFruiCzgIcfhhZJBwcix3ZjFyDOgb13eA3PiO/XuiSiIux/BCc6cF6iG+N7BXU9Pn8r++/KhjdcX1TJLdrCvShuKAOUEClxXMvN7icyDxaLi+b0Juchb/ZR9XFVZW4oAFAwnOWIGJs9pyRE5sHNhMGdXMJ6Dqh44a+r4cxoU3szHI7cMQtCw8CVfHAZRdjNbbe8TKFuk8Oogzanr04iL8rkSzWd3jX9zWSvty1gMThXqoajkTJ+c8Bhj16EDwgXf0E13/Y7J/ICDaehBT8CtVsqIAqhvfIQkU4gjlxLnz6md+9PzGmF76oOXtiH39+XnO8rg6iDvMkNULhnkizHFDeL0wdxvfSphiwXxqrPXy0ymCC0ZHJOWuzffbqoFID0aeInoSoyoHhPJUSRlmDnCDELbnTTHkhwe4/AO/p5TENk5XKXHtelrwfQl8UpR8fRWmGZXxwBVvFytNZxgLydvaEcpz4tz7znYvQo6IFpDfKaQCG/WmgwVIJKLN5tpMxH/IKkrCLt+htHeLYxl0lIWiOyvh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3983.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(396003)(39860400002)(136003)(376002)(8676002)(5660300002)(316002)(36756003)(16526019)(186003)(8936002)(83380400001)(4326008)(956004)(2616005)(2906002)(30864003)(52116002)(6486002)(6512007)(6666004)(478600001)(6506007)(66556008)(66476007)(66946007)(7416002)(26005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?DZUUJEmRsR+k9GUyMRg6s5BsC7W?= =?utf-8?q?wxrhvYzFmRB+BY4kgDQtbIxJpjSOgqHTaouPcXOigjbhSbrOVyXU50pc?= =?utf-8?q?B2DiwEyQI5mMuwolpd9pkwfp2ROESW8pNI3mOUZQg14XclMJHC0TmIA0?= =?utf-8?q?rnG0KH0d27S+2XaKcEq32owPj8t2MRxA5qyj/3HFAwXOBXxx4Ib76wJ4?= =?utf-8?q?XBc3DEl/rGcWDDC0GLimmI+zcfO9NSwMWZECzjZOfyIZflqAe1R/hT+v?= =?utf-8?q?Y3dkpVI5ERrQVt2jrNg9kQyHjs+DCyqnBUviJaLPVd/JHBbX1/uWfFK2?= =?utf-8?q?8HxI50D8ziyYFRVyivzLSvBwYgQh6RYoSRIJL+fDawFZPClhH+Cildns?= =?utf-8?q?Ss9JbzXM0bWp5+XzzM9PDx2y5uPbDOXRjSxQrtGpdY5gDpjkB8eeR3d5?= =?utf-8?q?Hh/m6odFuWZI9uYX7Tn9cPOMtROIc2/C8XG9ZwqjvinbIKTXsClerWLX?= =?utf-8?q?VvXjMc1UQ3gyU2sYbdT0VDsmuH5ZfzMPB19JsuvnnW7Flk13byG3R5MM?= =?utf-8?q?RHS1N6pg738jhpthK11vAAJwFxf9NciTPUc2NjYwlEQ5E9gEJJPEHzQG?= =?utf-8?q?OHsBLQ1VPaJf4EYlvOCOwgT55wjCk7Rg3k7ocfLR/2VLCoVSNsbS4udZ?= =?utf-8?q?Oovtnl0wQ9gGT8gEGcyMwGfLvWfvwoPx/24/QmbpP2a2vs/B9F+mEFlf?= =?utf-8?q?HFdFaOd9U4Xq02vGnGuvOPrtNvo5FRQiaVSYndyVWh0CiKFmPaFogdis?= =?utf-8?q?plaO2v4EFe6f92j8+K/J9KnSBKJe6+l2io1YDAoim3FB/bP36Hxnvuzb?= =?utf-8?q?LqySqDU+nZMLeRqBt3UcvbXlje4AyBQFyQbRnFicHK6iBEJ18885T3og?= =?utf-8?q?2UP9votV1Og1nahkGn9PQRe/4SkTYAR14yrXsbvsEkZn23tffJRGvJTb?= =?utf-8?q?60/06qgJOWZHN8b4np7nhno7WGtCk3TuKhEqYVXbjS8Xr81xKsC1Wm4o?= =?utf-8?q?xf9PUK4PYpOyHyL2n1d5wc+VxE73XYUx4cUgMM0oOSyY4MwnmBu6lEJj?= =?utf-8?q?VTExmFa8Z6Ut5nMj8c/b1VKnIIaxQRPFy+m707a8iSRgSLsD1rVnZTK1?= =?utf-8?q?SBNw90a2/5QXdDu+TeWalOzUA0QwbJZFdjLHdBH4oqekKsDmH8mZwgsf?= =?utf-8?q?WEbZ3ujR7ijDb8yojQw9IsPmaSU0ZWKG+Qq7BcwAgME7QDE1htvJqG0J?= =?utf-8?q?vWgBv6gAzWaZfPDFNx+/Z4BR5yUXqxtJ96+r0ccY2VOw9LzVmNbzlJHO?= =?utf-8?q?R7vKYGea2x/bQRbDIOkSZt4t6yML3gpXCUq7XK1X3byL2ntKqNR760G7?= =?utf-8?q?b5G3gzlvUtnI5ql1GREepsjEBsCWq?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc3abef8-414f-477b-a097-08d8e8f8bf73 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 03:57:13.9191 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QxnVZWwsXcWT8IsyEKAZHsgbXjw9Ip+af+CcgkImed6bBqA33+QQbeqN0cOxqKZUEuFuTszSWq+zh8ottRVUWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6141 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds a drm bridge driver for i.MX8qxp pixel link to display pixel interface(PXL2DPI). The PXL2DPI interfaces the pixel link 36-bit data output and the DSI controller’s MIPI-DPI 24-bit data input, and inputs of LVDS Display Bridge(LDB) module used in LVDS mode, to remap the pixel color codings between those modules. The PXL2DPI is purely combinatorial. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v5->v6: * No change. v4->v5: * No change. v3->v4: * Use 'fsl,sc-resource' DT property to get the SCU resource ID associated with the PXL2DPI instance instead of using alias ID. (Rob) v2->v3: * Call syscon_node_to_regmap() to get regmap instead of syscon_regmap_lookup_by_phandle(). v1->v2: * Drop unnecessary port availability check. drivers/gpu/drm/bridge/imx/Kconfig | 8 + drivers/gpu/drm/bridge/imx/Makefile | 1 + drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 485 +++++++++++++++++++++++++++ 3 files changed, 494 insertions(+) create mode 100644 drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig index 4d1f027..1ea1ce7 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -14,3 +14,11 @@ config DRM_IMX8QXP_PIXEL_LINK help Choose this to enable display pixel link found in Freescale i.MX8qm/qxp processors. + +config DRM_IMX8QXP_PIXEL_LINK_TO_DPI + tristate "Freescale i.MX8QXP pixel link to display pixel interface" + depends on OF + select DRM_KMS_HELPER + help + Choose this to enable pixel link to display pixel interface(PXL2DPI) + found in Freescale i.MX8qxp processor. diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile index c15469f..e74dd64 100644 --- a/drivers/gpu/drm/bridge/imx/Makefile +++ b/drivers/gpu/drm/bridge/imx/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_DRM_IMX8QXP_PIXEL_COMBINER) += imx8qxp-pixel-combiner.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK) += imx8qxp-pixel-link.o +obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK_TO_DPI) += imx8qxp-pxl2dpi.o diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c new file mode 100644 index 00000000..6696855 --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c @@ -0,0 +1,485 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * Copyright 2020 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define PXL2DPI_CTRL 0x40 +#define CFG1_16BIT 0x0 +#define CFG2_16BIT 0x1 +#define CFG3_16BIT 0x2 +#define CFG1_18BIT 0x3 +#define CFG2_18BIT 0x4 +#define CFG_24BIT 0x5 + +#define DRIVER_NAME "imx8qxp-pxl2dpi" + +struct imx8qxp_pxl2dpi { + struct regmap *regmap; + struct drm_bridge bridge; + struct drm_bridge *next_bridge; + struct drm_bridge *companion; + struct device *dev; + struct imx_sc_ipc *ipc_handle; + u32 sc_resource; + u32 in_bus_format; + u32 out_bus_format; + u32 pl_sel; +}; + +#define bridge_to_p2d(b) container_of(b, struct imx8qxp_pxl2dpi, bridge) + +static int imx8qxp_pxl2dpi_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct imx8qxp_pxl2dpi *p2d = bridge->driver_private; + + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { + DRM_DEV_ERROR(p2d->dev, + "do not support creating a drm_connector\n"); + return -EINVAL; + } + + if (!bridge->encoder) { + DRM_DEV_ERROR(p2d->dev, "missing encoder\n"); + return -ENODEV; + } + + return drm_bridge_attach(bridge->encoder, + p2d->next_bridge, bridge, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); +} + +static int +imx8qxp_pxl2dpi_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct imx8qxp_pxl2dpi *p2d = bridge->driver_private; + + p2d->in_bus_format = bridge_state->input_bus_cfg.format; + p2d->out_bus_format = bridge_state->output_bus_cfg.format; + + return 0; +} + +static void +imx8qxp_pxl2dpi_bridge_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode) +{ + struct imx8qxp_pxl2dpi *p2d = bridge->driver_private; + struct imx8qxp_pxl2dpi *companion_p2d; + int ret; + + ret = pm_runtime_get_sync(p2d->dev); + if (ret < 0) + DRM_DEV_ERROR(p2d->dev, + "failed to get runtime PM sync: %d\n", ret); + + ret = imx_sc_misc_set_control(p2d->ipc_handle, p2d->sc_resource, + IMX_SC_C_PXL_LINK_SEL, p2d->pl_sel); + if (ret) + DRM_DEV_ERROR(p2d->dev, + "failed to set pixel link selection(%u): %d\n", + p2d->pl_sel, ret); + + switch (p2d->out_bus_format) { + case MEDIA_BUS_FMT_RGB888_1X24: + regmap_write(p2d->regmap, PXL2DPI_CTRL, CFG_24BIT); + break; + case MEDIA_BUS_FMT_RGB666_1X24_CPADHI: + regmap_write(p2d->regmap, PXL2DPI_CTRL, CFG2_18BIT); + break; + default: + DRM_DEV_ERROR(p2d->dev, + "unsupported output bus format 0x%08x\n", + p2d->out_bus_format); + } + + if (p2d->companion) { + companion_p2d = bridge_to_p2d(p2d->companion); + + companion_p2d->in_bus_format = p2d->in_bus_format; + companion_p2d->out_bus_format = p2d->out_bus_format; + + p2d->companion->funcs->mode_set(p2d->companion, mode, + adjusted_mode); + } +} + +static void +imx8qxp_pxl2dpi_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) +{ + struct imx8qxp_pxl2dpi *p2d = bridge->driver_private; + int ret; + + ret = pm_runtime_put(p2d->dev); + if (ret < 0) + DRM_DEV_ERROR(p2d->dev, "failed to put runtime PM: %d\n", ret); + + if (p2d->companion) + p2d->companion->funcs->atomic_disable(p2d->companion, + old_bridge_state); +} + +static const u32 imx8qxp_pxl2dpi_bus_output_fmts[] = { + MEDIA_BUS_FMT_RGB888_1X24, + MEDIA_BUS_FMT_RGB666_1X24_CPADHI, +}; + +static bool imx8qxp_pxl2dpi_bus_output_fmt_supported(u32 fmt) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(imx8qxp_pxl2dpi_bus_output_fmts); i++) { + if (imx8qxp_pxl2dpi_bus_output_fmts[i] == fmt) + return true; + } + + return false; +} + +static u32 * +imx8qxp_pxl2dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + u32 *input_fmts; + + if (!imx8qxp_pxl2dpi_bus_output_fmt_supported(output_fmt)) + return NULL; + + *num_input_fmts = 1; + + input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + + switch (output_fmt) { + case MEDIA_BUS_FMT_RGB888_1X24: + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X36_CPADLO; + break; + case MEDIA_BUS_FMT_RGB666_1X24_CPADHI: + input_fmts[0] = MEDIA_BUS_FMT_RGB666_1X36_CPADLO; + break; + default: + kfree(input_fmts); + input_fmts = NULL; + break; + } + + return input_fmts; +} + +static u32 * +imx8qxp_pxl2dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + unsigned int *num_output_fmts) +{ + *num_output_fmts = ARRAY_SIZE(imx8qxp_pxl2dpi_bus_output_fmts); + return kmemdup(imx8qxp_pxl2dpi_bus_output_fmts, + sizeof(imx8qxp_pxl2dpi_bus_output_fmts), GFP_KERNEL); +} + +static const struct drm_bridge_funcs imx8qxp_pxl2dpi_bridge_funcs = { + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + .attach = imx8qxp_pxl2dpi_bridge_attach, + .atomic_check = imx8qxp_pxl2dpi_bridge_atomic_check, + .mode_set = imx8qxp_pxl2dpi_bridge_mode_set, + .atomic_disable = imx8qxp_pxl2dpi_bridge_atomic_disable, + .atomic_get_input_bus_fmts = + imx8qxp_pxl2dpi_bridge_atomic_get_input_bus_fmts, + .atomic_get_output_bus_fmts = + imx8qxp_pxl2dpi_bridge_atomic_get_output_bus_fmts, +}; + +static struct device_node * +imx8qxp_pxl2dpi_get_available_ep_from_port(struct imx8qxp_pxl2dpi *p2d, + u32 port_id) +{ + struct device_node *port, *ep; + int ep_cnt; + + port = of_graph_get_port_by_id(p2d->dev->of_node, port_id); + if (!port) { + DRM_DEV_ERROR(p2d->dev, "failed to get port@%u\n", port_id); + return ERR_PTR(-ENODEV); + } + + ep_cnt = of_get_available_child_count(port); + if (ep_cnt == 0) { + DRM_DEV_ERROR(p2d->dev, "no available endpoints of port@%u\n", + port_id); + ep = ERR_PTR(-ENODEV); + goto out; + } else if (ep_cnt > 1) { + DRM_DEV_ERROR(p2d->dev, + "invalid available endpoints of port@%u\n", port_id); + ep = ERR_PTR(-ENOTSUPP); + goto out; + } + + ep = of_get_next_available_child(port, NULL); + if (!ep) { + DRM_DEV_ERROR(p2d->dev, + "failed to get available endpoint of port@%u\n", + port_id); + ep = ERR_PTR(-ENODEV); + goto out; + } +out: + of_node_put(port); + return ep; +} + +static struct drm_bridge * +imx8qxp_pxl2dpi_find_next_bridge(struct imx8qxp_pxl2dpi *p2d) +{ + struct device_node *ep, *remote; + struct drm_bridge *next_bridge; + int ret; + + ep = imx8qxp_pxl2dpi_get_available_ep_from_port(p2d, 1); + if (IS_ERR(ep)) { + ret = PTR_ERR(ep); + return ERR_PTR(ret); + } + + remote = of_graph_get_remote_port_parent(ep); + if (!remote || !of_device_is_available(remote)) { + DRM_DEV_ERROR(p2d->dev, "no available remote\n"); + next_bridge = ERR_PTR(-ENODEV); + goto out; + } else if (!of_device_is_available(remote->parent)) { + DRM_DEV_ERROR(p2d->dev, "remote parent is not available\n"); + next_bridge = ERR_PTR(-ENODEV); + goto out; + } + + next_bridge = of_drm_find_bridge(remote); + if (!next_bridge) { + next_bridge = ERR_PTR(-EPROBE_DEFER); + goto out; + } +out: + of_node_put(remote); + of_node_put(ep); + + return next_bridge; +} + +static int imx8qxp_pxl2dpi_set_pixel_link_sel(struct imx8qxp_pxl2dpi *p2d) +{ + struct device_node *ep; + struct of_endpoint endpoint; + int ret; + + ep = imx8qxp_pxl2dpi_get_available_ep_from_port(p2d, 0); + if (IS_ERR(ep)) + return PTR_ERR(ep); + + ret = of_graph_parse_endpoint(ep, &endpoint); + if (ret) { + DRM_DEV_ERROR(p2d->dev, + "failed to parse endpoint of port@0: %d\n", ret); + goto out; + } + + p2d->pl_sel = endpoint.id; +out: + of_node_put(ep); + + return ret; +} + +static int imx8qxp_pxl2dpi_parse_dt_companion(struct imx8qxp_pxl2dpi *p2d) +{ + struct imx8qxp_pxl2dpi *companion_p2d; + struct device *dev = p2d->dev; + struct device_node *companion; + struct device_node *port1, *port2; + const struct of_device_id *match; + int dual_link; + int ret = 0; + + /* Locate the companion PXL2DPI for dual-link operation, if any. */ + companion = of_parse_phandle(dev->of_node, "fsl,companion-pxl2dpi", 0); + if (!companion) + return 0; + + if (!of_device_is_available(companion)) { + DRM_DEV_ERROR(dev, "companion PXL2DPI is not available\n"); + ret = -ENODEV; + goto out; + } + + /* + * Sanity check: the companion bridge must have the same compatible + * string. + */ + match = of_match_device(dev->driver->of_match_table, dev); + if (!of_device_is_compatible(companion, match->compatible)) { + DRM_DEV_ERROR(dev, "companion PXL2DPI is incompatible\n"); + ret = -ENXIO; + goto out; + } + + p2d->companion = of_drm_find_bridge(companion); + if (!p2d->companion) { + ret = -EPROBE_DEFER; + DRM_DEV_DEBUG_DRIVER(p2d->dev, + "failed to find companion bridge: %d\n", ret); + goto out; + } + + companion_p2d = bridge_to_p2d(p2d->companion); + + /* + * We need to work out if the sink is expecting us to function in + * dual-link mode. We do this by looking at the DT port nodes that + * the next bridges are connected to. If they are marked as expecting + * even pixels and odd pixels than we need to use the companion PXL2DPI. + */ + port1 = of_graph_get_port_by_id(p2d->next_bridge->of_node, 1); + port2 = of_graph_get_port_by_id(companion_p2d->next_bridge->of_node, 1); + dual_link = drm_of_lvds_get_dual_link_pixel_order(port1, port2); + of_node_put(port1); + of_node_put(port2); + + if (dual_link < 0) { + ret = dual_link; + DRM_DEV_ERROR(dev, "failed to get dual link pixel order: %d\n", + ret); + goto out; + } + + DRM_DEV_DEBUG_DRIVER(dev, + "dual-link configuration detected (companion bridge %pOF)\n", + companion); +out: + of_node_put(companion); + return ret; +} + +static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev) +{ + struct imx8qxp_pxl2dpi *p2d; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + int ret; + + p2d = devm_kzalloc(dev, sizeof(*p2d), GFP_KERNEL); + if (!p2d) + return -ENOMEM; + + p2d->regmap = syscon_node_to_regmap(np->parent); + if (IS_ERR(p2d->regmap)) { + ret = PTR_ERR(p2d->regmap); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to get regmap: %d\n", ret); + return ret; + } + + ret = imx_scu_get_handle(&p2d->ipc_handle); + if (ret) { + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to get SCU ipc handle: %d\n", + ret); + return ret; + } + + p2d->dev = dev; + + ret = of_property_read_u32(np, "fsl,sc-resource", &p2d->sc_resource); + if (ret) { + DRM_DEV_ERROR(dev, "failed to get SC resource %d\n", ret); + return ret; + } + + p2d->next_bridge = imx8qxp_pxl2dpi_find_next_bridge(p2d); + if (IS_ERR(p2d->next_bridge)) { + ret = PTR_ERR(p2d->next_bridge); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to find next bridge: %d\n", + ret); + return ret; + } + + ret = imx8qxp_pxl2dpi_set_pixel_link_sel(p2d); + if (ret) + return ret; + + ret = imx8qxp_pxl2dpi_parse_dt_companion(p2d); + if (ret) + return ret; + + platform_set_drvdata(pdev, p2d); + pm_runtime_enable(dev); + + p2d->bridge.driver_private = p2d; + p2d->bridge.funcs = &imx8qxp_pxl2dpi_bridge_funcs; + p2d->bridge.of_node = np; + + drm_bridge_add(&p2d->bridge); + + return ret; +} + +static int imx8qxp_pxl2dpi_bridge_remove(struct platform_device *pdev) +{ + struct imx8qxp_pxl2dpi *p2d = platform_get_drvdata(pdev); + + drm_bridge_remove(&p2d->bridge); + + pm_runtime_disable(&pdev->dev); + + return 0; +} + +static const struct of_device_id imx8qxp_pxl2dpi_dt_ids[] = { + { .compatible = "fsl,imx8qxp-pxl2dpi", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx8qxp_pxl2dpi_dt_ids); + +static struct platform_driver imx8qxp_pxl2dpi_bridge_driver = { + .probe = imx8qxp_pxl2dpi_bridge_probe, + .remove = imx8qxp_pxl2dpi_bridge_remove, + .driver = { + .of_match_table = imx8qxp_pxl2dpi_dt_ids, + .name = DRIVER_NAME, + }, +}; +module_platform_driver(imx8qxp_pxl2dpi_bridge_driver); + +MODULE_DESCRIPTION("i.MX8QXP pixel link to DPI bridge driver"); +MODULE_AUTHOR("Liu Ying "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRIVER_NAME); From patchwork Wed Mar 17 03:42:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 403401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D7BAC433E6 for ; Wed, 17 Mar 2021 03:58:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E980E64F9B for ; Wed, 17 Mar 2021 03:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230341AbhCQD5s (ORCPT ); Tue, 16 Mar 2021 23:57:48 -0400 Received: from mail-eopbgr60045.outbound.protection.outlook.com ([40.107.6.45]:58945 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230266AbhCQD5W (ORCPT ); Tue, 16 Mar 2021 23:57:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MOD74j56pKKZKZvIXHJdxwomHT9inoTD6QOfUJPhcAt/ZNIPIIXX0K04XGe+0FFB8V2DuJT6nf7YQg0KRf4aylOnUr0oLNJDIyqkogTT1xy8Xq/aX3IqQmvcZ5dzX1KgutVhGtm1vk6MW9JW4EJLuzmxA/mYSoypPN4pjLZvmcoyx+TNBJCtO4eqAKjcplhesHRYelEQuSWvAa0WJBWaq5Knyd4k7N2TeaptIjIX8OTf+clC6GaJ5IJMH69lvECJDmwXv4QWeE+mgRnhPvEtUcuqtTKLib1mgBcDG+ApSrG0i9c2YmaTt+laykqcZGod3wPE3wT4fxdsFZqb4jtQaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6AmJDD0juRXtlm1CpeLcdr3bh9SZNfq+Cr5pkyVXKmI=; b=GH6ZVbbBvNAycAWe0fN8a6jej/KqSbYD09duIju0CTN9j8CvVFRiAusEo/15qYMEXhxF+4TOkDi92L7QyhiG6FtUoJqOU+qhj+2zO78tx4XeUN0Z0oK1zLxcsDVF6VFANGXLBJjP6Yv1GnVpF519pylp43yVX7hZmx42iNTeuzQ6WOzIV5OJW9G4o27XjVCJ67xMw/rJeEErIsw+kGDNK5lhByZa0qztwZXSIoB5OSnp1PlyZewbe9NRaMB5uWKKNOACn6BNxGYCGHeFz58kZ7HfcXkzZpDASgC3yqsh/Ij62Z+/PL3ywbN3CUIkdSkuo9hh99t9eNg2KUvYutlTTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6AmJDD0juRXtlm1CpeLcdr3bh9SZNfq+Cr5pkyVXKmI=; b=FZt8SuBspz6vXsYnzkqgnM6vrdQFkrMayRD9Y0YQLDowdXV2n4+aJm45zImGiy9KPpuQHqwrMd0SmNnvEDcWck/uT+s+SHQa1TSWZw0Mw3TD+MYcMd+cTrzF29/JRo/mMHi4zwlxk2rI8DFsdoDbh/XBbgZnTyrP7i+YEaeUHxk= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB6141.eurprd04.prod.outlook.com (2603:10a6:803:f9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Wed, 17 Mar 2021 03:57:20 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0%5]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 03:57:20 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org, a.hajda@samsung.com, narmstrong@baylibre.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org, robert.foss@linaro.org, lee.jones@linaro.org Subject: [PATCH v6 10/14] drm/bridge: imx: Add LDB driver helper support Date: Wed, 17 Mar 2021 11:42:45 +0800 Message-Id: <1615952569-4711-11-git-send-email-victor.liu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> References: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 03:57:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 09578d67-8ca9-4132-62a6-08d8e8f8c356 X-MS-TrafficTypeDiagnostic: VI1PR04MB6141: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eYesXYx6UuUkg7hxKuFe/RcOy41blsrN5oCrNT4YxYpzu7pAE513ArcyddFYFXe3nIq16GwqbOq46CQo1fAheItjis5oMYaAsXTGmWlVEuIjyhwtEAqP9MJYh9JyYpZxYwQRk4UZrekJsolaesGo63HDSp3j2w2yTaFDBRRDUa7Cd4/c+qVyH4UE9xt7WVa4YauYC/kREwfc98hQBQw/iQ751SlYkIQnqssAQfgrTxJLTPgmsxdyBUte4lkHbpfbzAODNDtuEmOsPQbJgv4H0vPSGKEmv3oRFK4XCuvBKfko4qkjGLk/HLqgIvYD74jrygBWkGxZ6tXYTEzUCDR+GGRbSPth+9OX3tbqsnp30t1qwaCPaAUVnrAEQ364QKWLeTmoder4Mm9j9DMr3uNbsXsqVofqR/LE/iRXOnBaMdjALRpQ5Bjpl1Fw/0nbMNQUtpVxTxzAJNzOo9P04qSqyzvwead7vgIAWE1gH+H0mNGxSQJ8L37rLcRTHqdP3MUL8tsMHzXkVK9+kwxrE10IB2cnerww9cbSuPZ5GiBw+SgIUmPo1TjrTnAJAMrWPyEWymJCj0AFUXQiEf4slu7Gc7v11IWawBtnSAWXz0QgFCFnC810ygGRYWMoABkdwGaW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3983.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(396003)(39860400002)(136003)(376002)(8676002)(5660300002)(316002)(36756003)(16526019)(186003)(8936002)(69590400012)(4326008)(956004)(2616005)(2906002)(52116002)(6486002)(6512007)(6666004)(478600001)(6506007)(66556008)(66476007)(66946007)(7416002)(26005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 7avyRUJ3j0RdvN/FZCRPsUXlMGTHbEqjX6ZgrnodY76RlRB0s5vhEJz0meArbKyF/i5e46aTr0/+yxIzdYpFNu0kw0hjoA0ULr3/UiYKFcQtojoiVD26BG4XbYHPu4wHHlLogUgMbWbU8gncDiGqFIW4oF1/fyhSdDzdV2PZdA5Qgj8lD5wD774/NM0TN4u7YHB0NQ7I3tGjzL9y7N5BQ2WaX2P8+FIXnrPQHBgc68xQ5G1fVWG24sCcNrvZmn7dsFhioFo9CRxOwfmWVLWfNzJEFHu92T9qS4dsepfQXHJZnpTJbzfYgXN67yH5HSw+GPvFUp6t5gsFzPtVKUE9+JS1V492TOsbqsvWfA9cc5DlVCCZYHwuEvcrF6M/fAwLyUZUxDtz98XDogyt0/97NWnt0GoptST6R7a23YKPuEiohpCcU/OcHxQRuRQhdhjjUzaX3kYxKZzJNL8keKYqX/rSE0RwP+I6atSwl/WH1qb2GP0RMYw86Lb8XI9ad//qT1ryUoOm3a+nHbdK8U28v+jPTOG9gWGIoH5QnYarJBEdqNNDjc0Ef+ZEj/zT94jzlwdgCMkZ5VOKclXbS36pCnNPK51Kw7MmFA2hMC1D/HGTWE+wmQFFDF+xpqM+4fDzTufj8LsdVvSsJ7ZwNF9cu/aeMGYHAP5MSltxsZ0plST00CmVy+OfJI38z4gB+cidfXpK6V+D16ZDGWugXOwQDawhaR/PjMLdj7tttH67dfDfaID2yF76HrIqHXVz21H+/s2L9kH6uL/Ws4sKYiJFFijl+CszV+BdYVsDFtTlddy0BsaKiKES4hv59KQiUyUFUdbqyDPmTGNrPqh//xHl+Dpxb7ku6/CRkSmthc2BICjjElBFKdW8/CKmdPLPvi73cwBPUuadwsrvmxgmt7h0lfbT0NQ9l5DjoIUIjL4D7praqCjwazSyz7LeKfTBLb/OFZssn2M1WipoCcTX+cymd0eonqUDoil3gvQb13GTFDdSgUpoHg9bqO26bj5tXrwtN01x2OOin5eP/UlpYm3skwtEAlba2zHlobcSsUHnUv/I18x/0NY4h/zOxa5l6M/2iQTFX1Qr/ZLGcCN6b3t4aufSKu4+6M0Ok7nA+BL+9Zn8E5sWy0Fn4StFsyYEFwrAl/3eNm8gK+QqUadDUYbaW9vp+kPFSOKqGrM26Li0b0WPyEYMIaF5LVRDWfLNFoAIDi9k8f32s5QfePcCKfu/MnVyE8jgEKQCfBPmc2YAbiPTnbFG1xccRZSECqyodV7EZAtVLdmBYOVnv/2zyJwLSofXScf7bB41fjTUQFULyvek61myXd/H01ZxhIJfAszz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09578d67-8ca9-4132-62a6-08d8e8f8c356 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 03:57:20.1745 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jBQHGHTmc+iL5+T0WJlJtGKwdqLXL+rFsz/d8ySpMDxjAuI7D1m84cJ06b/9IHHipPmzqKwdHqkYoEt+1NQnaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6141 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds a helper to support LDB drm bridge drivers for i.MX SoCs. Helper functions supported by this helper should implement common logics for all LDB modules embedded in i.MX SoCs. Signed-off-by: Liu Ying Reviewed-by: Robert Foss --- v5->v6: * No change. v4->v5: * Make imx-ldb-helper be a pure object to be linked with i.MX8qxp LDB bridge driver and i.MX8qm LDB bridge driver. (Robert) * Move 'imx_ldb_helper.h' to 'drivers/gpu/drm/bridge/imx/imx-ldb-helper.h'. (Robert) * s/__FSL_IMX_LDB__/__IMX_LDB_HELPER__/ for 'imx-ldb-helper.h'. v3->v4: * No change. v2->v3: * Call syscon_node_to_regmap() to get regmap instead of syscon_regmap_lookup_by_phandle(). v1->v2: * No change. drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 232 ++++++++++++++++++++++++++++ drivers/gpu/drm/bridge/imx/imx-ldb-helper.h | 98 ++++++++++++ 2 files changed, 330 insertions(+) create mode 100644 drivers/gpu/drm/bridge/imx/imx-ldb-helper.c create mode 100644 drivers/gpu/drm/bridge/imx/imx-ldb-helper.h diff --git a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c new file mode 100644 index 00000000..d01c4ff9 --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c @@ -0,0 +1,232 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2012 Sascha Hauer, Pengutronix + * Copyright 2019,2020 NXP + */ + +#include +#include +#include + +#include +#include +#include + +#include "imx-ldb-helper.h" + +bool ldb_channel_is_single_link(struct ldb_channel *ldb_ch) +{ + return ldb_ch->link_type == LDB_CH_SINGLE_LINK; +} + +bool ldb_channel_is_split_link(struct ldb_channel *ldb_ch) +{ + return ldb_ch->link_type == LDB_CH_DUAL_LINK_EVEN_ODD_PIXELS || + ldb_ch->link_type == LDB_CH_DUAL_LINK_ODD_EVEN_PIXELS; +} + +int ldb_bridge_atomic_check_helper(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + + ldb_ch->in_bus_format = bridge_state->input_bus_cfg.format; + ldb_ch->out_bus_format = bridge_state->output_bus_cfg.format; + + return 0; +} + +void ldb_bridge_mode_set_helper(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + struct ldb *ldb = ldb_ch->ldb; + bool is_split = ldb_channel_is_split_link(ldb_ch); + + if (is_split) + ldb->ldb_ctrl |= LDB_SPLIT_MODE_EN; + + switch (ldb_ch->out_bus_format) { + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG: + break; + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG: + if (ldb_ch->chno == 0 || is_split) + ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24; + if (ldb_ch->chno == 1 || is_split) + ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24; + break; + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA: + if (ldb_ch->chno == 0 || is_split) + ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24 | + LDB_BIT_MAP_CH0_JEIDA; + if (ldb_ch->chno == 1 || is_split) + ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24 | + LDB_BIT_MAP_CH1_JEIDA; + break; + } +} + +void ldb_bridge_enable_helper(struct drm_bridge *bridge) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + struct ldb *ldb = ldb_ch->ldb; + + /* + * Platform specific bridge drivers should set ldb_ctrl properly + * for the enablement, so just write the ctrl_reg here. + */ + regmap_write(ldb->regmap, ldb->ctrl_reg, ldb->ldb_ctrl); +} + +void ldb_bridge_disable_helper(struct drm_bridge *bridge) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + struct ldb *ldb = ldb_ch->ldb; + bool is_split = ldb_channel_is_split_link(ldb_ch); + + if (ldb_ch->chno == 0 || is_split) + ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; + if (ldb_ch->chno == 1 || is_split) + ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; + + regmap_write(ldb->regmap, ldb->ctrl_reg, ldb->ldb_ctrl); +} + +int ldb_bridge_attach_helper(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + struct ldb *ldb = ldb_ch->ldb; + + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { + DRM_DEV_ERROR(ldb->dev, + "do not support creating a drm_connector\n"); + return -EINVAL; + } + + if (!bridge->encoder) { + DRM_DEV_ERROR(ldb->dev, "missing encoder\n"); + return -ENODEV; + } + + return drm_bridge_attach(bridge->encoder, + ldb_ch->next_bridge, bridge, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); +} + +int ldb_init_helper(struct ldb *ldb) +{ + struct device *dev = ldb->dev; + struct device_node *np = dev->of_node; + struct device_node *child; + int ret; + u32 i; + + ldb->regmap = syscon_node_to_regmap(np->parent); + if (IS_ERR(ldb->regmap)) { + ret = PTR_ERR(ldb->regmap); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to get regmap: %d\n", ret); + return ret; + } + + for_each_available_child_of_node(np, child) { + struct ldb_channel *ldb_ch; + + ret = of_property_read_u32(child, "reg", &i); + if (ret || i > MAX_LDB_CHAN_NUM - 1) { + ret = -EINVAL; + DRM_DEV_ERROR(dev, + "invalid channel node address: %u\n", i); + of_node_put(child); + return ret; + } + + ldb_ch = ldb->channel[i]; + ldb_ch->ldb = ldb; + ldb_ch->chno = i; + ldb_ch->is_available = true; + ldb_ch->np = child; + + ldb->available_ch_cnt++; + } + + return 0; +} + +int ldb_find_next_bridge_helper(struct ldb *ldb) +{ + struct device *dev = ldb->dev; + struct ldb_channel *ldb_ch; + int ret, i; + + for (i = 0; i < MAX_LDB_CHAN_NUM; i++) { + ldb_ch = ldb->channel[i]; + + if (!ldb_ch->is_available) + continue; + + ret = drm_of_find_panel_or_bridge(ldb_ch->np, 1, 0, + &ldb_ch->panel, + &ldb_ch->next_bridge); + if (ret) { + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, + "failed to find panel or bridge: %d\n", + ret); + return ret; + } + + if (ldb_ch->panel) { + ldb_ch->next_bridge = devm_drm_panel_bridge_add(dev, + ldb_ch->panel); + if (IS_ERR(ldb_ch->next_bridge)) { + ret = PTR_ERR(ldb_ch->next_bridge); + DRM_DEV_ERROR(dev, + "failed to add panel bridge: %d\n", + ret); + return ret; + } + } + } + + return 0; +} + +void ldb_add_bridge_helper(struct ldb *ldb, + const struct drm_bridge_funcs *bridge_funcs) +{ + struct ldb_channel *ldb_ch; + int i; + + for (i = 0; i < MAX_LDB_CHAN_NUM; i++) { + ldb_ch = ldb->channel[i]; + + if (!ldb_ch->is_available) + continue; + + ldb_ch->bridge.driver_private = ldb_ch; + ldb_ch->bridge.funcs = bridge_funcs; + ldb_ch->bridge.of_node = ldb_ch->np; + + drm_bridge_add(&ldb_ch->bridge); + } +} + +void ldb_remove_bridge_helper(struct ldb *ldb) +{ + struct ldb_channel *ldb_ch; + int i; + + for (i = 0; i < MAX_LDB_CHAN_NUM; i++) { + ldb_ch = ldb->channel[i]; + + if (!ldb_ch->is_available) + continue; + + drm_bridge_remove(&ldb_ch->bridge); + } +} diff --git a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.h b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.h new file mode 100644 index 00000000..748c378 --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.h @@ -0,0 +1,98 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* + * Copyright 2019,2020 NXP + */ + +#ifndef __IMX_LDB_HELPER__ +#define __IMX_LDB_HELPER__ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define LDB_CH0_MODE_EN_TO_DI0 (1 << 0) +#define LDB_CH0_MODE_EN_TO_DI1 (3 << 0) +#define LDB_CH0_MODE_EN_MASK (3 << 0) +#define LDB_CH1_MODE_EN_TO_DI0 (1 << 2) +#define LDB_CH1_MODE_EN_TO_DI1 (3 << 2) +#define LDB_CH1_MODE_EN_MASK (3 << 2) +#define LDB_SPLIT_MODE_EN (1 << 4) +#define LDB_DATA_WIDTH_CH0_24 (1 << 5) +#define LDB_BIT_MAP_CH0_JEIDA (1 << 6) +#define LDB_DATA_WIDTH_CH1_24 (1 << 7) +#define LDB_BIT_MAP_CH1_JEIDA (1 << 8) +#define LDB_DI0_VS_POL_ACT_LOW (1 << 9) +#define LDB_DI1_VS_POL_ACT_LOW (1 << 10) + +#define MAX_LDB_CHAN_NUM 2 + +enum ldb_channel_link_type { + LDB_CH_SINGLE_LINK, + LDB_CH_DUAL_LINK_EVEN_ODD_PIXELS, + LDB_CH_DUAL_LINK_ODD_EVEN_PIXELS, +}; + +struct ldb; + +struct ldb_channel { + struct ldb *ldb; + struct drm_bridge bridge; + struct drm_panel *panel; + struct drm_bridge *next_bridge; + struct device_node *np; + u32 chno; + bool is_available; + u32 in_bus_format; + u32 out_bus_format; + enum ldb_channel_link_type link_type; +}; + +struct ldb { + struct regmap *regmap; + struct device *dev; + struct ldb_channel *channel[MAX_LDB_CHAN_NUM]; + unsigned int ctrl_reg; + u32 ldb_ctrl; + unsigned int available_ch_cnt; +}; + +#define bridge_to_ldb_ch(b) container_of(b, struct ldb_channel, bridge) + +bool ldb_channel_is_single_link(struct ldb_channel *ldb_ch); +bool ldb_channel_is_split_link(struct ldb_channel *ldb_ch); + +int ldb_bridge_atomic_check_helper(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state); + +void ldb_bridge_mode_set_helper(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode); + +void ldb_bridge_enable_helper(struct drm_bridge *bridge); + +void ldb_bridge_disable_helper(struct drm_bridge *bridge); + +int ldb_bridge_attach_helper(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags); + +int ldb_init_helper(struct ldb *ldb); + +int ldb_find_next_bridge_helper(struct ldb *ldb); + +void ldb_add_bridge_helper(struct ldb *ldb, + const struct drm_bridge_funcs *bridge_funcs); + +void ldb_remove_bridge_helper(struct ldb *ldb); + +#endif /* __IMX_LDB_HELPER__ */ From patchwork Wed Mar 17 03:42:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 403400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 722BFC43332 for ; Wed, 17 Mar 2021 03:58:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BEF964F72 for ; Wed, 17 Mar 2021 03:58:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230175AbhCQD5v (ORCPT ); Tue, 16 Mar 2021 23:57:51 -0400 Received: from mail-eopbgr80071.outbound.protection.outlook.com ([40.107.8.71]:23811 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230388AbhCQD5m (ORCPT ); Tue, 16 Mar 2021 23:57:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N1L51SgEXlJDPSIKXI9iFw6ghaihk5LkWNg0f6/lbKhyeOQs3XMoTjYz+1vx+OsxTZIGhveMaVV4MdLMMCY65NwFOUrtzqVRmv3CuEg+1SB+fvvcg0aQ84is15FrQeDAyUcVEc6ChU8GarxAib3WNQHp4Uvy9f8yKDwZwjgKTagIdvvkkzn7swFvFc3sK79wFXMqtkinaYYrzetTx45DCyF8CZ2DqeGGW3zJ6opR86R6Zdsb4c2p2Zv6KyuZmSl5XSWqXTXT0Q2yoqbzWvBu6LFFYFFEtMJrIGhBkiTClKacUTDkiI0AzM9SJznyB969dWbjZ+hjiig967AvjBFA+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9YrdOt50zFwdkajsHgYKNz7Jhz/ASMpaB8lIPyZ4e7s=; b=MKuaiL80Iuk9ImKA0Rp2zX2wO9V0BTVCZYRSjC2WEqU2weD3XBZ9hxwbRdaAtVw00ymG35O6QeSLqsv0AywFkhj9D4YDN5y3jDnKpye0mwvTwMmWRV7XLpDkVllzxtqhPPVzgp3tFyQdg7zOI1Ef7j4L89EErGMyfX4Jx2gWlQut347AoSqFsrLzhJ9Gsh101Ka9/QuhQV8WU75yCd05Hib3jUchv1hQOiQGXbsc+QNC86aanjSXX/ypPqNdMNKmhj11tuv7J13pQwgxT9qfPZkCVmxaqKeBBMPjRD+GMNpZG9qAIq4DMiB64aRPsQONJWA+2HpUy2iSsZoAsaxdcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9YrdOt50zFwdkajsHgYKNz7Jhz/ASMpaB8lIPyZ4e7s=; b=UnYEJjSadu+Z/1SR7QdD2lJaJL2Cgu7ASKega0zi6P2canpXR1nwd2bW98LUv3rzsLQ+BhZ5sGHdcidTVACkQ+pm2YSc/uoC1BQ0xEGnMgDV+SMKfHffHvvFsdp4XkcfkhLfbesvs4K8iMPhMLQesouae/le/SoY3ArimymwRDE= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB6991.eurprd04.prod.outlook.com (2603:10a6:803:12d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Wed, 17 Mar 2021 03:57:39 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::2564:cacc:2da5:52d0%5]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 03:57:39 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org, a.hajda@samsung.com, narmstrong@baylibre.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org, robert.foss@linaro.org, lee.jones@linaro.org Subject: [PATCH v6 13/14] drm/bridge: imx: Add LDB support for i.MX8qm Date: Wed, 17 Mar 2021 11:42:48 +0800 Message-Id: <1615952569-4711-14-git-send-email-victor.liu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> References: <1615952569-4711-1-git-send-email-victor.liu@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 03:57:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 18aff6ca-a6c9-4d3e-f45e-08d8e8f8cea8 X-MS-TrafficTypeDiagnostic: VI1PR04MB6991: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tZgrhyn8HE/Ac3reSacX7GUY3fQj9InN6xCqtOYQR7M13bvwltJzm7xKHcvhaPaLZqVoRok7i/UkIM3KIRPVFkx8LlbXm7vH2eYMav3rgHm5yCvKEjAG24DcUWaMlFn53KC+cZBubv1V8DA8MeJhlXoleILTKT0I7162VROktz0MUifdMEQj8t72QfCyINWgTarH39/bDFAC3e5EXm7/3t/GEOIlpzSjTo9LTDgEUzqXQrDC8uwLCe+YzI0bNTAQHdGmKp8rkChDzlYErCYzjz1RsReUFmuAY1LzVT3giutcKtGR4v5LOCl9tOasju1MGOfcazK7nMmwJ+xuvzvPdb+/tmIRve5n4C/9gjCRc/1C2Wrrz9pF2PPU88q/y2aqGqlXQaKsztLtTtz0mYjU9sGbGOeRpIh7IJdRcONmjv+CStfDRnzW59EI2OmjrSc4b8wpgN3u6YeKs5x/zclN1PzxGJYu2TbXrNMVfxXgqKtpJT5tOlT0VbVFjPHgH/exuC72EWheUSqfgpAWdRA23qs7Bj1IFw1ih9ogW40zd1p62lNH+RLqcibnghiw8fiTpQjtwfYIg2a0vUz61o1zDBFHzt/xOQTZ6GUlwuuJAhzXsC92IdtgVIxBBzV98+/Bezm9/9IeT/tmdutqQls5UOr+PLEdXqB8Dcg1hrnGjc3abnYI/hqYFYswFiTujMZB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3983.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(136003)(39860400002)(396003)(376002)(6506007)(36756003)(2616005)(6512007)(86362001)(6486002)(478600001)(69590400012)(52116002)(186003)(66556008)(30864003)(66946007)(4326008)(66476007)(6666004)(8676002)(956004)(5660300002)(83380400001)(316002)(966005)(26005)(2906002)(16526019)(8936002)(7416002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +cgggIqFexUQjphcYTBo5BR5V19XAWsGVe4OE0SREx1sNOlMNDff8k69XGkl9t2jM+FWnZLOIJXS8eUJ7iu/x74NGsnX5JH7UOTRihWz9HcpRH48ptCGLCgBX0aTDACJI7MNsa8HYrnsBD86g+MoSoaW7SmXah5jrtO/pu5897oxXB4kQYlP3rbcnbkrbUPmejOIHgsw9obW4zd1oEoI6tNTo85bxO1LW4sv7YKz5sPQYpDO3s/T815mZeoIT89lx64pTwgzOMqUQ2kLj7S3fYSXRWn5Buv3m2lY9XHtmY3F+m2iItyt742E4c9oKUcGNILK/vgFWDeFYwhFhtXJNGGsb0RlsLzkuuHBOWKiO1b8bxGXYrWJzRtRIhfLX5wQJSFyLVDvTUt/H2nkUvXjXiEfDn71w5GovcR6EOzvzEroOL69LvFLOW5mEcox6kUn3nkM58gQUaraOxBvpRvgCr/isAmf5ePCs0qVF754GQ7SvaMChquyODsd+of5dSdk4Y5p4rJbyjg+gl8vQGAeTg68dmbppX3JOUVnWc0SxB997Z/b1eFmb5WsKkwnhAKv8npqf98BrdS3ysvOFow1Vx830Mv8JjmFwLpbnGcpOTkmZiTtvLvS/Vv8Ij4/cGh528gQmndN1bzNt1PdxZMUoc5ApT1k9eC2TtlNlXypy6IN6/KEvoKX+dGGHIztjFN1gPExu0WsQ53/01qxmM52KqujWBpUQFoZ7Kjotn5CtMAEXu61xM2tR29HptHZF21akP2YM5rrtYuRMbFU/+XJciYv1g5akPRIrTbLDOZiRHJizQatYwVwLmwx6aXVxVSL992OXvVFm9zAUE6C1FL9D+kjRk1ra+jyUV9+Yzgn8kg+oyuX3K1CCT0joLgU3aO+sjdHWoFbB7po/qEbo0fDqIIDEnaH0XtF4J7TtkapcnVZF0zxfVi6juUmiE/k2jkGdTphcWb56RgDkk8Ail8lzyjbzcse7U0CibWj4xvytxQbjoxcbbtgUy5b51lMOUoDY0D7Wof8g9BvaX5BJgYmwngjGFjUdblhP+xLI3r2WQnapXKxipLP8dxXZ6qTL7zjj+YO2EJVEw9Zi2pBuWQHzW8hZmm5LYukumyUr88udy08D+NxMoEtq/3qZs/AlG6ViLvpiABWs+VnP9dHot5otmyrYAetHmE3kR0tROsLKwm2imXhpPJQMb/PDYb5I9eA7e03SFbj7WjiKOK/UCbLP20zLB31JQt782mSZiGorB39dUYGOrFEKUrjnP0RY/vDklctnEqt60bB1NrdtgawbwF5l9S5sHFCQiBGn0rSzcJYogotW/yM3XW5//TMvfc5 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18aff6ca-a6c9-4d3e-f45e-08d8e8f8cea8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 03:57:39.2216 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +R/Ko+sXzkB2JWSRzc1zNqVF3O6Sk68GOpdBbJQvaRXaGdtK4o6vgg3hlhi4JyB8G3ubmIy9+LKAJNB4gSxOEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6991 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds a drm bridge driver for i.MX8qm LVDS display bridge(LDB) which is officially named as pixel mapper. The LDB has two channels. Each of them supports up to 30bpp parallel input color format and can map the input to VESA or JEIDA standards. The two channels can be used simultaneously, either in dual mode or split mode. In dual mode, the two channels output identical data. In split mode, channel0 outputs odd pixels and channel1 outputs even pixels. This patch supports the LDB single mode and split mode. Signed-off-by: Liu Ying --- Note that this patch depends on the patch 'phy: Add LVDS configuration options', which has already been sent with the following series to add Mixel combo PHY found in i.MX8qxp: https://www.spinics.net/lists/arm-kernel/msg879957.html v5->v6: * No change. v4->v5: * Link with the imx-ldb-helper object. (Robert) * Correspondingly, rename 'imx8qm-ldb.c' to 'imx8qm-ldb-drv.c'. v3->v4: * No change. v2->v3: * No change. v1->v2: * Drop unnecessary check for maximum available LDB channels. * Mention i.MX8qm LDB official name 'pixel mapper' in the bridge driver and Kconfig help message. drivers/gpu/drm/bridge/imx/Kconfig | 9 + drivers/gpu/drm/bridge/imx/Makefile | 3 + drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c | 586 ++++++++++++++++++++++++++++ 3 files changed, 598 insertions(+) create mode 100644 drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig index 94f8db4d..3a8683f 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -1,3 +1,12 @@ +config DRM_IMX8QM_LDB + tristate "Freescale i.MX8QM LVDS display bridge" + depends on OF + depends on COMMON_CLK + select DRM_KMS_HELPER + help + Choose this to enable the internal LVDS Display Bridge(LDB) found in + Freescale i.MX8qm processor. Official name of LDB is pixel mapper. + config DRM_IMX8QXP_LDB tristate "Freescale i.MX8QXP LVDS display bridge" depends on OF diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile index 96d5d1e..aa90ec8 100644 --- a/drivers/gpu/drm/bridge/imx/Makefile +++ b/drivers/gpu/drm/bridge/imx/Makefile @@ -1,3 +1,6 @@ +imx8qm-ldb-objs := imx-ldb-helper.o imx8qm-ldb-drv.o +obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o + imx8qxp-ldb-objs := imx-ldb-helper.o imx8qxp-ldb-drv.o obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o diff --git a/drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c b/drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c new file mode 100644 index 00000000..6c92636 --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c @@ -0,0 +1,586 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * Copyright 2020 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "imx-ldb-helper.h" + +#define LDB_CH0_10BIT_EN (1 << 22) +#define LDB_CH1_10BIT_EN (1 << 23) +#define LDB_CH0_DATA_WIDTH_24BIT (1 << 24) +#define LDB_CH1_DATA_WIDTH_24BIT (1 << 26) +#define LDB_CH0_DATA_WIDTH_30BIT (2 << 24) +#define LDB_CH1_DATA_WIDTH_30BIT (2 << 26) + +#define SS_CTRL 0x20 +#define CH_HSYNC_M(id) BIT(0 + ((id) * 2)) +#define CH_VSYNC_M(id) BIT(1 + ((id) * 2)) +#define CH_PHSYNC(id) BIT(0 + ((id) * 2)) +#define CH_PVSYNC(id) BIT(1 + ((id) * 2)) + +#define DRIVER_NAME "imx8qm-ldb" + +struct imx8qm_ldb_channel { + struct ldb_channel base; + struct phy *phy; +}; + +struct imx8qm_ldb { + struct ldb base; + struct device *dev; + struct imx8qm_ldb_channel channel[MAX_LDB_CHAN_NUM]; + struct clk *clk_pixel; + struct clk *clk_bypass; + int active_chno; +}; + +static inline struct imx8qm_ldb_channel * +base_to_imx8qm_ldb_channel(struct ldb_channel *base) +{ + return container_of(base, struct imx8qm_ldb_channel, base); +} + +static inline struct imx8qm_ldb *base_to_imx8qm_ldb(struct ldb *base) +{ + return container_of(base, struct imx8qm_ldb, base); +} + +static void imx8qm_ldb_set_phy_cfg(struct imx8qm_ldb *imx8qm_ldb, + unsigned long di_clk, + bool is_split, bool is_slave, + struct phy_configure_opts_lvds *phy_cfg) +{ + phy_cfg->bits_per_lane_and_dclk_cycle = 7; + phy_cfg->lanes = 4; + phy_cfg->differential_clk_rate = is_split ? di_clk / 2 : di_clk; + phy_cfg->is_slave = is_slave; +} + +static int imx8qm_ldb_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + struct ldb *ldb = ldb_ch->ldb; + struct imx8qm_ldb_channel *imx8qm_ldb_ch = + base_to_imx8qm_ldb_channel(ldb_ch); + struct imx8qm_ldb *imx8qm_ldb = base_to_imx8qm_ldb(ldb); + struct drm_display_mode *adj = &crtc_state->adjusted_mode; + unsigned long di_clk = adj->clock * 1000; + bool is_split = ldb_channel_is_split_link(ldb_ch); + union phy_configure_opts opts = { }; + struct phy_configure_opts_lvds *phy_cfg = &opts.lvds; + int ret; + + ret = ldb_bridge_atomic_check_helper(bridge, bridge_state, + crtc_state, conn_state); + if (ret) + return ret; + + imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, false, phy_cfg); + ret = phy_validate(imx8qm_ldb_ch->phy, PHY_MODE_LVDS, 0, &opts); + if (ret < 0) { + DRM_DEV_DEBUG_DRIVER(imx8qm_ldb->dev, + "failed to validate PHY: %d\n", ret); + return ret; + } + + if (is_split) { + imx8qm_ldb_ch = + &imx8qm_ldb->channel[imx8qm_ldb->active_chno ^ 1]; + imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, true, + phy_cfg); + ret = phy_validate(imx8qm_ldb_ch->phy, PHY_MODE_LVDS, 0, &opts); + if (ret < 0) { + DRM_DEV_DEBUG_DRIVER(imx8qm_ldb->dev, + "failed to validate slave PHY: %d\n", ret); + return ret; + } + } + + return ret; +} + +static void +imx8qm_ldb_bridge_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + struct ldb *ldb = ldb_ch->ldb; + struct imx8qm_ldb_channel *imx8qm_ldb_ch = + base_to_imx8qm_ldb_channel(ldb_ch); + struct imx8qm_ldb *imx8qm_ldb = base_to_imx8qm_ldb(ldb); + struct device *dev = imx8qm_ldb->dev; + unsigned long di_clk = adjusted_mode->clock * 1000; + bool is_split = ldb_channel_is_split_link(ldb_ch); + union phy_configure_opts opts = { }; + struct phy_configure_opts_lvds *phy_cfg = &opts.lvds; + u32 chno = ldb_ch->chno; + int ret; + + ret = pm_runtime_get_sync(dev); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to get runtime PM sync: %d\n", ret); + + ret = phy_init(imx8qm_ldb_ch->phy); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to initialize PHY: %d\n", ret); + + clk_set_rate(imx8qm_ldb->clk_bypass, di_clk); + clk_set_rate(imx8qm_ldb->clk_pixel, di_clk); + + imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, false, phy_cfg); + ret = phy_configure(imx8qm_ldb_ch->phy, &opts); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to configure PHY: %d\n", ret); + + if (is_split) { + imx8qm_ldb_ch = + &imx8qm_ldb->channel[imx8qm_ldb->active_chno ^ 1]; + imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, true, + phy_cfg); + ret = phy_configure(imx8qm_ldb_ch->phy, &opts); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to configure slave PHY: %d\n", + ret); + } + + /* input VSYNC signal from pixel link is active low */ + if (ldb_ch->chno == 0 || is_split) + ldb->ldb_ctrl |= LDB_DI0_VS_POL_ACT_LOW; + if (ldb_ch->chno == 1 || is_split) + ldb->ldb_ctrl |= LDB_DI1_VS_POL_ACT_LOW; + + switch (ldb_ch->out_bus_format) { + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG: + break; + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA: + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG: + if (ldb_ch->chno == 0 || is_split) + ldb->ldb_ctrl |= LDB_CH0_DATA_WIDTH_24BIT; + if (ldb_ch->chno == 1 || is_split) + ldb->ldb_ctrl |= LDB_CH1_DATA_WIDTH_24BIT; + break; + } + + ldb_bridge_mode_set_helper(bridge, mode, adjusted_mode); + + if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) + regmap_update_bits(ldb->regmap, SS_CTRL, CH_VSYNC_M(chno), 0); + else if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) + regmap_update_bits(ldb->regmap, SS_CTRL, + CH_VSYNC_M(chno), CH_PVSYNC(chno)); + + if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) + regmap_update_bits(ldb->regmap, SS_CTRL, CH_HSYNC_M(chno), 0); + else if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) + regmap_update_bits(ldb->regmap, SS_CTRL, + CH_HSYNC_M(chno), CH_PHSYNC(chno)); +} + +static void +imx8qm_ldb_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + struct ldb *ldb = ldb_ch->ldb; + struct imx8qm_ldb_channel *imx8qm_ldb_ch = + base_to_imx8qm_ldb_channel(ldb_ch); + struct imx8qm_ldb *imx8qm_ldb = base_to_imx8qm_ldb(ldb); + struct device *dev = imx8qm_ldb->dev; + bool is_split = ldb_channel_is_split_link(ldb_ch); + int ret; + + clk_prepare_enable(imx8qm_ldb->clk_pixel); + clk_prepare_enable(imx8qm_ldb->clk_bypass); + + /* both DI0 and DI1 connect with pixel link, so ok to use DI0 only */ + if (ldb_ch->chno == 0 || is_split) { + ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; + ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI0; + } + if (ldb_ch->chno == 1 || is_split) { + ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; + ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI0; + } + + if (is_split) { + ret = phy_power_on(imx8qm_ldb->channel[0].phy); + if (ret) + DRM_DEV_ERROR(dev, + "failed to power on channel0 PHY: %d\n", + ret); + + ret = phy_power_on(imx8qm_ldb->channel[1].phy); + if (ret) + DRM_DEV_ERROR(dev, + "failed to power on channel1 PHY: %d\n", + ret); + } else { + ret = phy_power_on(imx8qm_ldb_ch->phy); + if (ret) + DRM_DEV_ERROR(dev, "failed to power on PHY: %d\n", ret); + } + + ldb_bridge_enable_helper(bridge); +} + +static void +imx8qm_ldb_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + struct ldb *ldb = ldb_ch->ldb; + struct imx8qm_ldb_channel *imx8qm_ldb_ch = + base_to_imx8qm_ldb_channel(ldb_ch); + struct imx8qm_ldb *imx8qm_ldb = base_to_imx8qm_ldb(ldb); + struct device *dev = imx8qm_ldb->dev; + bool is_split = ldb_channel_is_split_link(ldb_ch); + int ret; + + ldb_bridge_disable_helper(bridge); + + if (is_split) { + ret = phy_power_off(imx8qm_ldb->channel[0].phy); + if (ret) + DRM_DEV_ERROR(dev, + "failed to power off channel0 PHY: %d\n", + ret); + ret = phy_power_off(imx8qm_ldb->channel[1].phy); + if (ret) + DRM_DEV_ERROR(dev, + "failed to power off channel1 PHY: %d\n", + ret); + } else { + ret = phy_power_off(imx8qm_ldb_ch->phy); + if (ret) + DRM_DEV_ERROR(dev, "failed to power off PHY: %d\n", ret); + } + + clk_disable_unprepare(imx8qm_ldb->clk_bypass); + clk_disable_unprepare(imx8qm_ldb->clk_pixel); + + ret = pm_runtime_put(dev); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to put runtime PM: %d\n", ret); +} + +static const u32 imx8qm_ldb_bus_output_fmts[] = { + MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, + MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, + MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, + MEDIA_BUS_FMT_FIXED, +}; + +static bool imx8qm_ldb_bus_output_fmt_supported(u32 fmt) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(imx8qm_ldb_bus_output_fmts); i++) { + if (imx8qm_ldb_bus_output_fmts[i] == fmt) + return true; + } + + return false; +} + +static u32 * +imx8qm_ldb_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + struct drm_display_info *di; + const struct drm_format_info *finfo; + u32 *input_fmts; + + if (!imx8qm_ldb_bus_output_fmt_supported(output_fmt)) + return NULL; + + *num_input_fmts = 1; + + input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + + switch (output_fmt) { + case MEDIA_BUS_FMT_FIXED: + di = &conn_state->connector->display_info; + + /* + * Look at the first bus format to determine input format. + * Default to MEDIA_BUS_FMT_RGB888_1X36_CPADLO, if no match. + */ + if (di->num_bus_formats) { + finfo = drm_format_info(di->bus_formats[0]); + + input_fmts[0] = finfo->depth == 18 ? + MEDIA_BUS_FMT_RGB666_1X36_CPADLO : + MEDIA_BUS_FMT_RGB888_1X36_CPADLO; + } else { + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X36_CPADLO; + } + break; + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG: + input_fmts[0] = MEDIA_BUS_FMT_RGB666_1X36_CPADLO; + break; + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG: + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA: + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X36_CPADLO; + break; + default: + kfree(input_fmts); + input_fmts = NULL; + break; + } + + return input_fmts; +} + +static u32 * +imx8qm_ldb_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + unsigned int *num_output_fmts) +{ + *num_output_fmts = ARRAY_SIZE(imx8qm_ldb_bus_output_fmts); + return kmemdup(imx8qm_ldb_bus_output_fmts, + sizeof(imx8qm_ldb_bus_output_fmts), GFP_KERNEL); +} + +static enum drm_mode_status +imx8qm_ldb_bridge_mode_valid(struct drm_bridge *bridge, + const struct drm_display_info *info, + const struct drm_display_mode *mode) +{ + struct ldb_channel *ldb_ch = bridge->driver_private; + bool is_single = ldb_channel_is_single_link(ldb_ch); + + if (mode->clock > 300000) + return MODE_CLOCK_HIGH; + + if (mode->clock > 150000 && is_single) + return MODE_CLOCK_HIGH; + + return MODE_OK; +} + +static const struct drm_bridge_funcs imx8qm_ldb_bridge_funcs = { + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + .mode_valid = imx8qm_ldb_bridge_mode_valid, + .attach = ldb_bridge_attach_helper, + .atomic_check = imx8qm_ldb_bridge_atomic_check, + .mode_set = imx8qm_ldb_bridge_mode_set, + .atomic_enable = imx8qm_ldb_bridge_atomic_enable, + .atomic_disable = imx8qm_ldb_bridge_atomic_disable, + .atomic_get_input_bus_fmts = + imx8qm_ldb_bridge_atomic_get_input_bus_fmts, + .atomic_get_output_bus_fmts = + imx8qm_ldb_bridge_atomic_get_output_bus_fmts, +}; + +static int imx8qm_ldb_get_phy(struct imx8qm_ldb *imx8qm_ldb) +{ + struct imx8qm_ldb_channel *imx8qm_ldb_ch; + struct ldb_channel *ldb_ch; + struct device *dev = imx8qm_ldb->dev; + int i, ret; + + for (i = 0; i < MAX_LDB_CHAN_NUM; i++) { + imx8qm_ldb_ch = &imx8qm_ldb->channel[i]; + ldb_ch = &imx8qm_ldb_ch->base; + + if (!ldb_ch->is_available) + continue; + + imx8qm_ldb_ch->phy = devm_of_phy_get(dev, ldb_ch->np, + "lvds_phy"); + if (IS_ERR(imx8qm_ldb_ch->phy)) { + ret = PTR_ERR(imx8qm_ldb_ch->phy); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, + "failed to get channel%d PHY: %d\n", + i, ret); + return ret; + } + } + + return 0; +} + +static int imx8qm_ldb_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct imx8qm_ldb *imx8qm_ldb; + struct imx8qm_ldb_channel *imx8qm_ldb_ch; + struct ldb *ldb; + struct ldb_channel *ldb_ch; + struct device_node *port1, *port2; + int pixel_order; + int ret, i; + + imx8qm_ldb = devm_kzalloc(dev, sizeof(*imx8qm_ldb), GFP_KERNEL); + if (!imx8qm_ldb) + return -ENOMEM; + + imx8qm_ldb->clk_pixel = devm_clk_get(dev, "pixel"); + if (IS_ERR(imx8qm_ldb->clk_pixel)) { + ret = PTR_ERR(imx8qm_ldb->clk_pixel); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, + "failed to get pixel clock: %d\n", ret); + return ret; + } + + imx8qm_ldb->clk_bypass = devm_clk_get(dev, "bypass"); + if (IS_ERR(imx8qm_ldb->clk_bypass)) { + ret = PTR_ERR(imx8qm_ldb->clk_bypass); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, + "failed to get bypass clock: %d\n", ret); + return ret; + } + + imx8qm_ldb->dev = dev; + + ldb = &imx8qm_ldb->base; + ldb->dev = dev; + ldb->ctrl_reg = 0xe0; + + for (i = 0; i < MAX_LDB_CHAN_NUM; i++) + ldb->channel[i] = &imx8qm_ldb->channel[i].base; + + ret = ldb_init_helper(ldb); + if (ret) + return ret; + + if (ldb->available_ch_cnt == 0) { + DRM_DEV_DEBUG_DRIVER(dev, "no available channel\n"); + return 0; + } + + if (ldb->available_ch_cnt == 2) { + port1 = of_graph_get_port_by_id(ldb->channel[0]->np, 1); + port2 = of_graph_get_port_by_id(ldb->channel[1]->np, 1); + pixel_order = + drm_of_lvds_get_dual_link_pixel_order(port1, port2); + of_node_put(port1); + of_node_put(port2); + + if (pixel_order != DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS) { + DRM_DEV_ERROR(dev, "invalid dual link pixel order: %d\n", + pixel_order); + return -EINVAL; + } + + imx8qm_ldb->active_chno = 0; + imx8qm_ldb_ch = &imx8qm_ldb->channel[0]; + ldb_ch = &imx8qm_ldb_ch->base; + ldb_ch->link_type = pixel_order; + } else { + for (i = 0; i < MAX_LDB_CHAN_NUM; i++) { + imx8qm_ldb_ch = &imx8qm_ldb->channel[i]; + ldb_ch = &imx8qm_ldb_ch->base; + + if (ldb_ch->is_available) { + imx8qm_ldb->active_chno = ldb_ch->chno; + break; + } + } + } + + ret = imx8qm_ldb_get_phy(imx8qm_ldb); + if (ret) + return ret; + + ret = ldb_find_next_bridge_helper(ldb); + if (ret) + return ret; + + platform_set_drvdata(pdev, imx8qm_ldb); + pm_runtime_enable(dev); + + ldb_add_bridge_helper(ldb, &imx8qm_ldb_bridge_funcs); + + return ret; +} + +static int imx8qm_ldb_remove(struct platform_device *pdev) +{ + struct imx8qm_ldb *imx8qm_ldb = platform_get_drvdata(pdev); + struct ldb *ldb = &imx8qm_ldb->base; + + ldb_remove_bridge_helper(ldb); + + pm_runtime_disable(&pdev->dev); + + return 0; +} + +static int __maybe_unused imx8qm_ldb_runtime_suspend(struct device *dev) +{ + return 0; +} + +static int __maybe_unused imx8qm_ldb_runtime_resume(struct device *dev) +{ + struct imx8qm_ldb *imx8qm_ldb = dev_get_drvdata(dev); + struct ldb *ldb = &imx8qm_ldb->base; + + /* disable LDB by resetting the control register to POR default */ + regmap_write(ldb->regmap, ldb->ctrl_reg, 0); + + return 0; +} + +static const struct dev_pm_ops imx8qm_ldb_pm_ops = { + SET_RUNTIME_PM_OPS(imx8qm_ldb_runtime_suspend, + imx8qm_ldb_runtime_resume, NULL) +}; + +static const struct of_device_id imx8qm_ldb_dt_ids[] = { + { .compatible = "fsl,imx8qm-ldb" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx8qm_ldb_dt_ids); + +static struct platform_driver imx8qm_ldb_driver = { + .probe = imx8qm_ldb_probe, + .remove = imx8qm_ldb_remove, + .driver = { + .pm = &imx8qm_ldb_pm_ops, + .name = DRIVER_NAME, + .of_match_table = imx8qm_ldb_dt_ids, + }, +}; +module_platform_driver(imx8qm_ldb_driver); + +MODULE_DESCRIPTION("i.MX8QM LVDS Display Bridge(LDB)/Pixel Mapper bridge driver"); +MODULE_AUTHOR("Liu Ying "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRIVER_NAME);