linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	Keijo Vaara <ferdasyn@rocketmail.com>,
	Jean Delvare <jdelvare@suse.de>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-pm@vger.kernel.org, linux-pci@vger.kernel.org,
	lkml <linux-kernel@vger.kernel.org>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>
Subject: Re: [Bug 203297] Synaptics touchpad TM-3127 functionality broken by PCI runtime power management patch on 4.20.2
Date: Mon, 29 Apr 2019 11:36:16 +0300	[thread overview]
Message-ID: <e96a7220-974f-1df6-70ee-695ee815057f@linux.intel.com> (raw)
In-Reply-To: <CAO-hwJKvXO6L7m0g1D6wycFP=Wu_qLDyLXTtmm0TkpxT5Z8ygw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]

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.

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?

-- 
Jarkko

[-- Attachment #2: i2c-core-host-notify-pm.diff --]
[-- Type: text/x-patch, Size: 830 bytes --]

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;
 }

  reply	other threads:[~2019-04-29  8:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190422130814.GJ173520@google.com>
2019-04-26 12:12 ` [Bug 203297] Synaptics touchpad TM-3127 functionality broken by PCI runtime power management patch on 4.20.2 Jarkko Nikula
2019-04-29  7:04   ` Rafael J. Wysocki
2019-04-29  7:45   ` Benjamin Tissoires
2019-04-29  8:36     ` Jarkko Nikula [this message]
2019-04-29  8:53       ` Benjamin Tissoires
2019-04-29  9:45         ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e96a7220-974f-1df6-70ee-695ee815057f@linux.intel.com \
    --to=jarkko.nikula@linux.intel.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ferdasyn@rocketmail.com \
    --cc=helgaas@kernel.org \
    --cc=jdelvare@suse.de \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).