Skip to content

Commit e36519f

Browse files
Pratap Nirujogialexdeucher
authored andcommitted
drm/amd/amdgpu: Initialize swnode for ISP MFD device
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. Reviewed-by: Mario Limonciello <[email protected]> Signed-off-by: Pratap Nirujogi <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 2becafc commit e36519f

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return
17231723
#endif
17241724

17251725
#if defined(CONFIG_DRM_AMD_ISP)
1726-
int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)[ACPI_ID_LEN]);
1726+
int amdgpu_acpi_get_isp4_dev(struct acpi_device **dev);
17271727
#endif
17281728

17291729
void amdgpu_register_gpu_instance(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ static int isp_match_acpi_device_ids(struct device *dev, const void *data)
15451545
return acpi_match_device(data, dev) ? 1 : 0;
15461546
}
15471547

1548-
int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)[ACPI_ID_LEN])
1548+
int amdgpu_acpi_get_isp4_dev(struct acpi_device **dev)
15491549
{
15501550
struct device *pdev __free(put_device) = NULL;
15511551
struct acpi_device *acpi_pdev;
@@ -1559,7 +1559,7 @@ int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)[ACPI_ID_LEN])
15591559
if (!acpi_pdev)
15601560
return -ENODEV;
15611561

1562-
strscpy(*hid, acpi_device_hid(acpi_pdev));
1562+
*dev = acpi_pdev;
15631563

15641564
return 0;
15651565
}

drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,23 +183,24 @@ static int isp_genpd_remove_device(struct device *dev, void *data)
183183

184184
static int isp_v4_1_1_hw_init(struct amdgpu_isp *isp)
185185
{
186+
const struct software_node *amd_camera_node, *isp4_node;
186187
struct amdgpu_device *adev = isp->adev;
188+
struct acpi_device *acpi_dev;
187189
int idx, int_idx, num_res, r;
188-
u8 isp_dev_hid[ACPI_ID_LEN];
189190
u64 isp_base;
190191

191192
if (adev->rmmio_size == 0 || adev->rmmio_size < 0x5289)
192193
return -EINVAL;
193194

194-
r = amdgpu_acpi_get_isp4_dev_hid(&isp_dev_hid);
195+
r = amdgpu_acpi_get_isp4_dev(&acpi_dev);
195196
if (r) {
196197
drm_dbg(&adev->ddev, "Invalid isp platform detected (%d)", r);
197198
/* allow GPU init to progress */
198199
return 0;
199200
}
200201

201202
/* add GPIO resources required for OMNI5C10 sensor */
202-
if (!strcmp("OMNI5C10", isp_dev_hid)) {
203+
if (!strcmp("OMNI5C10", acpi_device_hid(acpi_dev))) {
203204
gpiod_add_lookup_table(&isp_gpio_table);
204205
gpiod_add_lookup_table(&isp_sensor_gpio_table);
205206
}
@@ -241,6 +242,9 @@ static int isp_v4_1_1_hw_init(struct amdgpu_isp *isp)
241242
goto failure;
242243
}
243244

245+
amd_camera_node = (const struct software_node *)acpi_dev->driver_data;
246+
isp4_node = software_node_find_by_name(amd_camera_node, "isp4");
247+
244248
/* initialize isp platform data */
245249
isp->isp_pdata->adev = (void *)adev;
246250
isp->isp_pdata->asic_type = adev->asic_type;
@@ -269,6 +273,7 @@ static int isp_v4_1_1_hw_init(struct amdgpu_isp *isp)
269273
isp->isp_cell[0].num_resources = num_res;
270274
isp->isp_cell[0].resources = &isp->isp_res[0];
271275
isp->isp_cell[0].platform_data = isp->isp_pdata;
276+
isp->isp_cell[0].swnode = isp4_node;
272277
isp->isp_cell[0].pdata_size = sizeof(struct isp_platform_data);
273278

274279
/* initialize isp i2c platform data */

0 commit comments

Comments
 (0)