On 26-03-03, Liu Ying wrote:
> On Mon, Mar 02, 2026 at 05:10:41PM +0100, Marco Felsch wrote:
> > From: Liu Ying <[email protected]>
> >
> > NXP i.MX93 mediamix blk-ctrl contains one DISPLAY_MUX register which
> > configures parallel display format by using the "PARALLEL_DISP_FORMAT"
> > field. Add a DRM bridge driver to support the display format configuration.
> >
> > Signed-off-by: Liu Ying <[email protected]>
> > [[email protected]: port to v7.0-rc1]
> > [[email protected]: add review feedback (Alexander)]
> > [[email protected]: fix to short Kconfig description (checkpath)]
> > [[email protected]: use "GPL" instead of "GPL v2" (checkpatch)]
> > [[email protected]: add bus-width support]
> > Signed-off-by: Marco Felsch <[email protected]>
> > ---
> > drivers/gpu/drm/bridge/imx/Kconfig | 11 ++
> > drivers/gpu/drm/bridge/imx/Makefile | 1 +
> > drivers/gpu/drm/bridge/imx/imx93-pdfc.c | 225
> > ++++++++++++++++++++++++++++++++
> > 3 files changed, 237 insertions(+)
> >
>
> [...]
>
> > +static bool imx93_pdfc_bus_output_fmt_supported(const u32 fmt)
>
> As I mentioned in v9, can you drop const?
> I don't think const is needed.
It makes sense to spot failures early. Albeit this function is very
small, the fmt shouldn't be changed and therefore needs to be const.
I forgot to add the double space fix though, thanks.
> > +{
> > + int i;
> > +
> > + for (i = 0; i < ARRAY_SIZE(imx93_pdfc_bus_output_fmts); i++) {
> > + if (imx93_pdfc_bus_output_fmts[i] == fmt)
> > + return true;
> > + }
> > +
> > + return false;
> > +}
> > +
> > +static u32 *
> > +imx93_pdfc_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 imx93_pdfc *pdfc = bridge_to_imx93_pdfc(bridge);
> > + u32 *input_fmts;
> > +
> > + *num_input_fmts = 0;
> > +
> > + input_fmts = kmalloc_obj(*input_fmts, GFP_KERNEL);
>
> With the below two commits in v7.0-rc1, I believe that GFP_KERNEL can be
> dropped.
>
> bf4afc53b77a Convert 'alloc_obj' family to use the new default GFP_KERNEL
> argument
> e19e1b480ac7 add default_gfp() helper macro and use it in the new
> *alloc_obj() helpers
Will drop the GFP_KERNEL.
> > + if (!input_fmts)
> > + return NULL;
> > +
> > + *num_input_fmts = 1;
> > +
> > + if (!imx93_pdfc_bus_output_fmt_supported(output_fmt)) {
> > + dev_dbg(pdfc->dev, "No valid output bus-fmt detected, fallback
> > to MEDIA_BUS_FMT_RGB888_1X24\n");
> > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > + return input_fmts;
> > + }
> > +
> > + switch (output_fmt) {
> > + case MEDIA_BUS_FMT_RGB888_1X24:
> > + case MEDIA_BUS_FMT_RGB565_1X16:
> > + input_fmts[0] = output_fmt;
> > + break;
> > + case MEDIA_BUS_FMT_RGB666_1X18:
> > + case MEDIA_BUS_FMT_FIXED:
> > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > + break;
> > + }
> > +
> > + return input_fmts;
> > +}
> > +
> > +static int imx93_pdfc_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 imx93_pdfc *pdfc = bridge_to_imx93_pdfc(bridge);
> > + const u32 format = bridge_state->output_bus_cfg.format;
>
> Can you drop const?
No because this function is not supposed to change the format. The
function documentation says: this function can alter the bus_cfg.flags
bit _not_ the format.
Regards,
Marco
>
> --
> Regards,
> Liu Ying
>
--
#gernperDu
#CallMeByMyFirstName
Pengutronix e.K. | |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |