| Message ID | 20250917080534.1772202-7-dario.binacchi@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path:
<linux-amarula+bncBCQ4XFG47UFRBXOXVHDAMGQEFTTFHHY@amarulasolutions.com>
X-Original-To: linux-amarula@patchwork.amarulasolutions.com
Delivered-To: linux-amarula@patchwork.amarulasolutions.com
Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com
[209.85.208.69])
by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 56E6E3F168
for <linux-amarula@patchwork.amarulasolutions.com>;
Wed, 17 Sep 2025 10:05:50 +0200 (CEST)
Received: by mail-ed1-f69.google.com with SMTP id
4fb4d7f45d1cf-629f069572esf848957a12.1
for <linux-amarula@patchwork.amarulasolutions.com>;
Wed, 17 Sep 2025 01:05:50 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1758096350; cv=pass;
d=google.com; s=arc-20240605;
b=Y51JDDcx6DjxnW92ynWMYmwmu43/atqIgY6fqsumE83jmZuuCeRUSBsJwU/tRHax59
UTtSaZVaBJBtyTt3OesUqjeddQgdwJVHgerkxJGbksoS8n7BubIA1g7lZ25W9dh45Cah
VsAYKYKjqK1OM+2+bhxKaCoiYT3cYxf537GzEU+yQaOduWHdXfbv2mcN/lJ0o7M02zlW
HJA5mjXhh9de2gyLfaMHK5yxhJUKQqztGIkPUviIc0pVTSyb36qCZ0DDAJGFsJCp/rmD
1z7Mb0wTdSRuJnWUWju2HVBJTUB4ehRuqAHZ/Y2FnG1IxZvxDSIZXxZMNcJ6UmkxPjXo
etag==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=3OpV/8YYKfKSwjz5eOuDaLDFik+85aneEAXjQ7oNeYE=;
fh=iTm6jI8g6+Nr1lSlgnx1wWWzN+FjXp1d4mQVVBl301M=;
b=EpR7Sy6iiPOgPwt0lAc0vvrLpY9E4uWOIzV34/ttM1/r/vnADwL51kh7kT43CIbfHY
fAdI+ARlmgdgTf22f+/6EW976Z98cizTfXjAOGwoSlDRma3M5fRar71toMo4YCc4X40s
tb/5AifNMCWlYiAa3N7cQdw7KeO7UX7+H5Hdia0AI6FCrd0KKnUsvnn+k+sVSw2MJzNi
NxYJsZ6eARChzk/K2SnFzin9KTcISbHc5ef34D36VkAxVCAgOsqOfLfZyKZtmbp8a0FT
soV6+pz2goFDKa5SJ2N7ztzx6N3STuelhWkEKXqdSZqwtVNEpWZMm2QTUTw7Z9li7flI
oq4A==;
darn=patchwork.amarulasolutions.com
ARC-Authentication-Results: i=2; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=qUXICK9r;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=pass header.i=@amarulasolutions.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=amarulasolutions.com; s=google; t=1758096350; x=1758701150;
darn=patchwork.amarulasolutions.com;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:x-original-authentication-results
:x-original-sender:mime-version:references:in-reply-to:message-id
:date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=3OpV/8YYKfKSwjz5eOuDaLDFik+85aneEAXjQ7oNeYE=;
b=Se0HRCrM8DFKyT7mY/XRKI6CE/hsZSwjtWAHK8dY8t4RNgGqKdYbwIGIUoPZOISDUk
kep3UV2m3rH/EB5F6PpOsUxsJI+OtnrXZ1L9UyJ1Tlo1m2qReqEiwaTHO8o5bhpLTfW7
HGftbxteuSxpCA5xmki9L3SRHY4x5xWZfcFWA=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1758096350; x=1758701150;
h=list-unsubscribe:list-archive:list-help:list-post
:x-spam-checked-in-group:list-id:mailing-list:precedence
:x-original-authentication-results:x-original-sender:mime-version
:references:in-reply-to:message-id:date:subject:cc:to:from
:x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=3OpV/8YYKfKSwjz5eOuDaLDFik+85aneEAXjQ7oNeYE=;
b=EKi41grVUUMyus4tjtgAxLFUf3cJT34ns2ohdkPA8Bkxr8LtDFOPmnYQ0jraLm5AHv
71aSt5PQUkd4AscFQjHIwlVAzxkUTUvYHoPv2YJA5WH/BQ1qZp1KrzYez9i9CdR8Top6
nXbWiVM0G0f8w60raBbdEgNlvWUhe/ro6nmChsXxT7VDXEmpd1mrFJ2bhD6vkdwtgonM
lq0AIuUKwOkPkKlLRpRcjHHYgUHpcwbXN+n4ek+EF+e7ciEekSK05JvkX7w6nHNtDYt3
xBq1Yk1xQXkjMsTj+P9DWhuQM8vEoY0PZcB42x+r9OAwy20T5KXlsDZASAzuLa/8Ttkm
05fA==
X-Forwarded-Encrypted: i=2;
AJvYcCULHbYilt8bQzevqduErXLrDok54/pUp9DzeMmjd0HJns0vDafbTf2R1g2IYDdrXJW5rSRYVdfe+uhtht6N@patchwork.amarulasolutions.com
X-Gm-Message-State: AOJu0YwbhLmkFBVAbq9q2ZWY+oDhjlHRO6gKGmP6pRmAXQaSUsEdirEQ
b6ZyLlla5PbeD/pVFcrweg0SHVDdEv2J1bdiosAZ5Y0KIeEz97nXYEoe/e9nXJTzBPpZLg==
X-Google-Smtp-Source:
AGHT+IE3nycBZ0ucroUuLv7Zz9eO39kTbeyo96Iklt33MYMR+4hthNwec1YrOWS5mbagofj2RNjxXg==
X-Received: by 2002:a05:6402:35d1:b0:62f:45f6:13b5 with SMTP id
4fb4d7f45d1cf-62f65f67e1fmr5234796a12.17.1758096349896;
Wed, 17 Sep 2025 01:05:49 -0700 (PDT)
X-BeenThere: linux-amarula@amarulasolutions.com;
h=ARHlJd6EAxrlk29AzyfbthqUZuX5nt870hDNXDCNRoFNTXBUmA==
Received: by 2002:a05:6402:3905:b0:62f:36ff:5232 with SMTP id
4fb4d7f45d1cf-62f7c36e560ls361257a12.1.-pod-prod-00-eu-canary; Wed, 17 Sep
2025 01:05:47 -0700 (PDT)
X-Received: by 2002:a17:906:4fce:b0:b04:6546:3475 with SMTP id
a640c23a62f3a-b1be32837b9mr138662066b.6.1758096347241;
Wed, 17 Sep 2025 01:05:47 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1758096347; cv=none;
d=google.com; s=arc-20240605;
b=hX5ien1lFpOrE2LUxE6hl5Q3LRDhMjVUdtRyfJXigdXfybKhJIOKbn1xMMI8oOF/8b
AD5oxo7qo1TDRTWxmCAjiBjBwzCRxJvE5EXY1ek4yKFpziMptlA3loFr+657pDrt3HaC
RDhYiMi2WBOptNAyj87o1xTNCmXWDQyKSb38TRlff1SzkMWDYZfd0bEEwLRjYG3P6KY/
iG+kGspZ/evqapzFcV0ZtrSk7rtArhzx/Dmzc8q/i1hH8lb8U1Y7f+Q3TTBmcU3cM3NG
aAg9UcgZxDfxY1F0vZpB11xN15xpQJvYSvQv0+5Qx7DTgisYE0sojt2AQ7SIu7Z175Ag
jtBQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=I/q3PAqpa8JFRI5D9goTpJtfgHgbqQ+Qd/SJYCaxuYg=;
fh=07XXofEZG9d+QeVy8dz+2QB2lNQ+zt329x24x7giHEI=;
b=XUx2B3p47rFhKSpJ8oZTW1r8cLL+p5XcLmJu2oKRlHPb20TZr+CQQrZPFe29i4yczC
f2YP05mgpiqXU1dBMntp+4qJ03bHnVVAHNeFct7yMZhQrUzaqi+rEnC5dvUYMymLTJBe
t9oQHdql+hNxHXEpgjRCHKng4HFbHKD2p/uCni9CXjDUpu7EJFsqp93V5LTJUOti/026
3I3f3jaYo8WK4d5axfmnLaI/vpFIV5r/pCUwPSsr6rpIvuN2NGWwLThr1HrkDQ6pAGy6
VTdLSEEvaOkk62nCXRM9ksQp/2ybJG+opyI2KfguJNRl36h59nnx10UIUtVeQZeWHZbz
dhhg==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=qUXICK9r;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=pass header.i=@amarulasolutions.com
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com.
[209.85.220.41])
by mx.google.com with SMTPS id
a640c23a62f3a-b1a6f9bae00sor51638466b.5.2025.09.17.01.05.47
for <linux-amarula@amarulasolutions.com>
(Google Transport Security);
Wed, 17 Sep 2025 01:05:47 -0700 (PDT)
Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Gm-Gg: ASbGncs/bEjI7S7H+xova+Utn4HtQXCGEFoCO/hyXOQ6pgUF6TgPnlXC9uYqiJCWZuj
2HH2IhaRm5PIzHpjLFDr8G7pAoZhKtH+m9IE5qkRgp+a571vMYpLBACy5Kb7rbxBqfKwCZEOLox
xsyRs7dDaX13ICWthBMA0QTmo7v4nUe58RtfzIv/JewHNsmLydawlggXmFOfggQninAqozr1Eww
D6Ks0NelcelAL7yvLi0h90kR5QfUe3QRWg5oYC8jsZZMdlEhYKo5I7MzwaMSRoUQJk8Ec8UJ2xi
8HSG9OX6LtEHYKIBdMEyNyyJDCwF6t1oKkut5K6jIgus7ZEiut+gjoWkXzrgnRisjkZQ5LKNfqs
+mRBdbxULuyhNZiUTSPX66adw/vM1C2ghRhnuGq92GHFamBhDKAZHlA2LAZPgMRiGCm2yyA==
X-Received: by 2002:a17:906:c14c:b0:b07:c383:8104 with SMTP id
a640c23a62f3a-b167ea6334emr662752366b.13.1758096346480;
Wed, 17 Sep 2025 01:05:46 -0700 (PDT)
Received: from localhost.localdomain
([2001:b07:6474:ebbf:1215:4a13:8ee5:da2a])
by smtp.gmail.com with ESMTPSA id
a640c23a62f3a-b07e1aed5ffsm924936766b.81.2025.09.17.01.05.45
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 17 Sep 2025 01:05:46 -0700 (PDT)
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: linux-kernel@vger.kernel.org
Cc: linux-amarula@amarulasolutions.com,
Frank Li <Frank.Li@nxp.com>,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Fabio Estevam <festevam@gmail.com>,
Michael Trimarchi <michael@amarulasolutions.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Sascha Hauer <s.hauer@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-input@vger.kernel.org
Subject: [PATCH v4 6/6] Input: imx6ul_tsc - set glitch threshold by DTS
property
Date: Wed, 17 Sep 2025 10:05:11 +0200
Message-ID: <20250917080534.1772202-7-dario.binacchi@amarulasolutions.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20250917080534.1772202-1-dario.binacchi@amarulasolutions.com>
References: <20250917080534.1772202-1-dario.binacchi@amarulasolutions.com>
MIME-Version: 1.0
X-Original-Sender: dario.binacchi@amarulasolutions.com
X-Original-Authentication-Results: mx.google.com; dkim=pass
header.i=@amarulasolutions.com header.s=google header.b=qUXICK9r;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=pass header.i=@amarulasolutions.com
Content-Type: text/plain; charset="UTF-8"
Precedence: list
Mailing-list: list linux-amarula@amarulasolutions.com;
contact linux-amarula+owners@amarulasolutions.com
List-ID: <linux-amarula.amarulasolutions.com>
X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com
X-Google-Group-Id: 476853432473
List-Post:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>,
<mailto:linux-amarula@amarulasolutions.com>
List-Help:
<https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>,
<mailto:linux-amarula+help@amarulasolutions.com>
List-Archive:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/>
List-Unsubscribe:
<mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>,
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe>
|
| Series |
Input: imx6ul_tsc - set glitch threshold by dts property
|
|
Commit Message
Dario Binacchi
Sept. 17, 2025, 8:05 a.m. UTC
Set the glitch threshold previously hardcoded in the driver. The change
is backward compatible.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
Changes in v4:
- Adjust property description fsl,imx6ul-tsc.yaml following the
suggestions of Conor Dooley and Frank Li.
Changes in v3:
- Remove the final part of the description that refers to
implementation details in fsl,imx6ul-tsc.yaml.
Changes in v2:
- Replace patch ("dt-bindings: input: touchscreen: fsl,imx6ul-tsc: add
fsl,glitch-threshold") with ("dt-bindings: touchscreen: add
touchscreen-glitch-threshold-ns property"), making the previous property
general by moving it to touchscreen.yaml.
- Rework "Input: imx6ul_tsc - set glitch threshold by DTS property" patch
to match changes made to the DTS property.
- Move "Input: imx6ul_tsc - use BIT, FIELD_{GET,PREP} and GENMASK macros"
patch right after the patch fixing the typo.
- Rework to match changes made to the DTS property.
drivers/input/touchscreen/imx6ul_tsc.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
Comments
On Wed, Sep 17, 2025 at 10:05:11AM +0200, Dario Binacchi wrote: > Set the glitch threshold previously hardcoded in the driver. The change > is backward compatible. Set the glitch threshold by DTS property and keep the existing default behavior if the 'touchscreen-glitch-threshold-ns' not present. Reviewed-by: Frank Li <Frank.Li@nxp.com> > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > > --- > > Changes in v4: > - Adjust property description fsl,imx6ul-tsc.yaml following the > suggestions of Conor Dooley and Frank Li. > > Changes in v3: > - Remove the final part of the description that refers to > implementation details in fsl,imx6ul-tsc.yaml. > > Changes in v2: > - Replace patch ("dt-bindings: input: touchscreen: fsl,imx6ul-tsc: add > fsl,glitch-threshold") with ("dt-bindings: touchscreen: add > touchscreen-glitch-threshold-ns property"), making the previous property > general by moving it to touchscreen.yaml. > - Rework "Input: imx6ul_tsc - set glitch threshold by DTS property" patch > to match changes made to the DTS property. > - Move "Input: imx6ul_tsc - use BIT, FIELD_{GET,PREP} and GENMASK macros" > patch right after the patch fixing the typo. > - Rework to match changes made to the DTS property. > > drivers/input/touchscreen/imx6ul_tsc.c | 26 ++++++++++++++++++++++++-- > 1 file changed, 24 insertions(+), 2 deletions(-) > > diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c > index e2c59cc7c82c..0d753aa05fbf 100644 > --- a/drivers/input/touchscreen/imx6ul_tsc.c > +++ b/drivers/input/touchscreen/imx6ul_tsc.c > @@ -79,7 +79,7 @@ > #define MEASURE_SIG_EN BIT(0) > #define VALID_SIG_EN BIT(8) > #define DE_GLITCH_MASK GENMASK(30, 29) > -#define DE_GLITCH_2 0x02 > +#define DE_GLITCH_DEF 0x02 > #define START_SENSE BIT(12) > #define TSC_DISABLE BIT(16) > #define DETECT_MODE 0x2 > @@ -98,6 +98,7 @@ struct imx6ul_tsc { > u32 pre_charge_time; > bool average_enable; > u32 average_select; > + u32 de_glitch; > > struct completion completion; > }; > @@ -205,7 +206,7 @@ static void imx6ul_tsc_set(struct imx6ul_tsc *tsc) > basic_setting |= AUTO_MEASURE; > writel(basic_setting, tsc->tsc_regs + REG_TSC_BASIC_SETTING); > > - debug_mode2 = FIELD_PREP(DE_GLITCH_MASK, DE_GLITCH_2); > + debug_mode2 = FIELD_PREP(DE_GLITCH_MASK, tsc->de_glitch); > writel(debug_mode2, tsc->tsc_regs + REG_TSC_DEBUG_MODE2); > > writel(tsc->pre_charge_time, tsc->tsc_regs + REG_TSC_PRE_CHARGE_TIME); > @@ -391,6 +392,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) > int tsc_irq; > int adc_irq; > u32 average_samples; > + u32 de_glitch; > > tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL); > if (!tsc) > @@ -513,6 +515,26 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) > return -EINVAL; > } > > + err = of_property_read_u32(np, "touchscreen-glitch-threshold-ns", > + &de_glitch); > + if (err) { > + tsc->de_glitch = DE_GLITCH_DEF; > + } else { > + u64 cycles; > + unsigned long rate = clk_get_rate(tsc->tsc_clk); > + > + cycles = DIV64_U64_ROUND_UP((u64)de_glitch * rate, NSEC_PER_SEC); > + > + if (cycles <= 0x3ff) > + tsc->de_glitch = 3; > + else if (cycles <= 0x7ff) > + tsc->de_glitch = 2; > + else if (cycles <= 0xfff) > + tsc->de_glitch = 1; > + else > + tsc->de_glitch = 0; > + } > + > err = input_register_device(tsc->input); > if (err) { > dev_err(&pdev->dev, > -- > 2.43.0 > To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c index e2c59cc7c82c..0d753aa05fbf 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -79,7 +79,7 @@ #define MEASURE_SIG_EN BIT(0) #define VALID_SIG_EN BIT(8) #define DE_GLITCH_MASK GENMASK(30, 29) -#define DE_GLITCH_2 0x02 +#define DE_GLITCH_DEF 0x02 #define START_SENSE BIT(12) #define TSC_DISABLE BIT(16) #define DETECT_MODE 0x2 @@ -98,6 +98,7 @@ struct imx6ul_tsc { u32 pre_charge_time; bool average_enable; u32 average_select; + u32 de_glitch; struct completion completion; }; @@ -205,7 +206,7 @@ static void imx6ul_tsc_set(struct imx6ul_tsc *tsc) basic_setting |= AUTO_MEASURE; writel(basic_setting, tsc->tsc_regs + REG_TSC_BASIC_SETTING); - debug_mode2 = FIELD_PREP(DE_GLITCH_MASK, DE_GLITCH_2); + debug_mode2 = FIELD_PREP(DE_GLITCH_MASK, tsc->de_glitch); writel(debug_mode2, tsc->tsc_regs + REG_TSC_DEBUG_MODE2); writel(tsc->pre_charge_time, tsc->tsc_regs + REG_TSC_PRE_CHARGE_TIME); @@ -391,6 +392,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) int tsc_irq; int adc_irq; u32 average_samples; + u32 de_glitch; tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL); if (!tsc) @@ -513,6 +515,26 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) return -EINVAL; } + err = of_property_read_u32(np, "touchscreen-glitch-threshold-ns", + &de_glitch); + if (err) { + tsc->de_glitch = DE_GLITCH_DEF; + } else { + u64 cycles; + unsigned long rate = clk_get_rate(tsc->tsc_clk); + + cycles = DIV64_U64_ROUND_UP((u64)de_glitch * rate, NSEC_PER_SEC); + + if (cycles <= 0x3ff) + tsc->de_glitch = 3; + else if (cycles <= 0x7ff) + tsc->de_glitch = 2; + else if (cycles <= 0xfff) + tsc->de_glitch = 1; + else + tsc->de_glitch = 0; + } + err = input_register_device(tsc->input); if (err) { dev_err(&pdev->dev,