On Thu, Aug 14, 2025 at 10:41:04PM -0500, Nishanth Menon wrote:
> The driver knows exactly which version of the chip is present since
> the vid/pid is used to enforce a compatibility. Given that some
> devices like IT66121 has potentially been replaced with IT66122 mid
> production for many platforms, it makes no sense to use the vid/pid as
> an enforcement for compatibility. Instead, let us detect the ID of the
> actual chip in use by matching the corresponding vid/pid.
> 
> This also allows for some future compatibility to be checked only
> against a restricted set of vid/pid.
> 
> While at this, fix up a bit of formatting errors reported by
> checkpatch warning, and since the ctx info just requires the id, drop
> storing the entire chip_info pointer.

Separate commit, please. Don't mix unrelated changes into a single
patch. "While at it" usually means that it should be a separate patch.

> 
> Signed-off-by: Nishanth Menon <n...@ti.com>
> ---
> Changes in V3:
> * Converted the patch to lookup ID based on vid/pid match rather than
>   enforcing vid/pid match per compatible.
> * Squashed a formating fix for pre-existing checkpatch --strict warning
> 
> V2: https://lore.kernel.org/all/20250813204106.580141-3...@ti.com/
> 
>  drivers/gpu/drm/bridge/ite-it66121.c | 53 ++++++++++++++--------------
>  1 file changed, 27 insertions(+), 26 deletions(-)
> 
> @@ -1606,28 +1613,22 @@ static void it66121_remove(struct i2c_client *client)
>       mutex_destroy(&ctx->lock);
>  }
>  
> -static const struct it66121_chip_info it66121_chip_info = {
> -     .id = ID_IT66121,
> -     .vid = 0x4954,
> -     .pid = 0x0612,
> -};
> -
> -static const struct it66121_chip_info it6610_chip_info = {
> -     .id = ID_IT6610,
> -     .vid = 0xca00,
> -     .pid = 0x0611,
> +static const struct it66121_chip_info it66xx_chip_info[] = {
> +     {.id = ID_IT66121, .vid = 0x4954, .pid = 0x0612 },
> +     {.id = ID_IT6610, .vid = 0xca00, .pid = 0x0611 },
> +     { }
>  };
>  
>  static const struct of_device_id it66121_dt_match[] = {
> -     { .compatible = "ite,it66121", &it66121_chip_info },
> -     { .compatible = "ite,it6610", &it6610_chip_info },
> +     { .compatible = "ite,it66121", &it66xx_chip_info },
> +     { .compatible = "ite,it6610", &it66xx_chip_info },

Other than dropping the match data completely, please keep arrays
sorted.

>       { }
>  };
>  MODULE_DEVICE_TABLE(of, it66121_dt_match);
>  
>  static const struct i2c_device_id it66121_id[] = {
> -     { "it66121", (kernel_ulong_t) &it66121_chip_info },
> -     { "it6610", (kernel_ulong_t) &it6610_chip_info },
> +     { "it66121", (kernel_ulong_t)&it66xx_chip_info },
> +     { "it6610", (kernel_ulong_t)&it66xx_chip_info },
>       { }
>  };
>  MODULE_DEVICE_TABLE(i2c, it66121_id);
> -- 
> 2.47.0
> 

-- 
With best wishes
Dmitry

Reply via email to