]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
drm/amd/powerplay: refine code to support no-dpm case
[linux.git] / drivers / gpu / drm / amd / powerplay / arcturus_ppt.c
index 9ed23998821674cfc264e91830ec11fc07bb4816..1c15c6fbe3b9fa535a0a7bd6c5cb8e6d7df920d0 100644 (file)
@@ -2022,7 +2022,7 @@ static int arcturus_i2c_eeprom_read_data(struct i2c_adapter *control,
        SwI2cRequest_t req;
        struct amdgpu_device *adev = to_amdgpu_device(control);
        struct smu_table_context *smu_table = &adev->smu.smu_table;
-       struct smu_table *table = &smu_table->tables[SMU_TABLE_I2C_COMMANDS];
+       struct smu_table *table = &smu_table->driver_table;
 
        memset(&req, 0, sizeof(req));
        arcturus_fill_eeprom_i2c_req(&req, false, address, numbytes, data);
@@ -2176,8 +2176,12 @@ static const struct i2c_algorithm arcturus_i2c_eeprom_i2c_algo = {
 static int arcturus_i2c_eeprom_control_init(struct i2c_adapter *control)
 {
        struct amdgpu_device *adev = to_amdgpu_device(control);
+       struct smu_context *smu = &adev->smu;
        int res;
 
+       if (!smu->pm_enabled)
+               return -EOPNOTSUPP;
+
        control->owner = THIS_MODULE;
        control->class = I2C_CLASS_SPD;
        control->dev.parent = &adev->pdev->dev;
@@ -2193,6 +2197,12 @@ static int arcturus_i2c_eeprom_control_init(struct i2c_adapter *control)
 
 static void arcturus_i2c_eeprom_control_fini(struct i2c_adapter *control)
 {
+       struct amdgpu_device *adev = to_amdgpu_device(control);
+       struct smu_context *smu = &adev->smu;
+
+       if (!smu->pm_enabled)
+               return;
+
        i2c_del_adapter(control);
 }
 
@@ -2237,6 +2247,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
        .get_profiling_clk_mask = arcturus_get_profiling_clk_mask,
        .get_power_profile_mode = arcturus_get_power_profile_mode,
        .set_power_profile_mode = arcturus_set_power_profile_mode,
+       .set_performance_level = smu_v11_0_set_performance_level,
        /* debug (internal used) */
        .dump_pptable = arcturus_dump_pptable,
        .get_power_limit = arcturus_get_power_limit,
@@ -2260,6 +2271,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
        .check_fw_version = smu_v11_0_check_fw_version,
        .write_pptable = smu_v11_0_write_pptable,
        .set_min_dcef_deep_sleep = smu_v11_0_set_min_dcef_deep_sleep,
+       .set_driver_table_location = smu_v11_0_set_driver_table_location,
        .set_tool_table_location = smu_v11_0_set_tool_table_location,
        .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
        .system_features_control = smu_v11_0_system_features_control,