Lines Matching refs:tk
29 struct dir685_touchkeys *tk = data;
30 const int num_bits = min_t(int, ARRAY_SIZE(tk->codes), 16);
38 err = i2c_master_recv(tk->client, buf, sizeof(buf));
40 dev_err(tk->dev, "short read %d\n", err);
44 dev_dbg(tk->dev, "IN: %*ph\n", (int)sizeof(buf), buf);
48 changed = tk->cur_key ^ key;
50 dev_dbg(tk->dev, "key %d is %s\n", i,
52 input_report_key(tk->input, tk->codes[i], test_bit(i, &key));
56 tk->cur_key = key;
57 input_sync(tk->input);
66 struct dir685_touchkeys *tk;
70 tk = devm_kzalloc(&client->dev, sizeof(*tk), GFP_KERNEL);
71 if (!tk)
74 tk->input = devm_input_allocate_device(dev);
75 if (!tk->input)
78 tk->client = client;
79 tk->dev = dev;
81 tk->input->keycodesize = sizeof(u16);
82 tk->input->keycodemax = ARRAY_SIZE(tk->codes);
83 tk->input->keycode = tk->codes;
84 tk->codes[0] = KEY_UP;
85 tk->codes[1] = KEY_DOWN;
86 tk->codes[2] = KEY_LEFT;
87 tk->codes[3] = KEY_RIGHT;
88 tk->codes[4] = KEY_ENTER;
89 tk->codes[5] = KEY_WPS_BUTTON;
94 tk->codes[6] = KEY_RESERVED;
96 __set_bit(EV_KEY, tk->input->evbit);
97 for (i = 0; i < ARRAY_SIZE(tk->codes); i++)
98 __set_bit(tk->codes[i], tk->input->keybit);
99 __clear_bit(KEY_RESERVED, tk->input->keybit);
101 tk->input->name = "D-Link DIR-685 touchkeys";
102 tk->input->id.bustype = BUS_I2C;
104 err = input_register_device(tk->input);
111 dev_warn(tk->dev, "error setting brightness level\n");
120 "dir685-tk", tk);