Lines Matching full:radio

68 	struct si4713_usb_device *radio = video_drvdata(file);  in vidioc_querycap()  local
70 strscpy(v->driver, "radio-usb-si4713", sizeof(v->driver)); in vidioc_querycap()
72 usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info)); in vidioc_querycap()
79 struct si4713_usb_device *radio = video_drvdata(file); in vidioc_g_modulator() local
81 return v4l2_subdev_call(radio->v4l2_subdev, tuner, g_modulator, vm); in vidioc_g_modulator()
87 struct si4713_usb_device *radio = video_drvdata(file); in vidioc_s_modulator() local
89 return v4l2_subdev_call(radio->v4l2_subdev, tuner, s_modulator, vm); in vidioc_s_modulator()
95 struct si4713_usb_device *radio = video_drvdata(file); in vidioc_s_frequency() local
97 return v4l2_subdev_call(radio->v4l2_subdev, tuner, s_frequency, vf); in vidioc_s_frequency()
103 struct si4713_usb_device *radio = video_drvdata(file); in vidioc_g_frequency() local
105 return v4l2_subdev_call(radio->v4l2_subdev, tuner, g_frequency, vf); in vidioc_g_frequency()
130 struct si4713_usb_device *radio = to_si4713_dev(v4l2_dev); in usb_si4713_video_device_release() local
131 struct i2c_adapter *adapter = &radio->i2c_adapter; in usb_si4713_video_device_release()
134 v4l2_device_unregister(&radio->v4l2_dev); in usb_si4713_video_device_release()
135 kfree(radio->buffer); in usb_si4713_video_device_release()
136 kfree(radio); in usb_si4713_video_device_release()
152 static int si4713_send_startup_command(struct si4713_usb_device *radio) in si4713_send_startup_command() argument
155 u8 *buffer = radio->buffer; in si4713_send_startup_command()
159 retval = usb_control_msg(radio->usbdev, usb_sndctrlpipe(radio->usbdev, 0), in si4713_send_startup_command()
160 0x09, 0x21, 0x033f, 0, radio->buffer, in si4713_send_startup_command()
167 retval = usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), in si4713_send_startup_command()
168 0x01, 0xa1, 0x033f, 0, radio->buffer, in si4713_send_startup_command()
172 if (!radio->buffer[1]) { in si4713_send_startup_command()
177 if (radio->buffer[2] == 0) in si4713_send_startup_command()
182 if (radio->buffer[2] & SI4713_CTS) in si4713_send_startup_command()
186 if ((radio->buffer[2] & SI4713_CTS) && radio->buffer[9] == 0x08) in si4713_send_startup_command()
240 static int si4713_start_seq(struct si4713_usb_device *radio) in si4713_start_seq() argument
245 radio->buffer[0] = 0x3f; in si4713_start_seq()
251 memcpy(radio->buffer + 1, payload, len); in si4713_start_seq()
252 memset(radio->buffer + len + 1, 0, BUFFER_LENGTH - 1 - len); in si4713_start_seq()
253 retval = si4713_send_startup_command(radio); in si4713_start_seq()
293 static int send_command(struct si4713_usb_device *radio, u8 *payload, char *data, int len) in send_command() argument
297 radio->buffer[0] = 0x3f; in send_command()
298 radio->buffer[1] = 0x06; in send_command()
300 memcpy(radio->buffer + 2, payload, 3); in send_command()
301 memcpy(radio->buffer + 5, data, len); in send_command()
302 memset(radio->buffer + 5 + len, 0, BUFFER_LENGTH - 5 - len); in send_command()
305 retval = usb_control_msg(radio->usbdev, usb_sndctrlpipe(radio->usbdev, 0), in send_command()
306 0x09, 0x21, 0x033f, 0, radio->buffer, in send_command()
312 static int si4713_i2c_read(struct si4713_usb_device *radio, char *data, int len) in si4713_i2c_read() argument
319 retval = usb_control_msg(radio->usbdev, in si4713_i2c_read()
320 usb_rcvctrlpipe(radio->usbdev, 0), in si4713_i2c_read()
321 0x01, 0xa1, 0x033f, 0, radio->buffer, in si4713_i2c_read()
333 if (radio->buffer[1] == 0 && (radio->buffer[2] & SI4713_CTS)) { in si4713_i2c_read()
334 memcpy(data, radio->buffer + 2, len); in si4713_i2c_read()
346 static int si4713_i2c_write(struct si4713_usb_device *radio, char *data, int len) in si4713_i2c_write() argument
356 retval = send_command(radio, command_table[i].payload, in si4713_i2c_write()
366 struct si4713_usb_device *radio = i2c_get_adapdata(i2c_adapter); in si4713_transfer() local
372 retval = si4713_i2c_read(radio, msgs[i].buf, msgs[i].len); in si4713_transfer()
374 retval = si4713_i2c_write(radio, msgs[i].buf, msgs[i].len); in si4713_transfer()
400 static int si4713_register_i2c_adapter(struct si4713_usb_device *radio) in si4713_register_i2c_adapter() argument
402 radio->i2c_adapter = si4713_i2c_adapter_template; in si4713_register_i2c_adapter()
404 radio->i2c_adapter.dev.parent = &radio->usbdev->dev; in si4713_register_i2c_adapter()
405 i2c_set_adapdata(&radio->i2c_adapter, radio); in si4713_register_i2c_adapter()
407 return i2c_add_adapter(&radio->i2c_adapter); in si4713_register_i2c_adapter()
414 struct si4713_usb_device *radio; in usb_si4713_probe() local
423 radio = kzalloc(sizeof(struct si4713_usb_device), GFP_KERNEL); in usb_si4713_probe()
424 if (radio) in usb_si4713_probe()
425 radio->buffer = kmalloc(BUFFER_LENGTH, GFP_KERNEL); in usb_si4713_probe()
427 if (!radio || !radio->buffer) { in usb_si4713_probe()
429 kfree(radio); in usb_si4713_probe()
433 mutex_init(&radio->lock); in usb_si4713_probe()
435 radio->usbdev = interface_to_usbdev(intf); in usb_si4713_probe()
436 radio->intf = intf; in usb_si4713_probe()
437 usb_set_intfdata(intf, &radio->v4l2_dev); in usb_si4713_probe()
439 retval = si4713_start_seq(radio); in usb_si4713_probe()
443 retval = v4l2_device_register(&intf->dev, &radio->v4l2_dev); in usb_si4713_probe()
449 retval = si4713_register_i2c_adapter(radio); in usb_si4713_probe()
455 adapter = &radio->i2c_adapter; in usb_si4713_probe()
456 sd = v4l2_i2c_new_subdev_board(&radio->v4l2_dev, adapter, in usb_si4713_probe()
458 radio->v4l2_subdev = sd; in usb_si4713_probe()
465 radio->vdev.ctrl_handler = sd->ctrl_handler; in usb_si4713_probe()
466 radio->v4l2_dev.release = usb_si4713_video_device_release; in usb_si4713_probe()
467 strscpy(radio->vdev.name, radio->v4l2_dev.name, in usb_si4713_probe()
468 sizeof(radio->vdev.name)); in usb_si4713_probe()
469 radio->vdev.v4l2_dev = &radio->v4l2_dev; in usb_si4713_probe()
470 radio->vdev.fops = &usb_si4713_fops; in usb_si4713_probe()
471 radio->vdev.ioctl_ops = &usb_si4713_ioctl_ops; in usb_si4713_probe()
472 radio->vdev.lock = &radio->lock; in usb_si4713_probe()
473 radio->vdev.release = video_device_release_empty; in usb_si4713_probe()
474 radio->vdev.vfl_dir = VFL_DIR_TX; in usb_si4713_probe()
475 radio->vdev.device_caps = V4L2_CAP_MODULATOR | V4L2_CAP_RDS_OUTPUT; in usb_si4713_probe()
477 video_set_drvdata(&radio->vdev, radio); in usb_si4713_probe()
479 retval = video_register_device(&radio->vdev, VFL_TYPE_RADIO, -1); in usb_si4713_probe()
486 video_device_node_name(&radio->vdev)); in usb_si4713_probe()
493 v4l2_device_unregister(&radio->v4l2_dev); in usb_si4713_probe()
495 kfree(radio->buffer); in usb_si4713_probe()
496 kfree(radio); in usb_si4713_probe()
502 struct si4713_usb_device *radio = to_si4713_dev(usb_get_intfdata(intf)); in usb_si4713_disconnect() local
506 mutex_lock(&radio->lock); in usb_si4713_disconnect()
508 video_unregister_device(&radio->vdev); in usb_si4713_disconnect()
509 v4l2_device_disconnect(&radio->v4l2_dev); in usb_si4713_disconnect()
510 mutex_unlock(&radio->lock); in usb_si4713_disconnect()
511 v4l2_device_put(&radio->v4l2_dev); in usb_si4713_disconnect()
516 .name = "radio-usb-si4713",