Lines Matching refs:radio
70 static int keene_cmd_main(struct keene_device *radio, unsigned freq, bool play) in keene_cmd_main() argument
75 radio->buffer[0] = 0x00; in keene_cmd_main()
76 radio->buffer[1] = 0x50; in keene_cmd_main()
77 radio->buffer[2] = (freq_send >> 8) & 0xff; in keene_cmd_main()
78 radio->buffer[3] = freq_send & 0xff; in keene_cmd_main()
79 radio->buffer[4] = radio->pa; in keene_cmd_main()
85 radio->buffer[5] = (radio->muted ? 4 : 8) | (play ? 1 : 2) | in keene_cmd_main()
87 radio->buffer[6] = 0x00; in keene_cmd_main()
88 radio->buffer[7] = 0x00; in keene_cmd_main()
90 ret = usb_control_msg(radio->usbdev, usb_sndctrlpipe(radio->usbdev, 0), in keene_cmd_main()
91 9, 0x21, 0x200, 2, radio->buffer, BUFFER_LENGTH, USB_TIMEOUT); in keene_cmd_main()
94 dev_warn(&radio->vdev.dev, "%s failed (%d)\n", __func__, ret); in keene_cmd_main()
98 radio->curfreq = freq; in keene_cmd_main()
103 static int keene_cmd_set(struct keene_device *radio) in keene_cmd_set() argument
107 radio->buffer[0] = 0x00; in keene_cmd_set()
108 radio->buffer[1] = 0x51; in keene_cmd_set()
109 radio->buffer[2] = radio->tx; in keene_cmd_set()
113 radio->buffer[3] = (radio->stereo ? 0 : 1) | (radio->preemph_75_us ? 4 : 0); in keene_cmd_set()
114 radio->buffer[4] = 0x00; in keene_cmd_set()
115 radio->buffer[5] = 0x00; in keene_cmd_set()
116 radio->buffer[6] = 0x00; in keene_cmd_set()
117 radio->buffer[7] = 0x00; in keene_cmd_set()
119 ret = usb_control_msg(radio->usbdev, usb_sndctrlpipe(radio->usbdev, 0), in keene_cmd_set()
120 9, 0x21, 0x200, 2, radio->buffer, BUFFER_LENGTH, USB_TIMEOUT); in keene_cmd_set()
123 dev_warn(&radio->vdev.dev, "%s failed (%d)\n", __func__, ret); in keene_cmd_set()
136 struct keene_device *radio = to_keene_dev(usb_get_intfdata(intf)); in usb_keene_disconnect() local
138 mutex_lock(&radio->lock); in usb_keene_disconnect()
140 video_unregister_device(&radio->vdev); in usb_keene_disconnect()
141 v4l2_device_disconnect(&radio->v4l2_dev); in usb_keene_disconnect()
142 mutex_unlock(&radio->lock); in usb_keene_disconnect()
143 v4l2_device_put(&radio->v4l2_dev); in usb_keene_disconnect()
148 struct keene_device *radio = to_keene_dev(usb_get_intfdata(intf)); in usb_keene_suspend() local
150 return keene_cmd_main(radio, 0, false); in usb_keene_suspend()
155 struct keene_device *radio = to_keene_dev(usb_get_intfdata(intf)); in usb_keene_resume() local
158 keene_cmd_set(radio); in usb_keene_resume()
159 keene_cmd_main(radio, radio->curfreq, true); in usb_keene_resume()
166 struct keene_device *radio = video_drvdata(file); in vidioc_querycap() local
170 usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info)); in vidioc_querycap()
177 struct keene_device *radio = video_drvdata(file); in vidioc_g_modulator() local
185 v->txsubchans = radio->stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; in vidioc_g_modulator()
193 struct keene_device *radio = video_drvdata(file); in vidioc_s_modulator() local
198 radio->stereo = (v->txsubchans == V4L2_TUNER_SUB_STEREO); in vidioc_s_modulator()
199 return keene_cmd_set(radio); in vidioc_s_modulator()
205 struct keene_device *radio = video_drvdata(file); in vidioc_s_frequency() local
211 return keene_cmd_main(radio, freq, true); in vidioc_s_frequency()
217 struct keene_device *radio = video_drvdata(file); in vidioc_g_frequency() local
222 f->frequency = radio->curfreq; in vidioc_g_frequency()
234 struct keene_device *radio = in keene_s_ctrl() local
239 radio->muted = ctrl->val; in keene_s_ctrl()
240 return keene_cmd_main(radio, 0, true); in keene_s_ctrl()
245 radio->pa = (ctrl->val - 71) * 100 / 62; in keene_s_ctrl()
246 return keene_cmd_main(radio, 0, true); in keene_s_ctrl()
249 radio->preemph_75_us = ctrl->val == V4L2_PREEMPHASIS_75_uS; in keene_s_ctrl()
250 return keene_cmd_set(radio); in keene_s_ctrl()
253 radio->tx = db2tx[(ctrl->val - (s32)ctrl->minimum) / (s32)ctrl->step]; in keene_s_ctrl()
254 return keene_cmd_set(radio); in keene_s_ctrl()
285 struct keene_device *radio = to_keene_dev(v4l2_dev); in usb_keene_video_device_release() local
288 v4l2_ctrl_handler_free(&radio->hdl); in usb_keene_video_device_release()
289 kfree(radio->buffer); in usb_keene_video_device_release()
290 kfree(radio); in usb_keene_video_device_release()
298 struct keene_device *radio; in usb_keene_probe() local
314 radio = kzalloc(sizeof(struct keene_device), GFP_KERNEL); in usb_keene_probe()
315 if (radio) in usb_keene_probe()
316 radio->buffer = kmalloc(BUFFER_LENGTH, GFP_KERNEL); in usb_keene_probe()
318 if (!radio || !radio->buffer) { in usb_keene_probe()
320 kfree(radio); in usb_keene_probe()
325 hdl = &radio->hdl; in usb_keene_probe()
335 radio->pa = 118; in usb_keene_probe()
336 radio->tx = 0x32; in usb_keene_probe()
337 radio->stereo = true; in usb_keene_probe()
344 retval = v4l2_device_register(&intf->dev, &radio->v4l2_dev); in usb_keene_probe()
350 mutex_init(&radio->lock); in usb_keene_probe()
352 radio->v4l2_dev.ctrl_handler = hdl; in usb_keene_probe()
353 radio->v4l2_dev.release = usb_keene_video_device_release; in usb_keene_probe()
354 strscpy(radio->vdev.name, radio->v4l2_dev.name, in usb_keene_probe()
355 sizeof(radio->vdev.name)); in usb_keene_probe()
356 radio->vdev.v4l2_dev = &radio->v4l2_dev; in usb_keene_probe()
357 radio->vdev.fops = &usb_keene_fops; in usb_keene_probe()
358 radio->vdev.ioctl_ops = &usb_keene_ioctl_ops; in usb_keene_probe()
359 radio->vdev.lock = &radio->lock; in usb_keene_probe()
360 radio->vdev.release = video_device_release_empty; in usb_keene_probe()
361 radio->vdev.vfl_dir = VFL_DIR_TX; in usb_keene_probe()
362 radio->vdev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_MODULATOR; in usb_keene_probe()
364 radio->usbdev = interface_to_usbdev(intf); in usb_keene_probe()
365 radio->intf = intf; in usb_keene_probe()
366 usb_set_intfdata(intf, &radio->v4l2_dev); in usb_keene_probe()
368 video_set_drvdata(&radio->vdev, radio); in usb_keene_probe()
372 keene_cmd_main(radio, 95.16 * FREQ_MUL, false); in usb_keene_probe()
374 retval = video_register_device(&radio->vdev, VFL_TYPE_RADIO, -1); in usb_keene_probe()
381 video_device_node_name(&radio->vdev)); in usb_keene_probe()
385 v4l2_device_unregister(&radio->v4l2_dev); in usb_keene_probe()
387 kfree(radio->buffer); in usb_keene_probe()
388 kfree(radio); in usb_keene_probe()