xref: /linux/drivers/media/platform/raspberrypi/rp1-cfe/pisp-fe.h (revision cdd30ebb1b9f36159d66f088b61aee264e649d7a)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * PiSP Front End Driver
4  *
5  * Copyright (c) 2021-2024 Raspberry Pi Ltd.
6  */
7 #ifndef _PISP_FE_H_
8 #define _PISP_FE_H_
9 
10 #include <linux/debugfs.h>
11 #include <linux/io.h>
12 #include <linux/types.h>
13 #include <linux/videodev2.h>
14 
15 #include <media/media-device.h>
16 #include <media/v4l2-device.h>
17 #include <media/v4l2-subdev.h>
18 
19 #include <linux/media/raspberrypi/pisp_fe_config.h>
20 
21 enum pisp_fe_pads {
22 	FE_STREAM_PAD,
23 	FE_CONFIG_PAD,
24 	FE_OUTPUT0_PAD,
25 	FE_OUTPUT1_PAD,
26 	FE_STATS_PAD,
27 	FE_NUM_PADS
28 };
29 
30 struct pisp_fe_device {
31 	/* Parent V4l2 device */
32 	struct v4l2_device *v4l2_dev;
33 	void __iomem *base;
34 	u32 hw_revision;
35 
36 	u16 inframe_count;
37 	struct media_pad pad[FE_NUM_PADS];
38 	struct v4l2_subdev sd;
39 };
40 
41 void pisp_fe_isr(struct pisp_fe_device *fe, bool *sof, bool *eof);
42 int pisp_fe_validate_config(struct pisp_fe_device *fe,
43 			    struct pisp_fe_config *cfg,
44 			    struct v4l2_format const *f0,
45 			    struct v4l2_format const *f1);
46 void pisp_fe_submit_job(struct pisp_fe_device *fe, struct vb2_buffer **vb2_bufs,
47 			struct pisp_fe_config *cfg);
48 void pisp_fe_start(struct pisp_fe_device *fe);
49 void pisp_fe_stop(struct pisp_fe_device *fe);
50 int pisp_fe_init(struct pisp_fe_device *fe, struct dentry *debugfs);
51 void pisp_fe_uninit(struct pisp_fe_device *fe);
52 
53 #endif
54