• Home
  • Raw
  • Download

Lines Matching refs:vin

43 #define rvin_group_id_to_master(vin) ((vin) < 4 ? 0 : 4)  argument
67 static unsigned int rvin_group_get_mask(struct rvin_dev *vin, in rvin_group_get_mask() argument
74 for (route = vin->info->routes; route->mask; route++) { in rvin_group_get_mask()
75 if (route->vin == vin->id && in rvin_group_get_mask()
78 vin_dbg(vin, in rvin_group_get_mask()
80 route->vin, route->csi, route->channel); in rvin_group_get_mask()
122 struct rvin_dev *vin = NULL; in rvin_group_link_notify() local
147 vin = container_of(vdev, struct rvin_dev, vdev); in rvin_group_link_notify()
148 master_id = rvin_group_id_to_master(vin->id); in rvin_group_link_notify()
150 if (WARN_ON(!group->vin[master_id])) { in rvin_group_link_notify()
157 if (!group->vin[i]) in rvin_group_link_notify()
162 &group->vin[i]->vdev.entity.pads[0]); in rvin_group_link_notify()
169 mask &= rvin_group_get_mask(group->vin[i], csi_id, channel); in rvin_group_link_notify()
188 if (group->vin[i] && in rvin_group_link_notify()
189 group->vin[i]->parallel.subdev == sd) { in rvin_group_link_notify()
190 group->vin[i]->is_csi = false; in rvin_group_link_notify()
196 vin_err(vin, "Subdevice %s not registered to any VIN\n", in rvin_group_link_notify()
203 mask_new = mask & rvin_group_get_mask(vin, csi_id, channel); in rvin_group_link_notify()
204 vin_dbg(vin, "Try link change mask: 0x%x new: 0x%x\n", mask, mask_new); in rvin_group_link_notify()
212 ret = rvin_set_channel_routing(group->vin[master_id], __ffs(mask_new)); in rvin_group_link_notify()
216 vin->is_csi = true; in rvin_group_link_notify()
250 static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin) in rvin_group_init() argument
260 for_each_matching_node(np, vin->dev->driver->of_match_table) in rvin_group_init()
264 vin_dbg(vin, "found %u enabled VIN's in DT", group->count); in rvin_group_init()
266 mdev->dev = vin->dev; in rvin_group_init()
269 match = of_match_node(vin->dev->driver->of_match_table, in rvin_group_init()
270 vin->dev->of_node); in rvin_group_init()
298 static int rvin_group_get(struct rvin_dev *vin) in rvin_group_get() argument
305 ret = of_property_read_u32(vin->dev->of_node, "renesas,id", &id); in rvin_group_get()
307 vin_err(vin, "%pOF: No renesas,id property found\n", in rvin_group_get()
308 vin->dev->of_node); in rvin_group_get()
313 vin_err(vin, "%pOF: Invalid renesas,id '%u'\n", in rvin_group_get()
314 vin->dev->of_node, id); in rvin_group_get()
330 ret = rvin_group_init(group, vin); in rvin_group_get()
333 vin_err(vin, "Failed to initialize group\n"); in rvin_group_get()
346 if (group->vin[id]) { in rvin_group_get()
347 vin_err(vin, "Duplicate renesas,id property value %u\n", id); in rvin_group_get()
353 group->vin[id] = vin; in rvin_group_get()
355 vin->id = id; in rvin_group_get()
356 vin->group = group; in rvin_group_get()
357 vin->v4l2_dev.mdev = &group->mdev; in rvin_group_get()
367 static void rvin_group_put(struct rvin_dev *vin) in rvin_group_put() argument
369 struct rvin_group *group = vin->group; in rvin_group_put()
373 vin->group = NULL; in rvin_group_put()
374 vin->v4l2_dev.mdev = NULL; in rvin_group_put()
376 if (WARN_ON(group->vin[vin->id] != vin)) in rvin_group_put()
379 group->vin[vin->id] = NULL; in rvin_group_put()
392 struct rvin_dev *vin = in rvin_s_ctrl() local
397 rvin_set_alpha(vin, ctrl->val); in rvin_s_ctrl()
431 static int rvin_parallel_subdevice_attach(struct rvin_dev *vin, in rvin_parallel_subdevice_attach() argument
443 vin->parallel.source_pad = ret; in rvin_parallel_subdevice_attach()
446 vin->parallel.sink_pad = ret < 0 ? 0 : ret; in rvin_parallel_subdevice_attach()
448 if (vin->info->use_mc) { in rvin_parallel_subdevice_attach()
449 vin->parallel.subdev = subdev; in rvin_parallel_subdevice_attach()
454 vin->mbus_code = 0; in rvin_parallel_subdevice_attach()
456 code.pad = vin->parallel.source_pad; in rvin_parallel_subdevice_attach()
457 while (!vin->mbus_code && in rvin_parallel_subdevice_attach()
466 vin->mbus_code = code.code; in rvin_parallel_subdevice_attach()
467 vin_dbg(vin, "Found media bus format for %s: %d\n", in rvin_parallel_subdevice_attach()
468 subdev->name, vin->mbus_code); in rvin_parallel_subdevice_attach()
475 if (!vin->mbus_code) { in rvin_parallel_subdevice_attach()
476 vin_err(vin, "Unsupported media bus format for %s\n", in rvin_parallel_subdevice_attach()
482 ret = v4l2_subdev_call(subdev, video, g_tvnorms, &vin->vdev.tvnorms); in rvin_parallel_subdevice_attach()
487 vin->std = V4L2_STD_UNKNOWN; in rvin_parallel_subdevice_attach()
488 ret = v4l2_subdev_call(subdev, video, g_std, &vin->std); in rvin_parallel_subdevice_attach()
493 ret = v4l2_ctrl_handler_init(&vin->ctrl_handler, 16); in rvin_parallel_subdevice_attach()
497 v4l2_ctrl_new_std(&vin->ctrl_handler, &rvin_ctrl_ops, in rvin_parallel_subdevice_attach()
500 if (vin->ctrl_handler.error) { in rvin_parallel_subdevice_attach()
501 ret = vin->ctrl_handler.error; in rvin_parallel_subdevice_attach()
502 v4l2_ctrl_handler_free(&vin->ctrl_handler); in rvin_parallel_subdevice_attach()
506 ret = v4l2_ctrl_add_handler(&vin->ctrl_handler, subdev->ctrl_handler, in rvin_parallel_subdevice_attach()
509 v4l2_ctrl_handler_free(&vin->ctrl_handler); in rvin_parallel_subdevice_attach()
513 vin->vdev.ctrl_handler = &vin->ctrl_handler; in rvin_parallel_subdevice_attach()
515 vin->parallel.subdev = subdev; in rvin_parallel_subdevice_attach()
520 static void rvin_parallel_subdevice_detach(struct rvin_dev *vin) in rvin_parallel_subdevice_detach() argument
522 rvin_v4l2_unregister(vin); in rvin_parallel_subdevice_detach()
523 vin->parallel.subdev = NULL; in rvin_parallel_subdevice_detach()
525 if (!vin->info->use_mc) { in rvin_parallel_subdevice_detach()
526 v4l2_ctrl_handler_free(&vin->ctrl_handler); in rvin_parallel_subdevice_detach()
527 vin->vdev.ctrl_handler = NULL; in rvin_parallel_subdevice_detach()
533 struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); in rvin_parallel_notify_complete() local
538 ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); in rvin_parallel_notify_complete()
540 vin_err(vin, "Failed to register subdev nodes\n"); in rvin_parallel_notify_complete()
544 if (!video_is_registered(&vin->vdev)) { in rvin_parallel_notify_complete()
545 ret = rvin_v4l2_register(vin); in rvin_parallel_notify_complete()
550 if (!vin->info->use_mc) in rvin_parallel_notify_complete()
554 source = &vin->parallel.subdev->entity; in rvin_parallel_notify_complete()
555 sink = &vin->vdev.entity; in rvin_parallel_notify_complete()
557 ret = media_create_pad_link(source, vin->parallel.source_pad, in rvin_parallel_notify_complete()
558 sink, vin->parallel.sink_pad, 0); in rvin_parallel_notify_complete()
560 vin_err(vin, "Error adding link from %s to %s: %d\n", in rvin_parallel_notify_complete()
570 struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); in rvin_parallel_notify_unbind() local
572 vin_dbg(vin, "unbind parallel subdev %s\n", subdev->name); in rvin_parallel_notify_unbind()
574 mutex_lock(&vin->lock); in rvin_parallel_notify_unbind()
575 rvin_parallel_subdevice_detach(vin); in rvin_parallel_notify_unbind()
576 mutex_unlock(&vin->lock); in rvin_parallel_notify_unbind()
583 struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); in rvin_parallel_notify_bound() local
586 mutex_lock(&vin->lock); in rvin_parallel_notify_bound()
587 ret = rvin_parallel_subdevice_attach(vin, subdev); in rvin_parallel_notify_bound()
588 mutex_unlock(&vin->lock); in rvin_parallel_notify_bound()
592 v4l2_set_subdev_hostdata(subdev, vin); in rvin_parallel_notify_bound()
594 vin_dbg(vin, "bound subdev %s source pad: %u sink pad: %u\n", in rvin_parallel_notify_bound()
595 subdev->name, vin->parallel.source_pad, in rvin_parallel_notify_bound()
596 vin->parallel.sink_pad); in rvin_parallel_notify_bound()
607 static int rvin_parallel_parse_of(struct rvin_dev *vin) in rvin_parallel_parse_of() argument
616 ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), 0, 0, 0); in rvin_parallel_parse_of()
624 vin_err(vin, "Failed to parse %pOF\n", to_of_node(fwnode)); in rvin_parallel_parse_of()
632 vin_dbg(vin, "Found %s media bus\n", in rvin_parallel_parse_of()
635 vin->parallel.mbus_type = vep.bus_type; in rvin_parallel_parse_of()
636 vin->parallel.bus = vep.bus.parallel; in rvin_parallel_parse_of()
639 vin_err(vin, "Unknown media bus type\n"); in rvin_parallel_parse_of()
644 asd = v4l2_async_notifier_add_fwnode_subdev(&vin->notifier, fwnode, in rvin_parallel_parse_of()
651 vin->parallel.asd = asd; in rvin_parallel_parse_of()
653 vin_dbg(vin, "Add parallel OF device %pOF\n", to_of_node(fwnode)); in rvin_parallel_parse_of()
660 static int rvin_parallel_init(struct rvin_dev *vin) in rvin_parallel_init() argument
664 v4l2_async_notifier_init(&vin->notifier); in rvin_parallel_init()
666 ret = rvin_parallel_parse_of(vin); in rvin_parallel_init()
671 if (!vin->parallel.asd) in rvin_parallel_init()
672 return vin->info->use_mc ? 0 : -ENODEV; in rvin_parallel_init()
674 vin_dbg(vin, "Found parallel subdevice %pOF\n", in rvin_parallel_init()
675 to_of_node(vin->parallel.asd->match.fwnode)); in rvin_parallel_init()
677 vin->notifier.ops = &rvin_parallel_notify_ops; in rvin_parallel_init()
678 ret = v4l2_async_notifier_register(&vin->v4l2_dev, &vin->notifier); in rvin_parallel_init()
680 vin_err(vin, "Notifier registration failed\n"); in rvin_parallel_init()
681 v4l2_async_notifier_cleanup(&vin->notifier); in rvin_parallel_init()
694 struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); in rvin_group_notify_complete() local
699 ret = media_device_register(&vin->group->mdev); in rvin_group_notify_complete()
703 ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); in rvin_group_notify_complete()
705 vin_err(vin, "Failed to register subdev nodes\n"); in rvin_group_notify_complete()
711 if (vin->group->vin[i] && in rvin_group_notify_complete()
712 !video_is_registered(&vin->group->vin[i]->vdev)) { in rvin_group_notify_complete()
713 ret = rvin_v4l2_register(vin->group->vin[i]); in rvin_group_notify_complete()
720 mutex_lock(&vin->group->lock); in rvin_group_notify_complete()
721 for (route = vin->info->routes; route->mask; route++) { in rvin_group_notify_complete()
727 if (!vin->group->vin[route->vin]) in rvin_group_notify_complete()
731 if (!vin->group->vin[rvin_group_id_to_master(route->vin)]) in rvin_group_notify_complete()
735 if (!vin->group->csi[route->csi].subdev) in rvin_group_notify_complete()
738 source = &vin->group->csi[route->csi].subdev->entity; in rvin_group_notify_complete()
742 sink = &vin->group->vin[route->vin]->vdev.entity; in rvin_group_notify_complete()
751 vin_err(vin, "Error adding link from %s to %s\n", in rvin_group_notify_complete()
756 mutex_unlock(&vin->group->lock); in rvin_group_notify_complete()
765 struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); in rvin_group_notify_unbind() local
769 if (vin->group->vin[i]) in rvin_group_notify_unbind()
770 rvin_v4l2_unregister(vin->group->vin[i]); in rvin_group_notify_unbind()
772 mutex_lock(&vin->group->lock); in rvin_group_notify_unbind()
775 if (vin->group->csi[i].asd != asd) in rvin_group_notify_unbind()
777 vin->group->csi[i].subdev = NULL; in rvin_group_notify_unbind()
778 vin_dbg(vin, "Unbind CSI-2 %s from slot %u\n", subdev->name, i); in rvin_group_notify_unbind()
782 mutex_unlock(&vin->group->lock); in rvin_group_notify_unbind()
784 media_device_unregister(&vin->group->mdev); in rvin_group_notify_unbind()
791 struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); in rvin_group_notify_bound() local
794 mutex_lock(&vin->group->lock); in rvin_group_notify_bound()
797 if (vin->group->csi[i].asd != asd) in rvin_group_notify_bound()
799 vin->group->csi[i].subdev = subdev; in rvin_group_notify_bound()
800 vin_dbg(vin, "Bound CSI-2 %s to slot %u\n", subdev->name, i); in rvin_group_notify_bound()
804 mutex_unlock(&vin->group->lock); in rvin_group_notify_bound()
815 static int rvin_mc_parse_of(struct rvin_dev *vin, unsigned int id) in rvin_mc_parse_of() argument
824 ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), 1, id, 0); in rvin_mc_parse_of()
832 vin_err(vin, "Failed to parse %pOF\n", to_of_node(fwnode)); in rvin_mc_parse_of()
838 vin_dbg(vin, "OF device %pOF disabled, ignoring\n", in rvin_mc_parse_of()
844 asd = v4l2_async_notifier_add_fwnode_subdev(&vin->group->notifier, in rvin_mc_parse_of()
852 vin->group->csi[vep.base.id].asd = asd; in rvin_mc_parse_of()
854 vin_dbg(vin, "Add group OF device %pOF to slot %u\n", in rvin_mc_parse_of()
862 static int rvin_mc_parse_of_graph(struct rvin_dev *vin) in rvin_mc_parse_of_graph() argument
868 mutex_lock(&vin->group->lock); in rvin_mc_parse_of_graph()
872 if (vin->group->vin[i]) { in rvin_mc_parse_of_graph()
878 if (vin->group->count != count) { in rvin_mc_parse_of_graph()
879 mutex_unlock(&vin->group->lock); in rvin_mc_parse_of_graph()
883 mutex_unlock(&vin->group->lock); in rvin_mc_parse_of_graph()
885 v4l2_async_notifier_init(&vin->group->notifier); in rvin_mc_parse_of_graph()
897 if (vin->group->csi[id].asd) in rvin_mc_parse_of_graph()
900 ret = rvin_mc_parse_of(vin->group->vin[i], id); in rvin_mc_parse_of_graph()
906 if (list_empty(&vin->group->notifier.asd_list)) in rvin_mc_parse_of_graph()
909 vin->group->notifier.ops = &rvin_group_notify_ops; in rvin_mc_parse_of_graph()
910 ret = v4l2_async_notifier_register(&vin->v4l2_dev, in rvin_mc_parse_of_graph()
911 &vin->group->notifier); in rvin_mc_parse_of_graph()
913 vin_err(vin, "Notifier registration failed\n"); in rvin_mc_parse_of_graph()
914 v4l2_async_notifier_cleanup(&vin->group->notifier); in rvin_mc_parse_of_graph()
921 static int rvin_mc_init(struct rvin_dev *vin) in rvin_mc_init() argument
925 vin->pad.flags = MEDIA_PAD_FL_SINK; in rvin_mc_init()
926 ret = media_entity_pads_init(&vin->vdev.entity, 1, &vin->pad); in rvin_mc_init()
930 ret = rvin_group_get(vin); in rvin_mc_init()
934 ret = rvin_mc_parse_of_graph(vin); in rvin_mc_init()
936 rvin_group_put(vin); in rvin_mc_init()
938 ret = v4l2_ctrl_handler_init(&vin->ctrl_handler, 1); in rvin_mc_init()
942 v4l2_ctrl_new_std(&vin->ctrl_handler, &rvin_ctrl_ops, in rvin_mc_init()
945 if (vin->ctrl_handler.error) { in rvin_mc_init()
946 ret = vin->ctrl_handler.error; in rvin_mc_init()
947 v4l2_ctrl_handler_free(&vin->ctrl_handler); in rvin_mc_init()
951 vin->vdev.ctrl_handler = &vin->ctrl_handler; in rvin_mc_init()
962 struct rvin_dev *vin = dev_get_drvdata(dev); in rvin_suspend() local
964 if (vin->state != RUNNING) in rvin_suspend()
967 rvin_stop_streaming(vin); in rvin_suspend()
969 vin->state = SUSPENDED; in rvin_suspend()
976 struct rvin_dev *vin = dev_get_drvdata(dev); in rvin_resume() local
978 if (vin->state != SUSPENDED) in rvin_resume()
988 if (vin->info->use_mc) { in rvin_resume()
989 unsigned int master_id = rvin_group_id_to_master(vin->id); in rvin_resume()
990 struct rvin_dev *master = vin->group->vin[master_id]; in rvin_resume()
1001 return rvin_start_streaming(vin); in rvin_resume()
1030 { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
1031 { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
1032 { .csi = RVIN_CSI40, .channel = 1, .vin = 0, .mask = BIT(2) },
1033 { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
1034 { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(1) | BIT(3) },
1035 { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
1036 { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
1037 { .csi = RVIN_CSI20, .channel = 1, .vin = 2, .mask = BIT(0) },
1038 { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
1039 { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
1040 { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
1041 { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
1042 { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
1043 { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) | BIT(2) },
1044 { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
1045 { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
1046 { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
1047 { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
1048 { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
1049 { .csi = RVIN_CSI20, .channel = 1, .vin = 6, .mask = BIT(0) },
1050 { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
1051 { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
1052 { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) | BIT(2) },
1053 { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
1066 { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
1067 { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
1068 { .csi = RVIN_CSI40, .channel = 1, .vin = 0, .mask = BIT(2) },
1069 { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
1070 { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(1) | BIT(3) },
1071 { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
1072 { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
1073 { .csi = RVIN_CSI20, .channel = 1, .vin = 2, .mask = BIT(0) },
1074 { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
1075 { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
1076 { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
1077 { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
1078 { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
1079 { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) | BIT(2) },
1080 { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
1081 { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
1082 { .csi = RVIN_CSI41, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
1083 { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
1084 { .csi = RVIN_CSI41, .channel = 1, .vin = 4, .mask = BIT(2) },
1085 { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
1086 { .csi = RVIN_CSI41, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
1087 { .csi = RVIN_CSI41, .channel = 0, .vin = 5, .mask = BIT(2) },
1088 { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
1089 { .csi = RVIN_CSI20, .channel = 1, .vin = 6, .mask = BIT(0) },
1090 { .csi = RVIN_CSI41, .channel = 0, .vin = 6, .mask = BIT(1) },
1091 { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
1092 { .csi = RVIN_CSI41, .channel = 2, .vin = 6, .mask = BIT(3) },
1093 { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
1094 { .csi = RVIN_CSI41, .channel = 1, .vin = 7, .mask = BIT(0) },
1095 { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) | BIT(2) },
1096 { .csi = RVIN_CSI41, .channel = 3, .vin = 7, .mask = BIT(3) },
1097 { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
1111 { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
1112 { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
1113 { .csi = RVIN_CSI21, .channel = 0, .vin = 0, .mask = BIT(2) | BIT(5) },
1114 { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
1115 { .csi = RVIN_CSI21, .channel = 0, .vin = 1, .mask = BIT(1) },
1116 { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
1117 { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(3) },
1118 { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
1119 { .csi = RVIN_CSI21, .channel = 1, .vin = 1, .mask = BIT(5) },
1120 { .csi = RVIN_CSI21, .channel = 0, .vin = 2, .mask = BIT(0) },
1121 { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
1122 { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
1123 { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
1124 { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
1125 { .csi = RVIN_CSI21, .channel = 2, .vin = 2, .mask = BIT(5) },
1126 { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
1127 { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) },
1128 { .csi = RVIN_CSI21, .channel = 1, .vin = 3, .mask = BIT(2) },
1129 { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
1130 { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
1131 { .csi = RVIN_CSI21, .channel = 3, .vin = 3, .mask = BIT(5) },
1132 { .csi = RVIN_CSI41, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
1133 { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
1134 { .csi = RVIN_CSI21, .channel = 0, .vin = 4, .mask = BIT(2) | BIT(5) },
1135 { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
1136 { .csi = RVIN_CSI21, .channel = 0, .vin = 5, .mask = BIT(1) },
1137 { .csi = RVIN_CSI41, .channel = 0, .vin = 5, .mask = BIT(2) },
1138 { .csi = RVIN_CSI41, .channel = 1, .vin = 5, .mask = BIT(3) },
1139 { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
1140 { .csi = RVIN_CSI21, .channel = 1, .vin = 5, .mask = BIT(5) },
1141 { .csi = RVIN_CSI21, .channel = 0, .vin = 6, .mask = BIT(0) },
1142 { .csi = RVIN_CSI41, .channel = 0, .vin = 6, .mask = BIT(1) },
1143 { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
1144 { .csi = RVIN_CSI41, .channel = 2, .vin = 6, .mask = BIT(3) },
1145 { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
1146 { .csi = RVIN_CSI21, .channel = 2, .vin = 6, .mask = BIT(5) },
1147 { .csi = RVIN_CSI41, .channel = 1, .vin = 7, .mask = BIT(0) },
1148 { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) },
1149 { .csi = RVIN_CSI21, .channel = 1, .vin = 7, .mask = BIT(2) },
1150 { .csi = RVIN_CSI41, .channel = 3, .vin = 7, .mask = BIT(3) },
1151 { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
1152 { .csi = RVIN_CSI21, .channel = 3, .vin = 7, .mask = BIT(5) },
1165 { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
1166 { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
1167 { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
1168 { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
1169 { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(3) },
1170 { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
1171 { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
1172 { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
1173 { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
1174 { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
1175 { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
1176 { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) },
1177 { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
1178 { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
1179 { .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
1180 { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
1181 { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
1182 { .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
1183 { .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(3) },
1184 { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
1185 { .csi = RVIN_CSI40, .channel = 0, .vin = 6, .mask = BIT(1) },
1186 { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
1187 { .csi = RVIN_CSI40, .channel = 2, .vin = 6, .mask = BIT(3) },
1188 { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
1189 { .csi = RVIN_CSI40, .channel = 1, .vin = 7, .mask = BIT(0) },
1190 { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) },
1191 { .csi = RVIN_CSI40, .channel = 3, .vin = 7, .mask = BIT(3) },
1192 { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
1206 { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
1207 { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
1208 { .csi = RVIN_CSI40, .channel = 1, .vin = 0, .mask = BIT(2) },
1209 { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
1210 { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(1) | BIT(3) },
1211 { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
1212 { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
1213 { .csi = RVIN_CSI20, .channel = 1, .vin = 2, .mask = BIT(0) },
1214 { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
1215 { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
1216 { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
1217 { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
1218 { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
1219 { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) | BIT(2) },
1220 { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
1221 { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
1222 { .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
1223 { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
1224 { .csi = RVIN_CSI40, .channel = 1, .vin = 4, .mask = BIT(2) },
1225 { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
1226 { .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
1227 { .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
1228 { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
1229 { .csi = RVIN_CSI20, .channel = 1, .vin = 6, .mask = BIT(0) },
1230 { .csi = RVIN_CSI40, .channel = 0, .vin = 6, .mask = BIT(1) },
1231 { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
1232 { .csi = RVIN_CSI40, .channel = 2, .vin = 6, .mask = BIT(3) },
1233 { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
1234 { .csi = RVIN_CSI40, .channel = 1, .vin = 7, .mask = BIT(0) },
1235 { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) | BIT(2) },
1236 { .csi = RVIN_CSI40, .channel = 3, .vin = 7, .mask = BIT(3) },
1237 { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
1251 { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
1252 { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
1253 { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(3) },
1254 { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
1255 { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
1256 { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
1257 { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
1270 { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
1271 { .csi = RVIN_CSI40, .channel = 1, .vin = 0, .mask = BIT(2) },
1272 { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
1273 { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(1) | BIT(3) },
1274 { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
1275 { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
1276 { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
1277 { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
1278 { .csi = RVIN_CSI41, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
1279 { .csi = RVIN_CSI41, .channel = 1, .vin = 4, .mask = BIT(2) },
1280 { .csi = RVIN_CSI41, .channel = 0, .vin = 5, .mask = BIT(2) },
1281 { .csi = RVIN_CSI41, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
1282 { .csi = RVIN_CSI41, .channel = 0, .vin = 6, .mask = BIT(1) },
1283 { .csi = RVIN_CSI41, .channel = 2, .vin = 6, .mask = BIT(3) },
1284 { .csi = RVIN_CSI41, .channel = 1, .vin = 7, .mask = BIT(0) },
1285 { .csi = RVIN_CSI41, .channel = 3, .vin = 7, .mask = BIT(3) },
1299 { .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
1300 { .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
1301 { .csi = RVIN_CSI40, .channel = 1, .vin = 4, .mask = BIT(2) },
1302 { .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
1404 struct rvin_dev *vin; in rcar_vin_probe() local
1407 vin = devm_kzalloc(&pdev->dev, sizeof(*vin), GFP_KERNEL); in rcar_vin_probe()
1408 if (!vin) in rcar_vin_probe()
1411 vin->dev = &pdev->dev; in rcar_vin_probe()
1412 vin->info = of_device_get_match_data(&pdev->dev); in rcar_vin_probe()
1413 vin->alpha = 0xff; in rcar_vin_probe()
1421 vin->info = attr->data; in rcar_vin_probe()
1423 vin->base = devm_platform_ioremap_resource(pdev, 0); in rcar_vin_probe()
1424 if (IS_ERR(vin->base)) in rcar_vin_probe()
1425 return PTR_ERR(vin->base); in rcar_vin_probe()
1431 ret = rvin_dma_register(vin, irq); in rcar_vin_probe()
1435 platform_set_drvdata(pdev, vin); in rcar_vin_probe()
1437 if (vin->info->use_mc) { in rcar_vin_probe()
1438 ret = rvin_mc_init(vin); in rcar_vin_probe()
1443 ret = rvin_parallel_init(vin); in rcar_vin_probe()
1453 v4l2_ctrl_handler_free(&vin->ctrl_handler); in rcar_vin_probe()
1455 if (vin->info->use_mc) { in rcar_vin_probe()
1456 mutex_lock(&vin->group->lock); in rcar_vin_probe()
1457 if (&vin->v4l2_dev == vin->group->notifier.v4l2_dev) { in rcar_vin_probe()
1458 v4l2_async_notifier_unregister(&vin->group->notifier); in rcar_vin_probe()
1459 v4l2_async_notifier_cleanup(&vin->group->notifier); in rcar_vin_probe()
1461 mutex_unlock(&vin->group->lock); in rcar_vin_probe()
1462 rvin_group_put(vin); in rcar_vin_probe()
1466 rvin_dma_unregister(vin); in rcar_vin_probe()
1473 struct rvin_dev *vin = platform_get_drvdata(pdev); in rcar_vin_remove() local
1477 rvin_v4l2_unregister(vin); in rcar_vin_remove()
1479 v4l2_async_notifier_unregister(&vin->notifier); in rcar_vin_remove()
1480 v4l2_async_notifier_cleanup(&vin->notifier); in rcar_vin_remove()
1482 if (vin->info->use_mc) { in rcar_vin_remove()
1483 v4l2_async_notifier_unregister(&vin->group->notifier); in rcar_vin_remove()
1484 v4l2_async_notifier_cleanup(&vin->group->notifier); in rcar_vin_remove()
1485 rvin_group_put(vin); in rcar_vin_remove()
1488 v4l2_ctrl_handler_free(&vin->ctrl_handler); in rcar_vin_remove()
1490 rvin_dma_unregister(vin); in rcar_vin_remove()