forked from Minki/linux
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 <andrey.grodzovsky@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
9cb268215d
commit
84dd1f698e
@ -425,6 +425,7 @@ struct amdgpu_pm {
|
|||||||
u32 default_sclk;
|
u32 default_sclk;
|
||||||
u32 default_mclk;
|
u32 default_mclk;
|
||||||
struct amdgpu_i2c_chan *i2c_bus;
|
struct amdgpu_i2c_chan *i2c_bus;
|
||||||
|
bool bus_locked;
|
||||||
/* internal thermal controller on rv6xx+ */
|
/* internal thermal controller on rv6xx+ */
|
||||||
enum amdgpu_int_thermal_type int_thermal_type;
|
enum amdgpu_int_thermal_type int_thermal_type;
|
||||||
struct device *int_hwmon_dev;
|
struct device *int_hwmon_dev;
|
||||||
|
@ -47,7 +47,6 @@ struct amdgpu_ras_eeprom_control {
|
|||||||
uint32_t next_addr;
|
uint32_t next_addr;
|
||||||
unsigned int num_recs;
|
unsigned int num_recs;
|
||||||
struct mutex tbl_mutex;
|
struct mutex tbl_mutex;
|
||||||
bool bus_locked;
|
|
||||||
uint32_t tbl_byte_sum;
|
uint32_t tbl_byte_sum;
|
||||||
uint16_t i2c_address; // 8-bit represented address
|
uint16_t i2c_address; // 8-bit represented address
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "amdgpu_amdkfd.h"
|
#include "amdgpu_amdkfd.h"
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include "amdgpu_ras.h"
|
|
||||||
|
|
||||||
/* error codes */
|
/* error codes */
|
||||||
#define I2C_OK 0
|
#define I2C_OK 0
|
||||||
@ -592,14 +591,13 @@ static uint32_t smu_v11_0_i2c_eeprom_write_data(struct i2c_adapter *control,
|
|||||||
static void lock_bus(struct i2c_adapter *i2c, unsigned int flags)
|
static void lock_bus(struct i2c_adapter *i2c, unsigned int flags)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = to_amdgpu_device(i2c);
|
struct amdgpu_device *adev = to_amdgpu_device(i2c);
|
||||||
struct amdgpu_ras_eeprom_control *control = &adev->psp.ras.ras->eeprom_control;
|
|
||||||
|
|
||||||
if (!smu_v11_0_i2c_bus_lock(i2c)) {
|
if (!smu_v11_0_i2c_bus_lock(i2c)) {
|
||||||
DRM_ERROR("Failed to lock the bus from SMU");
|
DRM_ERROR("Failed to lock the bus from SMU");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
control->bus_locked = true;
|
adev->pm.bus_locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int trylock_bus(struct i2c_adapter *i2c, unsigned int flags)
|
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)
|
|||||||
static void unlock_bus(struct i2c_adapter *i2c, unsigned int flags)
|
static void unlock_bus(struct i2c_adapter *i2c, unsigned int flags)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = to_amdgpu_device(i2c);
|
struct amdgpu_device *adev = to_amdgpu_device(i2c);
|
||||||
struct amdgpu_ras_eeprom_control *control = &adev->psp.ras.ras->eeprom_control;
|
|
||||||
|
|
||||||
if (!smu_v11_0_i2c_bus_unlock(i2c)) {
|
if (!smu_v11_0_i2c_bus_unlock(i2c)) {
|
||||||
DRM_ERROR("Failed to unlock the bus from SMU");
|
DRM_ERROR("Failed to unlock the bus from SMU");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
control->bus_locked = false;
|
adev->pm.bus_locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct i2c_lock_operations smu_v11_0_i2c_i2c_lock_ops = {
|
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,
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
struct amdgpu_device *adev = to_amdgpu_device(i2c_adap);
|
struct amdgpu_device *adev = to_amdgpu_device(i2c_adap);
|
||||||
struct amdgpu_ras_eeprom_control *control = &adev->psp.ras.ras->eeprom_control;
|
|
||||||
|
|
||||||
if (!control->bus_locked) {
|
if (!adev->pm.bus_locked) {
|
||||||
DRM_ERROR("I2C bus unlocked, stopping transaction!");
|
DRM_ERROR("I2C bus unlocked, stopping transaction!");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user