Lines Matching +full:short +full:- +full:circuit

1 // SPDX-License-Identifier: GPL-2.0-only
3 * D-Link DIR-685 router I2C-based Touchkeys input driver
6 * This is a one-off touchkey controller based on the Cypress Semiconductor
7 * CY8C214 MCU with some firmware in its internal 8KB flash. The circuit
31 const int num_bits = min_t(int, ARRAY_SIZE(tk->codes), 16);
39 err = i2c_master_recv(tk->client, buf, sizeof(buf));
41 dev_err(tk->dev, "short read %d\n", err);
45 dev_dbg(tk->dev, "IN: %*ph\n", (int)sizeof(buf), buf);
49 changed = tk->cur_key ^ key;
51 dev_dbg(tk->dev, "key %d is %s\n", i,
53 input_report_key(tk->input, tk->codes[i], test_bit(i, &key));
57 tk->cur_key = key;
58 input_sync(tk->input);
66 struct device *dev = &client->dev;
71 tk = devm_kzalloc(&client->dev, sizeof(*tk), GFP_KERNEL);
73 return -ENOMEM;
75 tk->input = devm_input_allocate_device(dev);
76 if (!tk->input)
77 return -ENOMEM;
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");
114 if (!client->irq) {
116 return -ENODEV;
118 err = devm_request_threaded_irq(dev, client->irq,
121 "dir685-tk", tk);
138 { .compatible = "dlink,dir685-touchkeys" },
146 .name = "dlink-dir685-touchkeys",
155 MODULE_DESCRIPTION("D-Link DIR-685 touchkeys driver");