Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / drivers / media / platform / exynos4-is / common.c
blob944b224eb621c7c28e8dbd6d25fa499cfa353afa
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Samsung S5P/EXYNOS4 SoC Camera Subsystem driver
5 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
6 * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 */
9 #include <linux/module.h>
10 #include <media/drv-intf/exynos-fimc.h>
11 #include "common.h"
13 /* Called with the media graph mutex held or entity->stream_count > 0. */
14 struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
16 struct media_pad *pad = &entity->pads[0];
17 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;
25 sd = media_entity_to_v4l2_subdev(pad->entity);
27 if (sd->grp_id == GRP_ID_FIMC_IS_SENSOR ||
28 sd->grp_id == GRP_ID_SENSOR)
29 return sd;
30 /* sink pad */
31 pad = &sd->entity.pads[0];
33 return NULL;
35 EXPORT_SYMBOL(fimc_find_remote_sensor);
37 void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap)
39 strscpy(cap->driver, dev->driver->name, sizeof(cap->driver));
40 strscpy(cap->card, dev->driver->name, sizeof(cap->card));
41 snprintf(cap->bus_info, sizeof(cap->bus_info),
42 "platform:%s", dev_name(dev));
44 EXPORT_SYMBOL(__fimc_vidioc_querycap);
46 MODULE_LICENSE("GPL");