All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 01/19] platform/x86: hp_accel: Avoid invoking _INI to speed up resume
@ 2021-05-24 14:50 Sasha Levin
  2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 02/19] serial: max310x: unregister uart driver in case of failure and abort Sasha Levin
                   ` (17 more replies)
  0 siblings, 18 replies; 24+ messages in thread
From: Sasha Levin @ 2021-05-24 14:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kai-Heng Feng, Éric Piel, Hans de Goede, Sasha Levin,
	platform-driver-x86

From: Kai-Heng Feng <kai.heng.feng@canonical.com>

[ Upstream commit 79d341e26ebcdbc622348aaaab6f8f89b6fdb25f ]

hp_accel can take almost two seconds to resume on some HP laptops.

The bottleneck is on evaluating _INI, which is only needed to run once.

Resolve the issue by only invoking _INI when it's necessary. Namely, on
probe and on hibernation restore.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Éric Piel <eric.piel@trempplin-utc.net>
Link: https://lore.kernel.org/r/20210430060736.590321-1-kai.heng.feng@canonical.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/lis3lv02d/lis3lv02d.h |  1 +
 drivers/platform/x86/hp_accel.c    | 22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/lis3lv02d/lis3lv02d.h b/drivers/misc/lis3lv02d/lis3lv02d.h
index c439c827eea8..0ef759671b54 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.h
+++ b/drivers/misc/lis3lv02d/lis3lv02d.h
@@ -284,6 +284,7 @@ struct lis3lv02d {
 	int			regs_size;
 	u8                      *reg_cache;
 	bool			regs_stored;
+	bool			init_required;
 	u8                      odr_mask;  /* ODR bit mask */
 	u8			whoami;    /* indicates measurement precision */
 	s16 (*read_data) (struct lis3lv02d *lis3, int reg);
diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
index abd9d83f6009..403d966223ee 100644
--- a/drivers/platform/x86/hp_accel.c
+++ b/drivers/platform/x86/hp_accel.c
@@ -101,6 +101,9 @@ MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids);
 static int lis3lv02d_acpi_init(struct lis3lv02d *lis3)
 {
 	struct acpi_device *dev = lis3->bus_priv;
+	if (!lis3->init_required)
+		return 0;
+
 	if (acpi_evaluate_object(dev->handle, METHOD_NAME__INI,
 				 NULL, NULL) != AE_OK)
 		return -EINVAL;
@@ -366,6 +369,7 @@ static int lis3lv02d_add(struct acpi_device *device)
 	}
 
 	/* call the core layer do its init */
+	lis3_dev.init_required = true;
 	ret = lis3lv02d_init_device(&lis3_dev);
 	if (ret)
 		return ret;
@@ -413,11 +417,27 @@ static int lis3lv02d_suspend(struct device *dev)
 
 static int lis3lv02d_resume(struct device *dev)
 {
+	lis3_dev.init_required = false;
+	lis3lv02d_poweron(&lis3_dev);
+	return 0;
+}
+
+static int lis3lv02d_restore(struct device *dev)
+{
+	lis3_dev.init_required = true;
 	lis3lv02d_poweron(&lis3_dev);
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(hp_accel_pm, lis3lv02d_suspend, lis3lv02d_resume);
+static const struct dev_pm_ops hp_accel_pm = {
+	.suspend = lis3lv02d_suspend,
+	.resume = lis3lv02d_resume,
+	.freeze = lis3lv02d_suspend,
+	.thaw = lis3lv02d_resume,
+	.poweroff = lis3lv02d_suspend,
+	.restore = lis3lv02d_restore,
+};
+
 #define HP_ACCEL_PM (&hp_accel_pm)
 #else
 #define HP_ACCEL_PM NULL
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-05-24 19:05 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 14:50 [PATCH AUTOSEL 4.9 01/19] platform/x86: hp_accel: Avoid invoking _INI to speed up resume Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 02/19] serial: max310x: unregister uart driver in case of failure and abort Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 03/19] net: fujitsu: fix potential null-ptr-deref Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 04/19] net: caif: remove BUG_ON(dev == NULL) in caif_xmit Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 05/19] char: hpet: add checks after calling ioremap Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 06/19] ALSA: sb8: Add a comment note regarding an unused pointer Sasha Levin
2021-05-24 14:50   ` Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 07/19] isdn: mISDNinfineon: check/cleanup ioremap failure correctly in setup_io Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 08/19] ath6kl: return error code in ath6kl_wmi_set_roam_lrssi_cmd() Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 09/19] dmaengine: qcom_hidma: comment platform_driver_register call Sasha Levin
2021-05-24 14:50   ` Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 10/19] libertas: register sysfs groups properly Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 11/19] media: dvb: Add check on sp8870_readreg return Sasha Levin
2021-05-24 14:50 ` [PATCH AUTOSEL 4.9 12/19] media: gspca: mt9m111: Check write_bridge for timeout Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.9 13/19] media: gspca: properly check for errors in po1030_probe() Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.9 14/19] cdrom: gdrom: initialize global variable at init time Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.9 15/19] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.9 16/19] openrisc: Define memory barrier mb Sasha Levin
2021-05-24 14:51   ` [OpenRISC] " Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.9 17/19] btrfs: do not BUG_ON in link_to_fixup_dir Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.9 18/19] platform/x86: intel_punit_ipc: Append MODULE_DEVICE_TABLE for ACPI Sasha Levin
2021-05-24 14:51 ` [PATCH AUTOSEL 4.9 19/19] drm/amdgpu: Fix a use-after-free Sasha Levin
2021-05-24 14:51   ` Sasha Levin
2021-05-24 14:51   ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.