From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: guptarud@gmail.com, Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: dts: qcom: msm8960: expressatt Add PWM vibrator
Date: Tue, 16 Dec 2025 15:22:30 +0100 [thread overview]
Message-ID: <821a7dc3-7b00-40d1-9332-ef57ad22f9ca@oss.qualcomm.com> (raw)
In-Reply-To: <20251211-expressatt-vibrator-v1-1-41bdc47217b2@gmail.com>
On 12/11/25 11:23 AM, Rudraksha Gupta via B4 Relay wrote:
> From: Rudraksha Gupta <guptarud@gmail.com>
>
> Add a pwm-vibrator to expressatt. Currently this vibrates only at 100%
>
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
> Add a pwm-vibrator to expressatt. Currently this vibrates only at 100%
>
> Link:
> - https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-express.c#L1767
> - https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/motor/Makefile#L5
>
> Test:
> =====================
> samsung-expressatt:~$ dmesg | grep vibra
> [ 79.892226] input: pwm-vibrator as /devices/platform/vibrator/input/input4
> samsung-expressatt:~$ fftest /dev/input/event4
> Force feedback test program.
> HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES
>
> Device /dev/input/event4 opened
> Features:
> * Absolute axes:
> [00 00 00 00 00 00 00 00 ]
> * Relative axes:
> [00 00 ]
> * Force feedback effects types: Periodic, Rumble, Gain,
> Force feedback periodic effects: Square, Triangle, Sine,
> [00 00 00 00 00 00 00 00 00 00 03 07 01 00 00 00 ]
> * Number of simultaneous effects: 16
>
> Setting master gain to 75% ... OK
> Uploading effect #0 (Periodic sinusoidal) ... OK (id 0)
> Uploading effect #1 (Constant) ... Error: Invalid argument
> Uploading effect #2 (Spring) ... Error: Invalid argument
> Uploading effect #3 (Damper) ... Error: Invalid argument
Looks like this is because GP1_CLK does not implement .set_duty_cycle..
The downstream driver you linked to does so in a terribly hacky way
(from the vibrator driver and not the clock driver):
https://github.com/LineageOS/android_kernel_samsung_d2/blob/cm-14.1/drivers/motor/immvibespi.c#L53
Upstream, we have an implementation for clk_rcg*2*_ops, whereas 8960
uses clk_rcg_ops.
They look very similar though, perhaps you can hack it up..
One thing to note is that you're passing GP1_CLK to the clk-pwm (as
you should), but we need to do clk_set_duty_cycle on its parent,
GP1_CLK*_SRC*. The framework will take care of this:
```
--- drivers/clk/clk.c
if (!core->ops->get_duty_cycle)
return clk_core_update_duty_cycle_parent_nolock(core);
```
so long as you add CLK_DUTY_CYCLE_PARENT to the child
[...]
> + /* TODO: Vary the frequency besides being 0% or 100% */
> + vibrator {
> + compatible = "pwm-vibrator";
> + pwms = <&gp1_pwm 0 54347 0>; /* ~18.4 kHz */
> + pwm-names = "enable";
> + enable-gpios = <&pm8921_gpio 4 GPIO_ACTIVE_HIGH>;
> + vcc-supply = <&vdd_haptics>;
> +
> + pinctrl-names = "default";
> + pinctrl-0 = <&vib_pwm_gpio>;
pinctrl-n
pinctrl-names
please, both occurences
> + };
> +
> + vdd_haptics: vdd-haptics-regulator {
> + compatible = "regulator-fixed";
> + regulator-name = "vdd_haptics";
> + gpio = <&tlmm 47 GPIO_ACTIVE_HIGH>;
> + enable-active-high;
> + regulator-boot-on;
> +
> + pinctrl-names = "default";
> + pinctrl-0 = <&haptics_pwr_en>;
> + };
> };
>
> &gsbi2 {
> @@ -241,6 +270,21 @@ touchkey_i2c_pins: touchkey-i2c-state {
> bias-disable;
> };
>
> + haptics_pwr_en: haptics-pwr-en-state {
> + pins = "gpio47";
> + function = "gpio";
> + drive-strength = <2>;
> + bias-disable;
> + output-low;
Drop output-low, the driver should take care of setting the state
Konrad
next prev parent reply other threads:[~2025-12-16 14:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 10:23 Rudraksha Gupta via B4 Relay
2025-12-16 14:22 ` Konrad Dybcio [this message]
2026-01-29 7:55 ` Rudraksha Gupta
2026-01-29 10:31 ` 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=821a7dc3-7b00-40d1-9332-ef57ad22f9ca@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=guptarud@gmail.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®