aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/input.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/input.h')
-rw-r--r--include/linux/input.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 339d043ccb5..896a92227bc 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -776,6 +776,7 @@ struct input_absinfo {
776#define REP_DELAY 0x00 776#define REP_DELAY 0x00
777#define REP_PERIOD 0x01 777#define REP_PERIOD 0x01
778#define REP_MAX 0x01 778#define REP_MAX 0x01
779#define REP_CNT (REP_MAX+1)
779 780
780/* 781/*
781 * Sounds 782 * Sounds
@@ -1099,21 +1100,18 @@ struct input_mt_slot {
1099 * @repeat_key: stores key code of the last key pressed; used to implement 1100 * @repeat_key: stores key code of the last key pressed; used to implement
1100 * software autorepeat 1101 * software autorepeat
1101 * @timer: timer for software autorepeat 1102 * @timer: timer for software autorepeat
1102 * @abs: current values for reports from absolute axes
1103 * @rep: current values for autorepeat parameters (delay, rate) 1103 * @rep: current values for autorepeat parameters (delay, rate)
1104 * @mt: pointer to array of struct input_mt_slot holding current values 1104 * @mt: pointer to array of struct input_mt_slot holding current values
1105 * of tracked contacts 1105 * of tracked contacts
1106 * @mtsize: number of MT slots the device uses 1106 * @mtsize: number of MT slots the device uses
1107 * @slot: MT slot currently being transmitted 1107 * @slot: MT slot currently being transmitted
1108 * @absinfo: array of &struct absinfo elements holding information
1109 * about absolute axes (current value, min, max, flat, fuzz,
1110 * resolution)
1108 * @key: reflects current state of device's keys/buttons 1111 * @key: reflects current state of device's keys/buttons
1109 * @led: reflects current state of device's LEDs 1112 * @led: reflects current state of device's LEDs
1110 * @snd: reflects current state of sound effects 1113 * @snd: reflects current state of sound effects
1111 * @sw: reflects current state of device's switches 1114 * @sw: reflects current state of device's switches
1112 * @absmax: maximum values for events coming from absolute axes
1113 * @absmin: minimum values for events coming from absolute axes
1114 * @absfuzz: describes noisiness for axes
1115 * @absflat: size of the center flat position (used by joydev)
1116 * @absres: resolution used for events coming form absolute axes
1117 * @open: this method is called when the very first user calls 1115 * @open: this method is called when the very first user calls
1118 * input_open_device(). The driver must prepare the device 1116 * input_open_device(). The driver must prepare the device
1119 * to start generating events (start polling thread, 1117 * to start generating events (start polling thread,
@@ -1180,24 +1178,19 @@ struct input_dev {
1180 unsigned int repeat_key; 1178 unsigned int repeat_key;
1181 struct timer_list timer; 1179 struct timer_list timer;
1182 1180
1183 int abs[ABS_CNT]; 1181 int rep[REP_CNT];
1184 int rep[REP_MAX + 1];
1185 1182
1186 struct input_mt_slot *mt; 1183 struct input_mt_slot *mt;
1187 int mtsize; 1184 int mtsize;
1188 int slot; 1185 int slot;
1189 1186
1187 struct input_absinfo *absinfo;
1188
1190 unsigned long key[BITS_TO_LONGS(KEY_CNT)]; 1189 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
1191 unsigned long led[BITS_TO_LONGS(LED_CNT)]; 1190 unsigned long led[BITS_TO_LONGS(LED_CNT)];
1192 unsigned long snd[BITS_TO_LONGS(SND_CNT)]; 1191 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1193 unsigned long sw[BITS_TO_LONGS(SW_CNT)]; 1192 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1194 1193
1195 int absmax[ABS_CNT];
1196 int absmin[ABS_CNT];
1197 int absfuzz[ABS_CNT];
1198 int absflat[ABS_CNT];
1199 int absres[ABS_CNT];
1200
1201 int (*open)(struct input_dev *dev); 1194 int (*open)(struct input_dev *dev);
1202 void (*close)(struct input_dev *dev); 1195 void (*close)(struct input_dev *dev);
1203 int (*flush)(struct input_dev *dev, struct file *file); 1196 int (*flush)(struct input_dev *dev, struct file *file);
@@ -1459,16 +1452,32 @@ static inline void input_set_events_per_packet(struct input_dev *dev, int n_even
1459 dev->hint_events_per_packet = n_events; 1452 dev->hint_events_per_packet = n_events;
1460} 1453}
1461 1454
1462static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1455void input_alloc_absinfo(struct input_dev *dev);
1463{ 1456void input_set_abs_params(struct input_dev *dev, unsigned int axis,
1464 dev->absmin[axis] = min; 1457 int min, int max, int fuzz, int flat);
1465 dev->absmax[axis] = max; 1458
1466 dev->absfuzz[axis] = fuzz; 1459#define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \
1467 dev->absflat[axis] = flat; 1460static inline int input_abs_get_##_suffix(struct input_dev *dev, \
1468 1461 unsigned int axis) \
1469 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1462{ \
1463 return dev->absinfo ? dev->absinfo[axis]._item : 0; \
1464} \
1465 \
1466static inline void input_abs_set_##_suffix(struct input_dev *dev, \
1467 unsigned int axis, int val) \
1468{ \
1469 input_alloc_absinfo(dev); \
1470 if (dev->absinfo) \
1471 dev->absinfo[axis]._item = val; \
1470} 1472}
1471 1473
1474INPUT_GENERATE_ABS_ACCESSORS(val, value)
1475INPUT_GENERATE_ABS_ACCESSORS(min, minimum)
1476INPUT_GENERATE_ABS_ACCESSORS(max, maximum)
1477INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz)
1478INPUT_GENERATE_ABS_ACCESSORS(flat, flat)
1479INPUT_GENERATE_ABS_ACCESSORS(res, resolution)
1480
1472int input_get_keycode(struct input_dev *dev, 1481int input_get_keycode(struct input_dev *dev,
1473 unsigned int scancode, unsigned int *keycode); 1482 unsigned int scancode, unsigned int *keycode);
1474int input_set_keycode(struct input_dev *dev, 1483int input_set_keycode(struct input_dev *dev,