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/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 == NULL ||
  23. media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
  24. break;
  25. sd = media_entity_to_v4l2_subdev(pad->entity);
  26. if (sd->grp_id == GRP_ID_FIMC_IS_SENSOR ||
  27. sd->grp_id == GRP_ID_SENSOR)
  28. return sd;
  29. /* sink pad */
  30. pad = &sd->entity.pads[0];
  31. }
  32. return NULL;
  33. }
  34. EXPORT_SYMBOL(fimc_find_remote_sensor);
  35. void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap,
  36. unsigned int caps)
  37. {
  38. strlcpy(cap->driver, dev->driver->name, sizeof(cap->driver));
  39. strlcpy(cap->card, dev->driver->name, sizeof(cap->card));
  40. snprintf(cap->bus_info, sizeof(cap->bus_info),
  41. "platform:%s", dev_name(dev));
  42. cap->device_caps = caps;
  43. cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
  44. }
  45. EXPORT_SYMBOL(__fimc_vidioc_querycap);
  46. MODULE_LICENSE("GPL");