From: Griffin Kroah-Hartman <griffin.kroah@fairphone.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Luca Weiss <luca.weiss@fairphone.com>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 2/3] Input: aw86927 - add driver for Awinic AW86927
Date: Thu, 14 Aug 2025 09:43:26 +0200 [thread overview]
Message-ID: <d87eedaf-e239-4809-b4cf-61308d5b3a2e@fairphone.com> (raw)
In-Reply-To: <vuv26omdn4a5jniv6znepcxel65buzymu6te2ys2dgtkttk6sg@edqm6xpddudn>
Hello Dmitry!
On 8/11/25 18:35, Dmitry Torokhov wrote:
> Hi Griffin,
>
> On Mon, Aug 11, 2025 at 01:12:02PM +0200, Griffin Kroah-Hartman wrote:
(..)
>> +struct aw86927_sram_waveform_header {
>> + uint8_t version;
>> + struct {
>> + __be16 start_address;
>> + __be16 end_address;
>> + } __packed waveform_address[1];
>
> Why does this need to be an array?
Great question, during development this was used to include multiple
wave-forms, but it was decided that the feature was unnecessary as of
now. I will remove the array for simplicity.
>> +static int aw86927_haptics_play(struct input_dev *dev, void *data, struct ff_effect *effect)
>> +{
>> + struct aw86927_data *haptics = input_get_drvdata(dev);
>> + int level;
>> +
>> + level = effect->u.rumble.strong_magnitude;
>> + if (!level)
>> + level = effect->u.rumble.weak_magnitude;
>> +
>> + /* If already running, don't restart playback */
>
> Why not if effect parameters are changing? Also what if someone is
> issuing stop for already stopped effect?
It it's current state, the driver only has one level of vibration,
therefore adjusting the effect does not matter as it is either vibrating
or off.
For your second question I don't think I understand what you are asking.
If someone gives magnitude 0 to a vibration that has ceased playback,
the vibration has already stopped, so we don't need to stop it again.
>> +
>> + haptics->regmap = devm_regmap_init_i2c(client, &aw86927_regmap_config);
>> + if (IS_ERR(haptics->regmap))
>> + return dev_err_probe(haptics->dev, PTR_ERR(haptics->regmap),
>> + "Failed to allocate register map\n");
>> +
>> + haptics->input_dev = devm_input_allocate_device(haptics->dev);
>> + if (!haptics->input_dev)
>> + return -ENOMEM;
>> +
>> + haptics->reset_gpio = devm_gpiod_get(haptics->dev, "reset", GPIOD_OUT_HIGH);
>> + if (IS_ERR(haptics->reset_gpio))
>> + return dev_err_probe(haptics->dev, PTR_ERR(haptics->reset_gpio),
>> + "Failed to get reset gpio\n");
>
> Is it mandatory to wire the reset pin? I see the chip supports software
> reset so maybe this can be optional?
In the datasheet, it is never explicitly mentioned that the pin is
optional, and in the downstream driver it is mandatory.
If the reset pin is not found the probe will fail.
If somebody has a board with that use-case they can modify this driver
easily.
>> +
>> + /* Hardware reset */
>> + aw86927_hw_reset(haptics);
>> +
>> + /* Software reset */
>> + err = regmap_write(haptics->regmap, AW86927_RSTCFG, AW86927_RSTCFG_SOFTRST);
>> + if (err)
>> + return dev_err_probe(haptics->dev, PTR_ERR(haptics->regmap),
>> + "Failed Software reset\n");
>
> Do you need to issue software reset together with hardware reset? Is
> one or the other not enough?
The datasheet does not mention whether one is enough, the downstream
driver does it with both so I have assumed that this would be best
practice with this chip.
>> + err = devm_request_threaded_irq(haptics->dev, client->irq, NULL,
>> + aw86927_irq, IRQF_ONESHOT, NULL, haptics);
>
> Error handling? Also it looks like here it is safe to register the
> interrupt handler early since it does not actually do anything, but
> better to move it after the bulk of initialization in case it will get
> expanded.
I will fix the error handling :). If someone were to implement FIFO mode
then this would be the correct placement of the initialization, so I
think for now it would make sense to keep it here.
>
> Thanks.
>
Thank you for your comments!
next prev parent reply other threads:[~2025-08-14 7:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 11:12 [PATCH v2 0/3] Add support for Awinic AW86927 haptic driver Griffin Kroah-Hartman
2025-08-11 11:12 ` [PATCH v2 1/3] dt-bindings: input: Add bindings for Awinic AW86927 Griffin Kroah-Hartman
2025-08-14 8:58 ` Krzysztof Kozlowski
2025-08-11 11:12 ` [PATCH v2 2/3] Input: aw86927 - add driver " Griffin Kroah-Hartman
2025-08-11 16:35 ` Dmitry Torokhov
2025-08-14 7:43 ` Griffin Kroah-Hartman [this message]
2025-08-11 11:12 ` [PATCH v2 3/3] arm64: dts: qcom: qcm6490-fairphone-fp5: Add vibrator support Griffin Kroah-Hartman
2025-08-11 11:40 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d87eedaf-e239-4809-b4cf-61308d5b3a2e@fairphone.com \
--to=griffin.kroah@fairphone.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox