aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2018-07-19 10:17:02 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-07-20 15:24:35 -0400
commit9e7204beae8cbb75939acd640829e10979f2c920 (patch)
tree6f0d3a9f54ac74713dc8abeef62d4a6f57c06915
parent7766484b4a18373ac557ce6ea442ef28517c8224 (diff)
drm/amdgpu/apci: don't call sbios request function if it's not supported
Check the supported functions mask before calling the bios requests method. Reviewed-by: Jim Qu <Jim.Qu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 0d8c3fc6eace..455617813ec4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -364,7 +364,6 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
364 struct acpi_bus_event *event) 364 struct acpi_bus_event *event)
365{ 365{
366 struct amdgpu_atif *atif = adev->atif; 366 struct amdgpu_atif *atif = adev->atif;
367 struct atif_sbios_requests req;
368 int count; 367 int count;
369 368
370 DRM_DEBUG_DRIVER("event, device_class = %s, type = %#x\n", 369 DRM_DEBUG_DRIVER("event, device_class = %s, type = %#x\n",
@@ -379,42 +378,46 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
379 /* Not our event */ 378 /* Not our event */
380 return NOTIFY_DONE; 379 return NOTIFY_DONE;
381 380
382 /* Check pending SBIOS requests */ 381 if (atif->functions.sbios_requests) {
383 count = amdgpu_atif_get_sbios_requests(atif, &req); 382 struct atif_sbios_requests req;
384 383
385 if (count <= 0) 384 /* Check pending SBIOS requests */
386 return NOTIFY_DONE; 385 count = amdgpu_atif_get_sbios_requests(atif, &req);
386
387 if (count <= 0)
388 return NOTIFY_DONE;
387 389
388 DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count); 390 DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count);
389 391
390 if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) { 392 if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) {
391 struct amdgpu_encoder *enc = atif->encoder_for_bl; 393 struct amdgpu_encoder *enc = atif->encoder_for_bl;
392 394
393 if (enc) { 395 if (enc) {
394 struct amdgpu_encoder_atom_dig *dig = enc->enc_priv; 396 struct amdgpu_encoder_atom_dig *dig = enc->enc_priv;
395 397
396 DRM_DEBUG_DRIVER("Changing brightness to %d\n", 398 DRM_DEBUG_DRIVER("Changing brightness to %d\n",
397 req.backlight_level); 399 req.backlight_level);
398 400
399 amdgpu_display_backlight_set_level(adev, enc, req.backlight_level); 401 amdgpu_display_backlight_set_level(adev, enc, req.backlight_level);
400 402
401#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) 403#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
402 backlight_force_update(dig->bl_dev, 404 backlight_force_update(dig->bl_dev,
403 BACKLIGHT_UPDATE_HOTKEY); 405 BACKLIGHT_UPDATE_HOTKEY);
404#endif 406#endif
407 }
405 } 408 }
406 } 409 if (req.pending & ATIF_DGPU_DISPLAY_EVENT) {
407 if (req.pending & ATIF_DGPU_DISPLAY_EVENT) { 410 if ((adev->flags & AMD_IS_PX) &&
408 if ((adev->flags & AMD_IS_PX) && 411 amdgpu_atpx_dgpu_req_power_for_displays()) {
409 amdgpu_atpx_dgpu_req_power_for_displays()) { 412 pm_runtime_get_sync(adev->ddev->dev);
410 pm_runtime_get_sync(adev->ddev->dev); 413 /* Just fire off a uevent and let userspace tell us what to do */
411 /* Just fire off a uevent and let userspace tell us what to do */ 414 drm_helper_hpd_irq_event(adev->ddev);
412 drm_helper_hpd_irq_event(adev->ddev); 415 pm_runtime_mark_last_busy(adev->ddev->dev);
413 pm_runtime_mark_last_busy(adev->ddev->dev); 416 pm_runtime_put_autosuspend(adev->ddev->dev);
414 pm_runtime_put_autosuspend(adev->ddev->dev); 417 }
415 } 418 }
419 /* TODO: check other events */
416 } 420 }
417 /* TODO: check other events */
418 421
419 /* We've handled the event, stop the notifier chain. The ACPI interface 422 /* We've handled the event, stop the notifier chain. The ACPI interface
420 * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to 423 * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to