Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha
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 ADC 100M 14b 4cha
Commits
45f25d71
Commit
45f25d71
authored
Sep 22, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: fix temperature sign propagation
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
2f96d404
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
10 deletions
+23
-10
driver.rst
doc/software/driver.rst
+5
-1
fa-calibration.c
software/kernel/fa-calibration.c
+13
-6
fa-core.c
software/kernel/fa-core.c
+5
-3
No files found.
doc/software/driver.rst
View file @
45f25d71
...
...
@@ -81,7 +81,11 @@ enable_test_data=[0, 1]
range, channel 1 goes from 0 to 511, other channel always report 0.
Trigger detection is unaffected by use of test data.
fa_calib_period_s=NUMBER
temp_calib=[0, 1] (Experimental)
It enables (1) or disables (0) the gain compensation based on the
current temperature. By default it is disabled.
temp_calib_period=NUMBER
The ADC periodically adjusts the calibration data based on the
current temperature. You can use this module parameter to pass
your period in seconds. By default the value is 0 (meaning
...
...
software/kernel/fa-calibration.c
View file @
45f25d71
...
...
@@ -14,8 +14,11 @@
#include <linux/jiffies.h>
#include <fmc-adc-100m14b4cha.h>
static
int
fa_calib_period_s
=
0
;
module_param_named
(
calib_s
,
fa_calib_period_s
,
int
,
0444
);
static
int
fa_calib_temp_period
=
0
;
module_param_named
(
temp_calib_period
,
fa_calib_temp_period
,
int
,
0444
);
static
int
fa_calib_temp
=
0
;
module_param_named
(
temp_calib
,
fa_calib_temp
,
int
,
0444
);
/* This identity calibration is used as default */
static
const
struct
fa_calib_stanza
fa_identity_calib
=
{
...
...
@@ -132,6 +135,9 @@ static int fa_calib_dac_gain_fix(int range, uint32_t gain_c,
static
bool
fa_calib_is_compensation_on
(
struct
fa_dev
*
fa
)
{
if
(
unlikely
(
fa_calib_temp
))
return
true
;
if
(
unlikely
((
fa
->
flags
&
FA_DEV_F_PATTERN_DATA
)))
return
false
;
...
...
@@ -307,7 +313,7 @@ static void fa_calib_gain_update(unsigned long arg)
struct
fa_dev
*
fa
=
(
void
*
)
arg
;
fa_calib_config
(
fa
);
mod_timer
(
&
fa
->
calib_timer
,
jiffies
+
HZ
*
fa_calib_
period_s
);
mod_timer
(
&
fa
->
calib_timer
,
jiffies
+
HZ
*
fa_calib_
temp_period
);
}
/* Actual verification code */
...
...
@@ -477,9 +483,10 @@ int fa_calib_init(struct fa_dev *fa)
/* Prepare the timely recalibration */
fa_calib_config
(
fa
);
if
(
fa_calib_
period_s
)
{
if
(
fa_calib_
is_compensation_on
(
fa
)
&&
fa_calib_temp_period
)
{
setup_timer
(
&
fa
->
calib_timer
,
fa_calib_gain_update
,
(
unsigned
long
)
fa
);
mod_timer
(
&
fa
->
calib_timer
,
jiffies
+
HZ
*
fa_calib_period_s
);
mod_timer
(
&
fa
->
calib_timer
,
jiffies
+
HZ
*
fa_calib_temp_period
);
}
out:
...
...
@@ -488,7 +495,7 @@ out:
void
fa_calib_exit
(
struct
fa_dev
*
fa
)
{
if
(
fa_calib_
period_s
)
if
(
fa_calib_
temp_period
)
del_timer_sync
(
&
fa
->
calib_timer
);
fa_identity_calib_set
(
&
fa
->
calib
);
fa_calib_config
(
fa
);
...
...
software/kernel/fa-core.c
View file @
45f25d71
...
...
@@ -94,11 +94,13 @@ bool fa_adc_is_output_randomizer(struct fa_dev *fa)
*/
int32_t
fa_temperature_read
(
struct
fa_dev
*
fa
)
{
uint32_t
raw_temp
;
uint32_t
reg
;
int16_t
raw_temp
;
raw_temp
=
fa_readl
(
fa
,
fa
->
fa_ow_base
,
&
zfad_regs
[
ZFA_DS18B20_TEMP
]);
reg
=
fa_readl
(
fa
,
fa
->
fa_ow_base
,
&
zfad_regs
[
ZFA_DS18B20_TEMP
]);
raw_temp
=
reg
&
0xFFFF
;
return
(
raw_temp
*
1000
+
8
)
/
16
;
return
(
raw_temp
*
1000
UL
+
8
)
/
16
;
}
/**
...
...
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