drm/amdgpu/swsmu/i2c: return an error if the SMU is not running
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jan 2022 17:17:23 +0000 (12:17 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jan 2022 20:50:03 +0000 (15:50 -0500)
Return an error if someone tries to use the i2c bus when the
SMU is not running.  Otherwise we can end up sending commands
to the SMU which will either get ignored or could cause other
issues depending on what state the GPU and SMU are in.

Cc: Luben.Tuikov@amd.com
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c

index 0cf385e8b4e9d5c3ae5d775077936fd748b7075d..ee296441c5bc4d1dd6c219bff09163aa1f441253 100644 (file)
@@ -2071,6 +2071,9 @@ static int arcturus_i2c_xfer(struct i2c_adapter *i2c_adap,
        int i, j, r, c;
        u16 dir;
 
+       if (!adev->pm.dpm_enabled)
+               return -EBUSY;
+
        req = kzalloc(sizeof(*req), GFP_KERNEL);
        if (!req)
                return -ENOMEM;
index 16a5d4d35981660a3749338569559a51c11195d4..4a86520d01c34b2f92d6c1adc5c8ace124aac884 100644 (file)
@@ -2754,6 +2754,9 @@ static int navi10_i2c_xfer(struct i2c_adapter *i2c_adap,
        int i, j, r, c;
        u16 dir;
 
+       if (!adev->pm.dpm_enabled)
+               return -EBUSY;
+
        req = kzalloc(sizeof(*req), GFP_KERNEL);
        if (!req)
                return -ENOMEM;
index 1c71ea97d06f1dad665d6efac1fe2759973c3ee3..22dd372b8d248dba46d6398bc8081ab1e14eea67 100644 (file)
@@ -3449,6 +3449,9 @@ static int sienna_cichlid_i2c_xfer(struct i2c_adapter *i2c_adap,
        int i, j, r, c;
        u16 dir;
 
+       if (!adev->pm.dpm_enabled)
+               return -EBUSY;
+
        req = kzalloc(sizeof(*req), GFP_KERNEL);
        if (!req)
                return -ENOMEM;
index 450049bcedcba6fa5383db7806a576ac9c064c7c..ba4c9771ffc56b6eadee9c2bc87c9a941eb9b84b 100644 (file)
@@ -1473,6 +1473,9 @@ static int aldebaran_i2c_xfer(struct i2c_adapter *i2c_adap,
        int i, j, r, c;
        u16 dir;
 
+       if (!adev->pm.dpm_enabled)
+               return -EBUSY;
+
        req = kzalloc(sizeof(*req), GFP_KERNEL);
        if (!req)
                return -ENOMEM;