Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Hans de Goede and committed by
Mauro Carvalho Chehab
d1f280d6 d7aab0bf

+41 -1
+39
drivers/media/radio/radio-shark2.c
··· 209 209 { 210 210 int i, retval; 211 211 212 + atomic_set(&shark->brightness[BLUE_LED], 127); 212 213 INIT_WORK(&shark->led_work, shark_led_work); 213 214 for (i = 0; i < NO_LEDS; i++) { 214 215 shark->leds[i] = shark_led_templates[i]; ··· 236 235 237 236 cancel_work_sync(&shark->led_work); 238 237 } 238 + 239 + static void shark_resume_leds(struct shark_device *shark) 240 + { 241 + int i; 242 + 243 + for (i = 0; i < NO_LEDS; i++) 244 + set_bit(i, &shark->brightness_new); 245 + 246 + schedule_work(&shark->led_work); 247 + } 239 248 #else 240 249 static int shark_register_leds(struct shark_device *shark, struct device *dev) 241 250 { ··· 254 243 return 0; 255 244 } 256 245 static inline void shark_unregister_leds(struct shark_device *shark) { } 246 + static inline void shark_resume_leds(struct shark_device *shark) { } 257 247 #endif 258 248 259 249 static void usb_shark_disconnect(struct usb_interface *intf) ··· 339 327 return retval; 340 328 } 341 329 330 + #ifdef CONFIG_PM 331 + int usb_shark_suspend(struct usb_interface *intf, pm_message_t message) 332 + { 333 + return 0; 334 + } 335 + 336 + int usb_shark_resume(struct usb_interface *intf) 337 + { 338 + struct v4l2_device *v4l2_dev = usb_get_intfdata(intf); 339 + struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); 340 + int ret; 341 + 342 + mutex_lock(&shark->tea.mutex); 343 + ret = radio_tea5777_set_freq(&shark->tea); 344 + mutex_unlock(&shark->tea.mutex); 345 + 346 + shark_resume_leds(shark); 347 + 348 + return ret; 349 + } 350 + #endif 351 + 342 352 /* Specify the bcdDevice value, as the radioSHARK and radioSHARK2 share ids */ 343 353 static struct usb_device_id usb_shark_device_table[] = { 344 354 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION | ··· 380 346 .probe = usb_shark_probe, 381 347 .disconnect = usb_shark_disconnect, 382 348 .id_table = usb_shark_device_table, 349 + #ifdef CONFIG_PM 350 + .suspend = usb_shark_suspend, 351 + .resume = usb_shark_resume, 352 + .reset_resume = usb_shark_resume, 353 + #endif 383 354 }; 384 355 module_usb_driver(usb_shark_driver);
+1 -1
drivers/media/radio/radio-tea5777.c
··· 184 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 189 u32 freq; 190 190 int res;
+1
drivers/media/radio/radio-tea5777.h
··· 85 85 86 86 int radio_tea5777_init(struct radio_tea5777 *tea, struct module *owner); 87 87 void radio_tea5777_exit(struct radio_tea5777 *tea); 88 + int radio_tea5777_set_freq(struct radio_tea5777 *tea); 88 89 89 90 #endif /* __RADIO_TEA5777_H */