• Home
  • Raw
  • Download

Lines Matching +full:int +full:- +full:threshold

1 // SPDX-License-Identifier: GPL-2.0-only
5 * - AF82MP20 PCH
7 * Copyright (C) 2009-2010 Intel Corporation. All rights reserved.
35 #include <asm/intel-mid.h>
45 static int timer_margin = DEFAULT_SOFT_TO_HARD_MARGIN;
46 module_param(timer_margin, int, 0);
53 static int timer_set = DEFAULT_TIME;
54 module_param(timer_set, int, 0);
65 static int force_boot;
66 module_param(force_boot, int, 0);
96 static int check_timer_margin(int new_margin) in check_timer_margin()
99 (new_margin > MAX_TIME - timer_set)) { in check_timer_margin()
101 new_margin, MIN_TIME_CYCLE, MAX_TIME - timer_set); in check_timer_margin()
102 return -EINVAL; in check_timer_margin()
110 static int watchdog_set_ipc(int soft_threshold, int threshold) in watchdog_set_ipc() argument
114 int ipc_ret = 0; in watchdog_set_ipc()
118 ipc_wbuf[1] = threshold; in watchdog_set_ipc()
139 static irqreturn_t watchdog_timer_interrupt(int irq, void *dev_id) in watchdog_timer_interrupt()
141 int int_status; in watchdog_timer_interrupt()
158 /* set the timer to the threshold */ in watchdog_timer_interrupt()
159 iowrite32(watchdog_device.threshold, in watchdog_timer_interrupt()
168 static int intel_scu_keepalive(void) in intel_scu_keepalive()
171 /* read eoi register - clears interrupt */ in intel_scu_keepalive()
187 static int intel_scu_stop(void) in intel_scu_stop()
193 static int intel_scu_set_heartbeat(u32 t) in intel_scu_set_heartbeat()
195 int ipc_ret; in intel_scu_set_heartbeat()
196 int retry_count; in intel_scu_set_heartbeat()
201 watchdog_device.threshold = in intel_scu_set_heartbeat()
202 timer_margin * watchdog_device.timer_tbl_ptr->freq_hz; in intel_scu_set_heartbeat()
204 (watchdog_device.timer_set - timer_margin) in intel_scu_set_heartbeat()
205 * watchdog_device.timer_tbl_ptr->freq_hz; in intel_scu_set_heartbeat()
208 watchdog_device.timer_tbl_ptr->freq_hz); in intel_scu_set_heartbeat()
212 pr_debug("set_heartbeat: threshold is %x (hex)\n", in intel_scu_set_heartbeat()
213 watchdog_device.threshold); in intel_scu_set_heartbeat()
219 watchdog_device.threshold = in intel_scu_set_heartbeat()
220 watchdog_device.threshold / FREQ_ADJUSTMENT; in intel_scu_set_heartbeat()
227 /* send the threshold and soft_threshold via IPC to the processor */ in intel_scu_set_heartbeat()
229 watchdog_device.threshold); in intel_scu_set_heartbeat()
237 /* Soft Threshold set loop. Early versions of silicon did */ in intel_scu_set_heartbeat()
251 return -ENODEV; in intel_scu_set_heartbeat()
254 /* set the timer to the soft threshold */ in intel_scu_set_heartbeat()
280 static int intel_scu_open(struct inode *inode, struct file *file) in intel_scu_open()
285 return -EBUSY; in intel_scu_open()
289 return -EPERM; in intel_scu_open()
294 static int intel_scu_release(struct inode *inode, struct file *file) in intel_scu_release()
307 return -ENOTTY; in intel_scu_release()
348 unsigned int cmd, in intel_scu_ioctl()
368 sizeof(ident)) ? -EFAULT : 0; in intel_scu_ioctl()
378 return -EFAULT; in intel_scu_ioctl()
381 return -EINVAL; in intel_scu_ioctl()
384 return -EINVAL; in intel_scu_ioctl()
390 return -ENOTTY; in intel_scu_ioctl()
397 static int intel_scu_notify_sys(struct notifier_block *this, in intel_scu_notify_sys()
420 static int __init intel_scu_watchdog_init(void) in intel_scu_watchdog_init()
422 int ret; in intel_scu_watchdog_init()
432 return -ENODEV; in intel_scu_watchdog_init()
438 (timer_set > MAX_TIME - MIN_TIME_CYCLE)) { in intel_scu_watchdog_init()
440 timer_set, MIN_TIME_CYCLE, MAX_TIME - MIN_TIME_CYCLE); in intel_scu_watchdog_init()
441 return -EINVAL; in intel_scu_watchdog_init()
446 return -EINVAL; in intel_scu_watchdog_init()
448 watchdog_device.timer_tbl_ptr = sfi_get_mtmr(sfi_mtimer_num-1); in intel_scu_watchdog_init()
452 return -ENODEV; in intel_scu_watchdog_init()
455 if (watchdog_device.timer_tbl_ptr->phys_addr == 0) { in intel_scu_watchdog_init()
458 return -ENODEV; in intel_scu_watchdog_init()
461 if (watchdog_device.timer_tbl_ptr->irq == 0) { in intel_scu_watchdog_init()
463 return -ENODEV; in intel_scu_watchdog_init()
466 tmp_addr = ioremap(watchdog_device.timer_tbl_ptr->phys_addr, in intel_scu_watchdog_init()
471 return -ENOMEM; in intel_scu_watchdog_init()
483 watchdog_device.threshold = in intel_scu_watchdog_init()
484 timer_margin * watchdog_device.timer_tbl_ptr->freq_hz; in intel_scu_watchdog_init()
486 (watchdog_device.timer_set - timer_margin) in intel_scu_watchdog_init()
487 * watchdog_device.timer_tbl_ptr->freq_hz; in intel_scu_watchdog_init()
510 ret = request_irq((unsigned int)watchdog_device.timer_tbl_ptr->irq, in intel_scu_watchdog_init()