blob: 1c98aff3da5dbf569187790edf0a863aa2478c07 [file] [log] [blame]
Laurent Pinchart26e0ca22013-06-04 11:22:30 -03001/*
2 * vsp1_rwpf.h -- R-Car VSP1 Read and Write Pixel Formatters
3 *
Laurent Pinchart8a1edc52014-02-06 14:42:31 -03004 * Copyright (C) 2013-2014 Renesas Electronics Corporation
Laurent Pinchart26e0ca22013-06-04 11:22:30 -03005 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
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.
12 */
13#ifndef __VSP1_RWPF_H__
14#define __VSP1_RWPF_H__
15
Laurent Pinchart894dde52016-05-26 05:14:22 -030016#include <linux/spinlock.h>
17
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030018#include <media/media-entity.h>
Laurent Pinchart7578c202014-05-21 19:00:05 -030019#include <media/v4l2-ctrls.h>
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030020#include <media/v4l2-subdev.h>
21
22#include "vsp1.h"
23#include "vsp1_entity.h"
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030024
25#define RWPF_PAD_SINK 0
26#define RWPF_PAD_SOURCE 1
27
Laurent Pinchart3dbb6102015-08-05 16:57:35 -030028struct v4l2_ctrl;
Laurent Pinchartef9621b2015-11-14 22:27:52 -020029struct vsp1_dl_manager;
Laurent Pinchartff7e97c2016-01-19 19:16:36 -020030struct vsp1_pipeline;
Laurent Pinchartb6af10c2015-07-28 14:05:56 -030031struct vsp1_rwpf;
Laurent Pinchartfaf26442015-08-02 14:58:43 -030032struct vsp1_video;
Laurent Pinchartb58faa92015-07-28 16:04:47 -030033
34struct vsp1_rwpf_memory {
Laurent Pinchartb58faa92015-07-28 16:04:47 -030035 dma_addr_t addr[3];
Laurent Pinchartb58faa92015-07-28 16:04:47 -030036};
Laurent Pinchartb6af10c2015-07-28 14:05:56 -030037
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030038struct vsp1_rwpf {
39 struct vsp1_entity entity;
Laurent Pinchart7578c202014-05-21 19:00:05 -030040 struct v4l2_ctrl_handler ctrls;
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030041
Laurent Pinchartff7e97c2016-01-19 19:16:36 -020042 struct vsp1_pipeline *pipe;
Laurent Pinchartfaf26442015-08-02 14:58:43 -030043 struct vsp1_video *video;
44
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030045 unsigned int max_width;
46 unsigned int max_height;
Laurent Pincharte5ad37b2013-08-24 20:49:58 -030047
Laurent Pinchart86960ee2015-07-28 14:00:43 -030048 struct v4l2_pix_format_mplane format;
49 const struct vsp1_format_info *fmtinfo;
Laurent Pinchartb7e51072015-11-15 19:14:22 -020050 unsigned int bru_input;
Laurent Pincharte5ad37b2013-08-24 20:49:58 -030051
Laurent Pinchartbd2fdd52015-11-01 12:19:42 -020052 unsigned int alpha;
53
Laurent Pinchartd05a3312016-06-20 05:04:38 -030054 u32 mult_alpha;
55 u32 outfmt;
56
Laurent Pinchart894dde52016-05-26 05:14:22 -030057 struct {
58 spinlock_t lock;
59 struct v4l2_ctrl *ctrls[2];
60 unsigned int pending;
61 unsigned int active;
62 } flip;
63
Laurent Pinchart351bbf92015-11-01 15:18:56 -020064 struct vsp1_rwpf_memory mem;
Laurent Pinchartef9621b2015-11-14 22:27:52 -020065
66 struct vsp1_dl_manager *dlm;
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030067};
68
69static inline struct vsp1_rwpf *to_rwpf(struct v4l2_subdev *subdev)
70{
71 return container_of(subdev, struct vsp1_rwpf, entity.subdev);
72}
73
Laurent Pinchart52434532015-11-17 12:23:23 -020074static inline struct vsp1_rwpf *entity_to_rwpf(struct vsp1_entity *entity)
75{
76 return container_of(entity, struct vsp1_rwpf, entity);
77}
78
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030079struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index);
80struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index);
81
Laurent Pinchart894dde52016-05-26 05:14:22 -030082int vsp1_rwpf_init_ctrls(struct vsp1_rwpf *rwpf, unsigned int ncontrols);
Laurent Pinchartbd2fdd52015-11-01 12:19:42 -020083
Laurent Pinchartc6c8efb2015-11-22 13:37:45 -020084extern const struct v4l2_subdev_pad_ops vsp1_rwpf_pad_ops;
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030085
Laurent Pinchartb7e51072015-11-15 19:14:22 -020086struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf,
87 struct v4l2_subdev_pad_config *config);
Laurent Pinchart4d346be52015-11-01 13:48:11 -020088
Laurent Pinchart26e0ca22013-06-04 11:22:30 -030089#endif /* __VSP1_RWPF_H__ */