[PATCH 07/39] drm/imx: dc: cf: Pass struct dc_subdev_info via OF match data
Frank Li
Frank.li at nxp.com
Mon Oct 13 10:01:02 PDT 2025
On Sat, Oct 11, 2025 at 06:51:22PM +0200, Marek Vasut wrote:
> Pass the struct dc_subdev_info as OF match data into the driver,
> so the driver can use the match data to correct map addresses to
> IDs. This is a preparatory patch for i.MX95 addition. No functional
> change.
>
> Signed-off-by: Marek Vasut <marek.vasut at mailbox.org>
Reviewed-by: Frank Li <Frank.Li at nxp.com>
> ---
> Cc: Abel Vesa <abelvesa at kernel.org>
> Cc: Conor Dooley <conor+dt at kernel.org>
> Cc: Fabio Estevam <festevam at gmail.com>
> Cc: Krzysztof Kozlowski <krzk+dt at kernel.org>
> Cc: Laurent Pinchart <Laurent.pinchart at ideasonboard.com>
> Cc: Liu Ying <victor.liu at nxp.com>
> Cc: Lucas Stach <l.stach at pengutronix.de>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Pengutronix Kernel Team <kernel at pengutronix.de>
> Cc: Rob Herring <robh at kernel.org>
> Cc: Shawn Guo <shawnguo at kernel.org>
> Cc: Thomas Zimmermann <tzimmermann at suse.de>
> Cc: devicetree at vger.kernel.org
> Cc: dri-devel at lists.freedesktop.org
> Cc: imx at lists.linux.dev
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-clk at vger.kernel.org
> ---
> drivers/gpu/drm/imx/dc/dc-cf.c | 23 +++++++++++++++++++----
> 1 file changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/imx/dc/dc-cf.c b/drivers/gpu/drm/imx/dc/dc-cf.c
> index 6cb83182a3668..1d3602c5d4230 100644
> --- a/drivers/gpu/drm/imx/dc/dc-cf.c
> +++ b/drivers/gpu/drm/imx/dc/dc-cf.c
> @@ -10,6 +10,7 @@
> #include <linux/mod_devicetable.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/regmap.h>
>
> #include "dc-drv.h"
> @@ -24,7 +25,13 @@
> #define CONSTANTCOLOR 0x10
> #define BLUE(x) FIELD_PREP(GENMASK(15, 8), (x))
>
> -static const struct dc_subdev_info dc_cf_info[] = {
> +struct dc_cf_subdev_match_data {
> + enum dc_link_id link_cf4;
> + enum dc_link_id link_cf5;
> + const struct dc_subdev_info *info;
> +};
> +
> +static const struct dc_subdev_info dc_cf_info_imx8qxp[] = {
> { .reg_start = 0x56180960, .id = 0, },
> { .reg_start = 0x561809e0, .id = 1, },
> { .reg_start = 0x561809a0, .id = 4, },
> @@ -32,6 +39,12 @@ static const struct dc_subdev_info dc_cf_info[] = {
> { /* sentinel */ },
> };
>
> +static const struct dc_cf_subdev_match_data dc_cf_match_data_imx8qxp = {
> + .link_cf4 = LINK_ID_CONSTFRAME4_MX8QXP,
> + .link_cf5 = LINK_ID_CONSTFRAME5_MX8QXP,
> + .info = dc_cf_info_imx8qxp,
> +};
> +
> static const struct regmap_range dc_cf_regmap_ranges[] = {
> regmap_reg_range(STATICCONTROL, CONSTANTCOLOR),
> };
> @@ -85,6 +98,8 @@ void dc_cf_init(struct dc_cf *cf)
>
> static int dc_cf_bind(struct device *dev, struct device *master, void *data)
> {
> + const struct dc_cf_subdev_match_data *dc_cf_match_data = device_get_match_data(dev);
> + const struct dc_subdev_info *dc_cf_info = dc_cf_match_data->info;
> struct platform_device *pdev = to_platform_device(dev);
> struct dc_drm_device *dc_drm = data;
> struct resource *res_pec;
> @@ -123,11 +138,11 @@ static int dc_cf_bind(struct device *dev, struct device *master, void *data)
> dc_drm->cf_cont[1] = cf;
> break;
> case 4:
> - cf->link = LINK_ID_CONSTFRAME4_MX8QXP;
> + cf->link = dc_cf_match_data->link_cf4;
> dc_drm->cf_safe[0] = cf;
> break;
> case 5:
> - cf->link = LINK_ID_CONSTFRAME5_MX8QXP;
> + cf->link = dc_cf_match_data->link_cf5;
> dc_drm->cf_safe[1] = cf;
> break;
> }
> @@ -157,7 +172,7 @@ static void dc_cf_remove(struct platform_device *pdev)
> }
>
> static const struct of_device_id dc_cf_dt_ids[] = {
> - { .compatible = "fsl,imx8qxp-dc-constframe" },
> + { .compatible = "fsl,imx8qxp-dc-constframe", .data = &dc_cf_match_data_imx8qxp },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, dc_cf_dt_ids);
> --
> 2.51.0
>
More information about the linux-arm-kernel
mailing list