Store name in PalitGPUController to avoid setting it in detector
This commit is contained in:
parent
2c630a5218
commit
f8d3c7a838
4 changed files with 29 additions and 18 deletions
|
|
@ -11,10 +11,11 @@
|
||||||
|
|
||||||
#include "PalitGPUController.h"
|
#include "PalitGPUController.h"
|
||||||
|
|
||||||
PalitGPUController::PalitGPUController(i2c_smbus_interface* bus, palit_dev_id dev)
|
PalitGPUController::PalitGPUController(i2c_smbus_interface* bus, palit_dev_id dev, std::string dev_name)
|
||||||
{
|
{
|
||||||
this->bus = bus;
|
this->bus = bus;
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
|
this->name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
PalitGPUController::~PalitGPUController()
|
PalitGPUController::~PalitGPUController()
|
||||||
|
|
@ -32,6 +33,11 @@ std::string PalitGPUController::GetDeviceLocation()
|
||||||
return("I2C: " + return_string);
|
return("I2C: " + return_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string PalitGPUController::GetName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
void PalitGPUController::SetDirect(unsigned char red, unsigned char green, unsigned char blue)
|
void PalitGPUController::SetDirect(unsigned char red, unsigned char green, unsigned char blue)
|
||||||
{
|
{
|
||||||
// NvAPI_I2CWriteEx: Dev: 0x08 RegSize: 0x01 Reg: 0x03 Size: 0x04 Data: 0xFF 0x00 0x00 0xFF
|
// NvAPI_I2CWriteEx: Dev: 0x08 RegSize: 0x01 Reg: 0x03 Size: 0x04 Data: 0xFF 0x00 0x00 0xFF
|
||||||
|
|
|
||||||
|
|
@ -14,30 +14,31 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "i2c_smbus.h"
|
#include "i2c_smbus.h"
|
||||||
|
|
||||||
typedef unsigned char palit_dev_id;
|
typedef unsigned char palit_dev_id;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PALIT_GPU_MODE_DIRECT = 0x00,
|
PALIT_GPU_MODE_DIRECT = 0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PALIT_GPU_REG_LED = 0x03,
|
PALIT_GPU_REG_LED = 0x03,
|
||||||
};
|
};
|
||||||
|
|
||||||
class PalitGPUController
|
class PalitGPUController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PalitGPUController(i2c_smbus_interface* bus, palit_dev_id dev);
|
PalitGPUController(i2c_smbus_interface* bus, palit_dev_id dev, std::string dev_name);
|
||||||
~PalitGPUController();
|
~PalitGPUController();
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetName();
|
||||||
|
|
||||||
void SetDirect(unsigned char red, unsigned char green, unsigned char blue);
|
void SetDirect(unsigned char red, unsigned char green, unsigned char blue);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
i2c_smbus_interface* bus;
|
i2c_smbus_interface* bus;
|
||||||
palit_dev_id dev;
|
palit_dev_id dev;
|
||||||
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,19 +36,23 @@ void DetectPalitGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Check for PALIT string |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
const uint8_t palit[] = {'P', 'A', 'L', 'I', 'T'};
|
const uint8_t palit[] = {'P', 'A', 'L', 'I', 'T'};
|
||||||
for (size_t i = 0; i < sizeof(palit); i++)
|
|
||||||
|
for(size_t i = 0; i < sizeof(palit); i++)
|
||||||
{
|
{
|
||||||
int32_t letter = bus->i2c_smbus_read_byte_data(i2c_addr, 0x07 + (u8)i);
|
int32_t letter = bus->i2c_smbus_read_byte_data(i2c_addr, 0x07 + (u8)i);
|
||||||
if (palit[i] != letter)
|
|
||||||
|
if(palit[i] != letter)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PalitGPUController* controller = new PalitGPUController(bus, i2c_addr);
|
PalitGPUController* controller = new PalitGPUController(bus, i2c_addr, name);
|
||||||
RGBController_PalitGPU* rgb_controller = new RGBController_PalitGPU(controller);
|
RGBController_PalitGPU* rgb_controller = new RGBController_PalitGPU(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
} /* DetectPalitGPUControllers() */
|
} /* DetectPalitGPUControllers() */
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ RGBController_PalitGPU::RGBController_PalitGPU(PalitGPUController* controller_pt
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = "Palit GPU";
|
name = controller->GetName();
|
||||||
vendor = "Palit";
|
vendor = "Palit";
|
||||||
description = "Legacy Palit RGB GPU Device";
|
description = "Legacy Palit RGB GPU Device";
|
||||||
location = controller->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
|
|
@ -52,8 +52,8 @@ void RGBController_PalitGPU::SetupZones()
|
||||||
| This device only has one LED, so create a single zone and |
|
| This device only has one LED, so create a single zone and |
|
||||||
| LED for it |
|
| LED for it |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
zone* new_zone = new zone();
|
zone* new_zone = new zone();
|
||||||
led* new_led = new led();
|
led* new_led = new led();
|
||||||
|
|
||||||
new_zone->name = "GPU Zone";
|
new_zone->name = "GPU Zone";
|
||||||
new_zone->type = ZONE_TYPE_SINGLE;
|
new_zone->type = ZONE_TYPE_SINGLE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue