drm/exynos: Stop using drm_framebuffer_unregister_private
[linux/fpc-iii.git] / drivers / gpu / drm / radeon / radeon_acpi.h
blobcd872f7953c61cdfd8ee30b959dbfa59436edf33
1 /*
2 * Copyright 2012 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef RADEON_ACPI_H
25 #define RADEON_ACPI_H
27 struct radeon_device;
28 struct acpi_bus_event;
30 int radeon_atif_handler(struct radeon_device *rdev,
31 struct acpi_bus_event *event);
33 /* AMD hw uses four ACPI control methods:
34 * 1. ATIF
35 * ARG0: (ACPI_INTEGER) function code
36 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
37 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
38 * ATIF provides an entry point for the gfx driver to interact with the sbios.
39 * The AMD ACPI notification mechanism uses Notify (VGA, 0x81) or a custom
40 * notification. Which notification is used as indicated by the ATIF Control
41 * Method GET_SYSTEM_PARAMETERS. When the driver receives Notify (VGA, 0x81) or
42 * a custom notification it invokes ATIF Control Method GET_SYSTEM_BIOS_REQUESTS
43 * to identify pending System BIOS requests and associated parameters. For
44 * example, if one of the pending requests is DISPLAY_SWITCH_REQUEST, the driver
45 * will perform display device detection and invoke ATIF Control Method
46 * SELECT_ACTIVE_DISPLAYS.
48 * 2. ATPX
49 * ARG0: (ACPI_INTEGER) function code
50 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
51 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
52 * ATPX methods are used on PowerXpress systems to handle mux switching and
53 * discrete GPU power control.
55 * 3. ATRM
56 * ARG0: (ACPI_INTEGER) offset of vbios rom data
57 * ARG1: (ACPI_BUFFER) size of the buffer to fill (up to 4K).
58 * OUTPUT: (ACPI_BUFFER) output buffer
59 * ATRM provides an interfacess to access the discrete GPU vbios image on
60 * PowerXpress systems with multiple GPUs.
62 * 4. ATCS
63 * ARG0: (ACPI_INTEGER) function code
64 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
65 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
66 * ATCS provides an interface to AMD chipset specific functionality.
69 /* ATIF */
70 #define ATIF_FUNCTION_VERIFY_INTERFACE 0x0
71 /* ARG0: ATIF_FUNCTION_VERIFY_INTERFACE
72 * ARG1: none
73 * OUTPUT:
74 * WORD - structure size in bytes (includes size field)
75 * WORD - version
76 * DWORD - supported notifications mask
77 * DWORD - supported functions bit vector
79 /* Notifications mask */
80 # define ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED (1 << 0)
81 # define ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED (1 << 1)
82 # define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED (1 << 2)
83 # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED (1 << 3)
84 # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED (1 << 4)
85 # define ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED (1 << 5)
86 # define ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED (1 << 6)
87 # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED (1 << 7)
88 # define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED (1 << 8)
89 /* supported functions vector */
90 # define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 0)
91 # define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 1)
92 # define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 2)
93 # define ATIF_GET_LID_STATE_SUPPORTED (1 << 3)
94 # define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 4)
95 # define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 5)
96 # define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 6)
97 # define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 7)
98 # define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 12)
99 # define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 14)
100 #define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS 0x1
101 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
102 * ARG1: none
103 * OUTPUT:
104 * WORD - structure size in bytes (includes size field)
105 * DWORD - valid flags mask
106 * DWORD - flags
108 * OR
110 * WORD - structure size in bytes (includes size field)
111 * DWORD - valid flags mask
112 * DWORD - flags
113 * BYTE - notify command code
115 * flags
116 * bits 1:0:
117 * 0 - Notify(VGA, 0x81) is not used for notification
118 * 1 - Notify(VGA, 0x81) is used for notification
119 * 2 - Notify(VGA, n) is used for notification where
120 * n (0xd0-0xd9) is specified in notify command code.
121 * bit 2:
122 * 1 - lid changes not reported though int10
124 #define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS 0x2
125 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
126 * ARG1: none
127 * OUTPUT:
128 * WORD - structure size in bytes (includes size field)
129 * DWORD - pending sbios requests
130 * BYTE - panel expansion mode
131 * BYTE - thermal state: target gfx controller
132 * BYTE - thermal state: state id (0: exit state, non-0: state)
133 * BYTE - forced power state: target gfx controller
134 * BYTE - forced power state: state id
135 * BYTE - system power source
136 * BYTE - panel backlight level (0-255)
138 /* pending sbios requests */
139 # define ATIF_DISPLAY_SWITCH_REQUEST (1 << 0)
140 # define ATIF_EXPANSION_MODE_CHANGE_REQUEST (1 << 1)
141 # define ATIF_THERMAL_STATE_CHANGE_REQUEST (1 << 2)
142 # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST (1 << 3)
143 # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST (1 << 4)
144 # define ATIF_DISPLAY_CONF_CHANGE_REQUEST (1 << 5)
145 # define ATIF_PX_GFX_SWITCH_REQUEST (1 << 6)
146 # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST (1 << 7)
147 # define ATIF_DGPU_DISPLAY_EVENT (1 << 8)
148 /* panel expansion mode */
149 # define ATIF_PANEL_EXPANSION_DISABLE 0
150 # define ATIF_PANEL_EXPANSION_FULL 1
151 # define ATIF_PANEL_EXPANSION_ASPECT 2
152 /* target gfx controller */
153 # define ATIF_TARGET_GFX_SINGLE 0
154 # define ATIF_TARGET_GFX_PX_IGPU 1
155 # define ATIF_TARGET_GFX_PX_DGPU 2
156 /* system power source */
157 # define ATIF_POWER_SOURCE_AC 1
158 # define ATIF_POWER_SOURCE_DC 2
159 # define ATIF_POWER_SOURCE_RESTRICTED_AC_1 3
160 # define ATIF_POWER_SOURCE_RESTRICTED_AC_2 4
161 #define ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS 0x3
162 /* ARG0: ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS
163 * ARG1:
164 * WORD - structure size in bytes (includes size field)
165 * WORD - selected displays
166 * WORD - connected displays
167 * OUTPUT:
168 * WORD - structure size in bytes (includes size field)
169 * WORD - selected displays
171 # define ATIF_LCD1 (1 << 0)
172 # define ATIF_CRT1 (1 << 1)
173 # define ATIF_TV (1 << 2)
174 # define ATIF_DFP1 (1 << 3)
175 # define ATIF_CRT2 (1 << 4)
176 # define ATIF_LCD2 (1 << 5)
177 # define ATIF_DFP2 (1 << 7)
178 # define ATIF_CV (1 << 8)
179 # define ATIF_DFP3 (1 << 9)
180 # define ATIF_DFP4 (1 << 10)
181 # define ATIF_DFP5 (1 << 11)
182 # define ATIF_DFP6 (1 << 12)
183 #define ATIF_FUNCTION_GET_LID_STATE 0x4
184 /* ARG0: ATIF_FUNCTION_GET_LID_STATE
185 * ARG1: none
186 * OUTPUT:
187 * WORD - structure size in bytes (includes size field)
188 * BYTE - lid state (0: open, 1: closed)
190 * GET_LID_STATE only works at boot and resume, for general lid
191 * status, use the kernel provided status
193 #define ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS 0x5
194 /* ARG0: ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS
195 * ARG1: none
196 * OUTPUT:
197 * WORD - structure size in bytes (includes size field)
198 * BYTE - 0
199 * BYTE - TV standard
201 # define ATIF_TV_STD_NTSC 0
202 # define ATIF_TV_STD_PAL 1
203 # define ATIF_TV_STD_PALM 2
204 # define ATIF_TV_STD_PAL60 3
205 # define ATIF_TV_STD_NTSCJ 4
206 # define ATIF_TV_STD_PALCN 5
207 # define ATIF_TV_STD_PALN 6
208 # define ATIF_TV_STD_SCART_RGB 9
209 #define ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS 0x6
210 /* ARG0: ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS
211 * ARG1:
212 * WORD - structure size in bytes (includes size field)
213 * BYTE - 0
214 * BYTE - TV standard
215 * OUTPUT: none
217 #define ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS 0x7
218 /* ARG0: ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS
219 * ARG1: none
220 * OUTPUT:
221 * WORD - structure size in bytes (includes size field)
222 * BYTE - panel expansion mode
224 #define ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS 0x8
225 /* ARG0: ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS
226 * ARG1:
227 * WORD - structure size in bytes (includes size field)
228 * BYTE - panel expansion mode
229 * OUTPUT: none
231 #define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION 0xD
232 /* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
233 * ARG1:
234 * WORD - structure size in bytes (includes size field)
235 * WORD - gfx controller id
236 * BYTE - current temperature (degress Celsius)
237 * OUTPUT: none
239 #define ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES 0xF
240 /* ARG0: ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES
241 * ARG1: none
242 * OUTPUT:
243 * WORD - number of gfx devices
244 * WORD - device structure size in bytes (excludes device size field)
245 * DWORD - flags \
246 * WORD - bus number } repeated structure
247 * WORD - device number /
249 /* flags */
250 # define ATIF_PX_REMOVABLE_GRAPHICS_DEVICE (1 << 0)
251 # define ATIF_XGP_PORT (1 << 1)
252 # define ATIF_VGA_ENABLED_GRAPHICS_DEVICE (1 << 2)
253 # define ATIF_XGP_PORT_IN_DOCK (1 << 3)
255 /* ATPX */
256 #define ATPX_FUNCTION_VERIFY_INTERFACE 0x0
257 /* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE
258 * ARG1: none
259 * OUTPUT:
260 * WORD - structure size in bytes (includes size field)
261 * WORD - version
262 * DWORD - supported functions bit vector
264 /* supported functions vector */
265 # define ATPX_GET_PX_PARAMETERS_SUPPORTED (1 << 0)
266 # define ATPX_POWER_CONTROL_SUPPORTED (1 << 1)
267 # define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED (1 << 2)
268 # define ATPX_I2C_MUX_CONTROL_SUPPORTED (1 << 3)
269 # define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4)
270 # define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED (1 << 5)
271 # define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED (1 << 7)
272 # define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED (1 << 8)
273 #define ATPX_FUNCTION_GET_PX_PARAMETERS 0x1
274 /* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS
275 * ARG1: none
276 * OUTPUT:
277 * WORD - structure size in bytes (includes size field)
278 * DWORD - valid flags mask
279 * DWORD - flags
281 /* flags */
282 # define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 0)
283 # define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 1)
284 # define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 2)
285 # define ATPX_CRT1_RGB_SIGNAL_MUXED (1 << 3)
286 # define ATPX_TV_SIGNAL_MUXED (1 << 4)
287 # define ATPX_DFP_SIGNAL_MUXED (1 << 5)
288 # define ATPX_SEPARATE_MUX_FOR_I2C (1 << 6)
289 # define ATPX_DYNAMIC_PX_SUPPORTED (1 << 7)
290 # define ATPX_ACF_NOT_SUPPORTED (1 << 8)
291 # define ATPX_FIXED_NOT_SUPPORTED (1 << 9)
292 # define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED (1 << 10)
293 # define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS (1 << 11)
294 # define ATPX_DGPU_CAN_DRIVE_DISPLAYS (1 << 12)
295 # define ATPX_MS_HYBRID_GFX_SUPPORTED (1 << 14)
296 #define ATPX_FUNCTION_POWER_CONTROL 0x2
297 /* ARG0: ATPX_FUNCTION_POWER_CONTROL
298 * ARG1:
299 * WORD - structure size in bytes (includes size field)
300 * BYTE - dGPU power state (0: power off, 1: power on)
301 * OUTPUT: none
303 #define ATPX_FUNCTION_DISPLAY_MUX_CONTROL 0x3
304 /* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL
305 * ARG1:
306 * WORD - structure size in bytes (includes size field)
307 * WORD - display mux control (0: iGPU, 1: dGPU)
308 * OUTPUT: none
310 # define ATPX_INTEGRATED_GPU 0
311 # define ATPX_DISCRETE_GPU 1
312 #define ATPX_FUNCTION_I2C_MUX_CONTROL 0x4
313 /* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL
314 * ARG1:
315 * WORD - structure size in bytes (includes size field)
316 * WORD - i2c/aux/hpd mux control (0: iGPU, 1: dGPU)
317 * OUTPUT: none
319 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION 0x5
320 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION
321 * ARG1:
322 * WORD - structure size in bytes (includes size field)
323 * WORD - target gpu (0: iGPU, 1: dGPU)
324 * OUTPUT: none
326 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION 0x6
327 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION
328 * ARG1:
329 * WORD - structure size in bytes (includes size field)
330 * WORD - target gpu (0: iGPU, 1: dGPU)
331 * OUTPUT: none
333 #define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING 0x8
334 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING
335 * ARG1: none
336 * OUTPUT:
337 * WORD - number of display connectors
338 * WORD - connector structure size in bytes (excludes connector size field)
339 * BYTE - flags \
340 * BYTE - ATIF display vector bit position } repeated
341 * BYTE - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure
342 * WORD - connector ACPI id /
344 /* flags */
345 # define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 0)
346 # define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 1)
347 # define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 2)
348 #define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS 0x9
349 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS
350 * ARG1: none
351 * OUTPUT:
352 * WORD - number of HPD/DDC ports
353 * WORD - port structure size in bytes (excludes port size field)
354 * BYTE - ATIF display vector bit position \
355 * BYTE - hpd id } reapeated structure
356 * BYTE - ddc id /
358 * available on A+A systems only
360 /* hpd id */
361 # define ATPX_HPD_NONE 0
362 # define ATPX_HPD1 1
363 # define ATPX_HPD2 2
364 # define ATPX_HPD3 3
365 # define ATPX_HPD4 4
366 # define ATPX_HPD5 5
367 # define ATPX_HPD6 6
368 /* ddc id */
369 # define ATPX_DDC_NONE 0
370 # define ATPX_DDC1 1
371 # define ATPX_DDC2 2
372 # define ATPX_DDC3 3
373 # define ATPX_DDC4 4
374 # define ATPX_DDC5 5
375 # define ATPX_DDC6 6
376 # define ATPX_DDC7 7
377 # define ATPX_DDC8 8
379 /* ATCS */
380 #define ATCS_FUNCTION_VERIFY_INTERFACE 0x0
381 /* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE
382 * ARG1: none
383 * OUTPUT:
384 * WORD - structure size in bytes (includes size field)
385 * WORD - version
386 * DWORD - supported functions bit vector
388 /* supported functions vector */
389 # define ATCS_GET_EXTERNAL_STATE_SUPPORTED (1 << 0)
390 # define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED (1 << 1)
391 # define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED (1 << 2)
392 # define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED (1 << 3)
393 #define ATCS_FUNCTION_GET_EXTERNAL_STATE 0x1
394 /* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE
395 * ARG1: none
396 * OUTPUT:
397 * WORD - structure size in bytes (includes size field)
398 * DWORD - valid flags mask
399 * DWORD - flags (0: undocked, 1: docked)
401 /* flags */
402 # define ATCS_DOCKED (1 << 0)
403 #define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST 0x2
404 /* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
405 * ARG1:
406 * WORD - structure size in bytes (includes size field)
407 * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
408 * WORD - valid flags mask
409 * WORD - flags
410 * BYTE - request type
411 * BYTE - performance request
412 * OUTPUT:
413 * WORD - structure size in bytes (includes size field)
414 * BYTE - return value
416 /* flags */
417 # define ATCS_ADVERTISE_CAPS (1 << 0)
418 # define ATCS_WAIT_FOR_COMPLETION (1 << 1)
419 /* request type */
420 # define ATCS_PCIE_LINK_SPEED 1
421 /* performance request */
422 # define ATCS_REMOVE 0
423 # define ATCS_FORCE_LOW_POWER 1
424 # define ATCS_PERF_LEVEL_1 2 /* PCIE Gen 1 */
425 # define ATCS_PERF_LEVEL_2 3 /* PCIE Gen 2 */
426 # define ATCS_PERF_LEVEL_3 4 /* PCIE Gen 3 */
427 /* return value */
428 # define ATCS_REQUEST_REFUSED 1
429 # define ATCS_REQUEST_COMPLETE 2
430 # define ATCS_REQUEST_IN_PROGRESS 3
431 #define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION 0x3
432 /* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
433 * ARG1: none
434 * OUTPUT: none
436 #define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH 0x4
437 /* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH
438 * ARG1:
439 * WORD - structure size in bytes (includes size field)
440 * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
441 * BYTE - number of active lanes
442 * OUTPUT:
443 * WORD - structure size in bytes (includes size field)
444 * BYTE - number of active lanes
447 #endif