1*7c569caaSEmmanuel Vadot /*-
2*7c569caaSEmmanuel Vadot * SPDX-License-Identifier: BSD-2-Clause
3*7c569caaSEmmanuel Vadot *
4*7c569caaSEmmanuel Vadot * Copyright (c) 2021 Alstom Group.
5*7c569caaSEmmanuel Vadot * Copyright (c) 2021 Semihalf.
6*7c569caaSEmmanuel Vadot *
7*7c569caaSEmmanuel Vadot * Redistribution and use in source and binary forms, with or without
8*7c569caaSEmmanuel Vadot * modification, are permitted provided that the following conditions
9*7c569caaSEmmanuel Vadot * are met:
10*7c569caaSEmmanuel Vadot * 1. Redistributions of source code must retain the above copyright
11*7c569caaSEmmanuel Vadot * notice, this list of conditions and the following disclaimer.
12*7c569caaSEmmanuel Vadot * 2. Redistributions in binary form must reproduce the above copyright
13*7c569caaSEmmanuel Vadot * notice, this list of conditions and the following disclaimer in the
14*7c569caaSEmmanuel Vadot * documentation and/or other materials provided with the distribution.
15*7c569caaSEmmanuel Vadot *
16*7c569caaSEmmanuel Vadot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17*7c569caaSEmmanuel Vadot * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18*7c569caaSEmmanuel Vadot * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19*7c569caaSEmmanuel Vadot * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20*7c569caaSEmmanuel Vadot * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21*7c569caaSEmmanuel Vadot * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22*7c569caaSEmmanuel Vadot * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23*7c569caaSEmmanuel Vadot * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24*7c569caaSEmmanuel Vadot * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25*7c569caaSEmmanuel Vadot * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*7c569caaSEmmanuel Vadot */
27*7c569caaSEmmanuel Vadot
28*7c569caaSEmmanuel Vadot #include <sys/cdefs.h>
29*7c569caaSEmmanuel Vadot #include "opt_platform.h"
30*7c569caaSEmmanuel Vadot
31*7c569caaSEmmanuel Vadot #include <sys/param.h>
32*7c569caaSEmmanuel Vadot #include <sys/bus.h>
33*7c569caaSEmmanuel Vadot #include <sys/lock.h>
34*7c569caaSEmmanuel Vadot #include <sys/mutex.h>
35*7c569caaSEmmanuel Vadot #include <sys/module.h>
36*7c569caaSEmmanuel Vadot #include <sys/ctype.h>
37*7c569caaSEmmanuel Vadot #include <sys/kernel.h>
38*7c569caaSEmmanuel Vadot #include <sys/libkern.h>
39*7c569caaSEmmanuel Vadot #include <sys/sysctl.h>
40*7c569caaSEmmanuel Vadot
41*7c569caaSEmmanuel Vadot #include <dev/iicbus/iicbus.h>
42*7c569caaSEmmanuel Vadot #include <dev/iicbus/iiconf.h>
43*7c569caaSEmmanuel Vadot
44*7c569caaSEmmanuel Vadot #include <dev/ofw/ofw_bus_subr.h>
45*7c569caaSEmmanuel Vadot #include <dev/ofw/ofw_bus.h>
46*7c569caaSEmmanuel Vadot
47*7c569caaSEmmanuel Vadot #define BIT(x) (1UL << (x))
48*7c569caaSEmmanuel Vadot
49*7c569caaSEmmanuel Vadot /* register map */
50*7c569caaSEmmanuel Vadot #define TMP461_LOCAL_TEMP_REG_MSB 0x0
51*7c569caaSEmmanuel Vadot #define TMP461_LOCAL_TEMP_REG_LSB 0x15
52*7c569caaSEmmanuel Vadot #define TMP461_GLOBAL_TEMP_REG_MSB 0x1
53*7c569caaSEmmanuel Vadot #define TMP461_GLOBAL_TEMP_REG_LSB 0x10
54*7c569caaSEmmanuel Vadot #define TMP461_STATUS_REG 0x2
55*7c569caaSEmmanuel Vadot #define TMP461_STATUS_REG_TEMP_LOCAL BIT(2)
56*7c569caaSEmmanuel Vadot #define TMP461_CONFIG_REG_R 0x3
57*7c569caaSEmmanuel Vadot #define TMP461_CONFIG_REG_W 0x9
58*7c569caaSEmmanuel Vadot #define TMP461_CONFIG_REG_TEMP_RANGE_BIT BIT(2)
59*7c569caaSEmmanuel Vadot #define TMP461_CONFIG_REG_STANDBY_BIT BIT(6)
60*7c569caaSEmmanuel Vadot #define TMP461_CONVERSION_RATE_REG 0x4
61*7c569caaSEmmanuel Vadot #define TMP461_ONESHOT_REG 0xF
62*7c569caaSEmmanuel Vadot #define TMP461_EXTENDED_TEMP_MODIFIER 64
63*7c569caaSEmmanuel Vadot
64*7c569caaSEmmanuel Vadot /* 28.4 fixed point representation of 273.15f */
65*7c569caaSEmmanuel Vadot #define TMP461_C_TO_K_FIX 4370
66*7c569caaSEmmanuel Vadot
67*7c569caaSEmmanuel Vadot #define TMP461_SENSOR_MAX_CONV_TIME 16000000
68*7c569caaSEmmanuel Vadot #define TMP461_LOCAL_MEASURE 0
69*7c569caaSEmmanuel Vadot #define TMP461_REMOTE_MEASURE 1
70*7c569caaSEmmanuel Vadot
71*7c569caaSEmmanuel Vadot /* flags */
72*7c569caaSEmmanuel Vadot #define TMP461_LOCAL_TEMP_DOUBLE_REG BIT(0)
73*7c569caaSEmmanuel Vadot #define TMP461_REMOTE_TEMP_DOUBLE_REG BIT(1)
74*7c569caaSEmmanuel Vadot
75*7c569caaSEmmanuel Vadot static int tmp461_probe(device_t dev);
76*7c569caaSEmmanuel Vadot static int tmp461_attach(device_t dev);
77*7c569caaSEmmanuel Vadot static int tmp461_read_1(device_t dev, uint8_t reg, uint8_t *data);
78*7c569caaSEmmanuel Vadot static int tmp461_write_1(device_t dev, uint8_t reg, uint8_t data);
79*7c569caaSEmmanuel Vadot static int tmp461_read_temperature(device_t dev, int32_t *temperature, bool mode);
80*7c569caaSEmmanuel Vadot static int tmp461_detach(device_t dev);
81*7c569caaSEmmanuel Vadot static int tmp461_sensor_sysctl(SYSCTL_HANDLER_ARGS);
82*7c569caaSEmmanuel Vadot
83*7c569caaSEmmanuel Vadot static device_method_t tmp461_methods[] = {
84*7c569caaSEmmanuel Vadot DEVMETHOD(device_probe, tmp461_probe),
85*7c569caaSEmmanuel Vadot DEVMETHOD(device_attach, tmp461_attach),
86*7c569caaSEmmanuel Vadot DEVMETHOD(device_detach, tmp461_detach),
87*7c569caaSEmmanuel Vadot
88*7c569caaSEmmanuel Vadot DEVMETHOD_END
89*7c569caaSEmmanuel Vadot };
90*7c569caaSEmmanuel Vadot
91*7c569caaSEmmanuel Vadot struct tmp461_softc {
92*7c569caaSEmmanuel Vadot struct mtx mtx;
93*7c569caaSEmmanuel Vadot uint8_t conf;
94*7c569caaSEmmanuel Vadot };
95*7c569caaSEmmanuel Vadot
96*7c569caaSEmmanuel Vadot static driver_t tmp461_driver = {
97*7c569caaSEmmanuel Vadot "tmp461_dev",
98*7c569caaSEmmanuel Vadot tmp461_methods,
99*7c569caaSEmmanuel Vadot sizeof(struct tmp461_softc)
100*7c569caaSEmmanuel Vadot };
101*7c569caaSEmmanuel Vadot
102*7c569caaSEmmanuel Vadot struct tmp461_data {
103*7c569caaSEmmanuel Vadot const char *compat;
104*7c569caaSEmmanuel Vadot const char *desc;
105*7c569caaSEmmanuel Vadot uint8_t flags;
106*7c569caaSEmmanuel Vadot };
107*7c569caaSEmmanuel Vadot
108*7c569caaSEmmanuel Vadot static struct tmp461_data sensor_list[] = {
109*7c569caaSEmmanuel Vadot {"adt7461", "ADT7461 Thernal Sensor Information",
110*7c569caaSEmmanuel Vadot TMP461_REMOTE_TEMP_DOUBLE_REG},
111*7c569caaSEmmanuel Vadot {"tmp461", "TMP461 Thernal Sensor Information",
112*7c569caaSEmmanuel Vadot TMP461_LOCAL_TEMP_DOUBLE_REG | TMP461_REMOTE_TEMP_DOUBLE_REG}
113*7c569caaSEmmanuel Vadot };
114*7c569caaSEmmanuel Vadot
115*7c569caaSEmmanuel Vadot static struct ofw_compat_data tmp461_compat_data[] = {
116*7c569caaSEmmanuel Vadot {"adi,adt7461", (uintptr_t)&sensor_list[0]},
117*7c569caaSEmmanuel Vadot {"ti,tmp461", (uintptr_t)&sensor_list[1]},
118*7c569caaSEmmanuel Vadot {NULL, 0}
119*7c569caaSEmmanuel Vadot };
120*7c569caaSEmmanuel Vadot
121*7c569caaSEmmanuel Vadot DRIVER_MODULE(tmp461, iicbus, tmp461_driver, 0, 0);
122*7c569caaSEmmanuel Vadot IICBUS_FDT_PNP_INFO(tmp461_compat_data);
123*7c569caaSEmmanuel Vadot
124*7c569caaSEmmanuel Vadot static int
tmp461_attach(device_t dev)125*7c569caaSEmmanuel Vadot tmp461_attach(device_t dev)
126*7c569caaSEmmanuel Vadot {
127*7c569caaSEmmanuel Vadot struct sysctl_oid *sensor_root_oid;
128*7c569caaSEmmanuel Vadot struct tmp461_data *compat_data;
129*7c569caaSEmmanuel Vadot struct sysctl_ctx_list *ctx;
130*7c569caaSEmmanuel Vadot struct tmp461_softc *sc;
131*7c569caaSEmmanuel Vadot uint8_t data;
132*7c569caaSEmmanuel Vadot
133*7c569caaSEmmanuel Vadot sc = device_get_softc(dev);
134*7c569caaSEmmanuel Vadot compat_data = (struct tmp461_data *)
135*7c569caaSEmmanuel Vadot ofw_bus_search_compatible(dev, tmp461_compat_data)->ocd_data;
136*7c569caaSEmmanuel Vadot sc->conf = compat_data->flags;
137*7c569caaSEmmanuel Vadot ctx = device_get_sysctl_ctx(dev);
138*7c569caaSEmmanuel Vadot
139*7c569caaSEmmanuel Vadot mtx_init(&sc->mtx, "tmp461 temperature", "temperature", MTX_DEF);
140*7c569caaSEmmanuel Vadot
141*7c569caaSEmmanuel Vadot sensor_root_oid = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw),
142*7c569caaSEmmanuel Vadot OID_AUTO, "temperature", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
143*7c569caaSEmmanuel Vadot "Thermal Sensor Information");
144*7c569caaSEmmanuel Vadot if (sensor_root_oid == NULL)
145*7c569caaSEmmanuel Vadot return (ENXIO);
146*7c569caaSEmmanuel Vadot
147*7c569caaSEmmanuel Vadot SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensor_root_oid), OID_AUTO,
148*7c569caaSEmmanuel Vadot "local_sensor", CTLTYPE_INT | CTLFLAG_RD, dev,
149*7c569caaSEmmanuel Vadot TMP461_LOCAL_MEASURE, tmp461_sensor_sysctl,
150*7c569caaSEmmanuel Vadot "IK1", compat_data->desc);
151*7c569caaSEmmanuel Vadot
152*7c569caaSEmmanuel Vadot /* get status register */
153*7c569caaSEmmanuel Vadot if (tmp461_read_1(dev, TMP461_STATUS_REG, &data) != 0)
154*7c569caaSEmmanuel Vadot return (ENXIO);
155*7c569caaSEmmanuel Vadot
156*7c569caaSEmmanuel Vadot if (!(data & TMP461_STATUS_REG_TEMP_LOCAL))
157*7c569caaSEmmanuel Vadot SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensor_root_oid), OID_AUTO,
158*7c569caaSEmmanuel Vadot "remote_sensor", CTLTYPE_INT | CTLFLAG_RD, dev,
159*7c569caaSEmmanuel Vadot TMP461_REMOTE_MEASURE, tmp461_sensor_sysctl,
160*7c569caaSEmmanuel Vadot "IK1", compat_data->desc);
161*7c569caaSEmmanuel Vadot
162*7c569caaSEmmanuel Vadot /* set standby mode */
163*7c569caaSEmmanuel Vadot if (tmp461_read_1(dev, TMP461_CONFIG_REG_R, &data) != 0)
164*7c569caaSEmmanuel Vadot return (ENXIO);
165*7c569caaSEmmanuel Vadot
166*7c569caaSEmmanuel Vadot data |= TMP461_CONFIG_REG_STANDBY_BIT;
167*7c569caaSEmmanuel Vadot if (tmp461_write_1(dev, TMP461_CONFIG_REG_W, data) != 0)
168*7c569caaSEmmanuel Vadot return (ENXIO);
169*7c569caaSEmmanuel Vadot
170*7c569caaSEmmanuel Vadot return (0);
171*7c569caaSEmmanuel Vadot }
172*7c569caaSEmmanuel Vadot
173*7c569caaSEmmanuel Vadot static int
tmp461_probe(device_t dev)174*7c569caaSEmmanuel Vadot tmp461_probe(device_t dev)
175*7c569caaSEmmanuel Vadot {
176*7c569caaSEmmanuel Vadot struct tmp461_data *compat_data;
177*7c569caaSEmmanuel Vadot
178*7c569caaSEmmanuel Vadot if (!ofw_bus_status_okay(dev))
179*7c569caaSEmmanuel Vadot return (ENXIO);
180*7c569caaSEmmanuel Vadot
181*7c569caaSEmmanuel Vadot compat_data = (struct tmp461_data *)
182*7c569caaSEmmanuel Vadot ofw_bus_search_compatible(dev, tmp461_compat_data)->ocd_data;
183*7c569caaSEmmanuel Vadot if (!compat_data)
184*7c569caaSEmmanuel Vadot return (ENXIO);
185*7c569caaSEmmanuel Vadot
186*7c569caaSEmmanuel Vadot device_set_desc(dev, compat_data->compat);
187*7c569caaSEmmanuel Vadot
188*7c569caaSEmmanuel Vadot return (BUS_PROBE_GENERIC);
189*7c569caaSEmmanuel Vadot }
190*7c569caaSEmmanuel Vadot
191*7c569caaSEmmanuel Vadot static int
tmp461_detach(device_t dev)192*7c569caaSEmmanuel Vadot tmp461_detach(device_t dev)
193*7c569caaSEmmanuel Vadot {
194*7c569caaSEmmanuel Vadot struct tmp461_softc *sc;
195*7c569caaSEmmanuel Vadot
196*7c569caaSEmmanuel Vadot sc = device_get_softc(dev);
197*7c569caaSEmmanuel Vadot mtx_destroy(&sc->mtx);
198*7c569caaSEmmanuel Vadot
199*7c569caaSEmmanuel Vadot return (0);
200*7c569caaSEmmanuel Vadot }
201*7c569caaSEmmanuel Vadot
202*7c569caaSEmmanuel Vadot static int
tmp461_read_1(device_t dev,uint8_t reg,uint8_t * data)203*7c569caaSEmmanuel Vadot tmp461_read_1(device_t dev, uint8_t reg, uint8_t *data)
204*7c569caaSEmmanuel Vadot {
205*7c569caaSEmmanuel Vadot int error;
206*7c569caaSEmmanuel Vadot
207*7c569caaSEmmanuel Vadot error = iicdev_readfrom(dev, reg, (void *) data, 1, IIC_DONTWAIT);
208*7c569caaSEmmanuel Vadot if (error != 0)
209*7c569caaSEmmanuel Vadot device_printf(dev, "Failed to read from device\n");
210*7c569caaSEmmanuel Vadot
211*7c569caaSEmmanuel Vadot return (error);
212*7c569caaSEmmanuel Vadot }
213*7c569caaSEmmanuel Vadot
214*7c569caaSEmmanuel Vadot static int
tmp461_write_1(device_t dev,uint8_t reg,uint8_t data)215*7c569caaSEmmanuel Vadot tmp461_write_1(device_t dev, uint8_t reg, uint8_t data)
216*7c569caaSEmmanuel Vadot {
217*7c569caaSEmmanuel Vadot int error;
218*7c569caaSEmmanuel Vadot
219*7c569caaSEmmanuel Vadot error = iicdev_writeto(dev, reg, (void *) &data, 1, IIC_DONTWAIT);
220*7c569caaSEmmanuel Vadot if (error != 0)
221*7c569caaSEmmanuel Vadot device_printf(dev, "Failed to write to device\n");
222*7c569caaSEmmanuel Vadot
223*7c569caaSEmmanuel Vadot return (error);
224*7c569caaSEmmanuel Vadot }
225*7c569caaSEmmanuel Vadot
226*7c569caaSEmmanuel Vadot static int
tmp461_read_temperature(device_t dev,int32_t * temperature,bool remote_measure)227*7c569caaSEmmanuel Vadot tmp461_read_temperature(device_t dev, int32_t *temperature, bool remote_measure)
228*7c569caaSEmmanuel Vadot {
229*7c569caaSEmmanuel Vadot uint8_t data, offset, reg;
230*7c569caaSEmmanuel Vadot struct tmp461_softc *sc;
231*7c569caaSEmmanuel Vadot int error;
232*7c569caaSEmmanuel Vadot
233*7c569caaSEmmanuel Vadot sc = device_get_softc(dev);
234*7c569caaSEmmanuel Vadot
235*7c569caaSEmmanuel Vadot mtx_lock(&sc->mtx);
236*7c569caaSEmmanuel Vadot
237*7c569caaSEmmanuel Vadot error = tmp461_read_1(dev, TMP461_CONVERSION_RATE_REG, &data);
238*7c569caaSEmmanuel Vadot if (error != 0)
239*7c569caaSEmmanuel Vadot goto fail;
240*7c569caaSEmmanuel Vadot
241*7c569caaSEmmanuel Vadot /* trigger sample*/
242*7c569caaSEmmanuel Vadot error = tmp461_write_1(dev, TMP461_ONESHOT_REG, 0xFF);
243*7c569caaSEmmanuel Vadot if (error != 0)
244*7c569caaSEmmanuel Vadot goto fail;
245*7c569caaSEmmanuel Vadot
246*7c569caaSEmmanuel Vadot /* wait for conversion time */
247*7c569caaSEmmanuel Vadot DELAY(TMP461_SENSOR_MAX_CONV_TIME/(1UL<<data));
248*7c569caaSEmmanuel Vadot
249*7c569caaSEmmanuel Vadot /* read config register offset */
250*7c569caaSEmmanuel Vadot error = tmp461_read_1(dev, TMP461_CONFIG_REG_R, &data);
251*7c569caaSEmmanuel Vadot if (error != 0)
252*7c569caaSEmmanuel Vadot goto fail;
253*7c569caaSEmmanuel Vadot
254*7c569caaSEmmanuel Vadot offset = (data & TMP461_CONFIG_REG_TEMP_RANGE_BIT ?
255*7c569caaSEmmanuel Vadot TMP461_EXTENDED_TEMP_MODIFIER : 0);
256*7c569caaSEmmanuel Vadot
257*7c569caaSEmmanuel Vadot reg = remote_measure ?
258*7c569caaSEmmanuel Vadot TMP461_GLOBAL_TEMP_REG_MSB : TMP461_LOCAL_TEMP_REG_MSB;
259*7c569caaSEmmanuel Vadot
260*7c569caaSEmmanuel Vadot /* read temeperature value*/
261*7c569caaSEmmanuel Vadot error = tmp461_read_1(dev, reg, &data);
262*7c569caaSEmmanuel Vadot if (error != 0)
263*7c569caaSEmmanuel Vadot goto fail;
264*7c569caaSEmmanuel Vadot
265*7c569caaSEmmanuel Vadot data -= offset;
266*7c569caaSEmmanuel Vadot *temperature = signed_extend32(data, 0, 8) << 4;
267*7c569caaSEmmanuel Vadot
268*7c569caaSEmmanuel Vadot if (remote_measure) {
269*7c569caaSEmmanuel Vadot if (sc->conf & TMP461_REMOTE_TEMP_DOUBLE_REG) {
270*7c569caaSEmmanuel Vadot error = tmp461_read_1(dev,
271*7c569caaSEmmanuel Vadot TMP461_GLOBAL_TEMP_REG_LSB, &data);
272*7c569caaSEmmanuel Vadot if (error != 0)
273*7c569caaSEmmanuel Vadot goto fail;
274*7c569caaSEmmanuel Vadot
275*7c569caaSEmmanuel Vadot *temperature |= data >> 4;
276*7c569caaSEmmanuel Vadot }
277*7c569caaSEmmanuel Vadot } else {
278*7c569caaSEmmanuel Vadot if (sc->conf & TMP461_LOCAL_TEMP_DOUBLE_REG) {
279*7c569caaSEmmanuel Vadot error = tmp461_read_1(dev,
280*7c569caaSEmmanuel Vadot TMP461_LOCAL_TEMP_REG_LSB, &data);
281*7c569caaSEmmanuel Vadot if (error != 0)
282*7c569caaSEmmanuel Vadot goto fail;
283*7c569caaSEmmanuel Vadot
284*7c569caaSEmmanuel Vadot *temperature |= data >> 4;
285*7c569caaSEmmanuel Vadot }
286*7c569caaSEmmanuel Vadot }
287*7c569caaSEmmanuel Vadot *temperature = (((*temperature + TMP461_C_TO_K_FIX) * 10) >> 4);
288*7c569caaSEmmanuel Vadot
289*7c569caaSEmmanuel Vadot fail:
290*7c569caaSEmmanuel Vadot mtx_unlock(&sc->mtx);
291*7c569caaSEmmanuel Vadot return (error);
292*7c569caaSEmmanuel Vadot }
293*7c569caaSEmmanuel Vadot
294*7c569caaSEmmanuel Vadot static int
tmp461_sensor_sysctl(SYSCTL_HANDLER_ARGS)295*7c569caaSEmmanuel Vadot tmp461_sensor_sysctl(SYSCTL_HANDLER_ARGS)
296*7c569caaSEmmanuel Vadot {
297*7c569caaSEmmanuel Vadot int32_t temperature;
298*7c569caaSEmmanuel Vadot device_t dev;
299*7c569caaSEmmanuel Vadot int error;
300*7c569caaSEmmanuel Vadot bool mode;
301*7c569caaSEmmanuel Vadot
302*7c569caaSEmmanuel Vadot dev = arg1;
303*7c569caaSEmmanuel Vadot mode = arg2;
304*7c569caaSEmmanuel Vadot
305*7c569caaSEmmanuel Vadot error = tmp461_read_temperature(dev, &temperature, mode);
306*7c569caaSEmmanuel Vadot if (error != 0)
307*7c569caaSEmmanuel Vadot return (error);
308*7c569caaSEmmanuel Vadot
309*7c569caaSEmmanuel Vadot return (sysctl_handle_int(oidp, &temperature, 0, req));
310*7c569caaSEmmanuel Vadot }
311