root/lm-sensors/trunk/kernel/include/sensors.h @ 158

Revision 158, 9.1 KB (checked in by frodo, 14 years ago)

The beginnings of i2c-dev

Everything is in, except the IOCTL hook (which will be pretty simple to add).
It compiles cleanly. It is not tested at all.

Also a very small fix for i2c-proc, and Makefile.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/*
2    sensors.h - Part of lm_sensors, Linux kernel modules for hardware
3                monitoring
4    Copyright (c) 1998  Frodo Looijaard <frodol@dds.nl>
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef SENSORS_SENSORS_H
22#define SENSORS_SENSORS_H
23
24#ifdef __KERNEL__
25
26/* Next two must be included before sysctl.h can be included, in 2.0 kernels */
27#include <linux/types.h>
28#include <linux/fs.h>
29#include <linux/sysctl.h>
30
31/* The type of callback functions used in sensors_{proc,sysctl}_real */
32typedef void (*sensors_real_callback) (struct i2c_client *client,
33                                       int operation, int ctl_name,
34                                       int *nrels_mag, long *results);
35
36/* Values for the operation field in the above function type */
37#define SENSORS_PROC_REAL_INFO 1
38#define SENSORS_PROC_REAL_READ 2
39#define SENSORS_PROC_REAL_WRITE 3
40
41/* These funcion reads or writes a 'real' value (encoded by the combination
42   of an integer and a magnitude, the last is the power of ten the value
43   should be divided with) to a /proc/sys directory. To use these functions,
44   you must (before registering the ctl_table) set the extra2 field to the
45   client, and the extra1 field to a function of the form:
46      void func(struct i2c_client *client, int operation, int ctl_name,
47                int *nrels_mag, long *results)
48   This last function can be called for three values of operation. If
49   operation equals SENSORS_PROC_REAL_INFO, the magnitude should be returned
50   in nrels_mag. If operation equals SENSORS_PROC_REAL_READ, values should
51   be read into results. nrels_mag should return the number of elements
52   read; the maximum number is put in it on entry. Finally, if operation
53   equals SENSORS_PROC_REAL_WRITE, the values in results should be
54   written to the chip. nrels_mag contains on entry the number of elements
55   found.
56   In all cases, client points to the client we wish to interact with,
57   and ctl_name is the SYSCTL id of the file we are accessing. */
58extern int sensors_sysctl_real (ctl_table *table, int *name, int nlen,
59                                void *oldval, size_t *oldlenp, void *newval,
60                                size_t newlen, void **context);
61extern int sensors_proc_real(ctl_table *ctl, int write, struct file * filp,
62                             void *buffer, size_t *lenp);
63
64
65
66/* These rather complex functions must be called when you want to add or
67   delete an entry in /proc/sys/dev/sensors/chips (not yet implemented). It
68   also creates a new directory within /proc/sys/dev/sensors/.
69   ctl_template should be a template of the newly created directory. It is
70   copied in memory. The extra2 field of each file is set to point to client.
71   If any driver wants subdirectories within the newly created directory,
72   these functions must be updated! */
73extern int sensors_register_entry(struct i2c_client *client,
74                                  const char *prefix, ctl_table *ctl_template);
75extern void sensors_deregister_entry(int id);
76
77#endif /* def __KERNEL__ */
78
79
80/* The maximum length of the prefix */
81#define SENSORS_PREFIX_MAX 20
82
83/* Driver IDs */
84#define I2C_DRIVERID_I2CDEV 1000
85#define I2C_DRIVERID_I2CPROC 1001
86#define I2C_DRIVERID_LM78 1002
87#define I2C_DRIVERID_LM75 1003
88#define I2C_DRIVERID_GL518 1004
89#define I2C_DRIVERID_EEPROM 1005
90#define I2C_DRIVERID_W83781D 1006
91#define I2C_DRIVERID_LM80 1007
92#define I2C_DRIVERID_ADM1021 1008
93#define I2C_DRIVERID_ADM9240 1009
94#define I2C_DRIVERID_LTC1710 1010
95
96/* Sysctl IDs */
97#ifdef DEV_HWMON
98#define DEV_SENSORS DEV_HWMON
99#else /* ndef DEV_HWMOM */
100#define DEV_SENSORS 2  /* The id of the lm_sensors directory within the
101                          dev table */
102#endif /* def DEV_HWMON */
103
104#define SENSORS_CHIPS 1
105struct sensors_chips_data {
106  int sysctl_id;
107  char name[SENSORS_PREFIX_MAX + 13];
108};
109
110#define LM78_SYSCTL_IN0 1000  /* Volts * 100 */
111#define LM78_SYSCTL_IN1 1001
112#define LM78_SYSCTL_IN2 1002
113#define LM78_SYSCTL_IN3 1003
114#define LM78_SYSCTL_IN4 1004
115#define LM78_SYSCTL_IN5 1005
116#define LM78_SYSCTL_IN6 1006
117#define LM78_SYSCTL_FAN1 1101 /* Rotations/min */
118#define LM78_SYSCTL_FAN2 1102
119#define LM78_SYSCTL_FAN3 1103
120#define LM78_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
121#define LM78_SYSCTL_VID 1300 /* Volts * 100 */
122#define LM78_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
123#define LM78_SYSCTL_ALARMS 2001 /* bitvector */
124
125#define LM78_ALARM_IN0 0x0001
126#define LM78_ALARM_IN1 0x0002
127#define LM78_ALARM_IN2 0x0004
128#define LM78_ALARM_IN3 0x0008
129#define LM78_ALARM_IN4 0x0100
130#define LM78_ALARM_IN5 0x0200
131#define LM78_ALARM_IN6 0x0400
132#define LM78_ALARM_FAN1 0x0040
133#define LM78_ALARM_FAN2 0x0080
134#define LM78_ALARM_FAN3 0x0800
135#define LM78_ALARM_TEMP 0x0010
136#define LM78_ALARM_BTI 0x0020
137#define LM78_ALARM_CHAS 0x1000
138#define LM78_ALARM_FIFO 0x2000
139#define LM78_ALARM_SMI_IN 0x4000
140
141#define W83781D_SYSCTL_IN0 1000  /* Volts * 100 */
142#define W83781D_SYSCTL_IN1 1001
143#define W83781D_SYSCTL_IN2 1002
144#define W83781D_SYSCTL_IN3 1003
145#define W83781D_SYSCTL_IN4 1004
146#define W83781D_SYSCTL_IN5 1005
147#define W83781D_SYSCTL_IN6 1006
148#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */
149#define W83781D_SYSCTL_FAN2 1102
150#define W83781D_SYSCTL_FAN3 1103
151#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
152#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
153#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
154#define W83781D_SYSCTL_VID 1300 /* Volts * 100 */
155#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
156#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */
157#define W83781D_SYSCTL_BEEP 2002 /* bitvector */
158
159#define W83781D_ALARM_IN0 0x0001
160#define W83781D_ALARM_IN1 0x0002
161#define W83781D_ALARM_IN2 0x0004
162#define W83781D_ALARM_IN3 0x0008
163#define W83781D_ALARM_IN4 0x0100
164#define W83781D_ALARM_IN5 0x0200
165#define W83781D_ALARM_IN6 0x0400
166#define W83781D_ALARM_FAN1 0x0040
167#define W83781D_ALARM_FAN2 0x0080
168#define W83781D_ALARM_FAN3 0x0800
169#define W83781D_ALARM_TEMP1 0x0010
170#define W83781D_ALARM_TEMP23 0x0020
171#define W83781D_ALARM_CHAS 0x1000
172
173#define LM75_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
174
175#define ADM1021_SYSCTL_TEMP 1200
176#define ADM1021_SYSCTL_REMOTE_TEMP 1201
177#define ADM1021_SYSCTL_DIE_CODE 1202
178#define ADM1021_SYSCTL_STATUS 1203
179
180#define GL518_SYSCTL_VDD  1000     /* Volts * 100 */
181#define GL518_SYSCTL_VIN1 1001
182#define GL518_SYSCTL_VIN2 1002
183#define GL518_SYSCTL_VIN3 1003
184#define GL518_SYSCTL_FAN1 1101     /* RPM */
185#define GL518_SYSCTL_FAN2 1102
186#define GL518_SYSCTL_TEMP 1200     /* Degrees Celcius * 10 */
187#define GL518_SYSCTL_VID 1300   
188#define GL518_SYSCTL_FAN_DIV 2000  /* 1, 2, 4 or 8 */
189#define GL518_SYSCTL_ALARMS 2001   /* bitvector */
190#define GL518_SYSCTL_BEEP 2002     /* bitvector */
191
192#define GL518_ALARM_VDD 0x01
193#define GL518_ALARM_VIN1 0x02
194#define GL518_ALARM_VIN2 0x04
195#define GL518_ALARM_VIN3 0x08
196#define GL518_ALARM_TEMP 0x10
197#define GL518_ALARM_FAN1 0x20
198#define GL518_ALARM_FAN2 0x40
199
200#define EEPROM_SYSCTL1 1000
201#define EEPROM_SYSCTL2 1001
202#define EEPROM_SYSCTL3 1002
203#define EEPROM_SYSCTL4 1003
204#define EEPROM_SYSCTL5 1004
205#define EEPROM_SYSCTL6 1005
206#define EEPROM_SYSCTL7 1006
207#define EEPROM_SYSCTL8 1007
208
209#define LM80_SYSCTL_IN0 1000  /* Volts * 100 */
210#define LM80_SYSCTL_IN1 1001
211#define LM80_SYSCTL_IN2 1002
212#define LM80_SYSCTL_IN3 1003
213#define LM80_SYSCTL_IN4 1004
214#define LM80_SYSCTL_IN5 1005
215#define LM80_SYSCTL_IN6 1006
216#define LM80_SYSCTL_FAN1 1101 /* Rotations/min */
217#define LM80_SYSCTL_FAN2 1102
218#define LM80_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
219#define LM80_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
220#define LM80_SYSCTL_ALARMS 2001 /* bitvector */
221
222#define ADM9240_SYSCTL_IN0 1000  /* Volts * 100 */
223#define ADM9240_SYSCTL_IN1 1001
224#define ADM9240_SYSCTL_IN2 1002
225#define ADM9240_SYSCTL_IN3 1003
226#define ADM9240_SYSCTL_IN4 1004
227#define ADM9240_SYSCTL_IN5 1005
228#define ADM9240_SYSCTL_FAN1 1101 /* Rotations/min */
229#define ADM9240_SYSCTL_FAN2 1102
230#define ADM9240_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
231#define ADM9240_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
232#define ADM9240_SYSCTL_ALARMS 2001 /* bitvector */
233#define ADM9240_SYSCTL_ANALOG_OUT 2002
234
235#define LTC1710_SYSCTL_SWITCH_1 1000
236#define LTC1710_SYSCTL_SWITCH_2 1001
237
238#define LM80_ALARM_IN0 0x0001
239#define LM80_ALARM_IN1 0x0002
240#define LM80_ALARM_IN2 0x0004
241#define LM80_ALARM_IN3 0x0008
242#define LM80_ALARM_IN4 0x0010
243#define LM80_ALARM_IN5 0x0020
244#define LM80_ALARM_IN6 0x0040
245#define LM80_ALARM_FAN1 0x0400
246#define LM80_ALARM_FAN2 0x0800
247#define LM80_ALARM_TEMP_HOT 0x0100
248#define LM80_ALARM_TEMP_OS 0x2000
249#define LM80_ALARM_CHAS 0x1000
250#define LM80_ALARM_BTI 0x0200
251#define LM80_ALARM_INT_IN 0x0080
252#endif /* def SENSORS_SENSORS_H */
Note: See TracBrowser for help on using the browser.