From patchwork Wed Sep 7 09:30:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 9318703 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 351EB601C0 for ; Wed, 7 Sep 2016 09:30:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F01DD291BC for ; Wed, 7 Sep 2016 09:30:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2BBB291BE; Wed, 7 Sep 2016 09:30:28 +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=-4.4 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 609D9291BC for ; Wed, 7 Sep 2016 09:30:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753019AbcIGJa1 (ORCPT ); Wed, 7 Sep 2016 05:30:27 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36782 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750873AbcIGJa0 (ORCPT ); Wed, 7 Sep 2016 05:30:26 -0400 Received: by mail-wm0-f66.google.com with SMTP id l65so1983798wmf.3 for ; Wed, 07 Sep 2016 02:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=FumQn0gOJtSGIjfLITS5TmgptG/HfUakQmv3j3v3gW4=; b=wmHZnx2Z2vi1pLzNRI+A6r1krsSZYE0jxf1WyVj11tyId411tmI4xxC82WRoQOiLNu 45JWr8rYna74t7oaea2zsoajtx8bFTAu0brrtWBMhgjNPtR1LCH6eFvpKb9OfgN6L7m/ 8XpO6ji7M6HQTJjG5uDtvl7e0L4lqZh3xFUnImi+leIsuV0IJgLDR0lq/p2lN8BB941m 77Hv8OG5EmJzpLl9ejNW5ZGfe0gbuzg40sFbYWWGS2nKh6zZPxzITQkPKyhPUj89uAzj lf19KAxr8UhS2X0FuWxdL9sRmWniY4rRqO+q/4uIHcZh6KINM0RiLzIZUchVaEY7P+J0 W7kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=FumQn0gOJtSGIjfLITS5TmgptG/HfUakQmv3j3v3gW4=; b=Sjxa30AD1PFYrgZ+pisF+9qzrqFsChmpTFozSsGRvDnsZikp4t6q4jDznngHPXigWf 34owxDzWYq6hmi7VWPduvXuSDJn6kZQadutbODVIeuASUxLEjsd6WlKjr7t2KlZOXqJb y9/pHgZoAUrm2Ujp/owj7EWrD8fFl2YGxBx1ufAOq/Mc65/Rr7AKI/CqFgqsfSgV7+V1 gf0wRLjB3vhOZ28R42EYoVxI8gTx95/C4gow23YL+URVvKiv5ivc057Asy7RtPLZL7bF Bzdi1hd34F2owff3aMSQM0andAOg8saIUUjtcczge1dyT/wa5XuKGOboZYSMl7v3MUAD O46A== X-Gm-Message-State: AE9vXwOdFfjR/0sL9HJmeOrHc6wZaQgvEdw4IsIR2XfWEOjpbX+wlrBlSyBRjHO0TmFdtw== X-Received: by 10.194.115.38 with SMTP id jl6mr39945129wjb.28.1473240624575; Wed, 07 Sep 2016 02:30:24 -0700 (PDT) Received: from plouf.banquise.eu (gra33-3-88-180-253-3.fbx.proxad.net. [88.180.253.3]) by smtp.googlemail.com with ESMTPSA id z17sm3224497wmz.23.2016.09.07.02.30.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Sep 2016 02:30:23 -0700 (PDT) Subject: Re: PROBLEM: i2c_hid: probe of i2c-ELAN0732:00 failed with error -61 To: Colin Johnstone References: <1473200056.6178.1.camel@gmail.com> Cc: Dmitry Torokhov , linux-input From: Benjamin Tissoires Message-ID: <3d89b80c-d211-11ba-a3c5-a1c6e754f1e1@gmail.com> Date: Wed, 7 Sep 2016 11:30:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1473200056.6178.1.camel@gmail.com> 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 On 09/07/2016 12:14 AM, Colin Johnstone wrote: > On Mon, 2016-09-05 at 12:19 +0200, Benjamin Tissoires wrote: >> > Hi Colin, >> > >> > On Sat, Sep 3, 2016 at 8:33 PM, Colin Johnstone >> > wrote: >>> > > >>> > > [1.] One line summary of the problem: Touchscreen does not work, >>> > > dmesg >>> > > shows errors "i2c_hid i2c-ELAN0732:00: failed to reset device", >>> > > "i2c_hid i2c-ELAN0732:00: can't add hid device: -61", and "i2c_hid: >>> > > probe of i2c-ELAN0732:00 failed with error -61" occur during boot. >> > >> > -61 is -ENODATA, which is raised when we timed-out when waiting for >> > the interrupt line. >> > >> > To confirm this, please provide a dmesg from the boot with >> > i2c_hid.debug=1 appended to the kernel command line. >> > >>> > > >>> > > >>> > > [2.] Full description of the problem/report: This is on an HP Eny >>> > > x360 >>> > > M6-AR004DX laptop with 7th-generation AMD FX CPU. The touchscreen >>> > > is >>> > > not recognized at all; it appears the screen is using GPIO >>> > > interrupts >>> > > as I have to build with AMD GPIO support to receive these errors, >>> > > otherwise I see a "failed to get GPIO interrupt" error. >>> > > >> > >> > So this is more likely either a failure of us retrieving the GPIO, or >> > a misconfiguration of those. I'd be interested if you could share the >> > output of acpidump (as root) as well. >> > >> > Cheers, >> > Benjamin > My apologies, the previous dmesg output was incorrect. I had an issue > with my grub config and was booting the wrong kernel build. Here's the > correct output, with AMD GPIO support: Thanks for the updated dmesg. So it looks like the interrupt is never served, which leads to timeout while resetting the device. The question now is: are we enabling the GPIO as Interrupt properly or is the bug in AMD GPIO? Could you try applying the following patch? It should retrieve the information of level trigger from ACPI which might help (though I have no big hope): --- commit ebdb645c5cbf70c745527169c99b82c01e74231e Author: Benjamin Tissoires Date: Wed Sep 7 10:59:58 2016 +0200 HID: i2c-hid: retrieve the GPIO parameters from ACPI Instead of forcing the level triggers of the GPIO INT, we can count on ACPI to set it up for us. *NOTE: this currently breaks other Int sources than GpioInt* Signed-off-by: Benjamin Tissoires --- I couldn't find a working device in your DSDT that would be using the GPIO from your chip (HPQ6007 seemed a good candidate, but it fails probing at a different step). Cheers, Benjamin -- 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/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index d0b1355..feacd9f 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -145,7 +145,6 @@ struct i2c_hid { unsigned long flags; /* device flags */ wait_queue_head_t wait; /* For waiting the interrupt */ - struct gpio_desc *desc; int irq; struct i2c_hid_platform_data pdata; @@ -819,9 +818,8 @@ static int i2c_hid_init_irq(struct i2c_client *client) dev_dbg(&client->dev, "Requesting IRQ: %d\n", ihid->irq); - ret = request_threaded_irq(ihid->irq, NULL, i2c_hid_irq, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - client->name, ihid); + ret = request_threaded_irq(ihid->irq, NULL, i2c_hid_irq, IRQF_ONESHOT, + client->name, ihid); if (ret < 0) { dev_warn(&client->dev, "Could not register for %s interrupt, irq = %d," @@ -1021,16 +1019,9 @@ static int i2c_hid_probe(struct i2c_client *client, if (client->irq > 0) { ihid->irq = client->irq; } else if (ACPI_COMPANION(&client->dev)) { - ihid->desc = gpiod_get(&client->dev, NULL, GPIOD_IN); - if (IS_ERR(ihid->desc)) { - dev_err(&client->dev, "Failed to get GPIO interrupt\n"); - return PTR_ERR(ihid->desc); - } - - ihid->irq = gpiod_to_irq(ihid->desc); + ihid->irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(&client->dev), 0); if (ihid->irq < 0) { - gpiod_put(ihid->desc); - dev_err(&client->dev, "Failed to convert GPIO to IRQ\n"); + dev_err(&client->dev, "Failed to request IRQ\n"); return ihid->irq; } } @@ -1108,9 +1099,6 @@ err_pm: pm_runtime_disable(&client->dev); err: - if (ihid->desc) - gpiod_put(ihid->desc); - i2c_hid_free_buffers(ihid); kfree(ihid); return ret; @@ -1134,9 +1122,6 @@ static int i2c_hid_remove(struct i2c_client *client) if (ihid->bufsize) i2c_hid_free_buffers(ihid); - if (ihid->desc) - gpiod_put(ihid->desc); - kfree(ihid); acpi_dev_remove_driver_gpios(ACPI_COMPANION(&client->dev));