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);
65 struct dir685_touchkeys *tk;
71 tk = devm_kzalloc(&client->dev, sizeof(*tk), GFP_KERNEL);
72 if (!tk)
75 tk->input = devm_input_allocate_device(dev);
76 if (!tk->input)
79 tk->client = client;
80 tk->dev = dev;
82 tk->input->keycodesize = sizeof(u16);
83 tk->input->keycodemax = ARRAY_SIZE(tk->codes);
84 tk->input->keycode = tk->codes;
85 tk->codes[0] = KEY_UP;
86 tk->codes[1] = KEY_DOWN;
87 tk->codes[2] = KEY_LEFT;
88 tk->codes[3] = KEY_RIGHT;
89 tk->codes[4] = KEY_ENTER;
90 tk->codes[5] = KEY_WPS_BUTTON;
95 tk->codes[6] = KEY_RESERVED;
97 __set_bit(EV_KEY, tk->input->evbit);
98 for (i = 0; i < ARRAY_SIZE(tk->codes); i++)
99 __set_bit(tk->codes[i], tk->input->keybit);
100 __clear_bit(KEY_RESERVED, tk->input->keybit);
102 tk->input->name = "D-Link DIR-685 touchkeys";
103 tk->input->id.bustype = BUS_I2C;
105 err = input_register_device(tk->input);
112 dev_warn(tk->dev, "error setting brightness level\n");
121 "dir685-tk", tk);