[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3d622f3c-ddd4-4feb-bc88-a1eea7dd936d@oss.nxp.com>
Date: Fri, 14 Nov 2025 18:03:06 +0800
From: Liu Ying <victor.liu@....nxp.com>
To: Marek Vasut <marek.vasut@...lbox.org>, Liu Ying <victor.liu@....com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Dmitry Baryshkov <lumag@...nel.org>
Cc: dri-devel@...ts.freedesktop.org, devicetree@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Frank Li <Frank.Li@....com>
Subject: Re: [PATCH v4 07/14] drm/imx: dc: Add DPR channel support
On 11/09/2025, Marek Vasut wrote:
> On 11/4/25 8:18 AM, Liu Ying wrote:
>
> Hello Liu,
Hello Marek,
>
>>>>>> +++ b/drivers/gpu/drm/imx/dc/Kconfig
>>>>>> @@ -1,6 +1,7 @@
>>>>>> config DRM_IMX8_DC
>>>>>> tristate "Freescale i.MX8 Display Controller Graphics"
>>>>>> depends on DRM && COMMON_CLK && OF && (ARCH_MXC || COMPILE_TEST)
>>>>>> + depends on IMX_SCU
>>>>> Can the SCU dependency be made optional,
>>>>
>>>> I don't think this can be done. If you grep 'depends on IMX_SCU' in
>>>> kernel, you may find a handful of existing dependancies.
>>>
>>> Sure, I do not dispute this part.
>>>
>>> But the SCU dependency can be contained in a component of this driver,
>>> which is not used by MX95, and used only by MX8Q . Then there will be
>>> no problem.
>>
>> Which component? You mean PRG and DPRC?
>>
>> If we add something like CONFIG_DRM_IMX8_DC_PRG and make CONFIG_DRM_IMX8_DC_PRG
>> depend on SCU, then should we make CONFIG_DRM_IMX8_DC depend on
>> CONFIG_DRM_IMX8_DC_PRG? That's yet another dependency.
>
> I would say, if possible, put the SCU-dependent parts behind
> CONFIG_DRM_IMX8_DC_PRG symbol, and make that symbol configurable via
> Kconfig . Users of iMX95-only can turn it off, generic kernel config
> should keep it on.
Both i.MX8 and i.MX95 would use arm64 defconfig. Most distros if not all
would use that to generate a single kernel image + modules for i.MX8 and
i.MX95. We can't presume that __most__ users would change the configs
for i.MX95.
>
>>>>> or per-module,
>>>>
>>>> Well, DRM_IMX8_DC(for the imx8_dc_drm module) depends on IMX_SCU just as
>>>> this patch does.
>>>
>>> I assume it shouldn't have to, because the SCU dependency is only relevant
>>> for the prefetch engine ?
>>
>> The SCU dependency is only relevant for the prefetch engine, agreed.
>> But, how to avoid the dependency?
>
> How about containing the SCU parts in a single file and put it behind a
> Kconfig symbol ? The common code can call the SCU parts and they would
> either use SCU (on MX8QXP) or do nothing (on MX95) . It should even be
> possible to discern this at runtime.
I'm not a big fan of a Kconfig symbol for the SCU parts.
To me, any code path which would run on i.MX95 should not call any function
in that single file for the SCU parts. That's really confusing because
i.MX95 has nothing to do with the SCU.
>
>>>>> or somehow abstracted out (via regmap?),
>>>>
>>>> Like I replied to your i.MX95 DC patch series's cover letter, SCU accesses
>>>> registers via Cortex-M core instead of Cortex-A core IIUC. I really don't
>>>> know how to abstract IMX_SCU out, especially via regmap.
>>>
>>> The simplest way would be to use regmap_config .reg_read and .reg_write ,
>>> if there is no better way.
>>
>> Can you shed more light on this? Any examples?
>
> I'll just reply to this part, because that is probably the most relevant
> to this whole conversation.
>
> git grep '\.reg_write' drivers -> drivers/hwmon/aspeed-pwm-tacho.c as a
> simple example.
>
> Then such a reg_write implementation can do:
>
> if (SCU)
> use SCU accessor
> else
> use writel() or so
Thanks for the example, it makes regmap idea a bit more clear. But, how
would you pass the SCU flag to .reg_write? I hope i.MX95 code path won't
see any information about SCU.
Also, IMO, wrapping SCU with regmap is abusing the regmap API.
How would you pass the resource, ctrl and val parameters to .reg_write?
int imx_sc_misc_set_control(struct imx_sc_ipc *ipc, u32 resource,
u8 ctrl, u32 val)
Regarding the 'else' clause, I don't think we can use writel(), because
SCU accesses registers via Cortex-M core, not Cortex-A core(I mentioned
this before). I don't see anything we can put under the 'else' clause.
>
>>>>> so iMX95 support can be added into the driver easily too ?
>>>>
>>>> Like I replied to your i.MX95 DC patch series, I think i.MX95 DC support
>>>> can be in drivers/gpu/drm/imx/dc, but it should be in a separate module
>>>> (something like imx95_dc_drm) plus an additional common module(like
>>>> imx_dc_drm_common).
>>> This design part is something I do not fully understand. Sure, it can be
>>> two modules, but in the end, the result would have to be capable of being
>>> compiled into single kernel binary if both modules would be =y in Kconfig
>>> anyway.
>>
>> This is something like imx8qm_ldb, imx8qxp_ldb and imx_ldb_helper modules -
>> DRM_IMX8QM_LDB and DRM_IMX8QXP_LDB select DRM_IMX_LDB_HELPER.
>>
>> Note you may make CONFIG_DRM_IMX8QM_LDB=y and CONFIG_DRM_IMX8QXP_LDB=m with
>> CONFIG_DRM_IMX_LDB_HELPER=y.
> Do we have to make it this complicated right from the start ?
I don't think imx_dc_drm_common would make it complicated, but instead it
makes drivers simple and easy to maintain.
> Maybe we can start simple, with one module, and then split it up if it turns
> out to be unsuitable ?
Hmm, maybe it's time to split it up now, because:
1) Your below patch has already been adding DB to CRTC function.
See dc_db_shdtokgen() in dc_crtc_atomic_enable(), which certainly breaks
i.MX8 DC. To avoid that, you'll add branches to the atomic enable
callback, which is something I don't want.
https://patchwork.freedesktop.org/patch/680085/?series=155784&rev=1
2) This patch series is trying to add i.MX8 DC prefetch engine support.
i.MX95 really doesn't embed the prefetch engine. And I hope i.MX95 code
path doesn't need to know the prefetch engine/SCU existence or non-existence.
--
Regards,
Liu Ying
Powered by blists - more mailing lists