Root/
Source at commit 1165 created 13 years 11 days ago. By slice, new targets: make image and make pkg, Russian localization | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * The contents of this file constitute Original Code as defined in and␊ |
7 | * are subject to the Apple Public Source License Version 1.1 (the␊ |
8 | * "License"). You may not use this file except in compliance with the␊ |
9 | * License. Please obtain a copy of the License at␊ |
10 | * http://www.apple.com/publicsource and read it before using this file.␊ |
11 | * ␊ |
12 | * This Original Code and all software distributed under the License are␊ |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the␊ |
17 | * License for the specific language governing rights and limitations␊ |
18 | * under the License.␊ |
19 | * ␊ |
20 | * @APPLE_LICENSE_HEADER_END@␊ |
21 | */␊ |
22 | ␊ |
23 | #ifndef _IOKIT_IODISPLAY_H␊ |
24 | #define _IOKIT_IODISPLAY_H␊ |
25 | ␊ |
26 | #include <IOKit/IOService.h>␊ |
27 | #include <IOKit/graphics/IOFramebuffer.h>␊ |
28 | ␊ |
29 | extern const OSSymbol * gIODisplayParametersKey;␊ |
30 | extern const OSSymbol * gIODisplayGUIDKey;␊ |
31 | ␊ |
32 | extern const OSSymbol * gIODisplayValueKey;␊ |
33 | extern const OSSymbol * gIODisplayMinValueKey;␊ |
34 | extern const OSSymbol * gIODisplayMaxValueKey;␊ |
35 | ␊ |
36 | extern const OSSymbol * gIODisplayContrastKey;␊ |
37 | extern const OSSymbol * gIODisplayBrightnessKey;␊ |
38 | extern const OSSymbol * gIODisplayHorizontalPositionKey;␊ |
39 | extern const OSSymbol * gIODisplayHorizontalSizeKey;␊ |
40 | extern const OSSymbol * gIODisplayVerticalPositionKey;␊ |
41 | extern const OSSymbol * gIODisplayVerticalSizeKey;␊ |
42 | extern const OSSymbol * gIODisplayTrapezoidKey;␊ |
43 | extern const OSSymbol * gIODisplayPincushionKey;␊ |
44 | extern const OSSymbol * gIODisplayParallelogramKey;␊ |
45 | extern const OSSymbol * gIODisplayRotationKey;␊ |
46 | extern const OSSymbol * gIODisplayOverscanKey;␊ |
47 | extern const OSSymbol * gIODisplayVideoBestKey;␊ |
48 | ␊ |
49 | extern const OSSymbol * gIODisplayParametersTheatreModeKey;␊ |
50 | extern const OSSymbol * gIODisplayParametersTheatreModeWindowKey;␊ |
51 | ␊ |
52 | extern const OSSymbol * gIODisplayMCCSVersionKey;␊ |
53 | extern const OSSymbol * gIODisplayTechnologyTypeKey;␊ |
54 | extern const OSSymbol * gIODisplayUsageTimeKey;␊ |
55 | extern const OSSymbol * gIODisplayFirmwareLevelKey;␊ |
56 | ␊ |
57 | extern const OSSymbol * gIODisplaySpeakerVolumeKey;␊ |
58 | extern const OSSymbol * gIODisplaySpeakerSelectKey;␊ |
59 | extern const OSSymbol * gIODisplayMicrophoneVolumeKey;␊ |
60 | extern const OSSymbol * gIODisplayAmbientLightSensorKey;␊ |
61 | extern const OSSymbol * gIODisplayAudioMuteAndScreenBlankKey;␊ |
62 | extern const OSSymbol * gIODisplayAudioTrebleKey;␊ |
63 | extern const OSSymbol * gIODisplayAudioBassKey;␊ |
64 | extern const OSSymbol * gIODisplayAudioBalanceLRKey;␊ |
65 | extern const OSSymbol * gIODisplayAudioProcessorModeKey;␊ |
66 | extern const OSSymbol * gIODisplayPowerModeKey;␊ |
67 | extern const OSSymbol * gIODisplayManufacturerSpecificKey;␊ |
68 | ␊ |
69 | extern const OSSymbol * gIODisplayParametersCommitKey;␊ |
70 | extern const OSSymbol * gIODisplayParametersDefaultKey;␊ |
71 | extern const OSSymbol * gIODisplayParametersFlushKey;␊ |
72 | ␊ |
73 | enum {␊ |
74 | kIODisplayNumPowerStates = 4,␊ |
75 | kIODisplayMaxPowerState = kIODisplayNumPowerStates - 1␊ |
76 | };␊ |
77 | ␊ |
78 | // these are the private instance variables for power management␊ |
79 | struct DisplayPMVars␊ |
80 | {␊ |
81 | UInt32 currentState;␊ |
82 | // highest state number normally, lowest usable state in emergency␊ |
83 | unsigned long maxState;␊ |
84 | // true if the display has had power lowered due to user inactivity␊ |
85 | bool displayIdle;␊ |
86 | };␊ |
87 | ␊ |
88 | class IODisplayConnect : public IOService␊ |
89 | {␊ |
90 | OSDeclareDefaultStructors(IODisplayConnect)␊ |
91 | ␊ |
92 | private:␊ |
93 | IOIndex connection;␊ |
94 | ␊ |
95 | protected:␊ |
96 | /*! @struct ExpansionData␊ |
97 | @discussion This structure will be used to expand the capablilties of this class in the future.␊ |
98 | */ ␊ |
99 | struct ExpansionData { };␊ |
100 | ␊ |
101 | /*! @var reserved␊ |
102 | Reserved for future use. (Internal use only) */␊ |
103 | ExpansionData * reserved;␊ |
104 | ␊ |
105 | public:␊ |
106 | virtual bool initWithConnection( IOIndex connection );␊ |
107 | virtual IOFramebuffer * getFramebuffer( void );␊ |
108 | virtual IOIndex getConnection( void );␊ |
109 | virtual IOReturn getAttributeForConnection( IOSelect selector, uintptr_t * value );␊ |
110 | virtual IOReturn setAttributeForConnection( IOSelect selector, uintptr_t value );␊ |
111 | virtual void joinPMtree ( IOService * driver );␊ |
112 | };␊ |
113 | ␊ |
114 | class IODisplay : public IOService␊ |
115 | {␊ |
116 | OSDeclareAbstractStructors(IODisplay)␊ |
117 | ␊ |
118 | public:␊ |
119 | static void initialize( void );␊ |
120 | ␊ |
121 | protected:␊ |
122 | // used to query the framebuffer controller␊ |
123 | IODisplayConnect * fConnection;␊ |
124 | class IODisplayParameterHandler * fParameterHandler;␊ |
125 | void * __resv;␊ |
126 | IONotifier * fNotifier;␊ |
127 | ␊ |
128 | // pointer to protected instance variables for power management␊ |
129 | struct DisplayPMVars * fDisplayPMVars;␊ |
130 | ␊ |
131 | // reserved for future expansion␊ |
132 | void * _IODisplay_reserved[32];␊ |
133 | ␊ |
134 | public:␊ |
135 | virtual IOService * probe( IOService * provider,␊ |
136 | SInt32 * score );␊ |
137 | ␊ |
138 | virtual bool start( IOService * provider );␊ |
139 | virtual void stop( IOService * provider );␊ |
140 | virtual void free();␊ |
141 | ␊ |
142 | virtual IODisplayConnect * getConnection( void );␊ |
143 | ␊ |
144 | virtual IOReturn getConnectFlagsForDisplayMode(␊ |
145 | IODisplayModeID mode, UInt32 * flags );␊ |
146 | ␊ |
147 | virtual IOReturn getGammaTableByIndex(␊ |
148 | UInt32 * channelCount, UInt32 * dataCount,␊ |
149 | UInt32 * dataWidth, void ** data );␊ |
150 | ␊ |
151 | virtual IOReturn readFramebufferEDID( void );␊ |
152 | ␊ |
153 | // ␊ |
154 | virtual IOReturn framebufferEvent( IOFramebuffer * framebuffer, ␊ |
155 | IOIndex event, void * info );␊ |
156 | ␊ |
157 | // parameter setting␊ |
158 | virtual IOReturn setProperties( OSObject * properties );␊ |
159 | virtual bool setForKey( OSDictionary * params, const OSSymbol * key,␊ |
160 | SInt32 value, SInt32 min, SInt32 max );␊ |
161 | ␊ |
162 | static bool addParameter( OSDictionary * params, const OSSymbol * paramName, SInt32 min, SInt32 max );␊ |
163 | static bool setParameter( OSDictionary * params, const OSSymbol * paramName, SInt32 value );␊ |
164 | static OSDictionary * getIntegerRange( OSDictionary * params, const OSSymbol * sym,␊ |
165 | SInt32 * value, SInt32 * min, SInt32 * max );␊ |
166 | ␊ |
167 | // low level set/get␊ |
168 | virtual bool doIntegerSet( OSDictionary * params,␊ |
169 | const OSSymbol * paramName, UInt32 value );␊ |
170 | virtual bool doDataSet( const OSSymbol * paramName, OSData * value );␊ |
171 | virtual bool doUpdate( void );␊ |
172 | ␊ |
173 | // power management methods␊ |
174 | virtual IOReturn setPowerState( unsigned long, IOService * );␊ |
175 | virtual unsigned long maxCapabilityForDomainState( IOPMPowerFlags );␊ |
176 | virtual unsigned long initialPowerStateForDomainState( IOPMPowerFlags );␊ |
177 | virtual unsigned long powerStateForDomainState( IOPMPowerFlags );␊ |
178 | ␊ |
179 | // ␊ |
180 | virtual void initPowerManagement( IOService * provider);␊ |
181 | virtual void dropOneLevel( void );␊ |
182 | virtual void makeDisplayUsable( void );␊ |
183 | ␊ |
184 | private:␊ |
185 | OSMetaClassDeclareReservedUnused(IODisplay, 0);␊ |
186 | OSMetaClassDeclareReservedUnused(IODisplay, 1);␊ |
187 | OSMetaClassDeclareReservedUnused(IODisplay, 2);␊ |
188 | OSMetaClassDeclareReservedUnused(IODisplay, 3);␊ |
189 | OSMetaClassDeclareReservedUnused(IODisplay, 4);␊ |
190 | OSMetaClassDeclareReservedUnused(IODisplay, 5);␊ |
191 | OSMetaClassDeclareReservedUnused(IODisplay, 6);␊ |
192 | OSMetaClassDeclareReservedUnused(IODisplay, 7);␊ |
193 | OSMetaClassDeclareReservedUnused(IODisplay, 8);␊ |
194 | OSMetaClassDeclareReservedUnused(IODisplay, 9);␊ |
195 | OSMetaClassDeclareReservedUnused(IODisplay, 10);␊ |
196 | OSMetaClassDeclareReservedUnused(IODisplay, 11);␊ |
197 | OSMetaClassDeclareReservedUnused(IODisplay, 12);␊ |
198 | OSMetaClassDeclareReservedUnused(IODisplay, 13);␊ |
199 | OSMetaClassDeclareReservedUnused(IODisplay, 14);␊ |
200 | OSMetaClassDeclareReservedUnused(IODisplay, 15);␊ |
201 | OSMetaClassDeclareReservedUnused(IODisplay, 16);␊ |
202 | OSMetaClassDeclareReservedUnused(IODisplay, 17);␊ |
203 | OSMetaClassDeclareReservedUnused(IODisplay, 18);␊ |
204 | OSMetaClassDeclareReservedUnused(IODisplay, 19);␊ |
205 | ␊ |
206 | private:␊ |
207 | static IOReturn _framebufferEvent( OSObject * self, void * ref,␊ |
208 | IOFramebuffer *framebuffer, IOIndex event, void * info );␊ |
209 | ␊ |
210 | bool addParameterHandler( IODisplayParameterHandler * parameterHandler );␊ |
211 | bool removeParameterHandler( IODisplayParameterHandler * parameterHandler );␊ |
212 | static bool updateNumber( OSDictionary * params, const OSSymbol * key, SInt32 value );␊ |
213 | };␊ |
214 | ␊ |
215 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */␊ |
216 | ␊ |
217 | class IOBacklightDisplay : public IODisplay␊ |
218 | {␊ |
219 | OSDeclareDefaultStructors(IOBacklightDisplay)␊ |
220 | ␊ |
221 | protected:␊ |
222 | // User preferred brightness level␊ |
223 | SInt32 fCurrentUserBrightness;␊ |
224 | SInt32 fCurrentBrightness;␊ |
225 | UInt32 fCurrentPowerState;␊ |
226 | SInt32 fMinBrightness;␊ |
227 | SInt32 fMaxBrightness;␊ |
228 | UInt16 fMaxBrightnessLevel[kIODisplayNumPowerStates];␊ |
229 | ␊ |
230 | public:␊ |
231 | virtual IOService * probe( IOService *, SInt32 * );␊ |
232 | virtual void stop( IOService * provider );␊ |
233 | virtual IOReturn setPowerState( unsigned long, IOService * );␊ |
234 | virtual unsigned long maxCapabilityForDomainState( IOPMPowerFlags );␊ |
235 | virtual unsigned long initialPowerStateForDomainState( IOPMPowerFlags );␊ |
236 | virtual unsigned long powerStateForDomainState( IOPMPowerFlags );␊ |
237 | ␊ |
238 | // ␊ |
239 | virtual void initPowerManagement( IOService * );␊ |
240 | ␊ |
241 | public:␊ |
242 | virtual bool doIntegerSet( OSDictionary * params,␊ |
243 | const OSSymbol * paramName, UInt32 value );␊ |
244 | virtual bool doUpdate( void );␊ |
245 | virtual void makeDisplayUsable( void );␊ |
246 | virtual bool setBrightness( SInt32 value );␊ |
247 | ␊ |
248 | private:␊ |
249 | void handlePMSettingCallback(const OSSymbol *, OSObject *, uintptr_t);␊ |
250 | ␊ |
251 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 0);␊ |
252 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 1);␊ |
253 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 2);␊ |
254 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 3);␊ |
255 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 4);␊ |
256 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 5);␊ |
257 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 6);␊ |
258 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 7);␊ |
259 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 8);␊ |
260 | OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 9);␊ |
261 | };␊ |
262 | ␊ |
263 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */␊ |
264 | ␊ |
265 | class IODisplayParameterHandler : public IOService␊ |
266 | {␊ |
267 | OSDeclareDefaultStructors(IODisplayParameterHandler)␊ |
268 | ␊ |
269 | public:␊ |
270 | virtual bool setDisplay( IODisplay * display ) = 0;␊ |
271 | virtual bool doIntegerSet( OSDictionary * params,␊ |
272 | const OSSymbol * paramName, UInt32 value ) = 0;␊ |
273 | virtual bool doDataSet( const OSSymbol * paramName, OSData * value ) = 0;␊ |
274 | virtual bool doUpdate( void ) = 0;␊ |
275 | ␊ |
276 | private:␊ |
277 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 0);␊ |
278 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 1);␊ |
279 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 2);␊ |
280 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 3);␊ |
281 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 4);␊ |
282 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 5);␊ |
283 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 6);␊ |
284 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 7);␊ |
285 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 8);␊ |
286 | OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 9);␊ |
287 | };␊ |
288 | ␊ |
289 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */␊ |
290 | ␊ |
291 | #endif /* ! _IOKIT_IODISPLAY_H */␊ |
292 | ␊ |
293 |