Lines Matching +full:de +full:- +full:asserting
4 * (C) 2002 Hiroshi Miura <miura@da-cha.org>
13 * software is provided AS-IS with no warranties.
22 * Suspend Modulation works by asserting and de-asserting the SUSP# pin
23 * to CPU(GX1/GXLV) for configurable durations. When asserting SUSP#
31 * 32us intervals which the SUSP# pin is asserted(ON)/de-asserted(OFF)
38 * F_eff = Fgx * ----------------------
46 * on_duration = off_duration * (stock_freq - freq) / freq
49 * on_duration = DURATION - off_duration
52 *---------------------------------------------------------------------------
55 * Dec. 12, 2003 Hiroshi Miura <miura@da-cha.org>
56 * - fix on/off register mistake
57 * - fix cpu_khz calc when it stops cpu modulation.
59 * Dec. 11, 2002 Hiroshi Miura <miura@da-cha.org>
60 * - rewrite for Cyrix MediaGX Cx5510/5520 and
64 * - cs5530_mod patch for 2.4.19-rc1.
66 *---------------------------------------------------------------------------
73 * Suspend Modulation - Definitions *
86 #include <asm/processor-cyrix.h>
108 #define SMISPDUP (1<<1) /* select how SMI re-enable suspend modulation: */
109 /* IRQTC timer or read SMI speedup disable reg.(F1BAR[08-09h]) */
127 /* PCI bus clock - defaults to 30.000 if cpu_khz is not available */
135 * is suspended -- processing power is just 0.39% of what it used to be,
136 * though. 781.25 kHz(!) for a 200 MHz processor -- wow. */
141 * - let's say 5%. (min = maxfreq / POLICY_MIN_DIV)
179 pci_write_config_byte(gx_params->cs55x0, reg, value); in gx_write_byte()
208 if ((gx_params->pci_suscfg & SUSMOD) == 0) in gx_get_cpuspeed()
211 return (stock_freq * gx_params->off_duration) in gx_get_cpuspeed()
212 / (gx_params->on_duration + gx_params->off_duration); in gx_get_cpuspeed()
232 for (i = max_duration; i > 0; i--) { in gx_validate_speed()
234 tmp_on = i - tmp_off; in gx_validate_speed()
237 * prefer it, too - lower latency */ in gx_validate_speed()
238 if (abs(tmp_freq - khz) <= abs(old_tmp_freq - khz)) { in gx_validate_speed()
263 new_khz = gx_validate_speed(khz, &gx_params->on_duration, in gx_set_cpuspeed()
264 &gx_params->off_duration); in gx_set_cpuspeed()
273 switch (gx_params->cs55x0->device) { in gx_set_cpuspeed()
275 pmer1 = gx_params->pci_pmer1 | IRQ_SPDUP | VID_SPDUP; in gx_set_cpuspeed()
276 /* FIXME: need to test other values -- Zwane,Miura */ in gx_set_cpuspeed()
283 if (gx_params->cs55x0->revision < 0x10) { in gx_set_cpuspeed()
285 suscfg = gx_params->pci_suscfg|SUSMOD; in gx_set_cpuspeed()
288 suscfg = gx_params->pci_suscfg|SUSMOD|PWRSVE; in gx_set_cpuspeed()
293 suscfg = gx_params->pci_suscfg | SUSMOD; in gx_set_cpuspeed()
301 suscfg = gx_params->pci_suscfg & ~(SUSMOD); in gx_set_cpuspeed()
302 gx_params->off_duration = 0; in gx_set_cpuspeed()
303 gx_params->on_duration = 0; in gx_set_cpuspeed()
307 gx_write_byte(PCI_MODOFF, gx_params->off_duration); in gx_set_cpuspeed()
308 gx_write_byte(PCI_MODON, gx_params->on_duration); in gx_set_cpuspeed()
311 pci_read_config_byte(gx_params->cs55x0, PCI_SUSCFG, &suscfg); in gx_set_cpuspeed()
315 gx_params->pci_suscfg = suscfg; in gx_set_cpuspeed()
320 gx_params->on_duration * 32, gx_params->off_duration * 32); in gx_set_cpuspeed()
341 return -EINVAL; in cpufreq_gx_verify()
343 policy->cpu = 0; in cpufreq_gx_verify()
348 * within policy->min and policy->max. If it is not, policy->max in cpufreq_gx_verify()
350 * policy->min may not be decreased, though. This way we guarantee a in cpufreq_gx_verify()
353 tmp_freq = gx_validate_speed(policy->min, &tmp1, &tmp2); in cpufreq_gx_verify()
354 if (tmp_freq < policy->min) in cpufreq_gx_verify()
356 policy->min = tmp_freq; in cpufreq_gx_verify()
357 if (policy->min > policy->max) in cpufreq_gx_verify()
358 policy->max = tmp_freq; in cpufreq_gx_verify()
359 tmp_freq = gx_validate_speed(policy->max, &tmp1, &tmp2); in cpufreq_gx_verify()
360 if (tmp_freq > policy->max) in cpufreq_gx_verify()
361 tmp_freq -= stock_freq / max_duration; in cpufreq_gx_verify()
362 policy->max = tmp_freq; in cpufreq_gx_verify()
363 if (policy->max < policy->min) in cpufreq_gx_verify()
364 policy->max = policy->min; in cpufreq_gx_verify()
383 return -EINVAL; in cpufreq_gx_target()
385 policy->cpu = 0; in cpufreq_gx_target()
388 while (tmp_freq < policy->min) { in cpufreq_gx_target()
392 while (tmp_freq > policy->max) { in cpufreq_gx_target()
393 tmp_freq -= stock_freq / max_duration; in cpufreq_gx_target()
406 if (!policy || policy->cpu != 0) in cpufreq_gx_cpu_init()
407 return -ENODEV; in cpufreq_gx_cpu_init()
422 policy->cpu = 0; in cpufreq_gx_cpu_init()
425 policy->min = maxfreq / max_duration; in cpufreq_gx_cpu_init()
427 policy->min = maxfreq / POLICY_MIN_DIV; in cpufreq_gx_cpu_init()
428 policy->max = maxfreq; in cpufreq_gx_cpu_init()
429 policy->cpuinfo.min_freq = maxfreq / max_duration; in cpufreq_gx_cpu_init()
430 policy->cpuinfo.max_freq = maxfreq; in cpufreq_gx_cpu_init()
445 .name = "gx-suspmod",
457 return -ENODEV; in cpufreq_gx_init()
467 return -ENOMEM; in cpufreq_gx_init()
469 params->cs55x0 = gx_pci; in cpufreq_gx_init()
473 pci_read_config_byte(params->cs55x0, PCI_SUSCFG, &(params->pci_suscfg)); in cpufreq_gx_init()
474 pci_read_config_byte(params->cs55x0, PCI_PMER1, &(params->pci_pmer1)); in cpufreq_gx_init()
475 pci_read_config_byte(params->cs55x0, PCI_PMER2, &(params->pci_pmer2)); in cpufreq_gx_init()
476 pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration)); in cpufreq_gx_init()
477 pci_read_config_byte(params->cs55x0, PCI_MODOFF, in cpufreq_gx_init()
478 &(params->off_duration)); in cpufreq_gx_init()
492 pci_dev_put(gx_params->cs55x0); in cpufreq_gx_exit()
496 MODULE_AUTHOR("Hiroshi Miura <miura@da-cha.org>");