Chameleon

Chameleon Svn Source Tree

Root/branches/zenith432/i386/include/IOKit/graphics/IODisplay.h

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
29extern const OSSymbol * gIODisplayParametersKey;
30extern const OSSymbol * gIODisplayGUIDKey;
31
32extern const OSSymbol * gIODisplayValueKey;
33extern const OSSymbol * gIODisplayMinValueKey;
34extern const OSSymbol * gIODisplayMaxValueKey;
35
36extern const OSSymbol * gIODisplayContrastKey;
37extern const OSSymbol * gIODisplayBrightnessKey;
38extern const OSSymbol * gIODisplayLinearBrightnessKey;
39extern const OSSymbol * gIODisplayUsableLinearBrightnessKey;
40extern const OSSymbol * gIODisplayBrightnessFadeKey;
41extern const OSSymbol * gIODisplayHorizontalPositionKey;
42extern const OSSymbol * gIODisplayHorizontalSizeKey;
43extern const OSSymbol * gIODisplayVerticalPositionKey;
44extern const OSSymbol * gIODisplayVerticalSizeKey;
45extern const OSSymbol * gIODisplayTrapezoidKey;
46extern const OSSymbol * gIODisplayPincushionKey;
47extern const OSSymbol * gIODisplayParallelogramKey;
48extern const OSSymbol * gIODisplayRotationKey;
49extern const OSSymbol * gIODisplayOverscanKey;
50extern const OSSymbol * gIODisplayVideoBestKey;
51extern const OSSymbol * gIODisplaySelectedColorModeKey;
52
53extern const OSSymbol * gIODisplayRedGammaScaleKey;
54extern const OSSymbol * gIODisplayGreenGammaScaleKey;
55extern const OSSymbol * gIODisplayBlueGammaScaleKey;
56extern const OSSymbol * gIODisplayGammaScaleKey;
57
58extern const OSSymbol * gIODisplayParametersTheatreModeKey;
59extern const OSSymbol * gIODisplayParametersTheatreModeWindowKey;
60
61extern const OSSymbol * gIODisplayMCCSVersionKey;
62extern const OSSymbol * gIODisplayTechnologyTypeKey;
63extern const OSSymbol * gIODisplayUsageTimeKey;
64extern const OSSymbol * gIODisplayFirmwareLevelKey;
65
66extern const OSSymbol * gIODisplaySpeakerVolumeKey;
67extern const OSSymbol * gIODisplaySpeakerSelectKey;
68extern const OSSymbol * gIODisplayMicrophoneVolumeKey;
69extern const OSSymbol * gIODisplayAmbientLightSensorKey;
70extern const OSSymbol * gIODisplayAudioMuteAndScreenBlankKey;
71extern const OSSymbol * gIODisplayAudioTrebleKey;
72extern const OSSymbol * gIODisplayAudioBassKey;
73extern const OSSymbol * gIODisplayAudioBalanceLRKey;
74extern const OSSymbol * gIODisplayAudioProcessorModeKey;
75extern const OSSymbol * gIODisplayPowerModeKey;
76extern const OSSymbol * gIODisplayManufacturerSpecificKey;
77
78extern const OSSymbol * gIODisplayPowerStateKey;
79extern const OSSymbol * gIODisplayControllerIDKey;
80extern const OSSymbol * gIODisplayCapabilityStringKey;
81
82extern const OSSymbol * gIODisplayParametersCommitKey;
83extern const OSSymbol * gIODisplayParametersDefaultKey;
84extern const OSSymbol * gIODisplayParametersFlushKey;
85
86extern const OSSymbol * gIODisplayFadeTime1Key;
87extern const OSSymbol * gIODisplayFadeTime2Key;
88extern const OSSymbol * gIODisplayFadeTime3Key;
89extern const OSSymbol * gIODisplayFadeStyleKey;
90
91extern UInt32 gIODisplayFadeTime1;
92extern UInt32 gIODisplayFadeTime2;
93extern UInt32 gIODisplayFadeTime3;
94extern UInt32 gIODisplayFadeStyle;
95
96enum {
97 kIODisplayNumPowerStates = 4,
98 kIODisplayMaxPowerState = kIODisplayNumPowerStates - 1
99};
100
101// these are the private instance variables for power management
102struct DisplayPMVars
103{
104 UInt32 currentState;
105 // highest state number normally, lowest usable state in emergency
106 unsigned long maxState;
107 // true if the display has had power lowered due to user inactivity
108 bool displayIdle;
109};
110
111class IODisplayConnect : public IOService
112{
113 OSDeclareDefaultStructors(IODisplayConnect)
114
115private:
116 IOIndex connection;
117
118protected:
119/* Reserved for future use. (Internal use only) */
120 struct ExpansionData { };
121
122/* Reserved for future use. (Internal use only) */
123 ExpansionData * reserved;
124
125public:
126 virtual bool initWithConnection( IOIndex connection );
127 virtual IOFramebuffer * getFramebuffer( void );
128 virtual IOIndex getConnection( void );
129 virtual IOReturn getAttributeForConnection( IOSelect selector, uintptr_t * value );
130 virtual IOReturn setAttributeForConnection( IOSelect selector, uintptr_t value );
131 virtual void joinPMtree ( IOService * driver );
132};
133
134class IODisplay : public IOService
135{
136 OSDeclareAbstractStructors(IODisplay)
137
138public:
139 static void initialize( void );
140
141protected:
142 // used to query the framebuffer controller
143 IODisplayConnect * fConnection;
144 class IODisplayParameterHandler * fParameterHandler;
145 void * __resv;
146 IONotifier * fNotifier;
147
148 // pointer to protected instance variables for power management
149 struct IODisplayPMVars * fDisplayPMVars;
150
151 // reserved for future expansion
152 void * _IODisplay_reserved[32];
153
154public:
155 virtual IOService * probe( IOService * provider,
156 SInt32 * score );
157
158 virtual bool start( IOService * provider );
159 virtual void stop( IOService * provider );
160 virtual void free();
161
162 virtual IODisplayConnect * getConnection( void );
163
164 virtual IOReturn getConnectFlagsForDisplayMode(
165 IODisplayModeID mode, UInt32 * flags );
166
167 virtual IOReturn getGammaTableByIndex(
168 UInt32 * channelCount, UInt32 * dataCount,
169 UInt32 * dataWidth, void ** data );
170
171 virtual IOReturn readFramebufferEDID( void );
172
173 //
174 virtual IOReturn framebufferEvent( IOFramebuffer * framebuffer,
175 IOIndex event, void * info );
176
177 // parameter setting
178 virtual IOReturn setProperties( OSObject * properties );
179 virtual bool setForKey( OSDictionary * params, const OSSymbol * key,
180 SInt32 value, SInt32 min, SInt32 max );
181
182 static bool addParameter( OSDictionary * params, const OSSymbol * paramName, SInt32 min, SInt32 max );
183 static bool setParameter( OSDictionary * params, const OSSymbol * paramName, SInt32 value );
184 static OSDictionary * getIntegerRange( OSDictionary * params, const OSSymbol * sym,
185 SInt32 * value, SInt32 * min, SInt32 * max );
186
187 // low level set/get
188 virtual bool doIntegerSet( OSDictionary * params,
189 const OSSymbol * paramName, UInt32 value );
190 virtual bool doDataSet( const OSSymbol * paramName, OSData * value );
191 virtual bool doUpdate( void );
192
193 // power management methods
194 virtual IOReturn setPowerState( unsigned long, IOService * );
195 virtual unsigned long maxCapabilityForDomainState( IOPMPowerFlags );
196 virtual unsigned long initialPowerStateForDomainState( IOPMPowerFlags );
197 virtual unsigned long powerStateForDomainState( IOPMPowerFlags );
198
199 //
200 virtual void initPowerManagement( IOService * provider);
201 virtual void dropOneLevel( void );
202 virtual void makeDisplayUsable( void );
203 void setDisplayPowerState(unsigned long state);
204
205private:
206 OSMetaClassDeclareReservedUnused(IODisplay, 0);
207 OSMetaClassDeclareReservedUnused(IODisplay, 1);
208 OSMetaClassDeclareReservedUnused(IODisplay, 2);
209 OSMetaClassDeclareReservedUnused(IODisplay, 3);
210 OSMetaClassDeclareReservedUnused(IODisplay, 4);
211 OSMetaClassDeclareReservedUnused(IODisplay, 5);
212 OSMetaClassDeclareReservedUnused(IODisplay, 6);
213 OSMetaClassDeclareReservedUnused(IODisplay, 7);
214 OSMetaClassDeclareReservedUnused(IODisplay, 8);
215 OSMetaClassDeclareReservedUnused(IODisplay, 9);
216 OSMetaClassDeclareReservedUnused(IODisplay, 10);
217 OSMetaClassDeclareReservedUnused(IODisplay, 11);
218 OSMetaClassDeclareReservedUnused(IODisplay, 12);
219 OSMetaClassDeclareReservedUnused(IODisplay, 13);
220 OSMetaClassDeclareReservedUnused(IODisplay, 14);
221 OSMetaClassDeclareReservedUnused(IODisplay, 15);
222 OSMetaClassDeclareReservedUnused(IODisplay, 16);
223 OSMetaClassDeclareReservedUnused(IODisplay, 17);
224 OSMetaClassDeclareReservedUnused(IODisplay, 18);
225 OSMetaClassDeclareReservedUnused(IODisplay, 19);
226
227private:
228 static IOReturn _framebufferEvent( OSObject * self, void * ref,
229 IOFramebuffer *framebuffer, IOIndex event, void * info );
230
231void searchParameterHandlers(IORegistryEntry * entry);
232 bool addParameterHandler( IODisplayParameterHandler * parameterHandler );
233 bool removeParameterHandler( IODisplayParameterHandler * parameterHandler );
234 static bool updateNumber( OSDictionary * params, const OSSymbol * key, SInt32 value );
235};
236
237/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
238
239class IOBacklightDisplay : public IODisplay
240{
241 OSDeclareDefaultStructors(IOBacklightDisplay)
242
243protected:
244 // User preferred brightness level
245 SInt32 fCurrentUserBrightness;
246 SInt32 fCurrentBrightness;
247 UInt32 fCurrentPowerState;
248 SInt32 fMinBrightness;
249 SInt32 fMaxBrightness;
250 UInt16 fMaxBrightnessLevel[kIODisplayNumPowerStates];
251
252public:
253 virtual IOService * probe( IOService *, SInt32 * );
254 virtual void stop( IOService * provider );
255 virtual IOReturn setPowerState( unsigned long, IOService * );
256 virtual unsigned long maxCapabilityForDomainState( IOPMPowerFlags );
257 virtual unsigned long initialPowerStateForDomainState( IOPMPowerFlags );
258 virtual unsigned long powerStateForDomainState( IOPMPowerFlags );
259
260 //
261 virtual void initPowerManagement( IOService * );
262
263public:
264 virtual bool doIntegerSet( OSDictionary * params,
265 const OSSymbol * paramName, UInt32 value );
266 virtual bool doUpdate( void );
267 virtual void makeDisplayUsable( void );
268 virtual bool setBrightness( SInt32 value );
269
270private:
271 void handlePMSettingCallback(const OSSymbol *, OSObject *, uintptr_t);
272
273 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 0);
274 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 1);
275 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 2);
276 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 3);
277 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 4);
278 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 5);
279 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 6);
280 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 7);
281 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 8);
282 OSMetaClassDeclareReservedUnused(IOBacklightDisplay, 9);
283};
284
285/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
286
287class IODisplayParameterHandler : public IOService
288{
289 OSDeclareDefaultStructors(IODisplayParameterHandler)
290
291public:
292 virtual bool setDisplay( IODisplay * display ) = 0;
293 virtual bool doIntegerSet( OSDictionary * params,
294 const OSSymbol * paramName, UInt32 value ) = 0;
295 virtual bool doDataSet( const OSSymbol * paramName, OSData * value ) = 0;
296 virtual bool doUpdate( void ) = 0;
297
298private:
299 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 0);
300 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 1);
301 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 2);
302 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 3);
303 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 4);
304 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 5);
305 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 6);
306 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 7);
307 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 8);
308 OSMetaClassDeclareReservedUnused(IODisplayParameterHandler, 9);
309};
310
311/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
312
313#endif /* ! _IOKIT_IODISPLAY_H */
314
315

Archive Download this file

Revision: 2805