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 0cf385e..ee29644 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 16a5d4d..4a86520 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 1c71ea9..22dd372 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 450049b..ba4c977 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;