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
nexedi
linux
Commits
02108949
Commit
02108949
authored
Mar 20, 2010
by
Mauro Carvalho Chehab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V4L/DVB: saa7134: add code to allow changing IR protocol
Signed-off-by:
Mauro Carvalho Chehab
<
mchehab@redhat.com
>
parent
d152b8b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
4 deletions
+63
-4
drivers/media/video/saa7134/saa7134-input.c
drivers/media/video/saa7134/saa7134-input.c
+60
-4
include/media/ir-common.h
include/media/ir-common.h
+3
-0
No files found.
drivers/media/video/saa7134/saa7134-input.c
View file @
02108949
...
@@ -421,6 +421,10 @@ static void saa7134_input_timer(unsigned long data)
...
@@ -421,6 +421,10 @@ static void saa7134_input_timer(unsigned long data)
void
saa7134_ir_start
(
struct
saa7134_dev
*
dev
,
struct
card_ir
*
ir
)
void
saa7134_ir_start
(
struct
saa7134_dev
*
dev
,
struct
card_ir
*
ir
)
{
{
if
(
ir
->
running
)
return
;
ir
->
running
=
1
;
if
(
ir
->
polling
)
{
if
(
ir
->
polling
)
{
setup_timer
(
&
ir
->
timer
,
saa7134_input_timer
,
setup_timer
(
&
ir
->
timer
,
saa7134_input_timer
,
(
unsigned
long
)
dev
);
(
unsigned
long
)
dev
);
...
@@ -448,8 +452,50 @@ void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir)
...
@@ -448,8 +452,50 @@ void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir)
void
saa7134_ir_stop
(
struct
saa7134_dev
*
dev
)
void
saa7134_ir_stop
(
struct
saa7134_dev
*
dev
)
{
{
struct
card_ir
*
ir
=
dev
->
remote
;
if
(
!
ir
->
running
)
return
;
if
(
dev
->
remote
->
polling
)
if
(
dev
->
remote
->
polling
)
del_timer_sync
(
&
dev
->
remote
->
timer
);
del_timer_sync
(
&
dev
->
remote
->
timer
);
else
if
(
ir
->
rc5_gpio
)
del_timer_sync
(
&
ir
->
timer_end
);
else
if
(
ir
->
nec_gpio
)
tasklet_kill
(
&
ir
->
tlet
);
ir
->
running
=
0
;
}
int
saa7134_ir_change_protocol
(
void
*
priv
,
u64
ir_type
)
{
struct
saa7134_dev
*
dev
=
priv
;
struct
card_ir
*
ir
=
dev
->
remote
;
u32
nec_gpio
,
rc5_gpio
;
if
(
ir_type
==
IR_TYPE_RC5
)
{
dprintk
(
"Changing protocol to RC5
\n
"
);
nec_gpio
=
0
;
rc5_gpio
=
1
;
}
else
if
(
ir_type
==
IR_TYPE_NEC
)
{
dprintk
(
"Changing protocol to NEC
\n
"
);
nec_gpio
=
1
;
rc5_gpio
=
0
;
}
else
{
dprintk
(
"IR protocol type %ud is not supported
\n
"
,
(
unsigned
)
ir_type
);
return
-
EINVAL
;
}
if
(
ir
->
running
)
{
saa7134_ir_stop
(
dev
);
ir
->
nec_gpio
=
nec_gpio
;
ir
->
rc5_gpio
=
rc5_gpio
;
saa7134_ir_start
(
dev
,
ir
);
}
else
{
ir
->
nec_gpio
=
nec_gpio
;
ir
->
rc5_gpio
=
rc5_gpio
;
}
return
0
;
}
}
int
saa7134_input_init1
(
struct
saa7134_dev
*
dev
)
int
saa7134_input_init1
(
struct
saa7134_dev
*
dev
)
...
@@ -698,6 +744,9 @@ int saa7134_input_init1(struct saa7134_dev *dev)
...
@@ -698,6 +744,9 @@ int saa7134_input_init1(struct saa7134_dev *dev)
}
}
ir
->
dev
=
input_dev
;
ir
->
dev
=
input_dev
;
dev
->
remote
=
ir
;
ir
->
running
=
0
;
/* init hardware-specific stuff */
/* init hardware-specific stuff */
ir
->
mask_keycode
=
mask_keycode
;
ir
->
mask_keycode
=
mask_keycode
;
...
@@ -713,6 +762,14 @@ int saa7134_input_init1(struct saa7134_dev *dev)
...
@@ -713,6 +762,14 @@ int saa7134_input_init1(struct saa7134_dev *dev)
snprintf
(
ir
->
phys
,
sizeof
(
ir
->
phys
),
"pci-%s/ir0"
,
snprintf
(
ir
->
phys
,
sizeof
(
ir
->
phys
),
"pci-%s/ir0"
,
pci_name
(
dev
->
pci
));
pci_name
(
dev
->
pci
));
if
(
ir_codes
->
ir_type
!=
IR_TYPE_OTHER
)
{
ir
->
props
.
allowed_protos
=
IR_TYPE_RC5
|
IR_TYPE_NEC
;
ir
->
props
.
priv
=
dev
;
ir
->
props
.
change_protocol
=
saa7134_ir_change_protocol
;
/* Set IR protocol */
saa7134_ir_change_protocol
(
ir
->
props
.
priv
,
ir_codes
->
ir_type
);
}
err
=
ir_input_init
(
input_dev
,
&
ir
->
ir
,
ir_type
);
err
=
ir_input_init
(
input_dev
,
&
ir
->
ir
,
ir_type
);
if
(
err
<
0
)
if
(
err
<
0
)
goto
err_out_free
;
goto
err_out_free
;
...
@@ -730,13 +787,12 @@ int saa7134_input_init1(struct saa7134_dev *dev)
...
@@ -730,13 +787,12 @@ int saa7134_input_init1(struct saa7134_dev *dev)
}
}
input_dev
->
dev
.
parent
=
&
dev
->
pci
->
dev
;
input_dev
->
dev
.
parent
=
&
dev
->
pci
->
dev
;
dev
->
remote
=
ir
;
err
=
ir_input_register
(
ir
->
dev
,
ir_codes
,
&
ir
->
props
,
MODULE_NAME
);
saa7134_ir_start
(
dev
,
ir
);
err
=
ir_input_register
(
ir
->
dev
,
ir_codes
,
NULL
,
MODULE_NAME
);
if
(
err
)
if
(
err
)
goto
err_out_stop
;
goto
err_out_stop
;
saa7134_ir_start
(
dev
,
ir
);
/* the remote isn't as bouncy as a keyboard */
/* the remote isn't as bouncy as a keyboard */
ir
->
dev
->
rep
[
REP_DELAY
]
=
repeat_delay
;
ir
->
dev
->
rep
[
REP_DELAY
]
=
repeat_delay
;
ir
->
dev
->
rep
[
REP_PERIOD
]
=
repeat_period
;
ir
->
dev
->
rep
[
REP_PERIOD
]
=
repeat_period
;
...
...
include/media/ir-common.h
View file @
02108949
...
@@ -51,6 +51,9 @@ struct card_ir {
...
@@ -51,6 +51,9 @@ struct card_ir {
char
name
[
32
];
char
name
[
32
];
char
phys
[
32
];
char
phys
[
32
];
u32
running
:
1
;
struct
ir_dev_props
props
;
/* Usual gpio signalling */
/* Usual gpio signalling */
u32
mask_keycode
;
u32
mask_keycode
;
...
...
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