Publish curated LumaOps source from c85ee9ef8f1454f5c305398902afbb9e6738de40
Managed validation / full (push) Failing after 8s
Managed validation / full (push) Failing after 8s
This commit is contained in:
1 parent
91f8b3e3c1
commit
def7920856
2271 files changed
+501225
-501178
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -1,40 +1,40 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_ZotacV2GPU.h |
|
||||
| |
|
||||
| RGBController for Zotac V2 GPU |
|
||||
| |
|
||||
| Krzysztof Haładyn (krzys_h) 16 Mar 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "ZotacV2GPUController.h"
|
||||
|
||||
class RGBController_ZotacV2GPU : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_ZotacV2GPU(ZotacV2GPUController* controller_ptr);
|
||||
~RGBController_ZotacV2GPU();
|
||||
|
||||
void SetupInitialValues();
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
ZotacV2GPUConfig config;
|
||||
|
||||
private:
|
||||
ZotacV2GPUController* controller;
|
||||
|
||||
int FindSynchronizedZoneNum(int syncMode);
|
||||
};
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_ZotacV2GPU.h |
|
||||
| |
|
||||
| RGBController for Zotac V2 GPU |
|
||||
| |
|
||||
| Krzysztof Haładyn (krzys_h) 16 Mar 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "ZotacV2GPUController.h"
|
||||
|
||||
class RGBController_ZotacV2GPU : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_ZotacV2GPU(ZotacV2GPUController* controller_ptr);
|
||||
~RGBController_ZotacV2GPU();
|
||||
|
||||
void SetupInitialValues();
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
ZotacV2GPUConfig config;
|
||||
|
||||
private:
|
||||
ZotacV2GPUController* controller;
|
||||
|
||||
int FindSynchronizedZoneNum(int syncMode);
|
||||
};
|
||||
@@ -1,203 +1,203 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| ZotacV2GPUController.cpp |
|
||||
| |
|
||||
| Driver for Zotac V2 GPU |
|
||||
| |
|
||||
| Krzysztof Haładyn (krzys_h) 16 Mar 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "ZotacV2GPUController.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
ZotacV2GPUController::ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
this->name = dev_name;
|
||||
|
||||
if(dev)
|
||||
{
|
||||
ReadVersion();
|
||||
}
|
||||
}
|
||||
|
||||
ZotacV2GPUController::~ZotacV2GPUController()
|
||||
{
|
||||
}
|
||||
|
||||
std::string ZotacV2GPUController::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);
|
||||
}
|
||||
|
||||
std::string ZotacV2GPUController::GetName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string ZotacV2GPUController::GetVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::ReadVersion()
|
||||
{
|
||||
u8 data_pkt[] = { ZOTAC_V2_GPU_REG_RGB, 0xF1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
if(bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||
int rdata_len = sizeof(rdata_pkt);
|
||||
if(bus->i2c_read_block(dev, &rdata_len, rdata_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
version = std::string((char*)rdata_pkt);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::TurnOnOff(bool on)
|
||||
{
|
||||
return SendCommand(on, false, 0, 0, 0, ZotacV2GPUZone());
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::ResetToDefaults()
|
||||
{
|
||||
return SendCommand(true, true, 0, 0, 0, ZotacV2GPUZone());
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::SetMode(int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig)
|
||||
{
|
||||
// NOTE: This only works if the device is in the ON state. Otherwise, the SetMode command will behave
|
||||
// like TurnOnOff(true), and the change will be ignored.
|
||||
|
||||
// NOTE: syncMode is per idleActive, NOT per (zone, idleActive) pair like zoneConfig is - as in,
|
||||
// you can have ACTIVE in INDIVIDUAL mode and IDLE in SYNCHRONIZED mode, but you can't have
|
||||
// different syncModes in different zones. The last written value is always applied, so make
|
||||
// sure you don't change it accidentally between writes.
|
||||
// TODO: Verify what I said above - it doesn't match the GUI, but it seems to match the NvAPISpy traces
|
||||
// From the GUI it seems like syncMode should be global, period.
|
||||
|
||||
return SendCommand(true, false, zone, idleActive, syncMode, zoneConfig);
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::GetMode(int zone, int idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig, bool& on)
|
||||
{
|
||||
u8 data_pkt[] =
|
||||
{
|
||||
ZOTAC_V2_GPU_REG_RGB,
|
||||
0xF0,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
(u8)idleActive,
|
||||
(u8)zone,
|
||||
0x00,
|
||||
};
|
||||
|
||||
if(bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||
int rdata_len = sizeof(rdata_pkt);
|
||||
if(bus->i2c_read_block(dev, &rdata_len, rdata_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool readReset;
|
||||
int readZone;
|
||||
int readIdleActive;
|
||||
if(!ParseCommand(on, readReset, readZone, readIdleActive, syncMode, zoneConfig))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(readReset != 0)
|
||||
{
|
||||
LOG_WARNING("Reset byte was not 0?!");
|
||||
}
|
||||
|
||||
if(readZone != zone || readIdleActive != idleActive)
|
||||
{
|
||||
LOG_WARNING("Got unexpected data - expected to recieve data for (%d, %d) but got for (%d, %d)", zone, idleActive, readZone, readIdleActive);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::SendCommand(bool on, bool reset, int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig)
|
||||
{
|
||||
u8 data_pkt[] =
|
||||
{
|
||||
ZOTAC_V2_GPU_REG_RGB,
|
||||
on ? (u8)0x01 : (u8)0x00,
|
||||
reset ? (u8)0x01 : (u8)0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
(u8)idleActive,
|
||||
(u8)zone,
|
||||
(u8)zoneConfig.mode,
|
||||
(u8)RGBGetRValue(zoneConfig.color1),
|
||||
(u8)RGBGetGValue(zoneConfig.color1),
|
||||
(u8)RGBGetBValue(zoneConfig.color1),
|
||||
(u8)zoneConfig.speed,
|
||||
(u8)zoneConfig.brightness,
|
||||
(u8)zoneConfig.direction,
|
||||
0x00,
|
||||
(u8)syncMode,
|
||||
(u8)zoneConfig.circuit,
|
||||
(u8)RGBGetRValue(zoneConfig.color2),
|
||||
(u8)RGBGetGValue(zoneConfig.color2),
|
||||
(u8)RGBGetBValue(zoneConfig.color2),
|
||||
(u8)zoneConfig.colorPreset,
|
||||
};
|
||||
|
||||
if(bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::ParseCommand(bool& on, bool& reset, int& zone, int& idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig)
|
||||
{
|
||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||
int rdata_len = sizeof(rdata_pkt);
|
||||
|
||||
if(bus->i2c_read_block(dev, &rdata_len, rdata_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
on = rdata_pkt[0] != 0x00;
|
||||
reset = rdata_pkt[1] != 0x00;
|
||||
idleActive = rdata_pkt[4];
|
||||
zone = rdata_pkt[5];
|
||||
zoneConfig.mode = rdata_pkt[6];
|
||||
zoneConfig.color1 = ToRGBColor(rdata_pkt[7], rdata_pkt[8], rdata_pkt[9]);
|
||||
zoneConfig.speed = rdata_pkt[10];
|
||||
zoneConfig.brightness = rdata_pkt[11];
|
||||
zoneConfig.direction = rdata_pkt[12];
|
||||
syncMode = rdata_pkt[14];
|
||||
zoneConfig.circuit = rdata_pkt[15];
|
||||
zoneConfig.color2 = ToRGBColor(rdata_pkt[16], rdata_pkt[17], rdata_pkt[18]);
|
||||
zoneConfig.colorPreset = rdata_pkt[19];
|
||||
return true;
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
| ZotacV2GPUController.cpp |
|
||||
| |
|
||||
| Driver for Zotac V2 GPU |
|
||||
| |
|
||||
| Krzysztof Haładyn (krzys_h) 16 Mar 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "ZotacV2GPUController.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
ZotacV2GPUController::ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
this->name = dev_name;
|
||||
|
||||
if(dev)
|
||||
{
|
||||
ReadVersion();
|
||||
}
|
||||
}
|
||||
|
||||
ZotacV2GPUController::~ZotacV2GPUController()
|
||||
{
|
||||
}
|
||||
|
||||
std::string ZotacV2GPUController::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);
|
||||
}
|
||||
|
||||
std::string ZotacV2GPUController::GetName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string ZotacV2GPUController::GetVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::ReadVersion()
|
||||
{
|
||||
u8 data_pkt[] = { ZOTAC_V2_GPU_REG_RGB, 0xF1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
if(bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||
int rdata_len = sizeof(rdata_pkt);
|
||||
if(bus->i2c_read_block(dev, &rdata_len, rdata_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
version = std::string((char*)rdata_pkt);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::TurnOnOff(bool on)
|
||||
{
|
||||
return SendCommand(on, false, 0, 0, 0, ZotacV2GPUZone());
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::ResetToDefaults()
|
||||
{
|
||||
return SendCommand(true, true, 0, 0, 0, ZotacV2GPUZone());
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::SetMode(int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig)
|
||||
{
|
||||
// NOTE: This only works if the device is in the ON state. Otherwise, the SetMode command will behave
|
||||
// like TurnOnOff(true), and the change will be ignored.
|
||||
|
||||
// NOTE: syncMode is per idleActive, NOT per (zone, idleActive) pair like zoneConfig is - as in,
|
||||
// you can have ACTIVE in INDIVIDUAL mode and IDLE in SYNCHRONIZED mode, but you can't have
|
||||
// different syncModes in different zones. The last written value is always applied, so make
|
||||
// sure you don't change it accidentally between writes.
|
||||
// TODO: Verify what I said above - it doesn't match the GUI, but it seems to match the NvAPISpy traces
|
||||
// From the GUI it seems like syncMode should be global, period.
|
||||
|
||||
return SendCommand(true, false, zone, idleActive, syncMode, zoneConfig);
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::GetMode(int zone, int idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig, bool& on)
|
||||
{
|
||||
u8 data_pkt[] =
|
||||
{
|
||||
ZOTAC_V2_GPU_REG_RGB,
|
||||
0xF0,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
(u8)idleActive,
|
||||
(u8)zone,
|
||||
0x00,
|
||||
};
|
||||
|
||||
if(bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||
int rdata_len = sizeof(rdata_pkt);
|
||||
if(bus->i2c_read_block(dev, &rdata_len, rdata_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool readReset;
|
||||
int readZone;
|
||||
int readIdleActive;
|
||||
if(!ParseCommand(on, readReset, readZone, readIdleActive, syncMode, zoneConfig))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(readReset != 0)
|
||||
{
|
||||
LOG_WARNING("Reset byte was not 0?!");
|
||||
}
|
||||
|
||||
if(readZone != zone || readIdleActive != idleActive)
|
||||
{
|
||||
LOG_WARNING("Got unexpected data - expected to recieve data for (%d, %d) but got for (%d, %d)", zone, idleActive, readZone, readIdleActive);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::SendCommand(bool on, bool reset, int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig)
|
||||
{
|
||||
u8 data_pkt[] =
|
||||
{
|
||||
ZOTAC_V2_GPU_REG_RGB,
|
||||
on ? (u8)0x01 : (u8)0x00,
|
||||
reset ? (u8)0x01 : (u8)0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
(u8)idleActive,
|
||||
(u8)zone,
|
||||
(u8)zoneConfig.mode,
|
||||
(u8)RGBGetRValue(zoneConfig.color1),
|
||||
(u8)RGBGetGValue(zoneConfig.color1),
|
||||
(u8)RGBGetBValue(zoneConfig.color1),
|
||||
(u8)zoneConfig.speed,
|
||||
(u8)zoneConfig.brightness,
|
||||
(u8)zoneConfig.direction,
|
||||
0x00,
|
||||
(u8)syncMode,
|
||||
(u8)zoneConfig.circuit,
|
||||
(u8)RGBGetRValue(zoneConfig.color2),
|
||||
(u8)RGBGetGValue(zoneConfig.color2),
|
||||
(u8)RGBGetBValue(zoneConfig.color2),
|
||||
(u8)zoneConfig.colorPreset,
|
||||
};
|
||||
|
||||
if(bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZotacV2GPUController::ParseCommand(bool& on, bool& reset, int& zone, int& idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig)
|
||||
{
|
||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||
int rdata_len = sizeof(rdata_pkt);
|
||||
|
||||
if(bus->i2c_read_block(dev, &rdata_len, rdata_pkt) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
on = rdata_pkt[0] != 0x00;
|
||||
reset = rdata_pkt[1] != 0x00;
|
||||
idleActive = rdata_pkt[4];
|
||||
zone = rdata_pkt[5];
|
||||
zoneConfig.mode = rdata_pkt[6];
|
||||
zoneConfig.color1 = ToRGBColor(rdata_pkt[7], rdata_pkt[8], rdata_pkt[9]);
|
||||
zoneConfig.speed = rdata_pkt[10];
|
||||
zoneConfig.brightness = rdata_pkt[11];
|
||||
zoneConfig.direction = rdata_pkt[12];
|
||||
syncMode = rdata_pkt[14];
|
||||
zoneConfig.circuit = rdata_pkt[15];
|
||||
zoneConfig.color2 = ToRGBColor(rdata_pkt[16], rdata_pkt[17], rdata_pkt[18]);
|
||||
zoneConfig.colorPreset = rdata_pkt[19];
|
||||
return true;
|
||||
}
|
||||
@@ -1,109 +1,109 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| ZotacV2GPUController.h |
|
||||
| |
|
||||
| Driver for Zotac V2 GPU |
|
||||
| |
|
||||
| Krzysztof Haładyn (krzys_h) 16 Mar 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_REG_RGB = 0xA0,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_CONFIG_IDLE = 0x00, // Config for when there is no load
|
||||
ZOTAC_V2_GPU_CONFIG_ACTIVE = 0x01, // Config for when GPU is under load
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_SYNC_INDIVIDUAL = 0x00, // Everything separated
|
||||
ZOTAC_V2_GPU_SYNC_SYNCHRONIZED = 0x01, // All internal zones synchronized, external is separated
|
||||
ZOTAC_V2_GPU_SYNC_SYNCHRONIZED_WITH_EXTERNAL = 0x02, // Everything synchronized
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_MODE_STATIC = 0x00, // Basic static color
|
||||
ZOTAC_V2_GPU_MODE_BREATH = 0x01, // Single color fades on and off
|
||||
ZOTAC_V2_GPU_MODE_FADE = 0x02, // All colors fade through the spectrum
|
||||
ZOTAC_V2_GPU_MODE_WINK = 0x03, // Single color flashes on and off
|
||||
ZOTAC_V2_GPU_MODE_FLASH = 0x04, // Each zone flashes a different color (only supported in SYNCHRONIZED or SYNCHRONIZED_WITH_EXTERNAL mode)
|
||||
ZOTAC_V2_GPU_MODE_SHINE = 0x05, // (Sound activated) Single color, on and off
|
||||
ZOTAC_V2_GPU_MODE_RANDOM = 0x06, // Single color, random patern
|
||||
ZOTAC_V2_GPU_MODE_SLIDE = 0x07, // Single color, moves one side to the other
|
||||
ZOTAC_V2_GPU_MODE_RAINBOW = 0x08, // All colors move one side to the other
|
||||
ZOTAC_V2_GPU_MODE_MARQUEE = 0x09, // Very similar to SLIDE effect
|
||||
ZOTAC_V2_GPU_MODE_DRIP = 0x0A, // Similar to SLIDE as well, less color moves
|
||||
ZOTAC_V2_GPU_MODE_DANCE = 0x0B, // (Sound activated) Single color, equalizer effect
|
||||
ZOTAC_V2_GPU_MODE_DUET = 0x17, // Dual colors
|
||||
ZOTAC_V2_GPU_MODE_PATH = 0x18, // Very similar to RAINBOW effect
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_DIR_LEFT = 0x00,
|
||||
ZOTAC_V2_GPU_DIR_RIGHT = 0x01,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_CIRCUIT_ON = 0x00,
|
||||
ZOTAC_V2_GPU_CIRCUIT_OFF = 0x01,
|
||||
};
|
||||
|
||||
struct ZotacV2GPUConfig
|
||||
{
|
||||
int numberOfZones = 0;
|
||||
bool supportsExternalLEDStrip = false;
|
||||
};
|
||||
|
||||
struct ZotacV2GPUZone
|
||||
{
|
||||
int mode = 0;
|
||||
RGBColor color1 = ToRGBColor(0, 0, 0);
|
||||
RGBColor color2 = ToRGBColor(0, 0, 0);
|
||||
unsigned int colorPreset = 0;
|
||||
unsigned int speed = 0;
|
||||
unsigned int brightness = 0;
|
||||
unsigned int direction = 0;
|
||||
unsigned int circuit = 0;
|
||||
};
|
||||
|
||||
|
||||
class ZotacV2GPUController
|
||||
{
|
||||
public:
|
||||
ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name);
|
||||
~ZotacV2GPUController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetName();
|
||||
std::string GetVersion();
|
||||
|
||||
bool TurnOnOff(bool on);
|
||||
bool ResetToDefaults();
|
||||
bool GetMode(int zone, int idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig, bool& on);
|
||||
bool SetMode(int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
|
||||
|
||||
private:
|
||||
i2c_smbus_interface* bus;
|
||||
u8 dev;
|
||||
std::string name;
|
||||
std::string version;
|
||||
|
||||
bool ReadVersion();
|
||||
bool SendCommand(bool on, bool reset, int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
|
||||
bool ParseCommand(bool& on, bool& reset, int& zone, int& idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig);
|
||||
};
|
||||
/*---------------------------------------------------------*\
|
||||
| ZotacV2GPUController.h |
|
||||
| |
|
||||
| Driver for Zotac V2 GPU |
|
||||
| |
|
||||
| Krzysztof Haładyn (krzys_h) 16 Mar 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_REG_RGB = 0xA0,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_CONFIG_IDLE = 0x00, // Config for when there is no load
|
||||
ZOTAC_V2_GPU_CONFIG_ACTIVE = 0x01, // Config for when GPU is under load
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_SYNC_INDIVIDUAL = 0x00, // Everything separated
|
||||
ZOTAC_V2_GPU_SYNC_SYNCHRONIZED = 0x01, // All internal zones synchronized, external is separated
|
||||
ZOTAC_V2_GPU_SYNC_SYNCHRONIZED_WITH_EXTERNAL = 0x02, // Everything synchronized
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_MODE_STATIC = 0x00, // Basic static color
|
||||
ZOTAC_V2_GPU_MODE_BREATH = 0x01, // Single color fades on and off
|
||||
ZOTAC_V2_GPU_MODE_FADE = 0x02, // All colors fade through the spectrum
|
||||
ZOTAC_V2_GPU_MODE_WINK = 0x03, // Single color flashes on and off
|
||||
ZOTAC_V2_GPU_MODE_FLASH = 0x04, // Each zone flashes a different color (only supported in SYNCHRONIZED or SYNCHRONIZED_WITH_EXTERNAL mode)
|
||||
ZOTAC_V2_GPU_MODE_SHINE = 0x05, // (Sound activated) Single color, on and off
|
||||
ZOTAC_V2_GPU_MODE_RANDOM = 0x06, // Single color, random patern
|
||||
ZOTAC_V2_GPU_MODE_SLIDE = 0x07, // Single color, moves one side to the other
|
||||
ZOTAC_V2_GPU_MODE_RAINBOW = 0x08, // All colors move one side to the other
|
||||
ZOTAC_V2_GPU_MODE_MARQUEE = 0x09, // Very similar to SLIDE effect
|
||||
ZOTAC_V2_GPU_MODE_DRIP = 0x0A, // Similar to SLIDE as well, less color moves
|
||||
ZOTAC_V2_GPU_MODE_DANCE = 0x0B, // (Sound activated) Single color, equalizer effect
|
||||
ZOTAC_V2_GPU_MODE_DUET = 0x17, // Dual colors
|
||||
ZOTAC_V2_GPU_MODE_PATH = 0x18, // Very similar to RAINBOW effect
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_DIR_LEFT = 0x00,
|
||||
ZOTAC_V2_GPU_DIR_RIGHT = 0x01,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ZOTAC_V2_GPU_CIRCUIT_ON = 0x00,
|
||||
ZOTAC_V2_GPU_CIRCUIT_OFF = 0x01,
|
||||
};
|
||||
|
||||
struct ZotacV2GPUConfig
|
||||
{
|
||||
int numberOfZones = 0;
|
||||
bool supportsExternalLEDStrip = false;
|
||||
};
|
||||
|
||||
struct ZotacV2GPUZone
|
||||
{
|
||||
int mode = 0;
|
||||
RGBColor color1 = ToRGBColor(0, 0, 0);
|
||||
RGBColor color2 = ToRGBColor(0, 0, 0);
|
||||
unsigned int colorPreset = 0;
|
||||
unsigned int speed = 0;
|
||||
unsigned int brightness = 0;
|
||||
unsigned int direction = 0;
|
||||
unsigned int circuit = 0;
|
||||
};
|
||||
|
||||
|
||||
class ZotacV2GPUController
|
||||
{
|
||||
public:
|
||||
ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name);
|
||||
~ZotacV2GPUController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetName();
|
||||
std::string GetVersion();
|
||||
|
||||
bool TurnOnOff(bool on);
|
||||
bool ResetToDefaults();
|
||||
bool GetMode(int zone, int idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig, bool& on);
|
||||
bool SetMode(int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
|
||||
|
||||
private:
|
||||
i2c_smbus_interface* bus;
|
||||
u8 dev;
|
||||
std::string name;
|
||||
std::string version;
|
||||
|
||||
bool ReadVersion();
|
||||
bool SendCommand(bool on, bool reset, int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
|
||||
bool ParseCommand(bool& on, bool& reset, int& zone, int& idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig);
|
||||
};
|
||||
@@ -1,67 +1,67 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| ZotacV2GPUControllerDetect.cpp |
|
||||
| |
|
||||
| Detector for Zotac V2 GPU |
|
||||
| |
|
||||
| Krzysztof Haładyn (krzys_h) 16 Mar 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "ZotacV2GPUController.h"
|
||||
#include "RGBController_ZotacV2GPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectZotacV2GPUControllers *
|
||||
* *
|
||||
* Detect ZOTAC 30/40 series RGB controllers on the enumerated I2C busses *
|
||||
* at address 0x49. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where RGB device is connected *
|
||||
* dev - I2C address of RGB device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectZotacV2GPUControllers(i2c_smbus_interface* bus, u8 i2c_addr, const std::string& name)
|
||||
{
|
||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||
int rdata_len = sizeof(rdata_pkt);
|
||||
|
||||
if(bus->i2c_read_block(i2c_addr, &rdata_len, rdata_pkt) >= 0)
|
||||
{
|
||||
ZotacV2GPUController* controller = new ZotacV2GPUController(bus, i2c_addr, name);
|
||||
RGBController_ZotacV2GPU* rgb_controller = new RGBController_ZotacV2GPU(controller);
|
||||
|
||||
if(rgb_controller->config.numberOfZones > 0)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("[%s] RGB controller not registered.", name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3070 AMP Holo LHR", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3070_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3070 Ti", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3070TI_GA102_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3070TI_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3070 Ti Trinity OC/AMP Holo", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3070TI_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 Trinity OC", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 Trinity LHR", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 AMP Holo", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 AMP Holo LHR", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 12GB Trinity OC LHR", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_12G_LHR_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_12G_LHR_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 Ti AMP Holo", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080TI_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3090 AMP Extreme Holo", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3090_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3090_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3090 Trinity", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3090_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3090_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4070 Ti Trinity OC", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4070TI_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4070TI_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4080 AMP Extreme AIRO", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4080_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4080_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4080 AMP Extreme AIRO", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4080_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4080_AMP_ALT_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4090 Trinity OC", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4090_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4090 AMP Extreme AIRO", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4090_AMP_SUB_DEV, 0x49);
|
||||
/*---------------------------------------------------------*\
|
||||
| ZotacV2GPUControllerDetect.cpp |
|
||||
| |
|
||||
| Detector for Zotac V2 GPU |
|
||||
| |
|
||||
| Krzysztof Haładyn (krzys_h) 16 Mar 2023 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "ZotacV2GPUController.h"
|
||||
#include "RGBController_ZotacV2GPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectZotacV2GPUControllers *
|
||||
* *
|
||||
* Detect ZOTAC 30/40 series RGB controllers on the enumerated I2C busses *
|
||||
* at address 0x49. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where RGB device is connected *
|
||||
* dev - I2C address of RGB device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectZotacV2GPUControllers(i2c_smbus_interface* bus, u8 i2c_addr, const std::string& name)
|
||||
{
|
||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||
int rdata_len = sizeof(rdata_pkt);
|
||||
|
||||
if(bus->i2c_read_block(i2c_addr, &rdata_len, rdata_pkt) >= 0)
|
||||
{
|
||||
ZotacV2GPUController* controller = new ZotacV2GPUController(bus, i2c_addr, name);
|
||||
RGBController_ZotacV2GPU* rgb_controller = new RGBController_ZotacV2GPU(controller);
|
||||
|
||||
if(rgb_controller->config.numberOfZones > 0)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("[%s] RGB controller not registered.", name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3070 AMP Holo LHR", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3070_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3070 Ti", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3070TI_GA102_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3070TI_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3070 Ti Trinity OC/AMP Holo", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3070TI_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 Trinity OC", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 Trinity LHR", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 AMP Holo", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 AMP Holo LHR", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 12GB Trinity OC LHR", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080_12G_LHR_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080_12G_LHR_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3080 Ti AMP Holo", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3080TI_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3090 AMP Extreme Holo", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3090_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3090_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 3090 Trinity", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX3090_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX3090_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4070 Ti Trinity OC", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4070TI_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4070TI_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4080 AMP Extreme AIRO", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4080_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4080_AMP_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4080 AMP Extreme AIRO", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4080_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4080_AMP_ALT_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4090 Trinity OC", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4090_TRINITY_SUB_DEV, 0x49);
|
||||
REGISTER_I2C_PCI_DETECTOR("ZOTAC GAMING GeForce RTX 4090 AMP Extreme AIRO", DetectZotacV2GPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, ZOTAC_SUB_VEN, ZOTAC_RTX4090_AMP_SUB_DEV, 0x49);
|
||||
Reference in new issue
Block a user