* [PATCH v4 1/6] Input: aw86927 - fix the 7 V boost reference for AW86938
2026-11-24 4:50 [PATCH v4 0/6] Input: aw86927 - add AW86937 support and fix the AW8693X layout Qianhui Xu
@ 2026-11-24 4:50 ` Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 2/6] Input: aw86927 - widen the AW86938 boost mode mask Qianhui Xu
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Qianhui Xu @ 2026-11-24 4:50 UTC (permalink / raw)
To: dmitry.torokhov
Cc: robh, krzk+dt, conor+dt, devicetree, linux-input, linux-kernel
AW86938_PLAYCFG1_BST_7000MV names 7 V, but the register encodes the boost
voltage as ((mV - 6000) / 2 * 0x8313) >> 22 + 5, so the value used since
AW86938 support was added, 0x11, selects 9 V. Program 0x09 for 7 V, the
value the vendor driver uses for these actuators.
Found while adding the AW86937 variant, which shares the register layout
and the same wrong value.
Fixes: df53055c540f ("Input: aw86927 - add support for Awinic AW86938")
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
---
drivers/input/misc/aw86927.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c
index 0657c52b4c..6d09e5e96b 100644
--- a/drivers/input/misc/aw86927.c
+++ b/drivers/input/misc/aw86927.c
@@ -47,7 +47,7 @@
#define AW86938_PLAYCFG1_BST_MODE_MASK GENMASK(5, 5)
#define AW86938_PLAYCFG1_BST_MODE_BYPASS 0
#define AW86938_PLAYCFG1_BST_VOUT_VREFSET_MASK GENMASK(4, 0)
-#define AW86938_PLAYCFG1_BST_7000MV 0x11
+#define AW86938_PLAYCFG1_BST_7000MV 0x09
#define AW86927_PLAYCFG2_REG 0x07
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v4 2/6] Input: aw86927 - widen the AW86938 boost mode mask
2026-11-24 4:50 [PATCH v4 0/6] Input: aw86927 - add AW86937 support and fix the AW8693X layout Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 1/6] Input: aw86927 - fix the 7 V boost reference for AW86938 Qianhui Xu
@ 2026-11-24 4:50 ` Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 3/6] dt-bindings: input: awinic,aw86927: document the AW86937 variant Qianhui Xu
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Qianhui Xu @ 2026-11-24 4:50 UTC (permalink / raw)
To: dmitry.torokhov
Cc: robh, krzk+dt, conor+dt, devicetree, linux-input, linux-kernel
The boost mode of the AW86938 and AW86937 is a two-bit field at bits 6:5
of PLAYCFG1, but the mask is defined as GENMASK(5, 5). When the driver
selects bypass mode it only clears bit 5 and leaves bit 6 at whatever the
bootloader left in the register, so the part may keep a boost mode that
the driver did not ask for. Widen the mask so that both bits are
programmed.
Fixes: df53055c540f ("Input: aw86927 - add support for Awinic AW86938")
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
---
drivers/input/misc/aw86927.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c
index 6d09e5e96b..b9b7315a5d 100644
--- a/drivers/input/misc/aw86927.c
+++ b/drivers/input/misc/aw86927.c
@@ -44,7 +44,7 @@
#define AW86927_PLAYCFG1_BST_8500MV 0x50
#define AW86938_PLAYCFG1_REG 0x06
-#define AW86938_PLAYCFG1_BST_MODE_MASK GENMASK(5, 5)
+#define AW86938_PLAYCFG1_BST_MODE_MASK GENMASK(6, 5)
#define AW86938_PLAYCFG1_BST_MODE_BYPASS 0
#define AW86938_PLAYCFG1_BST_VOUT_VREFSET_MASK GENMASK(4, 0)
#define AW86938_PLAYCFG1_BST_7000MV 0x09
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v4 3/6] dt-bindings: input: awinic,aw86927: document the AW86937 variant
2026-11-24 4:50 [PATCH v4 0/6] Input: aw86927 - add AW86937 support and fix the AW8693X layout Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 1/6] Input: aw86927 - fix the 7 V boost reference for AW86938 Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 2/6] Input: aw86927 - widen the AW86938 boost mode mask Qianhui Xu
@ 2026-11-24 4:50 ` Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 4/6] Input: aw86927 - add support for Awinic AW86937 Qianhui Xu
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Qianhui Xu @ 2026-11-24 4:50 UTC (permalink / raw)
To: dmitry.torokhov
Cc: robh, krzk+dt, conor+dt, devicetree, linux-input, linux-kernel,
Krzysztof Kozlowski
The AW86937 is a sibling of the AW86938 with the same register layout and
a distinct CHIPID. It is described the same way as the AW86938, with the
AW86927 compatible as fallback; software tells the parts apart by reading
the CHIPID registers.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
---
Documentation/devicetree/bindings/input/awinic,aw86927.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/input/awinic,aw86927.yaml b/Documentation/devicetree/bindings/input/awinic,aw86927.yaml
index bd74b81488..42b8f5f9e8 100644
--- a/Documentation/devicetree/bindings/input/awinic,aw86927.yaml
+++ b/Documentation/devicetree/bindings/input/awinic,aw86927.yaml
@@ -15,6 +15,7 @@ properties:
- const: awinic,aw86927
- items:
- enum:
+ - awinic,aw86937
- awinic,aw86938
- const: awinic,aw86927
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v4 4/6] Input: aw86927 - add support for Awinic AW86937
2026-11-24 4:50 [PATCH v4 0/6] Input: aw86927 - add AW86937 support and fix the AW8693X layout Qianhui Xu
` (2 preceding siblings ...)
2026-11-24 4:50 ` [PATCH v4 3/6] dt-bindings: input: awinic,aw86927: document the AW86937 variant Qianhui Xu
@ 2026-11-24 4:50 ` Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 5/6] Input: aw86927 - handle the AW8693X play and boost register layout Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 6/6] Input: aw86927 - stop playback over suspend, close and shutdown Qianhui Xu
5 siblings, 0 replies; 8+ messages in thread
From: Qianhui Xu @ 2026-11-24 4:50 UTC (permalink / raw)
To: dmitry.torokhov
Cc: robh, krzk+dt, conor+dt, devicetree, linux-input, linux-kernel,
Joonhoe Kim
The AW86937 reports CHIPID 0x9370 and is register compatible with the
AW86938 as far as the boost setup is concerned, so it joins that branch of
the haptic initialisation. Detection stays by CHIPID, so the existing
AW86927 compatible keeps working as fallback.
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
Tested-by: Joonhoe Kim <26rote@gmail.com> # Lenovo Y700 Gen 5 (TB323FU)
---
drivers/input/misc/aw86927.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c
index b9b7315a5d..699c92a1ce 100644
--- a/drivers/input/misc/aw86927.c
+++ b/drivers/input/misc/aw86927.c
@@ -146,6 +146,7 @@
#define AW86927_CHIPIDH_REG 0x57
#define AW86927_CHIPIDL_REG 0x58
#define AW86927_CHIPID 0x9270
+#define AW86937_CHIPID 0x9370
#define AW86938_CHIPID 0x9380
#define AW86927_TMCFG_REG 0x5b
@@ -182,6 +183,7 @@ enum aw86927_work_mode {
enum aw86927_model {
AW86927,
+ AW86937,
AW86938,
};
@@ -588,6 +590,7 @@ static int aw86927_haptic_init(struct aw86927_data *haptics)
if (err)
return err;
break;
+ case AW86937:
case AW86938:
err = regmap_update_bits(haptics->regmap,
AW86938_PLAYCFG1_REG,
@@ -750,6 +753,9 @@ static int aw86927_detect(struct aw86927_data *haptics)
case AW86927_CHIPID:
haptics->model = AW86927;
break;
+ case AW86937_CHIPID:
+ haptics->model = AW86937;
+ break;
case AW86938_CHIPID:
haptics->model = AW86938;
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v4 5/6] Input: aw86927 - handle the AW8693X play and boost register layout
2026-11-24 4:50 [PATCH v4 0/6] Input: aw86927 - add AW86937 support and fix the AW8693X layout Qianhui Xu
` (3 preceding siblings ...)
2026-11-24 4:50 ` [PATCH v4 4/6] Input: aw86927 - add support for Awinic AW86937 Qianhui Xu
@ 2026-11-24 4:50 ` Qianhui Xu
2026-11-24 4:50 ` [PATCH v4 6/6] Input: aw86927 - stop playback over suspend, close and shutdown Qianhui Xu
5 siblings, 0 replies; 8+ messages in thread
From: Qianhui Xu @ 2026-11-24 4:50 UTC (permalink / raw)
To: dmitry.torokhov
Cc: robh, krzk+dt, conor+dt, devicetree, linux-input, linux-kernel,
Joonhoe Kim
AW86937 and AW86938 keep the same register map as the AW86927 but move
two bits and invert the stop handshake:
- auto boost lives in bit 2 of PLAYCFG3 instead of bit 4, and the boost
mode in PLAYCFG1 is a two-bit field at bit 5 instead of bit 7;
- the VBAT mode bit taps the battery voltage instead of the software
tracked value;
- stopping is a two-step sequence: select PLAY_MODE_STOP in PLAYCFG3 and
then issue GO in PLAYCFG4, as the dedicated STOP bit does not exist
for these parts. A standby timeout after that is a real failure, so
return it instead of forcing the state machine.
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
Tested-by: Joonhoe Kim <26rote@gmail.com> # Lenovo Y700 Gen 5 (TB323FU)
---
drivers/input/misc/aw86927.c | 65 +++++++++++++++++++++++++++---------
1 file changed, 49 insertions(+), 16 deletions(-)
diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c
index 699c92a1ce..1dbcba7988 100644
--- a/drivers/input/misc/aw86927.c
+++ b/drivers/input/misc/aw86927.c
@@ -49,6 +49,14 @@
#define AW86938_PLAYCFG1_BST_VOUT_VREFSET_MASK GENMASK(4, 0)
#define AW86938_PLAYCFG1_BST_7000MV 0x09
+/*
+ * The AW8693x parts move auto-boost to bit 2 of PLAYCFG3 and stop playback
+ * by selecting the dedicated stop mode and then issuing a GO, unlike the
+ * AW86927 which has an explicit STOP bit in PLAYCFG4.
+ */
+#define AW8693X_PLAYCFG3_AUTO_BST_MASK BIT(2)
+#define AW8693X_PLAYCFG3_PLAY_MODE_STOP 3
+
#define AW86927_PLAYCFG2_REG 0x07
#define AW86927_PLAYCFG3_REG 0x08
@@ -290,9 +298,14 @@ static int aw86927_play_mode(struct aw86927_data *haptics, u8 play_mode)
err = regmap_update_bits(haptics->regmap,
AW86927_PLAYCFG1_REG,
- AW86927_PLAYCFG1_BST_MODE_MASK,
+ haptics->model == AW86927 ?
+ AW86927_PLAYCFG1_BST_MODE_MASK :
+ AW86938_PLAYCFG1_BST_MODE_MASK,
+ haptics->model == AW86927 ?
FIELD_PREP(AW86927_PLAYCFG1_BST_MODE_MASK,
- AW86927_PLAYCFG1_BST_MODE_BYPASS));
+ AW86927_PLAYCFG1_BST_MODE_BYPASS) :
+ FIELD_PREP(AW86938_PLAYCFG1_BST_MODE_MASK,
+ AW86938_PLAYCFG1_BST_MODE_BYPASS));
if (err)
return err;
@@ -300,7 +313,8 @@ static int aw86927_play_mode(struct aw86927_data *haptics, u8 play_mode)
AW86927_VBATCTRL_REG,
AW86927_VBATCTRL_VBAT_MODE_MASK,
FIELD_PREP(AW86927_VBATCTRL_VBAT_MODE_MASK,
- AW86927_VBATCTRL_VBAT_MODE_SW));
+ haptics->model == AW86927 ?
+ AW86927_VBATCTRL_VBAT_MODE_SW : 1));
if (err)
return err;
@@ -312,23 +326,38 @@ static int aw86927_play_mode(struct aw86927_data *haptics, u8 play_mode)
static int aw86927_stop(struct aw86927_data *haptics)
{
+ bool aw8693x = haptics->model != AW86927;
int err;
- err = regmap_write(haptics->regmap, AW86927_PLAYCFG4_REG, AW86927_PLAYCFG4_STOP);
+ if (aw8693x) {
+ err = regmap_update_bits(haptics->regmap, AW86927_PLAYCFG3_REG,
+ AW86927_PLAYCFG3_PLAY_MODE_MASK,
+ AW8693X_PLAYCFG3_PLAY_MODE_STOP);
+ if (err)
+ return err;
+ }
+
+ err = regmap_write(haptics->regmap, AW86927_PLAYCFG4_REG,
+ aw8693x ? AW86927_PLAYCFG4_GO : AW86927_PLAYCFG4_STOP);
if (err) {
dev_err(haptics->dev, "Failed to stop playback: %d\n", err);
return err;
}
err = aw86927_wait_enter_standby(haptics);
- if (err) {
- dev_err(haptics->dev, "Failed to enter standby, trying to force it\n");
- err = aw86927_play_mode(haptics, AW86927_STANDBY_MODE);
- if (err)
- return err;
- }
+ if (!err)
+ return 0;
- return 0;
+ /*
+ * The AW8693x reliably reaches standby through the stop mode above, so a
+ * timeout there is fatal; the AW86927 sometimes needs the nudge.
+ */
+ if (aw8693x)
+ return err;
+
+ dev_err(haptics->dev, "Failed to enter standby, trying to force it\n");
+
+ return aw86927_play_mode(haptics, AW86927_STANDBY_MODE);
}
static int aw86927_haptics_play(struct input_dev *dev, void *data, struct ff_effect *effect)
@@ -364,9 +393,13 @@ static int aw86927_play_sine(struct aw86927_data *haptics)
return err;
err = regmap_update_bits(haptics->regmap, AW86927_PLAYCFG3_REG,
- AW86927_PLAYCFG3_AUTO_BST_MASK,
+ haptics->model == AW86927 ?
+ AW86927_PLAYCFG3_AUTO_BST_MASK :
+ AW8693X_PLAYCFG3_AUTO_BST_MASK,
+ haptics->model == AW86927 ?
FIELD_PREP(AW86927_PLAYCFG3_AUTO_BST_MASK,
- AW86927_PLAYCFG3_AUTO_BST_ENABLE));
+ AW86927_PLAYCFG3_AUTO_BST_ENABLE) :
+ AW8693X_PLAYCFG3_AUTO_BST_MASK);
if (err)
return err;
@@ -604,9 +637,9 @@ static int aw86927_haptic_init(struct aw86927_data *haptics)
err = regmap_update_bits(haptics->regmap,
AW86927_PLAYCFG3_REG,
- AW86927_PLAYCFG3_AUTO_BST_MASK,
- FIELD_PREP(AW86927_PLAYCFG3_AUTO_BST_MASK,
- AW86927_PLAYCFG3_AUTO_BST_DISABLE));
+ haptics->model == AW86927 ?
+ AW86927_PLAYCFG3_AUTO_BST_MASK :
+ AW8693X_PLAYCFG3_AUTO_BST_MASK, 0);
if (err)
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v4 6/6] Input: aw86927 - stop playback over suspend, close and shutdown
2026-11-24 4:50 [PATCH v4 0/6] Input: aw86927 - add AW86937 support and fix the AW8693X layout Qianhui Xu
` (4 preceding siblings ...)
2026-11-24 4:50 ` [PATCH v4 5/6] Input: aw86927 - handle the AW8693X play and boost register layout Qianhui Xu
@ 2026-11-24 4:50 ` Qianhui Xu
2026-12-04 21:20 ` Joonhoe Kim
5 siblings, 1 reply; 8+ messages in thread
From: Qianhui Xu @ 2026-11-24 4:50 UTC (permalink / raw)
To: dmitry.torokhov
Cc: robh, krzk+dt, conor+dt, devicetree, linux-input, linux-kernel
Playback is not stopped across system sleep, device close and shutdown:
an effect that is being played when the system suspends keeps the chip
driving the actuator, a memless effect whose timer fires around close()
restarts playback on a device nobody has open, and nothing holds the chip
in reset on shutdown or unbind.
Park the chip in standby on suspend, refuse new effects while the device
is closed or suspended, and assert reset on shutdown. The work item is
drained from a devres action so it also runs on unbind, where
input_close_device() is skipped for an inhibited device and the memless
effect timer can queue play_work again; that action also covers shutdown.
Suspend parks the chip in standby without asserting reset, and resume
only clears the suspend flag: the chip is left in standby with its SRAM
initialised, which is the state probe leaves it in. Shutdown asserts
reset without a separate stop.
Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
---
drivers/input/misc/aw86927.c | 120 ++++++++++++++++++++++++++++++++---
1 file changed, 112 insertions(+), 8 deletions(-)
diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c
index 1dbcba7988..9ffea6a2bc 100644
--- a/drivers/input/misc/aw86927.c
+++ b/drivers/input/misc/aw86927.c
@@ -14,6 +14,7 @@
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/module.h>
+#include <linux/pm.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/types.h>
@@ -203,6 +204,8 @@ struct aw86927_data {
struct i2c_client *client;
struct regmap *regmap;
struct gpio_desc *reset_gpio;
+ bool suspended;
+ bool enabled;
u16 level;
};
@@ -365,22 +368,30 @@ static int aw86927_haptics_play(struct input_dev *dev, void *data, struct ff_eff
struct aw86927_data *haptics = input_get_drvdata(dev);
int level;
+ /*
+ * Ignore new effects while the chip is parked in standby (suspended) or
+ * while nobody has the device open: a queued effect would either fail or
+ * restart playback that close() already stopped.
+ */
+ if (READ_ONCE(haptics->suspended) || !READ_ONCE(haptics->enabled))
+ return 0;
+
level = effect->u.rumble.strong_magnitude;
if (!level)
level = effect->u.rumble.weak_magnitude;
/* If level does not change, don't restart playback */
- if (haptics->level == level)
+ if (READ_ONCE(haptics->level) == level)
return 0;
- haptics->level = level;
+ WRITE_ONCE(haptics->level, level);
schedule_work(&haptics->play_work);
return 0;
}
-static int aw86927_play_sine(struct aw86927_data *haptics)
+static int aw86927_play_sine(struct aw86927_data *haptics, u16 level)
{
int err;
@@ -425,7 +436,8 @@ static int aw86927_play_sine(struct aw86927_data *haptics)
if (err)
return err;
- err = regmap_write(haptics->regmap, AW86927_PLAYCFG2_REG, haptics->level * 0x80 / 0xffff);
+ err = regmap_write(haptics->regmap, AW86927_PLAYCFG2_REG,
+ level * 0x80 / 0xffff);
if (err)
return err;
@@ -437,12 +449,33 @@ static int aw86927_play_sine(struct aw86927_data *haptics)
return 0;
}
+static int aw86927_open(struct input_dev *input)
+{
+ struct aw86927_data *haptics = input_get_drvdata(input);
+
+ WRITE_ONCE(haptics->enabled, true);
+
+ return 0;
+}
+
static void aw86927_close(struct input_dev *input)
{
struct aw86927_data *haptics = input_get_drvdata(input);
struct device *dev = &haptics->client->dev;
int err;
+ /*
+ * Stop accepting effects before draining the work: the memless effect
+ * timer runs from a softirq, and clearing the level without blocking
+ * aw86927_haptics_play() would let the next tick see a level change and
+ * queue play_work again. input core calls close() with
+ * input_dev->mutex held, so this cannot interleave with a new open().
+ */
+ scoped_guard(spinlock_irq, &input->event_lock) {
+ WRITE_ONCE(haptics->enabled, false);
+ WRITE_ONCE(haptics->level, 0);
+ }
+
cancel_work_sync(&haptics->play_work);
err = aw86927_stop(haptics);
@@ -455,10 +488,11 @@ static void aw86927_haptics_play_work(struct work_struct *work)
struct aw86927_data *haptics =
container_of(work, struct aw86927_data, play_work);
struct device *dev = &haptics->client->dev;
+ u16 level = READ_ONCE(haptics->level);
int err;
- if (haptics->level)
- err = aw86927_play_sine(haptics);
+ if (level)
+ err = aw86927_play_sine(haptics, level);
else
err = aw86927_stop(haptics);
@@ -800,6 +834,20 @@ static int aw86927_detect(struct aw86927_data *haptics)
return 0;
}
+static void aw86927_reset(void *data)
+{
+ struct aw86927_data *haptics = data;
+
+ /*
+ * Drain the worker before the regmap can go away: this action also runs
+ * from devres on unbind, where input_close_device() may have been skipped
+ * (inhibited device) and the memless effect timer can have queued the
+ * work again.
+ */
+ disable_work_sync(&haptics->play_work);
+ gpiod_set_value_cansleep(haptics->reset_gpio, 1);
+}
+
static int aw86927_probe(struct i2c_client *client)
{
struct aw86927_data *haptics;
@@ -828,6 +876,17 @@ static int aw86927_probe(struct i2c_client *client)
return dev_err_probe(haptics->dev, PTR_ERR(haptics->reset_gpio),
"Failed to get reset gpio\n");
+ /*
+ * The work item must exist before the devres action below can be run: any
+ * later failure in probe makes devres call aw86927_reset(), which drains
+ * play_work.
+ */
+ INIT_WORK(&haptics->play_work, aw86927_haptics_play_work);
+
+ err = devm_add_action_or_reset(haptics->dev, aw86927_reset, haptics);
+ if (err)
+ return err;
+
/* Hardware reset */
aw86927_hw_reset(haptics);
@@ -865,9 +924,8 @@ static int aw86927_probe(struct i2c_client *client)
if (err)
return dev_err_probe(haptics->dev, err, "Failed to request threaded irq\n");
- INIT_WORK(&haptics->play_work, aw86927_haptics_play_work);
-
haptics->input_dev->name = "aw86927-haptics";
+ haptics->input_dev->open = aw86927_open;
haptics->input_dev->close = aw86927_close;
input_set_drvdata(haptics->input_dev, haptics);
@@ -899,6 +957,50 @@ static int aw86927_probe(struct i2c_client *client)
return 0;
}
+static void aw86927_shutdown(struct i2c_client *client)
+{
+ struct aw86927_data *haptics = i2c_get_clientdata(client);
+
+ aw86927_reset(haptics);
+}
+
+static int aw86927_suspend(struct device *dev)
+{
+ struct aw86927_data *haptics = dev_get_drvdata(dev);
+ int err;
+
+ guard(mutex)(&haptics->input_dev->mutex);
+
+ /* Block events from the memless effect timer before draining the work. */
+ scoped_guard(spinlock_irq, &haptics->input_dev->event_lock)
+ haptics->suspended = true;
+
+ cancel_work_sync(&haptics->play_work);
+ err = aw86927_stop(haptics);
+
+ scoped_guard(spinlock_irq, &haptics->input_dev->event_lock) {
+ if (err)
+ haptics->suspended = false;
+ else
+ WRITE_ONCE(haptics->level, 0);
+ }
+
+ return err;
+}
+
+static int aw86927_resume(struct device *dev)
+{
+ struct aw86927_data *haptics = dev_get_drvdata(dev);
+
+ guard(mutex)(&haptics->input_dev->mutex);
+ guard(spinlock_irq)(&haptics->input_dev->event_lock);
+ haptics->suspended = false;
+
+ return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(aw86927_pm_ops, aw86927_suspend, aw86927_resume);
+
static const struct of_device_id aw86927_of_id[] = {
{ .compatible = "awinic,aw86927" },
{ /* sentinel */ }
@@ -910,8 +1012,10 @@ static struct i2c_driver aw86927_driver = {
.driver = {
.name = "aw86927-haptics",
.of_match_table = aw86927_of_id,
+ .pm = pm_sleep_ptr(&aw86927_pm_ops),
},
.probe = aw86927_probe,
+ .shutdown = aw86927_shutdown,
};
module_i2c_driver(aw86927_driver);
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v4 6/6] Input: aw86927 - stop playback over suspend, close and shutdown
2026-11-24 4:50 ` [PATCH v4 6/6] Input: aw86927 - stop playback over suspend, close and shutdown Qianhui Xu
@ 2026-12-04 21:20 ` Joonhoe Kim
0 siblings, 0 replies; 8+ messages in thread
From: Joonhoe Kim @ 2026-12-04 21:20 UTC (permalink / raw)
To: Qianhui Xu
Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
devicetree, linux-input, linux-kernel
On Tue, 24 Nov 2026 12:50:40 +0800, Qianhui Xu wrote:
> Park the chip in standby on suspend, refuse new effects while the device
> is closed or suspended, and assert reset on shutdown.
Tested v4 on a Lenovo Y700 Gen 5 (TB323FU, Kaanapali) with two AW86937,
on v7.3 with the whole series applied:
- a 5 s rumble on both motors stops when the device is closed after 1 s;
- a 10 s rumble stops when the system enters s2idle and does not come
back after resume;
- short rumbles work on both motors before and after s2idle.
Tested-by: Joonhoe Kim <26rote@gmail.com> # Lenovo Y700 Gen 5 (TB323FU)
^ permalink raw reply [flat|nested] 8+ messages in thread