diff options
Diffstat (limited to 'drivers/idle/i7300_idle.c')
-rw-r--r-- | drivers/idle/i7300_idle.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c index 79d47f284cd6..fb176f6ef9f8 100644 --- a/drivers/idle/i7300_idle.c +++ b/drivers/idle/i7300_idle.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #define I7300_IDLE_DRIVER_VERSION "1.55" | 35 | #define I7300_IDLE_DRIVER_VERSION "1.55" |
36 | #define I7300_PRINT "i7300_idle:" | 36 | #define I7300_PRINT "i7300_idle:" |
37 | 37 | ||
38 | #define MAX_STOP_RETRIES 10 | ||
39 | |||
38 | static int debug; | 40 | static int debug; |
39 | module_param_named(debug, debug, uint, 0644); | 41 | module_param_named(debug, debug, uint, 0644); |
40 | MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); | 42 | MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); |
@@ -47,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); | |||
47 | * 0 = No throttling | 49 | * 0 = No throttling |
48 | * 1 = Throttle when > 4 activations per eval window (Maximum throttling) | 50 | * 1 = Throttle when > 4 activations per eval window (Maximum throttling) |
49 | * 2 = Throttle when > 8 activations | 51 | * 2 = Throttle when > 8 activations |
50 | * 168 = Throttle when > 168 activations (Minimum throttling) | 52 | * 168 = Throttle when > 672 activations (Minimum throttling) |
51 | */ | 53 | */ |
52 | #define MAX_THRTLWLIMIT 168 | 54 | #define MAX_THROTTLE_LOW_LIMIT 168 |
53 | static uint i7300_idle_thrtlowlm = 1; | 55 | static uint throttle_low_limit = 1; |
54 | module_param_named(thrtlwlimit, i7300_idle_thrtlowlm, uint, 0644); | 56 | module_param_named(throttle_low_limit, throttle_low_limit, uint, 0644); |
55 | MODULE_PARM_DESC(thrtlwlimit, | 57 | MODULE_PARM_DESC(throttle_low_limit, |
56 | "Value for THRTLOWLM activation field " | 58 | "Value for THRTLOWLM activation field " |
57 | "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)"); | 59 | "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)"); |
58 | 60 | ||
@@ -111,9 +113,9 @@ static int i7300_idle_ioat_start(void) | |||
111 | static void i7300_idle_ioat_stop(void) | 113 | static void i7300_idle_ioat_stop(void) |
112 | { | 114 | { |
113 | int i; | 115 | int i; |
114 | u8 sts; | 116 | u64 sts; |
115 | 117 | ||
116 | for (i = 0; i < 5; i++) { | 118 | for (i = 0; i < MAX_STOP_RETRIES; i++) { |
117 | writeb(IOAT_CHANCMD_RESET, | 119 | writeb(IOAT_CHANCMD_RESET, |
118 | ioat_chanbase + IOAT1_CHANCMD_OFFSET); | 120 | ioat_chanbase + IOAT1_CHANCMD_OFFSET); |
119 | 121 | ||
@@ -127,9 +129,10 @@ static void i7300_idle_ioat_stop(void) | |||
127 | 129 | ||
128 | } | 130 | } |
129 | 131 | ||
130 | if (i == 5) | 132 | if (i == MAX_STOP_RETRIES) { |
131 | dprintk("failed to suspend+reset I/O AT after 5 retries\n"); | 133 | dprintk("failed to stop I/O AT after %d retries\n", |
132 | 134 | MAX_STOP_RETRIES); | |
135 | } | ||
133 | } | 136 | } |
134 | 137 | ||
135 | /* Test I/O AT by copying 1024 byte from 2k to 1k */ | 138 | /* Test I/O AT by copying 1024 byte from 2k to 1k */ |
@@ -276,7 +279,7 @@ static void __exit i7300_idle_ioat_exit(void) | |||
276 | i7300_idle_ioat_stop(); | 279 | i7300_idle_ioat_stop(); |
277 | 280 | ||
278 | /* Wait for a while for the channel to halt before releasing */ | 281 | /* Wait for a while for the channel to halt before releasing */ |
279 | for (i = 0; i < 10; i++) { | 282 | for (i = 0; i < MAX_STOP_RETRIES; i++) { |
280 | writeb(IOAT_CHANCMD_RESET, | 283 | writeb(IOAT_CHANCMD_RESET, |
281 | ioat_chanbase + IOAT1_CHANCMD_OFFSET); | 284 | ioat_chanbase + IOAT1_CHANCMD_OFFSET); |
282 | 285 | ||
@@ -390,9 +393,9 @@ static void i7300_idle_start(void) | |||
390 | new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT; | 393 | new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT; |
391 | pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl); | 394 | pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl); |
392 | 395 | ||
393 | limit = i7300_idle_thrtlowlm; | 396 | limit = throttle_low_limit; |
394 | if (unlikely(limit > MAX_THRTLWLIMIT)) | 397 | if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT)) |
395 | limit = MAX_THRTLWLIMIT; | 398 | limit = MAX_THROTTLE_LOW_LIMIT; |
396 | 399 | ||
397 | pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit); | 400 | pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit); |
398 | 401 | ||
@@ -441,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val, | |||
441 | static ktime_t idle_begin_time; | 444 | static ktime_t idle_begin_time; |
442 | static int time_init = 1; | 445 | static int time_init = 1; |
443 | 446 | ||
444 | if (!i7300_idle_thrtlowlm) | 447 | if (!throttle_low_limit) |
445 | return 0; | 448 | return 0; |
446 | 449 | ||
447 | if (unlikely(time_init)) { | 450 | if (unlikely(time_init)) { |