Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3421014yba; Mon, 29 Apr 2019 01:55:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCl2Q8ZfLTgYUAfvTDSAVEXj7jxo1SyT9o2fXUG26oobla/8uAOOI8NX2O/9Vg4jUNFu0y X-Received: by 2002:aa7:8c86:: with SMTP id p6mr35676852pfd.37.1556528110032; Mon, 29 Apr 2019 01:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556528110; cv=none; d=google.com; s=arc-20160816; b=wGT5M9T0Xns1kzc0iVUMEXPDqtddGfZOx73l1pO72GFKpP49jkv1gpxYWtgrdosTcL tm1w2nyfdKOiVg1O7PV2ie6zCoz3aJ+jgEaGwfkkUEkjtorZDLQHzm8t63hIYUejwQBA 6hYOJG4GHzuPVO3c4K89RX1MgwHC5Az/fAy0zbihBd9wr/GTGzecMTiZRWAMKH7ethlv s3pKGKi4vcm3+GmNLuSwCb8PHX+2AEnC942/f0sRWobwkhmc7QeDSPnR65k4KxMCG7m/ m1Qd8M5SuutG3xBM0ylnFM72Uq/0k0hFJjlHpNNWszwlOdZOat4XBrfMqmNU0ThXpTBy 4Z+A== 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=bIfW/+4U6pm/qHClHwco8fXWHPOvzXVyki8YHnCJ7Oo=; b=C2Bn6p6751H/Bj+3s9GxH/Gc5WLFusm/bFsZmOFXEJZ4Un7BZ+ieQIqeGsd4mIJRI2 B4MuFnbKHzifyE9zMxuMaclzFeWL/MKb7xlH35XXkiwVvdD/5RX+CwqsxWnuDA6KFrq/ 37ebDu2ZNcPXUv0FnPjZc0q3c2iTzolyXKN7JuKp3cvkdyQApOUsZSK5uvuAvVIIKYLo yM+GNe1j4FWyb2ZBScVJ7PDk147C/hNFnKEbDADjPPDN7Lsq/GlPHQytKcjTcnt78wwM ZnaRIMuK4KWaKrVqeC0m/dT7qOHGqcYk+rJXs7t+PHMFfggorxIjKbVZwCxHelJ+XYAK Z3og== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9si31022810pgh.55.2019.04.29.01.54.53; Mon, 29 Apr 2019 01:55:10 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727709AbfD2Ixw (ORCPT + 99 others); Mon, 29 Apr 2019 04:53:52 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:40205 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727554AbfD2Ixw (ORCPT ); Mon, 29 Apr 2019 04:53:52 -0400 Received: by mail-qk1-f193.google.com with SMTP id w20so5450765qka.7 for ; Mon, 29 Apr 2019 01:53:52 -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=bIfW/+4U6pm/qHClHwco8fXWHPOvzXVyki8YHnCJ7Oo=; b=EVeApaoWSXm5J1Qca6T5VRsz53VCUHWHEuap/2EFCvkXDCNfPlrlruRKNr0aunKk3t W6puadK7IS51QT6xkh3Qca55QIj06WARNyfxhU+i3Y8r98Wc5/GI8Mdm6fT21DotT7SW 5HwsnVEy2COSnVUC7znA9/7wxP2SBO7B57q5jnaL0Xjfibf0yAdXgc72LJaCvexjgYEr jcM+ZdxpnSQtjwCm+o+aSzbEkDfeFT7UIetsAjmq3kb1ltkPFiFUvGS8dAcXX2te8ocV v8+NvQ1nTtFN6quddsZ0Xm8DEbUtW9AliqQPLglBbL1q8l3M+5iOAD4eIpWGAOLEs+F2 7O+Q== X-Gm-Message-State: APjAAAVHZ2OMqJs+rXq2ZoTNkFx4vbtE4KidiHC4mnqiOLbpLnFdPbjS ni340lt0ZsMx5vb/gEvIXIukwfhZfh29rakrjpRn3Q== X-Received: by 2002:ae9:e418:: with SMTP id q24mr16707653qkc.134.1556528031629; Mon, 29 Apr 2019 01:53:51 -0700 (PDT) MIME-Version: 1.0 References: <20190422130814.GJ173520@google.com> <3a1139ef-10ed-6923-73c5-30fbf0c065c3@linux.intel.com> In-Reply-To: From: Benjamin Tissoires Date: Mon, 29 Apr 2019 10:53:40 +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" , Dmitry Torokhov , linux-pm@vger.kernel.org, linux-pci@vger.kernel.org, lkml , "open list:HID CORE LAYER" , Wolfram Sang 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 Mon, Apr 29, 2019 at 10:38 AM Jarkko Nikula wrote: > > On 4/29/19 10:45 AM, Benjamin Tissoires wrote: > >> 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? > > > > Hmm, I am not sure there is such an existing architecture you could > > use in a simple patch. > > > > rmi-driver.c does indeed create an input device we could use to toggle > > on/off the PM state, but those callbacks are not wired to the > > transport driver (rmi_smbus.c), so it would required a little bit of > > extra work. And then, there are other RMI4 functions (firmware > > upgrade) that would not be happy if PM is in suspend while there is no > > open input node. > > > I see. > > I got another thought about this. I noticed these input drivers need > SMBus Host Notify, maybe that explain the PM dependency? If that's the > only dependency then we could prevent the controller suspend if there is > a client needing host notify mechanism. IMHO that's less hack than the > patch to rmi_smbus.c. So currently, AFAIK, only Synaptics (rmi4) and Elantech are using SMBus Host Notify. So this patch would prevent the same bugs for those 2 vendors, which is good. It took me some time to understand why this would be less than a hack. And indeed, given that Host Notify relies on the I2C connection to be ready for the IRQ, we can not put the controller in suspend like we do for others where the IRQ controller is still ready. So yes, that could work from me. Not sure what Wolfram and Jean would say though. > > Keijo: care to test does this idea would fix the issue (without the > previous patch)? I also attached the diff. > > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c > index 38af18645133..d54eafad7727 100644 > --- a/drivers/i2c/i2c-core-base.c > +++ b/drivers/i2c/i2c-core-base.c > @@ -327,6 +327,8 @@ static int i2c_device_probe(struct device *dev) > > if (client->flags & I2C_CLIENT_HOST_NOTIFY) { > dev_dbg(dev, "Using Host Notify IRQ\n"); > + /* Adapter should not suspend for Host Notify */ > + pm_runtime_get_sync(&client->adapter->dev); > irq = i2c_smbus_host_notify_to_irq(client); > } else if (dev->of_node) { > irq = of_irq_get_byname(dev->of_node, "irq"); > @@ -431,6 +433,8 @@ static int i2c_device_remove(struct device *dev) > device_init_wakeup(&client->dev, false); > > client->irq = client->init_irq; > + if (client->flags & I2C_CLIENT_HOST_NOTIFY) > + pm_runtime_put(&client->adapter->dev); > > return status; > } > > > So I think this "hack" (with Mika's comments addressed) should go in > > until someone starts propagating the PM states correctly. > > > I guess you mean the Rafael's pm_runtime_get_sync() comment? Oops, yes, that one, sorry :) Cheers, Benjamin