1 /* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
2 /*
3  * Rockchip ISP1 Driver - Common definitions
4  *
5  * Copyright (C) 2019 Collabora, Ltd.
6  *
7  * Based on Rockchip ISP1 driver by Rockchip Electronics Co., Ltd.
8  * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
9  */
10 
11 #ifndef _RKISP1_COMMON_H
12 #define _RKISP1_COMMON_H
13 
14 #include <linux/clk.h>
15 #include <linux/interrupt.h>
16 #include <linux/mutex.h>
17 #include <linux/rkisp1-config.h>
18 #include <media/media-device.h>
19 #include <media/media-entity.h>
20 #include <media/v4l2-ctrls.h>
21 #include <media/v4l2-device.h>
22 #include <media/videobuf2-v4l2.h>
23 
24 #include "rkisp1-regs.h"
25 
26 struct dentry;
27 
28 /*
29  * flags on the 'direction' field in struct rkisp1_mbus_info' that indicate
30  * on which pad the media bus format is supported
31  */
32 #define RKISP1_ISP_SD_SRC			BIT(0)
33 #define RKISP1_ISP_SD_SINK			BIT(1)
34 
35 /* min and max values for the widths and heights of the entities */
36 #define RKISP1_ISP_MAX_WIDTH			4032
37 #define RKISP1_ISP_MAX_HEIGHT			3024
38 #define RKISP1_ISP_MIN_WIDTH			32
39 #define RKISP1_ISP_MIN_HEIGHT			32
40 
41 #define RKISP1_RSZ_MP_SRC_MAX_WIDTH		4416
42 #define RKISP1_RSZ_MP_SRC_MAX_HEIGHT		3312
43 #define RKISP1_RSZ_SP_SRC_MAX_WIDTH		1920
44 #define RKISP1_RSZ_SP_SRC_MAX_HEIGHT		1920
45 #define RKISP1_RSZ_SRC_MIN_WIDTH		32
46 #define RKISP1_RSZ_SRC_MIN_HEIGHT		16
47 
48 /* the default width and height of all the entities */
49 #define RKISP1_DEFAULT_WIDTH			800
50 #define RKISP1_DEFAULT_HEIGHT			600
51 
52 #define RKISP1_DRIVER_NAME			"rkisp1"
53 #define RKISP1_BUS_INFO				"platform:" RKISP1_DRIVER_NAME
54 
55 /* maximum number of clocks */
56 #define RKISP1_MAX_BUS_CLK			8
57 
58 /* a bitmask of the ready stats */
59 #define RKISP1_STATS_MEAS_MASK			(RKISP1_CIF_ISP_AWB_DONE |	\
60 						 RKISP1_CIF_ISP_AFM_FIN |	\
61 						 RKISP1_CIF_ISP_EXP_END |	\
62 						 RKISP1_CIF_ISP_HIST_MEASURE_RDY)
63 
64 /* enum for the resizer pads */
65 enum rkisp1_rsz_pad {
66 	RKISP1_RSZ_PAD_SINK,
67 	RKISP1_RSZ_PAD_SRC,
68 	RKISP1_RSZ_PAD_MAX
69 };
70 
71 /* enum for the csi receiver pads */
72 enum rkisp1_csi_pad {
73 	RKISP1_CSI_PAD_SINK,
74 	RKISP1_CSI_PAD_SRC,
75 	RKISP1_CSI_PAD_NUM
76 };
77 
78 /* enum for the capture id */
79 enum rkisp1_stream_id {
80 	RKISP1_MAINPATH,
81 	RKISP1_SELFPATH,
82 };
83 
84 /* bayer patterns */
85 enum rkisp1_fmt_raw_pat_type {
86 	RKISP1_RAW_RGGB = 0,
87 	RKISP1_RAW_GRBG,
88 	RKISP1_RAW_GBRG,
89 	RKISP1_RAW_BGGR,
90 };
91 
92 /* enum for the isp pads */
93 enum rkisp1_isp_pad {
94 	RKISP1_ISP_PAD_SINK_VIDEO,
95 	RKISP1_ISP_PAD_SINK_PARAMS,
96 	RKISP1_ISP_PAD_SOURCE_VIDEO,
97 	RKISP1_ISP_PAD_SOURCE_STATS,
98 	RKISP1_ISP_PAD_MAX
99 };
100 
101 /*
102  * enum rkisp1_feature - ISP features
103  *
104  * @RKISP1_FEATURE_MIPI_CSI2: The ISP has an internal MIPI CSI-2 receiver
105  *
106  * The ISP features are stored in a bitmask in &rkisp1_info.features and allow
107  * the driver to implement support for features present in some ISP versions
108  * only.
109  */
110 enum rkisp1_feature {
111 	RKISP1_FEATURE_MIPI_CSI2 = BIT(0),
112 };
113 
114 /*
115  * struct rkisp1_info - Model-specific ISP Information
116  *
117  * @clks: array of ISP clock names
118  * @clk_size: number of entries in the @clks array
119  * @isrs: array of ISP interrupt descriptors
120  * @isr_size: number of entries in the @isrs array
121  * @isp_ver: ISP version
122  * @features: bitmask of rkisp1_feature features implemented by the ISP
123  *
124  * This structure contains information about the ISP specific to a particular
125  * ISP model, version, or integration in a particular SoC.
126  */
127 struct rkisp1_info {
128 	const char * const *clks;
129 	unsigned int clk_size;
130 	const struct rkisp1_isr_data *isrs;
131 	unsigned int isr_size;
132 	enum rkisp1_cif_isp_version isp_ver;
133 	unsigned int features;
134 };
135 
136 /*
137  * struct rkisp1_sensor_async - A container for the v4l2_async_subdev to add to the notifier
138  *				of the v4l2-async API
139  *
140  * @asd:		async_subdev variable for the sensor
141  * @index:		index of the sensor (counting sensor found in DT)
142  * @source_ep:		fwnode for the sensor source endpoint
143  * @lanes:		number of lanes
144  * @mbus_type:		type of bus (currently only CSI2 is supported)
145  * @mbus_flags:		media bus (V4L2_MBUS_*) flags
146  * @sd:			a pointer to v4l2_subdev struct of the sensor
147  * @pixel_rate_ctrl:	pixel rate of the sensor, used to initialize the phy
148  * @port:		port number (0: MIPI, 1: Parallel)
149  */
150 struct rkisp1_sensor_async {
151 	struct v4l2_async_connection asd;
152 	unsigned int index;
153 	struct fwnode_handle *source_ep;
154 	unsigned int lanes;
155 	enum v4l2_mbus_type mbus_type;
156 	unsigned int mbus_flags;
157 	struct v4l2_subdev *sd;
158 	struct v4l2_ctrl *pixel_rate_ctrl;
159 	unsigned int port;
160 };
161 
162 /*
163  * struct rkisp1_csi - CSI receiver subdev
164  *
165  * @rkisp1: pointer to the rkisp1 device
166  * @dphy: a pointer to the phy
167  * @is_dphy_errctrl_disabled: if dphy errctrl is disabled (avoid endless interrupt)
168  * @sd: v4l2_subdev variable
169  * @pads: media pads
170  * @pad_cfg: configurations for the pads
171  * @sink_fmt: input format
172  * @lock: protects pad_cfg and sink_fmt
173  * @source: source in-use, set when starting streaming
174  */
175 struct rkisp1_csi {
176 	struct rkisp1_device *rkisp1;
177 	struct phy *dphy;
178 	bool is_dphy_errctrl_disabled;
179 	struct v4l2_subdev sd;
180 	struct media_pad pads[RKISP1_CSI_PAD_NUM];
181 	struct v4l2_subdev_pad_config pad_cfg[RKISP1_CSI_PAD_NUM];
182 	const struct rkisp1_mbus_info *sink_fmt;
183 	struct mutex lock;
184 	struct v4l2_subdev *source;
185 };
186 
187 /*
188  * struct rkisp1_isp - ISP subdev entity
189  *
190  * @sd:				v4l2_subdev variable
191  * @rkisp1:			pointer to rkisp1_device
192  * @pads:			media pads
193  * @pad_cfg:			pads configurations
194  * @sink_fmt:			input format
195  * @src_fmt:			output format
196  * @ops_lock:			ops serialization
197  * @frame_sequence:		used to synchronize frame_id between video devices.
198  */
199 struct rkisp1_isp {
200 	struct v4l2_subdev sd;
201 	struct rkisp1_device *rkisp1;
202 	struct media_pad pads[RKISP1_ISP_PAD_MAX];
203 	struct v4l2_subdev_pad_config pad_cfg[RKISP1_ISP_PAD_MAX];
204 	const struct rkisp1_mbus_info *sink_fmt;
205 	const struct rkisp1_mbus_info *src_fmt;
206 	struct mutex ops_lock; /* serialize the subdevice ops */
207 	__u32 frame_sequence;
208 };
209 
210 /*
211  * struct rkisp1_vdev_node - Container for the video nodes: params, stats, mainpath, selfpath
212  *
213  * @buf_queue:	queue of buffers
214  * @vlock:	lock of the video node
215  * @vdev:	video node
216  * @pad:	media pad
217  */
218 struct rkisp1_vdev_node {
219 	struct vb2_queue buf_queue;
220 	struct mutex vlock; /* ioctl serialization mutex */
221 	struct video_device vdev;
222 	struct media_pad pad;
223 };
224 
225 /*
226  * struct rkisp1_buffer - A container for the vb2 buffers used by the video devices:
227  *			  params, stats, mainpath, selfpath
228  *
229  * @vb:		vb2 buffer
230  * @queue:	entry of the buffer in the queue
231  * @buff_addr:	dma addresses of each plane, used only by the capture devices: selfpath, mainpath
232  */
233 struct rkisp1_buffer {
234 	struct vb2_v4l2_buffer vb;
235 	struct list_head queue;
236 	u32 buff_addr[VIDEO_MAX_PLANES];
237 };
238 
239 /*
240  * struct rkisp1_dummy_buffer - A buffer to write the next frame to in case
241  *				there are no vb2 buffers available.
242  *
243  * @vaddr:	return value of call to dma_alloc_attrs.
244  * @dma_addr:	dma address of the buffer.
245  * @size:	size of the buffer.
246  */
247 struct rkisp1_dummy_buffer {
248 	void *vaddr;
249 	dma_addr_t dma_addr;
250 	u32 size;
251 };
252 
253 struct rkisp1_device;
254 
255 /*
256  * struct rkisp1_capture - ISP capture video device
257  *
258  * @vnode:	  video node
259  * @rkisp1:	  pointer to rkisp1_device
260  * @id:		  id of the capture, one of RKISP1_SELFPATH, RKISP1_MAINPATH
261  * @ops:	  list of callbacks to configure the capture device.
262  * @config:	  a pointer to the list of registers to configure the capture format.
263  * @is_streaming: device is streaming
264  * @is_stopping:  stop_streaming callback was called and the device is in the process of
265  *		  stopping the streaming.
266  * @done:	  when stop_streaming callback is called, the device waits for the next irq
267  *		  handler to stop the streaming by waiting on the 'done' wait queue.
268  *		  If the irq handler is not called, the stream is stopped by the callback
269  *		  after timeout.
270  * @sp_y_stride:  the selfpath allows to configure a y stride that is longer than the image width.
271  * @buf.lock:	  lock to protect buf.queue
272  * @buf.queue:	  queued buffer list
273  * @buf.dummy:	  dummy space to store dropped data
274  *
275  * rkisp1 uses shadow registers, so it needs two buffers at a time
276  * @buf.curr:	  the buffer used for current frame
277  * @buf.next:	  the buffer used for next frame
278  * @pix.cfg:	  pixel configuration
279  * @pix.info:	  a pointer to the v4l2_format_info of the pixel format
280  * @pix.fmt:	  buffer format
281  */
282 struct rkisp1_capture {
283 	struct rkisp1_vdev_node vnode;
284 	struct rkisp1_device *rkisp1;
285 	enum rkisp1_stream_id id;
286 	const struct rkisp1_capture_ops *ops;
287 	const struct rkisp1_capture_config *config;
288 	bool is_streaming;
289 	bool is_stopping;
290 	wait_queue_head_t done;
291 	unsigned int sp_y_stride;
292 	struct {
293 		/* protects queue, curr and next */
294 		spinlock_t lock;
295 		struct list_head queue;
296 		struct rkisp1_dummy_buffer dummy;
297 		struct rkisp1_buffer *curr;
298 		struct rkisp1_buffer *next;
299 	} buf;
300 	struct {
301 		const struct rkisp1_capture_fmt_cfg *cfg;
302 		const struct v4l2_format_info *info;
303 		struct v4l2_pix_format_mplane fmt;
304 	} pix;
305 };
306 
307 struct rkisp1_stats;
308 struct rkisp1_stats_ops {
309 	void (*get_awb_meas)(struct rkisp1_stats *stats,
310 			     struct rkisp1_stat_buffer *pbuf);
311 	void (*get_aec_meas)(struct rkisp1_stats *stats,
312 			     struct rkisp1_stat_buffer *pbuf);
313 	void (*get_hst_meas)(struct rkisp1_stats *stats,
314 			     struct rkisp1_stat_buffer *pbuf);
315 };
316 
317 /*
318  * struct rkisp1_stats - ISP Statistics device
319  *
320  * @vnode:	  video node
321  * @rkisp1:	  pointer to the rkisp1 device
322  * @lock:	  locks the buffer list 'stat'
323  * @stat:	  queue of rkisp1_buffer
324  * @vdev_fmt:	  v4l2_format of the metadata format
325  */
326 struct rkisp1_stats {
327 	struct rkisp1_vdev_node vnode;
328 	struct rkisp1_device *rkisp1;
329 	const struct rkisp1_stats_ops *ops;
330 
331 	spinlock_t lock; /* locks the buffers list 'stats' */
332 	struct list_head stat;
333 	struct v4l2_format vdev_fmt;
334 };
335 
336 struct rkisp1_params;
337 struct rkisp1_params_ops {
338 	void (*lsc_matrix_config)(struct rkisp1_params *params,
339 				  const struct rkisp1_cif_isp_lsc_config *pconfig);
340 	void (*goc_config)(struct rkisp1_params *params,
341 			   const struct rkisp1_cif_isp_goc_config *arg);
342 	void (*awb_meas_config)(struct rkisp1_params *params,
343 				const struct rkisp1_cif_isp_awb_meas_config *arg);
344 	void (*awb_meas_enable)(struct rkisp1_params *params,
345 				const struct rkisp1_cif_isp_awb_meas_config *arg,
346 				bool en);
347 	void (*awb_gain_config)(struct rkisp1_params *params,
348 				const struct rkisp1_cif_isp_awb_gain_config *arg);
349 	void (*aec_config)(struct rkisp1_params *params,
350 			   const struct rkisp1_cif_isp_aec_config *arg);
351 	void (*hst_config)(struct rkisp1_params *params,
352 			   const struct rkisp1_cif_isp_hst_config *arg);
353 	void (*hst_enable)(struct rkisp1_params *params,
354 			   const struct rkisp1_cif_isp_hst_config *arg, bool en);
355 	void (*afm_config)(struct rkisp1_params *params,
356 			   const struct rkisp1_cif_isp_afc_config *arg);
357 };
358 
359 /*
360  * struct rkisp1_params - ISP input parameters device
361  *
362  * @vnode:		video node
363  * @rkisp1:		pointer to the rkisp1 device
364  * @ops:		pointer to the variant-specific operations
365  * @config_lock:	locks the buffer list 'params'
366  * @params:		queue of rkisp1_buffer
367  * @vdev_fmt:		v4l2_format of the metadata format
368  * @quantization:	the quantization configured on the isp's src pad
369  * @raw_type:		the bayer pattern on the isp video sink pad
370  */
371 struct rkisp1_params {
372 	struct rkisp1_vdev_node vnode;
373 	struct rkisp1_device *rkisp1;
374 	const struct rkisp1_params_ops *ops;
375 
376 	spinlock_t config_lock; /* locks the buffers list 'params' */
377 	struct list_head params;
378 	struct v4l2_format vdev_fmt;
379 
380 	enum v4l2_quantization quantization;
381 	enum v4l2_ycbcr_encoding ycbcr_encoding;
382 	enum rkisp1_fmt_raw_pat_type raw_type;
383 };
384 
385 /*
386  * struct rkisp1_resizer - Resizer subdev
387  *
388  * @sd:	       v4l2_subdev variable
389  * @regs_base: base register address offset
390  * @id:	       id of the resizer, one of RKISP1_SELFPATH, RKISP1_MAINPATH
391  * @rkisp1:    pointer to the rkisp1 device
392  * @pads:      media pads
393  * @pad_cfg:   configurations for the pads
394  * @config:    the set of registers to configure the resizer
395  * @pixel_enc: pixel encoding of the resizer
396  * @ops_lock:  a lock for the subdev ops
397  */
398 struct rkisp1_resizer {
399 	struct v4l2_subdev sd;
400 	u32 regs_base;
401 	enum rkisp1_stream_id id;
402 	struct rkisp1_device *rkisp1;
403 	struct media_pad pads[RKISP1_RSZ_PAD_MAX];
404 	struct v4l2_subdev_pad_config pad_cfg[RKISP1_RSZ_PAD_MAX];
405 	const struct rkisp1_rsz_config *config;
406 	enum v4l2_pixel_encoding pixel_enc;
407 	struct mutex ops_lock; /* serialize the subdevice ops */
408 };
409 
410 /*
411  * struct rkisp1_debug - Values to be exposed on debugfs.
412  *			 The parameters are counters of the number of times the
413  *			 event occurred since the driver was loaded.
414  *
415  * @data_loss:			  loss of data occurred within a line, processing failure
416  * @outform_size_error:		  size error is generated in outmux submodule
417  * @img_stabilization_size_error: size error is generated in image stabilization submodule
418  * @inform_size_err:		  size error is generated in inform submodule
419  * @mipi_error:			  mipi error occurred
420  * @stats_error:		  writing to the 'Interrupt clear register' did not clear
421  *				  it in the register 'Masked interrupt status'
422  * @stop_timeout:		  upon stream stop, the capture waits 1 second for the isr to stop
423  *				  the stream. This param is incremented in case of timeout.
424  * @frame_drop:			  a frame was ready but the buffer queue was empty so the frame
425  *				  was not sent to userspace
426  */
427 struct rkisp1_debug {
428 	struct dentry *debugfs_dir;
429 	unsigned long data_loss;
430 	unsigned long outform_size_error;
431 	unsigned long img_stabilization_size_error;
432 	unsigned long inform_size_error;
433 	unsigned long irq_delay;
434 	unsigned long mipi_error;
435 	unsigned long stats_error;
436 	unsigned long stop_timeout[2];
437 	unsigned long frame_drop[2];
438 };
439 
440 /*
441  * struct rkisp1_device - ISP platform device
442  *
443  * @base_addr:	   base register address
444  * @irq:	   the irq number
445  * @dev:	   a pointer to the struct device
446  * @clk_size:	   number of clocks
447  * @clks:	   array of clocks
448  * @v4l2_dev:	   v4l2_device variable
449  * @media_dev:	   media_device variable
450  * @notifier:	   a notifier to register on the v4l2-async API to be notified on the sensor
451  * @source:        source subdev in-use, set when starting streaming
452  * @csi:	   internal CSI-2 receiver
453  * @isp:	   ISP sub-device
454  * @resizer_devs:  resizer sub-devices
455  * @capture_devs:  capture devices
456  * @stats:	   ISP statistics metadata capture device
457  * @params:	   ISP parameters metadata output device
458  * @pipe:	   media pipeline
459  * @stream_lock:   serializes {start/stop}_streaming callbacks between the capture devices.
460  * @debug:	   debug params to be exposed on debugfs
461  * @info:	   version-specific ISP information
462  */
463 struct rkisp1_device {
464 	void __iomem *base_addr;
465 	struct device *dev;
466 	unsigned int clk_size;
467 	struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
468 	struct v4l2_device v4l2_dev;
469 	struct media_device media_dev;
470 	struct v4l2_async_notifier notifier;
471 	struct v4l2_subdev *source;
472 	struct rkisp1_csi csi;
473 	struct rkisp1_isp isp;
474 	struct rkisp1_resizer resizer_devs[2];
475 	struct rkisp1_capture capture_devs[2];
476 	struct rkisp1_stats stats;
477 	struct rkisp1_params params;
478 	struct media_pipeline pipe;
479 	struct mutex stream_lock; /* serialize {start/stop}_streaming cb between capture devices */
480 	struct rkisp1_debug debug;
481 	const struct rkisp1_info *info;
482 };
483 
484 /*
485  * struct rkisp1_mbus_info - ISP media bus info, Translates media bus code to hardware
486  *			     format values
487  *
488  * @mbus_code: media bus code
489  * @pixel_enc: pixel encoding
490  * @mipi_dt:   mipi data type
491  * @yuv_seq:   the order of the Y, Cb, Cr values
492  * @bus_width: bus width
493  * @bayer_pat: bayer pattern
494  * @direction: a bitmask of the flags indicating on which pad the format is supported on
495  */
496 struct rkisp1_mbus_info {
497 	u32 mbus_code;
498 	enum v4l2_pixel_encoding pixel_enc;
499 	u32 mipi_dt;
500 	u32 yuv_seq;
501 	u8 bus_width;
502 	enum rkisp1_fmt_raw_pat_type bayer_pat;
503 	unsigned int direction;
504 };
505 
506 static inline void
507 rkisp1_write(struct rkisp1_device *rkisp1, unsigned int addr, u32 val)
508 {
509 	writel(val, rkisp1->base_addr + addr);
510 }
511 
512 static inline u32 rkisp1_read(struct rkisp1_device *rkisp1, unsigned int addr)
513 {
514 	return readl(rkisp1->base_addr + addr);
515 }
516 
517 /*
518  * rkisp1_cap_enum_mbus_codes - A helper function that return the i'th supported mbus code
519  *				of the capture entity. This is used to enumerate the supported
520  *				mbus codes on the source pad of the resizer.
521  *
522  * @cap:  the capture entity
523  * @code: the mbus code, the function reads the code->index and fills the code->code
524  */
525 int rkisp1_cap_enum_mbus_codes(struct rkisp1_capture *cap,
526 			       struct v4l2_subdev_mbus_code_enum *code);
527 
528 /*
529  * rkisp1_mbus_info_get_by_index - Retrieve the ith supported mbus info
530  *
531  * @index: index of the mbus info to fetch
532  */
533 const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_index(unsigned int index);
534 
535 /*
536  * rkisp1_sd_adjust_crop_rect - adjust a rectangle to fit into another rectangle.
537  *
538  * @crop:   rectangle to adjust.
539  * @bounds: rectangle used as bounds.
540  */
541 void rkisp1_sd_adjust_crop_rect(struct v4l2_rect *crop,
542 				const struct v4l2_rect *bounds);
543 
544 /*
545  * rkisp1_sd_adjust_crop - adjust a rectangle to fit into media bus format
546  *
547  * @crop:   rectangle to adjust.
548  * @bounds: media bus format used as bounds.
549  */
550 void rkisp1_sd_adjust_crop(struct v4l2_rect *crop,
551 			   const struct v4l2_mbus_framefmt *bounds);
552 
553 /*
554  * rkisp1_mbus_info_get_by_code - get the isp info of the media bus code
555  *
556  * @mbus_code: the media bus code
557  */
558 const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_code(u32 mbus_code);
559 
560 /*
561  * rkisp1_params_pre_configure - Configure the params before stream start
562  *
563  * @params:	  pointer to rkisp1_params
564  * @bayer_pat:	  the bayer pattern on the isp video sink pad
565  * @quantization: the quantization configured on the isp's src pad
566  * @ycbcr_encoding: the ycbcr_encoding configured on the isp's src pad
567  *
568  * This function is called by the ISP entity just before the ISP gets started.
569  * It applies the initial ISP parameters from the first params buffer, but
570  * skips LSC as it needs to be configured after the ISP is started.
571  */
572 void rkisp1_params_pre_configure(struct rkisp1_params *params,
573 				 enum rkisp1_fmt_raw_pat_type bayer_pat,
574 				 enum v4l2_quantization quantization,
575 				 enum v4l2_ycbcr_encoding ycbcr_encoding);
576 
577 /*
578  * rkisp1_params_post_configure - Configure the params after stream start
579  *
580  * @params:	  pointer to rkisp1_params
581  *
582  * This function is called by the ISP entity just after the ISP gets started.
583  * It applies the initial ISP LSC parameters from the first params buffer.
584  */
585 void rkisp1_params_post_configure(struct rkisp1_params *params);
586 
587 /* rkisp1_params_disable - disable all parameters.
588  *			   This function is called by the isp entity upon stream start
589  *			   when capturing bayer format.
590  *
591  * @params: pointer to rkisp1_params.
592  */
593 void rkisp1_params_disable(struct rkisp1_params *params);
594 
595 /* irq handlers */
596 irqreturn_t rkisp1_isp_isr(int irq, void *ctx);
597 irqreturn_t rkisp1_csi_isr(int irq, void *ctx);
598 irqreturn_t rkisp1_capture_isr(int irq, void *ctx);
599 void rkisp1_stats_isr(struct rkisp1_stats *stats, u32 isp_ris);
600 void rkisp1_params_isr(struct rkisp1_device *rkisp1);
601 
602 /* register/unregisters functions of the entities */
603 int rkisp1_capture_devs_register(struct rkisp1_device *rkisp1);
604 void rkisp1_capture_devs_unregister(struct rkisp1_device *rkisp1);
605 
606 int rkisp1_isp_register(struct rkisp1_device *rkisp1);
607 void rkisp1_isp_unregister(struct rkisp1_device *rkisp1);
608 
609 int rkisp1_resizer_devs_register(struct rkisp1_device *rkisp1);
610 void rkisp1_resizer_devs_unregister(struct rkisp1_device *rkisp1);
611 
612 int rkisp1_stats_register(struct rkisp1_device *rkisp1);
613 void rkisp1_stats_unregister(struct rkisp1_device *rkisp1);
614 
615 int rkisp1_params_register(struct rkisp1_device *rkisp1);
616 void rkisp1_params_unregister(struct rkisp1_device *rkisp1);
617 
618 #if IS_ENABLED(CONFIG_DEBUG_FS)
619 void rkisp1_debug_init(struct rkisp1_device *rkisp1);
620 void rkisp1_debug_cleanup(struct rkisp1_device *rkisp1);
621 #else
622 static inline void rkisp1_debug_init(struct rkisp1_device *rkisp1)
623 {
624 }
625 static inline void rkisp1_debug_cleanup(struct rkisp1_device *rkisp1)
626 {
627 }
628 #endif
629 
630 #endif /* _RKISP1_COMMON_H */
631