xref: /linux/drivers/media/platform/samsung/exynos4-is/common.c (revision fd7d598270724cc787982ea48bbe17ad383a8b7f)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Samsung S5P/EXYNOS4 SoC Camera Subsystem driver
4  *
5  * Copyright (C) 2013 Samsung Electronics Co., Ltd.
6  * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
7  */
8 
9 #include <linux/module.h>
10 #include <media/drv-intf/exynos-fimc.h>
11 #include "common.h"
12 
13 /*
14  * Called with the media graph mutex held or media_entity_is_streaming(entity)
15  * true.
16  */
17 struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
18 {
19 	struct media_pad *pad = &entity->pads[0];
20 	struct v4l2_subdev *sd;
21 
22 	while (pad->flags & MEDIA_PAD_FL_SINK) {
23 		/* source pad */
24 		pad = media_pad_remote_pad_first(pad);
25 		if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
26 			break;
27 
28 		sd = media_entity_to_v4l2_subdev(pad->entity);
29 
30 		if (sd->grp_id == GRP_ID_FIMC_IS_SENSOR ||
31 		    sd->grp_id == GRP_ID_SENSOR)
32 			return sd;
33 		/* sink pad */
34 		pad = &sd->entity.pads[0];
35 	}
36 	return NULL;
37 }
38 EXPORT_SYMBOL(fimc_find_remote_sensor);
39 
40 void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap)
41 {
42 	strscpy(cap->driver, dev->driver->name, sizeof(cap->driver));
43 	strscpy(cap->card, dev->driver->name, sizeof(cap->card));
44 }
45 EXPORT_SYMBOL(__fimc_vidioc_querycap);
46 
47 MODULE_LICENSE("GPL");
48