aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-keene.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/radio/radio-keene.c')
-rw-r--r--drivers/media/radio/radio-keene.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/media/radio/radio-keene.c b/drivers/media/radio/radio-keene.c
index 55bd1d2937c8..79adf3e654e5 100644
--- a/drivers/media/radio/radio-keene.c
+++ b/drivers/media/radio/radio-keene.c
@@ -28,7 +28,6 @@
28#include <media/v4l2-ctrls.h> 28#include <media/v4l2-ctrls.h>
29#include <media/v4l2-event.h> 29#include <media/v4l2-event.h>
30#include <linux/usb.h> 30#include <linux/usb.h>
31#include <linux/version.h>
32#include <linux/mutex.h> 31#include <linux/mutex.h>
33 32
34/* driver and module definitions */ 33/* driver and module definitions */
@@ -149,7 +148,6 @@ static void usb_keene_disconnect(struct usb_interface *intf)
149{ 148{
150 struct keene_device *radio = to_keene_dev(usb_get_intfdata(intf)); 149 struct keene_device *radio = to_keene_dev(usb_get_intfdata(intf));
151 150
152 v4l2_device_get(&radio->v4l2_dev);
153 mutex_lock(&radio->lock); 151 mutex_lock(&radio->lock);
154 usb_set_intfdata(intf, NULL); 152 usb_set_intfdata(intf, NULL);
155 video_unregister_device(&radio->vdev); 153 video_unregister_device(&radio->vdev);
@@ -158,6 +156,23 @@ static void usb_keene_disconnect(struct usb_interface *intf)
158 v4l2_device_put(&radio->v4l2_dev); 156 v4l2_device_put(&radio->v4l2_dev);
159} 157}
160 158
159static int usb_keene_suspend(struct usb_interface *intf, pm_message_t message)
160{
161 struct keene_device *radio = to_keene_dev(usb_get_intfdata(intf));
162
163 return keene_cmd_main(radio, 0, false);
164}
165
166static int usb_keene_resume(struct usb_interface *intf)
167{
168 struct keene_device *radio = to_keene_dev(usb_get_intfdata(intf));
169
170 mdelay(50);
171 keene_cmd_set(radio);
172 keene_cmd_main(radio, radio->curfreq, true);
173 return 0;
174}
175
161static int vidioc_querycap(struct file *file, void *priv, 176static int vidioc_querycap(struct file *file, void *priv,
162 struct v4l2_capability *v) 177 struct v4l2_capability *v)
163{ 178{
@@ -256,18 +271,6 @@ static int keene_s_ctrl(struct v4l2_ctrl *ctrl)
256 return -EINVAL; 271 return -EINVAL;
257} 272}
258 273
259static int vidioc_subscribe_event(struct v4l2_fh *fh,
260 struct v4l2_event_subscription *sub)
261{
262 switch (sub->type) {
263 case V4L2_EVENT_CTRL:
264 return v4l2_event_subscribe(fh, sub, 0);
265 default:
266 return -EINVAL;
267 }
268}
269
270
271/* File system interface */ 274/* File system interface */
272static const struct v4l2_file_operations usb_keene_fops = { 275static const struct v4l2_file_operations usb_keene_fops = {
273 .owner = THIS_MODULE, 276 .owner = THIS_MODULE,
@@ -288,7 +291,7 @@ static const struct v4l2_ioctl_ops usb_keene_ioctl_ops = {
288 .vidioc_g_frequency = vidioc_g_frequency, 291 .vidioc_g_frequency = vidioc_g_frequency,
289 .vidioc_s_frequency = vidioc_s_frequency, 292 .vidioc_s_frequency = vidioc_s_frequency,
290 .vidioc_log_status = v4l2_ctrl_log_status, 293 .vidioc_log_status = v4l2_ctrl_log_status,
291 .vidioc_subscribe_event = vidioc_subscribe_event, 294 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
292 .vidioc_unsubscribe_event = v4l2_event_unsubscribe, 295 .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
293}; 296};
294 297
@@ -404,6 +407,9 @@ static struct usb_driver usb_keene_driver = {
404 .probe = usb_keene_probe, 407 .probe = usb_keene_probe,
405 .disconnect = usb_keene_disconnect, 408 .disconnect = usb_keene_disconnect,
406 .id_table = usb_keene_device_table, 409 .id_table = usb_keene_device_table,
410 .suspend = usb_keene_suspend,
411 .resume = usb_keene_resume,
412 .reset_resume = usb_keene_resume,
407}; 413};
408 414
409static int __init keene_init(void) 415static int __init keene_init(void)