mirror of https://gitee.com/openkylin/linux.git
drm/amdgpu/smu: rework i2c adpater registration
The i2c init/fini functions just register the i2c adapter. There is no need to call them during hw init/fini. They only need to be called once per driver init/fini. The previous behavior broke runtime pm because we unregistered the i2c adapter during suspend. Tested-by: Tom St Denis <tom.stdenis@amd.com> Reviewed-by: Kevin Wang <kevin1.wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
d6a4e5e9fe
commit
95a2687687
|
@ -579,6 +579,10 @@ static int smu_smc_table_sw_init(struct smu_context *smu)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = smu_i2c_init(smu, &smu->adev->pm.smu_i2c);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -586,6 +590,8 @@ static int smu_smc_table_sw_fini(struct smu_context *smu)
|
|||
{
|
||||
int ret;
|
||||
|
||||
smu_i2c_fini(smu, &smu->adev->pm.smu_i2c);
|
||||
|
||||
ret = smu_free_memory_pool(smu);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -844,10 +850,6 @@ static int smu_smc_hw_setup(struct smu_context *smu)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = smu_i2c_init(smu, &adev->pm.smu_i2c);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = smu_disable_umc_cdr_12gbps_workaround(smu);
|
||||
if (ret) {
|
||||
dev_err(adev->dev, "Workaround failed to disable UMC CDR feature on 12Gbps SKU!\n");
|
||||
|
@ -1046,8 +1048,6 @@ static int smu_smc_hw_cleanup(struct smu_context *smu)
|
|||
struct amdgpu_device *adev = smu->adev;
|
||||
int ret = 0;
|
||||
|
||||
smu_i2c_fini(smu, &adev->pm.smu_i2c);
|
||||
|
||||
cancel_work_sync(&smu->throttling_logging_work);
|
||||
|
||||
ret = smu_disable_thermal_alert(smu);
|
||||
|
|
|
@ -2080,22 +2080,11 @@ static const struct i2c_algorithm arcturus_i2c_algo = {
|
|||
.functionality = arcturus_i2c_func,
|
||||
};
|
||||
|
||||
static bool arcturus_i2c_adapter_is_added(struct i2c_adapter *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
|
||||
return control->dev.parent == &adev->pdev->dev;
|
||||
}
|
||||
|
||||
static int arcturus_i2c_control_init(struct smu_context *smu, struct i2c_adapter *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
int res;
|
||||
|
||||
/* smu_i2c_eeprom_init may be called twice in sriov */
|
||||
if (arcturus_i2c_adapter_is_added(control))
|
||||
return 0;
|
||||
|
||||
control->owner = THIS_MODULE;
|
||||
control->class = I2C_CLASS_SPD;
|
||||
control->dev.parent = &adev->pdev->dev;
|
||||
|
@ -2111,9 +2100,6 @@ static int arcturus_i2c_control_init(struct smu_context *smu, struct i2c_adapter
|
|||
|
||||
static void arcturus_i2c_control_fini(struct smu_context *smu, struct i2c_adapter *control)
|
||||
{
|
||||
if (!arcturus_i2c_adapter_is_added(control))
|
||||
return;
|
||||
|
||||
i2c_del_adapter(control);
|
||||
}
|
||||
|
||||
|
|
|
@ -2457,22 +2457,11 @@ static const struct i2c_algorithm navi10_i2c_algo = {
|
|||
.functionality = navi10_i2c_func,
|
||||
};
|
||||
|
||||
static bool navi10_i2c_adapter_is_added(struct i2c_adapter *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
|
||||
return control->dev.parent == &adev->pdev->dev;
|
||||
}
|
||||
|
||||
static int navi10_i2c_control_init(struct smu_context *smu, struct i2c_adapter *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
int res;
|
||||
|
||||
/* smu_i2c_eeprom_init may be called twice in sriov */
|
||||
if (navi10_i2c_adapter_is_added(control))
|
||||
return 0;
|
||||
|
||||
control->owner = THIS_MODULE;
|
||||
control->class = I2C_CLASS_SPD;
|
||||
control->dev.parent = &adev->pdev->dev;
|
||||
|
@ -2488,9 +2477,6 @@ static int navi10_i2c_control_init(struct smu_context *smu, struct i2c_adapter *
|
|||
|
||||
static void navi10_i2c_control_fini(struct smu_context *smu, struct i2c_adapter *control)
|
||||
{
|
||||
if (!navi10_i2c_adapter_is_added(control))
|
||||
return;
|
||||
|
||||
i2c_del_adapter(control);
|
||||
}
|
||||
|
||||
|
|
|
@ -2630,22 +2630,11 @@ static const struct i2c_algorithm sienna_cichlid_i2c_algo = {
|
|||
.functionality = sienna_cichlid_i2c_func,
|
||||
};
|
||||
|
||||
static bool sienna_cichlid_i2c_adapter_is_added(struct i2c_adapter *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
|
||||
return control->dev.parent == &adev->pdev->dev;
|
||||
}
|
||||
|
||||
static int sienna_cichlid_i2c_control_init(struct smu_context *smu, struct i2c_adapter *control)
|
||||
{
|
||||
struct amdgpu_device *adev = to_amdgpu_device(control);
|
||||
int res;
|
||||
|
||||
/* smu_i2c_eeprom_init may be called twice in sriov */
|
||||
if (sienna_cichlid_i2c_adapter_is_added(control))
|
||||
return 0;
|
||||
|
||||
control->owner = THIS_MODULE;
|
||||
control->class = I2C_CLASS_SPD;
|
||||
control->dev.parent = &adev->pdev->dev;
|
||||
|
@ -2661,9 +2650,6 @@ static int sienna_cichlid_i2c_control_init(struct smu_context *smu, struct i2c_a
|
|||
|
||||
static void sienna_cichlid_i2c_control_fini(struct smu_context *smu, struct i2c_adapter *control)
|
||||
{
|
||||
if (!sienna_cichlid_i2c_adapter_is_added(control))
|
||||
return;
|
||||
|
||||
i2c_del_adapter(control);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue