From patchwork Tue May 30 12:09:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 100708 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp179590qge; Tue, 30 May 2017 05:09:35 -0700 (PDT) X-Received: by 10.98.217.154 with SMTP id b26mr22994495pfl.136.1496146175504; Tue, 30 May 2017 05:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496146175; cv=none; d=google.com; s=arc-20160816; b=AY4B3NB9BTxFRHgVzbZ9sSkmvKaLec9VqauahuP/mqfGb/Sf2KmaSPnmSqX1mpvbxC tdQFBYhD1/Nl9YMdSj68ChTBqp8bjU7/KUaoofjUbdJP/yeO3B0s+/ENfc+pn9EmLPkD rJWi+lR96T/s982e9ZJ6As+CZjJVbTqYBI+zpcgLMKHvJOYOEM5N5u16qswAdDtMBFYa ykmlVd4gi5qMG7i7QU2twb0Jh4PAuoOsvGT7TakClZBXkmHoPRMCjqxjXQB5wfqVOFJc rKxW/nEhWEELwZvLdfpplRN5RLb3BuCeJtzDIgl0eta/D33Wu8Q7ORfl7MxkaTJG919K p31g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=0B9Q3/Y3yGM5VCE5u9awt80vxFAtFpKTHnwKVXQjvC8=; b=aNkmwRaFlhy8ZYoD9Uc86raAl8pWfwwcjgRgIzl0UJkUOFDV9BefvSBTKuToy105Hv QrLhCNUFlWDWhgtsd+E7D95HiXolQgb4PBbvvYSWHDJ2zylKsABEjfUYerUsKMnhrqPf /A2Dzc34oAL+40Ly+H0NY1esV60NqoySw89Hs7/oJL1qNCaJpGWCKpexkoEc1j8SYUdW 5OHEd6DbsSSoRhch0R2uNpCtJUoSXc45I+QO/JdMyQdLV2fSpT7dE6ZLD3iTGzlAWA9n /1i2uCJPxFhJJECOlgjG1etv/1F5i7lJWvbO9yAjDGZxiRICG1FQtBMPeiMHwUYWXNnn Bd+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si12717806plb.244.2017.05.30.05.09.35 for ; Tue, 30 May 2017 05:09:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751435AbdE3MJ3 (ORCPT ); Tue, 30 May 2017 08:09:29 -0400 Received: from mail-lf0-f54.google.com ([209.85.215.54]:34428 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750905AbdE3MJ0 (ORCPT ); Tue, 30 May 2017 08:09:26 -0400 Received: by mail-lf0-f54.google.com with SMTP id 99so47886411lfu.1 for ; Tue, 30 May 2017 05:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=RclVkdpnZ7KIYYWSMJzLcNZyeRA2JpOx0LtZdUaVfxk=; b=SZBXQ8oiuFUSoyrG5vU24Ahn/6/ze9CT77y6zNMU8jf+37Id9dEDuWjZc9z86UvmaR HeSvCX1anVLLzQgYOaBW4D8REa1GTZmShTCTBK0xXTv0DeNptL4fKswGeiXVqaIq2XDD AYe5YI5AFNmgnDUFUrBxSxoB5Ip9AtcCZpHw0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=RclVkdpnZ7KIYYWSMJzLcNZyeRA2JpOx0LtZdUaVfxk=; b=XEMtxLqM3oShzmJd6DzJx3HSt0BMGsEmNj9Tnkg+HBw3/+VQvFpOBb6pLcGcB3Qh22 90uvZf5yWAJZV5PqHkxeLBsMJxst7OUwPVVPQDINtv/s1+T4pNeI2v5HgwmWzBrsJ4sE OLD4oQg9EmFkJaCjWm5Bpsla4k0+yeL1bbbQKRXQ0yXCITzKn0qXZ/6LtgM5jbW4V/zu HMZT/2wqDr9qZ/ckVIJOSaGORqQBlElM0ex2evk2rapGHJ6b+QXbQsp6chyGd2jZGk+e z8Ize9f8MmVu7X0jaLR8jLRLdxGGW2l6BsZidaJ7QvFqRxB0yYIr3qHuoR0p9DuybpfK CZ8A== X-Gm-Message-State: AODbwcDxI02WHTu73aKRMCcs8q1vOW6/jt8kQq/Cbolfw3wuLNANsjQk bUyn3cPg8r1tUNTn X-Received: by 10.25.145.75 with SMTP id y11mr5895355lfj.68.1496146164938; Tue, 30 May 2017 05:09:24 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-9d7e71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.126.157]) by smtp.gmail.com with ESMTPSA id 25sm2656353ljp.2.2017.05.30.05.09.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2017 05:09:23 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Linus Walleij , devicetree@vger.kernel.org Subject: [PATCH 1/2 v3] input: keyboard: DT bindings for the D-Link DIR-685 touchkeys Date: Tue, 30 May 2017 14:09:17 +0200 Message-Id: <20170530120918.27357-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This adds device tree bindings for the D-Link DIR-685 touchkeys. It's a simple homebrewn touchkey controller (by D-Link referred to as "touchpad") on I2C. Cc: devicetree@vger.kernel.org Acked-by: Rob Herring Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - No changes, just resending. ChangeLog v1->v2: - Rename from "touchpad" to touchkeys" consistently. - Add Rob's ACK. --- .../bindings/input/dlink,dir685-touchkeys.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/dlink,dir685-touchkeys.txt -- 2.9.4 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/input/dlink,dir685-touchkeys.txt b/Documentation/devicetree/bindings/input/dlink,dir685-touchkeys.txt new file mode 100644 index 000000000000..10dec1c57abf --- /dev/null +++ b/Documentation/devicetree/bindings/input/dlink,dir685-touchkeys.txt @@ -0,0 +1,21 @@ +* D-Link DIR-685 Touchkeys + +This is a I2C 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. + +The touchkey device node should be placed inside an I2C bus node. + +Required properties: +- compatible: must be "dlink,dir685-touchkeys" +- reg: the I2C address of the touchkeys +- interrupts: reference to the interrupt number + +Example: + +touchkeys@26 { + compatible = "dlink,dir685-touchkeys"; + reg = <0x26>; + interrupt-parent = <&gpio0>; + interrupts = <17 IRQ_TYPE_EDGE_FALLING>; +}; From patchwork Tue May 30 12:09:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 100709 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp179605qge; Tue, 30 May 2017 05:09:37 -0700 (PDT) X-Received: by 10.99.4.87 with SMTP id 84mr1532206pge.138.1496146177519; Tue, 30 May 2017 05:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496146177; cv=none; d=google.com; s=arc-20160816; b=q2h1qYzbRCsbpSbiNu0kmaIMoEFUKE7kSt3+v0X9+LWBVTzXPLN6u+xeaTqVQcveCw YLg1rMe+L8fCDmNy9ftYiWqttI5nW8YazFMk8UMZf0HRdfO1A/JsWYJWf1zqfp/IE3jf NTgb63T4xcY6ztbIKQzCNgdFJHNsWP5CHT7vzJ/Ho2pPWFQLg0Ywrh0SyoJUeKmTYSPZ 8BN1pJ38/i83ACPe6p0zAw8qqrMdH5GTW2SpFEIfB7DV20/8DbXkYACtRSl91q9Zunhp dcBox9FKTAHoUf53F4JP1Zy4HAKcC6ZCMbSKG2cl+WUYUXksFKtX3BxZ+J9zwFlozdrj lQGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=OTuAy+2waLSzNV3h2qT2qAlJcGksilJ+QEtQ2V0tVB8=; b=kNdZdRD/qNnTfgzzR7KnQZDhyjM6HKcCcD4E/oWcoosNPUwrThka0Vs5vqM0uJRgzm tqmDqMVAwGMM4l9qnnVuK23VD+7aWTBecbWt/YkmXxNcCtPcfDOpXMGS7xP2m+5arV7L /NImPvWmz/ZOuVX4nHPQOmnABqDExgEjj9tIRJ/XF29lQ7ZXh4EB4S4o/pfcN3xxGm0W mnuM8ScxZ80sEto0gOHGRxqGPppNmCug49OMFmSfzGTmWtrWDhpJRhzABdTeWEFhghYw KFY8xXOKAdE+EnJf2fCaHtQpp5/THTUsQhAuhSiVY0jmWw4hB2vmLPxSR4E0KhHYkydh yexA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si12717806plb.244.2017.05.30.05.09.37 for ; Tue, 30 May 2017 05:09:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751340AbdE3MJg (ORCPT ); Tue, 30 May 2017 08:09:36 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:36746 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750905AbdE3MJg (ORCPT ); Tue, 30 May 2017 08:09:36 -0400 Received: by mail-lf0-f52.google.com with SMTP id h4so47877610lfj.3 for ; Tue, 30 May 2017 05:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pqGouSiCiWuIi9XO2NqnOTrwGRTO2pjghluZmWVY69E=; b=OnlxIRBDRQVIQmI8/7jGfPG7coW1jmzsM+gcFkIs+/DU7Tfa4Cr6CJHCgHLUNKoEbp 6X8YeeZaYolUB6JkGpEJioccisZbfA1pfnCCJusaN6I24URyHWFb0bmw2fWIQj0Nf/bS nc2Kmi1YOzWIScWLuR7+LEssL2S25yR3196q8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pqGouSiCiWuIi9XO2NqnOTrwGRTO2pjghluZmWVY69E=; b=AxmKR3roAn0fWVP5HAZm+EiNqql88+Rz+gI5+Fmb+PIjAOgDW/zcvuDC4CKQjT75QX aTFadm2T1aQwXEViwm2OJ0Jt8LHZR9ksSR2oLs63Oispxp9yLuqSeeGbljvIDe0RtfKp EBFzat7BHy644Tz2IPL7sFHVV/gIjd0dy9Pp2R/8WSO9JGSLt2g3h81ZshNHC/iMISUB ptHrF17nrwqiBlgSKYsYs7QhO/04l6P6avqg3MFa8wIWTpv1MJgpliwUCgmQtWI0dJdw +UpRMn5+Dt1qW2JiUJzhKwqOZhuQfQ3QTOSVn38lu7Wd7tNk4ZjidZ5L9d2/7sIHzGDF Rk3Q== X-Gm-Message-State: AODbwcBkj2ftDSHoAALJpjO9dN8vE7e4L6TQu3uDQY1g8LwkA6ua45Gt sM9vkIdFCqc5C3IA X-Received: by 10.25.209.209 with SMTP id i200mr6043515lfg.44.1496146168761; Tue, 30 May 2017 05:09:28 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-9d7e71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.126.157]) by smtp.gmail.com with ESMTPSA id 25sm2656353ljp.2.2017.05.30.05.09.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2017 05:09:27 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Linus Walleij Subject: [PATCH 2/2 v3] input: keyboard: Add D-Link DIR-685 touchkeys driver Date: Tue, 30 May 2017 14:09:18 +0200 Message-Id: <20170530120918.27357-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170530120918.27357-1-linus.walleij@linaro.org> References: <20170530120918.27357-1-linus.walleij@linaro.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This adds support for the D-Link DIR-685 touchkeys found in the router with this name. The vendor code calles this a "touchpad" but we are registering it here under its real name. Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Switch "KEY_W" to "KEY_WPS_BUTTON" as apropriate. - Add comment about the mysterious "KEY_O". ChangeLog v1->v2: - Change the whole touchpad->touchkey naming scheme, even in the device tree bindings. - Embedd the keycodes directly into the state container and open code the key assignments. - Use Dmitry's suggested XOR loop to detect key state changes. - Drop add - Drop dependency on the OF config symbol. - Rename all "ret" to "err". - Drop driver dev_info() announcement. --- MAINTAINERS | 6 + drivers/input/keyboard/Kconfig | 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/dlink-dir685-touchkeys.c | 157 ++++++++++++++++++++++++ 4 files changed, 175 insertions(+) create mode 100644 drivers/input/keyboard/dlink-dir685-touchkeys.c -- 2.9.4 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/MAINTAINERS b/MAINTAINERS index 96753be12026..eea776eec996 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3779,6 +3779,12 @@ S: Supported F: drivers/input/touchscreen/cyttsp* F: include/linux/input/cyttsp.h +D-LINK DIR-685 TOUCHKEYS DRIVER +M: Linus Walleij +L: linux-input@vger.kernel.org +S: Supported +F: drivers/input/dlink-dir685-touchkeys.c + DALLAS/MAXIM DS1685-FAMILY REAL TIME CLOCK M: Joshua Kinard S: Maintained diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 97acd6524ad7..4c4ab1ced235 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -178,6 +178,17 @@ config KEYBOARD_CLPS711X To compile this driver as a module, choose M here: the module will be called clps711x-keypad. +config KEYBOARD_DLINK_DIR685 + tristate "D-Link DIR-685 touchkeys support" + depends on I2C + default ARCH_GEMINI + help + If you say yes here you get support for the D-Link DIR-685 + touchkeys. + + To compile this driver as a module, choose M here: the + module will be called dlink-dir685-touchkeys. + config KEYBOARD_LKKBD tristate "DECstation/VAXstation LK201/LK401 keyboard" select SERIO diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 7d9acff819a7..d2338bacdad1 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o obj-$(CONFIG_KEYBOARD_CROS_EC) += cros_ec_keyb.o obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o +obj-$(CONFIG_KEYBOARD_DLINK_DIR685) += dlink-dir685-touchkeys.o obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS) += goldfish_events.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o diff --git a/drivers/input/keyboard/dlink-dir685-touchkeys.c b/drivers/input/keyboard/dlink-dir685-touchkeys.c new file mode 100644 index 000000000000..6d6f60963e3c --- /dev/null +++ b/drivers/input/keyboard/dlink-dir685-touchkeys.c @@ -0,0 +1,157 @@ +/* + * D-Link DIR-685 router I2C-based Touchkeys input driver + * Copyright (C) 2017 Linus Walleij + * + * 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 + */ + +#include +#include +#include +#include +#include +#include +#include + +struct dir685_touchkeys { + struct device *dev; + struct i2c_client *client; + struct input_dev *input; + unsigned long cur_key; + u16 codes[7]; +}; + +static irqreturn_t dir685_tk_irq_thread(int irq, void *data) +{ + struct dir685_touchkeys *tk = data; + const int num_bits = min_t(int, ARRAY_SIZE(tk->codes), 16); + unsigned long changed; + u8 buf[6]; + unsigned long key; + int i; + int err; + + memset(buf, 0, sizeof(buf)); + err = i2c_master_recv(tk->client, buf, sizeof(buf)); + if (err != sizeof(buf)) { + dev_err(tk->dev, "short read %d\n", err); + return IRQ_HANDLED; + } + + dev_dbg(tk->dev, "IN: %02x, %02x, %02x, %02x, %02x, %02x\n", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); + key = be16_to_cpup((__le16 *) &buf[4]); + + /* 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, + test_bit(i, &key) ? "down" : "up"); + input_report_key(tk->input, tk->codes[i], test_bit(i, &key)); + } + + /* Store currently down keys */ + tk->cur_key = key; + input_sync(tk->input); + + return IRQ_HANDLED; +} + +static int dir685_tk_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct dir685_touchkeys *tk; + struct device *dev = &client->dev; + u8 bl_data[] = { 0xa7, 0x40 }; + int err; + int i; + + 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 provoke it. + */ + tk->codes[6] = KEY_O; + + __set_bit(EV_KEY, tk->input->evbit); + for (i = 0; i < ARRAY_SIZE(tk->codes); i++) + __set_bit(tk->codes[i], tk->input->keybit); + + tk->input->name = "D-Link DIR-685 touchkeys"; + input_set_drvdata(tk->input, tk); + + err = input_register_device(tk->input); + if (err) + return err; + + /* Set up 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 up 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; + } + + i2c_set_clientdata(client, tk); + + return 0; +} + +static const struct i2c_device_id dir685_tk_id[] = { + { "dir685tk", 0 }, + { } +}; + +static const struct of_device_id dir685_tk_of_match[] = { + { .compatible = "dlink,dir685-touchkeys" }, + {}, +}; +MODULE_DEVICE_TABLE(of, dir685_tk_of_match); + +static struct i2c_driver dir685_tk_i2c_driver = { + .driver = { + .name = "dlin-dir685-touchkeys", + .of_match_table = of_match_ptr(dir685_tk_of_match), + }, + .probe = dir685_tk_probe, + .id_table = dir685_tk_id, +}; +MODULE_DEVICE_TABLE(i2c, dir685_tk_id); + +module_i2c_driver(dir685_tk_i2c_driver); + +MODULE_AUTHOR("Linus Walleij "); +MODULE_DESCRIPTION("D-Link DIR-685 touchkeys driver"); +MODULE_LICENSE("GPL");