[PATCH] drm/amd/amdgpu: Initialize swnode for ISP MFD device
Nirujogi, Pratap
pnirujog at amd.com
Fri Jun 27 16:13:21 UTC 2025
Thanks Mario.
On 6/27/2025 11:55 AM, Mario Limonciello wrote:
> On 6/25/2025 5:09 PM, Pratap Nirujogi wrote:
>> Create amd_isp_capture MFD device with swnode initialized to
>> isp specific software_node part of fwnode graph in amd_isp4
>> x86/platform driver. The isp driver use this swnode handle
>> to retrieve the critical properties (data-lanes, mipi phyid,
>> link-frequencies etc.) required for camera to work on AMD ISP4
>> based targets.
>>
>> Signed-off-by: Pratap Nirujogi <pratap.nirujogi at amd.com>
> Reviewed-by: Mario Limonciello <mario.limonciello at amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 4 ++--
>> drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 11 ++++++++---
>> 3 files changed, 11 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/
>> amd/amdgpu/amdgpu.h
>> index 3f0b1fa590c6..7427986992d6 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -1718,7 +1718,7 @@ static inline bool
>> amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return
>> #endif
>> #if defined(CONFIG_DRM_AMD_ISP)
>> -int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)[ACPI_ID_LEN]);
>> +int amdgpu_acpi_get_isp4_dev(struct acpi_device **dev);
>> #endif
>> void amdgpu_register_gpu_instance(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/
>> drm/amd/amdgpu/amdgpu_acpi.c
>> index f5466c592d94..ae2d08cf027e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> @@ -1545,7 +1545,7 @@ static int isp_match_acpi_device_ids(struct
>> device *dev, const void *data)
>> return acpi_match_device(data, dev) ? 1 : 0;
>> }
>> -int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)[ACPI_ID_LEN])
>> +int amdgpu_acpi_get_isp4_dev(struct acpi_device **dev)
>> {
>> struct device *pdev __free(put_device) = NULL;
>> struct acpi_device *acpi_pdev;
>> @@ -1559,7 +1559,7 @@ int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)
>> [ACPI_ID_LEN])
>> if (!acpi_pdev)
>> return -ENODEV;
>> - strscpy(*hid, acpi_device_hid(acpi_pdev));
>> + *dev = acpi_pdev;
>> return 0;
>> }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c b/drivers/gpu/
>> drm/amd/amdgpu/isp_v4_1_1.c
>> index f857796f0297..a887df520414 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c
>> @@ -183,15 +183,16 @@ static int isp_genpd_remove_device(struct device
>> *dev, void *data)
>> static int isp_v4_1_1_hw_init(struct amdgpu_isp *isp)
>> {
>> + const struct software_node *amd_camera_node, *isp4_node;
>> struct amdgpu_device *adev = isp->adev;
>> + struct acpi_device *acpi_dev;
>> int idx, int_idx, num_res, r;
>> - u8 isp_dev_hid[ACPI_ID_LEN];
>> u64 isp_base;
>> if (adev->rmmio_size == 0 || adev->rmmio_size < 0x5289)
>> return -EINVAL;
>> - r = amdgpu_acpi_get_isp4_dev_hid(&isp_dev_hid);
>> + r = amdgpu_acpi_get_isp4_dev(&acpi_dev);
>> if (r) {
>> drm_dbg(&adev->ddev, "Invalid isp platform detected (%d)", r);
>> /* allow GPU init to progress */
>> @@ -199,7 +200,7 @@ static int isp_v4_1_1_hw_init(struct amdgpu_isp *isp)
>> }
>> /* add GPIO resources required for OMNI5C10 sensor */
>> - if (!strcmp("OMNI5C10", isp_dev_hid)) {
>> + if (!strcmp("OMNI5C10", acpi_device_hid(acpi_dev))) {
>> gpiod_add_lookup_table(&isp_gpio_table);
>> gpiod_add_lookup_table(&isp_sensor_gpio_table);
>> }
>> @@ -241,6 +242,9 @@ static int isp_v4_1_1_hw_init(struct amdgpu_isp *isp)
>> goto failure;
>> }
>> + amd_camera_node = (const struct software_node *)acpi_dev-
>> >driver_data;
>> + isp4_node = software_node_find_by_name(amd_camera_node, "isp4");
>> +
>> /* initialize isp platform data */
>> isp->isp_pdata->adev = (void *)adev;
>> isp->isp_pdata->asic_type = adev->asic_type;
>> @@ -269,6 +273,7 @@ static int isp_v4_1_1_hw_init(struct amdgpu_isp *isp)
>> isp->isp_cell[0].num_resources = num_res;
>> isp->isp_cell[0].resources = &isp->isp_res[0];
>> isp->isp_cell[0].platform_data = isp->isp_pdata;
>> + isp->isp_cell[0].swnode = isp4_node;
>> isp->isp_cell[0].pdata_size = sizeof(struct isp_platform_data);
>> /* initialize isp i2c platform data */
>
More information about the amd-gfx
mailing list