Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+30 -30
+26 -26
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c
··· 536 536 return false; 537 537 } 538 538 539 - /***************************** EEPROM I2C GLUE ****************************/ 539 + /***************************** I2C GLUE ****************************/ 540 540 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) 545 545 { 546 546 uint32_t ret = 0; 547 547 ··· 561 561 return ret; 562 562 } 563 563 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) 568 568 { 569 569 uint32_t ret; 570 570 ··· 624 624 .unlock_bus = unlock_bus, 625 625 }; 626 626 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, 628 628 struct i2c_msg *msgs, int num) 629 629 { 630 630 int i, ret; ··· 639 639 640 640 for (i = 0; i < num; i++) { 641 641 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); 645 645 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); 649 649 650 650 if (ret != I2C_OK) { 651 651 num = -EIO; ··· 657 657 return num; 658 658 } 659 659 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) 661 661 { 662 662 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 663 663 } 664 664 665 665 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, 669 669 }; 670 670 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) 672 672 { 673 673 struct amdgpu_device *adev = to_amdgpu_device(control); 674 674 int res; ··· 676 676 control->owner = THIS_MODULE; 677 677 control->class = I2C_CLASS_SPD; 678 678 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"); 681 681 control->lock_ops = &smu_v11_0_i2c_i2c_lock_ops; 682 682 683 683 res = i2c_add_adapter(control); ··· 687 687 return res; 688 688 } 689 689 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) 691 691 { 692 692 i2c_del_adapter(control); 693 693 } ··· 715 715 smu_v11_0_i2c_init(control); 716 716 717 717 /* 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); 719 719 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); 721 721 722 722 smu_v11_0_i2c_fini(control); 723 723
+2 -2
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.h
··· 28 28 29 29 struct i2c_adapter; 30 30 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); 33 33 34 34 #endif
+2 -2
drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c
··· 523 523 priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size = sizeof(DpmActivityMonitorCoeffInt_t); 524 524 525 525 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); 527 527 if (ret) 528 528 goto err4; 529 529 } ··· 563 563 struct amdgpu_device *adev = hwmgr->adev; 564 564 565 565 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); 567 567 568 568 if (priv) { 569 569 amdgpu_bo_free_kernel(&priv->smu_tables.entry[TABLE_PPTABLE].handle,