Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
ce4065e9
Commit
ce4065e9
authored
Dec 30, 2013
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug cleanup
parent
8d9930c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
17 deletions
+18
-17
si5338.c
drivers/misc/si5338.c
+15
-14
vsc330x.c
drivers/misc/vsc330x.c
+3
-3
No files found.
drivers/misc/si5338.c
View file @
ce4065e9
...
...
@@ -18,6 +18,7 @@
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define DEBUG
/* should be before linux/module.h - enables dev_dbg at boot in this file (needs "debug" in bootarg)*/
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/kernel.h>
...
...
@@ -3783,7 +3784,7 @@ static int set_ms_p123(struct i2c_client *client,u32 * p123, int chn) /* chn 0,1
else
p123
[
0
]
=
256
;
p123
[
1
]
=
0
;
p123
[
2
]
=
1
;
dev_
info
(
&
client
->
dev
,
"Using high speed divisor option on ms%d"
,
chn
);
dev_
dbg
(
&
client
->
dev
,
"Using high speed divisor option on ms%d"
,
chn
);
}
else
hs
=
0
;
if
(((
rc
=
write_field
(
client
,
hs
,
awe_ms_hs
[
chn
])))
<
0
)
return
rc
;
/* optionally disable spread spectrum before changing frequency */
...
...
@@ -4574,7 +4575,7 @@ static void si5338_init_of(struct i2c_client *client)
return
;
}
else
if
(
i
>
0
){
init_type
=
0
;
dev_
info
(
&
client
->
dev
,
"Skipping conditional initialization (some driver variables will not be initialized)
\n
"
);
dev_
dbg
(
&
client
->
dev
,
"Skipping conditional initialization (some driver variables will not be initialized)
\n
"
);
return
;
}
init_type
=
1
;
...
...
@@ -4588,7 +4589,7 @@ static void si5338_init_of(struct i2c_client *client)
if
(
config_data
){
len
/=
sizeof
(
*
config_data
);
dev_dbg
(
&
client
->
dev
,
"Read %d values
\n
"
,
len
);
dev_
info
(
&
client
->
dev
,
"Found %d items in 'si5338,configuration_data' in the Device Tree
\n
"
,
len
);
dev_
dbg
(
&
client
->
dev
,
"Found %d items in 'si5338,configuration_data' in the Device Tree
\n
"
,
len
);
for
(
i
=
0
;
i
<
len
;
i
++
){
*
setup_data_be32
=
config_data
[
i
];
page_reg
=
setup_data
.
reg
+
(
setup_data
.
page
<<
8
);
...
...
@@ -4603,7 +4604,7 @@ static void si5338_init_of(struct i2c_client *client)
sprintf
(
buf
,
"si5338,%s"
,
in_freq_names
[
n
]);
config_data
=
of_get_property
(
client
->
dev
.
of_node
,
buf
,
&
len
);
if
(
config_data
&&
(
len
>
0
)){
dev_
info
(
&
client
->
dev
,
"Found '%s', value = %d (0x%x)
\n
"
,
buf
,(
int
)(
be32_to_cpup
(
config_data
)),(
int
)(
be32_to_cpup
(
config_data
)));
dev_
dbg
(
&
client
->
dev
,
"Found '%s', value = %d (0x%x)
\n
"
,
buf
,(
int
)(
be32_to_cpup
(
config_data
)),(
int
)(
be32_to_cpup
(
config_data
)));
if
(
set_in_frequency
(
client
,
be32_to_cpup
(
config_data
),
n
)
<
0
)
return
;
/* 32 bits are sufficient here */
}
}
...
...
@@ -4621,7 +4622,7 @@ static void si5338_init_of(struct i2c_client *client)
freq
[
1
]
=
be32_to_cpup
(
&
config_data
[
1
]);
freq
[
2
]
=
be32_to_cpup
(
&
config_data
[
2
]);
}
dev_
info
(
&
client
->
dev
,
"Found '%s', value = %lld+(%lld/%lld)
\n
"
,
buf
,
freq
[
0
],
freq
[
1
],
freq
[
2
]);
dev_
dbg
(
&
client
->
dev
,
"Found '%s', value = %lld+(%lld/%lld)
\n
"
,
buf
,
freq
[
0
],
freq
[
1
],
freq
[
2
]);
if
(
n
&
2
){
/* by output */
if
(
set_pll_freq_by_out
(
client
,
freq
,
n
&
1
)
<
0
)
return
;
}
else
{
/* directly set PLL frequency */
...
...
@@ -4645,7 +4646,7 @@ static void si5338_init_of(struct i2c_client *client)
freq
[
1
]
=
be32_to_cpup
(
&
config_data
[
1
]);
freq
[
2
]
=
be32_to_cpup
(
&
config_data
[
2
]);
}
dev_
info
(
&
client
->
dev
,
"Found '%s', value = %lld+(%lld/%lld)
\n
"
,
buf
,
freq
[
0
],
freq
[
1
],
freq
[
2
]);
dev_
dbg
(
&
client
->
dev
,
"Found '%s', value = %lld+(%lld/%lld)
\n
"
,
buf
,
freq
[
0
],
freq
[
1
],
freq
[
2
]);
if
(
set_out_frequency_and_route
(
client
,
freq
,
n
&
3
,
n
>>
2
)
<
0
)
return
;
}
}
...
...
@@ -4657,7 +4658,7 @@ static void si5338_init_of(struct i2c_client *client)
len
/=
sizeof
(
*
config_data
);
for
(
i
=
0
;
i
<
len
;
i
++
){
*
setup_data_be32
=
config_data
[
i
];
dev_
info
(
&
client
->
dev
,
"Setting '%s', channel %d"
,
buf
,
setup_data
.
mask
);
dev_
dbg
(
&
client
->
dev
,
"Setting '%s', channel %d"
,
buf
,
setup_data
.
mask
);
if
(
configure_output_driver
(
&
client
->
dev
,
drv_configs
[
n
].
description
,
setup_data
.
mask
)
<
0
)
return
;
}
}
...
...
@@ -4671,7 +4672,7 @@ static void si5338_init_of(struct i2c_client *client)
len
/=
sizeof
(
*
config_data
);
for
(
i
=
0
;
i
<
len
;
i
++
){
*
setup_data_be32
=
config_data
[
i
];
dev_
info
(
&
client
->
dev
,
"Setting '%s', channel %d"
,
buf
,
setup_data
.
mask
);
dev_
dbg
(
&
client
->
dev
,
"Setting '%s', channel %d"
,
buf
,
setup_data
.
mask
);
if
(
set_drv_disable
(
client
,
n
,
setup_data
.
mask
)
<
0
)
return
;
}
}
...
...
@@ -4685,7 +4686,7 @@ static void si5338_init_of(struct i2c_client *client)
len
/=
sizeof
(
*
config_data
);
for
(
i
=
0
;
i
<
len
;
i
++
){
*
setup_data_be32
=
config_data
[
i
];
dev_
info
(
&
client
->
dev
,
"Setting '%s', channel %d"
,
buf
,
setup_data
.
mask
);
dev_
dbg
(
&
client
->
dev
,
"Setting '%s', channel %d"
,
buf
,
setup_data
.
mask
);
if
(
set_drv_powerdown
(
client
,
n
,
setup_data
.
mask
)
<
0
)
return
;
}
}
...
...
@@ -4699,7 +4700,7 @@ static void si5338_init_of(struct i2c_client *client)
len
/=
sizeof
(
*
config_data
);
for
(
i
=
0
;
i
<
len
;
i
++
){
*
setup_data_be32
=
config_data
[
i
];
dev_
info
(
&
client
->
dev
,
"Setting '%s', channel %d"
,
buf
,
setup_data
.
mask
);
dev_
dbg
(
&
client
->
dev
,
"Setting '%s', channel %d"
,
buf
,
setup_data
.
mask
);
if
(
set_drv_disable
(
client
,
n
,
setup_data
.
mask
)
<
0
)
return
;
}
}
...
...
@@ -4715,7 +4716,7 @@ static void si5338_init_of(struct i2c_client *client)
if
(
len
>
1
)
amp
=
be32_to_cpup
(
&
config_data
[
1
]);
if
(
len
>
2
)
rate
=
be32_to_cpup
(
&
config_data
[
2
]);
if
(
store_ss_down_parameters
(
client
,
rate
,
amp
,
n
)
==
0
){
dev_
info
(
&
client
->
dev
,
"Set spread spectrum parameters for MS%d, amplitude=%d (*0.01%%), rate=%d Hz, %s
\n
"
,
dev_
dbg
(
&
client
->
dev
,
"Set spread spectrum parameters for MS%d, amplitude=%d (*0.01%%), rate=%d Hz, %s
\n
"
,
n
,
amp
,
rate
,
config_data
[
0
]
?
"ON"
:
"OFF"
);
}
else
{
dev_err
(
&
client
->
dev
,
"Failed to set spread spectrum parameters for MS%d, amplitude=%d (*0.01%%), rate=%d Hz, %s
\n
"
,
...
...
@@ -4725,9 +4726,9 @@ static void si5338_init_of(struct i2c_client *client)
if
(
config_data
[
0
]){
/* enable SS */
if
((
set_ss_down
(
client
,
n
)
==
0
)
&&
/* calculate and set SS registers */
(
set_ss_state
(
client
,
1
,
n
)
==
0
)){
// enable SS. Not using enable_spread_spectrum() as we'll reset MS later anyway
dev_
info
(
&
client
->
dev
,
"Spread spectrum enabled for MS%d
\n
"
,
n
);
dev_
dbg
(
&
client
->
dev
,
"Spread spectrum enabled for MS%d
\n
"
,
n
);
}
else
{
dev_
info
(
&
client
->
dev
,
"Fail to enable spread spectrum for MS%d
\n
"
,
n
);
dev_
err
(
&
client
->
dev
,
"Fail to enable spread spectrum for MS%d
\n
"
,
n
);
}
}
}
...
...
@@ -4764,7 +4765,7 @@ static int si5338_i2c_probe(struct i2c_client *client,
if
(((
rc
=
_write_single_reg
(
client
,
REG5338_PAGE
,
0
)))
<
0
)
return
rc
;
// did not respond
if
(((
rc
=
read_reg
(
client
,
REG5338_DEV_CONFIG2
)))
<
0
)
return
rc
;
// did not respond
if
((
rc
&
REG5338_DEV_CONFIG2_MASK
)
!=
REG5338_DEV_CONFIG2_VAL
){
dev_
info
(
&
client
->
dev
,
dev_
err
(
&
client
->
dev
,
"Chip returned unexpected value from reg %d: %d, expected %d. It is not %s
\n
"
,
REG5338_DEV_CONFIG2
,
rc
,
REG5338_DEV_CONFIG2_VAL
,
id
->
name
);
return
-
EIO
;
...
...
drivers/misc/vsc330x.c
View file @
ce4065e9
...
...
@@ -296,8 +296,8 @@ static int make_group (struct device *dev, const char * name, int port_mask, mod
ssize_t
(
*
show
)(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
),
ssize_t
(
*
store
)(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
)
{
const
char
*
buf
,
size_t
count
)
)
{
int
retval
=-
1
;
int
port
,
index
=
0
,
num_regs
;
struct
attribute
**
pattrs
;
/* array of pointers to attibutes */
...
...
@@ -790,7 +790,7 @@ static void vsc330x_init_of(struct i2c_client *client)
dev_dbg
(
&
client
->
dev
,
"page=0x%02x, reg=0x%02x, data=0x%02x, mask=0x%02x
\n
"
,
(
int
)
setup_data
.
page
,
(
int
)
setup_data
.
reg
,(
int
)
setup_data
.
data
,(
int
)
setup_data
.
mask
);
if
(((
rc
=
write_page_with_mask
(
client
,
(
setup_data
.
page
==
0xff
)
?-
1
:
setup_data
.
page
,
setup_data
.
reg
,
setup_data
.
data
,
setup_data
.
mask
)))
<
0
)
return
rc
;
setup_data
.
data
,
setup_data
.
mask
)))
<
0
)
return
;
}
}
else
{
dev_info
(
&
client
->
dev
,
"'vsc330x,configuration_data' not found
\n
"
);
...
...
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