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
53b17607
Commit
53b17607
authored
Feb 02, 2023
by
Vaibhav Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! software: kernel: Use HWMON API to expose Temperature
parent
269e67b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
fa-hwmon.c
software/kernel/fa-hwmon.c
+25
-18
fmc-adc-100m14b4cha-private.h
software/kernel/fmc-adc-100m14b4cha-private.h
+4
-1
No files found.
software/kernel/fa-hwmon.c
View file @
53b17607
...
...
@@ -3,6 +3,8 @@
/*
* Author: Vaibhav Gupta <vaibhav.gupta@cern.ch>
*
* Hardware Monitoring for fa-dev
*/
#include <linux/hwmon.h>
...
...
@@ -27,29 +29,13 @@ static int fa_hwmon_temp_read(struct device *dev, enum hwmon_sensor_types type,
return
0
;
}
static
char
*
fa_hwmon_temp_sensor_id
;
static
int
fa_hwmon_temp_sensor_id_read
(
struct
device
*
dev
,
enum
hwmon_sensor_types
type
,
u32
attr
,
int
channel
,
const
char
**
str
)
{
int
size
;
char
device_type
[]
=
"Temperature - FMC ADC 100M14B4C - "
;
struct
fa_dev
*
fa
=
dev_get_drvdata
(
dev
);
size
=
strlen
(
dev_name
(
&
fa
->
slot
->
dev
));
size
+=
strlen
(
device_type
);
size
++
;
fa_hwmon_temp_sensor_id
=
kzalloc
(
size
,
GFP_KERNEL
);
if
(
!
fa_hwmon_temp_sensor_id
)
return
-
ENOMEM
;
snprintf
(
fa_hwmon_temp_sensor_id
,
size
,
"%s%s"
,
device_type
,
dev_name
(
&
fa
->
slot
->
dev
));
*
str
=
fa_hwmon_temp_sensor_id
;
*
str
=
fa
->
hwmon_temp_sensor_id
;
return
0
;
}
...
...
@@ -72,13 +58,34 @@ static const struct hwmon_chip_info fa_hwmon_temp_chip_info = {
int
fa_hwmon_init
(
struct
fa_dev
*
fa
)
{
int
size
;
char
device_type
[]
=
"Temperature - FMC ADC 100M14B4C - "
;
struct
device
*
dev
=
&
fa
->
pdev
->
dev
;
fa
->
hwmon_dev
=
devm_hwmon_device_register_with_info
(
dev
,
"fa_temperature"
,
fa
,
&
fa_hwmon_temp_chip_info
,
NULL
);
return
PTR_ERR_OR_ZERO
(
fa
->
hwmon_dev
);
if
(
!
IS_ERR
(
fa
->
hwmon_dev
))
{
size
=
strlen
(
dev_name
(
&
fa
->
slot
->
dev
));
size
+=
strlen
(
device_type
);
size
++
;
fa
->
hwmon_temp_sensor_id
=
devm_kzalloc
(
fa
->
hwmon_dev
,
size
,
GFP_KERNEL
);
if
(
!
fa
->
hwmon_temp_sensor_id
)
{
devm_hwmon_device_unregister
(
dev
);
return
-
ENOMEM
;
}
snprintf
(
fa
->
hwmon_temp_sensor_id
,
size
,
"%s%s"
,
device_type
,
dev_name
(
&
fa
->
slot
->
dev
));
return
0
;
}
return
PTR_ERR
(
fa
->
hwmon_dev
);
}
#endif
/* LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0) */
software/kernel/fmc-adc-100m14b4cha-private.h
View file @
53b17607
...
...
@@ -345,9 +345,12 @@ struct fa_dev {
/* one-wire */
uint8_t
ds18_id
[
8
];
unsigned
long
next_t
;
struct
device
*
hwmon_dev
;
int
temp
;
/* temperature: scaled by 4 bits */
/* HWMON */
char
*
hwmon_temp_sensor_id
;
struct
device
*
hwmon_dev
;
/* Calibration Data */
struct
fa_calib
calib
;
int32_t
range
[
FA100M14B4C_NCHAN
];
...
...
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