Add Gainward GTX 1080 Phoenix
This commit is contained in:
parent
4b1c68abd2
commit
f0fbe17456
7 changed files with 371 additions and 6 deletions
69
Controllers/GainwardGPUController/GainwardGPUController.cpp
Normal file
69
Controllers/GainwardGPUController/GainwardGPUController.cpp
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*-----------------------------------------*\
|
||||
| GainwardGPUController.cpp |
|
||||
| |
|
||||
| Driver for Gainward RGB on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "GainwardGPUController.h"
|
||||
#include <cstring>
|
||||
|
||||
GainwardGPUController::GainwardGPUController(i2c_smbus_interface* bus, gainward_gpu_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
}
|
||||
|
||||
GainwardGPUController::~GainwardGPUController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string GainwardGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
return_string.append(addr);
|
||||
return("I2C: " + return_string);
|
||||
}
|
||||
|
||||
unsigned char GainwardGPUController::GetLEDRed()
|
||||
{
|
||||
return(GainwardGPURegisterRead(GAINWARD_RED_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GainwardGPUController::GetLEDGreen()
|
||||
{
|
||||
return(GainwardGPURegisterRead(GAINWARD_GREEN_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GainwardGPUController::GetLEDBlue()
|
||||
{
|
||||
return(GainwardGPURegisterRead(GAINWARD_BLUE_REGISTER));
|
||||
}
|
||||
|
||||
void GainwardGPUController::SetLEDColors(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
GainwardGPURegisterWrite(GAINWARD_RED_REGISTER, red);
|
||||
GainwardGPURegisterWrite(GAINWARD_GREEN_REGISTER, green);
|
||||
GainwardGPURegisterWrite(GAINWARD_BLUE_REGISTER, blue);
|
||||
GainwardGPURegisterWrite(GAINWARD_06_REGISTER, 0xFF);
|
||||
}
|
||||
|
||||
void GainwardGPUController::SetMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
unsigned char GainwardGPUController::GainwardGPURegisterRead(unsigned char reg)
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, reg));
|
||||
}
|
||||
|
||||
void GainwardGPUController::GainwardGPURegisterWrite(unsigned char reg, unsigned char val)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, reg, val);
|
||||
}
|
||||
44
Controllers/GainwardGPUController/GainwardGPUController.h
Normal file
44
Controllers/GainwardGPUController/GainwardGPUController.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*-----------------------------------------*\
|
||||
| GainwardGPUController.h |
|
||||
| |
|
||||
| Driver for Gainward RGB on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char gainward_gpu_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
/* RGB Registers */
|
||||
GAINWARD_RED_REGISTER = 0x03, /* Red Register */
|
||||
GAINWARD_GREEN_REGISTER = 0x04, /* Green Register */
|
||||
GAINWARD_BLUE_REGISTER = 0x05, /* Blue Register */
|
||||
GAINWARD_06_REGISTER = 0x06, /* Unknown (Brightness/Mode?) Register */
|
||||
};
|
||||
|
||||
class GainwardGPUController
|
||||
{
|
||||
public:
|
||||
GainwardGPUController(i2c_smbus_interface* bus, gainward_gpu_dev_id);
|
||||
~GainwardGPUController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
unsigned char GetLEDRed();
|
||||
unsigned char GetLEDGreen();
|
||||
unsigned char GetLEDBlue();
|
||||
void SetLEDColors(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetMode();
|
||||
|
||||
unsigned char GainwardGPURegisterRead(unsigned char reg);
|
||||
void GainwardGPURegisterWrite(unsigned char reg, unsigned char val);
|
||||
|
||||
private:
|
||||
i2c_smbus_interface * bus;
|
||||
gainward_gpu_dev_id dev;
|
||||
};
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/*-----------------------------------------*\
|
||||
| GainwardGPUControllerDetect.cpp |
|
||||
| |
|
||||
| Driver for Gainward RGB on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "GainwardGPUController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_GainwardGPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int pci_vendor;
|
||||
int pci_device;
|
||||
int pci_subsystem_vendor;
|
||||
int pci_subsystem_device;
|
||||
const char * name;
|
||||
} gpu_pci_device;
|
||||
|
||||
#define GPU_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const gpu_pci_device device_list[] =
|
||||
{
|
||||
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, GAINWARD_SUB_VEN, GAINWARD_GTX_1080_PHOENIX, "Gainward GTX 1080 Phoenix" },
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForGainwardGPUController *
|
||||
* *
|
||||
* Tests the given address to see if a Gainward GPU controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForGainwardGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
pass = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForGainwardGPUController() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectGainwardGPUControllers *
|
||||
* *
|
||||
* Detect Gainward GPU controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectGainwardGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
GainwardGPUController* new_GainwardGPU;
|
||||
RGBController_GainwardGPU* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Check for Gainward controller at 0x08
|
||||
for(unsigned int dev_idx = 0; dev_idx < GPU_NUM_DEVICES; dev_idx++)
|
||||
{
|
||||
if(busses[bus]->pci_vendor == device_list[dev_idx].pci_vendor &&
|
||||
busses[bus]->pci_device == device_list[dev_idx].pci_device &&
|
||||
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
|
||||
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
|
||||
{
|
||||
if (TestForGainwardGPUController(busses[bus], 0x08))
|
||||
{
|
||||
new_GainwardGPU = new GainwardGPUController(busses[bus], 0x08);
|
||||
new_controller = new RGBController_GainwardGPU(new_GainwardGPU);
|
||||
new_controller->name = device_list[dev_idx].name;
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectGainwardGPUControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("Gainward GPU", DetectGainwardGPUControllers);
|
||||
113
Controllers/GainwardGPUController/RGBController_GainwardGPU.cpp
Normal file
113
Controllers/GainwardGPUController/RGBController_GainwardGPU.cpp
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPU.cpp |
|
||||
| |
|
||||
| Driver for Gainward RGB on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_GainwardGPU.h"
|
||||
|
||||
int RGBController_GainwardGPU::GetDeviceMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
return(active_mode);
|
||||
}
|
||||
|
||||
RGBController_GainwardGPU::RGBController_GainwardGPU(GainwardGPUController * gainward_gpu_ptr)
|
||||
{
|
||||
gainward_gpu = gainward_gpu_ptr;
|
||||
|
||||
name = "Gainward GPU";
|
||||
vendor = "Gainward";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "Gainward GTX GPU";
|
||||
version = "";
|
||||
location = gainward_gpu->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 1;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_GainwardGPU::~RGBController_GainwardGPU()
|
||||
{
|
||||
delete gainward_gpu;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPU::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone gainward_gpu_zone;
|
||||
gainward_gpu_zone.name = "GPU";
|
||||
gainward_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
gainward_gpu_zone.leds_min = 1;
|
||||
gainward_gpu_zone.leds_max = 1;
|
||||
gainward_gpu_zone.leds_count = 1;
|
||||
gainward_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(gainward_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led gainward_gpu_led;
|
||||
gainward_gpu_led.name = "GPU";
|
||||
leds.push_back(gainward_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = gainward_gpu->GetLEDRed();
|
||||
unsigned char grn = gainward_gpu->GetLEDGreen();
|
||||
unsigned char blu = gainward_gpu->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPU::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPU::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
|
||||
gainward_gpu->SetLEDColors(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPU::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPU::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPU::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_GainwardGPU::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_GainwardGPU.h |
|
||||
| |
|
||||
| Driver for Gainward RGB on GPUs |
|
||||
| |
|
||||
| TheRogueZeta 11/05/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GainwardGPUController.h"
|
||||
|
||||
class RGBController_GainwardGPU : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GainwardGPU(GainwardGPUController* gainward_gpu_ptr);
|
||||
~RGBController_GainwardGPU();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GainwardGPUController* gainward_gpu;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
18
OpenRGB.pro
18
OpenRGB.pro
|
|
@ -73,13 +73,14 @@ INCLUDEPATH +=
|
|||
Controllers/EspurnaController/ \
|
||||
Controllers/EVGAGPUController/ \
|
||||
Controllers/FanBusController/ \
|
||||
Controllers/GainwardGPUController/ \
|
||||
Controllers/GalaxGPUController/ \
|
||||
Controllers/GigabyteAorusCPUCoolerController/ \
|
||||
Controllers/GigabyteRGBFusion2DRAMController/ \
|
||||
Controllers/GigabyteRGBFusion2SMBusController/ \
|
||||
Controllers/GigabyteRGBFusion2USBController/ \
|
||||
Controllers/GigabyteRGBFusionController/ \
|
||||
Controllers/GigabyteRGBFusionGPUController/ \
|
||||
Controllers/GalaxGPUController/ \
|
||||
Controllers/HoltekController/ \
|
||||
Controllers/HyperXDRAMController/ \
|
||||
Controllers/HyperXKeyboardController/ \
|
||||
|
|
@ -202,6 +203,10 @@ HEADERS +=
|
|||
Controllers/FanBusController/FanBusController.h \
|
||||
Controllers/FanBusController/FanBusInterface.h \
|
||||
Controllers/FanBusController/RGBController_FanBus.h \
|
||||
Controllers/GainwardGPUController/GainwardGPUController.h \
|
||||
Controllers/GainwardGPUController/RGBController_GainwardGPU.h \
|
||||
Controllers/GalaxGPUController/GalaxGPUController.h \
|
||||
Controllers/GalaxGPUController/RGBController_GalaxGPU.h \
|
||||
Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h \
|
||||
Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.h \
|
||||
Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMController.h \
|
||||
|
|
@ -214,8 +219,6 @@ HEADERS +=
|
|||
Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.h \
|
||||
Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUController.h \
|
||||
Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.h \
|
||||
Controllers/GalaxGPUController/GalaxGPUController.h \
|
||||
Controllers/GalaxGPUController/RGBController_GalaxGPU.h \
|
||||
Controllers/HoltekController/HoltekA070Controller.h \
|
||||
Controllers/HoltekController/HoltekA1FAController.h \
|
||||
Controllers/HoltekController/RGBController_HoltekA070.h \
|
||||
|
|
@ -427,6 +430,12 @@ SOURCES +=
|
|||
Controllers/FanBusController/FanBusControllerDetect.cpp \
|
||||
Controllers/FanBusController/FanBusInterface.cpp \
|
||||
Controllers/FanBusController/RGBController_FanBus.cpp \
|
||||
Controllers/GainwardGPUController/GainwardGPUController.cpp \
|
||||
Controllers/GainwardGPUController/GainwardGPUControllerDetect.cpp \
|
||||
Controllers/GainwardGPUController/RGBController_GainwardGPU.cpp \
|
||||
Controllers/GalaxGPUController/GalaxGPUController.cpp \
|
||||
Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp \
|
||||
Controllers/GalaxGPUController/RGBController_GalaxGPU.cpp \
|
||||
Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp \
|
||||
Controllers/GigabyteAorusCPUCoolerController/GigabyteAorusCPUCoolerControllerDetect.cpp \
|
||||
Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp \
|
||||
|
|
@ -445,9 +454,6 @@ SOURCES +=
|
|||
Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUController.cpp \
|
||||
Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUControllerDetect.cpp \
|
||||
Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.cpp \
|
||||
Controllers/GalaxGPUController/GalaxGPUController.cpp \
|
||||
Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp \
|
||||
Controllers/GalaxGPUController/RGBController_GalaxGPU.cpp \
|
||||
Controllers/HoltekController/HoltekA070Controller.cpp \
|
||||
Controllers/HoltekController/HoltekA1FAController.cpp \
|
||||
Controllers/HoltekController/HoltekControllerDetect.cpp \
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@
|
|||
#define ASUS_SUB_VEN 0x1043
|
||||
#define EVGA_SUB_VEN 0x3842
|
||||
#define GALAX_SUB_VEN 0x1B4C
|
||||
#define GAINWARD_SUB_VEN 0x10B0
|
||||
#define GIGABYTE_SUB_VEN 0x1458
|
||||
#define MSI_SUB_VEN 0x1462
|
||||
#define NVIDIA_SUB_VEN 0x10DE
|
||||
|
|
@ -85,6 +86,11 @@
|
|||
#define EVGA_RTX2080_XC_GAMING_SUB_DEV 0x2182
|
||||
#define EVGA_RTX2080TI_XC_ULTRA_SUB_DEV 0x2383
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Gainward Sub-Device IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define GAINWARD_GTX_1080_PHOENIX 0x1B80
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| GALAX / KFA2 Sub-Device IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue