static ssize_t leds_store(struct sys_device *dev, struct sysdev_attribute *attr, const char *buf, size_t size) { int ret = -EINVAL, len = strcspn(buf, " "); if (len > 0 && buf[len] == '\0') len--; if (strncmp(buf, "claim", len) == 0) { leds_event(led_claim); ret = size; } else if (strncmp(buf, "release", len) == 0) { leds_event(led_release); ret = size; } else { int i; for (i = 0; i < ARRAY_SIZE(evt_names); i++) { if (strlen(evt_names[i].name) != len || strncmp(buf, evt_names[i].name, len) != 0) continue; if (strncmp(buf+len, " on", 3) == 0) { leds_event(evt_names[i].on); ret = size; } else if (strncmp(buf+len, " off", 4) == 0) { leds_event(evt_names[i].off); ret = size; } break; } } return ret; }
static int leds_idle_notifier(struct notifier_block *nb, unsigned long val, void *data) { switch (val) { case IDLE_START: leds_event(led_idle_start); break; case IDLE_END: leds_event(led_idle_end); break; } return 0; }
static int __init uC53281_platform_add_led_devs(void) { extern void (*leds_event) (led_event_t); leds_event = uC53281_leds_event; leds_event(led_led2_exit); leds_event(led_led3_exit); leds_event(led_led4_exit); leds_event(led_led5_init); leds_event(led_led5_on); return platform_add_devices(uC53281_led_devices, ARRAY_SIZE(uC53281_led_devices)); }
static int __init sa1100_leds_init(void) { if (machine_is_assabet()) leds_event = assabet_leds_event; if (machine_is_consus()) leds_event = consus_leds_event; if (machine_is_badge4()) leds_event = badge4_leds_event; if (machine_is_brutus()) leds_event = brutus_leds_event; if (machine_is_cerf()) leds_event = cerf_leds_event; if (machine_is_flexanet()) leds_event = flexanet_leds_event; if (machine_is_graphicsclient()) leds_event = graphicsclient_leds_event; if (machine_is_hackkit()) leds_event = hackkit_leds_event; if (machine_is_lart()) leds_event = lart_leds_event; if (machine_is_pfs168()) leds_event = pfs168_leds_event; if (machine_is_graphicsmaster()) leds_event = graphicsmaster_leds_event; if (machine_is_adsbitsy()) leds_event = adsbitsy_leds_event; if (machine_is_pt_system3()) leds_event = system3_leds_event; leds_event(led_start); return 0; }
static int __init wmt_leds_init(void) { leds_event = wmt_leds_event; leds_event(led_start); return 0; }
static int __init sa1100_leds_init(void) { if (machine_is_assabet()) leds_event = assabet_leds_event; if (machine_is_consus()) leds_event = consus_leds_event; if (machine_is_badge4()) leds_event = badge4_leds_event; if (machine_is_brutus()) leds_event = brutus_leds_event; if (machine_is_cerf()) leds_event = cerf_leds_event; if (machine_is_flexanet()) leds_event = flexanet_leds_event; if (machine_is_graphicsclient()) leds_event = graphicsclient_leds_event; if (machine_is_hackkit()) leds_event = hackkit_leds_event; if (machine_is_lart()) leds_event = lart_leds_event; if (machine_is_pfs168()) leds_event = pfs168_leds_event; if (machine_is_graphicsmaster()) leds_event = graphicsmaster_leds_event; if (machine_is_adsbitsy()) leds_event = adsbitsy_leds_event; if (machine_is_pt_system3()) leds_event = system3_leds_event; if (machine_is_simpad()) leds_event = simpad_leds_event; /* what about machine registry? including led, apm... -zecke */ leds_event(led_start); return 0; }
static inline void do_leds(void) { static unsigned int count = HZ/2; if (--count == 0) { count = HZ/2; leds_event(led_timer); } }
static int __init leds_init(void) { if (machine_is_ebsa285() || machine_is_co285()) leds_event = ebsa285_leds_event; leds_event(led_start); return 0; }
static int __init leds_init(void) { if (machine_is_netwinder()) leds_event = netwinder_leds_event; leds_event(led_start); return 0; }
void cpu_idle(void) { local_fiq_enable(); /* endless idle loop with no priority at all */ while (1) { int idle = pm_idle; if (!idle) idle = default_idle; preempt_disable(); leds_event(led_idle_start); while (!need_resched()) idle(); leds_event(led_idle_end); preempt_enable(); schedule(); } }
static int __init evm_leds_init(void) { if (!machine_is_davinci_evm()) return 0; leds_event = evm_leds_event; leds_event(led_start); return 0; }
static int __init leds_init(void) { if (!at91_leds_timer || !at91_leds_cpu) return -ENODEV; leds_event = at91_leds_event; leds_event(led_start); return 0; }
static int __init leds_init(void) { if ((ks8695_leds_timer == -1) || (ks8695_leds_cpu == -1)) return -ENODEV; leds_event = ks8695_leds_event; leds_event(led_start); return 0; }
static int __init omap_leds_init(void) { if (machine_is_omap_innovator()) leds_event = innovator_leds_event; else if (machine_is_omap_h2() || machine_is_omap_perseus2()) { leds_event = h2p2_dbg_leds_event; } leds_event(led_start); return 0; }
static int __init pxa_leds_init(void) { if (machine_is_lubbock()) leds_event = lubbock_leds_event; if (machine_is_mainstone()) leds_event = mainstone_leds_event; if (machine_is_pxa_idp()) leds_event = idp_leds_event; leds_event(led_start); return 0; }
static int __init omap_leds_init(void) { if (!cpu_class_is_omap1()) return -ENODEV; if (machine_is_omap_innovator()) leds_event = innovator_leds_event; else if (machine_is_omap_h2() || machine_is_omap_h3() || machine_is_omap_perseus2()) leds_event = h2p2_dbg_leds_event; else if (machine_is_omap_osk()) leds_event = osk_leds_event; else return -1; if (machine_is_omap_h2() || machine_is_omap_h3() #ifdef CONFIG_OMAP_OSK_MISTRAL || machine_is_omap_osk() #endif ) { /* LED1/LED2 pins can be used as GPIO (as done here), or by * the LPG (works even in deep sleep!), to drive a bicolor * LED on the H2 sample board, and another on the H2/P2 * "surfer" expansion board. * * The same pins drive a LED on the OSK Mistral board, but * that's a different kind of LED (just one color at a time). */ omap_cfg_reg(P18_1610_GPIO3); if (gpio_request(3, "LED red") == 0) gpio_direction_output(3, 1); else printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); omap_cfg_reg(MPUIO4); if (gpio_request(OMAP_MPUIO(4), "LED green") == 0) gpio_direction_output(OMAP_MPUIO(4), 1); else printk(KERN_WARNING "LED: can't get MPUIO4/green?\n"); } leds_event(led_start); return 0; }
static int __init leds_init(void) { if (!at91_leds_timer || !at91_leds_cpu) return -ENODEV; /* Enable PIO to access the LEDs */ at91_set_gpio_output(at91_leds_timer, 1); at91_set_gpio_output(at91_leds_cpu, 1); leds_event = at91_leds_event; leds_event(led_start); return 0; }
static int __init s3c6410_leds_init(void) { if (machine_is_smdk6410()) leds_event = smdk6410_leds_event; else return -1; if (machine_is_smdk6410()) { /*GPN12~15 used for LED*/ /*Set GPN12~15 to output mode */ gpio_direction_output(S3C_GPN12); if(gpio_get_pin(S3C_GPN12) == 0) { printk(KERN_WARNING "LED: can't set GPN12 output mode\n"); } gpio_direction_output(S3C_GPN13); if(gpio_get_pin(S3C_GPN13) == 0) { printk(KERN_WARNING "LED: can't set GPN13 output mode\n"); } gpio_direction_output(S3C_GPN14); if(gpio_get_pin(S3C_GPN14) == 0) { printk(KERN_WARNING "LED: can't set GPN14 output mode\n"); } gpio_direction_output(S3C_GPN15); if(gpio_get_pin(S3C_GPN15) == 0) { printk(KERN_WARNING "LED: can't set GPN15 output mode\n"); } } /* Get irqs */ set_irq_type(IRQ_EINT9, IRQT_FALLING); gpio_pullup(S3C_GPN9, 0x0); if (request_irq(IRQ_EINT9, eint9_switch, SA_TRIGGER_FALLING, "EINT9", NULL)) { printk(KERN_ERR "leds.c: Could not allocate EINT9 !\n"); return -EIO; } leds_event(led_start); return 0; }
static int __init s5pc100_leds_init(void) { if (machine_is_smdkc100()) leds_event = s5pc100_leds_event; else return -1; if (machine_is_smdkc100()) { gpio_request(S5PC1XX_GPH1(4), "GPH1"); gpio_direction_output(S5PC1XX_GPH1(4), 1); if(gpio_get_value(S5PC1XX_GPH1(4)) == 0) { printk(KERN_WARNING "LED: can't set GPH1(4) to output mode\n"); } gpio_request(S5PC1XX_GPH1(5), "GPH1"); gpio_direction_output(S5PC1XX_GPH1(5), 1); if(gpio_get_value(S5PC1XX_GPH1(5)) == 0) { printk(KERN_WARNING "LED: can't set GPH1(5) to output mode\n"); } gpio_request(S5PC1XX_GPH1(6), "GPH1"); gpio_direction_output(S5PC1XX_GPH1(6), 1); if(gpio_get_value(S5PC1XX_GPH1(6)) == 0) { printk(KERN_WARNING "LED: can't set GPH1(6) to output mode\n"); } gpio_request(S5PC1XX_GPH1(7), "GPH1"); gpio_direction_output(S5PC1XX_GPH1(7), 1); if(gpio_get_value(S5PC1XX_GPH1(7)) == 0) { printk(KERN_WARNING "LED: can't set GPH1(7) to output mode\n"); } } /* Get irqs */ set_irq_type(IRQ_EINT11, IRQ_TYPE_EDGE_FALLING); s3c_gpio_setpull(S5PC1XX_GPH1(3), S3C_GPIO_PULL_NONE); if (request_irq(IRQ_EINT11, eint11_switch, IRQF_DISABLED, "EINT11", NULL)) { return -EIO; } leds_event(led_start); return 0; }
static int __init leds_init(void) { extern void (*leds_event)(led_event_t); short temp; leds_event = sequoia_leds_event; /* Make LEDs independent of power-state */ request_region(0x24,4,"sequoia"); temp = sequoia_read(0x09); temp |= 1<<10; sequoia_write(temp,0x09); leds_event(led_start); return 0; }
static int leds_shutdown(struct sys_device *dev) { leds_event(led_halted); return 0; }
static int leds_resume(struct sys_device *dev) { leds_event(led_start); return 0; }
static int leds_suspend(struct sys_device *dev, pm_message_t state) { leds_event(led_stop); return 0; }
int pm_do_suspend(void) { unsigned long sleep_save[SLEEP_SAVE_SIZE]; cli(); leds_event(led_stop); /* preserve current time */ RCNR = xtime.tv_sec; /* save vital registers */ SAVE(OSCR); SAVE(OSMR0); SAVE(OSMR1); SAVE(OSMR2); SAVE(OSMR3); SAVE(OIER); SAVE(GPDR); SAVE(GRER); SAVE(GFER); SAVE(GAFR); SAVE(PPDR); SAVE(PPSR); SAVE(PPAR); SAVE(PSDR); SAVE(Ser1SDCR0); SAVE(ICMR); /* ... maybe a global variable initialized by arch code to set this? */ GRER = PWER; GFER = 0; GEDR = GEDR; /* Clear previous reset status */ RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR; /* set resume return address */ PSPR = virt_to_phys(sa1100_cpu_resume); /* go zzz */ sa1100_cpu_suspend(); /* ensure not to come back here if it wasn't intended */ PSPR = 0; #ifdef DEBUG printk(KERN_DEBUG "*** made it back from resume\n"); #endif /* restore registers */ RESTORE(GPDR); RESTORE(GRER); RESTORE(GFER); RESTORE(GAFR); /* clear any edge detect bit */ GEDR = GEDR; RESTORE(PPDR); RESTORE(PPSR); RESTORE(PPAR); RESTORE(PSDR); RESTORE(Ser1SDCR0); PSSR = PSSR_PH; RESTORE(OSMR0); RESTORE(OSMR1); RESTORE(OSMR2); RESTORE(OSMR3); RESTORE(OSCR); RESTORE(OIER); ICLR = 0; ICCR = 1; RESTORE(ICMR); /* restore current time */ xtime.tv_sec = RCNR; leds_event(led_start); sti(); /* * Restore the CPU frequency settings. */ #ifdef CONFIG_CPU_FREQ cpufreq_restore(); #endif return 0; }