From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011001.outbound.protection.outlook.com [40.107.130.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4672E55199E; Thu, 17 Sep 2026 14:24:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.130.1 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789655089; cv=fail; b=F99C8e7XZS9DfBXQQfS/GUr+QLTdvEokQSZibXquT7oUl+7vs5Rg318KNqw5j1ESGM55DuE2iIkvi3zDhqYm/aw4GN5yKepzL37G1Mes2n5ZgPNXxoxtPE4M5kty4eaUJQfOmZYnFneaiDjRvpzjZZ5ptx4jGK2N7l3Z7PHF5CE= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789655089; c=relaxed/simple; bh=by+v2SVB4Pd4TFB6yM+iL+GlEdwkXHl19XZhOmcE+Zk=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=tIqj7uVjSz2mphrGp3XxzhA398ukpDJ5jSEBEdUnmwJPRGXPkgdy1vlPkxsRV/q+cjBpcemskj8gaGpzJ+BtJG3zXRnhNOL1/F8TqIcyfdX2PEPE4Ymzr1zZKjvGfZKUoJMXnqtkISFW2FRyJUstpRY0qxO+tS2yMIfQB9LYh78= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=iy3mhe7+; arc=fail smtp.client-ip=40.107.130.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="iy3mhe7+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rTUIAu/NQUI3hEkTCBHq9JUpbI143x2cxUEFB6CHysOwywypcg57Zif/Sxn2XGbD7xpf/rhdOGBNB+44noVEnMpl7dbYATAuD8oFNoMyrISgNvKYempj8Mt7C0P6ge+wB8m4TyclnUg7nlT5wyvKCfsX1pYTwwQ54VGaR559awA7qJGyMT2gKpVCEK0BgQ9OdX0PJy5dF7gQ2rSYGot8w8Ir9cWbPJgxQLfBmOPWMq68RJukColNP3xssQr6vL+QRohdnptz/jWVx904pq+tp5+mhKz4n4M4xBVYq7SYNjCEinFLEDpWSSVsu1wzIYVdJDDh2i13aUC20ZHEWBoWWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=aF3K/0Ps+QwSicPEWcXZ9rL6zIZXbd5WKY8sDsDWoKk=; b=twfXlL5ZXw2MKr03QVDtJfrRaEPeAGdTa2V3+IPdXB33AQDknrTU1mo+TsS/EuJXnQdVHjAhTxscnpyyBwez6tv/oVAHxYq8xwfPL4XtZcO/MpzfDdAmjoqLeDUALfu68Sq36w0TMmam9BWmET8qJgZ9xIQffmp/RysFyV1LzrJNxmumSJAQK+excwfP7LjqUx3nv5eQz8It8tVrBFBEoWeTXO6CeMISzFRUmEfjRRgQAKs7+pj/266WrCzHCPH+cYGrNDmTjf7TRZRfSO09wdY1204FqPiYl3aMyV3ga/CjOPJTzrKx4aUhA55neJOICbwBNhaU/7XVnlg5Q8vXWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aF3K/0Ps+QwSicPEWcXZ9rL6zIZXbd5WKY8sDsDWoKk=; b=iy3mhe7+k4TFT/omdXEn+pkNctgrfHwXJ8KsedlnoW9qG1AH5aJQy6hK2uP0YQci4svckNJpOYwrZ2DFb9+JG3eeXBI6tmY5vqg527bwtHo2WHQL8kVAHXahatM8gA/IkSlPyHH/2/xynyFnISwXStzQxTmycG/BiDLCTpzRJVQCkWYUey5DbCPXK3QLQ/tLYg83WfoKUvQHttPOe+wTmXkYfY6WxhgrLA8lP9OiAowTwXbS+PgGMmzzTTu1uB48Z6lr0iSPOMGRfcPqAJJVbGhNMA1m76Jn7QGO0TFMe2IVN7OnyrX5yPo7RB0sqIDqSfW55dkwSS6UaIJJqwoTzg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) by AM9PR04MB7684.eurprd04.prod.outlook.com (2603:10a6:20b:287::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.12; Thu, 17 Sep 2026 14:24:42 +0000 Received: from GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c]) by GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c%7]) with mapi id 15.21.0406.012; Thu, 17 Sep 2026 14:24:42 +0000 Date: Thu, 17 Sep 2026 09:24:30 -0500 From: Frank Li To: Francesco Dolcini Cc: Marek Vasut , Stefan Agner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Francesco Dolcini , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Andrzej Hajda , Neil Armstrong , Robert Foss , Alexander Stein Subject: Re: [PATCH v5 2/4] drm: mxsfb: Add optional DPI output bus-width configuration Message-ID: References: <20260917140042.118181-1-francesco@dolcini.it> <20260917140042.118181-3-francesco@dolcini.it> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260917140042.118181-3-francesco@dolcini.it> X-ClientProxiedBy: PH0P220CA0017.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::24) To GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV2PR04MB11799:EE_|AM9PR04MB7684:EE_ X-MS-Office365-Filtering-Correlation-Id: 7be9f981-c42b-4841-e8b6-08df14c76a29 X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|1800799024|19092799006|376014|7416014|4143699003|10067099003|11063799006|22082099003|18002099003|56012099006|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: sCZTTP4JzqRdB/84WJl/MrWB3U1Bk26UrvrYwZW/RnKD1vwPKDY9FqXjnO07nPEV3scsEOnSyFqK1gqeJQ7W35wdnGcXeSIJOm64eTgVftegDzCDBh9sOvWWGsipvIHWvpEmbdpQd9LxvZTwCvIZSoCsXObIFJ2FpvnLNmkAhwxuKSf1GYPT7F137kMTk0iwx3sKhg0DL0Oi/nXR0TBMsy+++Xij6Oj7uWr0iDdwW6+tQ4m+tJATS06J+nTaERb8tp6X18BRS3CQA/hvXh4EphFtIbC7IG3Idv5XszfcbMdoMAIGkC2X3JS4CAQ2HFcZDmVaNrxZGxC85RUUMql4/CvRIl6vntZmpsTBs4e92Tpc6uEj7HNcnfGIAhNLnXgpE+i13Y5LgtrDWwHT+2q/EhPbfKENO2+feNX903Kf28oj4BwB05knjPIYSbiIr+TGm6oOprsGFWt23+3OajB7nMJw5ImJufmsRhXVp0pSrGBoL+s5t7AEK2jL7q2VSXjKuEL0Pe9Dx9xzZtkeOgwHUCMpxRpxFeNyXT1OcsV0Zn68noxCD0NMqZwWot92nS9jH4jifuDJt9ZoyWXvm/hjenxL/iKjZQOJjws1JXuvC+lBH2aClzmv7hHKhj/TcgWU7atIECvtrFIA39ghkWrc/kTwnB6Mg5AvGM6Bwvrc5A4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV2PR04MB11799.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(1800799024)(19092799006)(376014)(7416014)(4143699003)(10067099003)(11063799006)(22082099003)(18002099003)(56012099006)(6133799003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?eFXX3L6EBM9yhlbZPfV4kWJhC9eduUW3J9e4X0eXbWxy6WlqE2BLR7kNJJW2?= =?us-ascii?Q?aKjszkS2olCBGBGVZmMWe8QoSGaXcTAS2qbguV90URyfJ5ueF0Td1r31rYjS?= =?us-ascii?Q?QA2O442XNH9asEoDbjvQmwBcOZyEidw3Vn5rwhybmFX9wD7ZFeYeSLqC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xw+Q4QL5y2mCOl8k1HWQ7HxGb4gmIywsnCVtZF6jy1A5?= =?us-ascii?Q?EjBxV6CD4O/C6wHtJuny+8XbmeKVwW3rqpRBVaJw/1Z7cJg01PNLnLZ+zIwS?= =?us-ascii?Q?z1UUvFYNCOz/kAnTS3/8kC7+DZhVxL7dNLXqTPrxJvTwRF/BQ2ouIhEcwTCN?= =?us-ascii?Q?RU3MobjwG1F7UXtwj4E5qdaOaa+b7KUT6FiyzTvkCg2lMVwlhkxSPhZRItGL?= =?us-ascii?Q?muA2mBAtw0DOPnlzLVSqR6ireRhFOcrPe2frZLh1s9Vm5sVRccSetaisgkpf?= =?us-ascii?Q?Tke5xCvI8Aa/UToFWSUzVvF+PpFypzaW8ZG4xi4RcxNA/371/8I75TIqjSGw?= =?us-ascii?Q?uQcLKHDfta0+jSOyPy1ggLhG9koHCizBGoGud8ZWZdcnq1xJQRE5QwbmZCJC?= =?us-ascii?Q?uccw5O/nSEm6bMuTx2xKg0dJrXGkPuIgy97aYh3kA3lKjmqbCGZQzl+bOp8/?= =?us-ascii?Q?fFZmzjOoGyBVhO5XY2vwQACY3q3YNazLTH+FVTuUqE7cvsSChSF8H4f3Bdmz?= =?us-ascii?Q?W0lObvQi1QNdQ4zkdyIBGxMI4JozZI+UYtqcFBAwb3sRQoo92+2WPanuswZB?= =?us-ascii?Q?kfTPTMXBGOnUqWes+LlIi3gPBTKtynbG52SwnMkloiejczitrXPGc5FLES1N?= =?us-ascii?Q?tSbfOEIljeFt3jICCQGzXTM+PAMSab4tD9y9ZAHwMBYlV97jCfmyOcZ0rOp4?= =?us-ascii?Q?6djwfeNprjy3UOG3LonHYei7KvOYoQfzDMo67r9AhAwgV8vMO69Q?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7be9f981-c42b-4841-e8b6-08df14c76a29 X-MS-Exchange-CrossTenant-AuthSource: GV2PR04MB11799.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2026 14:24:42.5343 (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: 6E4EguQP34AC9wAFvbqhjFvK1t8sjn10N4u/ZWzAeo9KN2N8evdB68yqqbaQvAo5VZRTlO0FvFJTFMbnhKLjzRyG53icFngWJQ14Fcky/S9SLF+aCMQUCPIEvxBET8xM X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7684 On Thu, Sep 17, 2026 at 04:00:37PM +0200, Francesco Dolcini wrote: > From: Francesco Dolcini > > LCDIF programs LCD_DATABUS_WIDTH from the selected media bus format. The > format reported by the downstream panel or bridge describes the display > input, but it does not describe how the LCDIF data pins are physically > wired on the board. > > These can differ. For example, a 16-bit LCDIF bus can be connected to a > 24-bit display by wiring the available color bits to the corresponding > display inputs. In that case, using the display's 24-bit format to > configure LCDIF selects the wrong data-bus mode and changes the assignment > of color bits on the LCD_DATA pins. > > Read the optional bus-width endpoint property from the LCDIF output port > and use it to select the media bus format used to configure LCDIF. This > allows the LCDIF bus mode to describe the physical interface > independently of the downstream display format. > > When the property is absent, continue using the format reported by the > downstream display device, preserving the previous behavior. The > devicetree binding restricts bus-width to 16, 18 or 24; any other value > means the devicetree is broken, so fail the probe instead of silently > falling back to the previous behavior. > > Signed-off-by: Francesco Dolcini Reviewed-by: Frank Li > --- > v5: fail probe on invalid bus-width instead of falling back to the > previous behavior; factor the property parsing into its own > mxsfb_of_bus_fmt() helper. Drop the r-b/t-b tags below since they > were given for the previous silent-fallback behavior and for a > different code shape; needs re-review. > v4: add r-b and t-b tags > v3: improve commit message and make it clear that the code assumes that > the DT is correct, when the DT contains an invalid property value, > the code safely fall-back to the previous behavior > v2: use the common bus-width property instead of the legacy interface-pix-fmt > > Dropped for v5: > Reviewed-by: Frank Li > Reviewed-by: Alexander Stein > Tested-by: Alexander Stein # TQMa6UL[L]x > --- > drivers/gpu/drm/mxsfb/mxsfb_drv.c | 43 +++++++++++++++++++++++++++++++ > drivers/gpu/drm/mxsfb/mxsfb_drv.h | 2 ++ > drivers/gpu/drm/mxsfb/mxsfb_kms.c | 12 +++++++++ > 3 files changed, 57 insertions(+) > > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c > index 8b4a500347fb..641691fc92c8 100644 > --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c > +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c > @@ -12,7 +12,10 @@ > #include > #include > #include > +#include > #include > +#include > +#include > #include > #include > #include > @@ -207,11 +210,41 @@ static void mxsfb_irq_uninstall(struct drm_device *dev) > free_irq(mxsfb->irq, dev); > } > > +static int mxsfb_of_bus_fmt(const struct device_node *ep, u32 *bus_format) > +{ > + u32 bus_width; > + int ret; > + > + ret = of_property_read_u32(ep, "bus-width", &bus_width); > + if (ret == -EINVAL) > + return 0; > + if (ret) > + return ret; > + > + switch (bus_width) { > + case 16: > + *bus_format = MEDIA_BUS_FMT_RGB565_1X16; > + break; > + case 18: > + *bus_format = MEDIA_BUS_FMT_RGB666_1X18; > + break; > + case 24: > + *bus_format = MEDIA_BUS_FMT_RGB888_1X24; > + break; > + default: > + return -EINVAL; > + } > + > + return 0; > +} > + > static int mxsfb_load(struct drm_device *drm, > const struct mxsfb_devdata *devdata) > { > struct platform_device *pdev = to_platform_device(drm->dev); > + struct device_node *np = pdev->dev.of_node; > struct mxsfb_drm_private *mxsfb; > + struct device_node *ep; > int ret; > > mxsfb = devm_kzalloc(&pdev->dev, sizeof(*mxsfb), GFP_KERNEL); > @@ -238,6 +271,16 @@ static int mxsfb_load(struct drm_device *drm, > if (IS_ERR(mxsfb->clk_disp_axi)) > mxsfb->clk_disp_axi = NULL; > > + ep = of_graph_get_next_endpoint(np, NULL); > + if (ep) { > + ret = mxsfb_of_bus_fmt(ep, &mxsfb->bus_format); > + of_node_put(ep); > + if (ret) { > + dev_err(drm->dev, "Invalid bus-width endpoint property\n"); > + return ret; > + } > + } > + > ret = dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32)); > if (ret) > return ret; > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h > index d160d921b25f..bdc47ce5be79 100644 > --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h > +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h > @@ -46,6 +46,8 @@ struct mxsfb_drm_private { > struct drm_connector *connector; > struct drm_bridge *bridge; > > + u32 bus_format; > + > bool crc_active; > }; > > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c > index d8ebebc5314b..1d78c486d147 100644 > --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c > +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c > @@ -386,6 +386,18 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, > if (!bus_format) > bus_format = MEDIA_BUS_FMT_RGB888_1X24; > > + /* > + * Prefer the bus format derived from the OF graph endpoint "bus-width" > + * property when available. Otherwise, use the bus format reported by > + * the downstream bridge or panel. > + * > + * This supports mismatched display and interface bus widths, such as > + * a 24-bit panel connected through an 18-bit interface or an 18-bit > + * panel connected through a 24-bit interface. > + */ > + if (mxsfb->bus_format) > + bus_format = mxsfb->bus_format; > + > mxsfb_crtc_mode_set_nofb(mxsfb, bridge_state, bus_format); > > /* Write cur_buf as well to avoid an initial corrupt frame */ > -- > 2.47.3 > >