2015-12-04 14:47:52 +00:00
|
|
|
/**
|
|
|
|
* Author......: Jens Steube <jens.steube@gmail.com>
|
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ext_ADL.h>
|
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int adl_init (ADL_PTR *adl)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
|
|
|
|
|
|
|
memset (adl, 0, sizeof (ADL_PTR));
|
|
|
|
|
|
|
|
#ifdef _WIN
|
|
|
|
if (!(adl->lib = hc_dlopen ("atiadlxx.dll")))
|
|
|
|
{
|
|
|
|
adl->lib = hc_dlopen ("atiadlxy.dll");
|
|
|
|
}
|
|
|
|
#elif _POSIX
|
|
|
|
adl->lib = hc_dlopen ("libatiadlxx.so", RTLD_NOW);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!adl->lib)
|
|
|
|
{
|
2016-02-04 14:07:38 +00:00
|
|
|
//if (data.quiet == 0)
|
|
|
|
// log_info ("WARNING: load ADL library failed, proceed without ADL HWMon enabled.");
|
2016-01-31 22:48:38 +00:00
|
|
|
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Main_Control_Destroy, ADL_MAIN_CONTROL_DESTROY, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Main_Control_Create, ADL_MAIN_CONTROL_CREATE, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Adapter_NumberOfAdapters_Get, ADL_ADAPTER_NUMBEROFADAPTERS_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Adapter_AdapterInfo_Get, ADL_ADAPTER_ADAPTERINFO_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Display_DisplayInfo_Get, ADL_DISPLAY_DISPLAYINFO_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Adapter_ID_Get, ADL_ADAPTER_ID_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Adapter_VideoBiosInfo_Get, ADL_ADAPTER_VIDEOBIOSINFO_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_ThermalDevices_Enum, ADL_OVERDRIVE5_THERMALDEVICES_ENUM, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_Temperature_Get, ADL_OVERDRIVE5_TEMPERATURE_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_Temperature_Get, ADL_OVERDRIVE6_TEMPERATURE_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_CurrentActivity_Get, ADL_OVERDRIVE5_CURRENTACTIVITY_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeedInfo_Get, ADL_OVERDRIVE5_FANSPEEDINFO_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeed_Get, ADL_OVERDRIVE5_FANSPEED_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Get, ADL_OVERDRIVE6_FANSPEED_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeed_Set, ADL_OVERDRIVE5_FANSPEED_SET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Set, ADL_OVERDRIVE6_FANSPEED_SET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeedToDefault_Set, ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODParameters_Get, ADL_OVERDRIVE5_ODPARAMETERS_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODPerformanceLevels_Get, ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODPerformanceLevels_Set, ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControlInfo_Get, ADL_OVERDRIVE6_POWERCONTROLINFO_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Get, ADL_OVERDRIVE6_POWERCONTROL_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Set, ADL_OVERDRIVE6_POWERCONTROL_SET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Adapter_Active_Get, ADL_ADAPTER_ACTIVE_GET, ADL, 0)
|
2016-02-01 14:39:44 +00:00
|
|
|
//HC_LOAD_FUNC(adl, ADL_DisplayEnable_Set, ADL_DISPLAYENABLE_SET, ADL, 0)
|
2016-01-31 22:48:38 +00:00
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive_Caps, ADL_OVERDRIVE_CAPS, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Caps, ADL_OVERDRIVE6_POWERCONTROL_CAPS, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_Capabilities_Get, ADL_OVERDRIVE6_CAPABILITIES_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_StateInfo_Get, ADL_OVERDRIVE6_STATEINFO_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_CurrentStatus_Get, ADL_OVERDRIVE6_CURRENTSTATUS_GET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_State_Set, ADL_OVERDRIVE6_STATE_SET, ADL, 0)
|
|
|
|
HC_LOAD_FUNC(adl, ADL_Overdrive6_TargetTemperatureData_Get, ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET, ADL, 0)
|
|
|
|
|
|
|
|
return 0;
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
void adl_close (ADL_PTR *adl)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (adl)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (adl->lib)
|
|
|
|
hc_dlclose (adl->lib);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
myfree (adl);
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
2016-01-31 22:48:38 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Main_Control_Destroy (ADL_PTR *adl)
|
2016-01-31 22:48:38 +00:00
|
|
|
{
|
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Main_Control_Destroy ();
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Main_Control_Destroy()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Main_Control_Create (ADL_PTR *adl, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Main_Control_Create (callback, iEnumConnectedAdapters);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Main_Control_Create()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Adapter_NumberOfAdapters_Get (ADL_PTR *adl, int *lpNumAdapters)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Adapter_NumberOfAdapters_Get (lpNumAdapters);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Adapter_NumberOfAdapters_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Adapter_AdapterInfo_Get (ADL_PTR *adl, LPAdapterInfo lpInfo, int iInputSize)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Adapter_AdapterInfo_Get (lpInfo, iInputSize);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Adapter_AdapterInfo_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Display_DisplayInfo_Get (ADL_PTR *adl, int iAdapterIndex, int *iNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Display_DisplayInfo_Get (iAdapterIndex, iNumDisplays, lppInfo, iForceDetect);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Display_DisplayInfo_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Adapter_ID_Get (ADL_PTR *adl, int iAdapterIndex, int *lpAdapterID)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Adapter_ID_Get (iAdapterIndex, lpAdapterID);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Adapter_ID_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ADL_rc;
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Adapter_VideoBiosInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLBiosInfo *lpBiosInfo)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Adapter_VideoBiosInfo_Get (iAdapterIndex, lpBiosInfo);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Adapter_VideoBiosInfo_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ADL_rc;
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_ThermalDevices_Enum (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_ThermalDevices_Enum (iAdapterIndex, iThermalControllerIndex, lpThermalControllerInfo);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_ThermalDevices_Enum()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive5_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_Temperature_Get (iAdapterIndex, iThermalControllerIndex, lpTemperature);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_Temperature_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive6_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int *iTemperature)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_Temperature_Get (iAdapterIndex, iTemperature);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive6_Temperature_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_CurrentActivity_Get (ADL_PTR *adl, int iAdapterIndex, ADLPMActivity *lpActivity)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_CurrentActivity_Get (iAdapterIndex, lpActivity);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_CurrentActivity_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive5_FanSpeedInfo_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_FanSpeedInfo_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedInfo);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_FanSpeedInfo_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ADL_rc;
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive5_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_FanSpeed_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_FanSpeed_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive6_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Get (iAdapterIndex, lpFanSpeedInfo);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive6_FanSpeed_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive5_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_FanSpeed_Set (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_FanSpeed_Set()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive6_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Set (iAdapterIndex, lpFanSpeedValue);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive6_FanSpeed_Set()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive5_FanSpeedToDefault_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_FanSpeedToDefault_Set (iAdapterIndex, iThermalControllerIndex);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_FanSpeedToDefault_Set()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_ODParameters_Get (ADL_PTR *adl, int iAdapterIndex, ADLODParameters *lpOdParameters)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_ODParameters_Get (iAdapterIndex, lpOdParameters);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_ODParameters_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_ODPerformanceLevels_Get (ADL_PTR *adl, int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_ODPerformanceLevels_Get (iAdapterIndex, iDefault, lpOdPerformanceLevels);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_ODPerformanceLevels_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_ODPerformanceLevels_Set (ADL_PTR *adl, int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive5_ODPerformanceLevels_Set (iAdapterIndex, lpOdPerformanceLevels);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_ODPerformanceLevels_Set()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_PowerControlInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6PowerControlInfo *powertune)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_PowerControlInfo_Get (iAdapterIndex, powertune);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_PowerControl_Get (ADL_PTR *adl, int iAdapterIndex, int *iCurrentValue)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
int default_value = 0;
|
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_PowerControl_Get (iAdapterIndex, iCurrentValue, &default_value);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_PowerControl_Set (ADL_PTR *adl, int iAdapterIndex, int level)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
int ADL_rc = ADL_ERR;
|
|
|
|
|
|
|
|
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (adl, iAdapterIndex, &powertune)) != ADL_OK)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
log_info ("WARN: %s\n", "ADL_Overdrive6_PowerControl_Get", ADL_rc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int min = powertune.iMinValue;
|
|
|
|
int max = powertune.iMaxValue;
|
|
|
|
int step = powertune.iStepValue;
|
|
|
|
|
|
|
|
if (level < min || level > max)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL PowerControl level invalid");
|
|
|
|
|
|
|
|
return ADL_ERR;
|
|
|
|
}
|
|
|
|
if (level % step != 0)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL PowerControl step invalid");
|
|
|
|
|
|
|
|
return ADL_ERR;
|
|
|
|
}
|
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
ADL_rc = adl->ADL_Overdrive6_PowerControl_Set (iAdapterIndex, level);
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Adapter_Active_Get (ADL_PTR *adl, int iAdapterIndex, int *lpStatus)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Adapter_Active_Get (iAdapterIndex, lpStatus);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_Adapter_Active_Get()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-01 14:39:44 +00:00
|
|
|
/*
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_DisplayEnable_Set (ADL_PTR *adl, int iAdapterIndex, int *lpDisplayIndexList, int iDisplayListSize, int bPersistOnly)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_DisplayEnable_Set (iAdapterIndex, lpDisplayIndexList, iDisplayListSize, bPersistOnly);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc != ADL_OK)
|
|
|
|
{
|
|
|
|
log_info ("WARN: %s: %d\n", "ADL_DisplayEnable_Set()", ADL_rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
2016-02-01 14:39:44 +00:00
|
|
|
*/
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_Caps (ADL_PTR *adl, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive_Caps (iAdapterIndex, od_supported, od_enabled, od_version);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
return (ADL_rc);
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive6_PowerControl_Caps (ADL_PTR *adl, int iAdapterIndex, int *lpSupported)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_PowerControl_Caps (iAdapterIndex, lpSupported);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
return (ADL_rc);
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_Capabilities_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6Capabilities *caps)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_Capabilities_Get (iAdapterIndex, caps);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_StateInfo_Get (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6MemClockState *state)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_StateInfo_Get (iAdapterIndex, type, state);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (ADL_rc == ADL_OK)
|
|
|
|
{
|
|
|
|
// check if clocks are okay with step sizes
|
|
|
|
// if not run a little hack: adjust the clocks to nearest clock size (clock down just a little bit)
|
|
|
|
|
|
|
|
ADLOD6Capabilities caps;
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
if ((hm_ADL_Overdrive_Capabilities_Get (adl, iAdapterIndex, &caps)) != ADL_OK)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
log_info ("ERROR: failed to get ADL device capabilities");
|
|
|
|
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state->state.aLevels[0].iEngineClock % caps.sEngineClockRange.iStep != 0)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL engine step size invalid for performance level 1");
|
|
|
|
state->state.aLevels[0].iEngineClock -= state->state.aLevels[0].iEngineClock % caps.sEngineClockRange.iStep;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state->state.aLevels[1].iEngineClock % caps.sEngineClockRange.iStep != 0)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL engine step size invalid for performance level 2");
|
|
|
|
state->state.aLevels[1].iEngineClock -= state->state.aLevels[1].iEngineClock % caps.sEngineClockRange.iStep;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state->state.aLevels[0].iMemoryClock % caps.sMemoryClockRange.iStep != 0)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL memory step size invalid for performance level 1");
|
|
|
|
state->state.aLevels[0].iMemoryClock -= state->state.aLevels[0].iMemoryClock % caps.sMemoryClockRange.iStep;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state->state.aLevels[1].iMemoryClock % caps.sMemoryClockRange.iStep != 0)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL memory step size invalid for performance level 2");
|
|
|
|
state->state.aLevels[1].iMemoryClock -= state->state.aLevels[1].iMemoryClock % caps.sMemoryClockRange.iStep;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_CurrentStatus_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6CurrentStatus *status)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_CurrentStatus_Get (iAdapterIndex, status);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive_State_Set (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6StateInfo *state)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
// sanity checks
|
|
|
|
|
|
|
|
ADLOD6Capabilities caps;
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
if ((hm_ADL_Overdrive_Capabilities_Get (adl, iAdapterIndex, &caps)) != ADL_OK)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
log_info ("ERROR: failed to get ADL device capabilities");
|
|
|
|
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state->aLevels[0].iEngineClock < caps.sEngineClockRange.iMin || state->aLevels[1].iEngineClock > caps.sEngineClockRange.iMax)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL engine clock outside valid range");
|
|
|
|
|
|
|
|
return ADL_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state->aLevels[1].iEngineClock % caps.sEngineClockRange.iStep != 0)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL engine step size invalid");
|
|
|
|
|
|
|
|
return ADL_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state->aLevels[0].iMemoryClock < caps.sMemoryClockRange.iMin || state->aLevels[1].iMemoryClock > caps.sMemoryClockRange.iMax)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL memory clock outside valid range");
|
|
|
|
|
|
|
|
return ADL_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state->aLevels[1].iMemoryClock % caps.sMemoryClockRange.iStep != 0)
|
|
|
|
{
|
|
|
|
log_info ("WARN: ADL memory step size invalid");
|
|
|
|
|
|
|
|
return ADL_ERR;
|
|
|
|
}
|
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_State_Set (iAdapterIndex, type, state);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
int hm_ADL_Overdrive6_TargetTemperatureData_Get (ADL_PTR *adl, int iAdapterIndex, int *cur_temp, int *default_temp)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-01-31 22:48:38 +00:00
|
|
|
if (!adl) return (-1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
int ADL_rc = adl->ADL_Overdrive6_TargetTemperatureData_Get (iAdapterIndex, cur_temp, default_temp);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
return (ADL_rc);
|
|
|
|
}
|