Skip to content

Commit 47f9326

Browse files
committed
dts: bindings: added stm32 tsc driver bindings
Added tsc pripheral bindings Signed-off-by: Arif Balik <[email protected]>
1 parent e8c5405 commit 47f9326

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Copyright (c) 2024 Arif Balik <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: STM32 Tocuh Sensing Controller (TSC) driver
5+
6+
compatible: "st,stm32-tsc"
7+
8+
include: [base.yaml, pinctrl-device.yaml, reset-device.yaml]
9+
10+
properties:
11+
reg:
12+
required: true
13+
clocks:
14+
required: true
15+
resets:
16+
required: true
17+
interrupts:
18+
required: true
19+
pinctrl-0:
20+
required: true
21+
pinctrl-names:
22+
required: true
23+
24+
st,pulse-generator-prescaler:
25+
type: int
26+
default: 0
27+
description: |
28+
Prescaler for the pulse generator clock (t_pgclk=f_hclk/prescaler).
29+
The prescaler is used to generate the charge transfer pulse. The final
30+
prescaled value is 2^N where N is the value of this property. The default
31+
uses the HCLK as the source clock with no prescaler.
32+
enum: [0, 1, 2, 3, 4, 5, 6, 7]
33+
34+
st,charge-transfer-pulse-high:
35+
type: int
36+
default: 2
37+
description: |
38+
Number of cycles for the high state of the
39+
charge transfer pulse (1 to 16 cycles of t_pgclk). The default keeps the
40+
pulse for 2 cycles which is just enough to charge the capacitors for most
41+
applications. Increase this value if change in capacitance is too low.
42+
enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
43+
44+
st,charge-transfer-pulse-low:
45+
type: int
46+
default: 2
47+
description: |
48+
Number of cycles for the low state of the
49+
charge transfer pulse (1 to 16 cycles of t_pgclk). The default discharges
50+
the capacitors for 2 cycles of the pulse generator clock, which is enough
51+
for most applications.
52+
enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
53+
54+
st,spread-spectrum:
55+
type: boolean
56+
description: Spread spectrum enable
57+
58+
st,spread-spectrum-prescaler:
59+
type: int
60+
default: 1
61+
description: Spread spectrum clock prescaler (t_ssclk)
62+
enum:
63+
- 1
64+
- 2
65+
66+
st,spread-spectrum-deviation:
67+
type: int
68+
default: 1
69+
description: Spread spectrum deviation (1 to 128 cycles of t_ssclk)
70+
71+
st,max-count-value:
72+
type: int
73+
default: 5
74+
description: |
75+
Max number of charge transfer pulses before max count error is generated.
76+
The value of the counter is calculated as 256 * 2^max_count_value. Default
77+
value is 5 which gives a maximum count of 8192, if you get max count error
78+
increase this value or the st,charge-transfer-pulse-high value.
79+
enum: [0, 1, 2, 3, 4, 5, 6, 7]
80+
81+
st,synced-acquisition:
82+
type: boolean
83+
description: |
84+
Synchronized acquisition enable.
85+
Acquisition starts when START bit and signal on sync pin.
86+
You have to provide a pinctrl for the sync pin.
87+
88+
st,syncpol-rising:
89+
type: boolean
90+
description: Rising synchronization pin polarity, instead of falling
91+
92+
st,iodef-float:
93+
type: boolean
94+
description: |
95+
Set default state (not acqusition) of all channel I/Os to floating.
96+
push-pull down by default.
97+
98+
child-binding:
99+
description: STM32 TSC group configuration
100+
properties:
101+
group:
102+
type: int
103+
required: true
104+
description: Group number (0 to 7)
105+
enum: [0, 1, 2, 3, 4, 5, 6, 7]
106+
107+
channel-ios:
108+
type: int
109+
default: 1
110+
description: Channel I/Os to be enabled
111+
enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
112+
113+
sampling-io:
114+
type: int
115+
required: true
116+
description: Channel to be selected for sampling
117+
enum:
118+
- 1
119+
- 2
120+
- 4
121+
- 8
122+
123+
st,use-as-shield:
124+
type: boolean
125+
description: |
126+
Use channel as shield. This configures group but
127+
does not enable it for acqusition. channel-io is used
128+
as shield pin and can only have values 1, 2, 4 or 8.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2024 Arif Balik <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_STM32_TSC_H_
7+
#define ZEPHYR_INCLUDE_DT_BINDINGS_STM32_TSC_H_
8+
9+
#define TSC_IO1 0x1UL
10+
#define TSC_IO2 0x2UL
11+
#define TSC_IO3 0x4UL
12+
#define TSC_IO4 0x8UL
13+
14+
#define TSC_PG_PRESCALER_1 0x0UL
15+
#define TSC_PG_PRESCALER_2 0x1UL
16+
#define TSC_PG_PRESCALER_4 0x2UL
17+
#define TSC_PG_PRESCALER_8 0x3UL
18+
#define TSC_PG_PRESCALER_16 0x4UL
19+
#define TSC_PG_PRESCALER_32 0x5UL
20+
#define TSC_PG_PRESCALER_64 0x6UL
21+
#define TSC_PG_PRESCALER_128 0x7UL
22+
23+
#define TSC_MAX_COUNT_255 0x0UL
24+
#define TSC_MAX_COUNT_511 0x1UL
25+
#define TSC_MAX_COUNT_1023 0x2UL
26+
#define TSC_MAX_COUNT_2047 0x3UL
27+
#define TSC_MAX_COUNT_4095 0x4UL
28+
#define TSC_MAX_COUNT_8191 0x5UL
29+
#define TSC_MAX_COUNT_16383 0x6UL
30+
#define TSC_MAX_COUNT_32767 0x7UL
31+
32+
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_STM32_TSC_H_ */

0 commit comments

Comments
 (0)