Re: [PATCH RESEND v3 2/3] Input: aw86927 - add driver for Awinic AW86927
From: Konrad Dybcio
Date: Thu Sep 25 2025 - 08:19:59 EST
On 9/25/25 12:07 PM, Griffin Kroah-Hartman wrote:
> Add support for the I2C-connected Awinic AW86927 LRA haptic driver.
>
> This driver includes a hardcoded sine waveform to be uploaded to the
> AW86927's SRAM for haptic playback.
> This driver does not currently support all the capabilities of the
> AW86927, such as F0 calibration, RTP mode, and CONT mode.
>
> Signed-off-by: Griffin Kroah-Hartman <griffin.kroah@xxxxxxxxxxxxx>
> ---
I'll give you a couple of cosmetic comments, feel free to ignore
uint8_t is abbreviated as u8 in the kernel
[...]
> +#define AW86927_PLAYCFG1_BST_MODE_MASK GENMASK(7, 7)
GENMASK(n, n) is BIT(n)
[...]
> +static int aw86927_wait_enter_standby(struct aw86927_data *haptics)
> +{
> + unsigned int reg_val;
> + int err;
"ret" is more common (for "return value")
[...]
> + switch (play_mode) {
> + case AW86927_STANDBY_MODE:
> + /* Briefly toggle standby, then toggle back to standby off */
> + err = regmap_update_bits(haptics->regmap,
> + AW86927_SYSCTRL3_REG,
> + AW86927_SYSCTRL3_STANDBY_MASK,
> + FIELD_PREP(AW86927_SYSCTRL3_STANDBY_MASK,
> + AW86927_SYSCTRL3_STANDBY_ON));
this is regmap_set_bits(regmap, register, field), you can consider
dropping the _MASK suffix too
> + if (err)
> + return err;
> +
> + err = regmap_update_bits(haptics->regmap,
> + AW86927_SYSCTRL3_REG,
> + AW86927_SYSCTRL3_STANDBY_MASK,
> + FIELD_PREP(AW86927_SYSCTRL3_STANDBY_MASK,
> + AW86927_SYSCTRL3_STANDBY_OFF));
regmap_clear_bits()
(also regmap_assign_bits() which is a conditional version of the two
is a nice piece of syntax sugar)
Konrad