]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/keyboard.h
common: arm: davinci: Move header file out of common
[people/ms/u-boot.git] / include / keyboard.h
CommitLineData
1c43771b
WD
1#ifndef __KEYBOARD_H
2#define __KEYBOARD_H
3
e84421d8
SG
4#ifdef CONFIG_DM_KEYBOARD
5#include <input.h>
6#include <stdio_dev.h>
7
8/**
9 * struct keyboard_priv - information about a keyboard, for the uclass
10 *
11 * @sdev: stdio device
12 * @input: input configuration (the driver may use this if desired)
13 */
14struct keyboard_priv {
15 struct stdio_dev sdev;
16
17 /*
18 * This is set up by the uclass but will only be used if the driver
19 * sets input.dev to its device pointer (it is initially NULL).
20 */
21 struct input_config input;
22};
23
24/**
25 * struct keyboard_ops - keyboard device operations
26 */
27struct keyboard_ops {
28 /**
29 * start() - enable the keyboard ready for use
30 *
31 * @dev: Device to enable
32 * @return 0 if OK, -ve on error
33 */
34 int (*start)(struct udevice *dev);
35
36 /**
37 * stop() - disable the keyboard when no-longer needed
38 *
39 * @dev: Device to disable
40 * @return 0 if OK, -ve on error
41 */
42 int (*stop)(struct udevice *dev);
43
44 /**
45 * tstc() - check if a key is available
46 *
47 * @dev: Device to check
48 * @return 0 if no key is available, 1 if a key is available, -ve on
49 * error
50 */
51 int (*tstc)(struct udevice *dev);
52
53 /**
54 * getc() - get a key
55 *
56 * TODO(sjg@chromium.org): At present this method may wait if it calls
57 * input_getc().
58 *
59 * @dev: Device to read from
60 * @return -EAGAIN if no key is available, otherwise key value read
61 * (as ASCII).
62 */
63 int (*getc)(struct udevice *dev);
64
65 /**
66 * update_leds() - update keyboard LEDs
67 *
68 * This is called when the LEDs have changed and need to be updated.
69 * For example, if 'caps lock' is pressed then this method will be
70 * called with the new LED value.
71 *
72 * @dev: Device to update
73 * @leds: New LED mask (see INPUT_LED_... in input.h)
74 */
75 int (*update_leds)(struct udevice *dev, int leds);
76};
77
78#define keyboard_get_ops(dev) ((struct keyboard_ops *)(dev)->driver->ops)
79
80#else
81
1c43771b
WD
82#ifdef CONFIG_PS2MULT
83#include <ps2mult.h>
84#endif
85
86#if !defined(kbd_request_region) || \
87 !defined(kbd_request_irq) || \
88 !defined(kbd_read_input) || \
89 !defined(kbd_read_status) || \
90 !defined(kbd_write_output) || \
91 !defined(kbd_write_command)
92#error PS/2 low level routines not defined
93#endif
94
95extern int kbd_init (void);
96extern void handle_scancode(unsigned char scancode);
97extern int kbd_init_hw(void);
98extern void pckbd_leds(unsigned char leds);
e84421d8 99#endif /* !CONFIG_DM_KEYBOARD */
1c43771b 100
7f825218 101#if defined(CONFIG_MPC5xxx) || defined(CONFIG_ARCH_MPC8540) || \
3c3d8ab5 102 defined(CONFIG_ARCH_MPC8541) || defined(CONFIG_ARCH_MPC8555)
91f81545
SG
103int ps2ser_check(void);
104#endif
105
1c43771b 106#endif /* __KEYBOARD_H */