Commit 7349a3af authored by David Francis's avatar David Francis Committed by Alex Deucher

drm/amd: update ATIF functions in AMD ACPI header

The ACPI interface in AMD was a few years out of date
and contained some unused and deprecated functions

Remove functions: Select Active Displays, Get Lid State,
Get TV Standard, Set TV Standard, Get Panel Expansion Mode,
Set Panel Expansion Mode, Get Graphics Device Types

Add functions: Query Backlight Transfer Characteristics,
Ready To Undock Notification

Changed functions: Get System Parameters,
Get System BIOS Requests

All changes are right from the standard
ATI ACPI Control Methods V0.44
Signed-off-by: default avatarDavid Francis <David.Francis@amd.com>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c1ee92f9
...@@ -41,28 +41,21 @@ struct amdgpu_atif_notification_cfg { ...@@ -41,28 +41,21 @@ struct amdgpu_atif_notification_cfg {
}; };
struct amdgpu_atif_notifications { struct amdgpu_atif_notifications {
bool display_switch;
bool expansion_mode_change;
bool thermal_state; bool thermal_state;
bool forced_power_state; bool forced_power_state;
bool system_power_state; bool system_power_state;
bool display_conf_change;
bool px_gfx_switch;
bool brightness_change; bool brightness_change;
bool dgpu_display_event; bool dgpu_display_event;
bool gpu_package_power_limit;
}; };
struct amdgpu_atif_functions { struct amdgpu_atif_functions {
bool system_params; bool system_params;
bool sbios_requests; bool sbios_requests;
bool select_active_disp;
bool lid_state;
bool get_tv_standard;
bool set_tv_standard;
bool get_panel_expansion_mode;
bool set_panel_expansion_mode;
bool temperature_change; bool temperature_change;
bool graphics_device_types; bool query_backlight_transfer_characteristics;
bool ready_to_undock;
bool external_gpu_information;
}; };
struct amdgpu_atif { struct amdgpu_atif {
...@@ -137,15 +130,12 @@ static union acpi_object *amdgpu_atif_call(struct amdgpu_atif *atif, ...@@ -137,15 +130,12 @@ static union acpi_object *amdgpu_atif_call(struct amdgpu_atif *atif,
*/ */
static void amdgpu_atif_parse_notification(struct amdgpu_atif_notifications *n, u32 mask) static void amdgpu_atif_parse_notification(struct amdgpu_atif_notifications *n, u32 mask)
{ {
n->display_switch = mask & ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED;
n->expansion_mode_change = mask & ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED;
n->thermal_state = mask & ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED; n->thermal_state = mask & ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED;
n->forced_power_state = mask & ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED; n->forced_power_state = mask & ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED;
n->system_power_state = mask & ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED; n->system_power_state = mask & ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED;
n->display_conf_change = mask & ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED;
n->px_gfx_switch = mask & ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED;
n->brightness_change = mask & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED; n->brightness_change = mask & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED;
n->dgpu_display_event = mask & ATIF_DGPU_DISPLAY_EVENT_SUPPORTED; n->dgpu_display_event = mask & ATIF_DGPU_DISPLAY_EVENT_SUPPORTED;
n->gpu_package_power_limit = mask & ATIF_GPU_PACKAGE_POWER_LIMIT_REQUEST_SUPPORTED;
} }
/** /**
...@@ -162,14 +152,11 @@ static void amdgpu_atif_parse_functions(struct amdgpu_atif_functions *f, u32 mas ...@@ -162,14 +152,11 @@ static void amdgpu_atif_parse_functions(struct amdgpu_atif_functions *f, u32 mas
{ {
f->system_params = mask & ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED; f->system_params = mask & ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED;
f->sbios_requests = mask & ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED; f->sbios_requests = mask & ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED;
f->select_active_disp = mask & ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED;
f->lid_state = mask & ATIF_GET_LID_STATE_SUPPORTED;
f->get_tv_standard = mask & ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED;
f->set_tv_standard = mask & ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED;
f->get_panel_expansion_mode = mask & ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED;
f->set_panel_expansion_mode = mask & ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED;
f->temperature_change = mask & ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED; f->temperature_change = mask & ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED;
f->graphics_device_types = mask & ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED; f->query_backlight_transfer_characteristics =
mask & ATIF_QUERY_BACKLIGHT_TRANSFER_CHARACTERISTICS_SUPPORTED;
f->ready_to_undock = mask & ATIF_READY_TO_UNDOCK_NOTIFICATION_SUPPORTED;
f->external_gpu_information = mask & ATIF_GET_EXTERNAL_GPU_INFORMATION_SUPPORTED;
} }
/** /**
......
...@@ -126,26 +126,18 @@ struct atcs_pref_req_output { ...@@ -126,26 +126,18 @@ struct atcs_pref_req_output {
* DWORD - supported functions bit vector * DWORD - supported functions bit vector
*/ */
/* Notifications mask */ /* Notifications mask */
# define ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED (1 << 0)
# define ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED (1 << 1)
# define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED (1 << 2) # define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED (1 << 2)
# define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED (1 << 3) # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED (1 << 3)
# define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED (1 << 4) # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED (1 << 4)
# define ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED (1 << 5)
# define ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED (1 << 6)
# define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED (1 << 7) # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED (1 << 7)
# define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED (1 << 8) # define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED (1 << 8)
# define ATIF_GPU_PACKAGE_POWER_LIMIT_REQUEST_SUPPORTED (1 << 12)
/* supported functions vector */ /* supported functions vector */
# define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 0) # define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 0)
# define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 1) # define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 1)
# define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 2)
# define ATIF_GET_LID_STATE_SUPPORTED (1 << 3)
# define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 4)
# define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 5)
# define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 6)
# define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 7)
# define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 12) # define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 12)
# define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 14) # define ATIF_QUERY_BACKLIGHT_TRANSFER_CHARACTERISTICS_SUPPORTED (1 << 15)
# define ATIF_READY_TO_UNDOCK_NOTIFICATION_SUPPORTED (1 << 16)
# define ATIF_GET_EXTERNAL_GPU_INFORMATION_SUPPORTED (1 << 20) # define ATIF_GET_EXTERNAL_GPU_INFORMATION_SUPPORTED (1 << 20)
#define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS 0x1 #define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS 0x1
/* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS /* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
...@@ -170,6 +162,10 @@ struct atcs_pref_req_output { ...@@ -170,6 +162,10 @@ struct atcs_pref_req_output {
* n (0xd0-0xd9) is specified in notify command code. * n (0xd0-0xd9) is specified in notify command code.
* bit 2: * bit 2:
* 1 - lid changes not reported though int10 * 1 - lid changes not reported though int10
* bit 3:
* 1 - system bios controls overclocking
* bit 4:
* 1 - enable overclocking
*/ */
#define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS 0x2 #define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS 0x2
/* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS /* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
...@@ -177,28 +173,23 @@ struct atcs_pref_req_output { ...@@ -177,28 +173,23 @@ struct atcs_pref_req_output {
* OUTPUT: * OUTPUT:
* WORD - structure size in bytes (includes size field) * WORD - structure size in bytes (includes size field)
* DWORD - pending sbios requests * DWORD - pending sbios requests
* BYTE - panel expansion mode * BYTE - reserved (all zeroes)
* BYTE - thermal state: target gfx controller * BYTE - thermal state: target gfx controller
* BYTE - thermal state: state id (0: exit state, non-0: state) * BYTE - thermal state: state id (0: exit state, non-0: state)
* BYTE - forced power state: target gfx controller * BYTE - forced power state: target gfx controller
* BYTE - forced power state: state id * BYTE - forced power state: state id (0: forced state, non-0: state)
* BYTE - system power source * BYTE - system power source
* BYTE - panel backlight level (0-255) * BYTE - panel backlight level (0-255)
* BYTE - GPU package power limit: target gfx controller
* DWORD - GPU package power limit: value (24:8 fractional format, Watts)
*/ */
/* pending sbios requests */ /* pending sbios requests */
# define ATIF_DISPLAY_SWITCH_REQUEST (1 << 0)
# define ATIF_EXPANSION_MODE_CHANGE_REQUEST (1 << 1)
# define ATIF_THERMAL_STATE_CHANGE_REQUEST (1 << 2) # define ATIF_THERMAL_STATE_CHANGE_REQUEST (1 << 2)
# define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST (1 << 3) # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST (1 << 3)
# define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST (1 << 4) # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST (1 << 4)
# define ATIF_DISPLAY_CONF_CHANGE_REQUEST (1 << 5)
# define ATIF_PX_GFX_SWITCH_REQUEST (1 << 6)
# define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST (1 << 7) # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST (1 << 7)
# define ATIF_DGPU_DISPLAY_EVENT (1 << 8) # define ATIF_DGPU_DISPLAY_EVENT (1 << 8)
/* panel expansion mode */ # define ATIF_GPU_PACKAGE_POWER_LIMIT_REQUEST (1 << 12)
# define ATIF_PANEL_EXPANSION_DISABLE 0
# define ATIF_PANEL_EXPANSION_FULL 1
# define ATIF_PANEL_EXPANSION_ASPECT 2
/* target gfx controller */ /* target gfx controller */
# define ATIF_TARGET_GFX_SINGLE 0 # define ATIF_TARGET_GFX_SINGLE 0
# define ATIF_TARGET_GFX_PX_IGPU 1 # define ATIF_TARGET_GFX_PX_IGPU 1
...@@ -208,76 +199,6 @@ struct atcs_pref_req_output { ...@@ -208,76 +199,6 @@ struct atcs_pref_req_output {
# define ATIF_POWER_SOURCE_DC 2 # define ATIF_POWER_SOURCE_DC 2
# define ATIF_POWER_SOURCE_RESTRICTED_AC_1 3 # define ATIF_POWER_SOURCE_RESTRICTED_AC_1 3
# define ATIF_POWER_SOURCE_RESTRICTED_AC_2 4 # define ATIF_POWER_SOURCE_RESTRICTED_AC_2 4
#define ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS 0x3
/* ARG0: ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS
* ARG1:
* WORD - structure size in bytes (includes size field)
* WORD - selected displays
* WORD - connected displays
* OUTPUT:
* WORD - structure size in bytes (includes size field)
* WORD - selected displays
*/
# define ATIF_LCD1 (1 << 0)
# define ATIF_CRT1 (1 << 1)
# define ATIF_TV (1 << 2)
# define ATIF_DFP1 (1 << 3)
# define ATIF_CRT2 (1 << 4)
# define ATIF_LCD2 (1 << 5)
# define ATIF_DFP2 (1 << 7)
# define ATIF_CV (1 << 8)
# define ATIF_DFP3 (1 << 9)
# define ATIF_DFP4 (1 << 10)
# define ATIF_DFP5 (1 << 11)
# define ATIF_DFP6 (1 << 12)
#define ATIF_FUNCTION_GET_LID_STATE 0x4
/* ARG0: ATIF_FUNCTION_GET_LID_STATE
* ARG1: none
* OUTPUT:
* WORD - structure size in bytes (includes size field)
* BYTE - lid state (0: open, 1: closed)
*
* GET_LID_STATE only works at boot and resume, for general lid
* status, use the kernel provided status
*/
#define ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS 0x5
/* ARG0: ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS
* ARG1: none
* OUTPUT:
* WORD - structure size in bytes (includes size field)
* BYTE - 0
* BYTE - TV standard
*/
# define ATIF_TV_STD_NTSC 0
# define ATIF_TV_STD_PAL 1
# define ATIF_TV_STD_PALM 2
# define ATIF_TV_STD_PAL60 3
# define ATIF_TV_STD_NTSCJ 4
# define ATIF_TV_STD_PALCN 5
# define ATIF_TV_STD_PALN 6
# define ATIF_TV_STD_SCART_RGB 9
#define ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS 0x6
/* ARG0: ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS
* ARG1:
* WORD - structure size in bytes (includes size field)
* BYTE - 0
* BYTE - TV standard
* OUTPUT: none
*/
#define ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS 0x7
/* ARG0: ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS
* ARG1: none
* OUTPUT:
* WORD - structure size in bytes (includes size field)
* BYTE - panel expansion mode
*/
#define ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS 0x8
/* ARG0: ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS
* ARG1:
* WORD - structure size in bytes (includes size field)
* BYTE - panel expansion mode
* OUTPUT: none
*/
#define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION 0xD #define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION 0xD
/* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION /* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
* ARG1: * ARG1:
...@@ -286,21 +207,43 @@ struct atcs_pref_req_output { ...@@ -286,21 +207,43 @@ struct atcs_pref_req_output {
* BYTE - current temperature (degress Celsius) * BYTE - current temperature (degress Celsius)
* OUTPUT: none * OUTPUT: none
*/ */
#define ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES 0xF #define ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS 0x10
/* ARG0: ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES /* ARG0: ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS
* ARG1: none * ARG1:
* WORD - structure size in bytes (includes size field)
* BYTE - requested display
* OUTPUT: * OUTPUT:
* WORD - number of gfx devices * WORD - structure size in bytes (includes size field)
* WORD - device structure size in bytes (excludes device size field) * WORD - flags (currently all 16 bits are reserved)
* DWORD - flags \ * BYTE - error code (on failure, disregard all below fields)
* WORD - bus number } repeated structure * BYTE - AC level (default brightness in percent when machine has full power)
* WORD - device number / * BYTE - DC level (default brightness in percent when machine is on battery)
* BYTE - min input signal, in range 0-255, corresponding to 0% backlight
* BYTE - max input signal, in range 0-255, corresponding to 100% backlight
* BYTE - number of reported data points
* BYTE - luminance level in percent \ repeated structure
* BYTE - input signal in range 0-255 / does not have entries for 0% and 100%
*/
/* requested display */
# define ATIF_QBTC_REQUEST_LCD1 0
# define ATIF_QBTC_REQUEST_CRT1 1
# define ATIF_QBTC_REQUEST_DFP1 3
# define ATIF_QBTC_REQUEST_CRT2 4
# define ATIF_QBTC_REQUEST_LCD2 5
# define ATIF_QBTC_REQUEST_DFP2 7
# define ATIF_QBTC_REQUEST_DFP3 9
# define ATIF_QBTC_REQUEST_DFP4 10
# define ATIF_QBTC_REQUEST_DFP5 11
# define ATIF_QBTC_REQUEST_DFP6 12
/* error code */
# define ATIF_QBTC_ERROR_CODE_SUCCESS 0
# define ATIF_QBTC_ERROR_CODE_FAILURE 1
# define ATIF_QBTC_ERROR_CODE_DEVICE_NOT_SUPPORTED 2
#define ATIF_FUNCTION_READY_TO_UNDOCK_NOTIFICATION 0x11
/* ARG0: ATIF_FUNCTION_READY_TO_UNDOCK_NOTIFICATION
* ARG1: none
* OUTPUT: none
*/ */
/* flags */
# define ATIF_PX_REMOVABLE_GRAPHICS_DEVICE (1 << 0)
# define ATIF_XGP_PORT (1 << 1)
# define ATIF_VGA_ENABLED_GRAPHICS_DEVICE (1 << 2)
# define ATIF_XGP_PORT_IN_DOCK (1 << 3)
#define ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION 0x15 #define ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION 0x15
/* ARG0: ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION /* ARG0: ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION
* ARG1: none * ARG1: none
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment