From patchwork Tue Jul 7 10:01:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriele Mazzotta X-Patchwork-Id: 6731761 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BD0559F2F0 for ; Tue, 7 Jul 2015 10:01:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BEC8520503 for ; Tue, 7 Jul 2015 10:01:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADCB72051A for ; Tue, 7 Jul 2015 10:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755460AbbGGKBd (ORCPT ); Tue, 7 Jul 2015 06:01:33 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:33456 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753796AbbGGKBc (ORCPT ); Tue, 7 Jul 2015 06:01:32 -0400 Received: by wgck11 with SMTP id k11so163234598wgc.0 for ; Tue, 07 Jul 2015 03:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; bh=WnUhEkxxdeZB2TTEVH9Wf2uI5N8feX6J7Lm0OA+Yc8E=; b=ihXqWO9ycTCI9DjD5YeWlx5WNNct0aDJSZWlHX67tsp5IQVtxbSSHm0Q9eHBI/BcQj F9xdkCIIW3Bd3Am9ItzsFYpkq9tXF5RCCTsg41l7PWEVkLxCVefQ3u3ihea8SkbSYZ7e exG+/715phsQnKofyCqvkvAMAo/BsvvFJ3Qyl5lJJw9k2+iueZ02m5JnhDaSfrrL2bkP SHEpQs4ABFfIDm5V2EAc9/qjUMmgMrBb6LVBXS1BwZrjDOynC7b7ZdJzmTvHlALauf17 zJGAYeQM4UtoHnh5Fg7mRIPZGJz7JdLp1mkZsSD/1uhS2funKA+9bWDhCTizE1KMyykg yl0A== X-Received: by 10.194.52.37 with SMTP id q5mr7383841wjo.122.1436263291128; Tue, 07 Jul 2015 03:01:31 -0700 (PDT) Received: from hostprova (2-235-140-64.ip228.fastwebnet.it. [2.235.140.64]) by mx.google.com with ESMTPSA id qq1sm32542743wjc.0.2015.07.07.03.01.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 03:01:30 -0700 (PDT) From: Gabriele Mazzotta To: Andrew Duggan Cc: linux-input@vger.kernel.org, benjamin.tissoires@redhat.com, jkosina@suse.cz Subject: Re: hid-rmi: configuration automatically changed after suspend/resume Date: Tue, 07 Jul 2015 12:01:29 +0200 Message-ID: <2572052.srFcAdtYRh@xps13> In-Reply-To: <559B13AD.50103@synaptics.com> References: <1463383.73UKVcFjqX@xps13> <559B13AD.50103@synaptics.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Monday 06 July 2015 16:47:57 Andrew Duggan wrote: > Hi Gabriele, > > On 07/06/2015 03:20 AM, Gabriele Mazzotta wrote: > > Hi, > > > > I recently noticed that there's a minor issue with hid-rmi.c. After a > > suspend/resume cycle the f11 control register is set to the default > > configuration, thus undoing the changes performed on init. > > This is because i2c_hid does a reset of the touchpad during resume. > Power cycles or resets will clear the changes to the control registers. > There isn't a way to make these changes persistent without changing the > firmware. OK, I suspected this was what was happening. > > I made some changes to the driver to prevent this from happening: the > > configuration is saved on suspend and restored upon resume. This seemed > > the simplest thing to do, but I encountered a small problem. > > I haven't been able to successfully complete reads which I perform in > the suspend callback. They end up timing out waiting for the response. > Maybe this is only an issue on certain platforms if this is working for you. I have the same problem and I solved it with the following patch. Please see if it works for you as well: From 654156ae5ed496daba792b4231858c788712df15 Mon Sep 17 00:00:00 2001 From: Gabriele Mazzotta Date: Sat, 27 Jun 2015 16:29:45 +0200 Subject: [PATCH] hid: i2c-hid - call suspend callback before disabling irq This will make possible to perform operations from the device suspend callback that needs the irq to be enabled. reviewed-by: Benjamin Tissoires --- drivers/hid/i2c-hid/i2c-hid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index f77469d..9ed69b5 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -1092,13 +1092,13 @@ static int i2c_hid_suspend(struct device *dev) struct hid_device *hid = ihid->hid; int ret = 0; + if (hid->driver && hid->driver->suspend) + ret = hid->driver->suspend(hid, PMSG_SUSPEND); + disable_irq(ihid->irq); if (device_may_wakeup(&client->dev)) enable_irq_wake(ihid->irq); - if (hid->driver && hid->driver->suspend) - ret = hid->driver->suspend(hid, PMSG_SUSPEND); - /* Save some power */ i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);