summaryrefslogtreecommitdiff
path: root/drivers/mxc/thermal/anatop_driver.h
blob: 63cbdc779402f4c443d950d354f6371575765fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
 *  anatop_drivers.h
 *
 *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
 *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
 *  Copyright (C) 2011 Freescale Semiconductor, Inc.
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or (at
 *  your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

#ifndef __ANATOP_DRIVERS_H__
#define __ANATOP_DRIVERS_H__


typedef void *anatop_handle;	/* Actually a ptr to a NS Node */

/* Device */
#define ANATOP_MAX_HANDLES	10
#define ANATOP_DEVICE_ID_LENGTH	0x09

struct anatop_handle_list {
	u32 count;
	anatop_handle handles[ANATOP_MAX_HANDLES];
};

struct anatop_device {
	struct device dev;
	anatop_handle handle;		/* no handle for fixed hardware */
	char name[40];
	int id;
	void *driver_data;
};
struct anatop_device_id {
	__u8 id[ANATOP_DEVICE_ID_LENGTH];
};
typedef int (*anatop_op_add) (struct anatop_device *device);
typedef int (*anatop_op_remove) (struct anatop_device *device, int type);
typedef int (*anatop_op_start) (struct anatop_device *device);
typedef int (*anatop_op_suspend) (struct anatop_device *device,
				pm_message_t state);
typedef int (*anatop_op_resume) (struct anatop_device *device);
typedef int (*anatop_op_bind) (struct anatop_device *device);
typedef int (*anatop_op_unbind) (struct anatop_device *device);
typedef void (*anatop_op_notify) (struct anatop_device *device, u32 event);

struct anatop_ops {
	u32 anatop_op_add:1;
	u32 anatop_op_start:1;
};

struct anatop_device_ops {
	anatop_op_add add;
	anatop_op_remove remove;
	anatop_op_start start;
	anatop_op_suspend suspend;
	anatop_op_resume resume;
	anatop_op_bind bind;
	anatop_op_unbind unbind;
	anatop_op_notify notify;
};

struct anatop_driver {
	char name[80];
	char class[80];
	const struct anatop_device_id *ids; /* Supported Hardware IDs */
	unsigned int flags;
	struct anatop_device_ops ops;
	struct device_driver drv;
	struct module *owner;
};



typedef u32 anatop_status;	/* All ANATOP Exceptions */

#define AT_OK                   (anatop_status) 0x0000
#define AT_ERROR                (anatop_status) 0x0001


#define ANATOP_MAX_STRING			80


#define ANATOP_BUS_COMPONENT		0x00010000
#define ANATOP_AC_COMPONENT		0x00020000
#define ANATOP_BATTERY_COMPONENT		0x00040000
#define ANATOP_BUTTON_COMPONENT		0x00080000
#define ANATOP_SBS_COMPONENT		0x00100000
#define ANATOP_FAN_COMPONENT		0x00200000
#define ANATOP_PCI_COMPONENT		0x00400000
#define ANATOP_POWER_COMPONENT		0x00800000
#define ANATOP_CONTAINER_COMPONENT	0x01000000
#define ANATOP_SYSTEM_COMPONENT		0x02000000
#define ANATOP_THERMAL_COMPONENT		0x04000000
#define ANATOP_MEMORY_DEVICE_COMPONENT	0x08000000
#define ANATOP_VIDEO_COMPONENT		0x10000000
#define ANATOP_PROCESSOR_COMPONENT	0x20000000


#define ANATOP_POWER_HID			"LNXPOWER"
#define ANATOP_PROCESSOR_OBJECT_HID	"LNXCPU"
#define ANATOP_SYSTEM_HID			"LNXSYSTM"
#define ANATOP_THERMAL_HID		"LNXTHERM"
#define ANATOP_BUTTON_HID_POWERF		"LNXPWRBN"
#define ANATOP_BUTTON_HID_SLEEPF		"LNXSLPBN"
#define ANATOP_VIDEO_HID			"LNXVIDEO"
#define ANATOP_BAY_HID			"LNXIOBAY"
#define ANATOP_DOCK_HID			"LNXDOCK"
/* Quirk for broken IBM BIOSes */
#define ANATOP_SMBUS_IBM_HID		"SMBUSIBM"

#define ANATOP_FIXED_HARDWARE_EVENT	0x100

static inline void *anatop_driver_data(struct anatop_device *d)
{
	return d->driver_data;
}

extern void anatop_thermal_cpufreq_init(void);
extern int anatop_thermal_cpu_hotplug(bool cpu_on);
extern int anatop_thermal_cpufreq_up(void);
extern int anatop_thermal_cpufreq_down(void);
extern struct thermal_cooling_device_ops imx_processor_cooling_ops;
extern void arch_reset(char mode, const char *cmd);

#endif /*__ANATOP_DRIVERS_H__*/