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 <[email protected]>

Reviewed-by: Frank Li <[email protected]>

> ---
> Cc: Abel Vesa <[email protected]>
> Cc: Conor Dooley <[email protected]>
> Cc: Fabio Estevam <[email protected]>
> Cc: Krzysztof Kozlowski <[email protected]>
> Cc: Laurent Pinchart <[email protected]>
> Cc: Liu Ying <[email protected]>
> Cc: Lucas Stach <[email protected]>
> Cc: Peng Fan <[email protected]>
> Cc: Pengutronix Kernel Team <[email protected]>
> Cc: Rob Herring <[email protected]>
> Cc: Shawn Guo <[email protected]>
> Cc: Thomas Zimmermann <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
>  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
>

Reply via email to