Store name in PowerColorRedDevilGPUController to avoid setting it in detector
This commit is contained in:
parent
2134323bf8
commit
ce86faabfe
4 changed files with 156 additions and 152 deletions
|
|
@ -14,10 +14,11 @@
|
|||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
RedDevilGPUController::RedDevilGPUController(i2c_smbus_interface* bus, red_devil_dev_id dev)
|
||||
RedDevilGPUController::RedDevilGPUController(i2c_smbus_interface* bus, red_devil_dev_id dev, std::string dev_name)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
this->name = dev_name;
|
||||
|
||||
if(bus->pci_device > AMD_NAVI10_DEV) // Only Navi 2 cards have this mode
|
||||
{
|
||||
|
|
@ -40,6 +41,11 @@ std::string RedDevilGPUController::GetDeviceLocation()
|
|||
return("I2C:" + return_string);
|
||||
}
|
||||
|
||||
std::string RedDevilGPUController::GetDeviceName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
void RedDevilGPUController::SetLEDColor(int led, RGBColor color)
|
||||
{
|
||||
if(led > RED_DEVIL_GPU_LED_MAX_COUNT)
|
||||
|
|
|
|||
|
|
@ -80,10 +80,11 @@ enum
|
|||
class RedDevilGPUController
|
||||
{
|
||||
public:
|
||||
RedDevilGPUController(i2c_smbus_interface* bus, red_devil_dev_id dev);
|
||||
RedDevilGPUController(i2c_smbus_interface* bus, red_devil_dev_id dev, std::string dev_name);
|
||||
~RedDevilGPUController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetDeviceName();
|
||||
|
||||
void SetLEDColor(int led, RGBColor color);
|
||||
RGBColor GetLEDColor(int led);
|
||||
|
|
@ -104,4 +105,5 @@ public:
|
|||
private:
|
||||
i2c_smbus_interface* bus;
|
||||
red_devil_dev_id dev;
|
||||
std::string name;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ void DetectPowerColorRedDevilGPUControllers(i2c_smbus_interface* bus, uint8_t i2
|
|||
{
|
||||
unsigned char data[3] = {0};
|
||||
int ret = bus->i2c_smbus_read_i2c_block_data(i2c_addr, 0x90, 3, data);
|
||||
|
||||
if(ret == 3 && memcmp(data, indicator, 3) == 0)
|
||||
{
|
||||
RedDevilGPUController* controller = new RedDevilGPUController(bus, i2c_addr);
|
||||
RedDevilGPUController* controller = new RedDevilGPUController(bus, i2c_addr, name);
|
||||
RGBController_RedDevilGPU* rgb_controller = new RGBController_RedDevilGPU(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
@ -32,8 +32,6 @@ void DetectPowerColorRedDevilGPUControllers(i2c_smbus_interface* bus, uint8_t i2
|
|||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX5700", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI10_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX5700_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX5700XT", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI10_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX5700XT_SUB_DEV, 0x22);
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6900XT Ultimate", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI21_DEV2, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6900XT_ULTIMATE_SUB_DEV, 0x22);
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6800XT", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI21_DEV1, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6800XT_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6750XT", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI22_DEV, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6750XT_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6800XT", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI21_DEV1, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6800XT_SUB_DEV, 0x22);
|
||||
REGISTER_I2C_PCI_DETECTOR("PowerColor Red Devil RX6900XT Ultimate", DetectPowerColorRedDevilGPUControllers, AMD_GPU_VEN, AMD_NAVI21_DEV2, POWERCOLOR_SUB_VEN, POWERCOLOR_RED_DEVIL_RX6900XT_ULTIMATE_SUB_DEV, 0x22);
|
||||
|
|
|
|||
|
|
@ -15,11 +15,10 @@ RGBController_RedDevilGPU::RGBController_RedDevilGPU(RedDevilGPUController* cont
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "PowerColor Red Devil GPU";
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "PowerColor";
|
||||
description = name;
|
||||
description = "PowerColor Red Devil GPU Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_GPU;
|
||||
|
||||
mode Off;
|
||||
|
|
@ -169,6 +168,7 @@ RGBController_RedDevilGPU::RGBController_RedDevilGPU(RedDevilGPUController* cont
|
|||
{
|
||||
modes[active_mode].brightness = config.brightness;
|
||||
modes[active_mode].speed = config.speed;
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
modes[active_mode].colors[0] = controller->GetModeColor();
|
||||
|
|
@ -190,7 +190,6 @@ void RGBController_RedDevilGPU::SetupZones()
|
|||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
zone* new_zone = new zone();
|
||||
|
||||
new_zone->name = "GPU";
|
||||
|
|
@ -199,18 +198,17 @@ void RGBController_RedDevilGPU::SetupZones()
|
|||
new_zone->leds_max = 1;
|
||||
new_zone->leds_count = 1;
|
||||
new_zone->matrix_map = NULL;
|
||||
zones.push_back(*new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| This device can control up to 12 LEDs |
|
||||
| For now all LEDs show the same color |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
led* new_led = new led();
|
||||
|
||||
new_led->name = "GPU";
|
||||
leds.push_back(*new_led);
|
||||
|
||||
zones.push_back(*new_zone);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue