xref: /linux/Documentation/devicetree/bindings/input/qcom,spmi-haptics.yaml (revision 67f8bc848ee31831336bd478e57d2f993551902e)
1*660ee679SFenglin Wu# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2*660ee679SFenglin Wu%YAML 1.2
3*660ee679SFenglin Wu---
4*660ee679SFenglin Wu$id: http://devicetree.org/schemas/input/qcom,spmi-haptics.yaml#
5*660ee679SFenglin Wu$schema: http://devicetree.org/meta-schemas/core.yaml#
6*660ee679SFenglin Wu
7*660ee679SFenglin Wutitle: Haptics device inside Qualcomm Technologies, Inc. PMIC
8*660ee679SFenglin Wu
9*660ee679SFenglin Wumaintainers:
10*660ee679SFenglin Wu  - Fenglin Wu <fenglin.wu@oss.qualcomm.com>
11*660ee679SFenglin Wu
12*660ee679SFenglin Wudescription: |
13*660ee679SFenglin Wu  Certain Qualcomm PMICs integrate a haptics module, such as the HAP530_HV haptics
14*660ee679SFenglin Wu  module in the PMIH0108 PMIC, which drives an LRA (Linear Resonant Actuator) with
15*660ee679SFenglin Wu  an output voltage up to 10 V. Several play modes are supported in HAP530_HV:
16*660ee679SFenglin Wu
17*660ee679SFenglin Wu    DIRECT_PLAY: The hardware outputs sinusoidal waveforms whose period is
18*660ee679SFenglin Wu      defined by qcom,lra-period-us and whose peak voltage is defined by
19*660ee679SFenglin Wu      qcom,vmax-microvolt. The driving amplitude can be scaled in the range
20*660ee679SFenglin Wu      [0, 255] via a single register byte.  Hardware-based LRA auto-resonance
21*660ee679SFenglin Wu      tracking is enabled by default in this mode, allowing the haptics engine
22*660ee679SFenglin Wu      to follow the actual resonant frequency of the LRA and update the driving
23*660ee679SFenglin Wu      period accordingly to achieve stronger vibration magnitude.
24*660ee679SFenglin Wu
25*660ee679SFenglin Wu    FIFO: The hardware can play an arbitrary waveform composed of a sequence
26*660ee679SFenglin Wu      of 8-bit samples at a configurable play rate.  Samples are pre-filled
27*660ee679SFenglin Wu      into the internal FIFO memory of the haptics module and continuously
28*660ee679SFenglin Wu      replenished via the FIFO-empty IRQ until all samples have been played.
29*660ee679SFenglin Wu      An 8K-byte FIFO memory bank is available in the HAP530_HV haptics module,
30*660ee679SFenglin Wu      shared between the FIFO and PAT_MEM play modes. The memory partition
31*660ee679SFenglin Wu      between the two modes is configurable via registers, and FIFO mode always
32*660ee679SFenglin Wu      uses the 1st partition starting from offset 0.
33*660ee679SFenglin Wu
34*660ee679SFenglin Wu    PAT_MEM: This mode is very similar to FIFO streaming mode but without the
35*660ee679SFenglin Wu      data refilling capability. It is designed mainly for short, latency-critical
36*660ee679SFenglin Wu      vibrations. The memory space for PAT_MEM mode must be reserved for dedicated
37*660ee679SFenglin Wu      usage, and the waveform data should be preloaded and remain unchanged
38*660ee679SFenglin Wu      thereafter. The haptics module can play the waveform data from the memory
39*660ee679SFenglin Wu      region specified by the PAT_MEM play start address and length registers.
40*660ee679SFenglin Wu
41*660ee679SFenglin Wu    In either FIFO mode or PAT_MEM mode, the following play rates are supported:
42*660ee679SFenglin Wu      -- 0(T_LRA): each FIFO byte drives one full sinusoidal cycle with the
43*660ee679SFenglin Wu        period defined in qcom,lra-period-us.
44*660ee679SFenglin Wu      -- 1/2/3(T_LRA_DIV_2/4/8): each FIFO byte drives a half/quarter/eighth
45*660ee679SFenglin Wu        sinusoidal cycle with the period defined in qcom,lra-period-us.
46*660ee679SFenglin Wu      -- 4/5/6(T_LRA_X_2/4/8): each FIFO byte drives 2/4/8 sinusoidal cycles
47*660ee679SFenglin Wu        with the period defined in qcom,lra-period-us.
48*660ee679SFenglin Wu      -- 8/9/10/11/12/13(8KHz/16KHz/24KHz/32KHz/44.1KHz/48KHz): the FIFO
49*660ee679SFenglin Wu        data is treated as PCM samples and drives the output with an
50*660ee679SFenglin Wu        arbitrarily shaped waveform.  This mode is typically used to define
51*660ee679SFenglin Wu        custom driving waveforms for specific vibration effects such as fast
52*660ee679SFenglin Wu        attack, crisp brake, etc.
53*660ee679SFenglin Wu
54*660ee679SFenglin Wu    The drive voltage in FIFO or PAT_MEM mode can exceed the value defined in
55*660ee679SFenglin Wu    qcom,vmax-microvolt to achieve a special vibration effect, but the waveform
56*660ee679SFenglin Wu    must be short enough to prevent the LRA from being damaged by operating at
57*660ee679SFenglin Wu    an overvoltage.
58*660ee679SFenglin Wu
59*660ee679SFenglin Wu    Also, hardware-based LRA auto-resonance tracking is normally disabled in
60*660ee679SFenglin Wu    FIFO or PAT_MEM mode, as these modes are intended to drive arbitrary
61*660ee679SFenglin Wu    waveforms that may not follow the resonant frequency; autonomous hardware
62*660ee679SFenglin Wu    resonance correction would interfere with the intended output.
63*660ee679SFenglin Wu
64*660ee679SFenglin Wuproperties:
65*660ee679SFenglin Wu  compatible:
66*660ee679SFenglin Wu    items:
67*660ee679SFenglin Wu      - const: qcom,pmih0108-haptics
68*660ee679SFenglin Wu      - const: qcom,spmi-haptics
69*660ee679SFenglin Wu
70*660ee679SFenglin Wu  reg:
71*660ee679SFenglin Wu    items:
72*660ee679SFenglin Wu      - description: HAP_CFG module base address
73*660ee679SFenglin Wu      - description: HAP_PTN module base address
74*660ee679SFenglin Wu
75*660ee679SFenglin Wu  reg-names:
76*660ee679SFenglin Wu    items:
77*660ee679SFenglin Wu      - const: cfg
78*660ee679SFenglin Wu      - const: ptn
79*660ee679SFenglin Wu
80*660ee679SFenglin Wu  interrupts:
81*660ee679SFenglin Wu    maxItems: 1
82*660ee679SFenglin Wu
83*660ee679SFenglin Wu  interrupt-names:
84*660ee679SFenglin Wu    items:
85*660ee679SFenglin Wu      - const: fifo-empty
86*660ee679SFenglin Wu
87*660ee679SFenglin Wu  qcom,vmax-microvolt:
88*660ee679SFenglin Wu    description:
89*660ee679SFenglin Wu      Maximum allowed output driving voltage in microvolts, must be a multiple
90*660ee679SFenglin Wu      of 50,000 uV. This is the peak driving voltage in DIRECT_PLAY mode,
91*660ee679SFenglin Wu      which outputs sinusoidal waveforms. The value should be equal to the
92*660ee679SFenglin Wu      square root of 2 times the Vrms voltage of the LRA.
93*660ee679SFenglin Wu    minimum: 50000
94*660ee679SFenglin Wu    maximum: 10000000
95*660ee679SFenglin Wu    multipleOf: 50000
96*660ee679SFenglin Wu
97*660ee679SFenglin Wu  qcom,lra-period-us:
98*660ee679SFenglin Wu    description:
99*660ee679SFenglin Wu      LRA actuator initial resonance period in microseconds
100*660ee679SFenglin Wu      (1,000,000 / resonant_freq_hz).  Used to configure T_LRA-based play
101*660ee679SFenglin Wu      rates and the auto-resonance zero-crossing window. It could be also used
102*660ee679SFenglin Wu      as the initial period if the LRA wants to be driven off resonance.
103*660ee679SFenglin Wu    minimum: 5
104*660ee679SFenglin Wu    maximum: 20475
105*660ee679SFenglin Wu    multipleOf: 5
106*660ee679SFenglin Wu
107*660ee679SFenglin Wurequired:
108*660ee679SFenglin Wu  - compatible
109*660ee679SFenglin Wu  - reg
110*660ee679SFenglin Wu  - reg-names
111*660ee679SFenglin Wu  - interrupts
112*660ee679SFenglin Wu  - interrupt-names
113*660ee679SFenglin Wu  - qcom,vmax-microvolt
114*660ee679SFenglin Wu  - qcom,lra-period-us
115*660ee679SFenglin Wu
116*660ee679SFenglin WuadditionalProperties: false
117