From patchwork Thu Jun 9 06:49:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 581002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00128C43334 for ; Thu, 9 Jun 2022 06:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239077AbiFIGsT (ORCPT ); Thu, 9 Jun 2022 02:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239213AbiFIGsR (ORCPT ); Thu, 9 Jun 2022 02:48:17 -0400 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50051.outbound.protection.outlook.com [40.107.5.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EA044B401; Wed, 8 Jun 2022 23:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cwOxPFB1WqZBk+g0nqRScO0aJEsiUkmMbh4WZNmgJR4qJya4oLuHaMW0g4L5cVgFvRw9HzKUY5lpwB/u4OC3KIIGlgnZ07IB2NC54kE2gmMaxbym0zUY/UxeCQfh7jWpJV7k0k9uSU/fX/qqJDU+pU1YgMc0nWFA3v1SC90XxMsGzxo3YNMbEB1Hzt5FqqqEab3ObibuhvkgENmrX6YJpBWxmDWSE8nNty/9XWB+OTtq4FY7OeLA79r3AOco3/FzIZvp2V5UlomMn6Qy8Q7qtm7GW1Mgklu+iDN2bmHSOFWllUce1p0ychpiF/oWkVsPVShXtwpK4bFjxaumquxGtA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PGMCFkE5UKzvfv/uX2zuCd//zUK1ZgRhdIRETpeS6yA=; b=fdTpnr3q9f6xTk4Y93u1ZXsWwaMenpFtHcxqj5du2NNTZIWUGaetYvdFoBh1m4KCicN5Y6ty1JRCyNCney+MOzxjGpkoTMceC+ZLCWaPXf9u/Srl+DKgqcO6EI6kYn4lYgsUUi0SHH2j3Q/3GH9gQO/JUsnVXqj/ivBKwBSb+ry5bapYJtQEtJFWKf8zwtDnv+9MWBY0wAN80hj2VDuiySZemRgoL+ulQvPQAGTHKCICojG1dzFEr5C+PBwAQ/l+ZFEMOtU6RaQTL+6DKWDEi1CIzK5mK40875RKi5C9Xgt5Y55oOYRr30s02eWdqZ8RpNU6ZvsHn83+XS77IpMgJg== 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=PGMCFkE5UKzvfv/uX2zuCd//zUK1ZgRhdIRETpeS6yA=; b=NZIskhGtBQd+OKuQJDoLUEAnRkpyLOD7A+0zjv8zLoeL0jZM+5ljWAwYAT+VAT5hJtgbSxGLZIJl7D6RPbubTQiGGBf1x80W9fJpOkFvlp5KxByoNH+AFBlPd5BdaSrWDdVJAwdgIQTy/GQuxdji/MKz4YMLwoxb0QEVep75+wA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by VI1PR04MB5280.eurprd04.prod.outlook.com (2603:10a6:803:5f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Thu, 9 Jun 2022 06:48:11 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502%7]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 06:48:10 +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: andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, lee.jones@linaro.org, mchehab@kernel.org, marcel.ziswiler@toradex.com, Laurent Pinchart Subject: [PATCH v8 01/14] media: uapi: Add some RGB bus formats for i.MX8qm/qxp pixel combiner Date: Thu, 9 Jun 2022 14:49:18 +0800 Message-Id: <20220609064931.3068601-2-victor.liu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609064931.3068601-1-victor.liu@nxp.com> References: <20220609064931.3068601-1-victor.liu@nxp.com> X-ClientProxiedBy: SGXP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1cc8759b-a47a-4283-b9f2-08da49e404ad X-MS-TrafficTypeDiagnostic: VI1PR04MB5280:EE_ X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aAy8HmCaLfIccdExDroJDY5TQ5WI14LX6R+qcHnB6l3gfUl/yiamdTJ6jKf4nbWX5mTnOX2dP4fFbqtrCx3w56SN39zGlipxjr0ZxrPPO6r2fuNqxOm0ua9nejLDKhedDst5P/cj8ULBt59bkY7Q8s12xLkIg5U3WGpmewKdONH6QFXZhSDFJvhrZQ0fLP2b+PoeanENJTqh8jGxUmOzqQEm0NBxGRbWiLBBnyhi2wXez8BCK16NiqbCDG5PZ/lhsrqPoNIooEv7rQ5NrVUDMzjCpQtjno85JW94m6ccLzJ3VJX5PxH1LMMzS/yXch5yl6qyET5tx/fHnTnGo4q7wtUwrjaVKugUzez5yQ9p4YzLpCt1YqAfRulScNTenl7MZwZe1ETDJMDUiOEACBSuqVE1NvVi1Z63jrFTcrLyeEoDclsJk554fRi21DVUnmwcs7K2FDrOZYYPFEZmHo4jRr0jH45WdPIFajzAFOcDnmUlk60A/K9wLGgsZD6Ap0wtNRsRPUETrCswDsWnPFO3KcBliCxqhcGHp/JPjUw7L0XpABU4NYM/nQZvXmXJ+Ix3EJiCzh6G+06tTOJE0+EsGhl3mE/oR0inpCpPwVy9bnD2cgR7ybRIP1KvtMXLZennQUFkI6drUNSsl8wM4N8RpvTX9M1eoU0gKN1nD5uOQZYSCK/Fe4rVs+CMzJopF1b73BGlPYsZe7ax8TIQQSUsNg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(1076003)(186003)(83380400001)(38350700002)(38100700002)(6506007)(36756003)(2906002)(52116002)(316002)(6512007)(508600001)(66946007)(6486002)(2616005)(66476007)(66556008)(8676002)(4326008)(7416002)(5660300002)(8936002)(86362001)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F303XoTCpfXJ4SFFzJWBqMorokBmVlFEmQGEcPd4BVjMB9fq64pOzAd2BtPlsm4jKBhUMtVPEwpoU/blV5dvNOWEu5p8MsAITHlN7za407zjxcI0SFnOVSV1EmnuCj+JPJxw68HwH4YVsBfF6qOuLwDzB1ZCcGt1/5Ajc0Ru13opMV1QAaUeGxm2HjMbDyYlv4UBuexFFsK+zTyvEO2OG6ovGmSGCiijXzBeduUXkfFts6GNcEs0Zh4JgJXmg/PdWl2VqGbCmfMksI9uk5ZLAsKHrVqg0kxMlUyQHc/2Q+4k5zDKZTOq5bV73JF7HhqCSSWs1W48PL1bsHVQ/JtJnoEY4cs2SDNdfUNgC7qKe9MNJCfIpRm8XYGW0dgZp85aiMUZczf5NsaOxhWrYlK8k7OY5ZEQzIEtrE0PhzS8rcXnpyymXCVpHuRRmgksVrkoerE2QjUzePrUxOsAG6OKi4vcg+1bGQWEkfrHmdwIFs7w8tdCsrCyBHVQp/z2rXLzit9k0cpJW6XyREja0tQrzVFduWXiY3VOHxEZDvUHZUtULKgEc46gn6WY0MqT8Hy4xLUAMyx4AGeBARs+RDaMbfpumGAi3RUYe7kaSE/efvdO9RNnIoklVIsvFqUHqXpN3oh5nuqIEB47rqwwjXuGl3WTD6fL7f4yL2jWH3BLQiPtwO8V9SdmYulbUi3ykKlb/LqsHS+eLinJ/VB/mI9vSftTFfQAFFtHkMGmYywiOmB4e+/9fvOlGhsGvpfRmX8yqRtWTaRDf0b592T2cZRisBgozobATjFaRSW8Gzy6dOHhpBk01PYNrR1sDkw3s/YfCFq5MarXWITvRCuYQD20x5S/zqm9WtqyyPUgZkPzvQyog0cH0J4te5fYejzBjXVBu7CunuMioPbDlX33qs3raP7Jks2Si07VWDbBoWFGcd+gnCXSNtpPuD7FMTm9HPz0yoQZLe18wNZN86kOlAymgVoBR5GBd9w6EXY4lw8bG/aYsxUx5dg286miLW5j7tWx3VqlJNCWJlkF2En2POyVI7oDV5RSs9RhB6bXKCm1chKLkgW/O7IzIp5+/A9wfA6LfHsogADrVtGTIXq4HqkL+v9OHfS6+A2hQIGXFuH66OS/kczRbDjcE4AidespEKlfQ+JWJ7K83J0Tthvi8qF9MNMFLoWfpKT257vZ73kIHzOz3N7+FZ2qAdJEb7hV/3ln0lcoRreh5KCngLRFL/uJk2DLkvvddaoQqhhD4Ewd0oIf+g5XvQFxE4HR9U4Vd/uBpvKu3i6HqGf9pqAFcah5MN+M4OAx2iXBtwagFbTZnWMR/Cz2zKn59QvDOWkWFVwFFBz/RzisfYXpUGfhDPk7ksecFHgBpt4TiWShYnfvXFZ1qaqGF9qDcgMpzd/XlUQpx9apJwierw+L0gajq2jaVzfWrbHStVTqcpl6OiWGLVhj2BPJldiQmEazsiEftMqB/Lwiwfz0i/Jn2nrEr8Gp7vlI/fBjHKJMM/4uXQs0d9qzkGKg4Am8Ox1jQic3XHf/BwTc9BucFeQZAVPu/3gOUve93FiV5233I8iMRHY2SifO9gyUsAcBiiFpDCwGHCSH8HLWoNQRCXQ8pzccRr0IcuqWl9xoxCs22wPjikdIqefB28gl4X4yUWS7s95ENwtClbz7Cu/CTMiOaM4Izln36qVpzd/oA86QmA5uJwwojDMQB7ZcRZ7dtzCQJfAwfi07CxhWAZkQ9LZAHpAip9SuFw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1cc8759b-a47a-4283-b9f2-08da49e404ad X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 06:48:10.8711 (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: mdiOHjGOqTcojznuYaYeTLJzy45JsEs93apyX71SZmWFtZpG4lzTm8n/I/yrdKohk7AeGB9hnLn119SctWhJ9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5280 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 --- v7->v8: * No change. v6->v7: * No change. 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 0dfc11ee243a..ec3323dbb927 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 Thu Jun 9 06:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 581001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60863C433EF for ; Thu, 9 Jun 2022 06:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239270AbiFIGsi (ORCPT ); Thu, 9 Jun 2022 02:48:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239251AbiFIGs3 (ORCPT ); Thu, 9 Jun 2022 02:48:29 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A397D31926; Wed, 8 Jun 2022 23:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nx+DOBqIMWHPOOnFFFvhuxhKwZQM2GS93OL0pdlOUm9IxI1lYKwWqW2LvFKBeyo51LVthnHOJV4TK8sTm6tErofU2JmlS11VW2hBNbV/IsUuc5ttC+zL3m0kxbBixkrJOzPjF55f54rzhVqgRCJnmFs3Lhe325Hvyp4AqresPjhcyR2yyFHCuh47JIy8G95yYllgmkX1W5/umI8q35YUmPaA9qOBAPam4FPPqiT+jIGtPnRrnOxgVKMHY+X3ZeXXMwbxROlmJuMMbILcBLVVZU0HjCMDS28UJG7g8c+5Sqbxz4PzbgT2I2t8rxEjEny06n5Za08Qk9GclnVZA2waOA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UrTNgj5phonT7Nomc4yB72k4kK6HzUGQNz+O9z91N5U=; b=KJ6CPfVWZIz6btzPft1zpN7ZXFEf7DPYSXp627X1pcf0nvD+MqL4EhRaBsrPn7fR7zjqFtNfplVzZqQNIkwy0bbablfXAOw25sT56pI7EHk7KuwCPu48Xw1ODCcTrasw/cg5s3ii63YfO94/cprazqFHaRrx3wY88ZGDCDZmmkq0GpdiSnDwUTmAvhW+H7lXtIUy6AQGVtAEl3jqugGsLO24NFtLmV2AF8mxwfFssSG/PtPyEy0M8CaC5XRKAF01C+ZcegsL0Q6jlTQGe8akk5H9a5CNjAU2MCJeBDSLx7nppklhC2MFjoQo3YKDBB19Ep6r2V3H9w3O/YSmZ9xRqg== 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=UrTNgj5phonT7Nomc4yB72k4kK6HzUGQNz+O9z91N5U=; b=ectPYDo9aSWKbzxlb7BLtOipAfD1bx/z2+aGFaOMO0pvnMMsJ5Yrh4eAtvpegkWMov8inzOuXYmORx25FvdZTWQef63pxqeUhnICGRREYzN8bIlWsnv8lmVGm5MwD5xh4pIKrUbcAR8GIuvBmvP6ipLDXb9VeaKaS6pHBBvIxs0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by VI1PR0402MB3518.eurprd04.prod.outlook.com (2603:10a6:803:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Thu, 9 Jun 2022 06:48:25 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502%7]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 06:48:25 +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: andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, lee.jones@linaro.org, mchehab@kernel.org, marcel.ziswiler@toradex.com, Rob Herring Subject: [PATCH v8 03/14] dt-bindings: display: bridge: Add i.MX8qm/qxp pixel combiner binding Date: Thu, 9 Jun 2022 14:49:20 +0800 Message-Id: <20220609064931.3068601-4-victor.liu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609064931.3068601-1-victor.liu@nxp.com> References: <20220609064931.3068601-1-victor.liu@nxp.com> X-ClientProxiedBy: SGXP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dee1d790-f178-424c-68ed-08da49e40d19 X-MS-TrafficTypeDiagnostic: VI1PR0402MB3518:EE_ X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BQRp4Dmb1rmVnUlLRJmirvCDRY0AVZ0WBKqKbkD11SbY0vXm3vXPlNgfksMXVSBlUE6BZgBTWgsbKYVwS31qdwXnLdGwCN0fNoqD+akMTkZAeXPnMyCA+pOEa9cpQz+jnmodeYQzWnLsZkvq/cOsQcJHuNJJVKmdChOYxlMjsPO+T7Zp0pAOaYbA8qdvjGr1Rf++C8qx5hFMCumdReZc9Fc6E1Wm9NTdcokU1UMF1lX2v6dSIOEATJyDhZdBwK0nCKobdouge/vSHUkZ6GLr2oIK4f+3mzvNL46ZFJKm4jGYTAbIQgZQ0xv9/bUUWCd9f3HATM+VnYah7jilfvvB1ahmkIjqrsi7NU/shjLLnu/l99a71Uazix4yX9G82cC5ru7f/Qa2weLyXPCw9LyenPh9WwrLZ2LQ1efRNTlpEvFk6xBcrCOv4S+oo7IBJmv3sPGc0lRssz78HJ2D10FCWBDOiTiDerkoT8xEu0xlWiJGH3XeoTVaZ8IOH4Fpf3b6whZ2AsW8YcWoHSaI+Kk2YDMLY4VEKa+iHUiV0Afw+XMhj9iUFLXHu87N+xjrb5INs5yBn4ArGe9fqE9OGdkMGyjeP4DdPNnsTE5x/hZDlkQzlIsJzm3E3PXUyC09JuVVowEg+SG7KZMFwKY53E2U8z0FHqDcBp+P2fbCaTCXRqdo8n1LR4MyYon74iCh+5nwXnFtvuPDfDhSTjOKsfbMpr8/86P8jr0AFS4mFRRcrqciFHi6IgCkiw8d906uDYwQYnxWCoAl6RrLmBU8LH4CbcXAM0k/FCa3oISbpDuWg7Nepa770JZ70UaufELv5Owo1eiyz0EVdA9OmQqTU+1Hzw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(4326008)(66476007)(508600001)(86362001)(5660300002)(8936002)(66946007)(7416002)(8676002)(52116002)(6506007)(66556008)(2906002)(6666004)(186003)(26005)(38100700002)(966005)(38350700002)(2616005)(316002)(36756003)(1076003)(6512007)(83380400001)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QpGcd9h+RG2OAvdiO/tkG1HElduOEyOL3YmtfW87d9Ln83J/AovgB+TdEeOgxy9tOZNaSYBbrZ9h07geAl6yCA4k9x9pv94pkZ7cauteP5ShmLJvcPFze6zEZZ+re2blmQjI8lsPKpEr9sx61JjFGghUAeSjbkH+It0TawcXu6NRXmxGKCFR5tlZHJjFw1zY5lFwLoChho+I7tjlGJXEsvOizg/YFTg4/3hVoP/0wZYQ4C0T+pZK7NPc6fP9YAhG1mAvxFB/pbjKgRVTBtnT3bs42C4C4SQiha3gC3QYjyP2UC+68dIZV5IR0M2JUas550V1P/2JOj8Hhc/jmiNQ6AcSejVaMKhYV49iSQ35cWwTn9v8sIphx9YkoRMkEhy91B6EhFBvwdghQTlbgVuGJR4LdFf7z0bhRVgqSe49kNcefjdodi7HKEJr8L/vzr4hJoo3XCedqsZsoXFiQ9q0wRVGHOMCLeuGP2rKYyRxPeMnIasUzG1KZt62pPzobBxIUcjbh1RmwhqmE0qzuHTYok9lY6P95THyj/WatZkMwNmyYv+oY6WL97GJGxuJ1xQConwJfvBioh08e1o8ubctQVkrH0x3CoCvcZEU/ImAa6PiuF/SEuwzeNgdIGeET/VChlVhft6F3lyzUXZsDGXvOrlMZVtzENXxTupYXZKsB8fiC+zKccfLf9HGIXChfAbD0MsCaeHdIWcrrYFWP65HJ4p4R3t6eDPxY8RR+dp48XJ6nDqsJVcNBjlwEdsZXxRjzXqD81qMWPDNCwzQjI2z3tWyivEqyfGdMcDxGBauH3duNGZpzck8Vhh3GxEWP0Q5uy0yqlul+TCWY07udwcS2ff39CURMGCU/S4dNbGftxW4ollQAQRVY9Z0MfqgQC272PSc3Is7hpHOcn0Yv+1jQ5ZHT8LXxwL9uzOvXejswf040fTRYVIm8M2lEMdZN1eqni5GgoS8mQnwtQIdD6PkknaLwuKQMWIa+6PS356bjBc46/NzIMdWqCwZxFqDPcsaF91cTItiu33X02hwqsuArVY2jk4czTTBKcdOuoDJZkSACXpfEr+FaPA3d2eWM8ESV/2tnb1VmtvzepdaGqrPFAx/sOpeBFrzmTpP5x46mz2FXAFKfXAp/MWGTWH4aygxJD9KgGnPAutUmf2Izlgh/9efPBfRbXhdq35uMPFsupq/mNRadCDW859h9iIjr8SdT10Fk5ZDfd6wfqDBg/6/5cQtFXQB5uxugr2UItnTX8YHYTh5JTqaBCJQuIxbm9mwwq6fsdMTl0SuwJaK27Lh5I/56UCULjAl40qLNY+XUBp+cQtqTqyCB5AFsrDTnvuq1VgCxoNXyNTulhxoOaWcsYOn4zTEfNb1MuXGFyCOhCfUB2Nv1YKpPw3igEMzKFntCl7cQVXzCX8OeC4t9aU4oD0zCClbluPl86HhOYd+df4c7bhOo9bXy881mDiPAoSYgh8QPH3/OAUF10if1ZrAStagC+bCCCdGvPUSnLLVmSbYUMXlWZmcp7O6y5IZlNvSPJcnnWQBFUN1UrRKmbf6t79LlXIgRpl8I8QuEiFbKFrhvzUVVEBxMAFN8P40xOb50WK4vTYhs5PYIHNMQIWVrR4vbRDBR0tgF6LtYsGqem/K8ScWmjrHeq5wPx9OHuR4AYll1+P1UymksCZBHWdO/SZStfCcgu3UGwcO6p6mbbxxeYxvBuQA6I3OEJnI0ILc+MZ98zWu9TGUcCijzd4vXA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dee1d790-f178-424c-68ed-08da49e40d19 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 06:48:24.9673 (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: zoFg3yWInpqzcXwVvF1NEdETQIgbNaIN0b8mRTGl5TP0+XFnGwCjzFsnxyNFG8eLAZM58FpBcmzJsQjOZxn4pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3518 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds bindings for i.MX8qm/qxp pixel combiner. Reviewed-by: Rob Herring Signed-off-by: Liu Ying --- v7->v8: * No change. v6->v7: * No change. 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) * Use enum instead of oneOf + const for the reg property of pixel combiner channels. (Rob) .../bridge/fsl,imx8qxp-pixel-combiner.yaml | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-combiner.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-combiner.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-combiner.yaml new file mode 100644 index 000000000000..50bae2122183 --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-combiner.yaml @@ -0,0 +1,144 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/fsl,imx8qxp-pixel-combiner.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX8qm/qxp Pixel Combiner + +maintainers: + - Liu Ying + +description: | + The Freescale i.MX8qm/qxp Pixel Combiner takes two output streams from a + single display controller and manipulates the two streams to support a number + of modes(bypass, pixel combine, YUV444 to YUV422, split_RGB) configured as + either one screen, two screens, or virtual screens. The pixel combiner is + also responsible for generating some of the control signals for the pixel link + output channel. + +properties: + compatible: + enum: + - fsl,imx8qm-pixel-combiner + - fsl,imx8qxp-pixel-combiner + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + const: apb + + power-domains: + maxItems: 1 + +patternProperties: + "^channel@[0-1]$": + type: object + description: Represents a display stream of pixel combiner. + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + reg: + description: The display stream index. + enum: [ 0, 1 ] + + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: Input endpoint of the display stream. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: Output endpoint of the display stream. + + required: + - "#address-cells" + - "#size-cells" + - reg + - port@0 + - port@1 + + additionalProperties: false + +required: + - compatible + - "#address-cells" + - "#size-cells" + - reg + - clocks + - clock-names + - power-domains + +additionalProperties: false + +examples: + - | + #include + #include + pixel-combiner@56020000 { + compatible = "fsl,imx8qxp-pixel-combiner"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x56020000 0x10000>; + clocks = <&dc0_pixel_combiner_lpcg IMX_LPCG_CLK_4>; + clock-names = "apb"; + power-domains = <&pd IMX_SC_R_DC_0>; + + channel@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + port@0 { + reg = <0>; + + dc0_pixel_combiner_ch0_dc0_dpu_disp0: endpoint { + remote-endpoint = <&dc0_dpu_disp0_dc0_pixel_combiner_ch0>; + }; + }; + + port@1 { + reg = <1>; + + dc0_pixel_combiner_ch0_dc0_pixel_link0: endpoint { + remote-endpoint = <&dc0_pixel_link0_dc0_pixel_combiner_ch0>; + }; + }; + }; + + channel@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + port@0 { + reg = <0>; + + dc0_pixel_combiner_ch1_dc0_dpu_disp1: endpoint { + remote-endpoint = <&dc0_dpu_disp1_dc0_pixel_combiner_ch1>; + }; + }; + + port@1 { + reg = <1>; + + dc0_pixel_combiner_ch1_dc0_pixel_link1: endpoint { + remote-endpoint = <&dc0_pixel_link1_dc0_pixel_combiner_ch1>; + }; + }; + }; + }; From patchwork Thu Jun 9 06:49:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 581000 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6935C433EF for ; Thu, 9 Jun 2022 06:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239373AbiFIGsq (ORCPT ); Thu, 9 Jun 2022 02:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239347AbiFIGsm (ORCPT ); Thu, 9 Jun 2022 02:48:42 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2075.outbound.protection.outlook.com [40.107.104.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 366BB4B414; Wed, 8 Jun 2022 23:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XOTJ1f3T3YG3EifuL3caI1LPmq0+TCExB0mrMN95pJkgtAynW1xEXnAPxq57CehPMBCFF6LswXLzl1ktMUXHpGsi/5GwUYB3cwKkYi3gDFl8hCU1WwBWE6Nq2rUkS2IeGo5m2rt9mhxWqnPhBpr1375Zfd38wYaGS+SJhQt7IgniyqeqSbVf789ro4UVyWDtdLHKylhwdqnATsoEBBb/3YvZyZLGC/SXU1319EVwGXarvkWtgAu9vyWy60MBbeaiM+B+BKtM0WEjI1yTTAwa0Z08fg0Bt8ICjLIwFi4knm3Sb1IrWNbp2/NDLdDlNXDdCHg4WXhKZmy+VcYMOhrSjA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6DjxV3N7Bt0o3J/KT/FGQPU6HbG721E6s9o0CyqixvQ=; b=RSoUbNZe7hivqWWKkEZmtqzEV7nyZ0cdJPa8YQzbHjRJrebCKta3+DXVNsT3WVhW6E8d2dn68vARVbreEEeGTgWjtAMt3Pu1mCIK2gq2wPREepD7yqxnNjd+bUOjWng30xPgMmAjcCUpeqH53VtpKWrCJIgxYBguomyXipl1hk35Z2K4WnyGmqCHd5g+619+cbBEpzFceR+m0sLliCA6hhP6rm73HyPByORPLM7vz4tfuCbBgugxNPArTD1ciCTwNGlXISGiKnBPciHOdmQmC2q+QPs95e3El7Nj5+JAkBPR6m6c/oe1GP6qUuCS6GvYl6LKoMzMYe8d2nfnM7gj2w== 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=6DjxV3N7Bt0o3J/KT/FGQPU6HbG721E6s9o0CyqixvQ=; b=I7mOS4HPLq56kfgyLPxMj9M9a7dnauWi1PM5qHAYhPqmK2HMVQP0BbVRpn6vwUEApCueCmemMv2hbc3UXB1aZizCIKw2fKjrmnmf0Pxk5hkoD6t0T9+EGo9vJUGeDp8NGqcpSXt/asbjF07fMUyp3xxFdR3wGsHjOLM6/tADBl0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by VI1PR0402MB3518.eurprd04.prod.outlook.com (2603:10a6:803:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Thu, 9 Jun 2022 06:48:38 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502%7]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 06:48:38 +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: andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, lee.jones@linaro.org, mchehab@kernel.org, marcel.ziswiler@toradex.com, Rob Herring Subject: [PATCH v8 05/14] dt-bindings: display: bridge: Add i.MX8qm/qxp display pixel link binding Date: Thu, 9 Jun 2022 14:49:22 +0800 Message-Id: <20220609064931.3068601-6-victor.liu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609064931.3068601-1-victor.liu@nxp.com> References: <20220609064931.3068601-1-victor.liu@nxp.com> X-ClientProxiedBy: SGXP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 301c3304-93c3-46ed-06c8-08da49e41510 X-MS-TrafficTypeDiagnostic: VI1PR0402MB3518:EE_ X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YmwBWc3cAWEIBinG2vAAv14OIiibv+Jg8E4FdTR1PuyNSl3bVPhPtIFDrgN2x0rUKNTCWehxwQlm4612pvYlCkXA18XdDRAx29A0iAbvP8EJQKZKA4vqGWa5bjeFLXRMmsvhI6crAt76io4Aaz0u8BhNCFO8Qif0RU7Kz4pq8Bedk4jlzLsuw++LMmSMDAsMS0KCei3Pzlbag9kUSjs/TjBPhdU5J9v5rXRGgCJXwqdsmccoaD/JYm8wMjK2BiDDNNrOKYXuSbtCnMqk/PB+HxmXU3CNepOLLxN0fwRskZq8c4dVhfKovoBbDTb27M45d83eLGAptZgsNWhnfvfq7lxMGa1v17VFx7acpGQ9feVkrwMz2r+9yIo/R6SLgDYvT/C4yz3QNXrKcBe0q4svfr76lh7EImChBNyKxBJiUr1/hhMmy+iYzxmxxcvhnYI/QLTPeXPnc5LckeLicFhqd1U2uuF1+9OUM/SwYQrcJXZoSICMJ47mLTqaoEC62f0l2y6mqk+iKUyRG8RA5rEHkAv9xo9cdJra+NBpZRd/abkrvQ39vf4cLnsQ/OX9WGbuOGFP5yt//+RUDvAc2j1xqx/uSV+NZ/8iLYm8R5YsJ5FiOr7NagL73pZ0XJgt/AScPjka5k9rj133mIRmoA7aQAbBr9Hv1i0VvzctiIEdbo76csNGMEZnBOUp0csclphv1drlL/4B+8Ic+I7Eguh9t4/iC1/I8+fFXQnP4UZe3hNQHovo6BXOq3fsU7rhHJ6oJ9uPQgZLHZc0dhqCIDWqtpciE0bEttQJ2KkCxeMbV1qy8ZQByrBY6P79emOT2TLlFQq5j8FcEHocCx6uFZMZJA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(966005)(2616005)(38350700002)(186003)(26005)(38100700002)(6512007)(6486002)(83380400001)(36756003)(316002)(1076003)(7416002)(66946007)(8676002)(8936002)(66556008)(52116002)(6506007)(66476007)(4326008)(86362001)(5660300002)(508600001)(6666004)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: no6+aKu4kxu+hG4o/OJhM1vhitFYAN7iXnYhEsrwCv+3ztlMno/b/eoq3K7ADXG79MGDFO9aVPOdLcGMqVQIktxp+4nmOIcjc7kWL4HHI1jmlM29PINwbmcXAMe2AT/syN1lJky4cW6zZ9DH44p98hecj1UrTYHvLKm8S+ia6PYIZ/IY6JYcIrOx8CnTlWtBJvR3WbZMyMoUTiFzKrXzhaiDmDIwERWxjHaelWBgt7IHyo5vZzoljLS8BbzYtIFEfn6FW2JDsdLOEEiGh62nSKNkAtz6t+YCw9T4GNGceGlgIpxGd7yzE+B/oNTdJ73xDIuHPI0cHiNvqnbbcTLQO8QF2H8SOrj5bN5me2O3Ms2ZP3kTrrqlqrILRpAiOCT92Z5FkhafDL/f8h/rQWRSBWgyD+TKsWjJPvFO4wmoSXR5y4qSyQ/LHny4ZYWtbPp0Ke60A6TTBNns6xWigAQbCCTaU2LXwiBIIXEA7Y6+pTDAyauU2M0eLM7H9lpxpEknn3EoNi7wCvpdDYQ8ovCTxj9BRm2YHWGw0OO2A2DiAAIHlvfIyp9nGs8jvtp9tsFen2k34PUIy//SohfwRyIYpN09NluAp0U3QZo5kQAjM3f8pCJzZVpRLBGYuMUIp6Pq+wf6JAxgrHJQN7IpRtGGLZm+tkwyI2Y9zh//NZRVEt1RjPlkLmEzeNbvdqEznOG+YdCgN/Hvm9XfzT6MLijkdr5CpcMl2ISbd2KuuKtt8eKwJzLlAeIPVQwuwomWbdPWC1tBcVrOSlAvg5z/dHYCPuWZfFns5qhTnLUS5yseIONgyddsPZTHy6NupLrjHq6r2Im1y2xxVnVBc4w95LucS176ZLdBeJCdvzn2mYzvjNfU1u/8vEXlleVGqRM3N+MfUnVO4946gfPExMy9lVNIPQqs20wl6/ems9zuP+D7WGDDzpHqdyKf63NiIibI8Hz+p8U+bCtA8hrtrYiuBrRjxBU57KUrleteg14xQkH+J74yUk8TfsLKAYIRbMqImcSEIDytgoEbfJeMzyzSypvgYZpPLUXBlTFWn5MS5j+/7aLXgn7dv0kSnt477ElKEBFIREmvtSScCwDFmPuhTr8iuN3qFaKycLBpvT6s6EXeAtgpicoD1wzAhWxN5Q0Jnwn6pXFKvfnKnJVNKp+/hhqRY3UJRn8OB4HxVstUiOnYy9uagBny1aIiNJYCVzv3xns+xXHVycr+4+gWzwmwIeYfadaSjlTqBPhi4/rP2R4Vf/M0wrbW5L5k225m74D20GyLfUKWxTHIFiv15LMDMcVI8CZh78xiT/oB/1WTwKcBQRGld27R6IUlxS0gil+pE3PlPwU5GfBVhJsgPHshYQJJbQAESWCEX1MwfjNLH+DNBaPSnntOg+FixM8eBns89pjsrBtWFf+woYwFjmJm9Mhjybn3NN8Tgjh0tpju9dhbRYFd+nXpUVlWVJjE9OLeHclqyw8lzUS32eVPs/3LGUkPTR5qEtD4EsG2d06ZzlqrridmH/GgiK9AxoTVOtiqHCxEHHqXewQJeQr/9I4kVvwM8KZ72LXbIAaBe5Yzcsi40/bmonFAqVRJT3HJTxsyv5ifHnVKoq/ERKitWeP6JaohuZTnZ9/OU4jv4OSMMmuN4/tWNk3CmoC/L4V659RVfPDLsAf9JTT9+OFEsGDiOLxak8cM5OZ3Z4to/WAXN/p1h7bazf3BMmDjFNz0PB6A8w6D+OfSYU96FE20nUDklVPsPA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 301c3304-93c3-46ed-06c8-08da49e41510 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 06:48:38.4526 (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: CsczIer9RZhlZWqlYmNbpDMd4NAssyaZ2Whk+zPnjNqlt6qQVao6dqIt4+Ib8nvVpd2IqzJGjnqdus3lmim0tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3518 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 --- v7->v8: * No change. v6->v7: * No change. 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) .../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 000000000000..3af67ccf8db1 --- /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 Thu Jun 9 06:49:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 580998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45CFAC43334 for ; Thu, 9 Jun 2022 06:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239288AbiFIGt3 (ORCPT ); Thu, 9 Jun 2022 02:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239354AbiFIGtL (ORCPT ); Thu, 9 Jun 2022 02:49:11 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2048.outbound.protection.outlook.com [40.107.104.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 473BC53C45; Wed, 8 Jun 2022 23:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kQicI+gJt2WE/t+SQO/H9GOvbrAvrdfHD2mCGJ/g8Bobld1Nmi44vkUjLs/w7ram0BG7szGGUCqG9/fcKRQZVsSY1F+zlp8ubDsvLwvuMzhHzlXZbFjK9JHHpY6DVbql5oShy8XYDbWo00DMoe8TCl8YJD+wzY7Z6HkvBlYXPIx9WIJWwDgFMhA1wBZ+UWXagMJN8BjnpzAVaOBBuZsGUWKPcdtGjP5mWAKmC4ukp6MVZc7YfSsdr6n43WLx0re+iUystIWJajzCvcQ+4/UOFao1Q5riHZnenSuhcwC8VpgE7WWfJtmEXFjmUmLEgYfm2n0Ayta0UbxJRbC+YWfY4Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3MFuqQgIeOIsb8c7f6wQQKF9i4OT0TOnV7McXEvV8t8=; b=hBSNSaL4f6CFTML/YsShVj5O+m43C1QQyX6wg+AjJqF5kOmDFz4UrJSTzCfPd2JOcOLgK1GMjZiHvFZaWk80nGSKewsVxy6IjYnRpgqYdVzktYn7PnkDRFPNdsEVw/SK8eKIGwBjWA44qSEeF3gj4Zw2HYmO9FlKcQ5lIj7IM79MCYLZVykhl9TbSTjlrpA8veqlWkFfcAsUtGyo2dd2NUHK4g639OvERm6kGBfBJP47RJmCraS2S4sIPCJF5ghrYDApUjPXWQEWRG+6OoVLvgNbokAX8fCNm5oKvZwyTNRYey8o74mhpC1mAQRHloqe6jj3abygGYR0z9qpQhQetA== 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=3MFuqQgIeOIsb8c7f6wQQKF9i4OT0TOnV7McXEvV8t8=; b=D2phlbzPfjj3F8iXpiaRWDd0ojh00InNxUvXokkCjp2zh5RNh/Ja0brzB3W/QqCwkLl2hP+znAN4QiI3Patpne+Im7s2VzXvt5jabul050riFr4uND1J6eX/s0rNe3n3Oc0AabCB/4s6U/Eh054aMmrOCL8gM7tVUoi1JulS8bg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by VI1PR0402MB3518.eurprd04.prod.outlook.com (2603:10a6:803:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Thu, 9 Jun 2022 06:48:52 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502%7]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 06:48:52 +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: andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, lee.jones@linaro.org, mchehab@kernel.org, marcel.ziswiler@toradex.com, Rob Herring Subject: [PATCH v8 07/14] dt-bindings: display: bridge: Add i.MX8qxp pixel link to DPI binding Date: Thu, 9 Jun 2022 14:49:24 +0800 Message-Id: <20220609064931.3068601-8-victor.liu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609064931.3068601-1-victor.liu@nxp.com> References: <20220609064931.3068601-1-victor.liu@nxp.com> X-ClientProxiedBy: SGXP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9dc30f7-594a-4605-34e7-08da49e41d26 X-MS-TrafficTypeDiagnostic: VI1PR0402MB3518:EE_ X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uQ/wLYIDm+D+ybX8ZSbdsvC8Isd4OxfkUlOi0ClNCuGSyghH1ExZBjbzn/mhCg+mHWodkI41pODzSwYaACePPFe2g93WIHUCCExophrxfieRRvUD7Ak27YqNemCvnlS8E8qDtV0EqPC/C0dNOg7EFR/W2YbYD2XyWT+XVKwUDzQq95qkEER8c8u9mI3cP4YIdCxskM9V8ATYB/W88JgBaVMB3cUJApEu1Ep8996KtxDeeUwNSrKaPpM54993tztydr9Rq6rtBC7AFS/4u1PAA1/O7cp+reTXPdBbarHKcnXQENvp3bNgEr5WePm1EWV+bFSIyrUB+E+NqMvar1dL4vW4kUIElhtvMVSGKrSF7SsDyOF/EvTUq/cnyWjHzicgkWvKzp7Lkq1ZqGCM/Ek7YIEG4u673T52kP+g+N+DCAdakll7av1shwoph/LWZkhMc3xWWMtz0imIWpUDYmBPjS87OMf179r4EzL9ZCqrjpoeal/IVD4+8BN/6iN0W7lluY85K/XqEcpAYmFv1BfPstOvZMFkZm5vnlpmDISX2DFLYHb3yvkt6DK21gLYnmZLDQOmTu1P0miB6qH3UQSZNhrqNu6fQ0bJYmTFHdnhcRZ7hKgOwWe6k5o+tSPHWdYWcaxaQTBI+sRZvJA43dDZk96vvDuxez2yFGrir6H+nOZ0rPTQ9Z9rnbU0ya4Viaansz5lNqho8+s6NXNpcdAsTQh4/ZW+hplJe7jOMuXYDrSqdba7vCOA+XnXcQr6kbImKbCD0m5rfc62793/UvbBzdFWuC3TeRehFAiI8EzsJ/bwIB85WXyD4giZuK9H00tJOqAQhxVHczKrsiJ+FFNbPw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(966005)(2616005)(38350700002)(186003)(26005)(38100700002)(6512007)(6486002)(36756003)(316002)(1076003)(7416002)(66946007)(8676002)(8936002)(66556008)(52116002)(6506007)(66476007)(4326008)(86362001)(5660300002)(508600001)(6666004)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GwcYtMj6mRaGOgiHQcgAJPVLonb0?= =?utf-8?q?rwtGLWk9Fu5mdebfY4Z7aw4vJUSWRlTS2HNvY7f3eeJU6tGThvpqfQqToT/N0shOe?= =?utf-8?q?59z7yso88E7gygkMSuE5MYJg9zh3aZh6qoqSc47tw0YrAdk2y7tAw/o/pdDBlSWvg?= =?utf-8?q?40fq0GAQY+NKu1YfREBQffnZerxxoDiC/o5WcBm5WP9hMJZ6GehuMY1jTpkHDgPuz?= =?utf-8?q?esvY64TM9+XV83YjZQO06L0WgtUkRuGrdMPADmlhY5KyrGRKoQGOU1pAXwoJrjqrs?= =?utf-8?q?ovo800l+IjCoHLIUuoqDcrnRbfbj5+kpLULKg18f14VTbBwBKzgytRuVPTZ8oEiLH?= =?utf-8?q?e9zb78rBqxlJ72r93iyKcns4lp4HZ6kcP1iu32PUCZNsQ+2KHE5TL93EUSB5JYYa+?= =?utf-8?q?p61N5pdW3Znv4/3YguU6waEBtHn4xobBLqoUgh37FMgVWCgcw9XGdUzbs4+yyrkmX?= =?utf-8?q?E7e04ZnXtFKDJZTj+9v/xloppHxgE2IzLAinY2iICZvIiZELT+z4i72PLAzSMYnbi?= =?utf-8?q?PLdTJZZKiwUQQ90/Oi6EnwTieLmJ1M6NPynqGIGq4HDE6fuj+TbeaTME/g63Ey/2K?= =?utf-8?q?TOhcIxccH3aCqr1DRguDg+16hEJT80SV90CGHAjBx5WrVWXKNwnG+j7IoESQ5GGeF?= =?utf-8?q?jLu2FZNcIrWku6ZIARWLdSOPmqpUccwmzgv0LCO/xnQ20WilsIXp7c80iDAlXCbEw?= =?utf-8?q?J9W1w04zEUTm2+imYeTkHHwryno7q9spqzRmb62i38nUKctN8UX7yJLvJFvF9Trhu?= =?utf-8?q?ochp2In5JHVynLkMrRsZweswq5UEyPwBWqQItLkJPMIs8FBDB2oa52lX4IcIyZUvB?= =?utf-8?q?OPiv+pvIHmbWya8ud4hR9Y2CMzP4SrqpfF6eWXZ3xdL4sOMeUMla5aDvmfqzRTdYd?= =?utf-8?q?jdBq+nFaHjTR/cii3qRg4piAtC2+675IO3IWoUa18/q3kStGO/GrQ+u+olJ/nPAbY?= =?utf-8?q?IqiH60ijxTD67zruP+V//RlJn6AW73LEDdvdLJZq87asEIZdLcfc8QI/NUawmVsRG?= =?utf-8?q?SpPtMZ5ZyotAesfbKtXHuJLn0PZi6iMjGMfpGDY0k38TLJN8spW8oczzAVe4qof7E?= =?utf-8?q?SBmLuImp/SxfRMPKT1okFS1Cc+Z9eJJT+MAIIhagzTPEHmdKeHc/iG4wuPf3RGENH?= =?utf-8?q?d3Aynuootau/EFl5BKQpAcJGWyqqRiRp5nO/dLK2ALnyNqMMBNpE1JqXZQkww+P+Z?= =?utf-8?q?fMssEWSx3kxuITboanrU90ORc5sQ1sD+mZwh/e3wtJW39TfmTc2y7eCyYVOsqF/J6?= =?utf-8?q?7xXO+yffop40VYUUuRYWO0E16rp0/euC4e69tTMtE4D8AkvCjkRfs9EAm39AVtbcq?= =?utf-8?q?pChheff/sI5mWcdDuwYoRCqCS9L4+Q5LNIIHfdrHksd2uBPSLJdiy0cM7BesI0kYU?= =?utf-8?q?3jnFq4oE3/gjpGk/kvaCyqYkqF3dR64QUQ+FCqKlkg2oiRkJZnUGXjWhiAkI534aC?= =?utf-8?q?NXxHGnLfOzUBQBTw5MNtZRTOUzr2qA4v0A0yTkN8Vn3//5ii9zDKW1faatZamQcEz?= =?utf-8?q?b7CiEZ9nzZtP1uRI9fpAYgwPwFLGNsu4TuARRc3AaQWNYP0hTNLKDqGpajIfSaIdt?= =?utf-8?q?YfoWXIICtLHb5iNQ9cooBkMKrrnkSJ1Cp6fQvqnazYWkoZlml9LwKw8JLAzlu0hSM?= =?utf-8?q?RFcGNfCtDhj5WY6a+fBXtQSIW6KeiTQw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9dc30f7-594a-4605-34e7-08da49e41d26 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 06:48:51.9260 (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: b4Oo5eDNi2Ooxc0EY0ptjROOLeBrwpMZ1F/xQP3RnHCIcow1ryyzd8HFS5LsRaHoQmTPhf867qqM30/lA6XR+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3518 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds bindings for i.MX8qxp pixel link to DPI(PXL2DPI). Reviewed-by: Rob Herring Signed-off-by: Liu Ying --- v7->v8: * No change. v6->v7: * No change. v5->v6: * Add Rob's R-b tag. v4->v5: * No change. v3->v4: * Add 'fsl,sc-resource' property. (Rob) v2->v3: * Drop 'fsl,syscon' property. (Rob) * Mention the CSR module controls PXL2DPI. v1->v2: * Use graph schema. (Laurent) .../display/bridge/fsl,imx8qxp-pxl2dpi.yaml | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pxl2dpi.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pxl2dpi.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pxl2dpi.yaml new file mode 100644 index 000000000000..e4e77fad05f1 --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pxl2dpi.yaml @@ -0,0 +1,108 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/fsl,imx8qxp-pxl2dpi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX8qxp Pixel Link to Display Pixel Interface + +maintainers: + - Liu Ying + +description: | + The Freescale i.MX8qxp Pixel Link to Display Pixel Interface(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. + This module is purely combinatorial. + + The i.MX8qxp PXL2DPI is controlled by Control and Status Registers(CSR) module. + The CSR module, as a system controller, contains the PXL2DPI's configuration + register. + +properties: + compatible: + const: fsl,imx8qxp-pxl2dpi + + fsl,sc-resource: + $ref: /schemas/types.yaml#/definitions/uint32 + description: The SCU resource ID associated with this PXL2DPI instance. + + power-domains: + maxItems: 1 + + fsl,companion-pxl2dpi: + $ref: /schemas/types.yaml#/definitions/phandle + description: | + A phandle which points to companion PXL2DPI which is used by downstream + LVDS Display Bridge(LDB) in split mode. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: The PXL2DPI input port node from pixel link. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: The PXL2DPI output port node to downstream bridge. + + required: + - port@0 + - port@1 + +required: + - compatible + - fsl,sc-resource + - power-domains + - ports + +additionalProperties: false + +examples: + - | + #include + 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_dc_pixel_link0: endpoint@0 { + reg = <0>; + remote-endpoint = <&dc_pixel_link0_mipi_lvds_0_pxl2dpi>; + }; + + mipi_lvds_0_pxl2dpi_dc_pixel_link1: endpoint@1 { + reg = <1>; + remote-endpoint = <&dc_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>; + }; + }; + }; + }; From patchwork Thu Jun 9 06:49:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 580999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01C11C43334 for ; Thu, 9 Jun 2022 06:49:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239054AbiFIGtW (ORCPT ); Thu, 9 Jun 2022 02:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239652AbiFIGtQ (ORCPT ); Thu, 9 Jun 2022 02:49:16 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60083.outbound.protection.outlook.com [40.107.6.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E012C53C41; Wed, 8 Jun 2022 23:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nsNHKqn9g29DUwO/+nMsiNKwp8nKR520pjczIZEi7dZOtfrh1JiGCfZAorcVsN/mLTnNPC1neNmrZloAHpsdj6ZSFkcdb7D6J19r8kRgk/Ul3JSgVKuv4uAlHghGdEsUqgo8/hQ6561ShaTaZkcL5W/HW3DxJBPdyb6z54exR4RcErzivUVia3Vwtb3ZsJgJ7pA1UqNVxF3Zxq6Zbf2bFhNDKGzsBwAFDKhKuWMOtyTyJndrECnmzHGd1qBWXeLschrNTno6z6fTdz/afYxgyPoduiRRgW4q3PQSjN9C66GXS5In9V5Lo8RWn3DaxrZKI7+3p5f9GHmr1PkPB6Xz4A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tENMvbt86pZa0vQCJzznIcRmYA/F6nNny2aT1juRyj8=; b=hlC8reXnHoWmmSY/idLAjbA8Bs7dfulULgQfSNxMHAsB4B9z4B8LM9gkDvcFXrHpYaaHZgZ1iZwrIqzHV2xFRV3tJ88zTVH9O1APSdQ6T5UTt9Qdf5vOiU9I2STe3Uf6YXF6ANRVuzvJwdCAV4ld/oO4Bj2iom5U+9xjRPW+MFV3On3K4uo0oL/Tow4ZS4Mv80gUzIs8zuGWwov4Oj6Av1/TPFjMDTq8Y0TYHrMDrmkFZ5/caIlJcVaJuasjmMesnq229sZo5HROVenuOcFeB/sMpZZIKGiTIaaxu8v/qy3kujAjRj8gV36fF49zgGY2uR1C/TZN0FYS3AxN3a4CUQ== 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=tENMvbt86pZa0vQCJzznIcRmYA/F6nNny2aT1juRyj8=; b=L5C3y/exlQKdhOnFHKZSbMVFGtZhGZYh2TQB1p8mXVpyrpyxFEwpb3Z73knfl58BZe6XBFNIngNGPAv82SmveL/n22cHCVtOssy1WpVtNibme+/dhDkCf3rNI/THtn0Tqzf9UidKiePgd2KUKFIjYrd94JUJhQC3odZiW1H1iRw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by VI1PR04MB5280.eurprd04.prod.outlook.com (2603:10a6:803:5f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Thu, 9 Jun 2022 06:48:58 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502%7]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 06:48:58 +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: andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, lee.jones@linaro.org, mchehab@kernel.org, marcel.ziswiler@toradex.com Subject: [PATCH v8 08/14] drm/bridge: imx: Add i.MX8qxp pixel link to DPI support Date: Thu, 9 Jun 2022 14:49:25 +0800 Message-Id: <20220609064931.3068601-9-victor.liu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609064931.3068601-1-victor.liu@nxp.com> References: <20220609064931.3068601-1-victor.liu@nxp.com> X-ClientProxiedBy: SGXP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf3b40ea-68a7-4a28-2f02-08da49e4212a X-MS-TrafficTypeDiagnostic: VI1PR04MB5280:EE_ X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KtgUGa5feWSa1QOKK7wtpySkeieQ5SGOe2tiE1UYrpVy75FFc1vb0HHxFXv8RLpFOUmMDkcnDAvgqroa34xiHApNg6KkUaP2VGS0uP3SPKzk7ntTMzP8NZU8DDbeU1L9ch8rg984IET+NxHZjmicGa9sFFs0lMbKOyDmlZnhVRAj5Gc9RIBCfipQ0WhADIz5ZRqYGO3W1h7M9N4Z8zXWeOjLxjf1KtoDaD0Oux8YoXVCbrAuy2BWn4HIz9Fv/Y+IuYt/euq7rlOI5GsruBL+1t6s+Q6SlZxdpdFMecsnl43sX+mq+xH/GFZJB+5Vae7T+o93LUCH3xF+5o/sRhWAeNaAFYg17qTpTolZtuy/4vuaKA0jcySNERFOXc6MVWLB17HseF9Lom3LSale/GhxJxg4lLhive//2b4DxuEI3//maMhldBOzRMjY7mIHJY46cGQeAaFD9JkJmEe9qlobIGVy5TyNB1B1VOSMqLGiTgP9VPsOfdF9bUeMHLmqnOLKKycpc2THCz36Uc/ido6kwFphB5ePP4bU4qDzdKM3ufvEc4ff4JD3CtON0y5nNNvvBM28io6HMkBcfZDZ2xI5cKEplGVpW2NmVOD875lksfATqusVTz/6rWJbE4Q/DYK4VECVwNun3zKtYAFRTc3y4ACabJixjKECErlWZl6Thc0tw2ShKAseQ9U+HUdntBh6tjsoII6ldwjigqPfcvUUoQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(1076003)(186003)(83380400001)(38350700002)(38100700002)(6506007)(6666004)(36756003)(30864003)(2906002)(52116002)(316002)(6512007)(508600001)(66946007)(6486002)(2616005)(66476007)(66556008)(8676002)(4326008)(7416002)(5660300002)(8936002)(86362001)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?xK7JsGjBgMzt1dnLc1fbVNjpAUHI?= =?utf-8?q?ZyevkTg7n8nrcBHRIzWmAYRsr08ghhxzvVeCBB6OhvU8GA+T6RCpWoLvrVxqROLns?= =?utf-8?q?9hEEUuH5sMrtPDRqoivtiCe1y98dKoy0umBL9+xeMZAKY00BWGyGXCuz6Buc6SYaZ?= =?utf-8?q?jOrQMBZ+LYnEpyFMG0k6S/RkcI4uxp2VkVWnAZy0cE4i6Lr0HCKh3xT7fOJ9c4xvz?= =?utf-8?q?m+xqsk0f9iP9SnE9kMyuS4ow2FqkPLH4Sf6vqj6PDukXNk6FomlJ8VK/ukSG2TKlx?= =?utf-8?q?eSTijQ9jBrLrEbJ/foT3w215PHxYHvugwUy+JhVdXFB2jR8Xeuda5BqqDBu0M5ibQ?= =?utf-8?q?BH1JCxD8j4joh4DA/T/magyhcW7WGq3KGiFzNTOifr9ZmNxJMBiYaPfbxeM3xmQ81?= =?utf-8?q?ZfylSwZdHckDtf22jq8sArYwuDDGZz/IkUklNr60AxHVd30A6YutbuAr42ZHkousk?= =?utf-8?q?aNJ2MXSGFS1eZ7SOe98YlWsVp8M58mGBlv4h3xqG5l1clL2Y80oavtL63/MishMhW?= =?utf-8?q?ztV5XQd4vn8Lkmf0Dh/Z1OW5ypLxD4ZUVJoy73beu5y6+K9hnx8/GnwgiZhGilJWp?= =?utf-8?q?7Z/1VXAjr069WejiFzaSrFO90KkQAft0dm6yC4t3bLggsTyqrUja+7P9Ysx2OR1h2?= =?utf-8?q?67eHIfGAkitLrzMWosScuiGuXm7Atib2pyMus87HK8HzVCsKlKhs4jqSXo6aUkLoP?= =?utf-8?q?hcOM5Ur959nx3iaDhYYS3KjSJyu8ivOfQ6gKdx5HjWpalOZ6SDX6mbwm1lzmPsuAN?= =?utf-8?q?JhMjdHABLbeyCcEAn0XNY+4qOc7SYnYPaqPfmdeX4G3Ugw1cEG/tdTRjE1SrYJItx?= =?utf-8?q?9c/cZE3zS08D5x475NuDb4H51QsCZbghHtSmpOBg5yN/niQaAudKb0FXMQL7efF8s?= =?utf-8?q?vhWXnUJhpdkOxB/Dc1UFWFqVtvOmc67Pu8UkJix1HWv6JhIjx0A2aaSfH8bSXR6JU?= =?utf-8?q?KdsCgzJfAs2tdNg38wqRfJUMmC4ny4OIOfUm7b+hkX3a2qlOPG2I8B5uS7O/ye0XO?= =?utf-8?q?Xm+CbNCJTFjn5a62CMc1fyXrZUzQKbCS7UrUP8OgSfCP6271wt9s8FdleYLwFYq/9?= =?utf-8?q?Gd5F8zg0dTn4uwcoE6VtP82ovI2fPbg6F+L+gzyCSsrNJQiUCYK4sC1xz4DUY4l+E?= =?utf-8?q?wZ2I12s/ST2rPIpl/9QKm3Z2PYI4hhalEJ2D2mL21/hsizWsjYeY/y4GwIK/KAY28?= =?utf-8?q?6uvOUY10MDVukMa/wFw7YjLd/ohQmE12FSAHrZOBzAbVcwhdZsZfvr5TIVHEe/9ec?= =?utf-8?q?zrI0Ybk8PnryvIPLSHWaXJs8MH5ecG5OnpRU8nWpkLGFWhQ5Iv5z7qBUQL/XWeKVe?= =?utf-8?q?eRtkG2vy14uhEzMo4WXheSQJVJULyz4vIJXoTZz2Goj2e3TbWjtnYs94RZdtnNfQ9?= =?utf-8?q?IW5qAJTLEmjdFI1m2mgQQS+nFxBnx4FD0By3qa5eb/LIvxVz2H6hxI2vSrJL1OaLz?= =?utf-8?q?efiznHRSkzo8//TnwjkdD2ObRb6ryWXUGP8ztR5ZWBCdmiadsZH+YfdNSHa6QfQ2X?= =?utf-8?q?fzthGqNRIOfLFhRa89zo9Bmj88z05cWncx4phL+WQbvM95tRXMMTZj+wn20sZ/Lqa?= =?utf-8?q?8s0rvzJrdhCR6dSutopGkTdjBTy0T/4VhWyWa2fqTj1QcdkDVKZA8V8uW1qje08RW?= =?utf-8?q?uIdNQdHeb/ZRG1iVgFhUp7yJqR5WW87g=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf3b40ea-68a7-4a28-2f02-08da49e4212a X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 06:48:58.6161 (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: w9eT5U2k4DAGacPlv+bhCQxxPJppbv8Zu1AngBVlQBzD/ymfwznsiSQVyUkbqq1PSrb94eNeMmWeevhq5yq7HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5280 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. Tested-by: Marcel Ziswiler # Colibri iMX8X, LT170410-2WHC, LP156WF1 Reviewed-by: Robert Foss Signed-off-by: Liu Ying --- Marcel, I add your T-b tag from v6, let me know if you want me to drop it, as the checkpatch fix and indentation fix in v7 are trivial. v7->v8: * No change. v6->v7: * Fix below complaints from 'checkpatch.pl --strict'. (Robert) - 'Alignment should match open parenthesis' - 'ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP' * A trivial indentation fix. (Robert) * Add Marcel's T-b tag. * Add Robert's R-b tag. 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 | 487 +++++++++++++++++++ 3 files changed, 496 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 4d1f027d07f8..1ea1ce7f558c 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 c15469fb5789..e74dd6422e95 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 000000000000..309f47a14cb6 --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c @@ -0,0 +1,487 @@ +// 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(-EINVAL); + 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 Thu Jun 9 06:49:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 580997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 617ABC43334 for ; Thu, 9 Jun 2022 06:49:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237351AbiFIGt4 (ORCPT ); Thu, 9 Jun 2022 02:49:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239697AbiFIGtw (ORCPT ); Thu, 9 Jun 2022 02:49:52 -0400 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50079.outbound.protection.outlook.com [40.107.5.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2774E396; Wed, 8 Jun 2022 23:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VjuceHgIPsFCLoqmrddLzy/IuINLXU4EmY651KtgJr8xKhqrUovk2x5s2fZbbZ8m8n8i2ecmqCxcpLqcwxhwLduPjMpJEXgYxPG3NyGdxgDsln4elRziLcBwSvGsQlVDYHgNAgJX20khABzdU+x2zBnHDFE0KK3R8eBRXgx75Satf+BYOX+hOGX+uFHkGvfBZ5J+h0MdMXBBQ1IBUIiXgq0JU3kMpJQJ/zsnzF2UNGs53jFPxDWgmqy+1S7rhMBtKly4jMcoCe46yjQanGsz5b6wpItNYqctFMFOleCrUo4WxVmqZ3lj8aRNHUmMEbLnY8tua7zCHeJFTk6oH5mHrg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5lSo1utlvCtoVmV/P7Trq3pr36eWfkeAbAvDGWn2AGY=; b=fKC0C7wJe6euFUVHGA9vUvgBbq8yGboWfD7TduzRKznNJNlRqtkvZENTUV8GQtpMrLiUpBd2szUAZCBxM5ceiWpCF5HIswmuuDWowMweBHA0WM/VI8+tKNWUQeVQcVpGR3XZmQh+45jLAZNsVAHgWsqMxeKc/k62Z0tTvYFpu5xkA1P17BNeWoXK+9az18ZRrVipTn7m6semAVFWzS01UFszzIdeB1rDdBTp6ZHX1/GU3kZciplHohGclAH6ewlMmEr4OTA4/sZicSRmDLgUADWdmUBRSE9u4VwQXcwoACpx2jhptrYSYAJrIoBwbd23U9qcmnU8UnSG8+bstTMhOA== 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=5lSo1utlvCtoVmV/P7Trq3pr36eWfkeAbAvDGWn2AGY=; b=WQOknAwKCG/pD3ZecViNEnIdBluSrf4K5t6Vyy3hfGRlkSoUPnUuHi4OP+RTWN5iSry5Oz33w173aOUYsFSybmBuL+4AZk6xgCSc7eoj1fcLRmT/LfsOIPkSB7+BYoeF+eA7xrGxANvkzYgUjb3gOqJ6p8d4zOs37OMvOcSgfO4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by VI1PR04MB5280.eurprd04.prod.outlook.com (2603:10a6:803:5f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Thu, 9 Jun 2022 06:49:18 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502%7]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 06:49:18 +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: andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, lee.jones@linaro.org, mchehab@kernel.org, marcel.ziswiler@toradex.com Subject: [PATCH v8 11/14] drm/bridge: imx: Add LDB support for i.MX8qxp Date: Thu, 9 Jun 2022 14:49:28 +0800 Message-Id: <20220609064931.3068601-12-victor.liu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609064931.3068601-1-victor.liu@nxp.com> References: <20220609064931.3068601-1-victor.liu@nxp.com> X-ClientProxiedBy: SGXP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c9e13d8-4e26-42da-6d6f-08da49e42cff X-MS-TrafficTypeDiagnostic: VI1PR04MB5280:EE_ X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2VRW9qSDNRnp8WNy/obalBo+yWIMrK+VMIMAAHoOd9TxeChX/9ef7ST9I7VoJKfzEYDlHZvQlSb+BOaCRjUmmPZ+04KbAzzBF7xk+V8d8TBnOjn8ydjFOgC5eFsN7kngArsvhwDz0AeUkZY4FVv9bko2SvX8a1AV3XSsSVX2sO6vDLXoyRZ4xoViW74CyEWDmz+Qd1OulAPC0wS/T9iEbEmG1Qh+1kK1AnpRHv+BV6Eg2dWyRYiqCc8w/HUcJJhIcZEbNkreAdfjj7YjZQosuS0HfVcBo49Y3p2sb7tEkl5VxBrmF0iCoeivio/P/0ngfXkWMJGpbX0/KQw/ZDLDfswMFCoJ7vxMFR+KrkV7pLDjdoot9RAO5VEqmIGvsx+bGcLqw1/b1S+tsshZQvrM1xtSHh1D4bYDibf/3IIL/j1g+8QwVRWUo+uUOJ8rYUcW+MN3wJ1+1FruOqLOBk/hGWJc1c1711aba7loN3RZc1GtAfrHv8qdjSdcM67ozcIPca/aOGOT4i7ONvL7kFyElon2F0fqsygVo8u6skNeXMIjUQ47L3xg0wtm1axSwGBnGmPKeV9I5n3RsiWVBKNuOewmhNyZMF8fCY17rbxzj4E/IZYeQx0+Vi9Lys7xYQwIJL+MaG2WQ2/Go0qaSAiU1P/KXcwUAVuvmmv3pOFh/FxH6/+EjiFl/vunlePeWp+65V6RTIqBflkNmqNuPjCMLA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(1076003)(186003)(83380400001)(38350700002)(38100700002)(6506007)(6666004)(36756003)(30864003)(2906002)(52116002)(316002)(6512007)(508600001)(66946007)(6486002)(2616005)(66476007)(66556008)(8676002)(4326008)(7416002)(5660300002)(8936002)(86362001)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /piz7UaAMuxcQHohE/Mpm5aoqXfR8q2bIueLj8YBWFnRd0mPtT7R6rRvVsGaj5OWmlWbtgRFI/OMFxhKnk2KA7OFKEBpoZcmq6PlxUGZGgOs6cZ4zW/Dez+YevzTEGKIBd2Re3cI4zwwHOIzUrMRxF6/q3HoOl05h/EZB2Jbh5f3i5HVh1v2QidaNVpHSlNnSpJCF/V2gpJob6HXHR3GXyMtodVmw6W3oR0ct/4fxKXRE7CQplpTyz9qgVbG3RCyg6pJjviOLq9AsOfowxVacYtHlHmJ4fWUl8Dgw1wei34hy4Fgcr7w03Moklyap5FHPI6nKLrMuXUTj/CPcbr6wZX1xdIiIpIDaASOe9tW+t5T96IQzGVAMWl+TjFFJkOO1omeiqkvs9bvP38pvvtxEZFjP0LZ2RQuk9bdGvu6jzJXfAqHw1iLitpfHbGPop1CVk8TonMvOcD0NpiXyucvfLDR8rEj8cBjDErOZ6HMcaR+q4bNguGvO3zqgmV7essoTSXn3B0sixmAOhJlQiv2DjvXSOlgwOL+Huu/wwyf8OzGLylgSyVi2+79+vaDh42Cuc8S85iNSqsZKKWaMBXb4ywxDOvd2UL4uk5sWPJ5BIUHu4wKiPBxHch4FiPeUnrxTJOjgsBxBo+iOHReJ7EWsgN2HzYEqZeyBOdf4zxcvai8Z8mYIu7eoySraN61bMZ9cTXVxsiix12InWc77dhZ/vOthAgJSBVWEtPn+uo9AY4KIrfl6UyKgT3VP++SBkR5Agdg+B/lESRKdzcXCYcR3irwir2kSzEWia0ScixsPmqJSBVgpweKhOJ4IBMKWMj/LgBIKWKswAkSk0WunCmNb0+VLg8FHPk1bvr730bIOHGCjXu+BuiLlRTGmOh5dGlm1EZiUCMc6exaAj3dOtyfxArD4AybBcqiyde6+SJPKxGHrYdI6g95NWxaDuJuQKiVvWx+zydl3fMTD3DFvZKY/V9+eDQe/nX93UoKt70TFRBL4lQyT9ghNYrXOgRj5F3MhPwhYsdAPUfl9pkrh1ICR5GLkvxOKAP6gGGEOcf0sLjp89gC3YWFEPGiZOFwJStE1umPOLWTOGbTj0PAoAXrT5eXhtZ3SjSGkJ25P5IyK9WBdLOMMBlMFSai5xM33rK3LSMPYq3iSBJ8Jw+ai54b9gNWVhfG7zGoGtrRj6e6kQB9m5DhcBfAL/KmDw47n0urSnSXKbAEdEldvGKhLBnCQI5x6efHp22sO+zUaG/YC6srocfa40w6tjaTLguVyz4BbgaBlJJzvk4ccbKdd/WFUFjKHOIIgbL0GRXwdHjNZD0ol+SE/qwhLXHqiloGgI4G+qkK9de3zb/JNtR24hVYJA5lWsfqThzqKB1qw2hc+hN+7xzaMygn1mYqmd5v61b2T0RD8dc7Jk5U90hhJUbERjVcjFRsRNJuYeXgb+hQvDQ18JGMoze27g5ng+gQOyQn2CxBiQidKHL+y90jNKRYip1lWB98wh9pK1rGFO0Xg8N2dKoOS0i3SdTPMPv5Le5NdQSBc5wunGF7vL9xW4rso9GxYwBeVpX74JVKcvqsNaEW2/ckoJkf2j2bg3UsQm6rGUkViWcz86raI1O5pIs+N08rESaDlmyS7twjlI+0ch8M9vbjWvUCoxthQY8LCoyiC2Dv9ePdTQJb5lr8gDHUOZ87VMD47SN81h6q/RaIBMXEPIh6GvMw8osPPTbwgWteNqHNGKGa6Y/p2rYWFp7S5A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c9e13d8-4e26-42da-6d6f-08da49e42cff X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 06:49:18.6404 (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: D8lJlbIeklIaUG+PFNOKu61fZPQ+IdfAVtvUTsUK+0RijNz6SimK1I+6tol9Zr1wo6dodSDbh9TuZ+bU0T85ig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5280 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds a drm bridge driver for i.MX8qxp LVDS display bridge(LDB) which is officially named as pixel mapper. The LDB has two channels. Each of them supports up to 24bpp parallel input color format and can map the input to VESA or JEIDA standards. The two channels cannot be used simultaneously, that is to say, the user should pick one of them to use. Two LDB channels from two LDB instances can work together in LDB split mode to support a dual link LVDS display. The channel indexes have to be different. Channel0 outputs odd pixels and channel1 outputs even pixels. This patch supports the LDB single mode and split mode. Tested-by: Marcel Ziswiler # Colibri iMX8X, LT170410-2WHC, LP156WF1 Reviewed-by: Robert Foss Signed-off-by: Liu Ying --- Marcel, I add your T-b tag from v6, let me know if you want me to drop it, as the checkpatch fix in v7 is trivial. v7->v8: * No change. v6->v7: * Fix below complaints from 'checkpatch.pl --strict'. (Robert) - 'Prefer using the BIT macro' - 'Alignment should match open parenthesis' - 'Comparison to NULL could be written "!companion_port"' - 'ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP' * Add Marcel's T-b tag. * Add Robert's R-b tag. v5->v6: * No change. v4->v5: * Link with the imx-ldb-helper object. (Robert) * Correspondingly, rename 'imx8qxp-ldb.c' to 'imx8qxp-ldb-drv.c'. v3->v4: * No change. v2->v3: * No change. v1->v2: * Drop unnecessary DT validation. * Use of_graph_get_endpoint_by_regs() and of_graph_get_remote_endpoint() to get the input remote endpoint in imx8qxp_ldb_set_di_id(). * Avoid using companion_port OF node after putting it in imx8qxp_ldb_parse_dt_companion(). * Mention i.MX8qxp 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/imx8qxp-ldb-drv.c | 722 +++++++++++++++++++ 3 files changed, 734 insertions(+) create mode 100644 drivers/gpu/drm/bridge/imx/imx8qxp-ldb-drv.c diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig index 1ea1ce7f558c..94f8db4d7e21 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -1,3 +1,12 @@ +config DRM_IMX8QXP_LDB + tristate "Freescale i.MX8QXP 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.MX8qxp processor. Official name of LDB is pixel mapper. + config DRM_IMX8QXP_PIXEL_COMBINER tristate "Freescale i.MX8QM/QXP pixel combiner" depends on OF diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile index e74dd6422e95..96d5d1e9659d 100644 --- a/drivers/gpu/drm/bridge/imx/Makefile +++ b/drivers/gpu/drm/bridge/imx/Makefile @@ -1,3 +1,6 @@ +imx8qxp-ldb-objs := imx-ldb-helper.o imx8qxp-ldb-drv.o +obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o + 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-ldb-drv.c b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb-drv.c new file mode 100644 index 000000000000..1cca5fc96a4b --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb-drv.c @@ -0,0 +1,722 @@ +// 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_CH_SEL BIT(28) + +#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 "imx8qxp-ldb" + +struct imx8qxp_ldb_channel { + struct ldb_channel base; + struct phy *phy; + unsigned int di_id; +}; + +struct imx8qxp_ldb { + struct ldb base; + struct device *dev; + struct imx8qxp_ldb_channel channel[MAX_LDB_CHAN_NUM]; + struct clk *clk_pixel; + struct clk *clk_bypass; + struct drm_bridge *companion; + int active_chno; +}; + +static inline struct imx8qxp_ldb_channel * +base_to_imx8qxp_ldb_channel(struct ldb_channel *base) +{ + return container_of(base, struct imx8qxp_ldb_channel, base); +} + +static inline struct imx8qxp_ldb *base_to_imx8qxp_ldb(struct ldb *base) +{ + return container_of(base, struct imx8qxp_ldb, base); +} + +static void imx8qxp_ldb_set_phy_cfg(struct imx8qxp_ldb *imx8qxp_ldb, + unsigned long di_clk, bool is_split, + struct phy_configure_opts_lvds *phy_cfg) +{ + phy_cfg->bits_per_lane_and_dclk_cycle = 7; + phy_cfg->lanes = 4; + + if (is_split) { + phy_cfg->differential_clk_rate = di_clk / 2; + phy_cfg->is_slave = !imx8qxp_ldb->companion; + } else { + phy_cfg->differential_clk_rate = di_clk; + phy_cfg->is_slave = false; + } +} + +static int +imx8qxp_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 imx8qxp_ldb_channel *imx8qxp_ldb_ch = + base_to_imx8qxp_ldb_channel(ldb_ch); + struct imx8qxp_ldb *imx8qxp_ldb = base_to_imx8qxp_ldb(ldb); + struct drm_bridge *companion = imx8qxp_ldb->companion; + 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; + + imx8qxp_ldb_set_phy_cfg(imx8qxp_ldb, di_clk, is_split, phy_cfg); + ret = phy_validate(imx8qxp_ldb_ch->phy, PHY_MODE_LVDS, 0, &opts); + if (ret < 0) { + DRM_DEV_DEBUG_DRIVER(imx8qxp_ldb->dev, + "failed to validate PHY: %d\n", ret); + return ret; + } + + if (is_split && companion) { + ret = companion->funcs->atomic_check(companion, + bridge_state, crtc_state, conn_state); + if (ret) + return ret; + } + + return ret; +} + +static void +imx8qxp_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_channel *companion_ldb_ch; + struct ldb *ldb = ldb_ch->ldb; + struct imx8qxp_ldb_channel *imx8qxp_ldb_ch = + base_to_imx8qxp_ldb_channel(ldb_ch); + struct imx8qxp_ldb *imx8qxp_ldb = base_to_imx8qxp_ldb(ldb); + struct drm_bridge *companion = imx8qxp_ldb->companion; + struct device *dev = imx8qxp_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(imx8qxp_ldb_ch->phy); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to initialize PHY: %d\n", ret); + + ret = phy_set_mode(imx8qxp_ldb_ch->phy, PHY_MODE_LVDS); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to set PHY mode: %d\n", ret); + + if (is_split && companion) { + companion_ldb_ch = bridge_to_ldb_ch(companion); + + companion_ldb_ch->in_bus_format = ldb_ch->in_bus_format; + companion_ldb_ch->out_bus_format = ldb_ch->out_bus_format; + } + + clk_set_rate(imx8qxp_ldb->clk_bypass, di_clk); + clk_set_rate(imx8qxp_ldb->clk_pixel, di_clk); + + imx8qxp_ldb_set_phy_cfg(imx8qxp_ldb, di_clk, is_split, phy_cfg); + ret = phy_configure(imx8qxp_ldb_ch->phy, &opts); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to configure PHY: %d\n", ret); + + if (chno == 0) + ldb->ldb_ctrl &= ~LDB_CH_SEL; + else + ldb->ldb_ctrl |= LDB_CH_SEL; + + /* input VSYNC signal from pixel link is active low */ + if (imx8qxp_ldb_ch->di_id == 0) + ldb->ldb_ctrl |= LDB_DI0_VS_POL_ACT_LOW; + else + ldb->ldb_ctrl |= LDB_DI1_VS_POL_ACT_LOW; + + /* + * For split mode, settle input VSYNC signal polarity and + * channel selection down early. + */ + if (is_split) + regmap_write(ldb->regmap, ldb->ctrl_reg, ldb->ldb_ctrl); + + 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)); + + if (is_split && companion) + companion->funcs->mode_set(companion, mode, adjusted_mode); +} + +static void +imx8qxp_ldb_bridge_atomic_pre_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 imx8qxp_ldb *imx8qxp_ldb = base_to_imx8qxp_ldb(ldb); + struct drm_bridge *companion = imx8qxp_ldb->companion; + bool is_split = ldb_channel_is_split_link(ldb_ch); + + clk_prepare_enable(imx8qxp_ldb->clk_pixel); + clk_prepare_enable(imx8qxp_ldb->clk_bypass); + + if (is_split && companion) + companion->funcs->atomic_pre_enable(companion, old_bridge_state); +} + +static void +imx8qxp_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 imx8qxp_ldb_channel *imx8qxp_ldb_ch = + base_to_imx8qxp_ldb_channel(ldb_ch); + struct imx8qxp_ldb *imx8qxp_ldb = base_to_imx8qxp_ldb(ldb); + struct drm_bridge *companion = imx8qxp_ldb->companion; + struct device *dev = imx8qxp_ldb->dev; + bool is_split = ldb_channel_is_split_link(ldb_ch); + int ret; + + if (ldb_ch->chno == 0 || is_split) { + ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; + ldb->ldb_ctrl |= imx8qxp_ldb_ch->di_id == 0 ? + LDB_CH0_MODE_EN_TO_DI0 : LDB_CH0_MODE_EN_TO_DI1; + } + if (ldb_ch->chno == 1 || is_split) { + ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; + ldb->ldb_ctrl |= imx8qxp_ldb_ch->di_id == 0 ? + LDB_CH1_MODE_EN_TO_DI0 : LDB_CH1_MODE_EN_TO_DI1; + } + + ldb_bridge_enable_helper(bridge); + + ret = phy_power_on(imx8qxp_ldb_ch->phy); + if (ret) + DRM_DEV_ERROR(dev, "failed to power on PHY: %d\n", ret); + + if (is_split && companion) + companion->funcs->atomic_enable(companion, old_bridge_state); +} + +static void +imx8qxp_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 imx8qxp_ldb_channel *imx8qxp_ldb_ch = + base_to_imx8qxp_ldb_channel(ldb_ch); + struct imx8qxp_ldb *imx8qxp_ldb = base_to_imx8qxp_ldb(ldb); + struct drm_bridge *companion = imx8qxp_ldb->companion; + struct device *dev = imx8qxp_ldb->dev; + bool is_split = ldb_channel_is_split_link(ldb_ch); + int ret; + + ret = phy_power_off(imx8qxp_ldb_ch->phy); + if (ret) + DRM_DEV_ERROR(dev, "failed to power off PHY: %d\n", ret); + + ret = phy_exit(imx8qxp_ldb_ch->phy); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to teardown PHY: %d\n", ret); + + ldb_bridge_disable_helper(bridge); + + clk_disable_unprepare(imx8qxp_ldb->clk_bypass); + clk_disable_unprepare(imx8qxp_ldb->clk_pixel); + + if (is_split && companion) + companion->funcs->atomic_disable(companion, old_bridge_state); + + ret = pm_runtime_put(dev); + if (ret < 0) + DRM_DEV_ERROR(dev, "failed to put runtime PM: %d\n", ret); +} + +static const u32 imx8qxp_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 imx8qxp_ldb_bus_output_fmt_supported(u32 fmt) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(imx8qxp_ldb_bus_output_fmts); i++) { + if (imx8qxp_ldb_bus_output_fmts[i] == fmt) + return true; + } + + return false; +} + +static u32 * +imx8qxp_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 (!imx8qxp_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_1X24, 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_1X24_CPADHI : + MEDIA_BUS_FMT_RGB888_1X24; + } else { + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; + } + break; + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG: + input_fmts[0] = MEDIA_BUS_FMT_RGB666_1X24_CPADHI; + break; + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG: + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA: + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; + break; + default: + kfree(input_fmts); + input_fmts = NULL; + break; + } + + return input_fmts; +} + +static u32 * +imx8qxp_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(imx8qxp_ldb_bus_output_fmts); + return kmemdup(imx8qxp_ldb_bus_output_fmts, + sizeof(imx8qxp_ldb_bus_output_fmts), GFP_KERNEL); +} + +static enum drm_mode_status +imx8qxp_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 > 170000) + return MODE_CLOCK_HIGH; + + if (mode->clock > 150000 && is_single) + return MODE_CLOCK_HIGH; + + return MODE_OK; +} + +static const struct drm_bridge_funcs imx8qxp_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 = imx8qxp_ldb_bridge_mode_valid, + .attach = ldb_bridge_attach_helper, + .atomic_check = imx8qxp_ldb_bridge_atomic_check, + .mode_set = imx8qxp_ldb_bridge_mode_set, + .atomic_pre_enable = imx8qxp_ldb_bridge_atomic_pre_enable, + .atomic_enable = imx8qxp_ldb_bridge_atomic_enable, + .atomic_disable = imx8qxp_ldb_bridge_atomic_disable, + .atomic_get_input_bus_fmts = + imx8qxp_ldb_bridge_atomic_get_input_bus_fmts, + .atomic_get_output_bus_fmts = + imx8qxp_ldb_bridge_atomic_get_output_bus_fmts, +}; + +static int imx8qxp_ldb_set_di_id(struct imx8qxp_ldb *imx8qxp_ldb) +{ + struct imx8qxp_ldb_channel *imx8qxp_ldb_ch = + &imx8qxp_ldb->channel[imx8qxp_ldb->active_chno]; + struct ldb_channel *ldb_ch = &imx8qxp_ldb_ch->base; + struct device_node *ep, *remote; + struct device *dev = imx8qxp_ldb->dev; + struct of_endpoint endpoint; + int ret; + + ep = of_graph_get_endpoint_by_regs(ldb_ch->np, 0, -1); + if (!ep) { + DRM_DEV_ERROR(dev, "failed to get port0 endpoint\n"); + return -EINVAL; + } + + remote = of_graph_get_remote_endpoint(ep); + of_node_put(ep); + if (!remote) { + DRM_DEV_ERROR(dev, "failed to get port0 remote endpoint\n"); + return -EINVAL; + } + + ret = of_graph_parse_endpoint(remote, &endpoint); + of_node_put(remote); + if (ret) { + DRM_DEV_ERROR(dev, "failed to parse port0 remote endpoint: %d\n", + ret); + return ret; + } + + imx8qxp_ldb_ch->di_id = endpoint.id; + + return 0; +} + +static int +imx8qxp_ldb_check_chno_and_dual_link(struct ldb_channel *ldb_ch, int link) +{ + if ((link == DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS && ldb_ch->chno != 0) || + (link == DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS && ldb_ch->chno != 1)) + return -EINVAL; + + return 0; +} + +static int imx8qxp_ldb_parse_dt_companion(struct imx8qxp_ldb *imx8qxp_ldb) +{ + struct imx8qxp_ldb_channel *imx8qxp_ldb_ch = + &imx8qxp_ldb->channel[imx8qxp_ldb->active_chno]; + struct ldb_channel *ldb_ch = &imx8qxp_ldb_ch->base; + struct ldb_channel *companion_ldb_ch; + struct device_node *companion; + struct device_node *child; + struct device_node *companion_port = NULL; + struct device_node *port1, *port2; + struct device *dev = imx8qxp_ldb->dev; + const struct of_device_id *match; + u32 i; + int dual_link; + int ret; + + /* Locate the companion LDB for dual-link operation, if any. */ + companion = of_parse_phandle(dev->of_node, "fsl,companion-ldb", 0); + if (!companion) + return 0; + + if (!of_device_is_available(companion)) { + DRM_DEV_ERROR(dev, "companion LDB 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 LDB is incompatible\n"); + ret = -ENXIO; + goto out; + } + + for_each_available_child_of_node(companion, child) { + ret = of_property_read_u32(child, "reg", &i); + if (ret || i > MAX_LDB_CHAN_NUM - 1) { + DRM_DEV_ERROR(dev, + "invalid channel node address: %u\n", i); + ret = -EINVAL; + of_node_put(child); + goto out; + } + + /* + * Channel numbers have to be different, because channel0 + * transmits odd pixels and channel1 transmits even pixels. + */ + if (i == (ldb_ch->chno ^ 0x1)) { + companion_port = child; + break; + } + } + + if (!companion_port) { + DRM_DEV_ERROR(dev, + "failed to find companion LDB channel port\n"); + ret = -EINVAL; + goto out; + } + + /* + * 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 we are + * connected to. If they are marked as expecting odd pixels and + * even pixels than we need to enable LDB split mode. + */ + port1 = of_graph_get_port_by_id(ldb_ch->np, 1); + port2 = of_graph_get_port_by_id(companion_port, 1); + dual_link = drm_of_lvds_get_dual_link_pixel_order(port1, port2); + of_node_put(port1); + of_node_put(port2); + + switch (dual_link) { + case DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS: + ldb_ch->link_type = LDB_CH_DUAL_LINK_ODD_EVEN_PIXELS; + break; + case DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS: + ldb_ch->link_type = LDB_CH_DUAL_LINK_EVEN_ODD_PIXELS; + break; + default: + ret = dual_link; + DRM_DEV_ERROR(dev, + "failed to get dual link pixel order: %d\n", ret); + goto out; + } + + ret = imx8qxp_ldb_check_chno_and_dual_link(ldb_ch, dual_link); + if (ret < 0) { + DRM_DEV_ERROR(dev, + "unmatched channel number(%u) vs dual link(%d)\n", + ldb_ch->chno, dual_link); + goto out; + } + + imx8qxp_ldb->companion = of_drm_find_bridge(companion_port); + if (!imx8qxp_ldb->companion) { + ret = -EPROBE_DEFER; + DRM_DEV_DEBUG_DRIVER(dev, + "failed to find bridge for companion bridge: %d\n", + ret); + goto out; + } + + DRM_DEV_DEBUG_DRIVER(dev, + "dual-link configuration detected (companion bridge %pOF)\n", + companion); + + companion_ldb_ch = bridge_to_ldb_ch(imx8qxp_ldb->companion); + companion_ldb_ch->link_type = ldb_ch->link_type; +out: + of_node_put(companion_port); + of_node_put(companion); + return ret; +} + +static int imx8qxp_ldb_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct imx8qxp_ldb *imx8qxp_ldb; + struct imx8qxp_ldb_channel *imx8qxp_ldb_ch; + struct ldb *ldb; + struct ldb_channel *ldb_ch; + int ret, i; + + imx8qxp_ldb = devm_kzalloc(dev, sizeof(*imx8qxp_ldb), GFP_KERNEL); + if (!imx8qxp_ldb) + return -ENOMEM; + + imx8qxp_ldb->clk_pixel = devm_clk_get(dev, "pixel"); + if (IS_ERR(imx8qxp_ldb->clk_pixel)) { + ret = PTR_ERR(imx8qxp_ldb->clk_pixel); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, + "failed to get pixel clock: %d\n", ret); + return ret; + } + + imx8qxp_ldb->clk_bypass = devm_clk_get(dev, "bypass"); + if (IS_ERR(imx8qxp_ldb->clk_bypass)) { + ret = PTR_ERR(imx8qxp_ldb->clk_bypass); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, + "failed to get bypass clock: %d\n", ret); + return ret; + } + + imx8qxp_ldb->dev = dev; + + ldb = &imx8qxp_ldb->base; + ldb->dev = dev; + ldb->ctrl_reg = 0xe0; + + for (i = 0; i < MAX_LDB_CHAN_NUM; i++) + ldb->channel[i] = &imx8qxp_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; + } else if (ldb->available_ch_cnt > 1) { + DRM_DEV_ERROR(dev, "invalid available channel number(%u)\n", + ldb->available_ch_cnt); + return -EINVAL; + } + + for (i = 0; i < MAX_LDB_CHAN_NUM; i++) { + imx8qxp_ldb_ch = &imx8qxp_ldb->channel[i]; + ldb_ch = &imx8qxp_ldb_ch->base; + + if (ldb_ch->is_available) { + imx8qxp_ldb->active_chno = ldb_ch->chno; + break; + } + } + + imx8qxp_ldb_ch->phy = devm_of_phy_get(dev, ldb_ch->np, "lvds_phy"); + if (IS_ERR(imx8qxp_ldb_ch->phy)) { + ret = PTR_ERR(imx8qxp_ldb_ch->phy); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "failed to get channel%d PHY: %d\n", + imx8qxp_ldb->active_chno, ret); + return ret; + } + + ret = ldb_find_next_bridge_helper(ldb); + if (ret) + return ret; + + ret = imx8qxp_ldb_set_di_id(imx8qxp_ldb); + if (ret) + return ret; + + ret = imx8qxp_ldb_parse_dt_companion(imx8qxp_ldb); + if (ret) + return ret; + + platform_set_drvdata(pdev, imx8qxp_ldb); + pm_runtime_enable(dev); + + ldb_add_bridge_helper(ldb, &imx8qxp_ldb_bridge_funcs); + + return ret; +} + +static int imx8qxp_ldb_remove(struct platform_device *pdev) +{ + struct imx8qxp_ldb *imx8qxp_ldb = platform_get_drvdata(pdev); + struct ldb *ldb = &imx8qxp_ldb->base; + + ldb_remove_bridge_helper(ldb); + + pm_runtime_disable(&pdev->dev); + + return 0; +} + +static int __maybe_unused imx8qxp_ldb_runtime_suspend(struct device *dev) +{ + return 0; +} + +static int __maybe_unused imx8qxp_ldb_runtime_resume(struct device *dev) +{ + struct imx8qxp_ldb *imx8qxp_ldb = dev_get_drvdata(dev); + struct ldb *ldb = &imx8qxp_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 imx8qxp_ldb_pm_ops = { + SET_RUNTIME_PM_OPS(imx8qxp_ldb_runtime_suspend, + imx8qxp_ldb_runtime_resume, NULL) +}; + +static const struct of_device_id imx8qxp_ldb_dt_ids[] = { + { .compatible = "fsl,imx8qxp-ldb" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx8qxp_ldb_dt_ids); + +static struct platform_driver imx8qxp_ldb_driver = { + .probe = imx8qxp_ldb_probe, + .remove = imx8qxp_ldb_remove, + .driver = { + .pm = &imx8qxp_ldb_pm_ops, + .name = DRIVER_NAME, + .of_match_table = imx8qxp_ldb_dt_ids, + }, +}; +module_platform_driver(imx8qxp_ldb_driver); + +MODULE_DESCRIPTION("i.MX8QXP LVDS Display Bridge(LDB)/Pixel Mapper bridge driver"); +MODULE_AUTHOR("Liu Ying "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRIVER_NAME); From patchwork Thu Jun 9 06:49:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 580996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30D20CCA473 for ; Thu, 9 Jun 2022 06:50:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239920AbiFIGuR (ORCPT ); Thu, 9 Jun 2022 02:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239865AbiFIGty (ORCPT ); Thu, 9 Jun 2022 02:49:54 -0400 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50079.outbound.protection.outlook.com [40.107.5.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 732BC5641D; Wed, 8 Jun 2022 23:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VYW/ihJrP7HysT67kDatW8KrrgRXx1O1/GKkNAdgOZNuRIRtwV4KkmZrkIZ8gwSWqUd0qB1Ak6dlxFXO1foN5JAnxNdbs3oGBJXj3/BG7m+77jVv8bgkjLggsgb2MIZFHZbOgfpS5EKdgdOPfdpcErB3i48+hLnGOlaU6YRKEgTE91K9Ei8qOOuGq+y3maPbG40lbvYFuRyJsqxEKwfmD6vMXu3kS3Jhgw33rJmNrspDcuZQvVgzXkDwmQXWimPHI/pmgNmdaKTa9q9kKcFBlZSlB4BMqrdLh10iE5AFq6r0mgxFyNq1KLJ+hRp5rnX55XkipzKbudWul3RKEM/Hbw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FZlKVqrBS3nEyEfo1QO4u2HAoxltQKJ8GkbaXUdLcsg=; b=S5FJ87nxe3aDR1yvEE661QniR3eRs48dqpbPmhr4IbrY4e5gZPpPTc5U8SQi9YIfRcb0vQN2v1H1WlCbp6ImhPjRst5nIN23PAGE7hBSwtY24o0/UGMRxwn154udrGnxdnuLQCntMqwJB+cS0NMTrJqqV+0AjCaMEdLRz1MCfPQW+zihrxdrk1e7Fat3J+7V/azySM3+4HyO/pzV9fv2XugqWuK5f/dHavvwnN8Asv1JgtQiZtQIa9I4n6aMPwyZtkGiKRv3JzP0qCZNLu9ND7cYGlHh/OzxFS5vTffzJ3+3ArJ0Imsa2ipYCmXlLu//f3twzwLhf26TgY9dfnZrqA== 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=FZlKVqrBS3nEyEfo1QO4u2HAoxltQKJ8GkbaXUdLcsg=; b=kFLuquX4WnZIaAEUGPXY41Ial/shgw7UUYnKnrYC6r6wyE1zlRjWvS90XwZtHPZH20nDW/fsb8TtKpApn+Jp635LZL9/eLOZWcEjRF/na61gx9LpCQos7nkgVCWjvu9h5koBN7KVZeWsDv5P+fcjdT/R/BEcJjKAhOXapsbTRhM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by VI1PR04MB5280.eurprd04.prod.outlook.com (2603:10a6:803:5f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Thu, 9 Jun 2022 06:49:26 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::3c82:f63b:711a:502%7]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 06:49:26 +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: andrzej.hajda@intel.com, narmstrong@baylibre.com, robert.foss@linaro.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, lee.jones@linaro.org, mchehab@kernel.org, marcel.ziswiler@toradex.com Subject: [PATCH v8 12/14] drm/bridge: imx: Add LDB support for i.MX8qm Date: Thu, 9 Jun 2022 14:49:29 +0800 Message-Id: <20220609064931.3068601-13-victor.liu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609064931.3068601-1-victor.liu@nxp.com> References: <20220609064931.3068601-1-victor.liu@nxp.com> X-ClientProxiedBy: SGXP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::20) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66709de2-0373-4584-3e5c-08da49e430fe X-MS-TrafficTypeDiagnostic: VI1PR04MB5280:EE_ X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eVqQn+3GmyO+yBMJ2uYBFrMfK+Dw+pbI3wqTW2lxmVZvNkCybu9GcVn/pkyK5bVAoMQMyftHPB/2fKn5+pzo93QVGPv4MSxOQ9ve2mxtAYAbawsXHCZ8PqMHJquNle2JeajctERsywElDjT8GPH0FwYfPIM58OP0g6f37zPluPl7rozbxYhBLT6H4ezGT/UPll8RHsIL6pWljhCyx06OuWJ6K1ukCeVUl164CR7guUEjYPBKcI+rhrFij+ibEVQqO5FGPCI3eK5vGUS0N2rCnOKzq9HfAJcZl5d3ZuM0Z/zuHC1Wisq0GiMn6VjDjJn12HctPQxu++JAQswPyJGsV/Fm918SNMKmzzxawf/7TAyp7h2w267KiLVx3YQVgwtTDGdW8B7YR6SAk+4/SaJ4U4wngS4pqr00uuhFmJK5+z9+/Yxs5he+j7COz92Gi+Mcx98N2ErToVGbnEIWXn0x2bx1Ev+v2Hj9U0sLv7TgnMamn65JzvIHkA+ZEp9pvq2P3KmOw1Pde2hPK1dc+WwMc17op/67MWKzCvSZ4oe475Qp0J8PUaTldelTvqKnrxIR5lB0D4dgX/wK8Cufxksb8hriciP4kzOVMyvVmT5dj4pQG+U8vao+vkudCldJfN8SYVhKgYzWuwgdPUAqjqW+2GYAnqMGfiwB9ue+jz4OK2Y7rvIY7nxiMOyfwZ8ijGC7JKhVbWHYnX2pXnhYV8aNUQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(1076003)(186003)(83380400001)(38350700002)(38100700002)(6506007)(36756003)(30864003)(2906002)(52116002)(316002)(6512007)(508600001)(66946007)(6486002)(2616005)(66476007)(66556008)(8676002)(4326008)(7416002)(5660300002)(8936002)(86362001)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ah6bu2O1SUrP0C/goVuLbkA6UmzfuIPRD9cU7eePhRfSuyRDXg0DmnduNhoYyUIO3NFse0VLOd4/9F+6D+D1Mgqw1ZtrXMvi/NiqbcGkQboV4hh3SDZXDMwddlO67ShY+E+/n+4uLS/QrhnZrh4Iqo2NsrjQnhy7Asi2jCmZKYSwd9hxb9Y093sKwCYoypt0eExyoCUqU2tYjgXrcFAOqC9evg1Z6vNSBBUzx3bh5x5liUrQ8xfMKa0JTcjskaevLnwzFDaRnMmFi+kJAE+smvWrP7+CPJu17xdskMI6l0FiM1+jkXnh0lxqVAUMuBYiph1tdajZlUiB/LerYUT01ntSYaz/XdO6V/4hcxmRd7SiL0JDZrvtPZ3IPgA5vc6h0fEJycB3twBAq8yLq1QiJ9eGUvBv/IztmTm11Kllh/gHX2qYerQe6SBvWEnpL8INlAG/HPKXJRIL0j9HQyngt4KplfCxzk5KzKc34iV7+ztT2l+HXdgdbdrbh/Lekj+jBURuN5qZ69BfoNYHA+GFoqMFPrkl128JiKHVxG0fyKzUJkUOaqkjOPyVAfxSPP4niY9YWFm9p1mp4x3Ez0UJVVz43Uc8kNQ3FA5XlvI6+e2ZB5avjgbdJPVc+W6vDh3MsCCd2CMHK0BNqk2PbWKrsJFS9NyNKw/HhQWZHuZK/OotyDJqtKsGpXxc8iHHPMIcCyvSpxR2d5N7ZiGGr2JWLFexbNKP6IXDMTCdNasBQJ4RXsGTVPTvgqQBhx5ZEMKcLayYU91yD5lYbSp6yXlHD5/Bv2d/8wwT6f8gxNT2Jn5xTWVIwUfs5emx7Jg6gq9tZJgBCvgSe8zdkZ5xOjuBqeGcbLMQC7lOnk2SUzJQnMXaSLf8l63soUmSy4yA+Rq0Ba1deBgl0m1gk+yI8kD0IGvQ9bOAb8TcRDgDYNNj4qXSskPhPrUF0CdlgOesdPShrdPh4p80HqUe+fbw4wyu149pfD4ysDW1RSE06CGxKdt1moTXyYB1LbGy9N/NnOzH7xqL9Ty7UEHMM/nIVE7tlnG0u4t0ZuBBHkJM8cFyJLHIYLFSZIxwhMABBwQODItdkLRheOjyUIbXJEgInGpILxyz8cmyg/S2N39KNMjSRvTTUKqbMI6AJQ77t4EgbkmGc5gm2hAohU0x5jfEZqzEWIDzzeNK7uhTCfQMtUFjA4rWmKV0iY7jnhBNvz0AldyQPjnDFHwUT5Zqtt4Loc7HxiAB4tO5ACpUJ5Z/Wl+srqO8tN/AABSZbGuEbA0pQOHKrraG80vo1QJy6q1thLkDhxZbPTBNdwzY2W0tiwXsbc0AL6/z5ScEpYXKmagM5ZLngOefxbe2dFtm7+1j6zSoS33jN6+pjo5SJkQeM0USkJ18eDuqpAnWjOw7qlH6sCHDUDUjygVNV4CVCu4MmD0lVZSBUOOrPNrX9eCTrQTnoSAfQlthMajcx3NUyHmpKc+6asP5hplZVR4XnIt2jvwzjHUOhU+gVtvAdB0TkvBZX0ajsHWTR7YQU0lTqDNGiShctu7FRQigU9XTUDegyTD5qzNMqe5o2ZhcxNS/MfphZEcqyA0icRKkRl6XKG+CHC4MEqJC2UIi59Y+NGQuu6oqjeusAp26QoxPoCk2VTFitomeYZYpP8xo0A65Gt1x6WROjiLqFCjaJKPMaM6YYGVyPx7Ebirxxbp6bgDi2neREFmshhoxPO0fZmnDiageeSElkFGa4+EhYViUOLmQBP8aDg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66709de2-0373-4584-3e5c-08da49e430fe X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 06:49:26.4851 (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: lqeWq6uWVabVxg/zSVdPrh+8LH0VZfRRftOXNeqcROaG+X+5Hp4CTsxR7PFxjE2YZdaYTccodoTFEjLiVzd2oA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5280 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. Tested-by: Marcel Ziswiler # Colibri iMX8X, LT170410-2WHC, LP156WF1 Reviewed-by: Robert Foss Signed-off-by: Liu Ying --- Marcel, I add your T-b tag from v6, let me know if you want me to drop it, as the checkpatch fix in v7 is trivial. v7->v8: * No change. v6->v7: * Fix below complaints from 'checkpatch.pl --strict'. (Robert) - 'Prefer using the BIT macro' - 'Alignment should match open parenthesis' * Add Marcel's T-b tag. * Add Robert's R-b tag. 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 | 587 ++++++++++++++++++++ 3 files changed, 599 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 94f8db4d7e21..3a8683fb7412 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 96d5d1e9659d..aa90ec8d5433 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 000000000000..29f8f36f814e --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c @@ -0,0 +1,587 @@ +// 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 BIT(22) +#define LDB_CH1_10BIT_EN BIT(23) +#define LDB_CH0_DATA_WIDTH_24BIT BIT(24) +#define LDB_CH1_DATA_WIDTH_24BIT BIT(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);