common.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Samsung S5P/EXYNOS4 SoC Camera Subsystem driver
  3. *
  4. * Copyright (C) 2013 Samsung Electronics Co., Ltd.
  5. * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/module.h>
  12. #include <media/drv-intf/exynos-fimc.h>
  13. #include "common.h"
  14. /* Called with the media graph mutex held or entity->stream_count > 0. */
  15. struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
  16. {
  17. struct media_pad *pad = &entity->pads[0];
  18. struct v4l2_subdev *sd;
  19. while (pad->flags & MEDIA_PAD_FL_SINK) {
  20. /* source pad */
  21. pad = media_entity_remote_pad(pad);
  22. if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
  23. break;
  24. sd = media_entity_to_v4l2_subdev(pad->entity);
  25. if (sd->grp_id == GRP_ID_FIMC_IS_SENSOR ||
  26. sd->grp_id == GRP_ID_SENSOR)
  27. return sd;
  28. /* sink pad */
  29. pad = &sd->entity.pads[0];
  30. }
  31. return NULL;
  32. }
  33. EXPORT_SYMBOL(fimc_find_remote_sensor);
  34. void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap,
  35. unsigned int caps)
  36. {
  37. strlcpy(cap->driver, dev->driver->name, sizeof(cap->driver));
  38. strlcpy(cap->card, dev->driver->name, sizeof(cap->card));
  39. snprintf(cap->bus_info, sizeof(cap->bus_info),
  40. "platform:%s", dev_name(dev));
  41. cap->device_caps = caps;
  42. cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
  43. }
  44. EXPORT_SYMBOL(__fimc_vidioc_querycap);
  45. MODULE_LICENSE("GPL");