Skip to content

Commit 84dd1f6

Browse files
committed
drm/amdgpu: move i2c bus lock out of ras structure
It's not really ras related. It's just a lock for the bus in general. This removes the ras dependency from the smu i2c bus. Reviewed-by: Andrey Grodzovsky <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 9cb2682 commit 84dd1f6

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ struct amdgpu_pm {
425425
u32 default_sclk;
426426
u32 default_mclk;
427427
struct amdgpu_i2c_chan *i2c_bus;
428+
bool bus_locked;
428429
/* internal thermal controller on rv6xx+ */
429430
enum amdgpu_int_thermal_type int_thermal_type;
430431
struct device *int_hwmon_dev;

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct amdgpu_ras_eeprom_control {
4747
uint32_t next_addr;
4848
unsigned int num_recs;
4949
struct mutex tbl_mutex;
50-
bool bus_locked;
5150
uint32_t tbl_byte_sum;
5251
uint16_t i2c_address; // 8-bit represented address
5352
};

drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "amdgpu_amdkfd.h"
3333
#include <linux/i2c.h>
3434
#include <linux/pci.h>
35-
#include "amdgpu_ras.h"
3635

3736
/* error codes */
3837
#define I2C_OK 0
@@ -592,14 +591,13 @@ static uint32_t smu_v11_0_i2c_eeprom_write_data(struct i2c_adapter *control,
592591
static void lock_bus(struct i2c_adapter *i2c, unsigned int flags)
593592
{
594593
struct amdgpu_device *adev = to_amdgpu_device(i2c);
595-
struct amdgpu_ras_eeprom_control *control = &adev->psp.ras.ras->eeprom_control;
596594

597595
if (!smu_v11_0_i2c_bus_lock(i2c)) {
598596
DRM_ERROR("Failed to lock the bus from SMU");
599597
return;
600598
}
601599

602-
control->bus_locked = true;
600+
adev->pm.bus_locked = true;
603601
}
604602

605603
static int trylock_bus(struct i2c_adapter *i2c, unsigned int flags)
@@ -611,14 +609,13 @@ static int trylock_bus(struct i2c_adapter *i2c, unsigned int flags)
611609
static void unlock_bus(struct i2c_adapter *i2c, unsigned int flags)
612610
{
613611
struct amdgpu_device *adev = to_amdgpu_device(i2c);
614-
struct amdgpu_ras_eeprom_control *control = &adev->psp.ras.ras->eeprom_control;
615612

616613
if (!smu_v11_0_i2c_bus_unlock(i2c)) {
617614
DRM_ERROR("Failed to unlock the bus from SMU");
618615
return;
619616
}
620617

621-
control->bus_locked = false;
618+
adev->pm.bus_locked = false;
622619
}
623620

624621
static const struct i2c_lock_operations smu_v11_0_i2c_i2c_lock_ops = {
@@ -632,9 +629,8 @@ static int smu_v11_0_i2c_eeprom_i2c_xfer(struct i2c_adapter *i2c_adap,
632629
{
633630
int i, ret;
634631
struct amdgpu_device *adev = to_amdgpu_device(i2c_adap);
635-
struct amdgpu_ras_eeprom_control *control = &adev->psp.ras.ras->eeprom_control;
636632

637-
if (!control->bus_locked) {
633+
if (!adev->pm.bus_locked) {
638634
DRM_ERROR("I2C bus unlocked, stopping transaction!");
639635
return -EIO;
640636
}

0 commit comments

Comments
 (0)