diff options
| author | Alex Deucher <alexander.deucher@amd.com> | 2012-08-02 12:30:49 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2012-09-20 13:10:36 -0400 |
| commit | c3c651600bd83de5e1cbb5d9ec34a88efd2856e8 (patch) | |
| tree | 981edca7cbbaebb3d2781445cdfdc1b0e057cb7e | |
| parent | 92fdf89aa95de32dba1cb44fe7f5c54824b4b2c4 (diff) | |
drm/radeon: document radeon_acpi.c
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_acpi.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c index 3486292892b5..49a7d64be9e3 100644 --- a/drivers/gpu/drm/radeon/radeon_acpi.c +++ b/drivers/gpu/drm/radeon/radeon_acpi.c | |||
| @@ -76,6 +76,16 @@ struct atif_sbios_requests { | |||
| 76 | 76 | ||
| 77 | /* Call the ATIF method | 77 | /* Call the ATIF method |
| 78 | */ | 78 | */ |
| 79 | /** | ||
| 80 | * radeon_atif_call - call an ATIF method | ||
| 81 | * | ||
| 82 | * @handle: acpi handle | ||
| 83 | * @function: the ATIF function to execute | ||
| 84 | * @params: ATIF function params | ||
| 85 | * | ||
| 86 | * Executes the requested ATIF function (all asics). | ||
| 87 | * Returns a pointer to the acpi output buffer. | ||
| 88 | */ | ||
| 79 | static union acpi_object *radeon_atif_call(acpi_handle handle, int function, | 89 | static union acpi_object *radeon_atif_call(acpi_handle handle, int function, |
| 80 | struct acpi_buffer *params) | 90 | struct acpi_buffer *params) |
| 81 | { | 91 | { |
| @@ -113,6 +123,16 @@ static union acpi_object *radeon_atif_call(acpi_handle handle, int function, | |||
| 113 | return buffer.pointer; | 123 | return buffer.pointer; |
| 114 | } | 124 | } |
| 115 | 125 | ||
| 126 | /** | ||
| 127 | * radeon_atif_parse_notification - parse supported notifications | ||
| 128 | * | ||
| 129 | * @n: supported notifications struct | ||
| 130 | * @mask: supported notifications mask from ATIF | ||
| 131 | * | ||
| 132 | * Use the supported notifications mask from ATIF function | ||
| 133 | * ATIF_FUNCTION_VERIFY_INTERFACE to determine what notifications | ||
| 134 | * are supported (all asics). | ||
| 135 | */ | ||
| 116 | static void radeon_atif_parse_notification(struct radeon_atif_notifications *n, u32 mask) | 136 | static void radeon_atif_parse_notification(struct radeon_atif_notifications *n, u32 mask) |
| 117 | { | 137 | { |
| 118 | n->display_switch = mask & ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED; | 138 | n->display_switch = mask & ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED; |
| @@ -126,6 +146,16 @@ static void radeon_atif_parse_notification(struct radeon_atif_notifications *n, | |||
| 126 | n->dgpu_display_event = mask & ATIF_DGPU_DISPLAY_EVENT_SUPPORTED; | 146 | n->dgpu_display_event = mask & ATIF_DGPU_DISPLAY_EVENT_SUPPORTED; |
| 127 | } | 147 | } |
| 128 | 148 | ||
| 149 | /** | ||
| 150 | * radeon_atif_parse_functions - parse supported functions | ||
| 151 | * | ||
| 152 | * @f: supported functions struct | ||
| 153 | * @mask: supported functions mask from ATIF | ||
| 154 | * | ||
| 155 | * Use the supported functions mask from ATIF function | ||
| 156 | * ATIF_FUNCTION_VERIFY_INTERFACE to determine what functions | ||
| 157 | * are supported (all asics). | ||
| 158 | */ | ||
| 129 | static void radeon_atif_parse_functions(struct radeon_atif_functions *f, u32 mask) | 159 | static void radeon_atif_parse_functions(struct radeon_atif_functions *f, u32 mask) |
| 130 | { | 160 | { |
| 131 | f->system_params = mask & ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED; | 161 | f->system_params = mask & ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED; |
| @@ -140,6 +170,17 @@ static void radeon_atif_parse_functions(struct radeon_atif_functions *f, u32 mas | |||
| 140 | f->graphics_device_types = mask & ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED; | 170 | f->graphics_device_types = mask & ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED; |
| 141 | } | 171 | } |
| 142 | 172 | ||
| 173 | /** | ||
| 174 | * radeon_atif_verify_interface - verify ATIF | ||
| 175 | * | ||
| 176 | * @handle: acpi handle | ||
| 177 | * @atif: radeon atif struct | ||
| 178 | * | ||
| 179 | * Execute the ATIF_FUNCTION_VERIFY_INTERFACE ATIF function | ||
| 180 | * to initialize ATIF and determine what features are supported | ||
| 181 | * (all asics). | ||
| 182 | * returns 0 on success, error on failure. | ||
| 183 | */ | ||
| 143 | static int radeon_atif_verify_interface(acpi_handle handle, | 184 | static int radeon_atif_verify_interface(acpi_handle handle, |
| 144 | struct radeon_atif *atif) | 185 | struct radeon_atif *atif) |
| 145 | { | 186 | { |
| @@ -175,6 +216,18 @@ out: | |||
| 175 | return err; | 216 | return err; |
| 176 | } | 217 | } |
| 177 | 218 | ||
| 219 | /** | ||
| 220 | * radeon_atif_get_notification_params - determine notify configuration | ||
| 221 | * | ||
| 222 | * @handle: acpi handle | ||
| 223 | * @n: atif notification configuration struct | ||
| 224 | * | ||
| 225 | * Execute the ATIF_FUNCTION_GET_SYSTEM_PARAMETERS ATIF function | ||
| 226 | * to determine if a notifier is used and if so which one | ||
| 227 | * (all asics). This is either Notify(VGA, 0x81) or Notify(VGA, n) | ||
| 228 | * where n is specified in the result if a notifier is used. | ||
| 229 | * Returns 0 on success, error on failure. | ||
| 230 | */ | ||
| 178 | static int radeon_atif_get_notification_params(acpi_handle handle, | 231 | static int radeon_atif_get_notification_params(acpi_handle handle, |
| 179 | struct radeon_atif_notification_cfg *n) | 232 | struct radeon_atif_notification_cfg *n) |
| 180 | { | 233 | { |
| @@ -226,6 +279,17 @@ out: | |||
| 226 | return err; | 279 | return err; |
| 227 | } | 280 | } |
| 228 | 281 | ||
| 282 | /** | ||
| 283 | * radeon_atif_get_sbios_requests - get requested sbios event | ||
| 284 | * | ||
| 285 | * @handle: acpi handle | ||
| 286 | * @req: atif sbios request struct | ||
| 287 | * | ||
| 288 | * Execute the ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF function | ||
| 289 | * to determine what requests the sbios is making to the driver | ||
| 290 | * (all asics). | ||
| 291 | * Returns 0 on success, error on failure. | ||
| 292 | */ | ||
| 229 | static int radeon_atif_get_sbios_requests(acpi_handle handle, | 293 | static int radeon_atif_get_sbios_requests(acpi_handle handle, |
| 230 | struct atif_sbios_requests *req) | 294 | struct atif_sbios_requests *req) |
| 231 | { | 295 | { |
| @@ -255,6 +319,16 @@ out: | |||
| 255 | return count; | 319 | return count; |
| 256 | } | 320 | } |
| 257 | 321 | ||
| 322 | /** | ||
| 323 | * radeon_atif_handler - handle ATIF notify requests | ||
| 324 | * | ||
| 325 | * @rdev: radeon_device pointer | ||
| 326 | * @event: atif sbios request struct | ||
| 327 | * | ||
| 328 | * Checks the acpi event and if it matches an atif event, | ||
| 329 | * handles it. | ||
| 330 | * Returns NOTIFY code | ||
| 331 | */ | ||
| 258 | int radeon_atif_handler(struct radeon_device *rdev, | 332 | int radeon_atif_handler(struct radeon_device *rdev, |
| 259 | struct acpi_bus_event *event) | 333 | struct acpi_bus_event *event) |
| 260 | { | 334 | { |
| @@ -309,6 +383,17 @@ int radeon_atif_handler(struct radeon_device *rdev, | |||
| 309 | return NOTIFY_BAD; | 383 | return NOTIFY_BAD; |
| 310 | } | 384 | } |
| 311 | 385 | ||
| 386 | /** | ||
| 387 | * radeon_acpi_event - handle notify events | ||
| 388 | * | ||
| 389 | * @nb: notifier block | ||
| 390 | * @val: val | ||
| 391 | * @data: acpi event | ||
| 392 | * | ||
| 393 | * Calls relevant radeon functions in response to various | ||
| 394 | * acpi events. | ||
| 395 | * Returns NOTIFY code | ||
| 396 | */ | ||
| 312 | static int radeon_acpi_event(struct notifier_block *nb, | 397 | static int radeon_acpi_event(struct notifier_block *nb, |
| 313 | unsigned long val, | 398 | unsigned long val, |
| 314 | void *data) | 399 | void *data) |
| @@ -330,6 +415,15 @@ static int radeon_acpi_event(struct notifier_block *nb, | |||
| 330 | } | 415 | } |
| 331 | 416 | ||
| 332 | /* Call all ACPI methods here */ | 417 | /* Call all ACPI methods here */ |
| 418 | /** | ||
| 419 | * radeon_acpi_init - init driver acpi support | ||
| 420 | * | ||
| 421 | * @rdev: radeon_device pointer | ||
| 422 | * | ||
| 423 | * Verifies the AMD ACPI interfaces and registers with the acpi | ||
| 424 | * notifier chain (all asics). | ||
| 425 | * Returns 0 on success, error on failure. | ||
| 426 | */ | ||
| 333 | int radeon_acpi_init(struct radeon_device *rdev) | 427 | int radeon_acpi_init(struct radeon_device *rdev) |
| 334 | { | 428 | { |
| 335 | acpi_handle handle; | 429 | acpi_handle handle; |
| @@ -403,6 +497,13 @@ out: | |||
| 403 | return ret; | 497 | return ret; |
| 404 | } | 498 | } |
| 405 | 499 | ||
| 500 | /** | ||
| 501 | * radeon_acpi_fini - tear down driver acpi support | ||
| 502 | * | ||
| 503 | * @rdev: radeon_device pointer | ||
| 504 | * | ||
| 505 | * Unregisters with the acpi notifier chain (all asics). | ||
| 506 | */ | ||
