Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
19a3e160
Commit
19a3e160
authored
Jun 27, 2024
by
Dmitry Torokhov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ib/ads7846-hsync' into next
Bring in ADS7846 hsync changes.
parents
866a5c7e
8685f22b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
Documentation/devicetree/bindings/input/touchscreen/ads7846.txt
...ntation/devicetree/bindings/input/touchscreen/ads7846.txt
+1
-0
drivers/input/touchscreen/ads7846.c
drivers/input/touchscreen/ads7846.c
+29
-6
No files found.
Documentation/devicetree/bindings/input/touchscreen/ads7846.txt
View file @
19a3e160
...
...
@@ -57,6 +57,7 @@ Optional properties:
pendown-gpio (u32).
pendown-gpio GPIO handle describing the pin the !PENIRQ
line is connected to.
ti,hsync-gpios GPIO line to poll for hsync
wakeup-source use any event on touchscreen as wakeup event.
(Legacy property support: "linux,wakeup")
touchscreen-size-x General touchscreen binding, see [1].
...
...
drivers/input/touchscreen/ads7846.c
View file @
19a3e160
...
...
@@ -138,6 +138,7 @@ struct ads7846 {
void
*
filter_data
;
int
(
*
get_pendown_state
)(
void
);
struct
gpio_desc
*
gpio_pendown
;
struct
gpio_desc
*
gpio_hsync
;
void
(
*
wait_for_sync
)(
void
);
};
...
...
@@ -634,10 +635,6 @@ ATTRIBUTE_GROUPS(ads784x);
/*--------------------------------------------------------------------------*/
static
void
null_wait_for_sync
(
void
)
{
}
static
int
ads7846_debounce_filter
(
void
*
ads
,
int
data_idx
,
int
*
val
)
{
struct
ads7846
*
ts
=
ads
;
...
...
@@ -790,6 +787,28 @@ static int ads7846_filter(struct ads7846 *ts)
return
0
;
}
static
void
ads7846_wait_for_hsync
(
struct
ads7846
*
ts
)
{
if
(
ts
->
wait_for_sync
)
{
ts
->
wait_for_sync
();
return
;
}
if
(
!
ts
->
gpio_hsync
)
return
;
/*
* Wait for HSYNC to assert the line should be flagged
* as active low so here we are waiting for it to assert
*/
while
(
!
gpiod_get_value
(
ts
->
gpio_hsync
))
cpu_relax
();
/* Then we wait for it do de-assert */
while
(
gpiod_get_value
(
ts
->
gpio_hsync
))
cpu_relax
();
}
static
void
ads7846_read_state
(
struct
ads7846
*
ts
)
{
struct
ads7846_packet
*
packet
=
ts
->
packet
;
...
...
@@ -800,7 +819,7 @@ static void ads7846_read_state(struct ads7846 *ts)
packet
->
last_cmd_idx
=
0
;
while
(
true
)
{
ts
->
wait_for_sync
(
);
ads7846_wait_for_hsync
(
ts
);
m
=
&
ts
->
msg
[
msg_idx
];
error
=
spi_sync
(
ts
->
spi
,
m
);
...
...
@@ -1258,7 +1277,11 @@ static int ads7846_probe(struct spi_device *spi)
ts
->
penirq_recheck_delay_usecs
=
pdata
->
penirq_recheck_delay_usecs
;
ts
->
wait_for_sync
=
pdata
->
wait_for_sync
?
:
null_wait_for_sync
;
ts
->
wait_for_sync
=
pdata
->
wait_for_sync
;
ts
->
gpio_hsync
=
devm_gpiod_get_optional
(
dev
,
"ti,hsync"
,
GPIOD_IN
);
if
(
IS_ERR
(
ts
->
gpio_hsync
))
return
PTR_ERR
(
ts
->
gpio_hsync
);
snprintf
(
ts
->
phys
,
sizeof
(
ts
->
phys
),
"%s/input0"
,
dev_name
(
dev
));
snprintf
(
ts
->
name
,
sizeof
(
ts
->
name
),
"ADS%d Touchscreen"
,
ts
->
model
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment