diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-08-03 11:39:43 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2012-09-20 13:10:37 -0400 |
commit | 37e9b6a62fb775276f8edb5bd2b9f13a3102b9dd (patch) | |
tree | 558e7267ff977b1851613102f8de01aa9c6b994e /drivers | |
parent | e3a1592085988c60a2207eb492b89493573a0303 (diff) |
drm/radeon: rework the backlight control to be an asic callback
This cleans up the interface a bit as well.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_encoders.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_acpi.c | 38 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_asic.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_asic.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 33 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 2 |
7 files changed, 84 insertions, 33 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 370b2c4a7c86..f9910f099e6e 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -73,7 +73,7 @@ radeon_atom_set_backlight_level_to_reg(struct radeon_device *rdev, | |||
73 | } | 73 | } |
74 | 74 | ||
75 | void | 75 | void |
76 | atombios_set_panel_brightness(struct radeon_encoder *radeon_encoder) | 76 | atombios_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level) |
77 | { | 77 | { |
78 | struct drm_encoder *encoder = &radeon_encoder->base; | 78 | struct drm_encoder *encoder = &radeon_encoder->base; |
79 | struct drm_device *dev = radeon_encoder->base.dev; | 79 | struct drm_device *dev = radeon_encoder->base.dev; |
@@ -82,8 +82,13 @@ atombios_set_panel_brightness(struct radeon_encoder *radeon_encoder) | |||
82 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; | 82 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; |
83 | int index; | 83 | int index; |
84 | 84 | ||
85 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 85 | if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)) |
86 | return; | ||
87 | |||
88 | if ((radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) && | ||
89 | radeon_encoder->enc_priv) { | ||
86 | dig = radeon_encoder->enc_priv; | 90 | dig = radeon_encoder->enc_priv; |
91 | dig->backlight_level = level; | ||
87 | radeon_atom_set_backlight_level_to_reg(rdev, dig->backlight_level); | 92 | radeon_atom_set_backlight_level_to_reg(rdev, dig->backlight_level); |
88 | 93 | ||
89 | switch (radeon_encoder->encoder_id) { | 94 | switch (radeon_encoder->encoder_id) { |
@@ -137,11 +142,7 @@ static int radeon_atom_backlight_update_status(struct backlight_device *bd) | |||
137 | struct radeon_backlight_privdata *pdata = bl_get_data(bd); | 142 | struct radeon_backlight_privdata *pdata = bl_get_data(bd); |
138 | struct radeon_encoder *radeon_encoder = pdata->encoder; | 143 | struct radeon_encoder *radeon_encoder = pdata->encoder; |
139 | 144 | ||
140 | if (radeon_encoder->enc_priv) { | 145 | atombios_set_backlight_level(radeon_encoder, radeon_atom_bl_level(bd)); |
141 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | ||
142 | dig->backlight_level = radeon_atom_bl_level(bd); | ||
143 | atombios_set_panel_brightness(radeon_encoder); | ||
144 | } | ||
145 | 146 | ||
146 | return 0; | 147 | return 0; |
147 | } | 148 | } |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 99a5c8445014..a1c4d4dac7df 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1153,6 +1153,8 @@ struct radeon_asic { | |||
1153 | u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc); | 1153 | u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc); |
1154 | /* wait for vblank */ | 1154 | /* wait for vblank */ |
1155 | void (*wait_for_vblank)(struct radeon_device *rdev, int crtc); | 1155 | void (*wait_for_vblank)(struct radeon_device *rdev, int crtc); |
1156 | /* set backlight level */ | ||
1157 | void (*set_backlight_level)(struct radeon_encoder *radeon_encoder, u8 level); | ||
1156 | } display; | 1158 | } display; |
1157 | /* copy functions for bo handling */ | 1159 | /* copy functions for bo handling */ |
1158 | struct { | 1160 | struct { |
@@ -1461,7 +1463,7 @@ struct radeon_atif { | |||
1461 | struct radeon_atif_notifications notifications; | 1463 | struct radeon_atif_notifications notifications; |
1462 | struct radeon_atif_functions functions; | 1464 | struct radeon_atif_functions functions; |
1463 | struct radeon_atif_notification_cfg notification_cfg; | 1465 | struct radeon_atif_notification_cfg notification_cfg; |
1464 | struct radeon_encoder *backlight_ctl; | 1466 | struct radeon_encoder *encoder_for_bl; |
1465 | }; | 1467 | }; |
1466 | 1468 | ||
1467 | struct radeon_atcs_functions { | 1469 | struct radeon_atcs_functions { |
@@ -1741,6 +1743,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v); | |||
1741 | #define radeon_irq_set(rdev) (rdev)->asic->irq.set((rdev)) | 1743 | #define radeon_irq_set(rdev) (rdev)->asic->irq.set((rdev)) |
1742 | #define radeon_irq_process(rdev) (rdev)->asic->irq.process((rdev)) | 1744 | #define radeon_irq_process(rdev) (rdev)->asic->irq.process((rdev)) |
1743 | #define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->display.get_vblank_counter((rdev), (crtc)) | 1745 | #define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->display.get_vblank_counter((rdev), (crtc)) |
1746 | #define radeon_set_backlight_level(rdev, e, l) (rdev)->asic->display.set_backlight_level((e), (l)) | ||
1744 | #define radeon_fence_ring_emit(rdev, r, fence) (rdev)->asic->ring[(r)].emit_fence((rdev), (fence)) | 1747 | #define radeon_fence_ring_emit(rdev, r, fence) (rdev)->asic->ring[(r)].emit_fence((rdev), (fence)) |
1745 | #define radeon_semaphore_ring_emit(rdev, r, cp, semaphore, emit_wait) (rdev)->asic->ring[(r)].emit_semaphore((rdev), (cp), (semaphore), (emit_wait)) | 1748 | #define radeon_semaphore_ring_emit(rdev, r, cp, semaphore, emit_wait) (rdev)->asic->ring[(r)].emit_semaphore((rdev), (cp), (semaphore), (emit_wait)) |
1746 | #define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy.blit((rdev), (s), (d), (np), (f)) | 1749 | #define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy.blit((rdev), (s), (d), (np), (f)) |
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c index cae895ba8e2f..c3976eb341bf 100644 --- a/drivers/gpu/drm/radeon/radeon_acpi.c +++ b/drivers/gpu/drm/radeon/radeon_acpi.c | |||
@@ -364,19 +364,23 @@ int radeon_atif_handler(struct radeon_device *rdev, | |||
364 | DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count); | 364 | DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count); |
365 | 365 | ||
366 | if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) { | 366 | if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) { |
367 | struct radeon_encoder *enc = atif->backlight_ctl; | 367 | struct radeon_encoder *enc = atif->encoder_for_bl; |
368 | 368 | ||
369 | if (enc) { | 369 | if (enc) { |
370 | struct radeon_encoder_atom_dig *dig = enc->enc_priv; | ||
371 | dig->backlight_level = req.backlight_level; | ||
372 | |||
373 | DRM_DEBUG_DRIVER("Changing brightness to %d\n", | 370 | DRM_DEBUG_DRIVER("Changing brightness to %d\n", |
374 | req.backlight_level); | 371 | req.backlight_level); |
375 | 372 | ||
376 | atombios_set_panel_brightness(enc); | 373 | radeon_set_backlight_level(rdev, enc, req.backlight_level); |
377 | 374 | ||
378 | backlight_force_update(dig->bl_dev, | 375 | if (rdev->is_atom_bios) { |
379 | BACKLIGHT_UPDATE_HOTKEY); | 376 | struct radeon_encoder_atom_dig *dig = enc->enc_priv; |
377 | backlight_force_update(dig->bl_dev, | ||
378 | BACKLIGHT_UPDATE_HOTKEY); | ||
379 | } else { | ||
380 | struct radeon_encoder_lvds *dig = enc->enc_priv; | ||
381 | backlight_force_update(dig->bl_dev, | ||
382 | BACKLIGHT_UPDATE_HOTKEY); | ||
383 | } | ||
380 | } | 384 | } |
381 | } | 385 | } |
382 | /* TODO: check other events */ | 386 | /* TODO: check other events */ |
@@ -577,16 +581,26 @@ int radeon_acpi_init(struct radeon_device *rdev) | |||
577 | list_for_each_entry(tmp, &rdev->ddev->mode_config.encoder_list, | 581 | list_for_each_entry(tmp, &rdev->ddev->mode_config.encoder_list, |
578 | head) { | 582 | head) { |
579 | struct radeon_encoder *enc = to_radeon_encoder(tmp); | 583 | struct radeon_encoder *enc = to_radeon_encoder(tmp); |
580 | struct radeon_encoder_atom_dig *dig = enc->enc_priv; | ||
581 | 584 | ||
582 | if ((enc->devices & (ATOM_DEVICE_LCD_SUPPORT)) && | 585 | if ((enc->devices & (ATOM_DEVICE_LCD_SUPPORT)) && |
583 | dig->bl_dev != NULL) { | 586 | enc->enc_priv) { |
584 | target = enc; | 587 | if (rdev->is_atom_bios) { |
585 | break; | 588 | struct radeon_encoder_atom_dig *dig = enc->enc_priv; |
589 | if (dig->bl_dev) { | ||
590 | target = enc; | ||
591 | break; | ||
592 | } | ||
593 | } else { | ||
594 | struct radeon_encoder_lvds *dig = enc->enc_priv; | ||
595 | if (dig->bl_dev) { | ||
596 | target = enc; | ||
597 | break; | ||
598 | } | ||
599 | } | ||
586 | } | 600 | } |
587 | } | 601 | } |
588 | 602 | ||
589 | atif->backlight_ctl = target; | 603 | atif->encoder_for_bl = target; |
590 | if (!target) { | 604 | if (!target) { |
591 | /* Brightness change notification is enabled, but we | 605 | /* Brightness change notification is enabled, but we |
592 | * didn't find a backlight controller, this should | 606 | * didn't find a backlight controller, this should |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 973417c4b014..29834a2be3ea 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -198,6 +198,7 @@ static struct radeon_asic r100_asic = { | |||
198 | .bandwidth_update = &r100_bandwidth_update, | 198 | .bandwidth_update = &r100_bandwidth_update, |
199 | .get_vblank_counter = &r100_get_vblank_counter, | 199 | .get_vblank_counter = &r100_get_vblank_counter, |
200 | .wait_for_vblank = &r100_wait_for_vblank, | 200 | .wait_for_vblank = &r100_wait_for_vblank, |
201 | .set_backlight_level = &radeon_legacy_set_backlight_level, | ||
201 | }, | 202 | }, |
202 | .copy = { | 203 | .copy = { |
203 | .blit = &r100_copy_blit, | 204 | .blit = &r100_copy_blit, |
@@ -272,6 +273,7 @@ static struct radeon_asic r200_asic = { | |||
272 | .bandwidth_update = &r100_bandwidth_update, | 273 | .bandwidth_update = &r100_bandwidth_update, |
273 | .get_vblank_counter = &r100_get_vblank_counter, | 274 | .get_vblank_counter = &r100_get_vblank_counter, |
274 | .wait_for_vblank = &r100_wait_for_vblank, | 275 | .wait_for_vblank = &r100_wait_for_vblank, |
276 | .set_backlight_level = &radeon_legacy_set_backlight_level, | ||
275 | }, | 277 | }, |
276 | .copy = { | 278 | .copy = { |
277 | .blit = &r100_copy_blit, | 279 | .blit = &r100_copy_blit, |
@@ -346,6 +348,7 @@ static struct radeon_asic r300_asic = { | |||
346 | .bandwidth_update = &r100_bandwidth_update, | 348 | .bandwidth_update = &r100_bandwidth_update, |
347 | .get_vblank_counter = &r100_get_vblank_counter, | 349 | .get_vblank_counter = &r100_get_vblank_counter, |
348 | .wait_for_vblank = &r100_wait_for_vblank, | 350 | .wait_for_vblank = &r100_wait_for_vblank, |
351 | .set_backlight_level = &radeon_legacy_set_backlight_level, | ||
349 | }, | 352 | }, |
350 | .copy = { | 353 | .copy = { |
351 | .blit = &r100_copy_blit, | 354 | .blit = &r100_copy_blit, |
@@ -420,6 +423,7 @@ static struct radeon_asic r300_asic_pcie = { | |||
420 | .bandwidth_update = &r100_bandwidth_update, | 423 | .bandwidth_update = &r100_bandwidth_update, |
421 | .get_vblank_counter = &r100_get_vblank_counter, | 424 | .get_vblank_counter = &r100_get_vblank_counter, |
422 | .wait_for_vblank = &r100_wait_for_vblank, | 425 | .wait_for_vblank = &r100_wait_for_vblank, |
426 | .set_backlight_level = &radeon_legacy_set_backlight_level, | ||
423 | }, | 427 | }, |
424 | .copy = { | 428 | .copy = { |
425 | .blit = &r100_copy_blit, | 429 | .blit = &r100_copy_blit, |
@@ -494,6 +498,7 @@ static struct radeon_asic r420_asic = { | |||
494 | .bandwidth_update = &r100_bandwidth_update, | 498 | .bandwidth_update = &r100_bandwidth_update, |
495 | .get_vblank_counter = &r100_get_vblank_counter, | 499 | .get_vblank_counter = &r100_get_vblank_counter, |
496 | .wait_for_vblank = &r100_wait_for_vblank, | 500 | .wait_for_vblank = &r100_wait_for_vblank, |
501 | .set_backlight_level = &atombios_set_backlight_level, | ||
497 | }, | 502 | }, |
498 | .copy = { | 503 | .copy = { |
499 | .blit = &r100_copy_blit, | 504 | .blit = &r100_copy_blit, |
@@ -568,6 +573,7 @@ static struct radeon_asic rs400_asic = { | |||
568 | .bandwidth_update = &r100_bandwidth_update, | 573 | .bandwidth_update = &r100_bandwidth_update, |
569 | .get_vblank_counter = &r100_get_vblank_counter, | 574 | .get_vblank_counter = &r100_get_vblank_counter, |
570 | .wait_for_vblank = &r100_wait_for_vblank, | 575 | .wait_for_vblank = &r100_wait_for_vblank, |
576 | .set_backlight_level = &radeon_legacy_set_backlight_level, | ||
571 | }, | 577 | }, |
572 | .copy = { | 578 | .copy = { |
573 | .blit = &r100_copy_blit, | 579 | .blit = &r100_copy_blit, |
@@ -642,6 +648,7 @@ static struct radeon_asic rs600_asic = { | |||
642 | .bandwidth_update = &rs600_bandwidth_update, | 648 | .bandwidth_update = &rs600_bandwidth_update, |
643 | .get_vblank_counter = &rs600_get_vblank_counter, | 649 | .get_vblank_counter = &rs600_get_vblank_counter, |
644 | .wait_for_vblank = &avivo_wait_for_vblank, | 650 | .wait_for_vblank = &avivo_wait_for_vblank, |
651 | .set_backlight_level = &atombios_set_backlight_level, | ||
645 | }, | 652 | }, |
646 | .copy = { | 653 | .copy = { |
647 | .blit = &r100_copy_blit, | 654 | .blit = &r100_copy_blit, |
@@ -716,6 +723,7 @@ static struct radeon_asic rs690_asic = { | |||
716 | .get_vblank_counter = &rs600_get_vblank_counter, | 723 | .get_vblank_counter = &rs600_get_vblank_counter, |
717 | .bandwidth_update = &rs690_bandwidth_update, | 724 | .bandwidth_update = &rs690_bandwidth_update, |
718 | .wait_for_vblank = &avivo_wait_for_vblank, | 725 | .wait_for_vblank = &avivo_wait_for_vblank, |
726 | .set_backlight_level = &atombios_set_backlight_level, | ||
719 | }, | 727 | }, |
720 | .copy = { | 728 | .copy = { |
721 | .blit = &r100_copy_blit, | 729 | .blit = &r100_copy_blit, |
@@ -790,6 +798,7 @@ static struct radeon_asic rv515_asic = { | |||
790 | .get_vblank_counter = &rs600_get_vblank_counter, | 798 | .get_vblank_counter = &rs600_get_vblank_counter, |
791 | .bandwidth_update = &rv515_bandwidth_update, | 799 | .bandwidth_update = &rv515_bandwidth_update, |
792 | .wait_for_vblank = &avivo_wait_for_vblank, | 800 | .wait_for_vblank = &avivo_wait_for_vblank, |
801 | .set_backlight_level = &atombios_set_backlight_level, | ||
793 | }, | 802 | }, |
794 | .copy = { | 803 | .copy = { |
795 | .blit = &r100_copy_blit, | 804 | .blit = &r100_copy_blit, |
@@ -864,6 +873,7 @@ static struct radeon_asic r520_asic = { | |||
864 | .bandwidth_update = &rv515_bandwidth_update, | 873 | .bandwidth_update = &rv515_bandwidth_update, |
865 | .get_vblank_counter = &rs600_get_vblank_counter, | 874 | .get_vblank_counter = &rs600_get_vblank_counter, |
866 | .wait_for_vblank = &avivo_wait_for_vblank, | 875 | .wait_for_vblank = &avivo_wait_for_vblank, |
876 | .set_backlight_level = &atombios_set_backlight_level, | ||
867 | }, | 877 | }, |
868 | .copy = { | 878 | .copy = { |
869 | .blit = &r100_copy_blit, | 879 | .blit = &r100_copy_blit, |
@@ -937,6 +947,7 @@ static struct radeon_asic r600_asic = { | |||
937 | .bandwidth_update = &rv515_bandwidth_update, | 947 | .bandwidth_update = &rv515_bandwidth_update, |
938 | .get_vblank_counter = &rs600_get_vblank_counter, | 948 | .get_vblank_counter = &rs600_get_vblank_counter, |
939 | .wait_for_vblank = &avivo_wait_for_vblank, | 949 | .wait_for_vblank = &avivo_wait_for_vblank, |
950 | .set_backlight_level = &atombios_set_backlight_level, | ||
940 | }, | 951 | }, |
941 | .copy = { | 952 | .copy = { |
942 | .blit = &r600_copy_blit, | 953 | .blit = &r600_copy_blit, |
@@ -1010,6 +1021,7 @@ static struct radeon_asic rs780_asic = { | |||
1010 | .bandwidth_update = &rs690_bandwidth_update, | 1021 | .bandwidth_update = &rs690_bandwidth_update, |
1011 | .get_vblank_counter = &rs600_get_vblank_counter, | 1022 | .get_vblank_counter = &rs600_get_vblank_counter, |
1012 | .wait_for_vblank = &avivo_wait_for_vblank, | 1023 | .wait_for_vblank = &avivo_wait_for_vblank, |
1024 | .set_backlight_level = &atombios_set_backlight_level, | ||
1013 | }, | 1025 | }, |
1014 | .copy = { | 1026 | .copy = { |
1015 | .blit = &r600_copy_blit, | 1027 | .blit = &r600_copy_blit, |
@@ -1083,6 +1095,7 @@ static struct radeon_asic rv770_asic = { | |||
1083 | .bandwidth_update = &rv515_bandwidth_update, | 1095 | .bandwidth_update = &rv515_bandwidth_update, |
1084 | .get_vblank_counter = &rs600_get_vblank_counter, | 1096 | .get_vblank_counter = &rs600_get_vblank_counter, |
1085 | .wait_for_vblank = &avivo_wait_for_vblank, | 1097 | .wait_for_vblank = &avivo_wait_for_vblank, |
1098 | .set_backlight_level = &atombios_set_backlight_level, | ||
1086 | }, | 1099 | }, |
1087 | .copy = { | 1100 | .copy = { |
1088 | .blit = &r600_copy_blit, | 1101 | .blit = &r600_copy_blit, |
@@ -1156,6 +1169,7 @@ static struct radeon_asic evergreen_asic = { | |||
1156 | .bandwidth_update = &evergreen_bandwidth_update, | 1169 | .bandwidth_update = &evergreen_bandwidth_update, |
1157 | .get_vblank_counter = &evergreen_get_vblank_counter, | 1170 | .get_vblank_counter = &evergreen_get_vblank_counter, |
1158 | .wait_for_vblank = &dce4_wait_for_vblank, | 1171 | .wait_for_vblank = &dce4_wait_for_vblank, |
1172 | .set_backlight_level = &atombios_set_backlight_level, | ||
1159 | }, | 1173 | }, |
1160 | .copy = { | 1174 | .copy = { |
1161 | .blit = &r600_copy_blit, | 1175 | .blit = &r600_copy_blit, |
@@ -1229,6 +1243,7 @@ static struct radeon_asic sumo_asic = { | |||
1229 | .bandwidth_update = &evergreen_bandwidth_update, | 1243 | .bandwidth_update = &evergreen_bandwidth_update, |
1230 | .get_vblank_counter = &evergreen_get_vblank_counter, | 1244 | .get_vblank_counter = &evergreen_get_vblank_counter, |
1231 | .wait_for_vblank = &dce4_wait_for_vblank, | 1245 | .wait_for_vblank = &dce4_wait_for_vblank, |
1246 | .set_backlight_level = &atombios_set_backlight_level, | ||
1232 | }, | 1247 | }, |
1233 | .copy = { | 1248 | .copy = { |
1234 | .blit = &r600_copy_blit, | 1249 | .blit = &r600_copy_blit, |
@@ -1302,6 +1317,7 @@ static struct radeon_asic btc_asic = { | |||
1302 | .bandwidth_update = &evergreen_bandwidth_update, | 1317 | .bandwidth_update = &evergreen_bandwidth_update, |
1303 | .get_vblank_counter = &evergreen_get_vblank_counter, | 1318 | .get_vblank_counter = &evergreen_get_vblank_counter, |
1304 | .wait_for_vblank = &dce4_wait_for_vblank, | 1319 | .wait_for_vblank = &dce4_wait_for_vblank, |
1320 | .set_backlight_level = &atombios_set_backlight_level, | ||
1305 | }, | 1321 | }, |
1306 | .copy = { | 1322 | .copy = { |
1307 | .blit = &r600_copy_blit, | 1323 | .blit = &r600_copy_blit, |
@@ -1406,6 +1422,7 @@ static struct radeon_asic cayman_asic = { | |||
1406 | .bandwidth_update = &evergreen_bandwidth_update, | 1422 | .bandwidth_update = &evergreen_bandwidth_update, |
1407 | .get_vblank_counter = &evergreen_get_vblank_counter, | 1423 | .get_vblank_counter = &evergreen_get_vblank_counter, |
1408 | .wait_for_vblank = &dce4_wait_for_vblank, | 1424 | .wait_for_vblank = &dce4_wait_for_vblank, |
1425 | .set_backlight_level = &atombios_set_backlight_level, | ||
1409 | }, | 1426 | }, |
1410 | .copy = { | 1427 | .copy = { |
1411 | .blit = &r600_copy_blit, | 1428 | .blit = &r600_copy_blit, |
@@ -1500,6 +1517,7 @@ static struct radeon_asic trinity_asic = { | |||
1500 | .bandwidth_update = &dce6_bandwidth_update, | 1517 | .bandwidth_update = &dce6_bandwidth_update, |
1501 | .get_vblank_counter = &evergreen_get_vblank_counter, | 1518 | .get_vblank_counter = &evergreen_get_vblank_counter, |
1502 | .wait_for_vblank = &dce4_wait_for_vblank, | 1519 | .wait_for_vblank = &dce4_wait_for_vblank, |
1520 | .set_backlight_level = &atombios_set_backlight_level, | ||
1503 | }, | 1521 | }, |
1504 | .copy = { | 1522 | .copy = { |
1505 | .blit = &r600_copy_blit, | 1523 | .blit = &r600_copy_blit, |
@@ -1604,6 +1622,7 @@ static struct radeon_asic si_asic = { | |||
1604 | .bandwidth_update = &dce6_bandwidth_update, | 1622 | .bandwidth_update = &dce6_bandwidth_update, |
1605 | .get_vblank_counter = &evergreen_get_vblank_counter, | 1623 | .get_vblank_counter = &evergreen_get_vblank_counter, |
1606 | .wait_for_vblank = &dce4_wait_for_vblank, | 1624 | .wait_for_vblank = &dce4_wait_for_vblank, |
1625 | .set_backlight_level = &atombios_set_backlight_level, | ||
1607 | }, | 1626 | }, |
1608 | .copy = { | 1627 | .copy = { |
1609 | .blit = NULL, | 1628 | .blit = NULL, |
@@ -1697,6 +1716,7 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
1697 | rdev->asic->pm.set_engine_clock = &radeon_legacy_set_engine_clock; | 1716 | rdev->asic->pm.set_engine_clock = &radeon_legacy_set_engine_clock; |
1698 | rdev->asic->pm.get_memory_clock = &radeon_legacy_get_memory_clock; | 1717 | rdev->asic->pm.get_memory_clock = &radeon_legacy_get_memory_clock; |
1699 | rdev->asic->pm.set_memory_clock = NULL; | 1718 | rdev->asic->pm.set_memory_clock = NULL; |
1719 | rdev->asic->display.set_backlight_level = &radeon_legacy_set_backlight_level; | ||
1700 | } | 1720 | } |
1701 | break; | 1721 | break; |
1702 | case CHIP_RS400: | 1722 | case CHIP_RS400: |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 132429e0cccd..75d6c9e6aa8f 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -42,6 +42,10 @@ uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev); | |||
42 | void radeon_atom_set_memory_clock(struct radeon_device *rdev, uint32_t mem_clock); | 42 | void radeon_atom_set_memory_clock(struct radeon_device *rdev, uint32_t mem_clock); |
43 | void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable); | 43 | void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable); |
44 | 44 | ||
45 | void atombios_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level); | ||
46 | void radeon_legacy_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level); | ||
47 | |||
48 | |||
45 | /* | 49 | /* |
46 | * r100,rv100,rs100,rv200,rs200 | 50 | * r100,rv100,rs100,rv200,rs200 |
47 | */ | 51 | */ |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 9910fe494744..ec00deaab9ca 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -290,10 +290,9 @@ static uint8_t radeon_legacy_lvds_level(struct backlight_device *bd) | |||
290 | return level; | 290 | return level; |
291 | } | 291 | } |
292 | 292 | ||
293 | static int radeon_legacy_backlight_update_status(struct backlight_device *bd) | 293 | void |
294 | radeon_legacy_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level) | ||
294 | { | 295 | { |
295 | struct radeon_backlight_privdata *pdata = bl_get_data(bd); | ||
296 | struct radeon_encoder *radeon_encoder = pdata->encoder; | ||
297 | struct drm_device *dev = radeon_encoder->base.dev; | 296 | struct drm_device *dev = radeon_encoder->base.dev; |
298 | struct radeon_device *rdev = dev->dev_private; | 297 | struct radeon_device *rdev = dev->dev_private; |
299 | int dpms_mode = DRM_MODE_DPMS_ON; | 298 | int dpms_mode = DRM_MODE_DPMS_ON; |
@@ -301,19 +300,31 @@ static int radeon_legacy_backlight_update_status(struct backlight_device *bd) | |||
301 | if (radeon_encoder->enc_priv) { | 300 | if (radeon_encoder->enc_priv) { |
302 | if (rdev->is_atom_bios) { | 301 | if (rdev->is_atom_bios) { |
303 | struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv; | 302 | struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv; |
304 | dpms_mode = lvds->dpms_mode; | 303 | if (lvds->backlight_level > 0) |
305 | lvds->backlight_level = radeon_legacy_lvds_level(bd); | 304 | dpms_mode = lvds->dpms_mode; |
305 | else | ||
306 | dpms_mode = DRM_MODE_DPMS_OFF; | ||
307 | lvds->backlight_level = level; | ||
306 | } else { | 308 | } else { |
307 | struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv; | 309 | struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv; |
308 | dpms_mode = lvds->dpms_mode; | 310 | if (lvds->backlight_level > 0) |
309 | lvds->backlight_level = radeon_legacy_lvds_level(bd); | 311 | dpms_mode = lvds->dpms_mode; |
312 | else | ||
313 | dpms_mode = DRM_MODE_DPMS_OFF; | ||
314 | lvds->backlight_level = level; | ||
310 | } | 315 | } |
311 | } | 316 | } |
312 | 317 | ||
313 | if (bd->props.brightness > 0) | 318 | radeon_legacy_lvds_update(&radeon_encoder->base, dpms_mode); |
314 | radeon_legacy_lvds_update(&radeon_encoder->base, dpms_mode); | 319 | } |
315 | else | 320 | |
316 | radeon_legacy_lvds_update(&radeon_encoder->base, DRM_MODE_DPMS_OFF); | 321 | static int radeon_legacy_backlight_update_status(struct backlight_device *bd) |
322 | { | ||
323 | struct radeon_backlight_privdata *pdata = bl_get_data(bd); | ||
324 | struct radeon_encoder *radeon_encoder = pdata->encoder; | ||
325 | |||
326 | radeon_legacy_set_backlight_level(radeon_encoder, | ||
327 | radeon_legacy_lvds_level(bd)); | ||
317 | 328 | ||
318 | return 0; | 329 | return 0; |
319 | } | 330 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 1f411c2609d8..5005057974b1 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -698,8 +698,6 @@ void radeon_panel_mode_fixup(struct drm_encoder *encoder, | |||
698 | struct drm_display_mode *adjusted_mode); | 698 | struct drm_display_mode *adjusted_mode); |
699 | void atom_rv515_force_tv_scaler(struct radeon_device *rdev, struct radeon_crtc *radeon_crtc); | 699 | void atom_rv515_force_tv_scaler(struct radeon_device *rdev, struct radeon_crtc *radeon_crtc); |
700 | 700 | ||
701 | void atombios_set_panel_brightness(struct radeon_encoder *radeon_encoder); | ||
702 | |||
703 | /* legacy tv */ | 701 | /* legacy tv */ |
704 | void radeon_legacy_tv_adjust_crtc_reg(struct drm_encoder *encoder, | 702 | void radeon_legacy_tv_adjust_crtc_reg(struct drm_encoder *encoder, |
705 | uint32_t *h_total_disp, uint32_t *h_sync_strt_wid, | 703 | uint32_t *h_total_disp, uint32_t *h_sync_strt_wid, |