Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30567
Change subject: nb/intel/sandybridge: Use understandable values for PWM backlight ......................................................................
nb/intel/sandybridge: Use understandable values for PWM backlight
This gets rid of setting the register values from the devicetree and makes it possible to use sensible values in the devicetree.
TODO update autoport.
Untested
Change-Id: I7eb69d9efdccede02fdd3771b3deab536050bfa4 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/mainboard/apple/macbookair4_2/devicetree.cb M src/mainboard/asrock/b75pro3-m/devicetree.cb M src/mainboard/google/link/devicetree.cb M src/mainboard/google/parrot/devicetree.cb M src/mainboard/google/stout/devicetree.cb M src/mainboard/hp/2570p/devicetree.cb M src/mainboard/hp/2760p/devicetree.cb M src/mainboard/hp/8460p/devicetree.cb M src/mainboard/hp/8470p/devicetree.cb M src/mainboard/hp/folio_9470m/devicetree.cb M src/mainboard/hp/revolve_810_g1/devicetree.cb M src/mainboard/lenovo/l520/devicetree.cb M src/mainboard/lenovo/s230u/devicetree.cb M src/mainboard/lenovo/t420/devicetree.cb M src/mainboard/lenovo/t420s/devicetree.cb M src/mainboard/lenovo/t430/devicetree.cb M src/mainboard/lenovo/t430s/devicetree.cb M src/mainboard/lenovo/t430s/variants/t431s/overridetree.cb M src/mainboard/lenovo/t520/variants/t520/devicetree.cb M src/mainboard/lenovo/t520/variants/w520/devicetree.cb M src/mainboard/lenovo/t530/variants/t530/devicetree.cb M src/mainboard/lenovo/t530/variants/w530/devicetree.cb M src/mainboard/lenovo/x131e/devicetree.cb M src/mainboard/lenovo/x1_carbon_gen1/devicetree.cb M src/mainboard/lenovo/x220/devicetree.cb M src/mainboard/lenovo/x230/devicetree.cb M src/mainboard/roda/rv11/variants/rv11/devicetree.cb M src/mainboard/roda/rv11/variants/rw11/devicetree.cb M src/mainboard/sapphire/pureplatinumh61/devicetree.cb M src/northbridge/intel/sandybridge/chip.h M src/northbridge/intel/sandybridge/gma.c 31 files changed, 93 insertions(+), 64 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/67/30567/1
diff --git a/src/mainboard/apple/macbookair4_2/devicetree.cb b/src/mainboard/apple/macbookair4_2/devicetree.cb index 226ec04..4a7edc9 100644 --- a/src/mainboard/apple/macbookair4_2/devicetree.cb +++ b/src/mainboard/apple/macbookair4_2/devicetree.cb @@ -3,7 +3,6 @@ register "gfx.link_frequency_270_mhz" = "0" register "gfx.ndid" = "2" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00001312" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -13,7 +12,8 @@ register "gpu_panel_power_cycle_delay" = "6" register "gpu_panel_power_down_delay" = "500" register "gpu_panel_power_up_delay" = "2000" - register "gpu_pch_backlight" = "0x13121312" + register "pwm_freq" = "200" + register "duty_cycle" = "100" device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/asrock/b75pro3-m/devicetree.cb b/src/mainboard/asrock/b75pro3-m/devicetree.cb index def3d1d..24cfe9a 100644 --- a/src/mainboard/asrock/b75pro3-m/devicetree.cb +++ b/src/mainboard/asrock/b75pro3-m/devicetree.cb @@ -19,7 +19,6 @@ register "gfx.link_frequency_270_mhz" = "0" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "0" - register "gpu_cpu_backlight" = "0x00000000" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -29,7 +28,6 @@ register "gpu_panel_power_cycle_delay" = "4" register "gpu_panel_power_down_delay" = "0" register "gpu_panel_power_up_delay" = "0" - register "gpu_pch_backlight" = "0x00000000" device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/google/link/devicetree.cb b/src/mainboard/google/link/devicetree.cb index 07be8e7..05d7b34 100644 --- a/src/mainboard/google/link/devicetree.cb +++ b/src/mainboard/google/link/devicetree.cb @@ -15,8 +15,9 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # 200ms
# Set backlight PWM values for eDP - register "gpu_cpu_backlight" = "0x00000200" - register "gpu_pch_backlight" = "0x04000000" + register "pwm_freq" = "953" + register "duty_cycle" = "50" +
register "max_mem_clock_mhz" = "666"
diff --git a/src/mainboard/google/parrot/devicetree.cb b/src/mainboard/google/parrot/devicetree.cb index eacfe57..d47684c 100644 --- a/src/mainboard/google/parrot/devicetree.cb +++ b/src/mainboard/google/parrot/devicetree.cb @@ -17,6 +17,9 @@ # Set backlight PWM values register "gpu_cpu_backlight" = "0x000001d4" register "gpu_pch_backlight" = "0x03aa0000" + register "pwm_freq" = "1041" + register "duty_cycle" = "50" +
register "max_mem_clock_mhz" = "666"
diff --git a/src/mainboard/google/stout/devicetree.cb b/src/mainboard/google/stout/devicetree.cb index 0fdb55e..446c822 100644 --- a/src/mainboard/google/stout/devicetree.cb +++ b/src/mainboard/google/stout/devicetree.cb @@ -17,8 +17,8 @@ # For native gfx register "gfx.use_spread_spectrum_clock" = "0" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x06100610" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
register "max_mem_clock_mhz" = "666"
diff --git a/src/mainboard/hp/2570p/devicetree.cb b/src/mainboard/hp/2570p/devicetree.cb index 753d286..bf3f03f 100644 --- a/src/mainboard/hp/2570p/devicetree.cb +++ b/src/mainboard/hp/2570p/devicetree.cb @@ -19,7 +19,6 @@ register "gfx.link_frequency_270_mhz" = "1" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00000437" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -29,7 +28,8 @@ register "gpu_panel_power_cycle_delay" = "5" register "gpu_panel_power_down_delay" = "230" register "gpu_panel_power_up_delay" = "300" - register "gpu_pch_backlight" = "0x0d9c0d9c" + register "pwm_freq" = "280" + register "duty_cycle" = "30" device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/hp/2760p/devicetree.cb b/src/mainboard/hp/2760p/devicetree.cb index 041b5e8..6bd4885 100644 --- a/src/mainboard/hp/2760p/devicetree.cb +++ b/src/mainboard/hp/2760p/devicetree.cb @@ -19,7 +19,6 @@ register "gfx.link_frequency_270_mhz" = "1" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00000129" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -29,7 +28,8 @@ register "gpu_panel_power_cycle_delay" = "5" register "gpu_panel_power_down_delay" = "230" register "gpu_panel_power_up_delay" = "300" - register "gpu_pch_backlight" = "0x02880288" + register "pwm_freq" = "1507" + register "duty_cycle" = "45" device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/hp/8460p/devicetree.cb b/src/mainboard/hp/8460p/devicetree.cb index 9f9efbb..adacbd9 100644 --- a/src/mainboard/hp/8460p/devicetree.cb +++ b/src/mainboard/hp/8460p/devicetree.cb @@ -19,7 +19,6 @@ register "gfx.link_frequency_270_mhz" = "1" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00000129" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -29,7 +28,9 @@ register "gpu_panel_power_cycle_delay" = "5" register "gpu_panel_power_down_delay" = "230" register "gpu_panel_power_up_delay" = "300" - register "gpu_pch_backlight" = "0x02880288" + register "pwm_freq" = "1507" + register "duty_cycle" = "45" + device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/hp/8470p/devicetree.cb b/src/mainboard/hp/8470p/devicetree.cb index 9d6fe3f..c9151fc 100644 --- a/src/mainboard/hp/8470p/devicetree.cb +++ b/src/mainboard/hp/8470p/devicetree.cb @@ -19,7 +19,6 @@ register "gfx.link_frequency_270_mhz" = "1" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00000385" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -29,7 +28,9 @@ register "gpu_panel_power_cycle_delay" = "5" register "gpu_panel_power_down_delay" = "230" register "gpu_panel_power_up_delay" = "300" - register "gpu_pch_backlight" = "0x0d9c0d9c" + register "pwm_freq" = "280" + register "duty_cycle" = "26" + device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/hp/folio_9470m/devicetree.cb b/src/mainboard/hp/folio_9470m/devicetree.cb index 56d90d3..c8fb413 100644 --- a/src/mainboard/hp/folio_9470m/devicetree.cb +++ b/src/mainboard/hp/folio_9470m/devicetree.cb @@ -19,7 +19,6 @@ register "gfx.link_frequency_270_mhz" = "1" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00000d9c" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -29,7 +28,9 @@ register "gpu_panel_power_cycle_delay" = "5" register "gpu_panel_power_down_delay" = "230" register "gpu_panel_power_up_delay" = "300" - register "gpu_pch_backlight" = "0x0d9c0d9c" + register "pwm_freq" = "280" + register "duty_cycle" = "30" + device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/hp/revolve_810_g1/devicetree.cb b/src/mainboard/hp/revolve_810_g1/devicetree.cb index 2384e71..604d4bc 100644 --- a/src/mainboard/hp/revolve_810_g1/devicetree.cb +++ b/src/mainboard/hp/revolve_810_g1/devicetree.cb @@ -19,7 +19,6 @@ register "gfx.link_frequency_270_mhz" = "1" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00000263" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -29,7 +28,9 @@ register "gpu_panel_power_cycle_delay" = "5" register "gpu_panel_power_down_delay" = "230" register "gpu_panel_power_up_delay" = "300" - register "gpu_pch_backlight" = "0x02880288" + register "pwm_freq" = "1507" + register "duty_cycle" = "94" + device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/lenovo/l520/devicetree.cb b/src/mainboard/lenovo/l520/devicetree.cb index 3e1f308..af14415 100644 --- a/src/mainboard/lenovo/l520/devicetree.cb +++ b/src/mainboard/lenovo/l520/devicetree.cb @@ -3,7 +3,6 @@ register "gfx.link_frequency_270_mhz" = "0" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "0" - register "gpu_cpu_backlight" = "0x00000000" register "gpu_dp_b_hotplug" = "0" register "gpu_dp_c_hotplug" = "0" register "gpu_dp_d_hotplug" = "0" @@ -13,7 +12,6 @@ register "gpu_panel_power_cycle_delay" = "0" register "gpu_panel_power_down_delay" = "0" register "gpu_panel_power_up_delay" = "0" - register "gpu_pch_backlight" = "0x00000000"
device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/lenovo/s230u/devicetree.cb b/src/mainboard/lenovo/s230u/devicetree.cb index 35135a9..ddf7baa 100644 --- a/src/mainboard/lenovo/s230u/devicetree.cb +++ b/src/mainboard/lenovo/s230u/devicetree.cb @@ -3,7 +3,6 @@ register "gfx.link_frequency_270_mhz" = "1" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00000060" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -13,7 +12,9 @@ register "gpu_panel_power_cycle_delay" = "5" register "gpu_panel_power_down_delay" = "500" register "gpu_panel_power_up_delay" = "600" - register "gpu_pch_backlight" = "0x041e041e" + register "pwm_freq" = "926" + register "duty_cycle" = "10" + device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 device lapic 0x0 on diff --git a/src/mainboard/lenovo/t420/devicetree.cb b/src/mainboard/lenovo/t420/devicetree.cb index bed406a..0b7722e 100644 --- a/src/mainboard/lenovo/t420/devicetree.cb +++ b/src/mainboard/lenovo/t420/devicetree.cb @@ -15,8 +15,8 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # T4: 200ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x06100610" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
device cpu_cluster 0 on chip cpu/intel/socket_rPGA988B diff --git a/src/mainboard/lenovo/t420s/devicetree.cb b/src/mainboard/lenovo/t420s/devicetree.cb index a090308..809fee2 100644 --- a/src/mainboard/lenovo/t420s/devicetree.cb +++ b/src/mainboard/lenovo/t420s/devicetree.cb @@ -14,8 +14,8 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # T4: 200ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x06100610" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
device cpu_cluster 0 on chip cpu/intel/socket_rPGA988B diff --git a/src/mainboard/lenovo/t430/devicetree.cb b/src/mainboard/lenovo/t430/devicetree.cb index 5eb92bc..ddd4289 100644 --- a/src/mainboard/lenovo/t430/devicetree.cb +++ b/src/mainboard/lenovo/t430/devicetree.cb @@ -14,8 +14,8 @@ register "gpu_panel_power_backlight_off_delay" = "2100" # T4: 210ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x11551155" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/lenovo/t430s/devicetree.cb b/src/mainboard/lenovo/t430s/devicetree.cb index 56e7f63..69e104a 100644 --- a/src/mainboard/lenovo/t430s/devicetree.cb +++ b/src/mainboard/lenovo/t430s/devicetree.cb @@ -14,8 +14,8 @@ register "gpu_panel_power_backlight_off_delay" = "2100" # T4: 210ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x11551155" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
device cpu_cluster 0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/lenovo/t430s/variants/t431s/overridetree.cb b/src/mainboard/lenovo/t430s/variants/t431s/overridetree.cb index e69f727..3abf890 100644 --- a/src/mainboard/lenovo/t430s/variants/t431s/overridetree.cb +++ b/src/mainboard/lenovo/t430s/variants/t431s/overridetree.cb @@ -10,7 +10,8 @@ register "gpu_panel_power_down_delay" = "500" # 50ms register "gpu_panel_power_backlight_on_delay" = "1" # 0.1ms register "gpu_panel_power_backlight_off_delay" = "1" # 0.1ms - register "gpu_cpu_backlight" = "0x03d2" + register "duty_cycle" = "63" +
device domain 0 on device pci 00.0 on diff --git a/src/mainboard/lenovo/t520/variants/t520/devicetree.cb b/src/mainboard/lenovo/t520/variants/t520/devicetree.cb index 97350f3..671b45d 100644 --- a/src/mainboard/lenovo/t520/variants/t520/devicetree.cb +++ b/src/mainboard/lenovo/t520/variants/t520/devicetree.cb @@ -15,8 +15,8 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # T4: 200ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x06100610" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
device cpu_cluster 0 on chip cpu/intel/socket_rPGA988B diff --git a/src/mainboard/lenovo/t520/variants/w520/devicetree.cb b/src/mainboard/lenovo/t520/variants/w520/devicetree.cb index 33b9368..3df91b9 100644 --- a/src/mainboard/lenovo/t520/variants/w520/devicetree.cb +++ b/src/mainboard/lenovo/t520/variants/w520/devicetree.cb @@ -15,8 +15,8 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # T4: 200ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x06100610" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
device cpu_cluster 0 on chip cpu/intel/socket_rPGA988B diff --git a/src/mainboard/lenovo/t530/variants/t530/devicetree.cb b/src/mainboard/lenovo/t530/variants/t530/devicetree.cb index 4dcdc9d..20404c0 100644 --- a/src/mainboard/lenovo/t530/variants/t530/devicetree.cb +++ b/src/mainboard/lenovo/t530/variants/t530/devicetree.cb @@ -15,8 +15,8 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # T4: 200ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x11551155" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
device cpu_cluster 0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/lenovo/t530/variants/w530/devicetree.cb b/src/mainboard/lenovo/t530/variants/w530/devicetree.cb index 7a72b26..4af6c42 100644 --- a/src/mainboard/lenovo/t530/variants/w530/devicetree.cb +++ b/src/mainboard/lenovo/t530/variants/w530/devicetree.cb @@ -18,8 +18,8 @@ register "gpu_panel_power_backlight_on_delay" = "2000" # T3: 200ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x11551155" + register "pwm_freq" = "220" + register "duty_cycle" = "100"
device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/lenovo/x131e/devicetree.cb b/src/mainboard/lenovo/x131e/devicetree.cb index ccdff7c..2a3a30f 100644 --- a/src/mainboard/lenovo/x131e/devicetree.cb +++ b/src/mainboard/lenovo/x131e/devicetree.cb @@ -14,8 +14,8 @@ register "gpu_panel_power_backlight_off_delay" = "2000" register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x11551155" + register "pwm_freq" = "220" + register "duty_cycle" = "100"
device cpu_cluster 0x0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/lenovo/x1_carbon_gen1/devicetree.cb b/src/mainboard/lenovo/x1_carbon_gen1/devicetree.cb index cb88a7f..c60ac62 100644 --- a/src/mainboard/lenovo/x1_carbon_gen1/devicetree.cb +++ b/src/mainboard/lenovo/x1_carbon_gen1/devicetree.cb @@ -3,7 +3,6 @@ register "gfx.link_frequency_270_mhz" = "1" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "1" - register "gpu_cpu_backlight" = "0x00001155" register "gpu_dp_b_hotplug" = "4" register "gpu_dp_c_hotplug" = "4" register "gpu_dp_d_hotplug" = "4" @@ -13,7 +12,9 @@ register "gpu_panel_power_cycle_delay" = "6" register "gpu_panel_power_down_delay" = "300" register "gpu_panel_power_up_delay" = "300" - register "gpu_pch_backlight" = "0x11551155" + register "pwm_freq" = "220" + register "duty_cycle" = "100" +
device cpu_cluster 0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/lenovo/x220/devicetree.cb b/src/mainboard/lenovo/x220/devicetree.cb index 969ae38..85f3fbc 100644 --- a/src/mainboard/lenovo/x220/devicetree.cb +++ b/src/mainboard/lenovo/x220/devicetree.cb @@ -15,8 +15,8 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # T4: 200ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x06100610" + register "pwm_freq" = "629" + register "duty_cycle" = "100"
device cpu_cluster 0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/lenovo/x230/devicetree.cb b/src/mainboard/lenovo/x230/devicetree.cb index a31be72..9a4866d 100644 --- a/src/mainboard/lenovo/x230/devicetree.cb +++ b/src/mainboard/lenovo/x230/devicetree.cb @@ -15,8 +15,8 @@ register "gpu_panel_power_backlight_off_delay" = "2100" # T4: 210ms register "gfx.use_spread_spectrum_clock" = "1" register "gfx.link_frequency_270_mhz" = "1" - register "gpu_cpu_backlight" = "0x1155" - register "gpu_pch_backlight" = "0x11551155" + register "pwm_freq" = "220" + register "duty_cycle" = "100"
device cpu_cluster 0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/roda/rv11/variants/rv11/devicetree.cb b/src/mainboard/roda/rv11/variants/rv11/devicetree.cb index 4455fdb..eab2401 100644 --- a/src/mainboard/roda/rv11/variants/rv11/devicetree.cb +++ b/src/mainboard/roda/rv11/variants/rv11/devicetree.cb @@ -27,8 +27,9 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # 200ms
# Set backlight PWM values for eDP - register "gpu_cpu_backlight" = "0x0000001a" - register "gpu_pch_backlight" = "0x002e0000" + register "pwm_freq" = "21229" + register "duty_cycle" = "57" +
device cpu_cluster 0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/roda/rv11/variants/rw11/devicetree.cb b/src/mainboard/roda/rv11/variants/rw11/devicetree.cb index b51c86e..ffc8b2e 100644 --- a/src/mainboard/roda/rv11/variants/rw11/devicetree.cb +++ b/src/mainboard/roda/rv11/variants/rw11/devicetree.cb @@ -27,8 +27,9 @@ register "gpu_panel_power_backlight_off_delay" = "2000" # 200ms
# Set backlight PWM values for eDP - register "gpu_cpu_backlight" = "0x00000ac8" - register "gpu_pch_backlight" = "0x13120000" + register "pwm_freq" = "200" + register "duty_cycle" = "57" +
device cpu_cluster 0 on chip cpu/intel/socket_rPGA989 diff --git a/src/mainboard/sapphire/pureplatinumh61/devicetree.cb b/src/mainboard/sapphire/pureplatinumh61/devicetree.cb index ed0d997..617e69d 100644 --- a/src/mainboard/sapphire/pureplatinumh61/devicetree.cb +++ b/src/mainboard/sapphire/pureplatinumh61/devicetree.cb @@ -19,7 +19,6 @@ register "gfx.link_frequency_270_mhz" = "0" register "gfx.ndid" = "3" register "gfx.use_spread_spectrum_clock" = "0" - register "gpu_cpu_backlight" = "0x00000000" register "gpu_dp_b_hotplug" = "0" register "gpu_dp_c_hotplug" = "0" register "gpu_dp_d_hotplug" = "0" @@ -29,7 +28,6 @@ register "gpu_panel_power_cycle_delay" = "0" register "gpu_panel_power_down_delay" = "0" register "gpu_panel_power_up_delay" = "0" - register "gpu_pch_backlight" = "0x00000000" device cpu_cluster 0x0 on chip cpu/intel/socket_LGA1155 device lapic 0x0 on diff --git a/src/northbridge/intel/sandybridge/chip.h b/src/northbridge/intel/sandybridge/chip.h index d002824..ebead59 100644 --- a/src/northbridge/intel/sandybridge/chip.h +++ b/src/northbridge/intel/sandybridge/chip.h @@ -37,8 +37,8 @@ u16 gpu_panel_power_backlight_on_delay; /* T5 time sequence */ u16 gpu_panel_power_backlight_off_delay; /* Tx time sequence */
- u32 gpu_cpu_backlight; /* CPU Backlight PWM value */ - u32 gpu_pch_backlight; /* PCH Backlight PWM value */ + u32 pwm_freq; + u8 duty_cycle;
/* * Maximum memory clock. diff --git a/src/northbridge/intel/sandybridge/gma.c b/src/northbridge/intel/sandybridge/gma.c index cd8f7b9..c5cdd41 100644 --- a/src/northbridge/intel/sandybridge/gma.c +++ b/src/northbridge/intel/sandybridge/gma.c @@ -528,6 +528,17 @@ gtt_write(0xe4f24, 0x0ff803cf); }
+static uint32_t get_raw_freq_mhz(void) +{ + uint32_t pp_divisor = (gtt_read(PCH_PP_DIVISOR) >> 8) & 0xffffff; + return (pp_divisor + 1) * 2 / 100; +} + +static uin32_t pwm_freq_to_reg(uint32_t pwm_freq) +{ + return get_raw_freq_mhz * 1000000 / (pwm_freq * 128); +} + static void gma_pm_init_post_vbios(struct device *dev) { struct northbridge_intel_sandybridge_config *conf = dev->chip_info; @@ -582,14 +593,25 @@ gtt_write(0xc7210, reg32); }
- /* Enable Backlight if needed */ - if (conf->gpu_cpu_backlight) { - gtt_write(0x48250, (1 << 31)); - gtt_write(0x48254, conf->gpu_cpu_backlight); - } - if (conf->gpu_pch_backlight) { + if (conf->pwm_freq) + { + uint32_t pwm_reg = pwm_freq_to_reg(conf->pwm_freq); + /* Set the pwm frequency */ gtt_write(0xc8250, (1 << 31)); - gtt_write(0xc8254, conf->gpu_pch_backlight); + reg = pwm_reg << 16; + /* PCH PWM freq override */ + uint8_t duty_cycle = conf->duty_cycle; + if (duty_cycle == 0 || duty_cycle > 100) { + printk(BIOS_WARNING, "GMA: Invalid duty cycle, using 100%\n"); + duty_cycle = 100; + } + if (gtt_read(0xc8250) & (1 << 30)) + reg |= pwm_reg * duty_cycle / 100; + /* PCH PWM backlight freq + duty cycle*/ + gtt_write(0xc8254, reg); + /* CPU PWM backlight duty cycle */ + gtt_write(0x48250, (1 << 31)); + gtt_write(0x48254, pwm_reg * duty_cycle / 100); } }