diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-08-11 11:37:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-09-13 16:42:11 -0400 |
commit | d1f280d615a0f0b723dac5a2cd3f2f7f18bca4fa (patch) | |
tree | ac916f6f898f70461dd05eac0b11bddff5a1d0c7 /drivers/media | |
parent | d7aab0bf9dbd658c25e815aa034042aed6801f3e (diff) |
[media] radio-shark2: Add support for suspend & resume
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/radio/radio-shark2.c | 39 | ||||
-rw-r--r-- | drivers/media/radio/radio-tea5777.c | 2 | ||||
-rw-r--r-- | drivers/media/radio/radio-tea5777.h | 1 |
3 files changed, 41 insertions, 1 deletions
diff --git a/drivers/media/radio/radio-shark2.c b/drivers/media/radio/radio-shark2.c index 7c730a0277ab..9740c760b73c 100644 --- a/drivers/media/radio/radio-shark2.c +++ b/drivers/media/radio/radio-shark2.c | |||
@@ -209,6 +209,7 @@ static int shark_register_leds(struct shark_device *shark, struct device *dev) | |||
209 | { | 209 | { |
210 | int i, retval; | 210 | int i, retval; |
211 | 211 | ||
212 | atomic_set(&shark->brightness[BLUE_LED], 127); | ||
212 | INIT_WORK(&shark->led_work, shark_led_work); | 213 | INIT_WORK(&shark->led_work, shark_led_work); |
213 | for (i = 0; i < NO_LEDS; i++) { | 214 | for (i = 0; i < NO_LEDS; i++) { |
214 | shark->leds[i] = shark_led_templates[i]; | 215 | shark->leds[i] = shark_led_templates[i]; |
@@ -235,6 +236,16 @@ static void shark_unregister_leds(struct shark_device *shark) | |||
235 | 236 | ||
236 | cancel_work_sync(&shark->led_work); | 237 | cancel_work_sync(&shark->led_work); |
237 | } | 238 | } |
239 | |||
240 | static void shark_resume_leds(struct shark_device *shark) | ||
241 | { | ||
242 | int i; | ||
243 | |||
244 | for (i = 0; i < NO_LEDS; i++) | ||
245 | set_bit(i, &shark->brightness_new); | ||
246 | |||
247 | schedule_work(&shark->led_work); | ||
248 | } | ||
238 | #else | 249 | #else |
239 | static int shark_register_leds(struct shark_device *shark, struct device *dev) | 250 | static int shark_register_leds(struct shark_device *shark, struct device *dev) |
240 | { | 251 | { |
@@ -243,6 +254,7 @@ static int shark_register_leds(struct shark_device *shark, struct device *dev) | |||
243 | return 0; | 254 | return 0; |
244 | } | 255 | } |
245 | static inline void shark_unregister_leds(struct shark_device *shark) { } | 256 | static inline void shark_unregister_leds(struct shark_device *shark) { } |
257 | static inline void shark_resume_leds(struct shark_device *shark) { } | ||
246 | #endif | 258 | #endif |
247 | 259 | ||
248 | static void usb_shark_disconnect(struct usb_interface *intf) | 260 | static void usb_shark_disconnect(struct usb_interface *intf) |
@@ -327,6 +339,28 @@ err_alloc_buffer: | |||
327 | return retval; | 339 | return retval; |
328 | } | 340 | } |
329 | 341 | ||
342 | #ifdef CONFIG_PM | ||
343 | int usb_shark_suspend(struct usb_interface *intf, pm_message_t message) | ||
344 | { | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | int usb_shark_resume(struct usb_interface *intf) | ||
349 | { | ||
350 | struct v4l2_device *v4l2_dev = usb_get_intfdata(intf); | ||
351 | struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); | ||
352 | int ret; | ||
353 | |||
354 | mutex_lock(&shark->tea.mutex); | ||
355 | ret = radio_tea5777_set_freq(&shark->tea); | ||
356 | mutex_unlock(&shark->tea.mutex); | ||
357 | |||
358 | shark_resume_leds(shark); | ||
359 | |||
360 | return ret; | ||
361 | } | ||
362 | #endif | ||
363 | |||
330 | /* Specify the bcdDevice value, as the radioSHARK and radioSHARK2 share ids */ | 364 | /* Specify the bcdDevice value, as the radioSHARK and radioSHARK2 share ids */ |
331 | static struct usb_device_id usb_shark_device_table[] = { | 365 | static struct usb_device_id usb_shark_device_table[] = { |
332 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION | | 366 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION | |
@@ -346,5 +380,10 @@ static struct usb_driver usb_shark_driver = { | |||
346 | .probe = usb_shark_probe, | 380 | .probe = usb_shark_probe, |
347 | .disconnect = usb_shark_disconnect, | 381 | .disconnect = usb_shark_disconnect, |
348 | .id_table = usb_shark_device_table, | 382 | .id_table = usb_shark_device_table, |
383 | #ifdef CONFIG_PM | ||
384 | .suspend = usb_shark_suspend, | ||
385 | .resume = usb_shark_resume, | ||
386 | .reset_resume = usb_shark_resume, | ||
387 | #endif | ||
349 | }; | 388 | }; |
350 | module_usb_driver(usb_shark_driver); | 389 | module_usb_driver(usb_shark_driver); |
diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c index 818e57c20086..ef8289829794 100644 --- a/drivers/media/radio/radio-tea5777.c +++ b/drivers/media/radio/radio-tea5777.c | |||
@@ -184,7 +184,7 @@ static u32 tea5777_freq_to_v4l2_freq(struct radio_tea5777 *tea, u32 freq) | |||
184 | return 0; /* Never reached */ | 184 | return 0; /* Never reached */ |
185 | } | 185 | } |
186 | 186 | ||
187 | static int radio_tea5777_set_freq(struct radio_tea5777 *tea) | 187 | int radio_tea5777_set_freq(struct radio_tea5777 *tea) |
188 | { | 188 | { |
189 | u32 freq; | 189 | u32 freq; |
190 | int res; | 190 | int res; |
diff --git a/drivers/media/radio/radio-tea5777.h b/drivers/media/radio/radio-tea5777.h index ffbae9ca84eb..4ea43a90a151 100644 --- a/drivers/media/radio/radio-tea5777.h +++ b/drivers/media/radio/radio-tea5777.h | |||
@@ -85,5 +85,6 @@ struct radio_tea5777 { | |||
85 | 85 | ||
86 | int radio_tea5777_init(struct radio_tea5777 *tea, struct module *owner); | 86 | int radio_tea5777_init(struct radio_tea5777 *tea, struct module *owner); |
87 | void radio_tea5777_exit(struct radio_tea5777 *tea); | 87 | void radio_tea5777_exit(struct radio_tea5777 *tea); |
88 | int radio_tea5777_set_freq(struct radio_tea5777 *tea); | ||
88 | 89 | ||
89 | #endif /* __RADIO_TEA5777_H */ | 90 | #endif /* __RADIO_TEA5777_H */ |