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

Side by Side Diff: arch/arm/mach-tegra/nv/nvrm/dispatch/nvrm_pwm_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_pwm.h"
41
42 #define OFFSET( s, e ) (NvU32)(void *)(&(((s*)0)->e))
43
44
45 typedef struct NvRmPwmConfig_in_t
46 {
47 NvU32 package_;
48 NvU32 function_;
49 NvRmPwmHandle hPwm;
50 NvRmPwmOutputId OutputId;
51 NvRmPwmMode Mode;
52 NvU32 DutyCycle;
53 NvU32 RequestedFreqHzOrPeriod;
54 } NV_ALIGN(4) NvRmPwmConfig_in;
55
56 typedef struct NvRmPwmConfig_inout_t
57 {
58 NvU32 dummy_;
59 } NV_ALIGN(4) NvRmPwmConfig_inout;
60
61 typedef struct NvRmPwmConfig_out_t
62 {
63 NvError ret_;
64 NvU32 pCurrentFreqHzOrPeriod;
65 } NV_ALIGN(4) NvRmPwmConfig_out;
66
67 typedef struct NvRmPwmConfig_params_t
68 {
69 NvRmPwmConfig_in in;
70 NvRmPwmConfig_inout inout;
71 NvRmPwmConfig_out out;
72 } NvRmPwmConfig_params;
73
74 typedef struct NvRmPwmClose_in_t
75 {
76 NvU32 package_;
77 NvU32 function_;
78 NvRmPwmHandle hPwm;
79 } NV_ALIGN(4) NvRmPwmClose_in;
80
81 typedef struct NvRmPwmClose_inout_t
82 {
83 NvU32 dummy_;
84 } NV_ALIGN(4) NvRmPwmClose_inout;
85
86 typedef struct NvRmPwmClose_out_t
87 {
88 NvU32 dummy_;
89 } NV_ALIGN(4) NvRmPwmClose_out;
90
91 typedef struct NvRmPwmClose_params_t
92 {
93 NvRmPwmClose_in in;
94 NvRmPwmClose_inout inout;
95 NvRmPwmClose_out out;
96 } NvRmPwmClose_params;
97
98 typedef struct NvRmPwmOpen_in_t
99 {
100 NvU32 package_;
101 NvU32 function_;
102 NvRmDeviceHandle hDevice;
103 } NV_ALIGN(4) NvRmPwmOpen_in;
104
105 typedef struct NvRmPwmOpen_inout_t
106 {
107 NvU32 dummy_;
108 } NV_ALIGN(4) NvRmPwmOpen_inout;
109
110 typedef struct NvRmPwmOpen_out_t
111 {
112 NvError ret_;
113 NvRmPwmHandle phPwm;
114 } NV_ALIGN(4) NvRmPwmOpen_out;
115
116 typedef struct NvRmPwmOpen_params_t
117 {
118 NvRmPwmOpen_in in;
119 NvRmPwmOpen_inout inout;
120 NvRmPwmOpen_out out;
121 } NvRmPwmOpen_params;
122
123 static NvError NvRmPwmConfig_dispatch_( void *InBuffer, NvU32 InSize, void *OutB uffer, NvU32 OutSize, NvDispatchCtx* Ctx )
124 {
125 NvError err_ = NvSuccess;
126 NvRmPwmConfig_in *p_in;
127 NvRmPwmConfig_out *p_out;
128
129 p_in = (NvRmPwmConfig_in *)InBuffer;
130 p_out = (NvRmPwmConfig_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPwmConfig_param s, out) - OFFSET(NvRmPwmConfig_params, inout));
131
132
133 p_out->ret_ = NvRmPwmConfig( p_in->hPwm, p_in->OutputId, p_in->Mode, p_in->D utyCycle, p_in->RequestedFreqHzOrPeriod, &p_out->pCurrentFreqHzOrPeriod );
134
135 return err_;
136 }
137
138 static NvError NvRmPwmClose_dispatch_( void *InBuffer, NvU32 InSize, void *OutBu ffer, NvU32 OutSize, NvDispatchCtx* Ctx )
139 {
140 NvError err_ = NvSuccess;
141 NvRmPwmClose_in *p_in;
142
143 p_in = (NvRmPwmClose_in *)InBuffer;
144
145
146 NvRmPwmClose( p_in->hPwm );
147
148 return err_;
149 }
150
151 static NvError NvRmPwmOpen_dispatch_( void *InBuffer, NvU32 InSize, void *OutBuf fer, NvU32 OutSize, NvDispatchCtx* Ctx )
152 {
153 NvError err_ = NvSuccess;
154 NvRmPwmOpen_in *p_in;
155 NvRmPwmOpen_out *p_out;
156
157 p_in = (NvRmPwmOpen_in *)InBuffer;
158 p_out = (NvRmPwmOpen_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPwmOpen_params, o ut) - OFFSET(NvRmPwmOpen_params, inout));
159
160
161 p_out->ret_ = NvRmPwmOpen( p_in->hDevice, &p_out->phPwm );
162
163 return err_;
164 }
165
166 NvError nvrm_pwm_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, void *O utBuffer, NvU32 OutSize, NvDispatchCtx* Ctx );
167 NvError nvrm_pwm_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, void *O utBuffer, NvU32 OutSize, NvDispatchCtx* Ctx )
168 {
169 NvError err_ = NvSuccess;
170
171 switch( function ) {
172 case 2:
173 err_ = NvRmPwmConfig_dispatch_( InBuffer, InSize, OutBuffer, OutSize, Ct x );
174 break;
175 case 1:
176 err_ = NvRmPwmClose_dispatch_( InBuffer, InSize, OutBuffer, OutSize, Ctx );
177 break;
178 case 0:
179 err_ = NvRmPwmOpen_dispatch_( InBuffer, InSize, OutBuffer, OutSize, Ctx );
180 break;
181 default:
182 err_ = NvError_BadParameter;
183 break;
184 }
185
186 return err_;
187 }
OLDNEW
« no previous file with comments | « arch/arm/mach-tegra/nv/nvrm/dispatch/nvrm_power_dispatch.c ('k') | arch/arm/mach-tegra/nv/nvrm/dispatch/nvrm_spi_dispatch.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698