From patchwork Mon Feb 13 08:56:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 56102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2241812wrn; Mon, 13 Feb 2023 01:02:43 -0800 (PST) X-Google-Smtp-Source: AK7set/tTdRT7DvufcspsLgiZhvqBiB0pDRr0L2K8LiPmWZmPtWrgB7ylBuK2BNIB/un4JgmVRt5 X-Received: by 2002:a05:6a20:a684:b0:bf:58d1:ce9b with SMTP id ba4-20020a056a20a68400b000bf58d1ce9bmr15051178pzb.26.1676278963538; Mon, 13 Feb 2023 01:02:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676278963; cv=pass; d=google.com; s=arc-20160816; b=FQIknCXSLOLJPD/C+AG22dPo2nDMNYUjmDg1ibqd8jSKBKVTk9yHOEsQQuTMEGmS5Z IN399fePGCqj7CJw+wWDWrNm+6TogGxWo8oNStE2NODDtQbZm2Iw1pk6m5714XsH16OY vRE5nqZ05ttZ0bR2B+/7QfbjZP190ar7dzbxirTdRPmWRSOp9D0YiDRmr5rNjL/SWO3Y NaI7EfnZuDf9F2r9QkoHc5nI8OmjV0iuQQULhVO59YoYK1VFqn5hmHnTDaP8tHz/H9FG XOiNc8Ow/zR4tZQUbdNePRbKHigXnKkfDbjVVDBNvLx9XX5TraGHBHfQApNagpXPY65F fuLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NLz1nghvDdeU8XX4c8mS1zhXYI5HBw4HFppFon0xTiY=; b=mcCs3xpGh4uPy8rYGiQ3Vil8JPFq52geiEY893rm1I3SFJNYBbsP2iTjvSCafhE53O 5c2jNUFpO348upL+IcNyn+8ALdhuCav4bSjiRlwz4gJa9n7s9UszT3UHom2TFyBhjiSF SpxHfT/syftTJM3R/tVmstkd+uaqC99v/pouhoIuTXe6fsXO66qnrQChM++dphRjbu2q WWFwVW5Q8RjJya+JtsCofbU1Qtr8i1zb4IYhGuGXXnoNVSx80UPCeC1Ep5uzwauuJQYT PKx36Zwh8LtOQ0fKKtKM3ALyNC9aCajiBDcLABaI0/q0yDIl8l8rOb2TXXY+QdF4c89j TzcA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=oEtHM8Iy; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a63af12000000b004fbc2116e0esi620904pge.205.2023.02.13.01.02.31; Mon, 13 Feb 2023 01:02:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=oEtHM8Iy; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbjBMIz4 (ORCPT + 99 others); Mon, 13 Feb 2023 03:55:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjBMIzo (ORCPT ); Mon, 13 Feb 2023 03:55:44 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2043.outbound.protection.outlook.com [40.107.20.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1184713527; Mon, 13 Feb 2023 00:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iCAnVHn6k94fvQ3X8X0AkW6mTe+/DY5sLO08M+YoubwPGYnj8DnvM9LWUc0c1n0RTTW5RhjWFxhXAkzkAeRLKVAX+INL6xgcYRIaq7OXK4fELAJOgaKq888z616gHXvvPnlvVZYLL+3hT3uOzbCC/VEv72Gc90lXFBhoNq1d1nwKTn1WQe2iPKuE2Qm1ZlsYaQyJu+X1Y5vt+5ZHrPcWd5fZjSPQszWwSFOnUyXb29/0dSoKDjgTuD/IVVhcj+XP3gqvAkfsxTHNSu1CVU1TC2fHsnEpwFK8IePpGnnvfWrZS1pvtbJdSn/up+s8RQ6xUB8FJ2CEUD7ldZmpDGs09g== 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=NLz1nghvDdeU8XX4c8mS1zhXYI5HBw4HFppFon0xTiY=; b=E4insgQn6eHOTw9Z300gPizT5MUGHZcPjFoXB8cJB7pFRmHI7rCknPSeV2PdfvIdKN6xHZnSAOKaGLVBdF2P6RkgNBTVsiAzgvB6ytl/cNv1GTkqCgAmkHVvlWsyPwCO70pDfS0hn5oeXZ3YdwiCuucMlrp15wrt5UyaZ0O/6OK8iZhMLaHYz2vnxjG6NvS2ZrToquybsI50O+xDFVJ0yIRz5jgKFqeG0Uyy/f//Xl8dSowx5xBNpGXQ8g9nGkXDwI6ut9NZg+5km9cs84sEIqpyhAwSMpjJI/JcTsv+sacLbgwKCSoFKnDdusaSEY4TcVzJN3llLeQDT4FhCzJsAQ== 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=NLz1nghvDdeU8XX4c8mS1zhXYI5HBw4HFppFon0xTiY=; b=oEtHM8Iyy9KaitMs0nXzcu1znDjBbRmYAGd9fhVtuLEYqAQUis6CQYil53fr4m1+lmLsrSyFTwU8A73XoWqhvEqqqNGscvpPQQojjxKAe+kkCSlbkml5TCRI19aosOt1TKNZLVLwqMTdlZMHcmvLRGqzY/V/lB4+C+nU6JmQLJk= 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 PA4PR04MB7600.eurprd04.prod.outlook.com (2603:10a6:102:f2::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24; Mon, 13 Feb 2023 08:55:30 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::5725:92ec:f43e:f5fc%9]) with mapi id 15.20.6086.023; Mon, 13 Feb 2023 08:55:30 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: marex@denx.de, stefan@agner.ch, airlied@gmail.com, 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, krzysztof.kozlowski@linaro.org, LW@KARO-electronics.de, alexander.stein@ew.tq-group.com Subject: [PATCH v3 4/6] drm: lcdif: Check consistent bus format and flags across first bridges Date: Mon, 13 Feb 2023 16:56:10 +0800 Message-Id: <20230213085612.1026538-5-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230213085612.1026538-1-victor.liu@nxp.com> References: <20230213085612.1026538-1-victor.liu@nxp.com> X-ClientProxiedBy: SI2PR01CA0009.apcprd01.prod.exchangelabs.com (2603:1096:4:191::18) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA4PR04MB7600:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fc3dd94-8fcc-4d32-3ea0-08db0da00f37 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hhmHmGbvOEHgFL2T1c3czTMnnNwkSWa9C6RsxRXcABkWXfabj8dG2S5XYt2/oQsWkA1eQ41/juv4oIC96mpVU8T+UM0XahOcKW31GFlH07wt4GuXVqSf3zCgQC+UB+e9JZytzdGiKjTz8zDowtlgmdcL7/ASfKRSxR25Z02x3oqxYK2jHJFixW+CGXkoi+4MupF4s+XtvENIERlZ9ZZkSzefC/ta/rFADTnarzVAVdC8gfl3wuHoRfgUFva8puuCOwJfYdAD91MWQUeC8mrjQk5+kHJCNd9WnTSO2hxi93QFs2d47cU7u8spIZSA+PswMRjdVv5LwOVKahAXLvrglByPUV3NqA8OICyHzTfeZknWZrIJFcOZtQd3o6/F2NLTS/xEPJWMEbmGUFsef8wh8tdX0YJe0VW4mUG1dRjajtmrX+OslsI261escMgcWhKu1ahOgSpTljVTotMVJmEYJIy9DRXkH64vw2O+Lx4kdxcbBZ8HFF7o4UrTyLyA+au+PC3fqt0CjImqEpyrNmCbJ0/6tGZRczkYpEtJIibEayCel92hxNAkJnMpn/hHgMY/EUm7vOkY7or2w8nmM3PrZEQD1FRGqXopbn7yqmcl9TC+ueBNZDzo2ER9/weaYBKANN/hrZ1YFtnI36y2UpH4NzkJ/ylkIW38OV2WpkIFYt3/hg60yBhxjBOAjUQ6SCyle6VNP0LFyZygZMKvC8m8Cg== 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:(13230025)(4636009)(136003)(366004)(396003)(39860400002)(346002)(376002)(451199018)(4326008)(8676002)(1076003)(66946007)(316002)(86362001)(36756003)(2616005)(186003)(83380400001)(6512007)(6506007)(38350700002)(38100700002)(26005)(66476007)(7416002)(6666004)(478600001)(6486002)(52116002)(41300700001)(2906002)(66556008)(8936002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uHKPTBaqBqksCDI19n4TKMlvar9Hgz7XtHzsKbEhYbhSp9KO32UItG/dYfjGycXofSPdjErZfNYQk9IjzKMYYYuFYR3j9mSdh79Z+ik2H+egck/pAd9qkRxcDS3tKl81hKsClTj/tbyGq+XjU+2KcrQ58g8K9sP/zXrEMVBYI6lAyF727rgCKFhCQVvM67eZxpWaypMai0BHtQ/h4TRwCP5RKFvKvs/Sc5pzV9DHGgxTixVwRzmsYJD+l98S3ctMVwE8XcdHbat5XqiqjvkMONF3PqeqKkhbCyT6TzGDkQAS2I/StiYNHi0Vt4ygnwNGrki0sK6YwtxaqxCYd4Uv2+7e3+WyHCA0YcsFM1+Zxi96dlooq+BbO31N7rYw0Hcvej0ACGFNbDXQOA5eLWA+kr+WwkjSTDufkGrTtRHhjmeOnPv+C288A5sIz6ZIKqLDfDqqtvb13eB3fqA/U8SnHyuzn1XEAaLh6l4o+ZJ3zrT/jNUeVPAuv/uVv1ZFW4d+GJA9nCYu4suTPzHmMADrLs3q3enPGN7kSs7oVqoiaUuRgovwXaHoSzew89kFY5iGF3kAd8zOyNDB5KiJwCAh5BFCmjmGOwbjovOLPeqU498PxA6yt6nSF/LvQ85FqorSo/mZGtMlSHa3kY4qMsChv5r7sOIS7PSioe7JtNOLc0Fc8Hh34SEmJF79C7VuihsN5nPx2kPHW4WlnEgZeUiVz86M47FaubIUdO9FbUqQbvjQiSHVtKVodEpE1KgLct08AjRzenCOh/2WzY59eOgNYYdQQClD9uFv4RtSTt3yveHsc+8576110LHUm5enY/hk76vGD4zAReNLNiaxtI1yCo/YHcKwoj2EvnrKBeT7vooguX4r8uy/xgkMjjXF70euqa2o/kEmfNDe9JfkKRlHstD0xysZ3K+7encPxhvmjbCmQS8aD8F1+zGqm26KIGSbiSsnIYquGXKF3BPfQuFWumQwYVzpG2GHIiDN/eXLNuuuQWGRTaeZQdn/gUgjBoh/oTqb48sVl3VXBKb5x2B0h2L8FtnbQjKbMFfw1wYe5cT+YzrcWsEbtZJD0YA12FrAfB7cenLUljgk6yPgRLYLxUmDk15Hg56HjOvUkvROAN+oqO68loM2K114U9B0mlD3h8lRHTCl5xL0rzkoZYa6wHXZdjkyCZVn7+LcfsXVqMLW/R9urj/Hi6pgO9x2KubW+1SjN8wDbq+cF8x/xiy2SqaCxHUdUcfUBKIrEjvN+6xU52XyusnNnVGg+5QjQ/OcBbn2GSIg9GXR35PQbROhSRKlQp4+kO8X8Z9kKSUzEBYuqHitfhxLXwHvTXbpPQLsqgzYH+L2a02TcEgs4wAiteLBzl/hxb+p1p7oeQJIQZF5WwYTzZsMZ4YTCtcSkNj699OrzHPEoJmF8wTHkfzPTi1R07VOp4xVrSxAcQ5a6BaFstqNSIoc+wswZqYuAYFWdw0yZ7GeXt6sX5PUvXn43Sw1s8pHqMj1lsaO0f98BO4AzsSlmZytj/HBg84I/X5Sc7Gwm6tbkvlaKIOVGRdMDRi8VP2+/Ls140yZmqoWCU8q3rioaRiHzWnLidRx1iCX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fc3dd94-8fcc-4d32-3ea0-08db0da00f37 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2023 08:55:30.5670 (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: gEb6K5FhNL9y3TUj9o3Cgzb39TPFsH2hVtqhpVlTE1vdqWlBJpKLBj2bKehcoqghqGaV8lHytDXC8nb6A+Tlyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7600 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757705890501253246?= X-GMAIL-MSGID: =?utf-8?q?1757705890501253246?= The single LCDIF embedded in i.MX93 SoC may drive multiple displays simultaneously. Check bus format and flags across first bridges in ->atomic_check() to ensure they are consistent. This is a preparation for adding i.MX93 LCDIF support. Signed-off-by: Liu Ying --- v2->v3: * No change. v1->v2: * Split from patch 2/2 in v1. (Marek, Alexander) * Drop a comment about bridge input bus format from lcdif_crtc_atomic_check(). drivers/gpu/drm/mxsfb/lcdif_drv.c | 2 - drivers/gpu/drm/mxsfb/lcdif_drv.h | 1 - drivers/gpu/drm/mxsfb/lcdif_kms.c | 76 ++++++++++++++++++++++--------- 3 files changed, 55 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index cc2ceb301b96..b5b9a8e273c6 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c @@ -52,8 +52,6 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) if (ret) return dev_err_probe(drm->dev, ret, "Failed to attach bridge\n"); - lcdif->bridge = bridge; - return 0; } diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.h b/drivers/gpu/drm/mxsfb/lcdif_drv.h index 6cdba6e20c02..aa6d099a1897 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.h +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.h @@ -31,7 +31,6 @@ struct lcdif_drm_private { } planes; struct drm_crtc crtc; struct drm_encoder encoder; - struct drm_bridge *bridge; }; static inline struct lcdif_drm_private * diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index 294cecdf5439..4ea3d2b2cf61 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -424,15 +425,19 @@ static int lcdif_crtc_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state) { struct drm_device *drm = crtc->dev; - struct lcdif_drm_private *lcdif = to_lcdif_drm_private(drm); struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct lcdif_crtc_state *lcdif_crtc_state = to_lcdif_crtc_state(crtc_state); bool has_primary = crtc_state->plane_mask & drm_plane_mask(crtc->primary); + struct drm_connector_state *connector_state; + struct drm_connector *connector; + struct drm_encoder *encoder; struct drm_bridge_state *bridge_state; - struct drm_bridge *bridge = lcdif->bridge; - int ret; + struct drm_bridge *bridge; + u32 bus_format, bus_flags; + bool format_set = false, flags_set = false; + int ret, i; /* The primary plane has to be enabled when the CRTC is active. */ if (crtc_state->active && !has_primary) @@ -442,26 +447,55 @@ static int lcdif_crtc_atomic_check(struct drm_crtc *crtc, if (ret) return ret; - bridge_state = drm_atomic_get_new_bridge_state(state, bridge); - if (!bridge_state) - lcdif_crtc_state->bus_format = MEDIA_BUS_FMT_FIXED; - else - lcdif_crtc_state->bus_format = bridge_state->input_bus_cfg.format; - - if (lcdif_crtc_state->bus_format == MEDIA_BUS_FMT_FIXED) { - dev_warn_once(drm->dev, - "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" - "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n"); - lcdif_crtc_state->bus_format = MEDIA_BUS_FMT_RGB888_1X24; + /* Try to find consistent bus format and flags across first bridges. */ + for_each_new_connector_in_state(state, connector, connector_state, i) { + if (!connector_state->crtc) + continue; + + encoder = connector_state->best_encoder; + + bridge = drm_bridge_chain_get_first_bridge(encoder); + if (!bridge) + continue; + + bridge_state = drm_atomic_get_new_bridge_state(state, bridge); + if (!bridge_state) + bus_format = MEDIA_BUS_FMT_FIXED; + else + bus_format = bridge_state->input_bus_cfg.format; + + if (bus_format == MEDIA_BUS_FMT_FIXED) { + dev_warn(drm->dev, + "[ENCODER:%d:%s]'s bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" + "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n", + encoder->base.id, encoder->name); + bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } + + if (!format_set) { + lcdif_crtc_state->bus_format = bus_format; + format_set = true; + } else if (lcdif_crtc_state->bus_format != bus_format) { + DRM_DEV_DEBUG_DRIVER(drm->dev, "inconsistent bus format\n"); + return -EINVAL; + } + + if (bridge->timings) + bus_flags = bridge->timings->input_bus_flags; + else if (bridge_state) + bus_flags = bridge_state->input_bus_cfg.flags; + else + bus_flags = 0; + + if (!flags_set) { + lcdif_crtc_state->bus_flags = bus_flags; + flags_set = true; + } else if (lcdif_crtc_state->bus_flags != bus_flags) { + DRM_DEV_DEBUG_DRIVER(drm->dev, "inconsistent bus flags\n"); + return -EINVAL; + } } - if (bridge->timings) - lcdif_crtc_state->bus_flags = bridge->timings->input_bus_flags; - else if (bridge_state) - lcdif_crtc_state->bus_flags = bridge_state->input_bus_cfg.flags; - else - lcdif_crtc_state->bus_flags = 0; - return 0; }