1 /*
2  * Simple interface library for fan control operations
3  * This file provides interface functions to support pwmtachtool.
4  * Copyright (C) <2019>  <American Megatrends International LLC>
5  *
6  */
7 
8 #ifndef __PWMTACH_IOCTL_H__
9 #define __PWMTACH_IOCTL_H__
10 
11 
12 typedef struct
13 {
14 	unsigned char id;
15 	unsigned int value;
16 }__attribute__((packed)) pwmtach_property_t;
17 
18 typedef struct
19 {
20 	char	device_name[16];
21 	unsigned int dev_id;
22 	unsigned int num_fans;
23 	unsigned char fannumber;
24 	unsigned int rpmvalue;
25 	unsigned int min_rpm;
26 	unsigned int max_rpm;
27 	unsigned char prevdutycycle;
28 	unsigned char dutycycle;
29 	unsigned int prescalervalue;
30 	unsigned int counterresvalue;
31 	unsigned int tachnumber;
32 	unsigned int pwmnumber;
33 	unsigned char status;
34 	pwmtach_property_t property;
35 	void* fanproperty_dataptr;
36 	void* fanmap_dataptr;
37 }  __attribute__((packed)) pwmtach_data_t;
38 
39 #define ENABLE_PWM_CHANNEL                     _IOW('P', 0, int)
40 #define DISABLE_PWM_CHANNEL                    _IOW('P', 1, int)
41 #define ENABLE_TACH_CHANNEL                    _IOW('P', 2, int)
42 #define DISABLE_TACH_CHANNEL                   _IOW('P', 3, int)
43 #define SET_DUTY_CYCLE_BY_PWM_CHANNEL          _IOW('P', 4, int)
44 #define SET_DUTY_CYCLE_VALUE_BY_PWM_CHANNEL    _IOW('P', 5, int)
45 #define GET_TACH_VALUE_BY_TACH_CHANNEL         _IOR('P', 6, int)
46 #define ENABLE_PWM                             _IOW('P', 7, int)
47 #define ENABLE_ALL_PWM                         _IOW('P', 8, int)
48 #define ENABLE_TACH                            _IOW('P', 9, int)
49 #define ENABLE_ALL_TACH                        _IOW('P', 10, int)
50 #define DISABLE_PWM                            _IOW('P', 11, int)
51 #define DISABLE_ALL_PWM                        _IOW('P', 12, int)
52 #define DISABLE_TACH                           _IOW('P', 13, int)
53 #define DISABLE_ALL_TACH                       _IOW('P', 14, int)
54 #define GET_TACH_STATUS                        _IOR('P', 15, int)
55 #define GET_PWM_STATUS                         _IOR('P', 16, int)
56 #define GET_PWM_CHANNEL_STATUS                 _IOR('P', 17, int)
57 #define GET_TACH_VALUE                         _IOW('P', 18, int)
58 #define SET_DUTY_CYCLE                         _IOW('P', 19, int)
59 #define INIT_PWMTACH                           _IOW('P', 20, int)
60 #define CONFIGURE_FANMAP_TABLE                 _IOW('P', 21, int)
61 #define CONFIGURE_FANPROPERTY_TABLE            _IOW('P', 22, int)
62 #define SHOW_FANMAP_TABLE                      _IOR('P', 23, int)
63 #define SHOW_FANPROPERTY_TABLE                 _IOR('P', 24, int)
64 #define GET_FAN_RPM_RANGE                      _IOR('P', 25, int)
65 #define GET_DUTY_CYCLE                         _IOR('P', 26, int)
66 #define SET_TACH_PROPERTY                      _IOW('P', 27, int)
67 #define GET_TACH_PROPERTY                      _IOR('P', 28, int)
68 #define SET_PWM_PROPERTY                       _IOW('P', 29, int)
69 #define GET_PWM_PROPERTY                       _IOR('P', 30, int)
70 #define CLEAR_TACH_ERROR                       _IOW('P', 31, int)
71 #define CLEAR_PWM_ERRORS                       _IOW('P', 32, int)
72 #define END_OF_FUNC_TABLE                      _IOW('P', 33, int)
73 
74 typedef pwmtach_data_t pwmtach_ioctl_data;
75 
76 #endif // __PWMTACH_IOCTL_H__
77