Commit 98d19a6c authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher

drm/amd: Convert USB-C PD F/W attributes into groups

Rather than special casing the creation of the file, special case
the visibility to the supported dGPUs.
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1cc506f0
...@@ -45,9 +45,6 @@ ...@@ -45,9 +45,6 @@
#define AMD_VBIOS_FILE_MAX_SIZE_B (1024*1024*3) #define AMD_VBIOS_FILE_MAX_SIZE_B (1024*1024*3)
static int psp_sysfs_init(struct amdgpu_device *adev);
static void psp_sysfs_fini(struct amdgpu_device *adev);
static int psp_load_smu_fw(struct psp_context *psp); static int psp_load_smu_fw(struct psp_context *psp);
static int psp_rap_terminate(struct psp_context *psp); static int psp_rap_terminate(struct psp_context *psp);
static int psp_securedisplay_terminate(struct psp_context *psp); static int psp_securedisplay_terminate(struct psp_context *psp);
...@@ -462,13 +459,6 @@ static int psp_sw_init(void *handle) ...@@ -462,13 +459,6 @@ static int psp_sw_init(void *handle)
} }
} }
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7)) {
ret = psp_sysfs_init(adev);
if (ret)
return ret;
}
ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG, ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
amdgpu_sriov_vf(adev) ? amdgpu_sriov_vf(adev) ?
AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT, AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
...@@ -520,10 +510,6 @@ static int psp_sw_fini(void *handle) ...@@ -520,10 +510,6 @@ static int psp_sw_fini(void *handle)
amdgpu_ucode_release(&psp->cap_fw); amdgpu_ucode_release(&psp->cap_fw);
amdgpu_ucode_release(&psp->toc_fw); amdgpu_ucode_release(&psp->toc_fw);
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
psp_sysfs_fini(adev);
kfree(cmd); kfree(cmd);
cmd = NULL; cmd = NULL;
...@@ -3705,6 +3691,7 @@ static DEVICE_ATTR(psp_vbflash_status, 0440, amdgpu_psp_vbflash_status, NULL); ...@@ -3705,6 +3691,7 @@ static DEVICE_ATTR(psp_vbflash_status, 0440, amdgpu_psp_vbflash_status, NULL);
static struct attribute *flash_attrs[] = { static struct attribute *flash_attrs[] = {
&dev_attr_psp_vbflash_status.attr, &dev_attr_psp_vbflash_status.attr,
&psp_vbflash_bin_attr.attr, &psp_vbflash_bin_attr.attr,
&dev_attr_usbc_pd_fw.attr,
NULL NULL
}; };
...@@ -3718,9 +3705,16 @@ static umode_t amdgpu_flash_attr_is_visible(struct kobject *kobj, struct attribu ...@@ -3718,9 +3705,16 @@ static umode_t amdgpu_flash_attr_is_visible(struct kobject *kobj, struct attribu
return 0; return 0;
switch (adev->ip_versions[MP0_HWIP][0]) { switch (adev->ip_versions[MP0_HWIP][0]) {
case IP_VERSION(11, 0, 0):
case IP_VERSION(11, 0, 7):
if (attr == &dev_attr_usbc_pd_fw.attr)
return 0660;
return 0;
case IP_VERSION(13, 0, 0): case IP_VERSION(13, 0, 0):
case IP_VERSION(13, 0, 7): case IP_VERSION(13, 0, 7):
if (attr == &psp_vbflash_bin_attr.attr) if (attr == &dev_attr_usbc_pd_fw.attr)
return 0;
else if (attr == &psp_vbflash_bin_attr.attr)
return 0660; return 0660;
return 0440; return 0440;
default: default:
...@@ -3751,21 +3745,6 @@ const struct amd_ip_funcs psp_ip_funcs = { ...@@ -3751,21 +3745,6 @@ const struct amd_ip_funcs psp_ip_funcs = {
.set_powergating_state = psp_set_powergating_state, .set_powergating_state = psp_set_powergating_state,
}; };
static int psp_sysfs_init(struct amdgpu_device *adev)
{
int ret = device_create_file(adev->dev, &dev_attr_usbc_pd_fw);
if (ret)
DRM_ERROR("Failed to create USBC PD FW control file!");
return ret;
}
static void psp_sysfs_fini(struct amdgpu_device *adev)
{
device_remove_file(adev->dev, &dev_attr_usbc_pd_fw);
}
const struct amdgpu_ip_block_version psp_v3_1_ip_block = { const struct amdgpu_ip_block_version psp_v3_1_ip_block = {
.type = AMD_IP_BLOCK_TYPE_PSP, .type = AMD_IP_BLOCK_TYPE_PSP,
.major = 3, .major = 3,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment