The following table lists device tree properties of the pmi8998 haptics driver, possible values and a description.
QPNP (qcom plug n play) Haptics properties
qpnp haptics registers, descriptions and bit masks
The pmi8998-haptics has 2 interrupts, hap-sc-irq
and hap-play-irq
hap-sc-irq
sc seems to stand for short circuit, this interrupt fires if the actuator is in short circuit so that the hardware can be shut down before something more dangerous happens.
This IRQ is also fired every 50ms during vibration, if the SC_FLAG_BIT
is set then all is well, the IRQ must be cleared as a kind of watchdog, if it isn't than the vibrator will stop.
hap-play-irq
This IRQ is only used for buffer mode, when fired the handler will write the next set of 'wave samples' to the HAP_WF_S1_REG
register.
I'm fairly sure this won't fire unless there's more than 8 samples (more than 1 sample set).
Wave samples define the wave sent to the actuator, a wave sample is 8 bits in size, samples are sent in sets of 8, it's possible to define up to 32 samples. They take the following format:
[0] - unused
[5:1] - amplitude
[6] - overdrive (where the LRA is driven over spec to increase power)
[7] - sign bit (for the amplitude??)
The default value for a wave sample is 0x3E
or 0b11111000
. The samples are written to the HAP_WF_S1_REG
register.
root@ubuntu-phablet:/sys/class/leds/vibrator# cat wf_samp
3e 3e 3e 3e 3e 3e 3e 3e 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 2 3 4 5 6 7