Lines Matching +full:led +full:- +full:cur
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Chassis LCD/LED driver for HP-PARISC workstations
7 * (c) Copyright 2001-2009 Helge Deller <deller@gmx.de>
11 * - speed-up calculations with inlined assembler
12 * - interface to write to second row of LCD from /proc (if technically possible)
15 * - Audit copy_from_user in led_proc_write.
17 * - Switch from using a tasklet to a work queue, so the led_LCD_driver
46 #include <asm/led.h>
50 /* The control of the LEDs and LCDs on PARISC-machines have to be done
56 static int led_type __read_mostly = -1;
57 static unsigned char lastleds; /* LED state from most recent update */
63 static int lcd_no_led_support __read_mostly = 0; /* KittyHawk doesn't support LED on its LCD */
78 unsigned char on; /* value for turning LED on */
79 unsigned char off; /* value for turning LED off */
84 lcd_cmd_reg_addr needs to be 64bit aligned on 64bit PA2.0-machines */
88 unsigned long lcd_cmd_reg_addr; /* ptr to LCD cmd-register & data ptr for LED */
89 unsigned long lcd_data_reg_addr; /* ptr to LCD data-register (LCD only) */
90 unsigned int min_cmd_delay; /* delay in uS after cmd-write (LCD only) */
103 #define KITTYHAWK_LCD_CMD F_EXTEND(0xf0190000UL) /* 64bit-ready */
106 /* lcd_info is pre-initialized to the values needed to program KittyHawk LCD's
129 /* The workqueue must be created at init-time */
135 /* KittyHawk has no LED support on its LCD */ in start_task()
138 /* Create the work queue and queue the LED task */ in start_task()
147 /* ptr to LCD/LED-specific function */
153 switch ((long)m->private) in led_proc_show()
179 char *cur, lbuf[32]; in led_proc_write() local
183 return -EACCES; in led_proc_write()
186 count = sizeof(lbuf)-1; in led_proc_write()
189 return -EFAULT; in led_proc_write()
192 cur = lbuf; in led_proc_write()
197 d = *cur++ - '0'; in led_proc_write()
201 if (*cur++ != ' ') goto parse_error; in led_proc_write()
203 d = *cur++ - '0'; in led_proc_write()
207 if (*cur++ != ' ') goto parse_error; in led_proc_write()
209 d = *cur++ - '0'; in led_proc_write()
215 if (*cur && cur[strlen(cur)-1] == '\n') in led_proc_write()
216 cur[strlen(cur)-1] = 0; in led_proc_write()
217 if (*cur == 0) in led_proc_write()
218 cur = lcd_text_default; in led_proc_write()
219 lcd_print(cur); in led_proc_write()
230 return -EINVAL; in led_proc_write()
246 if (led_type == -1) return -1; in led_create_procfs()
249 if (!proc_pdc_root) return -1; in led_create_procfs()
253 ent = proc_create_data("led", 0644, proc_pdc_root, in led_create_procfs()
254 &led_proc_ops, (void *)LED_NOLCD); /* LED */ in led_create_procfs()
255 if (!ent) return -1; in led_create_procfs()
262 if (!ent) return -1; in led_create_procfs()
328 gsc_writeb( blockp[i]->command, LCD_CMD_REG ); in led_LCD_driver()
331 gsc_writeb( leds & mask[i] ? blockp[i]->on : in led_LCD_driver()
332 blockp[i]->off, LCD_DATA_REG ); in led_LCD_driver()
343 ** calculate if there was TX- or RX-throughput on the network interfaces
365 if (!in_dev || !in_dev->ifa_list) in led_get_net_activity()
367 if (ipv4_is_loopback(in_dev->ifa_list->ifa_local)) in led_get_net_activity()
370 rx_total += stats->rx_packets; in led_get_net_activity()
371 tx_total += stats->tx_packets; in led_get_net_activity()
396 ** calculate if there was disk-io in the system
422 ** manages when and which chassis LCD/LED gets updated
425 - display load average (older machines like 715/64 have 4 "free" LED's for that)
426 - optimizations
446 count_HZ += jiffies - last_jiffies; in led_work_func()
453 /* flash heartbeat-LED like a real heart in led_work_func()
493 ** LED/LCD activities.
541 ** registers an external LED or LCD for usage by this driver.
542 ** currently only LCD-, LASI- and ASP-style LCD/LED's are supported.
566 /* Skip to register LED in QEMU */ in register_led_driver()
571 printk(KERN_INFO "LED display at %lx registered\n", LED_DATA_REG); in register_led_driver()
578 printk(KERN_INFO "LED (ASP-style) display at %lx registered\n", in register_led_driver()
584 printk(KERN_ERR "%s: Wrong LCD/LED model %d !\n", in register_led_driver()
589 /* mark the LCD/LED driver now as initialized and in register_led_driver()
605 ** register_led_regions() registers the LCD/LED regions for /procfs.
606 ** At bootup - where the initialisation of the LCD/LED normally happens -
608 ** so that we delay the led-registration until after busdevices_init()
632 ** Displays the given string on the LCD-Display of newer machines.
633 ** lcd_print() disables/enables the timer-based led work queue to
644 /* temporarily disable the led work task */ in lcd_print()
664 /* re-queue the work */ in lcd_print()
675 ** led_init() is called very early in the bootup-process from setup.c
676 ** and asks the PDC for an usable chassis LCD or LED.
677 ** If the PDC doesn't return any info, then the LED
690 "Linux %s", init_utsname()->release); in led_init()
692 /* Work around the buggy PDC of KittyHawk-machines */ in led_init()
694 case 0x580: /* KittyHawk DC2-100 (K100) */ in led_init()
695 case 0x581: /* KittyHawk DC3-120 (K210) */ in led_init()
699 printk(KERN_INFO "%s: KittyHawk-Machine (hversion 0x%x) found, " in led_init()
700 "LED detection skipped.\n", __FILE__, CPU_HVERSION); in led_init()
716 (lcd_info.model==DISPLAY_MODEL_LASI) ? "LED" : "unknown", in led_init()
732 offsetof(struct pdc_chassis_lcd_info_ret_block, _pad)-1) in led_init()
740 case DISPLAY_MODEL_NONE: /* no LED or LCD available */ in led_init()
741 printk(KERN_INFO "PDC reported no LCD or LED.\n"); in led_init()
744 case DISPLAY_MODEL_LASI: /* Lasi style 8 bit LED display */ in led_init()
750 printk(KERN_WARNING "PDC reported unknown LCD/LED model %d\n", in led_init()
756 /* register the LCD/LED driver */ in led_init()