diff options
author | Uri Shkolnik <uris@siano-ms.com> | 2009-05-19 11:18:40 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 18:14:40 -0400 |
commit | 5b8db8978379be5e715803f89c03a2733fe8c8e8 (patch) | |
tree | a7618497ca3f40d4feca60f7b97f951ab8e3086d /drivers | |
parent | 4887f7b4ef8926fd8eb79a928d5f3c4ea25263b8 (diff) |
V4L/DVB (11887): Siano: smscards - add board (target) events
Add events handling for targets. All board-specific
(target specific) should reside here.
Signed-off-by: Uri Shkolnik <uris@siano-ms.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/siano/sms-cards.c | 167 | ||||
-rw-r--r-- | drivers/media/dvb/siano/sms-cards.h | 24 |
2 files changed, 191 insertions, 0 deletions
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index 370cf513a81a..d8b15d583bde 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c | |||
@@ -104,6 +104,173 @@ struct sms_board *sms_get_board(int id) | |||
104 | return &sms_boards[id]; | 104 | return &sms_boards[id]; |
105 | } | 105 | } |
106 | EXPORT_SYMBOL_GPL(sms_get_board); | 106 | EXPORT_SYMBOL_GPL(sms_get_board); |
107 | static inline void sms_gpio_assign_11xx_default_led_config( | ||
108 | struct smscore_gpio_config *pGpioConfig) { | ||
109 | pGpioConfig->Direction = SMS_GPIO_DIRECTION_OUTPUT; | ||
110 | pGpioConfig->InputCharacteristics = | ||
111 | SMS_GPIO_INPUT_CHARACTERISTICS_NORMAL; | ||
112 | pGpioConfig->OutputDriving = SMS_GPIO_OUTPUT_DRIVING_4mA; | ||
113 | pGpioConfig->OutputSlewRate = SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS; | ||
114 | pGpioConfig->PullUpDown = SMS_GPIO_PULL_UP_DOWN_NONE; | ||
115 | } | ||
116 | |||
117 | int sms_board_event(struct smscore_device_t *coredev, | ||
118 | enum SMS_BOARD_EVENTS gevent) { | ||
119 | int board_id = smscore_get_board_id(coredev); | ||
120 | struct sms_board *board = sms_get_board(board_id); | ||
121 | struct smscore_gpio_config MyGpioConfig; | ||
122 | |||
123 | sms_gpio_assign_11xx_default_led_config(&MyGpioConfig); | ||
124 | |||
125 | switch (gevent) { | ||
126 | case BOARD_EVENT_POWER_INIT: /* including hotplug */ | ||
127 | switch (board_id) { | ||
128 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
129 | /* set I/O and turn off all LEDs */ | ||
130 | smscore_gpio_configure(coredev, | ||
131 | board->board_cfg.leds_power, | ||
132 | &MyGpioConfig); | ||
133 | smscore_gpio_set_level(coredev, | ||
134 | board->board_cfg.leds_power, 0); | ||
135 | smscore_gpio_configure(coredev, board->board_cfg.led0, | ||
136 | &MyGpioConfig); | ||
137 | smscore_gpio_set_level(coredev, | ||
138 | board->board_cfg.led0, 0); | ||
139 | smscore_gpio_configure(coredev, board->board_cfg.led1, | ||
140 | &MyGpioConfig); | ||
141 | smscore_gpio_set_level(coredev, | ||
142 | board->board_cfg.led1, 0); | ||
143 | break; | ||
144 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
145 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
146 | /* set I/O and turn off LNA */ | ||
147 | smscore_gpio_configure(coredev, | ||
148 | board->board_cfg.foreign_lna0_ctrl, | ||
149 | &MyGpioConfig); | ||
150 | smscore_gpio_set_level(coredev, | ||
151 | board->board_cfg.foreign_lna0_ctrl, | ||
152 | 0); | ||
153 | break; | ||
154 | } | ||
155 | break; /* BOARD_EVENT_BIND */ | ||
156 | |||
157 | case BOARD_EVENT_POWER_SUSPEND: | ||
158 | switch (board_id) { | ||
159 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
160 | smscore_gpio_set_level(coredev, | ||
161 | board->board_cfg.leds_power, 0); | ||
162 | smscore_gpio_set_level(coredev, | ||
163 | board->board_cfg.led0, 0); | ||
164 | smscore_gpio_set_level(coredev, | ||
165 | board->board_cfg.led1, 0); | ||
166 | break; | ||
167 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
168 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
169 | smscore_gpio_set_level(coredev, | ||
170 | board->board_cfg.foreign_lna0_ctrl, | ||
171 | 0); | ||
172 | break; | ||
173 | } | ||
174 | break; /* BOARD_EVENT_POWER_SUSPEND */ | ||
175 | |||
176 | case BOARD_EVENT_POWER_RESUME: | ||
177 | switch (board_id) { | ||
178 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
179 | smscore_gpio_set_level(coredev, | ||
180 | board->board_cfg.leds_power, 1); | ||
181 | smscore_gpio_set_level(coredev, | ||
182 | board->board_cfg.led0, 1); | ||
183 | smscore_gpio_set_level(coredev, | ||
184 | board->board_cfg.led1, 0); | ||
185 | break; | ||
186 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
187 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
188 | smscore_gpio_set_level(coredev, | ||
189 | board->board_cfg.foreign_lna0_ctrl, | ||
190 | 1); | ||
191 | break; | ||
192 | } | ||
193 | break; /* BOARD_EVENT_POWER_RESUME */ | ||
194 | |||
195 | case BOARD_EVENT_BIND: | ||
196 | switch (board_id) { | ||
197 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
198 | smscore_gpio_set_level(coredev, | ||
199 | board->board_cfg.leds_power, 1); | ||
200 | smscore_gpio_set_level(coredev, | ||
201 | board->board_cfg.led0, 1); | ||
202 | smscore_gpio_set_level(coredev, | ||
203 | board->board_cfg.led1, 0); | ||
204 | break; | ||
205 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
206 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
207 | smscore_gpio_set_level(coredev, | ||
208 | board->board_cfg.foreign_lna0_ctrl, | ||
209 | 1); | ||
210 | break; | ||
211 | } | ||
212 | break; /* BOARD_EVENT_BIND */ | ||
213 | |||
214 | case BOARD_EVENT_SCAN_PROG: | ||
215 | break; /* BOARD_EVENT_SCAN_PROG */ | ||
216 | case BOARD_EVENT_SCAN_COMP: | ||
217 | break; /* BOARD_EVENT_SCAN_COMP */ | ||
218 | case BOARD_EVENT_EMERGENCY_WARNING_SIGNAL: | ||
219 | break; /* BOARD_EVENT_EMERGENCY_WARNING_SIGNAL */ | ||
220 | case BOARD_EVENT_FE_LOCK: | ||
221 | switch (board_id) { | ||
222 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
223 | smscore_gpio_set_level(coredev, | ||
224 | board->board_cfg.led1, 1); | ||
225 | break; | ||
226 | } | ||
227 | break; /* BOARD_EVENT_FE_LOCK */ | ||
228 | case BOARD_EVENT_FE_UNLOCK: | ||
229 | switch (board_id) { | ||
230 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
231 | smscore_gpio_set_level(coredev, | ||
232 | board->board_cfg.led1, 0); | ||
233 | break; | ||
234 | } | ||
235 | break; /* BOARD_EVENT_FE_UNLOCK */ | ||
236 | case BOARD_EVENT_DEMOD_LOCK: | ||
237 | break; /* BOARD_EVENT_DEMOD_LOCK */ | ||
238 | case BOARD_EVENT_DEMOD_UNLOCK: | ||
239 | break; /* BOARD_EVENT_DEMOD_UNLOCK */ | ||
240 | case BOARD_EVENT_RECEPTION_MAX_4: | ||
241 | break; /* BOARD_EVENT_RECEPTION_MAX_4 */ | ||
242 | case BOARD_EVENT_RECEPTION_3: | ||
243 | break; /* BOARD_EVENT_RECEPTION_3 */ | ||
244 | case BOARD_EVENT_RECEPTION_2: | ||
245 | break; /* BOARD_EVENT_RECEPTION_2 */ | ||
246 | case BOARD_EVENT_RECEPTION_1: | ||
247 | break; /* BOARD_EVENT_RECEPTION_1 */ | ||
248 | case BOARD_EVENT_RECEPTION_LOST_0: | ||
249 | break; /* BOARD_EVENT_RECEPTION_LOST_0 */ | ||
250 | case BOARD_EVENT_MULTIPLEX_OK: | ||
251 | switch (board_id) { | ||
252 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
253 | smscore_gpio_set_level(coredev, | ||
254 | board->board_cfg.led1, 1); | ||
255 | break; | ||
256 | } | ||
257 | break; /* BOARD_EVENT_MULTIPLEX_OK */ | ||
258 | case BOARD_EVENT_MULTIPLEX_ERRORS: | ||
259 | switch (board_id) { | ||
260 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
261 | smscore_gpio_set_level(coredev, | ||
262 | board->board_cfg.led1, 0); | ||
263 | break; | ||
264 | } | ||
265 | break; /* BOARD_EVENT_MULTIPLEX_ERRORS */ | ||
266 | |||
267 | default: | ||
268 | sms_err("Unknown SMS board event"); | ||
269 | break; | ||
270 | } | ||
271 | return 0; | ||
272 | } | ||
273 | EXPORT_SYMBOL_GPL(sms_board_event); | ||
107 | 274 | ||
108 | static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable) | 275 | static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable) |
109 | { | 276 | { |
diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h index e183f946af4d..38f062f6ad68 100644 --- a/drivers/media/dvb/siano/sms-cards.h +++ b/drivers/media/dvb/siano/sms-cards.h | |||
@@ -85,6 +85,30 @@ struct sms_board *sms_get_board(int id); | |||
85 | 85 | ||
86 | extern struct smscore_device_t *coredev; | 86 | extern struct smscore_device_t *coredev; |
87 | 87 | ||
88 | enum SMS_BOARD_EVENTS { | ||
89 | BOARD_EVENT_POWER_INIT, | ||
90 | BOARD_EVENT_POWER_SUSPEND, | ||
91 | BOARD_EVENT_POWER_RESUME, | ||
92 | BOARD_EVENT_BIND, | ||
93 | BOARD_EVENT_SCAN_PROG, | ||
94 | BOARD_EVENT_SCAN_COMP, | ||
95 | BOARD_EVENT_EMERGENCY_WARNING_SIGNAL, | ||
96 | BOARD_EVENT_FE_LOCK, | ||
97 | BOARD_EVENT_FE_UNLOCK, | ||
98 | BOARD_EVENT_DEMOD_LOCK, | ||
99 | BOARD_EVENT_DEMOD_UNLOCK, | ||
100 | BOARD_EVENT_RECEPTION_MAX_4, | ||
101 | BOARD_EVENT_RECEPTION_3, | ||
102 | BOARD_EVENT_RECEPTION_2, | ||
103 | BOARD_EVENT_RECEPTION_1, | ||
104 | BOARD_EVENT_RECEPTION_LOST_0, | ||
105 | BOARD_EVENT_MULTIPLEX_OK, | ||
106 | BOARD_EVENT_MULTIPLEX_ERRORS | ||
107 | }; | ||
108 | |||
109 | int sms_board_event(struct smscore_device_t *coredev, | ||
110 | enum SMS_BOARD_EVENTS gevent); | ||
111 | |||
88 | int sms_board_setup(struct smscore_device_t *coredev); | 112 | int sms_board_setup(struct smscore_device_t *coredev); |
89 | 113 | ||
90 | #define SMS_LED_OFF 0 | 114 | #define SMS_LED_OFF 0 |