Lines Matching refs:capdev
83 static int atmel_read(struct atmel_captouch_device *capdev, in atmel_read() argument
86 struct i2c_client *client = capdev->client; in atmel_read()
91 if (len > sizeof(capdev->xfer_buf) - 2) in atmel_read()
94 capdev->xfer_buf[0] = reg; in atmel_read()
95 capdev->xfer_buf[1] = len; in atmel_read()
99 msg[0].buf = capdev->xfer_buf; in atmel_read()
104 msg[1].buf = capdev->xfer_buf; in atmel_read()
111 if (capdev->xfer_buf[0] != reg) { in atmel_read()
114 capdev->xfer_buf[0], reg); in atmel_read()
118 memcpy(data, &capdev->xfer_buf[2], len); in atmel_read()
130 struct atmel_captouch_device *capdev = data; in atmel_captouch_isr() local
131 struct device *dev = &capdev->client->dev; in atmel_captouch_isr()
137 error = atmel_read(capdev, REG_KEY_STATE, &new_btn, 1); in atmel_captouch_isr()
145 changed_btn = new_btn ^ capdev->prev_btn; in atmel_captouch_isr()
146 capdev->prev_btn = new_btn; in atmel_captouch_isr()
148 for (i = 0; i < capdev->num_btn; i++) { in atmel_captouch_isr()
150 input_report_key(capdev->input, in atmel_captouch_isr()
151 capdev->keycodes[i], in atmel_captouch_isr()
155 input_sync(capdev->input); in atmel_captouch_isr()
166 struct atmel_captouch_device *capdev; in atmel_captouch_probe() local
180 capdev = devm_kzalloc(dev, sizeof(*capdev), GFP_KERNEL); in atmel_captouch_probe()
181 if (!capdev) in atmel_captouch_probe()
184 capdev->client = client; in atmel_captouch_probe()
186 err = atmel_read(capdev, REG_KEY_STATE, in atmel_captouch_probe()
187 &capdev->prev_btn, sizeof(capdev->prev_btn)); in atmel_captouch_probe()
193 capdev->input = devm_input_allocate_device(dev); in atmel_captouch_probe()
194 if (!capdev->input) { in atmel_captouch_probe()
199 capdev->input->id.bustype = BUS_I2C; in atmel_captouch_probe()
200 capdev->input->id.product = 0x880A; in atmel_captouch_probe()
201 capdev->input->id.version = 0; in atmel_captouch_probe()
202 capdev->input->name = "ATMegaXX Capacitive Button Controller"; in atmel_captouch_probe()
203 __set_bit(EV_KEY, capdev->input->evbit); in atmel_captouch_probe()
212 __set_bit(EV_REP, capdev->input->evbit); in atmel_captouch_probe()
214 capdev->num_btn = of_property_count_u32_elems(node, "linux,keymap"); in atmel_captouch_probe()
215 if (capdev->num_btn > MAX_NUM_OF_BUTTONS) in atmel_captouch_probe()
216 capdev->num_btn = MAX_NUM_OF_BUTTONS; in atmel_captouch_probe()
219 capdev->keycodes, in atmel_captouch_probe()
220 capdev->num_btn); in atmel_captouch_probe()
227 for (i = 0; i < capdev->num_btn; i++) in atmel_captouch_probe()
228 __set_bit(capdev->keycodes[i], capdev->input->keybit); in atmel_captouch_probe()
230 capdev->input->keycode = capdev->keycodes; in atmel_captouch_probe()
231 capdev->input->keycodesize = sizeof(capdev->keycodes[0]); in atmel_captouch_probe()
232 capdev->input->keycodemax = capdev->num_btn; in atmel_captouch_probe()
234 err = input_register_device(capdev->input); in atmel_captouch_probe()
241 "atmel_captouch", capdev); in atmel_captouch_probe()