Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: arch/arm/mach-tegra/nv/nvrm/dispatch/nvrm_analog_dispatch.c

Issue 3256004: [ARM] tegra: add nvos/nvrm/nvmap drivers (Closed) Base URL: ssh://git@gitrw.chromium.org/kernel.git
Patch Set: remove ap15 headers Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2009 NVIDIA Corporation.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * Neither the name of the NVIDIA Corporation nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33 #define NV_IDL_IS_DISPATCH
34
35 #include "nvcommon.h"
36 #include "nvos.h"
37 #include "nvassert.h"
38 #include "nvreftrack.h"
39 #include "nvidlcmd.h"
40 #include "nvrm_analog.h"
41
42 #define OFFSET( s, e ) (NvU32)(void *)(&(((s*)0)->e))
43
44
45 typedef struct NvRmUsbDetectChargerState_in_t
46 {
47 NvU32 package_;
48 NvU32 function_;
49 NvRmDeviceHandle hDevice;
50 NvU32 wait;
51 } NV_ALIGN(4) NvRmUsbDetectChargerState_in;
52
53 typedef struct NvRmUsbDetectChargerState_inout_t
54 {
55 NvU32 dummy_;
56 } NV_ALIGN(4) NvRmUsbDetectChargerState_inout;
57
58 typedef struct NvRmUsbDetectChargerState_out_t
59 {
60 NvU32 ret_;
61 } NV_ALIGN(4) NvRmUsbDetectChargerState_out;
62
63 typedef struct NvRmUsbDetectChargerState_params_t
64 {
65 NvRmUsbDetectChargerState_in in;
66 NvRmUsbDetectChargerState_inout inout;
67 NvRmUsbDetectChargerState_out out;
68 } NvRmUsbDetectChargerState_params;
69
70 typedef struct NvRmUsbIsConnected_in_t
71 {
72 NvU32 package_;
73 NvU32 function_;
74 NvRmDeviceHandle hDevice;
75 } NV_ALIGN(4) NvRmUsbIsConnected_in;
76
77 typedef struct NvRmUsbIsConnected_inout_t
78 {
79 NvU32 dummy_;
80 } NV_ALIGN(4) NvRmUsbIsConnected_inout;
81
82 typedef struct NvRmUsbIsConnected_out_t
83 {
84 NvBool ret_;
85 } NV_ALIGN(4) NvRmUsbIsConnected_out;
86
87 typedef struct NvRmUsbIsConnected_params_t
88 {
89 NvRmUsbIsConnected_in in;
90 NvRmUsbIsConnected_inout inout;
91 NvRmUsbIsConnected_out out;
92 } NvRmUsbIsConnected_params;
93
94 typedef struct NvRmAnalogGetTvDacConfiguration_in_t
95 {
96 NvU32 package_;
97 NvU32 function_;
98 NvRmDeviceHandle hDevice;
99 NvRmAnalogTvDacType Type;
100 } NV_ALIGN(4) NvRmAnalogGetTvDacConfiguration_in;
101
102 typedef struct NvRmAnalogGetTvDacConfiguration_inout_t
103 {
104 NvU32 dummy_;
105 } NV_ALIGN(4) NvRmAnalogGetTvDacConfiguration_inout;
106
107 typedef struct NvRmAnalogGetTvDacConfiguration_out_t
108 {
109 NvU8 ret_;
110 } NV_ALIGN(4) NvRmAnalogGetTvDacConfiguration_out;
111
112 typedef struct NvRmAnalogGetTvDacConfiguration_params_t
113 {
114 NvRmAnalogGetTvDacConfiguration_in in;
115 NvRmAnalogGetTvDacConfiguration_inout inout;
116 NvRmAnalogGetTvDacConfiguration_out out;
117 } NvRmAnalogGetTvDacConfiguration_params;
118
119 typedef struct NvRmAnalogInterfaceControl_in_t
120 {
121 NvU32 package_;
122 NvU32 function_;
123 NvRmDeviceHandle hDevice;
124 NvRmAnalogInterface Interface;
125 NvBool Enable;
126 void* Config;
127 NvU32 ConfigLength;
128 } NV_ALIGN(4) NvRmAnalogInterfaceControl_in;
129
130 typedef struct NvRmAnalogInterfaceControl_inout_t
131 {
132 NvU32 dummy_;
133 } NV_ALIGN(4) NvRmAnalogInterfaceControl_inout;
134
135 typedef struct NvRmAnalogInterfaceControl_out_t
136 {
137 NvError ret_;
138 } NV_ALIGN(4) NvRmAnalogInterfaceControl_out;
139
140 typedef struct NvRmAnalogInterfaceControl_params_t
141 {
142 NvRmAnalogInterfaceControl_in in;
143 NvRmAnalogInterfaceControl_inout inout;
144 NvRmAnalogInterfaceControl_out out;
145 } NvRmAnalogInterfaceControl_params;
146
147 static NvError NvRmUsbDetectChargerState_dispatch_( void *InBuffer, NvU32 InSize , void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx )
148 {
149 NvError err_ = NvSuccess;
150 NvRmUsbDetectChargerState_in *p_in;
151 NvRmUsbDetectChargerState_out *p_out;
152
153 p_in = (NvRmUsbDetectChargerState_in *)InBuffer;
154 p_out = (NvRmUsbDetectChargerState_out *)((NvU8 *)OutBuffer + OFFSET(NvRmUsb DetectChargerState_params, out) - OFFSET(NvRmUsbDetectChargerState_params, inout ));
155
156
157 p_out->ret_ = NvRmUsbDetectChargerState( p_in->hDevice, p_in->wait );
158
159 return err_;
160 }
161
162 static NvError NvRmUsbIsConnected_dispatch_( void *InBuffer, NvU32 InSize, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx )
163 {
164 NvError err_ = NvSuccess;
165 NvRmUsbIsConnected_in *p_in;
166 NvRmUsbIsConnected_out *p_out;
167
168 p_in = (NvRmUsbIsConnected_in *)InBuffer;
169 p_out = (NvRmUsbIsConnected_out *)((NvU8 *)OutBuffer + OFFSET(NvRmUsbIsConne cted_params, out) - OFFSET(NvRmUsbIsConnected_params, inout));
170
171
172 p_out->ret_ = NvRmUsbIsConnected( p_in->hDevice );
173
174 return err_;
175 }
176
177 static NvError NvRmAnalogGetTvDacConfiguration_dispatch_( void *InBuffer, NvU32 InSize, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx )
178 {
179 NvError err_ = NvSuccess;
180 NvRmAnalogGetTvDacConfiguration_in *p_in;
181 NvRmAnalogGetTvDacConfiguration_out *p_out;
182
183 p_in = (NvRmAnalogGetTvDacConfiguration_in *)InBuffer;
184 p_out = (NvRmAnalogGetTvDacConfiguration_out *)((NvU8 *)OutBuffer + OFFSET(N vRmAnalogGetTvDacConfiguration_params, out) - OFFSET(NvRmAnalogGetTvDacConfigura tion_params, inout));
185
186
187 p_out->ret_ = NvRmAnalogGetTvDacConfiguration( p_in->hDevice, p_in->Type );
188
189 return err_;
190 }
191
192 static NvError NvRmAnalogInterfaceControl_dispatch_( void *InBuffer, NvU32 InSiz e, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx )
193 {
194 NvError err_ = NvSuccess;
195 NvRmAnalogInterfaceControl_in *p_in;
196 NvRmAnalogInterfaceControl_out *p_out;
197 void* Config = NULL;
198
199 p_in = (NvRmAnalogInterfaceControl_in *)InBuffer;
200 p_out = (NvRmAnalogInterfaceControl_out *)((NvU8 *)OutBuffer + OFFSET(NvRmAn alogInterfaceControl_params, out) - OFFSET(NvRmAnalogInterfaceControl_params, in out));
201
202 if( p_in->ConfigLength && p_in->Config )
203 {
204 Config = (void* )NvOsAlloc( p_in->ConfigLength );
205 if( !Config )
206 {
207 err_ = NvError_InsufficientMemory;
208 goto clean;
209 }
210 if( p_in->Config )
211 {
212 err_ = NvOsCopyIn( Config, p_in->Config, p_in->ConfigLength );
213 if( err_ != NvSuccess )
214 {
215 err_ = NvError_BadParameter;
216 goto clean;
217 }
218 }
219 }
220
221 p_out->ret_ = NvRmAnalogInterfaceControl( p_in->hDevice, p_in->Interface, p_ in->Enable, Config, p_in->ConfigLength );
222
223 if(p_in->Config && Config)
224 {
225 err_ = NvOsCopyOut( p_in->Config, Config, p_in->ConfigLength );
226 if( err_ != NvSuccess )
227 {
228 err_ = NvError_BadParameter;
229 }
230 }
231 clean:
232 NvOsFree( Config );
233 return err_;
234 }
235
236 NvError nvrm_analog_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx );
237 NvError nvrm_analog_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx )
238 {
239 NvError err_ = NvSuccess;
240
241 switch( function ) {
242 case 3:
243 err_ = NvRmUsbDetectChargerState_dispatch_( InBuffer, InSize, OutBuffer, OutSize, Ctx );
244 break;
245 case 2:
246 err_ = NvRmUsbIsConnected_dispatch_( InBuffer, InSize, OutBuffer, OutSiz e, Ctx );
247 break;
248 case 1:
249 err_ = NvRmAnalogGetTvDacConfiguration_dispatch_( InBuffer, InSize, OutB uffer, OutSize, Ctx );
250 break;
251 case 0:
252 err_ = NvRmAnalogInterfaceControl_dispatch_( InBuffer, InSize, OutBuffer , OutSize, Ctx );
253 break;
254 default:
255 err_ = NvError_BadParameter;
256 break;
257 }
258
259 return err_;
260 }
OLDNEW
« no previous file with comments | « arch/arm/mach-tegra/nv/nvrm/dispatch/NvRm_Dispatch.c ('k') | arch/arm/mach-tegra/nv/nvrm/dispatch/nvrm_diag_dispatch.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698