2 * vsp1_entity.h -- R-Car VSP1 Base Entity
4 * Copyright (C) 2013-2014 Renesas Electronics Corporation
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 #ifndef __VSP1_ENTITY_H__
14 #define __VSP1_ENTITY_H__
16 #include <linux/list.h>
17 #include <linux/mutex.h>
19 #include <media/v4l2-subdev.h>
24 enum vsp1_entity_type {
37 * struct vsp1_route - Entity routing configuration
38 * @type: Entity type this routing entry is associated with
39 * @index: Entity index this routing entry is associated with
40 * @reg: Output routing configuration register
41 * @inputs: Target node value for each input
43 * Each $vsp1_route entry describes routing configuration for the entity
44 * specified by the entry's @type and @index. @reg indicates the register that
45 * holds output routing configuration for the entity, and the @inputs array
46 * store the target node value for each input of the entity.
49 enum vsp1_entity_type type;
52 unsigned int inputs[4];
56 struct vsp1_device *vsp1;
58 enum vsp1_entity_type type;
60 const struct vsp1_route *route;
62 struct list_head list_dev;
63 struct list_head list_pipe;
65 struct media_pad *pads;
66 unsigned int source_pad;
68 struct media_entity *sink;
69 unsigned int sink_pad;
71 struct v4l2_subdev subdev;
72 struct v4l2_mbus_framefmt *formats;
74 struct vsp1_video *video;
76 struct mutex lock; /* Protects the streaming field */
80 static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
82 return container_of(subdev, struct vsp1_entity, subdev);
85 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
86 unsigned int num_pads);
87 void vsp1_entity_destroy(struct vsp1_entity *entity);
89 extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
90 extern const struct media_entity_operations vsp1_media_ops;
92 struct v4l2_mbus_framefmt *
93 vsp1_entity_get_pad_format(struct vsp1_entity *entity,
94 struct v4l2_subdev_pad_config *cfg,
95 unsigned int pad, u32 which);
96 void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
97 struct v4l2_subdev_pad_config *cfg);
99 bool vsp1_entity_is_streaming(struct vsp1_entity *entity);
100 int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming);
102 #endif /* __VSP1_ENTITY_H__ */