Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: aw86927 - respect vibration magnitude levels

Previously the gain value was hardcoded. Take the magnitude passed via
the input API and configure the gain register accordingly.

Signed-off-by: Griffin Kroah-Hartman <griffin.kroah@fairphone.com>
Link: https://patch.msgid.link/20260302-aw86938-driver-v4-1-92c865df9cca@fairphone.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Griffin Kroah-Hartman and committed by
Dmitry Torokhov
53ba7a47 4decd8f4

+7 -7
+7 -7
drivers/input/misc/aw86927.c
··· 180 180 struct i2c_client *client; 181 181 struct regmap *regmap; 182 182 struct gpio_desc *reset_gpio; 183 - bool running; 183 + u16 level; 184 184 }; 185 185 186 186 static const struct regmap_config aw86927_regmap_config = { ··· 325 325 if (!level) 326 326 level = effect->u.rumble.weak_magnitude; 327 327 328 - /* If already running, don't restart playback */ 329 - if (haptics->running && level) 328 + /* If level does not change, don't restart playback */ 329 + if (haptics->level == level) 330 330 return 0; 331 331 332 - haptics->running = level; 332 + haptics->level = level; 333 + 333 334 schedule_work(&haptics->play_work); 334 335 335 336 return 0; ··· 377 376 if (err) 378 377 return err; 379 378 380 - /* set gain to value lower than 0x80 to avoid distorted playback */ 381 - err = regmap_write(haptics->regmap, AW86927_PLAYCFG2_REG, 0x7c); 379 + err = regmap_write(haptics->regmap, AW86927_PLAYCFG2_REG, haptics->level * 0x80 / 0xffff); 382 380 if (err) 383 381 return err; 384 382 ··· 409 409 struct device *dev = &haptics->client->dev; 410 410 int err; 411 411 412 - if (haptics->running) 412 + if (haptics->level) 413 413 err = aw86927_play_sine(haptics); 414 414 else 415 415 err = aw86927_stop(haptics);