Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3346161yba; Mon, 29 Apr 2019 00:05:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyVMi8aMo9GL99uNqV+m3IMDw9r0GOl0cvTGumFQpiG+6wRapyOZajFrQO3Aa18hQY5It6 X-Received: by 2002:a63:5149:: with SMTP id r9mr41831517pgl.177.1556521554788; Mon, 29 Apr 2019 00:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556521554; cv=none; d=google.com; s=arc-20160816; b=bWxUPV+d3Pfxb4A5IeWvyufNevp+J9M8hCfnNiYHfL2576R7ExXehoCZq/KV2lSMxH US/pQ3qB/BtgMw7rDvQ1Mx0ltBsk2sCEeVOqx8IerGRo0Ec0Lo1N+rjxEChntt+pcGIw 0h8W5K5UNF2P/18YZzYghvyRnfrbdodTOu9ULKApOFjjxIDKh3BeLG5kU4IWKhC5vFCE bXg/nrJrQn9PrRtWlKVvsl26P6a6rH74sZyDUzIpP/+eOulkNy53dDcq2wgZSYJZDXaL TpAPwx1Z0QbyYDazqPgu5r/2izaYZc5DtN4qTeXXrc+WKvn+emvgUAUrH8X328GJ3mxH hNiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=LM+MBIKe0mwYMMv3jF2FrcYhobpKYmKEZS9fGWMXsAs=; b=kguEBEemOwDRvMqmNW3EksfI1WAmcL3JYeZnOusDYvwD83T5DK/sE2oYgNVvbtp1rg bPYbleteGpTO22Ops2qRuuKsphquV7nqK6ycTO1tgjZ8ej+NyGj/uVnkPIdscf8xGmEY 3pkIRI7DdS2DQxhgUn5cRAVcMXygHvORWEMup5HoNtKbKPWpo9yPb7tNgltCFFrzAnx8 2kVnlNXJcM8iZHDZxFVCdW7e8VUoAOXOLNT8HdKazjSHoFRe9fso8AzoB3Cf6FA8TCb/ vdDsDCnsO3zq+02MdyB0Ohs8tOrm7ogIYH6fC2ZTviQDZfQ37zoXOV4lXh5c6HIfc9hT WxEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si31895120pgr.443.2019.04.29.00.05.39; Mon, 29 Apr 2019 00:05:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727501AbfD2HEW (ORCPT + 99 others); Mon, 29 Apr 2019 03:04:22 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:34249 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbfD2HEW (ORCPT ); Mon, 29 Apr 2019 03:04:22 -0400 Received: by mail-ot1-f68.google.com with SMTP id n15so1646565ota.1; Mon, 29 Apr 2019 00:04:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LM+MBIKe0mwYMMv3jF2FrcYhobpKYmKEZS9fGWMXsAs=; b=RiRDYysgBtrNzUx05AHYN94xYVKDSZZs3pqR8Au4vT170hy1bzqVdLZhV6krZ9BZ4n ZQT4DMARuTy/zYKNBucbHofZURDodgoksp7zXGixLCry1v6J1Q536bJ24pVhdWoLL7wv ihXSQHyEu6TLXB5RYJIMXqry4mYhv3HKZ8If9ImTF09189Hgp8T7qbp/goVmi+/zHZuV Uuy4UNkPqGIMbYuvwLdRy0mAbhTbgWxwP4gEcEKj3edWswOusX/QLRAbB5PFr49ObPF3 Cd8DENwLIav6Xki4JaCUncfnI7qxBQRp7gaDSF/iOX/5pFtTrEGLeLWlik6+EO3BsCDB qaKQ== X-Gm-Message-State: APjAAAXAqqiBngXOwGqWzABNHlE6oUIcrjLlXyWvz6rILV3oS5noEK+x 9tqOFy/hn/Ptemed2iK3jXkJsIv2CGlM8KypYCM= X-Received: by 2002:a9d:6e17:: with SMTP id e23mr7268147otr.65.1556521461471; Mon, 29 Apr 2019 00:04:21 -0700 (PDT) MIME-Version: 1.0 References: <20190422130814.GJ173520@google.com> <3a1139ef-10ed-6923-73c5-30fbf0c065c3@linux.intel.com> In-Reply-To: <3a1139ef-10ed-6923-73c5-30fbf0c065c3@linux.intel.com> From: "Rafael J. Wysocki" Date: Mon, 29 Apr 2019 09:04:05 +0200 Message-ID: Subject: Re: [Bug 203297] Synaptics touchpad TM-3127 functionality broken by PCI runtime power management patch on 4.20.2 To: Jarkko Nikula Cc: Bjorn Helgaas , Keijo Vaara , Jean Delvare , "Rafael J. Wysocki" , Benjamin Tissoires , Dmitry Torokhov , Linux PM , Linux PCI , Linux Kernel Mailing List , linux-input@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 2:14 PM Jarkko Nikula wrote: > > On 4/22/19 4:08 PM, Bjorn Helgaas wrote: > > https://bugzilla.kernel.org/show_bug.cgi?id=203297 > > > > Regression, suspected but as yet unconfirmed cause: > > > > c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions") > > > > backported to 4.20 stable as 39e1be324c2f. > > > With help of Keijo it was confirmed above patch broke the Synaptics > touchpad. Not bisected but touchpad works again by forcing the i2c-i801 > SMBus controller always on: > "echo on >/sys/bus/pci/devices/0000\:00\:1f.3/power/control" > > Above patch is a generalized fix that fixed the runtime PM regression on > i2c-i801 and re-allow the controller go to runtime suspend when idle. So > most probably Synaptics touchpad was broken by i2c-i801 runtime PM also > before but got unnoticed. Which is easy since on many platforms SMBus > controller doesn't necessarily have the PCI PM capabilities. > > I would like to ask help from input subsystem experts what kind of SMBus > power state dependency Synaptics RMI4 SMBus devices have since it cease > to work if SMBus controllers idles between transfers and how this is > best to fix? > > Instead of revert I think we'd need to have some method to force SMBus > controller on whenever the touchpad is active, like when there is a > userspace listening. > > I'm not expert in this area so as quick proof of concept I had a > following hack which forces the I2C/SMBus adapter, and eventually the > parent PCI device of it on when the RMI4 SMBus device is probed and let > the SMBus controller to idle when removed. > > According to Keijo it fixes the issue but I like to hear input experts > for better place to put these. > > diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c > index b6ccf39c6a7b..2b11d69be313 100644 > --- a/drivers/input/rmi4/rmi_smbus.c > +++ b/drivers/input/rmi4/rmi_smbus.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > #include > #include "rmi_driver.h" > @@ -332,6 +333,9 @@ static int rmi_smb_probe(struct i2c_client *client, > > dev_info(&client->dev, "registering SMbus-connected sensor\n"); > > + /* Force SMBus adapter on while RMI4 device is connected */ > + pm_runtime_get(&client->adapter->dev); That should be pm_runtime_get_sync() IMO. Otherwise, the rmi_register_transport_device() may be called before completing the PM transition. > + > error = rmi_register_transport_device(&rmi_smb->xport); > if (error) { > dev_err(&client->dev, "failed to register sensor: %d\n", error); > @@ -346,6 +350,7 @@ static int rmi_smb_remove(struct i2c_client *client) > struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); > > rmi_unregister_transport_device(&rmi_smb->xport); > + pm_runtime_put(&client->adapter->dev); > > return 0; > } > > -- > Jarkko