Re: [PATCH 07/11] i2c: nvidia-gpu: Replace ccgx to well-known regex

Jon Hunter
2022-11-01T15:12:56Z

On 24/10/2022 08:41, Wayne Chang wrote:
> ccgx is refer to the cypress cypd4226 typec controller.
> Replace ccgx to well-known regex "cypress".
>
> Signed-off-by: Wayne Chang <waynec@nvidia.com>
> ---
> drivers/i2c/busses/i2c-nvidia-gpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
> index 12e330cd7635..0934f8ad7f49 100644
> --- a/drivers/i2c/busses/i2c-nvidia-gpu.c
> +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
> @@ -260,7 +260,7 @@ MODULE_DEVICE_TABLE(pci, gpu_i2c_ids);
>
> static const struct property_entry ccgx_props[] = {
> /* Use FW built for NVIDIA (nv) only */
> - PROPERTY_ENTRY_U16("ccgx,firmware-build", ('n' << 8) | 'v'),
> + PROPERTY_ENTRY_U16("cypress,firmware-build", ('n' << 8) | 'v'),
> { }
> };
>

Could we change this to be PROPERTY_ENTRY_STRING instead of
PROPERTY_ENTRY_U16? The benefit of this would be to allow us to use a
proper string identifier in device-tree for the Tegra devices which is
more flexible and descriptive.

So given that this is for NVIDIA GPUs, we could simply make this ...

PROPERTY_ENTRY_STRING("cypress,firmware-build", "nvidia,gpu"),

Then in the ucsi_ccg.c driver, when we read the device property
"cypress,firmware-build", if it is 'nvidia,gpu' then we set the
uc->fw_build variable to CCG_FW_BUILD_NVIDIA.

Jon

--
nvpublic