#if DEBUG #define DBG(x...) printk(KERN_DEBUG x) #else #define DBG(x...) #endif #define INFO(x...) printk(KERN_INFO x) #define ERR(x...) printk(KERN_ERR x) #define VID_DEC_NAME "msm_vidc_dec" static struct vid_dec_dev *vid_dec_device_p; static dev_t vid_dec_dev_num; static struct class *vid_dec_class; static void vid_dec_timer_fn(unsigned long data); static struct timer_list hw_timer = TIMER_INITIALIZER(vid_dec_timer_fn, 0, 0); /* static unsigned long hw_ticks; */ static void (*hw_timeout_fn)(void *p_user_data); static s32 vid_dec_get_empty_client_index(void) { u32 i, found = FALSE; for (i = 0; i < VID_DEC_MAX_DECODER_CLIENTS; i++) { if (!vid_dec_device_p->vdec_clients[i].vcd_handle) { found = TRUE; break; } } if (!found) { ERR("%s():ERROR No space for new client\n", __func__);
#define UART_RESET 0x95 #define UART_MODE_ON 0x03 static int uart6850_opened; static int uart6850_irq; static int uart6850_detected; static int my_dev; static DEFINE_SPINLOCK(lock); static void (*midi_input_intr) (int dev, unsigned char data); static void poll_uart6850(unsigned long dummy); static struct timer_list uart6850_timer = TIMER_INITIALIZER(poll_uart6850, 0, 0); static void uart6850_input_loop(void) { int count = 10; while (count) { /* * Not timed out */ if (input_avail()) { unsigned char c = uart6850_read(); count = 100; if (uart6850_opened & OPEN_READ)
static void floppy_off(unsigned int nr); static void setup_req_params(int drive); static void redo_fd_request(void); static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long param); static void fd_probe(int drive); static int fd_test_drive_present(int drive); static void config_types(void); static int floppy_open(struct inode *inode, struct file *filp); static int floppy_release(struct inode *inode, struct file *filp); static void do_fd_request(request_queue_t *); /************************* End of Prototypes **************************/ static struct timer_list motor_off_timer = TIMER_INITIALIZER(fd_motor_off_timer, 0, 0); #ifdef TRACKBUFFER static struct timer_list readtrack_timer = TIMER_INITIALIZER(fd_readtrack_check, 0, 0); #endif static struct timer_list timeout_timer = TIMER_INITIALIZER(fd_times_out, 0, 0); static struct timer_list fd_timer = TIMER_INITIALIZER(check_change, 0, 0); /* DAG: Haven't got a clue what this is? */ int stdma_islocked(void) {
printk(DEBUG_LVL "T:%06d %6s\n", (int)tv.tv_usec, s[event]); #endif } input_sync(ts.dev); } /* * Manage the state of the touchscreen. */ static void event_send_timer_f(unsigned long data); static struct timer_list event_send_timer = TIMER_INITIALIZER(event_send_timer_f, 0, 0); static void event_send_timer_f(unsigned long data) { static int noop_counter; int event_type; while (__kfifo_get(ts.event_fifo, (unsigned char *)&event_type, sizeof(int))) { int buf[2]; switch (event_type) { case 'D': if (ts.state == TS_STATE_RELEASE_PENDING) /* Ignore short UP event */ ts.state = TS_STATE_PRESSED;
&cs8900_device, #endif }; #if defined(CONFIG_MMC_PXA) #define IRQ_MMC_DETECT IRQ_GPIO(3) static irqreturn_t (*csb226_mmc_cd_handler)(int, void *, struct pt_regs *); static void csb226_mmc_cd_debounce_timeout (unsigned long data) { csb226_mmc_cd_handler(IRQ_MMC_DETECT, (void *)data, NULL); } static struct timer_list csb226_mmc_cd_debounce_timer = TIMER_INITIALIZER(csb226_mmc_cd_debounce_timeout, 0, 0); static irqreturn_t csb226_mmc_cd_irq (int irq, void *data, struct pt_regs *regs) { mod_timer(&csb226_mmc_cd_debounce_timer, jiffies + 5 * HZ / 100); return IRQ_HANDLED; } static int csb226_mci_init(struct device *dev, irqreturn_t (*cd_handler)(int, void *, struct pt_regs *), void *data) { int ret; /* set up gpio */ pxa_gpio_mode(GPIO6_MMCCLK_MD);
static bool bln_enabled = false; /* bln available */ static bool bln_ongoing = false; /* notification currently active */ static int bln_led_state = 0; static int bln_blink_state = 0; static bool bln_suspended = false; /* is system suspended */ static uint32_t blink_count; static uint32_t blink_on_msec = 500; static uint32_t blink_off_msec = 500; static uint32_t max_blink_count = 300; static struct bln_implementation *bln_imp = NULL; static struct wake_lock bln_wake_lock; void bl_timer_callback(unsigned long data); static struct timer_list blink_timer = TIMER_INITIALIZER(bl_timer_callback, 0, 0); static void blink_callback(struct work_struct *blink_work); static DECLARE_WORK(blink_work, blink_callback); #define BACKLIGHTNOTIFICATION_VERSION 10 static void bln_led_on(void) { bln_imp->on(); bln_led_state = 1; } static void bln_led_off(void) { bln_imp->off(); bln_led_state = 0;
*/ #include <linux/spinlock.h> #include "sound_config.h" static volatile int opened, tmr_running; static volatile time_t tmr_offs, tmr_ctr; static volatile unsigned long ticks_offs; static volatile int curr_tempo, curr_timebase; static volatile unsigned long curr_ticks; static volatile unsigned long next_event_time; static unsigned long prev_event_time; static void poll_def_tmr(unsigned long dummy); static spinlock_t lock=SPIN_LOCK_UNLOCKED; static struct timer_list def_tmr = TIMER_INITIALIZER(poll_def_tmr, 0, 0); static unsigned long tmr2ticks(int tmr_value) { /* * Convert timer ticks to MIDI ticks */ unsigned long tmp; unsigned long scale; /* tmr_value (ticks per sec) * 1000000 (usecs per sec) / HZ (ticks per sec) -=> usecs */ tmp = tmr_value * (1000000 / HZ); scale = (60 * 1000000) / (curr_tempo * curr_timebase); /* usecs per MIDI tick */
}; static struct notifier_block mpoa_notifier = { mpoa_event_listener, NULL, 0 }; #ifdef CONFIG_PROC_FS extern int mpc_proc_init(void); extern void mpc_proc_clean(void); #endif struct mpoa_client *mpcs = NULL; /* FIXME */ static struct atm_mpoa_qos *qos_head = NULL; static struct timer_list mpc_timer = TIMER_INITIALIZER(NULL, 0, 0); static struct mpoa_client *find_mpc_by_itfnum(int itf) { struct mpoa_client *mpc; mpc = mpcs; /* our global linked list */ while (mpc != NULL) { if (mpc->dev_num == itf) return mpc; mpc = mpc->next; } return NULL; /* not found */ }
unsigned char old_mcr; /* storage of MCR reg while signal lost */ }; static DEFINE_SPINLOCK(idt77105_priv_lock); #define PRIV(dev) ((struct idt77105_priv *) dev->phy_data) #define PUT(val,reg) dev->ops->phy_put(dev,val,IDT77105_##reg) #define GET(reg) dev->ops->phy_get(dev,IDT77105_##reg) static void idt77105_stats_timer_func(unsigned long); static void idt77105_restart_timer_func(unsigned long); static struct timer_list stats_timer = TIMER_INITIALIZER(idt77105_stats_timer_func, 0, 0); static struct timer_list restart_timer = TIMER_INITIALIZER(idt77105_restart_timer_func, 0, 0); static int start_timer = 1; static struct idt77105_priv *idt77105_all = NULL; /* * Retrieve the value of one of the IDT77105's counters. * `counter' is one of the IDT77105_CTRSEL_* constants. */ static u16 get_counter(struct atm_dev *dev, int counter) { u16 val; /* write the counter bit into PHY register 6 */ PUT(counter, CTRSEL);
/* returns the TOD. see 4-38 Principles of Op of zSeries */ return get_clock(); # else return get_cycles(); # endif /* __s390__ */ } #endif /* HAVE_MONOTONIC */ /* Last time scheduled */ static unsigned long long hangcheck_tsc, hangcheck_tsc_margin; static void hangcheck_fire(unsigned long); static struct timer_list hangcheck_ticktock = TIMER_INITIALIZER(hangcheck_fire, 0, 0); static void hangcheck_fire(unsigned long data) { unsigned long long cur_tsc, tsc_diff; cur_tsc = monotonic_clock(); if (cur_tsc > hangcheck_tsc) tsc_diff = cur_tsc - hangcheck_tsc; else tsc_diff = (cur_tsc + (~0ULL - hangcheck_tsc)); /* or something */ if (tsc_diff > hangcheck_tsc_margin) { if (hangcheck_dump_tasks) {
select_amcb2_transmit_clock : select_redundant_clock : select_ref_frequency : All sysfs interfaces are integers in hex format, i.e echo 99 > refalign has the same effect as echo 0x99 > refalign. */ static unsigned int telclk_interrupt; static int int_events; /* Event that generate a interrupt */ static int got_event; /* if events processing have been done */ static void switchover_timeout(unsigned long data); static struct timer_list switchover_timer = TIMER_INITIALIZER(switchover_timeout , 0, 0); static unsigned long tlclk_timer_data; static struct tlclk_alarms *alarm_events; static DEFINE_SPINLOCK(event_lock); static int tlclk_major = TLCLK_MAJOR; static irqreturn_t tlclk_interrupt(int irq, void *dev_id); /* /\* static DECLARE_WAIT_QUEUE_HEAD(wq); *\/ */ /* /\* static unsigned long useflags; *\/ */ /* /\* static DEFINE_MUTEX(tlclk_mutex); *\/ */
#else #define DEBUG_PRINT(...) #endif #define SPRD_WATCHDOG_MINOR (WATCHDOG_MINOR - 1) #define WDT_FREQ 32000 /* 32KHz clock */ static int margin = 20; /* (secs) Default is 20 sec */ static int feed_period = 3; /* (secs) Default is 3 sec */ static unsigned long wdt_state; static unsigned long wdt_users; static int boot_status; static void watchdog_feeder(unsigned long); static struct timer_list feeder_timer = TIMER_INITIALIZER(watchdog_feeder, 0, 0); /* * This is a hw watchdog starts after init, and fed by a timer started * by the watchdog driver itself. It can also be fed from userland. * The watchdog will be stopped in system suspend, and restarted in * system resume. */ static void watchdog_feeder(unsigned long data) { DEBUG_PRINT(WDT "%s, margin=%d, feed_period=%d\n", __FUNCTION__, margin, feed_period); WDG_LOAD_TIMER_VALUE(margin * WDT_FREQ); mod_timer(&feeder_timer, jiffies + (feed_period * HZ)); }
* and non-BH context, so local BH disabling is needed. * 4) All operations modify state, so a spinlock is used. */ static struct dst_entry *dst_garbage_list; #if RT_CACHE_DEBUG >= 2 static atomic_t dst_total = ATOMIC_INIT(0); #endif static spinlock_t dst_lock = SPIN_LOCK_UNLOCKED; static unsigned long dst_gc_timer_expires; static unsigned long dst_gc_timer_inc = DST_GC_MAX; static void dst_run_gc(unsigned long); static void ___dst_free(struct dst_entry * dst); static struct timer_list dst_gc_timer = TIMER_INITIALIZER(dst_run_gc, DST_GC_MIN, 0); static void dst_run_gc(unsigned long dummy) { int delayed = 0; struct dst_entry * dst, **dstp; if (!spin_trylock(&dst_lock)) { mod_timer(&dst_gc_timer, jiffies + HZ/10); return; } del_timer(&dst_gc_timer); dstp = &dst_garbage_list; while ((dst = *dstp) != NULL) {
#include "gpio.h" #include "diag.h" #define getvar(str) (nvram_get(str)?:"") static inline int startswith (char *source, char *cmp) { return !strncmp(source,cmp,strlen(cmp)); } static int fill_event(struct event_t *); static unsigned int gpiomask = 0; module_param(gpiomask, int, 0644); extern char *nvram_get(char *str); static void led_flash(unsigned long dummy); static struct platform_t platform; static struct timer_list led_timer = TIMER_INITIALIZER(&led_flash, 0, 0); static struct proc_dir_entry *diag, *leds; #if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) static inline struct inode *file_inode(struct file *f) { return f->f_path.dentry->d_inode; } #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) static inline void *PDE_DATA(const struct inode *inode) { return PDE(inode)->data; }
static u32 prev_temp = 0xffffffff; /* i.e -1. */ static u32 test_mode; static int dram_temp_override; static unsigned long mr4_freq_threshold; static atomic_t mr4_temp_poll; static atomic_t mr4_freq_poll; static atomic_t mr4_force_poll; static void emc_mr4_poll(unsigned long nothing); static void emc_train(unsigned long nothing); /* The timers themselves. */ static struct timer_list emc_timer_mr4 = TIMER_DEFERRED_INITIALIZER(emc_mr4_poll, 0, 0); static struct timer_list emc_timer_training = TIMER_INITIALIZER(emc_train, 0, 0); static void emc_mr4_poll(unsigned long nothing) { int dram_temp; emc_timer_dbg(2, "Doing MR4 poll\n"); if (!test_mode) dram_temp = tegra_emc_get_dram_temperature(); else dram_temp = dram_temp_override; if (prev_temp == dram_temp) goto reset;
static int soft_noboot = 1; #else static int soft_noboot = 0; #endif /* ONLY_TESTING */ module_param(soft_noboot, int, 0); MODULE_PARM_DESC(soft_noboot, "Softdog action, set to 1 to ignore reboots, 0 to reboot (default depends on ONLY_TESTING)"); /* * Our timer */ static void watchdog_fire(unsigned long); static struct timer_list watchdog_ticktock = TIMER_INITIALIZER(watchdog_fire, 0, 0); static unsigned long driver_open, orphan_timer; static char expect_close; /* * If the timer expires.. */ static void watchdog_fire(unsigned long data) { if (test_and_clear_bit(0, &orphan_timer)) module_put(THIS_MODULE); if (soft_noboot) printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n");
static bool bBlink = true; static bool bBlinkTimer = false; static bool bIsOn = false; static int iCountsBlink = 0; static unsigned int iTimeBlink = 200; static unsigned int iTimesOn = 1; static unsigned int iTimesTotal = 10; static unsigned int iBlinkMilisecondsTimeout = 1500; static DECLARE_MUTEX(enable_sem); static DECLARE_MUTEX(i2c_sem); static uint32_t blink_count; static bool system_is_sleeping = false; static void blink_timer_callback(unsigned long data); static struct timer_list blink_timer = TIMER_INITIALIZER(blink_timer_callback, 0, 0); static void blink_callback(struct work_struct *blink_work); static DECLARE_WORK(blink_work, blink_callback); static struct wake_lock sBlinkWakeLock; static int led_gpios[] = { 2, 3, 6, 7 }; static void aries_touchkey_led_onoff(int onoff) { int i; for (i = 0; i < ARRAY_SIZE(led_gpios); i++) gpio_direction_output(S5PV210_GPJ3(led_gpios[i]), !!onoff); bIsOn = onoff;
#include <linux/proc_fs.h> #include <linux/timer.h> #define DELAY HZ void timer_fn(unsigned long); static int minor_start = 0; static int minor_cnt = 1; static dev_t dev; static struct cdev cdev; static struct class *class; static wait_queue_head_t wq_head; static char flag = 'n'; static struct semaphore read_mutex; static struct timer_list my_timer = TIMER_INITIALIZER(timer_fn, 0, 0); static char val; static ssize_t my_read(struct file *f, char __user *buf, size_t cnt, loff_t *off) { printk("In Read\n"); if (down_interruptible(&read_mutex)) { printk("Semaphore Failed\n"); return -1; } if (copy_to_user(buf, &val, 1)) { return -EINVAL; }
static int send_1_5 (int lun, unsigned char *command, int dma); static int get_status (void); static int calc_received (void *start_address); extern int pamsnet_probe(struct net_device *dev); static int pamsnet_open(struct net_device *dev); static int pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev); static void pamsnet_poll_rx(struct net_device *); static int pamsnet_close(struct net_device *dev); static struct net_device_stats *net_get_stats(struct net_device *dev); static void pamsnet_tick(unsigned long); static irqreturn_t pamsnet_intr(int irq, void *data, struct pt_regs *fp); static struct timer_list pamsnet_timer = TIMER_INITIALIZER(pamsnet_tick, 0, 0); #define STRAM_ADDR(a) (((a) & 0xff000000) == 0) typedef struct { unsigned char reserved1[0x38]; HADDR hwaddr; unsigned char reserved2[0x1c2]; } DMAHWADDR; /* * Definitions of commands understood by the PAMs DMA adaptor. * * In general the DMA adaptor uses LUN 0, 5, 6 and 7 on one ID changeable * by the PAM's Net software.
#include <linux/init.h> #include <asm/uaccess.h> #include <asm/io.h> static int mixcomwd_ioports[] = { 0x180, 0x280, 0x380, 0x000 }; #define MIXCOM_WATCHDOG_OFFSET 0xc10 #define MIXCOM_ID 0x11 #define FLASHCOM_WATCHDOG_OFFSET 0x4 #define FLASHCOM_ID 0x18 static long mixcomwd_opened; /* long req'd for setbit --RR */ static int watchdog_port; static int mixcomwd_timer_alive; static struct timer_list mixcomwd_timer = TIMER_INITIALIZER(NULL, 0, 0); static int expect_close = 0; #ifdef CONFIG_WATCHDOG_NOWAYOUT static int nowayout = 1; #else static int nowayout = 0; #endif module_param(nowayout, int, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); static void mixcomwd_ping(void) { outb_p(55,watchdog_port); return;
static void dump_cmd_complete_status(u_int int_ret_code); static void ps2esdi_get_device_cfg(void); static void ps2esdi_reset_timer(unsigned long unused); static u_int dma_arb_level; /* DMA arbitration level */ static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int); static int no_int_yet; static int ps2esdi_drives; static u_short io_base; static struct timer_list esdi_timer = TIMER_INITIALIZER(ps2esdi_reset_timer, 0, 0); static int reset_status; static int ps2esdi_slot = -1; static int tp720esdi = 0; /* Is it Integrated ESDI of ThinkPad-720? */ static int intg_esdi = 0; /* If integrated adapter */ struct ps2esdi_i_struct { unsigned int head, sect, cyl, wpcom, lzone, ctl; }; static spinlock_t ps2esdi_lock = SPIN_LOCK_UNLOCKED; static struct request_queue *ps2esdi_queue; static struct request *current_req; #if 0 #if 0 /* try both - I don't know which one is better... UB */ static struct ps2esdi_i_struct ps2esdi_info[MAX_HD] = {
// input_report_abs(ts->dev, ABS_X, ts->xp); // input_report_abs(ts->dev, ABS_Y, ts->yp); // input_report_abs(ts->dev, ABS_Z, 0); // input_report_key(ts->dev, BTN_TOUCH, 0); // input_sync(ts->dev); input_report_key(ts->dev, BTN_TOUCH, 0); input_report_abs(ts->dev, ABS_PRESSURE, 0); input_sync(ts->dev); writel(WAIT4INT(0), ts_base+S3C_ADCTSC); } } static struct timer_list touch_timer = TIMER_INITIALIZER(touch_timer_fire, 0, 0); static irqreturn_t stylus_updown(int irqno, void *param) { unsigned long data0; unsigned long data1; int updown; data0 = readl(ts_base + S3C_ADCDAT0); data1 = readl(ts_base + S3C_ADCDAT1); updown = (!(data0 & S3C_ADCDAT0_UPDOWN)) && (!(data1 & S3C_ADCDAT1_UPDOWN)); /* TODO we should never get an interrupt with updown set while * the timer is running, but maybe we ought to verify that the
unsigned short dirty_addr_buf[2]; const unsigned short normal_i2c[2]; }u_i2c_addr = {{0x00},}; static int reg_val; #define TP_MAX_X 2200 //2047// #define TP_MAX_Y 1600 //2047// #define DEVICE_NAME "Goodix-TS" //#define TIMER_READ_DATA #ifdef TIMER_READ_DATA static void touch_timer_handler (unsigned long irq); #define SAMPLE_PERIOD jiffies + HZ/10 static struct timer_list touch_timer = TIMER_INITIALIZER(touch_timer_handler, 1, 0); #endif static void ctp_clear_penirq(void); static int ctp_judge_int_occur(void); struct ts_data { u16 x1; u16 y1; u16 x2; u16 y2; }; struct inferpoint_ts_priv { struct ts_data data_to_xy; struct i2c_client *client;
{ module_put(THIS_MODULE); if (soft_noboot) { pr_crit("Triggered - Reboot ignored\n"); } else if (soft_panic) { pr_crit("Initiating panic\n"); panic("Software Watchdog Timer expired"); } else { pr_crit("Initiating system reboot\n"); emergency_restart(); pr_crit("Reboot didn't ?????\n"); } } static struct timer_list softdog_ticktock = TIMER_INITIALIZER(softdog_fire, 0, 0); static struct watchdog_device softdog_dev; static void softdog_pretimeout(unsigned long data) { watchdog_notify_pretimeout(&softdog_dev); } static struct timer_list softdog_preticktock = TIMER_INITIALIZER(softdog_pretimeout, 0, 0); static int softdog_ping(struct watchdog_device *w) { if (!mod_timer(&softdog_ticktock, jiffies + (w->timeout * HZ))) __module_get(THIS_MODULE);
#include <net/sock.h> #include <linux/timer.h> #include <linux/jiffies.h> #include <linux/hardirq.h> #include "vrr.h" #include "vrr_data.h" static void vrr_timer_tick(unsigned long arg); /* Defined in af_vrr.c */ extern const struct net_proto_family vrr_family_ops; extern struct proto vrr_proto; static struct timer_list vrr_timer = TIMER_INITIALIZER (vrr_timer_tick, 0, 0); static struct packet_type vrr_packet_type __read_mostly = { .type = cpu_to_be16(ETH_P_VRR), .func = vrr_rcv, }; static ssize_t id_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { u_int value = get_vrr_id(); return sprintf(buf, "%08x\n", value); } static ssize_t pset_show_real( struct kobject *kobj,