xref: /illumos-gate/usr/src/man/man9f/ksensor_kind.9f (revision 71536d92c2013e2e7bf726baf846077b18ddf93d)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright 2024 Oxide Computer Company
13.\"
14.Dd May 10, 2024
15.Dt KSENSOR_KIND 9F
16.Os
17.Sh NAME
18.Nm ksensor_kind_current ,
19.Nm ksensor_kind_temperature ,
20.Nm ksensor_kind_voltage
21.Nd ksensor kind implementations
22.Sh SYNOPSIS
23.In sys/sensors.h
24.Ft int
25.Fo ksensor_kind_current
26.Fa "void *driver"
27.Fa "sensor_ioctl_kind_t *kind"
28.Fc
29.Ft int
30.Fo ksensor_kind_temperature
31.Fa "void *driver"
32.Fa "sensor_ioctl_kind_t *kind"
33.Fc
34.Ft int
35.Fo ksensor_kind_voltage
36.Fa "void *driver"
37.Fa "sensor_ioctl_kind_t *kind"
38.Fc
39.Sh INTERFACE LEVEL
40.Sy Volatile -
41This interface is still evolving in illumos.
42API and ABI stability is not guaranteed.
43.Sh DESCRIPTION
44The
45.Fn ksensor_kind_current ,
46.Fn ksensor_kind_temperature ,
47and
48.Fn ksensor_kind_voltage
49functions are implementations of the ksensor
50.Xr kso_kind 9E
51entry point
52and indicate that a sensor is a current
53.Pq Dv SENSOR_KIND_CURRENT ,
54temperature
55.Pq Dv SENSOR_KIND_TEMPERATURE ,
56or voltage
57.Pq Dv SENSOR_KIND_VOLTAGE
58sensor respectively.
59.Pp
60While these functions can be called directly, it is expected that they
61will be used as part of a ksensor operations vector as described in
62.Xr ksensor_ops 9E ,
63allowing the driver to avoid having to implement the entry point
64directly.
65If a driver does use this function, it must ensure that the return value
66is passed back to the framework as part of its
67.Xr kso_kind 9E
68entry point.
69.Sh CONTEXT
70The
71.Fn ksensor_kind_current ,
72.Fn ksensor_kind_temperature ,
73and
74.Fn ksensor_kind_voltage
75functions can be called from
76.Sy user ,
77or
78.Sy kernel
79context.
80.Sh RETURN VALUES
81Upon successful completion, the
82.Fn ksensor_kind_current ,
83.Fn ksensor_kind_temperature ,
84and
85.Fn ksensor_kind_voltage
86functions return
87.Sy 0
88and update
89.Fa kind
90with the corresponding information.
91Otherwise, a non-zero error value is returned.
92.Sh EXAMPLES
93.Sy Example 1
94Using
95.Fn ksensor_kind_temperature
96as part of the
97.Xr ksensor_ops 9E
98entry points.
99.Bd -literal
100#include <sys/sensors.h>
101
102static int coretemp_read(void *, sensor_ioctl_scalar_t *);
103
104static const ksensor_ops_t coretemp_temp_ops = {
105        .kso_kind = ksensor_kind_temperature,
106        .kso_scalar = coretemp_read
107};
108.Ed
109.Sh SEE ALSO
110.Xr ksensor 9E ,
111.Xr ksensor_ops 9E ,
112.Xr kso_kind 9E
113