Skip to content

Commit a519fd8

Browse files
committed
drm/amdgpu: remove eeprom from the smu i2c handlers
The driver uses it for EEPROM access, but it's just an i2c bus. Reviewed-by: Andrey Grodzovsky <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 84dd1f6 commit a519fd8

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

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

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,12 @@ static bool smu_v11_0_i2c_bus_unlock(struct i2c_adapter *control)
536536
return false;
537537
}
538538

539-
/***************************** EEPROM I2C GLUE ****************************/
539+
/***************************** I2C GLUE ****************************/
540540

541-
static uint32_t smu_v11_0_i2c_eeprom_read_data(struct i2c_adapter *control,
542-
uint8_t address,
543-
uint8_t *data,
544-
uint32_t numbytes)
541+
static uint32_t smu_v11_0_i2c_read_data(struct i2c_adapter *control,
542+
uint8_t address,
543+
uint8_t *data,
544+
uint32_t numbytes)
545545
{
546546
uint32_t ret = 0;
547547

@@ -561,10 +561,10 @@ static uint32_t smu_v11_0_i2c_eeprom_read_data(struct i2c_adapter *control,
561561
return ret;
562562
}
563563

564-
static uint32_t smu_v11_0_i2c_eeprom_write_data(struct i2c_adapter *control,
565-
uint8_t address,
566-
uint8_t *data,
567-
uint32_t numbytes)
564+
static uint32_t smu_v11_0_i2c_write_data(struct i2c_adapter *control,
565+
uint8_t address,
566+
uint8_t *data,
567+
uint32_t numbytes)
568568
{
569569
uint32_t ret;
570570

@@ -624,7 +624,7 @@ static const struct i2c_lock_operations smu_v11_0_i2c_i2c_lock_ops = {
624624
.unlock_bus = unlock_bus,
625625
};
626626

627-
static int smu_v11_0_i2c_eeprom_i2c_xfer(struct i2c_adapter *i2c_adap,
627+
static int smu_v11_0_i2c_xfer(struct i2c_adapter *i2c_adap,
628628
struct i2c_msg *msgs, int num)
629629
{
630630
int i, ret;
@@ -639,13 +639,13 @@ static int smu_v11_0_i2c_eeprom_i2c_xfer(struct i2c_adapter *i2c_adap,
639639

640640
for (i = 0; i < num; i++) {
641641
if (msgs[i].flags & I2C_M_RD)
642-
ret = smu_v11_0_i2c_eeprom_read_data(i2c_adap,
643-
(uint8_t)msgs[i].addr,
644-
msgs[i].buf, msgs[i].len);
642+
ret = smu_v11_0_i2c_read_data(i2c_adap,
643+
(uint8_t)msgs[i].addr,
644+
msgs[i].buf, msgs[i].len);
645645
else
646-
ret = smu_v11_0_i2c_eeprom_write_data(i2c_adap,
647-
(uint8_t)msgs[i].addr,
648-
msgs[i].buf, msgs[i].len);
646+
ret = smu_v11_0_i2c_write_data(i2c_adap,
647+
(uint8_t)msgs[i].addr,
648+
msgs[i].buf, msgs[i].len);
649649

650650
if (ret != I2C_OK) {
651651
num = -EIO;
@@ -657,27 +657,27 @@ static int smu_v11_0_i2c_eeprom_i2c_xfer(struct i2c_adapter *i2c_adap,
657657
return num;
658658
}
659659

660-
static u32 smu_v11_0_i2c_eeprom_i2c_func(struct i2c_adapter *adap)
660+
static u32 smu_v11_0_i2c_func(struct i2c_adapter *adap)
661661
{
662662
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
663663
}
664664

665665

666-
static const struct i2c_algorithm smu_v11_0_i2c_eeprom_i2c_algo = {
667-
.master_xfer = smu_v11_0_i2c_eeprom_i2c_xfer,
668-
.functionality = smu_v11_0_i2c_eeprom_i2c_func,
666+
static const struct i2c_algorithm smu_v11_0_i2c_algo = {
667+
.master_xfer = smu_v11_0_i2c_xfer,
668+
.functionality = smu_v11_0_i2c_func,
669669
};
670670

671-
int smu_v11_0_i2c_eeprom_control_init(struct i2c_adapter *control)
671+
int smu_v11_0_i2c_control_init(struct i2c_adapter *control)
672672
{
673673
struct amdgpu_device *adev = to_amdgpu_device(control);
674674
int res;
675675

676676
control->owner = THIS_MODULE;
677677
control->class = I2C_CLASS_SPD;
678678
control->dev.parent = &adev->pdev->dev;
679-
control->algo = &smu_v11_0_i2c_eeprom_i2c_algo;
680-
snprintf(control->name, sizeof(control->name), "AMDGPU EEPROM");
679+
control->algo = &smu_v11_0_i2c_algo;
680+
snprintf(control->name, sizeof(control->name), "AMDGPU SMU");
681681
control->lock_ops = &smu_v11_0_i2c_i2c_lock_ops;
682682

683683
res = i2c_add_adapter(control);
@@ -687,7 +687,7 @@ int smu_v11_0_i2c_eeprom_control_init(struct i2c_adapter *control)
687687
return res;
688688
}
689689

690-
void smu_v11_0_i2c_eeprom_control_fini(struct i2c_adapter *control)
690+
void smu_v11_0_i2c_control_fini(struct i2c_adapter *control)
691691
{
692692
i2c_del_adapter(control);
693693
}
@@ -715,9 +715,9 @@ bool smu_v11_0_i2c_test_bus(struct i2c_adapter *control)
715715
smu_v11_0_i2c_init(control);
716716

717717
/* Write 0xde to address 0x0000 on the EEPROM */
718-
ret = smu_v11_0_i2c_eeprom_write_data(control, I2C_TARGET_ADDR, data, 6);
718+
ret = smu_v11_0_i2c_write_data(control, I2C_TARGET_ADDR, data, 6);
719719

720-
ret = smu_v11_0_i2c_eeprom_read_data(control, I2C_TARGET_ADDR, data, 6);
720+
ret = smu_v11_0_i2c_read_data(control, I2C_TARGET_ADDR, data, 6);
721721

722722
smu_v11_0_i2c_fini(control);
723723

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
struct i2c_adapter;
3030

31-
int smu_v11_0_i2c_eeprom_control_init(struct i2c_adapter *control);
32-
void smu_v11_0_i2c_eeprom_control_fini(struct i2c_adapter *control);
31+
int smu_v11_0_i2c_control_init(struct i2c_adapter *control);
32+
void smu_v11_0_i2c_control_fini(struct i2c_adapter *control);
3333

3434
#endif

drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static int vega20_smu_init(struct pp_hwmgr *hwmgr)
523523
priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size = sizeof(DpmActivityMonitorCoeffInt_t);
524524

525525
if (adev->psp.ras.ras) {
526-
ret = smu_v11_0_i2c_eeprom_control_init(&adev->pm.smu_i2c);
526+
ret = smu_v11_0_i2c_control_init(&adev->pm.smu_i2c);
527527
if (ret)
528528
goto err4;
529529
}
@@ -563,7 +563,7 @@ static int vega20_smu_fini(struct pp_hwmgr *hwmgr)
563563
struct amdgpu_device *adev = hwmgr->adev;
564564

565565
if (adev->psp.ras.ras)
566-
smu_v11_0_i2c_eeprom_control_fini(&adev->pm.smu_i2c);
566+
smu_v11_0_i2c_control_fini(&adev->pm.smu_i2c);
567567

568568
if (priv) {
569569
amdgpu_bo_free_kernel(&priv->smu_tables.entry[TABLE_PPTABLE].handle,

0 commit comments

Comments
 (0)