Linux Input/HID development
 help / color / mirror / Atom feed
From: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Lee Jones <lee@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: David Collins <david.collins@oss.qualcomm.com>,
	Subbaraman Narayanamurthy
	<subbaraman.narayanamurthy@oss.qualcomm.com>,
	Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>,
	kernel@oss.qualcomm.com, linux-input@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] input: misc: Add Qualcomm SPMI PMIC haptics driver
Date: Wed, 17 Jun 2026 10:31:47 +0800	[thread overview]
Message-ID: <1bcf00ae-2558-4c3a-970d-aee1da0c06f9@oss.qualcomm.com> (raw)
In-Reply-To: <eb693705-c0c3-427b-a924-5aa907fd65bb@oss.qualcomm.com>

>> +		ret = ptn_bulk_write(h, HAP_PTN_FIFO_DIN_0_REG, &data[i], 4);
>> +		if (ret)
>> +			return ret;
>> +	}
>> +
>> +	for (; i < len; i++) {
>> +		ret = ptn_write(h, HAP_PTN_FIFO_DIN_1B_REG, (u8)data[i]);
>> +		if (ret)
>> +			return ret;
>> +	}
> So if i'm reading this right, the first loop will always write
> 4*(len//4) bytes and the second one will be entered at most once,
> to write len rem 4 bytes.. should this be an if instead?

I should put a comment for clarification. Here’s some background: FIFO 
data writing supports both 4-byte bulk writes using registers 
[HAP_PTN_FIFO_DIN_0_REG ... HAP_PTN_FIFO_DIN_3_REG], and 1-byte writes 
using the HAP_PTN_FIFO_DIN_1B_REG register. The 4-byte bulk write is 
more efficient, especially for waveform which has several Kb data, and 
it helps to reduce software latency when loading effects and reduce the 
delay in triggering vibration. It also helps prevent the FIFO from 
running dry during data refill in FIFO-empty interrupts. Typically, we 
use 4-byte writes for the initial 4-byte aligned data, and 1-byte writes 
for any trailing remainder.

So it still needs a 'for' loop here since the remainder could be more 
than 1 byte.

>> +
>> +	return 0;
>> +}
>> +
>> +/*
>> + * Configure the hardware FIFO memory boundary.
>> + * FIFO occupies addresses [0, fifo_len).
>> + */
>> +static int haptics_configure_fifo_mmap(struct qcom_haptics *h)
>> +{
>> +	u32 fifo_len, fifo_units;
>> +
>> +	/* Config all memory space for FIFO usage for now */
> What's the not-"for now" endgame for this?

The hardware supports more modes than the two currently supported in the 
driver. One of these, called 'PAT_MEM' mode, also shares memory space 
with FIFO mode. However, 'PAT_MEM' requires memory to be pre-reserved 
and waveform data to be pre-loaded. The entire 8K bytes of memory can be 
divided into partitions, and it is configurable, with FIFO mode always 
using the first partition [0, fifo_len], where 'fifo_len' is set via the 
'MMAP_FIFO_REG' register. 'PAT_MEM' mode plays waveform using data 
preloaded in a memory bank defined by the registers 
'PATX_MEM_START_ADDR_REG' and 'PATTERN_SPMI_PATX_LEN_REG' (they are not 
defined in the driver). Since PAT_MEM is mainly intended for 
hardware-triggered vibrations, such as a signal from a dedicated GPIO 
triggering a short vibration with a preloaded waveform, and although it 
also supports software triggers, I haven't found a suitable way to 
support it well into the driver under input FF framework yet. So, I am 
currently allocating the entire 8K FIFO memory for FIFO mode only. We 
can adjust this later if we find a better way to incorporate 'PAT_MEM' 
mode into the driver.


  parent reply	other threads:[~2026-06-17  2:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 10:08 [PATCH 0/4] input: misc: Add an initial driver for haptics inside Qcom PMIH010x PMIC Fenglin Wu
2026-06-16 10:08 ` [PATCH 1/4] dt-bindings: input: Add binding for Qualcomm SPMI PMIC haptics Fenglin Wu
2026-06-16 10:11   ` Konrad Dybcio
2026-06-16 10:18   ` sashiko-bot
2026-06-17 10:35   ` Krzysztof Kozlowski
2026-06-17 11:02     ` Fenglin Wu
2026-06-16 10:08 ` [PATCH 2/4] dt-bindings: mfd: qcom,spmi-pmic: Document haptics device Fenglin Wu
2026-06-16 10:17   ` sashiko-bot
2026-06-16 10:08 ` [PATCH 3/4] input: misc: Add Qualcomm SPMI PMIC haptics driver Fenglin Wu
2026-06-16 10:23   ` sashiko-bot
2026-06-16 10:25   ` Konrad Dybcio
2026-06-16 19:22     ` Dmitry Torokhov
2026-06-17  2:31     ` Fenglin Wu [this message]
2026-06-17  9:30       ` Konrad Dybcio
2026-06-17 10:12         ` Fenglin Wu
2026-06-16 14:37   ` Julian Braha
2026-06-16 10:08 ` [PATCH 4/4] arm64: dts: qcom: Add PMIH0108 haptics device node Fenglin Wu
2026-06-16 10:27   ` Konrad Dybcio
2026-06-17  1:30     ` Fenglin Wu
2026-06-17 10:42 ` [PATCH 0/4] input: misc: Add an initial driver for haptics inside Qcom PMIH010x PMIC Krzysztof Kozlowski

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=1bcf00ae-2558-4c3a-970d-aee1da0c06f9@oss.qualcomm.com \
    --to=fenglin.wu@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=david.collins@oss.qualcomm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kamal.wadhwa@oss.qualcomm.com \
    --cc=kernel@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=subbaraman.narayanamurthy@oss.qualcomm.com \
    /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