From patchwork Mon Nov 21 14:21:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 9439487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B55E8606DB for ; Mon, 21 Nov 2016 14:21:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2D1728AF2 for ; Mon, 21 Nov 2016 14:21:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 966F028AF6; Mon, 21 Nov 2016 14:21:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3094428AF2 for ; Mon, 21 Nov 2016 14:21:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752849AbcKUOVb (ORCPT ); Mon, 21 Nov 2016 09:21:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44328 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752502AbcKUOVa (ORCPT ); Mon, 21 Nov 2016 09:21:30 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E52E31B333; Mon, 21 Nov 2016 14:21:30 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-116-112.ams2.redhat.com [10.36.116.112]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uALELSax021199; Mon, 21 Nov 2016 09:21:29 -0500 From: Benjamin Tissoires To: Jiri Kosina Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] HID: i2c-hid: force the IRQ level trigger only when not set Date: Mon, 21 Nov 2016 15:21:27 +0100 Message-Id: <1479738087-3123-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 21 Nov 2016 14:21:30 +0000 (UTC) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of forcing the level trigger of the IRQ, we can count on ACPI or OF to set it up for us. The first release of the HID over I2C specification mentioned that the level trigger needed to be active low. In the latest version of the specification, there is no such explicit mention, so it's better to not assume one. Signed-off-by: Benjamin Tissoires --- changes in v2: - reword a little the commit message (and mention that the new spec doesn't requires active low anymore) - add missing irq.h include as per kbuild bot raised So after the kbuild bot warning and a search in my email folder, I realised that the commit message should be amended too. So here is a v2 :) Cheers, Benjamin --- drivers/hid/i2c-hid/i2c-hid.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index ce51879..8d53efe 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -858,13 +859,16 @@ static struct hid_ll_driver i2c_hid_ll_driver = { static int i2c_hid_init_irq(struct i2c_client *client) { struct i2c_hid *ihid = i2c_get_clientdata(client); + unsigned long irqflags = 0; int ret; dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq); + if (!irq_get_trigger_type(client->irq)) + irqflags = IRQF_TRIGGER_LOW; + ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - client->name, ihid); + irqflags | IRQF_ONESHOT, client->name, ihid); if (ret < 0) { dev_warn(&client->dev, "Could not register for %s interrupt, irq = %d,"