Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 4cha - Software
Commits
0808e84a
Commit
0808e84a
authored
Feb 26, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HALF-WORKING: vcxo attribute: read works, write likely not
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
b8fb123f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
1 deletion
+38
-1
fd-core.c
kernel/fd-core.c
+38
-1
No files found.
kernel/fd-core.c
View file @
0808e84a
...
...
@@ -122,6 +122,38 @@ static struct fd_modlist mods[] = {
SUBSYS
(
zio
),
};
/* We have an attribute specific to this card */
static
ssize_t
fd_show_vcxo
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
struct
fmc_device
*
fmc
=
container_of
(
dev
,
struct
fmc_device
,
dev
);
struct
fd_dev
*
fd
=
fmc
->
mezzanine_data
;
/* FIXME: if WR-mode, return -1 as vcxo is driven by softpll */
return
sprintf
(
buf
,
"%i
\n
"
,
fd
->
current_vcxo_dac
);
}
ssize_t
fd_store_vcxo
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
{
struct
fmc_device
*
fmc
=
container_of
(
dev
,
struct
fmc_device
,
dev
);
struct
fd_dev
*
fd
=
fmc
->
mezzanine_data
;
int
vcxo
;
char
*
rest
;
/* checkpatck complains, but kstrtol only exists since 2.6.39 */
vcxo
=
simple_strtol
(
buf
,
&
rest
,
10
);
if
(
rest
&&
*
rest
)
return
-
EINVAL
;
if
(
vcxo
&
~
0xffff
)
return
-
EINVAL
;
/* FIXME: if WR-mode, refuse writing the dac */
fd_spi_set_vcxo
(
fd
,
vcxo
);
return
count
;
}
static
DEVICE_ATTR
(
vcxo
,
0644
,
fd_show_vcxo
,
fd_store_vcxo
);
/* probe and remove are called by the FMC bus core */
int
fd_probe
(
struct
fmc_device
*
fmc
)
{
...
...
@@ -239,11 +271,14 @@ int fd_probe(struct fmc_device *fmc)
}
}
/*
Finally, enable the input em
gine */
/*
Enable the input en
gine */
ret
=
fd_irq_init
(
fd
);
if
(
ret
<
0
)
goto
err
;
/* Create our own attribute */
device_create_file
(
dev
,
&
dev_attr_vcxo
);
if
(
0
)
{
struct
timespec
ts1
,
ts2
,
ts3
;
/* Temporarily, test the time stuff */
...
...
@@ -280,6 +315,8 @@ int fd_remove(struct fmc_device *fmc)
if
(
!
test_bit
(
FD_FLAG_INITED
,
&
fd
->
flags
))
/* FIXME: ditch this */
return
0
;
/* No init, no exit */
device_remove_file
(
&
fmc
->
dev
,
&
dev_attr_vcxo
);
fd_irq_exit
(
fd
);
while
(
--
i
>=
0
)
{
m
=
mods
+
i
;
...
...
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