#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/miscdevice.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
#include <linux/parport.h>
#include <linux/list.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include "charlcd.h"
#include "hd44780_common.h"
#define LCD_MAXBYTES …
#define KEYPAD_BUFFER …
#define INPUT_POLL_TIME …
#define KEYPAD_REP_START …
#define KEYPAD_REP_DELAY …
#define PNL_PINPUT(a) …
#define PNL_PBUSY …
#define PNL_PACK …
#define PNL_POUTPA …
#define PNL_PSELECD …
#define PNL_PERRORP …
#define PNL_PBIDIR …
#define PNL_PINTEN …
#define PNL_PSELECP …
#define PNL_PINITP …
#define PNL_PAUTOLF …
#define PNL_PSTROBE …
#define PNL_PD0 …
#define PNL_PD1 …
#define PNL_PD2 …
#define PNL_PD3 …
#define PNL_PD4 …
#define PNL_PD5 …
#define PNL_PD6 …
#define PNL_PD7 …
#define PIN_NONE …
#define PIN_STROBE …
#define PIN_D0 …
#define PIN_D1 …
#define PIN_D2 …
#define PIN_D3 …
#define PIN_D4 …
#define PIN_D5 …
#define PIN_D6 …
#define PIN_D7 …
#define PIN_AUTOLF …
#define PIN_INITP …
#define PIN_SELECP …
#define PIN_NOT_SET …
#define NOT_SET …
#define r_ctr(x) …
#define r_dtr(x) …
#define r_str(x) …
#define w_ctr(x, y) …
#define w_dtr(x, y) …
static __u8 scan_mask_o;
static __u8 scan_mask_i;
enum input_type { … };
enum input_state { … };
struct logical_input { … };
static LIST_HEAD(logical_inputs);
static __u64 phys_read;
static __u64 phys_read_prev;
static __u64 phys_curr;
static __u64 phys_prev;
static char inputs_stable;
static struct { … } keypad;
static char keypad_buffer[KEYPAD_BUFFER];
static int keypad_buflen;
static int keypad_start;
static char keypressed;
static wait_queue_head_t keypad_read_wait;
static struct { … } lcd;
static int selected_lcd_type = …;
#define BIT_CLR …
#define BIT_SET …
#define BIT_MSK …
#define BIT_STATES …
#define LCD_BIT_E …
#define LCD_BIT_RS …
#define LCD_BIT_RW …
#define LCD_BIT_BL …
#define LCD_BIT_CL …
#define LCD_BIT_DA …
#define LCD_BITS …
#define LCD_PORT_C …
#define LCD_PORT_D …
#define LCD_PORTS …
static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
#define LCD_PROTO_PARALLEL …
#define LCD_PROTO_SERIAL …
#define LCD_PROTO_TI_DA8XX_LCD …
#define LCD_CHARSET_NORMAL …
#define LCD_CHARSET_KS0074 …
#define LCD_TYPE_NONE …
#define LCD_TYPE_CUSTOM …
#define LCD_TYPE_OLD …
#define LCD_TYPE_KS0074 …
#define LCD_TYPE_HANTRONIX …
#define LCD_TYPE_NEXCOM …
#define KEYPAD_TYPE_NONE …
#define KEYPAD_TYPE_OLD …
#define KEYPAD_TYPE_NEW …
#define KEYPAD_TYPE_NEXCOM …
#define PANEL_PROFILE_CUSTOM …
#define PANEL_PROFILE_OLD …
#define PANEL_PROFILE_NEW …
#define PANEL_PROFILE_HANTRONIX …
#define PANEL_PROFILE_NEXCOM …
#define PANEL_PROFILE_LARGE …
#define DEFAULT_PARPORT …
#define DEFAULT_PROFILE …
#define DEFAULT_KEYPAD_TYPE …
#define DEFAULT_LCD_TYPE …
#define DEFAULT_LCD_HEIGHT …
#define DEFAULT_LCD_WIDTH …
#define DEFAULT_LCD_CHARSET …
#define DEFAULT_LCD_PROTO …
#define DEFAULT_LCD_PIN_E …
#define DEFAULT_LCD_PIN_RS …
#define DEFAULT_LCD_PIN_RW …
#define DEFAULT_LCD_PIN_SCL …
#define DEFAULT_LCD_PIN_SDA …
#define DEFAULT_LCD_PIN_BL …
#ifdef CONFIG_PANEL_PARPORT
#undef DEFAULT_PARPORT
#define DEFAULT_PARPORT …
#endif
#ifdef CONFIG_PANEL_PROFILE
#undef DEFAULT_PROFILE
#define DEFAULT_PROFILE …
#endif
#if DEFAULT_PROFILE == 0
#ifdef CONFIG_PANEL_KEYPAD
#undef DEFAULT_KEYPAD_TYPE
#define DEFAULT_KEYPAD_TYPE …
#endif
#ifdef CONFIG_PANEL_LCD
#undef DEFAULT_LCD_TYPE
#define DEFAULT_LCD_TYPE …
#endif
#ifdef CONFIG_PANEL_LCD_HEIGHT
#undef DEFAULT_LCD_HEIGHT
#define DEFAULT_LCD_HEIGHT …
#endif
#ifdef CONFIG_PANEL_LCD_WIDTH
#undef DEFAULT_LCD_WIDTH
#define DEFAULT_LCD_WIDTH …
#endif
#ifdef CONFIG_PANEL_LCD_BWIDTH
#undef DEFAULT_LCD_BWIDTH
#define DEFAULT_LCD_BWIDTH …
#endif
#ifdef CONFIG_PANEL_LCD_HWIDTH
#undef DEFAULT_LCD_HWIDTH
#define DEFAULT_LCD_HWIDTH …
#endif
#ifdef CONFIG_PANEL_LCD_CHARSET
#undef DEFAULT_LCD_CHARSET
#define DEFAULT_LCD_CHARSET …
#endif
#ifdef CONFIG_PANEL_LCD_PROTO
#undef DEFAULT_LCD_PROTO
#define DEFAULT_LCD_PROTO …
#endif
#ifdef CONFIG_PANEL_LCD_PIN_E
#undef DEFAULT_LCD_PIN_E
#define DEFAULT_LCD_PIN_E …
#endif
#ifdef CONFIG_PANEL_LCD_PIN_RS
#undef DEFAULT_LCD_PIN_RS
#define DEFAULT_LCD_PIN_RS …
#endif
#ifdef CONFIG_PANEL_LCD_PIN_RW
#undef DEFAULT_LCD_PIN_RW
#define DEFAULT_LCD_PIN_RW …
#endif
#ifdef CONFIG_PANEL_LCD_PIN_SCL
#undef DEFAULT_LCD_PIN_SCL
#define DEFAULT_LCD_PIN_SCL …
#endif
#ifdef CONFIG_PANEL_LCD_PIN_SDA
#undef DEFAULT_LCD_PIN_SDA
#define DEFAULT_LCD_PIN_SDA …
#endif
#ifdef CONFIG_PANEL_LCD_PIN_BL
#undef DEFAULT_LCD_PIN_BL
#define DEFAULT_LCD_PIN_BL …
#endif
#endif
static atomic_t keypad_available = …;
static struct pardevice *pprt;
static int keypad_initialized;
static DEFINE_SPINLOCK(pprt_lock);
static struct timer_list scan_timer;
MODULE_DESCRIPTION(…) …;
static int parport = …;
module_param(parport, int, 0000);
MODULE_PARM_DESC(…) …;
static int profile = …;
module_param(profile, int, 0000);
MODULE_PARM_DESC(…) …;
static int keypad_type = …;
module_param(keypad_type, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_type = …;
module_param(lcd_type, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_height = …;
module_param(lcd_height, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_width = …;
module_param(lcd_width, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_bwidth = …;
module_param(lcd_bwidth, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_hwidth = …;
module_param(lcd_hwidth, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_charset = …;
module_param(lcd_charset, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_proto = …;
module_param(lcd_proto, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_e_pin = …;
module_param(lcd_e_pin, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_rs_pin = …;
module_param(lcd_rs_pin, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_rw_pin = …;
module_param(lcd_rw_pin, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_cl_pin = …;
module_param(lcd_cl_pin, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_da_pin = …;
module_param(lcd_da_pin, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_bl_pin = …;
module_param(lcd_bl_pin, int, 0000);
MODULE_PARM_DESC(…) …;
static int lcd_enabled = …;
module_param(lcd_enabled, int, 0000);
MODULE_PARM_DESC(…) …;
static int keypad_enabled = …;
module_param(keypad_enabled, int, 0000);
MODULE_PARM_DESC(…) …;
static const unsigned char lcd_char_conv_ks0074[256] = …;
static const char old_keypad_profile[][4][9] = …;
static const char new_keypad_profile[][4][9] = …;
static const char nexcom_keypad_profile[][4][9] = …;
static const char (*keypad_profile)[4][9] = …;
static DECLARE_BITMAP(bits, LCD_BITS);
static void lcd_get_bits(unsigned int port, int *val)
{ … }
static int set_data_bits(void)
{ … }
static int set_ctrl_bits(void)
{ … }
static void panel_set_bits(void)
{ … }
static void pin_to_bits(int pin, unsigned char *d_val, unsigned char *c_val)
{ … }
static void lcd_send_serial(int byte)
{ … }
static void lcd_backlight(struct charlcd *charlcd, enum charlcd_onoff on)
{ … }
static void lcd_write_cmd_s(struct hd44780_common *hdc, int cmd)
{ … }
static void lcd_write_data_s(struct hd44780_common *hdc, int data)
{ … }
static void lcd_write_cmd_p8(struct hd44780_common *hdc, int cmd)
{ … }
static void lcd_write_data_p8(struct hd44780_common *hdc, int data)
{ … }
static void lcd_write_cmd_tilcd(struct hd44780_common *hdc, int cmd)
{ … }
static void lcd_write_data_tilcd(struct hd44780_common *hdc, int data)
{ … }
static const struct charlcd_ops charlcd_ops = …;
static void lcd_init(void)
{ … }
static ssize_t keypad_read(struct file *file,
char __user *buf, size_t count, loff_t *ppos)
{ … }
static int keypad_open(struct inode *inode, struct file *file)
{ … }
static int keypad_release(struct inode *inode, struct file *file)
{ … }
static const struct file_operations keypad_fops = …;
static struct miscdevice keypad_dev = …;
static void keypad_send_key(const char *string, int max_len)
{ … }
static void phys_scan_contacts(void)
{ … }
static inline int input_state_high(struct logical_input *input)
{ … }
static inline void input_state_falling(struct logical_input *input)
{ … }
static void panel_process_inputs(void)
{ … }
static void panel_scan_timer(struct timer_list *unused)
{ … }
static void init_scan_timer(void)
{ … }
static u8 input_name2mask(const char *name, __u64 *mask, __u64 *value,
u8 *imask, u8 *omask)
{ … }
static struct logical_input *panel_bind_key(const char *name, const char *press,
const char *repeat,
const char *release)
{ … }
#if 0
static struct logical_input *panel_bind_callback(char *name,
void (*press_fct)(int),
int press_data,
void (*release_fct)(int),
int release_data)
{
struct logical_input *callback;
callback = kmalloc(sizeof(*callback), GFP_KERNEL);
if (!callback)
return NULL;
memset(callback, 0, sizeof(struct logical_input));
if (!input_name2mask(name, &callback->mask, &callback->value,
&scan_mask_i, &scan_mask_o))
return NULL;
callback->type = INPUT_TYPE_STD;
callback->state = INPUT_ST_LOW;
callback->rise_time = 1;
callback->fall_time = 1;
callback->u.std.press_fct = press_fct;
callback->u.std.press_data = press_data;
callback->u.std.release_fct = release_fct;
callback->u.std.release_data = release_data;
list_add(&callback->list, &logical_inputs);
return callback;
}
#endif
static void keypad_init(void)
{ … }
static void panel_attach(struct parport *port)
{ … }
static void panel_detach(struct parport *port)
{ … }
static struct parport_driver panel_driver = …;
module_parport_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;