panel.c (66ce7d5c1e124b497f45aead50df1dc3c2873382) panel.c (718e05ed92ecac0d9d3954bcc8064527c3ce7565)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Front panel driver for Linux
4 * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
5 * Copyright (C) 2016-2017 Glider bvba
6 *
7 * This code drives an LCD module (/dev/lcd), and a keypad (/dev/keypad)
8 * connected to a parallel printer port.

--- 42 unchanged lines hidden (view full) ---

51#include <linux/ctype.h>
52#include <linux/parport.h>
53#include <linux/list.h>
54
55#include <linux/io.h>
56#include <linux/uaccess.h>
57
58#include "charlcd.h"
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Front panel driver for Linux
4 * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
5 * Copyright (C) 2016-2017 Glider bvba
6 *
7 * This code drives an LCD module (/dev/lcd), and a keypad (/dev/keypad)
8 * connected to a parallel printer port.

--- 42 unchanged lines hidden (view full) ---

51#include <linux/ctype.h>
52#include <linux/parport.h>
53#include <linux/list.h>
54
55#include <linux/io.h>
56#include <linux/uaccess.h>
57
58#include "charlcd.h"
59#include "hd44780_common.h"
59
60#define LCD_MAXBYTES 256 /* max burst write */
61
62#define KEYPAD_BUFFER 64
63
64/* poll the keyboard this every second */
65#define INPUT_POLL_TIME (HZ / 50)
66/* a key starts to repeat after this times INPUT_POLL_TIME */

--- 823 unchanged lines hidden (view full) ---

890 .clear_fast = lcd_clear_fast_tilcd,
891 .backlight = lcd_backlight,
892};
893
894/* initialize the LCD driver */
895static void lcd_init(void)
896{
897 struct charlcd *charlcd;
60
61#define LCD_MAXBYTES 256 /* max burst write */
62
63#define KEYPAD_BUFFER 64
64
65/* poll the keyboard this every second */
66#define INPUT_POLL_TIME (HZ / 50)
67/* a key starts to repeat after this times INPUT_POLL_TIME */

--- 823 unchanged lines hidden (view full) ---

891 .clear_fast = lcd_clear_fast_tilcd,
892 .backlight = lcd_backlight,
893};
894
895/* initialize the LCD driver */
896static void lcd_init(void)
897{
898 struct charlcd *charlcd;
899 struct hd44780_common *hdc;
898
900
901 hdc = hd44780_common_alloc();
902 if (!hdc)
903 return;
904
899 charlcd = charlcd_alloc(0);
905 charlcd = charlcd_alloc(0);
900 if (!charlcd)
906 if (!charlcd) {
907 kfree(hdc);
901 return;
908 return;
909 }
902
910
911 hdc->hd44780 = &lcd;
912 charlcd->drvdata = hdc;
913
903 /*
904 * Init lcd struct with load-time values to preserve exact
905 * current functionality (at least for now).
906 */
907 charlcd->height = lcd_height;
908 charlcd->width = lcd_width;
909 charlcd->bwidth = lcd_bwidth;
910 charlcd->hwidth = lcd_hwidth;

--- 704 unchanged lines hidden (view full) ---

1615 return;
1616
1617err_lcd_unreg:
1618 if (scan_timer.function)
1619 del_timer_sync(&scan_timer);
1620 if (lcd.enabled)
1621 charlcd_unregister(lcd.charlcd);
1622err_unreg_device:
914 /*
915 * Init lcd struct with load-time values to preserve exact
916 * current functionality (at least for now).
917 */
918 charlcd->height = lcd_height;
919 charlcd->width = lcd_width;
920 charlcd->bwidth = lcd_bwidth;
921 charlcd->hwidth = lcd_hwidth;

--- 704 unchanged lines hidden (view full) ---

1626 return;
1627
1628err_lcd_unreg:
1629 if (scan_timer.function)
1630 del_timer_sync(&scan_timer);
1631 if (lcd.enabled)
1632 charlcd_unregister(lcd.charlcd);
1633err_unreg_device:
1623 charlcd_free(lcd.charlcd);
1634 kfree(lcd.charlcd);
1624 lcd.charlcd = NULL;
1625 parport_unregister_device(pprt);
1626 pprt = NULL;
1627}
1628
1629static void panel_detach(struct parport *port)
1630{
1631 if (port->number != parport)

--- 10 unchanged lines hidden (view full) ---

1642 if (keypad.enabled) {
1643 misc_deregister(&keypad_dev);
1644 keypad_initialized = 0;
1645 }
1646
1647 if (lcd.enabled) {
1648 charlcd_unregister(lcd.charlcd);
1649 lcd.initialized = false;
1635 lcd.charlcd = NULL;
1636 parport_unregister_device(pprt);
1637 pprt = NULL;
1638}
1639
1640static void panel_detach(struct parport *port)
1641{
1642 if (port->number != parport)

--- 10 unchanged lines hidden (view full) ---

1653 if (keypad.enabled) {
1654 misc_deregister(&keypad_dev);
1655 keypad_initialized = 0;
1656 }
1657
1658 if (lcd.enabled) {
1659 charlcd_unregister(lcd.charlcd);
1660 lcd.initialized = false;
1650 charlcd_free(lcd.charlcd);
1661 kfree(lcd.charlcd->drvdata);
1662 kfree(lcd.charlcd);
1651 lcd.charlcd = NULL;
1652 }
1653
1654 /* TODO: free all input signals */
1655 parport_release(pprt);
1656 parport_unregister_device(pprt);
1657 pprt = NULL;
1658}

--- 137 unchanged lines hidden ---
1663 lcd.charlcd = NULL;
1664 }
1665
1666 /* TODO: free all input signals */
1667 parport_release(pprt);
1668 parport_unregister_device(pprt);
1669 pprt = NULL;
1670}

--- 137 unchanged lines hidden ---