From patchwork Thu Jul 20 07:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13319878 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E840EB64DA for ; Thu, 20 Jul 2023 07:10:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CADF810E56A; Thu, 20 Jul 2023 07:10:24 +0000 (UTC) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2051.outbound.protection.outlook.com [40.107.247.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 38DDD10E56A for ; Thu, 20 Jul 2023 07:10:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iebD1sNFUvHM9FzvDiYtru0o+DNKMjVxovMXzr/OZVn9mmk0XZYu5R7q26CetNwIJGOBbtw5EnqlVk6/K42IDlQBVBKj0rPEfXXqBL2s6oZOzgo8EyDJFZucBLGzuI4qc+ZC4z4Fi3bMNuk1p+CwZ9DpbnwHwAkGkbzPeihFosbe05gE5tf72+YcdjS7av0opu+oVqUQROHHey7ZnyZgSBV6MrgRfzN4u+rLHQyO2PqJBtHPkouBlZwfo4U4CK9YEk/hhq/Jrid+CaRrRalUaqHxrBEma73bWy2BaLX/0WG5qnKGfBUViOsuPlYzz4PzDA0nynNGK4zDz3j5EtY+0w== 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=QcM4UwOad8aiPGN1wd4BrcxlMjn1XZT0hNlv74Fm71U=; b=W2T0BZ+vVunXRzf1yEJ60gYPy5JFLRkwaAtUlHJnJYwMx77ULtDj9FgOeHd2FR4h3HVhSqQL/XYR6fmZxoU2e5KtYndPhUWwaQSNNuCDD7Hn+DNopOHdQqixdj0Ce+yFy+5xMfHnsZkzwejws8khi4MXrzOJ56wDdUrNBFerqHZA2DaGmcgJUyRdoZQ01i7ZtScp4gnHXJrabUTybzlBBJNEioNo2XX+1BBTMhmPPV+erMZIe7mUn08G3bdZxrbqzV+i5jlIno/dFFYJXZ1N7PZuyObTFFm5/1ktUnhjLTqaHXDfY73crG3to138tszLorEDyUD7wwFqUxpkZFkvfw== 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=QcM4UwOad8aiPGN1wd4BrcxlMjn1XZT0hNlv74Fm71U=; b=p63uVE1ONxlpX2cNAKmATkJxkyFiArmHHr4db7MBOhHwr5+31wnIw3L17XKkZ6tIT9/grP7Gc4dBt6f8/qnzmNiWCbk9gHynj4NkiUuV9W8XMD4OLe/uQ4yAV/qY6OMc3xhmGw0Dtsqy3Ra9BB+vnNVkWqecteB2nvHIDJvYYMQ= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM9PR04MB8415.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 07:10:19 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6609.022; Thu, 20 Jul 2023 07:10:19 +0000 From: Ying Liu To: "dri-devel@lists.freedesktop.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v2 5/9] drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc Thread-Topic: [PATCH v2 5/9] drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc Thread-Index: Adm62T4XsRXruAuytUCRfthfHJ0PDA== Date: Thu, 20 Jul 2023 07:10:19 +0000 Message-ID: <20230720071430.259892-6-victor.liu@nxp.com> References: <20230720071430.259892-1-victor.liu@nxp.com> In-Reply-To: <20230720071430.259892-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SI2PR01CA0039.apcprd01.prod.exchangelabs.com (2603:1096:4:193::16) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|AM9PR04MB8415:EE_ x-ms-office365-filtering-correlation-id: 5f39451c-bd98-470c-49b1-08db88f06092 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 927SuwfviYwscyZCa5dO7tqXKFvioMorJOXtth6I0zsODsAVtNszmHr0I7EffDf1uz9vUvrs+eM3jjWkcWM1hxtq9E3t0jNeSpSPuvD1dCCMXNqJSApd6kRaF+8vmZVpvoyokQ4XGDC0g+Jh573NC9YBU49Co4wepeUm21843J055OzfI1pvzOsd/wFDVnkF9T+HYToWlHNNHh0S+T+C/k7jvnGJ4FEs+/ScJ78kqxxGkT3KlLVblePQS4kNeMkqjZHaQut964Tc+w7EiMYmb2PlA/0HJiyiKAGzeoA6g1h25P9jQYbIe6ccd58eYXPNot27RK29hYq91Hqu/QZeZUvVDt9a/l/uQ1QJcGcKtqbqS/27Lm/0IoGbhGLejxRkZUa9i6HRfNPSCkj/E2o7eZE9NhWmt4U84YP1YLapI1CMl/veWsX6eurMFp80TcjXb4M+5xyHbLAz6+19Z1DPoTm7lqmBULjOM45FS3uIXNaKawb4LpZmQRHlJKAOS8eULhd5sGDDKAlnOb8HwCkl80M/BLVvsaqdWkBUViuSuaqkkDi9jSs+QoVfp2tFbus/Lb9HSRH7v5KHuSC0JXP6XEDFom+LCJ7wLw9IHeGUcrg= 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:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199021)(6506007)(478600001)(1076003)(26005)(6486002)(52116002)(2906002)(6512007)(71200400001)(4326008)(5660300002)(66556008)(316002)(66946007)(66476007)(83380400001)(66446008)(54906003)(110136005)(64756008)(38350700002)(36756003)(38100700002)(7416002)(8936002)(8676002)(86362001)(186003)(2616005)(41300700001)(122000001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?pFIuyYGjs++tFrtAbBWKG2B?= =?iso-8859-1?q?VQ9ZJ4tW0TOo+Dw92NSGdm/cBJFNLYSM29+v3qops7gFmWy7DyrIyCdSL/pJ?= =?iso-8859-1?q?k6St2buNdUFMzF7ddi0qGjnQKkwGhRyDtTbrr0MP1RsBqwrkskatOeiYty/F?= =?iso-8859-1?q?HdeXTc62ZXk/T3ydYN9BN3dM7FdZPiMQR+mxD+zmMJqo9fuv75471brwkBTg?= =?iso-8859-1?q?AGEG8bgtT9zack9dDWMw8g4wT1/plBq81nMTUJNuSB35XHt8tLArtN8cFjIx?= =?iso-8859-1?q?2P5RLrqnIcP6ukyY/zx8WmUrryTWHjq5MuRFRAsq8DUUw0VecKW21cZdNGuE?= =?iso-8859-1?q?S/lohap/Ej27vdSk+9TDjxklTzNPQJ0xhoniAClo+tCTyKmo4uJvu145dJ9L?= =?iso-8859-1?q?S0Ewq/qXdL2FWhNqJROv7GQFIwdpsRb1m3I+sVfK64ydMfF6LxeviH5yJscc?= =?iso-8859-1?q?iWZMkCTB9TniuToXO3ZI9oiIlrP1Q2vaZ+jLOLmc+JcPgPhl8Pa7LEZJNK1+?= =?iso-8859-1?q?GyrcdA9ceZwm+M5dNwYyklHyDrXPYlCrYtN0xebwFj5Boy6/F6Xod6EHrWK5?= =?iso-8859-1?q?IWrtLyowe3BheP2w6NrvfkO90vzmcPUxRMmH/H7J1EPmgN6jYv75Dts/mq+G?= =?iso-8859-1?q?pv8LvLXztQBnTo/PRdvjK3a1mN1Q8voyS8Hgy21LEtywAE98S9GedpJ7INYq?= =?iso-8859-1?q?dK6lDQEr5vFnhDf/0kE6tVSCIreAgAT1Ig3ZTBf3ZXc+ER4lwTmSwLLZJCkW?= =?iso-8859-1?q?x/7lVHpVZg1Q3wbD2pKYw5pEXrYvmOfZT+KqEqNg8bxhETaNovz0z+REVaSL?= =?iso-8859-1?q?UI0qU8wSaf/f2q8RWlQ7ZjFzeBwIlmejtSm40LwQHvrTS27hfM0ixZcmQ9aR?= =?iso-8859-1?q?0Sz4mIy5H5b++eb58B2Ie/PFQW6JoQGpu2VqaiX+r5BluZk9xcxBTNden3M5?= =?iso-8859-1?q?js7Som7yheYFmnELINnKO3c5/SZuERb8tMtQMBlsAeTYLuI43UBF7QILI6FK?= =?iso-8859-1?q?1b8rnGXRRF8GKsCPR7b56up8o8/ddelizeGG73iGp8kV+DAGYsMycqydyoHb?= =?iso-8859-1?q?7EF8ibe185jOc0+rzO3sjCahRcSHio7SUkZopQXq+13OIjJDPZsCXphgXASs?= =?iso-8859-1?q?oknL6fUsxDTIN9tnXqynbS/9haNMMsgIKCIgjiL3hmaxxZljod9Cal2155bz?= =?iso-8859-1?q?dBKzEj1pFzIkfEne4MzNc2fQJFUfk8q2gxqpNIxBP48xnV7Qkx7iEVD3D+dx?= =?iso-8859-1?q?a6MDgfbZQ+JEI2OVUpSjYiRz66fF7aGdbn8zb8yNjVaLzmhDjFgLmmZJj5GZ?= =?iso-8859-1?q?QxfHEyf596T3rN7kD+NxdwPKVplyEaUzTanYzGie1DRDkXsLOcnGdW1PuZ3H?= =?iso-8859-1?q?Rs8OUJlI//nCvOW79F+JXuKektKqG67jLUI0AwyR03V0VT/yWNomwFbmlk7v?= =?iso-8859-1?q?Q4kJUN5vddfDOUjqqhuJdT3uvfPln3UM9eRcIC8gxoJNNLy/zguWVUmggwKJ?= =?iso-8859-1?q?IEY9nyUc927WFz76oujuUeZ5+kQIfnp93CGMJA5BRipnYpXc1hKEKdaDE9wR?= =?iso-8859-1?q?hvtm24DWU+85sw2Wh7tXud+IE4OPlodxyqgon1oBRf0DFX2tlon3kxYmko7i?= =?iso-8859-1?q?xLktmPyKtqbgRpNiG?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f39451c-bd98-470c-49b1-08db88f06092 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 07:10:19.6718 (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: /aiazLIxuDq3z9yQZVss5F3pct/K9HTwicUSVVnoXI3zyBSmlLKlwHyxOMshlPBBY2yglbFwGBmL1C2ANlF3hg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8415 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "neil.armstrong@linaro.org" , "conor+dt@kernel.org" , "rfoss@kernel.org" , "krzysztof.kozlowski+dt@linaro.org" , "jonas@kwiboo.se" , "alexander.stein@ew.tq-group.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "jernej.skrabec@gmail.com" , "sam@ravnborg.org" , "jagan@amarulasolutions.com" , "robh+dt@kernel.org" , "Laurent.pinchart@ideasonboard.com" , "andrzej.hajda@intel.com" , "kernel@pengutronix.de" , dl-linux-imx Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To get better accuration, use pixel clock rate to calculate lbcc instead of lane_mbps since the pixel clock rate is in KHz while lane_mbps is in MHz. Without this, distorted image can be seen on a HDMI monitor connected with i.MX93 11x11 EVK through ADV7535 DSI to HDMI bridge in 1920x1080p@60 video mode. Signed-off-by: Liu Ying --- v1->v2: * No change. drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index c754d55f71d1..332388fd86da 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -762,8 +763,15 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi, u32 hcomponent) { u32 frac, lbcc; + int bpp; - lbcc = hcomponent * dsi->lane_mbps * MSEC_PER_SEC / 8; + bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); + if (bpp < 0) { + dev_err(dsi->dev, "failed to get bpp\n"); + return 0; + } + + lbcc = div_u64((u64)hcomponent * mode->clock * bpp, dsi->lanes * 8); frac = lbcc % mode->clock; lbcc = lbcc / mode->clock;