// SPDX-License-Identifier: GPL-2.0-only /* * D-Link DIR-685 router I2C-based Touchkeys input driver * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org> * * This is a one-off touchkey controller based on the Cypress Semiconductor * CY8C214 MCU with some firmware in its internal 8KB flash. The circuit * board inside the router is named E119921
*/
/* Figure out if any bits went high or low since last message */
changed = tk->cur_key ^ key;
for_each_set_bit(i, &changed, num_bits) {
dev_dbg(tk->dev, "key %d is %s\n", i,
str_down_up(test_bit(i, &key)));
input_report_key(tk->input, tk->codes[i], test_bit(i, &key));
}
/* Store currently down keys */
tk->cur_key = key;
input_sync(tk->input);
tk = devm_kzalloc(&client->dev, sizeof(*tk), GFP_KERNEL); if (!tk) return -ENOMEM;
tk->input = devm_input_allocate_device(dev); if (!tk->input) return -ENOMEM;
tk->client = client;
tk->dev = dev;
tk->input->keycodesize = sizeof(u16);
tk->input->keycodemax = ARRAY_SIZE(tk->codes);
tk->input->keycode = tk->codes;
tk->codes[0] = KEY_UP;
tk->codes[1] = KEY_DOWN;
tk->codes[2] = KEY_LEFT;
tk->codes[3] = KEY_RIGHT;
tk->codes[4] = KEY_ENTER;
tk->codes[5] = KEY_WPS_BUTTON; /* * This key appears in the vendor driver, but I have * not been able to activate it.
*/
tk->codes[6] = KEY_RESERVED;
__set_bit(EV_KEY, tk->input->evbit); for (i = 0; i < ARRAY_SIZE(tk->codes); i++)
__set_bit(tk->codes[i], tk->input->keybit);
__clear_bit(KEY_RESERVED, tk->input->keybit);
err = input_register_device(tk->input); if (err) return err;
/* Set the brightness to max level */
err = i2c_master_send(client, bl_data, sizeof(bl_data)); if (err != sizeof(bl_data))
dev_warn(tk->dev, "error setting brightness level\n");
if (!client->irq) {
dev_err(dev, "no IRQ on the I2C device\n"); return -ENODEV;
}
err = devm_request_threaded_irq(dev, client->irq,
NULL, dir685_tk_irq_thread,
IRQF_ONESHOT, "dir685-tk", tk); if (err) {
dev_err(dev, "can't request IRQ\n"); return err;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.