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/spinlock.h>
19 #include <media/v4l2-subdev.h>
23 enum vsp1_entity_type {
35 #define VSP1_ENTITY_MAX_INPUTS 5 /* For the BRU */
38 * struct vsp1_route - Entity routing configuration
39 * @type: Entity type this routing entry is associated with
40 * @index: Entity index this routing entry is associated with
41 * @reg: Output routing configuration register
42 * @inputs: Target node value for each input
44 * Each $vsp1_route entry describes routing configuration for the entity
45 * specified by the entry's @type and @index. @reg indicates the register that
46 * holds output routing configuration for the entity, and the @inputs array
47 * store the target node value for each input of the entity.
50 enum vsp1_entity_type type;
53 unsigned int inputs[VSP1_ENTITY_MAX_INPUTS];
57 struct vsp1_device *vsp1;
59 void (*destroy)(struct vsp1_entity *);
61 enum vsp1_entity_type type;
63 const struct vsp1_route *route;
65 struct list_head list_dev;
66 struct list_head list_pipe;
68 struct media_pad *pads;
69 unsigned int source_pad;
71 struct media_entity *sink;
72 unsigned int sink_pad;
74 struct v4l2_subdev subdev;
75 struct v4l2_mbus_framefmt *formats;
78 static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
80 return container_of(subdev, struct vsp1_entity, subdev);
83 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
84 unsigned int num_pads);
85 void vsp1_entity_destroy(struct vsp1_entity *entity);
87 extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
89 int vsp1_entity_link_setup(struct media_entity *entity,
90 const struct media_pad *local,
91 const struct media_pad *remote, u32 flags);
93 struct v4l2_mbus_framefmt *
94 vsp1_entity_get_pad_format(struct vsp1_entity *entity,
95 struct v4l2_subdev_pad_config *cfg,
96 unsigned int pad, u32 which);
97 void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
98 struct v4l2_subdev_pad_config *cfg);
100 void vsp1_entity_route_setup(struct vsp1_entity *source);
102 void vsp1_mod_write(struct vsp1_entity *e, u32 reg, u32 data);
104 #endif /* __VSP1_ENTITY_H__ */