public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Caleb Connolly <caleb.connolly@linaro.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, david@ixit.cz
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Matthias Schiffer <matthias.schiffer@ew.tq-group.com>,
	Vincent Huang <vincent.huang@tw.synaptics.com>,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	methanal <baclofen@tuta.io>
Subject: Re: [PATCH v3 2/7] Input: synaptics-rmi4 - handle duplicate/unknown PDT entries
Date: Tue, 11 Mar 2025 12:22:24 +0000	[thread overview]
Message-ID: <58cd8f7b-e824-4518-8bc1-c004c8a605f2@linaro.org> (raw)
In-Reply-To: <Z885Jw0K6d2h_2pl@google.com>

Hi Dmitry,

On 3/10/25 19:10, Dmitry Torokhov wrote:
> Hi David,
> 
> On Sat, Mar 08, 2025 at 03:08:38PM +0100, David Heidelberg via B4 Relay wrote:
>> From: Caleb Connolly <caleb.connolly@linaro.org>
>>
>> Some third party rmi4-compatible ICs don't expose their PDT entries
>> very well. Add a few checks to skip duplicate entries as well as entries
>> for unsupported functions.
>>
>> This is required to support some phones with third party displays.
>>
>> Validated on a stock OnePlus 6T (original parts):
>> manufacturer: Synaptics, product: S3706B, fw id: 2852315
>>
>> Co-developed-by: methanal <baclofen@tuta.io>
>> Signed-off-by: methanal <baclofen@tuta.io>
>> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
>> Signed-off-by: David Heidelberg <david@ixit.cz>
>> ---
>>   drivers/input/rmi4/rmi_driver.c | 47 +++++++++++++++++++++++++++++++++++------
>>   drivers/input/rmi4/rmi_driver.h |  6 ++++++
>>   2 files changed, 47 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
>> index 2168b6cd7167334d44553c9c566f870a4e034179..51c23a407b2731d5b6eaefe9cae6288f97316e34 100644
>> --- a/drivers/input/rmi4/rmi_driver.c
>> +++ b/drivers/input/rmi4/rmi_driver.c
>> @@ -493,12 +493,44 @@ static void rmi_driver_copy_pdt_to_fd(const struct pdt_entry *pdt,
>>   	fd->function_version = pdt->function_version;
>>   }
>>   
>> +static bool rmi_pdt_entry_is_valid(struct rmi_device *rmi_dev,
>> +				   struct pdt_scan_state *state, u8 fn)
>> +{
>> +	unsigned int i;
>> +
>> +	switch (fn) {
>> +	case 0x01:
>> +	case 0x03:
>> +	case 0x11:
>> +	case 0x12:
>> +	case 0x30:
>> +	case 0x34:
>> +	case 0x3a:
>> +	case 0x54:
>> +	case 0x55:
> 
> This mean that we need to update this code any time there is new
> function introduced. I'd rather we did not do that. The driver should be
> able to handle unknown functions.

Synaptics don't produce new RMI4 based tech anymore afaik, they have 
moved on. So I don't think there will be new functions being added here.

Unfortunately in my experience the fake touch ICs report completely 
random values here, so there really isn't a good way to handle this 
otherwise.

What if this list rather than being hardcoded here was just using the 
fn_handlers[] array from rmi_bus.c?

Kind regards,
> 
>> +		break;
>> +
>> +	default:
>> +		rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
>> +			"PDT has unknown function number %#02x\n", fn);
>> +		return false;
>> +	}
>> +
>> +	for (i = 0; i < state->pdt_count; i++) {
>> +		if (state->pdts[i] == fn)
>> +			return false;
>> +	}
>> +
>> +	state->pdts[state->pdt_count++] = fn;
> 
> Duplicate detection could be handled thorough a bitmap.
> 
> Thanks.
> 

-- 
Caleb (they/them)


  reply	other threads:[~2025-03-11 12:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-08 14:08 [PATCH v3 0/7] Subject: [PATCH v3 0/7] Input: synaptics-rmi4: add quirks for third party touchscreen controllers David Heidelberg via B4 Relay
2025-03-08 14:08 ` [PATCH v3 1/7] dt-bindings: input: syna,rmi4: document syna,pdt-fallback-desc David Heidelberg via B4 Relay
2025-03-10  9:45   ` Krzysztof Kozlowski
2025-03-24 18:00     ` David Heidelberg
2025-03-25  7:36       ` Krzysztof Kozlowski
2025-03-25 13:23         ` Caleb Connolly
2025-03-26  6:57           ` Krzysztof Kozlowski
2025-03-26 10:26             ` Caleb Connolly
2025-03-28 22:45               ` David Heidelberg
2025-03-29  9:56                 ` Caleb Connolly
2025-03-08 14:08 ` [PATCH v3 2/7] Input: synaptics-rmi4 - handle duplicate/unknown PDT entries David Heidelberg via B4 Relay
2025-03-10 19:10   ` Dmitry Torokhov
2025-03-11 12:22     ` Caleb Connolly [this message]
2025-04-02 18:54     ` David Heidelberg
2025-03-08 14:08 ` [PATCH v3 3/7] Input: synaptics-rmi4 - f12: use hardcoded values for aftermarket touch ICs David Heidelberg via B4 Relay
2025-03-08 14:08 ` [PATCH v3 4/7] Input: synaptics-rmi4 - f55: handle zero electrode count David Heidelberg via B4 Relay
2025-03-10 19:00   ` Dmitry Torokhov
2025-03-08 14:08 ` [PATCH v3 5/7] Input: synaptics-rmi4 - don't do unaligned reads in IRQ context David Heidelberg via B4 Relay
2025-03-08 14:08 ` [PATCH v3 6/7] Input: synaptics-rmi4 - read product ID on aftermarket touch ICs David Heidelberg via B4 Relay
2025-03-08 14:08 ` [PATCH v3 7/7] Input: synaptics-rmi4 - support fallback values for PDT descriptor bytes David Heidelberg via B4 Relay
2025-03-10 10:04 ` [PATCH v3 0/7] Subject: [PATCH v3 0/7] Input: synaptics-rmi4: add quirks for third party touchscreen controllers Caleb Connolly
2025-03-10 10:47   ` David Heidelberg

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=58cd8f7b-e824-4518-8bc1-c004c8a605f2@linaro.org \
    --to=caleb.connolly@linaro.org \
    --cc=Jason@zx2c4.com \
    --cc=baclofen@tuta.io \
    --cc=conor+dt@kernel.org \
    --cc=david@ixit.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.schiffer@ew.tq-group.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=vincent.huang@tw.synaptics.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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