Skip to content

Commit d428487

Browse files
author
William Breathitt Gray
committed
counter: i8254: Introduce the Intel 8254 interface library module
Exposes consumer library functions providing support for interfaces compatible with the venerable Intel 8254 Programmable Interval Timer (PIT). The Intel 8254 PIT first appeared in the early 1980s and was used initially in IBM PC compatibles. The popularity of the original Intel 825x family of chips led to many subsequent variants and clones of the interface in various chips and integrated circuits. Although still popular, interfaces compatible with the Intel 8254 PIT are nowdays typically found embedded in larger VLSI processing chips and FPGA components rather than as discrete ICs. A CONFIG_I8254 Kconfig option is introduced by this patch. Modules wanting access to these i8254 library functions should select this Kconfig option, and import the I8254 symbol namespace. Link: https://lore.kernel.org/r/f6fe32c2db9525d816ab1a01f45abad56c081652.1681665189.git.william.gray@linaro.org/ Signed-off-by: William Breathitt Gray <[email protected]>
1 parent 98ffe02 commit d428487

File tree

8 files changed

+558
-1
lines changed

8 files changed

+558
-1
lines changed

Documentation/ABI/testing/sysfs-bus-counter

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,60 @@ Description:
9090
counter does not freeze at the boundary points, but
9191
counts continuously throughout.
9292

93+
interrupt on terminal count:
94+
The output signal is initially low, and will remain low
95+
until the counter reaches zero. The output signal then
96+
goes high and remains high until a new preset value is
97+
set.
98+
99+
hardware retriggerable one-shot:
100+
The output signal is initially high. The output signal
101+
will go low by a trigger input signal, and will remain
102+
low until the counter reaches zero. The output will then
103+
go high and remain high until the next trigger. A
104+
trigger results in loading the counter to the preset
105+
value and setting the output signal low, thus starting
106+
the one-shot pulse.
107+
108+
rate generator:
109+
The output signal is initially high. When the counter
110+
has decremented to 1, the output signal goes low for one
111+
clock pulse. The output signal then goes high again, the
112+
counter is reloaded to the preset value, and the process
113+
repeats in a periodic manner as such.
114+
115+
square wave mode:
116+
The output signal is initially high.
117+
118+
If the initial count is even, the counter is decremented
119+
by two on succeeding clock pulses. When the count
120+
expires, the output signal changes value and the
121+
counter is reloaded to the preset value. The process
122+
repeats in periodic manner as such.
123+
124+
If the initial count is odd, the initial count minus one
125+
(an even number) is loaded and then is decremented by
126+
two on succeeding clock pulses. One clock pulse after
127+
the count expires, the output signal goes low and the
128+
counter is reloaded to the preset value minus one.
129+
Succeeding clock pulses decrement the count by two. When
130+
the count expires, the output goes high again and the
131+
counter is reloaded to the preset value minus one. The
132+
process repeats in a periodic manner as such.
133+
134+
software triggered strobe:
135+
The output signal is initially high. When the count
136+
expires, the output will go low for one clock pulse and
137+
then go high again. The counting sequence is "triggered"
138+
by setting the preset value.
139+
140+
hardware triggered strobe:
141+
The output signal is initially high. Counting is started
142+
by a trigger input signal. When the count expires, the
143+
output signal will go low for one clock pulse and then
144+
go high again. A trigger results in loading the counter
145+
to the preset value.
146+
93147
What: /sys/bus/counter/devices/counterX/countY/count_mode_available
94148
What: /sys/bus/counter/devices/counterX/countY/error_noise_available
95149
What: /sys/bus/counter/devices/counterX/countY/function_available

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10257,6 +10257,13 @@ L: [email protected]
1025710257
S: Maintained
1025810258
F: drivers/video/fbdev/i810/
1025910259

10260+
INTEL 8254 COUNTER DRIVER
10261+
M: William Breathitt Gray <[email protected]>
10262+
10263+
S: Maintained
10264+
F: drivers/counter/i8254.c
10265+
F: include/linux/i8254.h
10266+
1026010267
INTEL 8255 GPIO DRIVER
1026110268
M: William Breathitt Gray <[email protected]>
1026210269

drivers/counter/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ menuconfig COUNTER
1010
interface. You only need to enable this, if you also want to enable
1111
one or more of the counter device drivers below.
1212

13+
config I8254
14+
tristate
15+
select COUNTER
16+
select REGMAP
17+
help
18+
Enables support for the i8254 interface library functions. The i8254
19+
interface library provides functions to facilitate communication with
20+
interfaces compatible with the venerable Intel 8254 Programmable
21+
Interval Timer (PIT). The Intel 825x family of chips was first
22+
released in the early 1980s but compatible interfaces are nowadays
23+
typically found embedded in larger VLSI processing chips and FPGA
24+
components.
25+
26+
If built as a module its name will be i8254.
27+
1328
if COUNTER
1429

1530
config 104_QUAD_8

drivers/counter/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
obj-$(CONFIG_COUNTER) += counter.o
77
counter-y := counter-core.o counter-sysfs.o counter-chrdev.o
88

9+
obj-$(CONFIG_I8254) += i8254.o
910
obj-$(CONFIG_104_QUAD_8) += 104-quad-8.o
1011
obj-$(CONFIG_INTERRUPT_CNT) += interrupt-cnt.o
1112
obj-$(CONFIG_RZ_MTU3_CNT) += rz-mtu3-cnt.o

drivers/counter/counter-sysfs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ static const char *const counter_count_mode_str[] = {
8888
[COUNTER_COUNT_MODE_NORMAL] = "normal",
8989
[COUNTER_COUNT_MODE_RANGE_LIMIT] = "range limit",
9090
[COUNTER_COUNT_MODE_NON_RECYCLE] = "non-recycle",
91-
[COUNTER_COUNT_MODE_MODULO_N] = "modulo-n"
91+
[COUNTER_COUNT_MODE_MODULO_N] = "modulo-n",
92+
[COUNTER_COUNT_MODE_INTERRUPT_ON_TERMINAL_COUNT] = "interrupt on terminal count",
93+
[COUNTER_COUNT_MODE_HARDWARE_RETRIGGERABLE_ONESHOT] = "hardware retriggerable one-shot",
94+
[COUNTER_COUNT_MODE_RATE_GENERATOR] = "rate generator",
95+
[COUNTER_COUNT_MODE_SQUARE_WAVE_MODE] = "square wave mode",
96+
[COUNTER_COUNT_MODE_SOFTWARE_TRIGGERED_STROBE] = "software triggered strobe",
97+
[COUNTER_COUNT_MODE_HARDWARE_TRIGGERED_STROBE] = "hardware triggered strobe",
9298
};
9399

94100
static const char *const counter_signal_polarity_str[] = {

0 commit comments

Comments
 (0)