[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251204-aw86938-driver-v1-2-ebd71868df3a@fairphone.com>
Date: Thu, 04 Dec 2025 13:29:01 +0100
From: Griffin Kroah-Hartman <griffin.kroah@...rphone.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>,
Luca Weiss <luca.weiss@...rphone.com>
Cc: linux-input@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
Griffin Kroah-Hartman <griffin.kroah@...rphone.com>
Subject: [PATCH 2/3] Input: aw86938 - add driver for Awinic AW86938
Add support for the I2C-connected Awinic AW86938 LRA haptic driver.
This driver is functionally similar to the AW86927. but suffers from
distortion with higher gain values.
Its vendor driver sets this value to 0x45, which fixes the problem and
does not noticeably effect the AW86927's playback.
Signed-off-by: Griffin Kroah-Hartman <griffin.kroah@...rphone.com>
---
drivers/input/misc/aw86927.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c
index abd117bb309478b3049f74e53582f06989f74e90..39e22dbdeeb7494ba1a8d4ca8fc40b5580c304f9 100644
--- a/drivers/input/misc/aw86927.c
+++ b/drivers/input/misc/aw86927.c
@@ -166,6 +166,7 @@
#define AW86927_BASEADDRH_VAL 0x08
#define AW86927_BASEADDRL_VAL 0x00
+#define AW86938_CHIPID 0x9380
enum aw86927_work_mode {
AW86927_STANDBY_MODE,
AW86927_RAM_MODE,
@@ -372,7 +373,7 @@ static int aw86927_play_sine(struct aw86927_data *haptics)
return err;
/* set gain to value lower than 0x80 to avoid distorted playback */
- err = regmap_write(haptics->regmap, AW86927_PLAYCFG2_REG, 0x7c);
+ err = regmap_write(haptics->regmap, AW86927_PLAYCFG2_REG, 0x45);
if (err)
return err;
@@ -602,6 +603,9 @@ static int aw86927_ram_init(struct aw86927_data *haptics)
FIELD_PREP(AW86927_SYSCTRL3_EN_RAMINIT_MASK,
AW86927_SYSCTRL3_EN_RAMINIT_ON));
+ /* AW86938 wants a 1ms delay here */
+ usleep_range(1000, 1500);
+
/* Set base address for the start of the SRAM waveforms */
err = regmap_write(haptics->regmap,
AW86927_BASEADDRH_REG,
@@ -724,7 +728,12 @@ static int aw86927_detect(struct aw86927_data *haptics)
chip_id = be16_to_cpu(read_buf);
- if (chip_id != AW86927_CHIPID) {
+ switch (chip_id) {
+ case AW86927_CHIPID:
+ break;
+ case AW86938_CHIPID:
+ break;
+ default:
dev_err(haptics->dev, "Unexpected CHIPID value 0x%x\n", chip_id);
return -ENODEV;
}
@@ -834,6 +843,7 @@ static int aw86927_probe(struct i2c_client *client)
static const struct of_device_id aw86927_of_id[] = {
{ .compatible = "awinic,aw86927" },
+ { .compatible = "awinic,aw86938" },
{ /* sentinel */ }
};
--
2.43.0
Powered by blists - more mailing lists