Add I2C read check to Sapphire GPU controller, so it only creates a controller for the correct GPU bus
This commit is contained in:
parent
7dfbdade39
commit
31a9399d19
1 changed files with 33 additions and 4 deletions
|
|
@ -24,6 +24,32 @@ static const gpu_pci_device device_list[] =
|
|||
{ AMD_GPU_VEN, AMD_RX580_DEV, SAPPHIRE_SUB_VEN, SAPPHIRE_RX580_NITRO_PLUS_SUB_DEV, "Sapphire RX580 Nitro+" },
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForSapphireGPUController *
|
||||
* *
|
||||
* Tests the given address to see if an Sapphire controller exists there. First *
|
||||
* does a quick write to test for a response *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForSapphireGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
int res;
|
||||
|
||||
//Read a byte to test for presence
|
||||
res = bus->i2c_smbus_read_byte(address);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForSapphireGPUController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectSapphireGPUControllers *
|
||||
|
|
@ -49,10 +75,13 @@ void DetectSapphireGPUControllers(std::vector<i2c_smbus_interface*>& busses, std
|
|||
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
|
||||
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
|
||||
{
|
||||
new_sapphire_gpu = new SapphireGPUController(busses[bus], 0x55);
|
||||
new_controller = new RGBController_SapphireGPU(new_sapphire_gpu);
|
||||
new_controller->name = device_list[dev_idx].name;
|
||||
rgb_controllers.push_back(new_controller);
|
||||
if(TestForSapphireGPUController(busses[bus], 0x55))
|
||||
{
|
||||
new_sapphire_gpu = new SapphireGPUController(busses[bus], 0x55);
|
||||
new_controller = new RGBController_SapphireGPU(new_sapphire_gpu);
|
||||
new_controller->name = device_list[dev_idx].name;
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue