MAINTAINERS: add CHAR and MISC driver maintainers
[zen-stable.git] / include / linux / input / mt.h
blob318bb82325a6fa59e4b3d9a13a17a99152dc5674
1 #ifndef _INPUT_MT_H
2 #define _INPUT_MT_H
4 /*
5 * Input Multitouch Library
7 * Copyright (c) 2010 Henrik Rydberg
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
14 #include <linux/input.h>
16 #define TRKID_MAX 0xffff
18 /**
19 * struct input_mt_slot - represents the state of an input MT slot
20 * @abs: holds current values of ABS_MT axes for this slot
22 struct input_mt_slot {
23 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
26 static inline void input_mt_set_value(struct input_mt_slot *slot,
27 unsigned code, int value)
29 slot->abs[code - ABS_MT_FIRST] = value;
32 static inline int input_mt_get_value(const struct input_mt_slot *slot,
33 unsigned code)
35 return slot->abs[code - ABS_MT_FIRST];
38 int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots);
39 void input_mt_destroy_slots(struct input_dev *dev);
41 static inline int input_mt_new_trkid(struct input_dev *dev)
43 return dev->trkid++ & TRKID_MAX;
46 static inline void input_mt_slot(struct input_dev *dev, int slot)
48 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
51 static inline bool input_is_mt_axis(int axis)
53 return axis == ABS_MT_SLOT ||
54 (axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST);
57 void input_mt_report_slot_state(struct input_dev *dev,
58 unsigned int tool_type, bool active);
60 void input_mt_report_finger_count(struct input_dev *dev, int count);
61 void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
63 #endif