Lines Matching full:pm
50 struct pm { struct
59 void (*parse_packet)(struct pm *); argument
66 static void pm_mtevent(struct pm *pm, struct input_dev *input) in pm_mtevent() argument
70 for (i = 0; i < pm->maxcontacts; ++i) { in pm_mtevent()
73 pm->slots[i].active); in pm_mtevent()
74 if (pm->slots[i].active) { in pm_mtevent()
75 input_event(input, EV_ABS, ABS_MT_POSITION_X, pm->slots[i].x); in pm_mtevent()
76 input_event(input, EV_ABS, ABS_MT_POSITION_Y, pm->slots[i].y); in pm_mtevent()
99 static void pm_parse_9000(struct pm *pm) in pm_parse_9000() argument
101 struct input_dev *dev = pm->dev; in pm_parse_9000()
103 if ((pm->data[0] & 0x80) && pm->packetsize == ++pm->idx) { in pm_parse_9000()
104 input_report_abs(dev, ABS_X, pm->data[1] * 128 + pm->data[2]); in pm_parse_9000()
105 input_report_abs(dev, ABS_Y, pm->data[3] * 128 + pm->data[4]); in pm_parse_9000()
106 input_report_key(dev, BTN_TOUCH, !!(pm->data[0] & 0x40)); in pm_parse_9000()
108 pm->idx = 0; in pm_parse_9000()
112 static void pm_parse_6000(struct pm *pm) in pm_parse_6000() argument
114 struct input_dev *dev = pm->dev; in pm_parse_6000()
116 if ((pm->data[0] & 0xbf) == 0x30 && pm->packetsize == ++pm->idx) { in pm_parse_6000()
117 if (pm_checkpacket(pm->data)) { in pm_parse_6000()
119 pm->data[2] * 256 + pm->data[1]); in pm_parse_6000()
121 pm->data[4] * 256 + pm->data[3]); in pm_parse_6000()
122 input_report_key(dev, BTN_TOUCH, pm->data[0] & 0x40); in pm_parse_6000()
125 pm->idx = 0; in pm_parse_6000()
129 static void pm_parse_3000(struct pm *pm) in pm_parse_3000() argument
131 struct input_dev *dev = pm->dev; in pm_parse_3000()
133 if ((pm->data[0] & 0xce) == 0x40 && pm->packetsize == ++pm->idx) { in pm_parse_3000()
134 if (pm_checkpacket(pm->data)) { in pm_parse_3000()
135 int slotnum = pm->data[0] & 0x0f; in pm_parse_3000()
136 pm->slots[slotnum].active = pm->data[0] & 0x30; in pm_parse_3000()
137 pm->slots[slotnum].x = pm->data[2] * 256 + pm->data[1]; in pm_parse_3000()
138 pm->slots[slotnum].y = pm->data[4] * 256 + pm->data[3]; in pm_parse_3000()
139 pm_mtevent(pm, dev); in pm_parse_3000()
141 pm->idx = 0; in pm_parse_3000()
145 static void pm_parse_6250(struct pm *pm) in pm_parse_6250() argument
147 struct input_dev *dev = pm->dev; in pm_parse_6250()
149 if ((pm->data[0] & 0xb0) == 0x30 && pm->packetsize == ++pm->idx) { in pm_parse_6250()
150 if (pm_checkpacket(pm->data)) { in pm_parse_6250()
151 int slotnum = pm->data[0] & 0x0f; in pm_parse_6250()
152 pm->slots[slotnum].active = pm->data[0] & 0x40; in pm_parse_6250()
153 pm->slots[slotnum].x = pm->data[2] * 256 + pm->data[1]; in pm_parse_6250()
154 pm->slots[slotnum].y = pm->data[4] * 256 + pm->data[3]; in pm_parse_6250()
155 pm_mtevent(pm, dev); in pm_parse_6250()
157 pm->idx = 0; in pm_parse_6250()
164 struct pm *pm = serio_get_drvdata(serio); in pm_interrupt() local
166 pm->data[pm->idx] = data; in pm_interrupt()
168 pm->parse_packet(pm); in pm_interrupt()
179 struct pm *pm = serio_get_drvdata(serio); in pm_disconnect() local
183 input_unregister_device(pm->dev); in pm_disconnect()
184 kfree(pm); in pm_disconnect()
197 struct pm *pm; in pm_connect() local
202 pm = kzalloc(sizeof(*pm), GFP_KERNEL); in pm_connect()
204 if (!pm || !input_dev) { in pm_connect()
209 pm->serio = serio; in pm_connect()
210 pm->dev = input_dev; in pm_connect()
211 snprintf(pm->phys, sizeof(pm->phys), "%s/input0", serio->phys); in pm_connect()
212 pm->maxcontacts = 1; in pm_connect()
215 input_dev->phys = pm->phys; in pm_connect()
228 pm->packetsize = 5; in pm_connect()
229 pm->parse_packet = pm_parse_9000; in pm_connect()
235 pm->packetsize = 6; in pm_connect()
236 pm->parse_packet = pm_parse_6000; in pm_connect()
242 pm->packetsize = 6; in pm_connect()
243 pm->parse_packet = pm_parse_3000; in pm_connect()
246 pm->maxcontacts = PM_3000_MTSLOT; in pm_connect()
250 pm->packetsize = 6; in pm_connect()
251 pm->parse_packet = pm_parse_6250; in pm_connect()
254 pm->maxcontacts = PM_6250_MTSLOT; in pm_connect()
258 input_set_abs_params(pm->dev, ABS_X, 0, max_x, 0, 0); in pm_connect()
259 input_set_abs_params(pm->dev, ABS_Y, 0, max_y, 0, 0); in pm_connect()
261 if (pm->maxcontacts > 1) { in pm_connect()
262 input_mt_init_slots(pm->dev, pm->maxcontacts, 0); in pm_connect()
263 input_set_abs_params(pm->dev, in pm_connect()
265 input_set_abs_params(pm->dev, in pm_connect()
269 serio_set_drvdata(serio, pm); in pm_connect()
275 err = input_register_device(pm->dev); in pm_connect()
284 kfree(pm); in pm_connect()