From patchwork Wed Oct 18 03:52:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13426261 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 3E96CCDB47E for ; Wed, 18 Oct 2023 03:48:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA47810E363; Wed, 18 Oct 2023 03:48:56 +0000 (UTC) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2070.outbound.protection.outlook.com [40.107.6.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB6C010E363 for ; Wed, 18 Oct 2023 03:48:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bv4V3R2YYbww4iM2CnGJVFwCdRyXNeMXL8/mzdjuLqQw1S5UXLut6qE/X37ysGzuh/S1FJw3+7iVxf6vkrjY4WQjkmEfpfx/WRQa8a8WdBc4VEKHBTBUNHET8SAZAU02STw1hzH0QzZg6v93b4t4Jy/eQ/g7farIt+rtyAsQvYKrxnxxwNvtqw/sq2yN50hoCFyRUp1HMhdR/5JEP7J4mOMKUg8Psl36BV6Wk1AqMN9XM+4H5GP6IKqxnXrwgnKCNZ0BqU+WmEG08gah/JOskmw0aDlV1G7CTFWM7E9S6kBMIAVVXa4OBLcrsxBsgzzVz9447/xXpczpi5yv3LY3Aw== 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=hdJNJz9rHbiULH7P/zXLw3++ML7Z4vI7lThi51JNY2s=; b=a1KmDSVMMv49ZzSRXr+8wXY4QaDuVrodgNBbuCCERlBcxOG80todKQ4/81GgV8BHvGevNsT4vhFZfk+t/sfmX2Y2wKwrynmJcEDsTBOworX/CGroXUT57/WcBBZ0pNBrE7kulwH0lp2lC+GLUaiXkcXuoRMTQTZm99fLagt1fP2UbkszwVoJOHLfQKYEhKgSkogmCge2EPWd5kc0MtvP1uMoTM/LkIP1IkbHNo6rJdyBgwiRQqndHC/hBORCRbcqcA15Wp3tA2YAHp4PTzmNNbrF2h/jdsqbrpWrQeIyUHny3cooOw9+lqUQL7pk6bqrPOFIoUpHfFSurrNEqFMSCQ== 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=hdJNJz9rHbiULH7P/zXLw3++ML7Z4vI7lThi51JNY2s=; b=HKm5uqjZIAky83JVZk/QZ8oiVIf0BkhWhfN4kRNCdewxQNHs7chrjHEuZ3n1AahXIlvBresb5u9oNgNlnn/DgfljYIyX5aBEblrrP+ybKeQeLQSC5km1s0QwnUKeOxQtZ7ANYkdzlrT/N5QaS1hHfcBXcAlllBF75XCSQOPg7GE= 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 DB9PR04MB9913.eurprd04.prod.outlook.com (2603:10a6:10:4c4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 03:48:51 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::1ace:f566:c57a:7d4b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::1ace:f566:c57a:7d4b%3]) with mapi id 15.20.6907.022; Wed, 18 Oct 2023 03:48:50 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/bridge: synopsys: dw-mipi-dsi: Fix hcomponent lbcc for burst mode Date: Wed, 18 Oct 2023 11:52:12 +0800 Message-Id: <20231018035212.1778767-1-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 X-ClientProxiedBy: SI1PR02CA0041.apcprd02.prod.outlook.com (2603:1096:4:1f6::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_|DB9PR04MB9913:EE_ X-MS-Office365-Filtering-Correlation-Id: 39d3e453-e4b4-4272-7875-08dbcf8d23ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +4+tbo0gyifmDTvROT13C16wO3LFDQ9uruRxQyjMrEnQT2L2hGAQfviFaEZ4TEQnFTIVToEQqdZXj4a/Hrzep3qicBiopFYtC/CkWzvGfxc7tK5Fm9wkXRgWWruJaW2GSCQa+d2AAdyCNZjAzIUE/WJrsTsFBclICVTF4DFlR8FbcTq1iG3K2UBpzIsQiwgQ4pWxAKKaXc2RtKwj6BiFW5i2TKuO32WaKc/RpU0uuyqVfJMHcZ2kjeRF3MwxL/pYyrPeuabzAC9/y0S3bvP/TNQhz3SyBHjpkZKb/LIxJZMk3L9JQCcYPnXvTT1akUUqOdMG0RT4T11uVc9bI6T8811IhxP7znpEnS7+27MCsDqb8gskL+VpxUSwgbU+QC6naBXqiCXsCbPqdjYg8ojGUMLqbCosFYEtQdMPmB/bVguRIx+iCAPwgpud/an4Tsj9HyB2bH2axADM7BGU06sgGdyJcUoheW/saWC/WucHFPe9BnwAlOe+F41DNvNhL214EsqxXvQawLkk3gNh1PU7naTeVkjE+eqhxy60UfbNutiswnj5aytgl5ZYLYVm4g+p/psq+4RCSL5LUDKniQJUMQ04hyM/d3DMAB/8HVBPE7c= 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:(13230031)(366004)(136003)(346002)(39860400002)(396003)(376002)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6512007)(36756003)(38350700005)(66476007)(66946007)(6916009)(316002)(66556008)(86362001)(1076003)(38100700002)(52116002)(83380400001)(26005)(6506007)(6486002)(2616005)(6666004)(966005)(66574015)(8676002)(8936002)(2906002)(478600001)(41300700001)(7416002)(5660300002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Ka/eP91ayba7U7US/CDgCGwC19wQ?= =?utf-8?q?igrTmOf/72EW++HPdRfiIQ2nW9j/TIR8MPcR4eM3+C54G27dwzJYanfEKDf1NWx0D?= =?utf-8?q?PP342bKB167S0HAEFrOUMViuI9nEks/aDbMF50Kazg6J+lcHBfVic0xgS15N0QWjx?= =?utf-8?q?FDTMvuDixq2ZL7gIgi0ekgzSL+aWfhdl/xxZeIw+bpmgGwnzEJ1aHkAqDJS2Ig2UI?= =?utf-8?q?c4wB5wUv4Y/Udfq4OXJdVU1MeilkNYhTZpVCIb/NM9lIFFghvr4mBTDZBtAKZRKqc?= =?utf-8?q?zjO2fXUHmlTF+5OtVwcRKi/5naYanxWB+HvNwNFlQH5/xEAG+kHleZIpGZ7CG42mR?= =?utf-8?q?NsaRrCXBpgVm7vwTINqD84OizIVWSSZOk7B5d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LWx5GfEo4Eeh9eqXmhqDnpp?= =?utf-8?q?rZ7TejtRkrJh1lSoLTVa3rBKyqh1fl971CKvGd+xZxm7rYxRCU55NmPnLeo9XoZQp?= =?utf-8?q?wKqXfzJn9urIR6PqsLGohJrbCcszEyi7CRSh5GTiiKpmDMlK31v61xiGu7VP1auuq?= =?utf-8?q?kSx1oGmKMEKRyPepOUkZ9VPrbUJGEn0yZMs/hj+7oiyHRQ00suVfscYY55KXXhfua?= =?utf-8?q?l6sVyEBddZ9eNvwm3N0J8SLWhhwR6w7sFPiyip1WvorZYPBJ7GYWdDlfdBxf+GiYN?= =?utf-8?q?tE7SFpaZ1lCN?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39d3e453-e4b4-4272-7875-08dbcf8d23ff X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 03:48:50.7050 (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: ulvgIVdpuqci6N/i2vSEQ0yZItp/HDNN1sDDr3XiRsLxrxzFUUapTBaMSdsQHIsLlAc3GluynamOIhNM2Xkgkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9913 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: mripard@kernel.org, neil.armstrong@linaro.org, rfoss@kernel.org, tzimmermann@suse.de, jonas@kwiboo.se, yannick.fertre@foss.st.com, raphael.gallais-pou@foss.st.com, hjc@rock-chips.com, jernej.skrabec@gmail.com, Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, zyw@rock-chips.com, philippe.cornu@foss.st.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In order to support burst mode, vendor drivers set lane_mbps higher than bandwidth through DPI interface. So, calculate horizontal component lane byte clock cycle(lbcc) based on lane_mbps instead of pixel clock rate for burst mode. Fixes: ac87d23694f4 ("drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc") Reported-by: Heiko Stübner Closes: https://lore.kernel.org/linux-arm-kernel/5979575.UjTJXf6HLC@diego/T/#u Tested-by: Heiko Stübner # px30 minievb with xinpeng xpp055c272 Signed-off-by: Liu Ying --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 8789eca26188..824fb3c65742 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -774,13 +774,19 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi, u32 frac, lbcc, minimum_lbcc; int bpp; - bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); - if (bpp < 0) { - dev_err(dsi->dev, "failed to get bpp\n"); - return 0; - } + if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) { + /* lbcc based on lane_mbps */ + lbcc = hcomponent * dsi->lane_mbps * MSEC_PER_SEC / 8; + } else { + /* lbcc based on pixel clock rate */ + 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); + lbcc = div_u64((u64)hcomponent * mode->clock * bpp, dsi->lanes * 8); + } frac = lbcc % mode->clock; lbcc = lbcc / mode->clock;