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_subdev 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 rkisp1_fmt_raw_pat_type raw_type;
382 };
383 
384 /*
385  * struct rkisp1_resizer - Resizer subdev
386  *
387  * @sd:	       v4l2_subdev variable
388  * @regs_base: base register address offset
389  * @id:	       id of the resizer, one of RKISP1_SELFPATH, RKISP1_MAINPATH
390  * @rkisp1:    pointer to the rkisp1 device
391  * @pads:      media pads
392  * @pad_cfg:   configurations for the pads
393  * @config:    the set of registers to configure the resizer
394  * @pixel_enc: pixel encoding of the resizer
395  * @ops_lock:  a lock for the subdev ops
396  */
397 struct rkisp1_resizer {
398 	struct v4l2_subdev sd;
399 	u32 regs_base;
400 	enum rkisp1_stream_id id;
401 	struct rkisp1_device *rkisp1;
402 	struct media_pad pads[RKISP1_RSZ_PAD_MAX];
403 	struct v4l2_subdev_pad_config pad_cfg[RKISP1_RSZ_PAD_MAX];
404 	const struct rkisp1_rsz_config *config;
405 	enum v4l2_pixel_encoding pixel_enc;
406 	struct mutex ops_lock; /* serialize the subdevice ops */
407 };
408 
409 /*
410  * struct rkisp1_debug - Values to be exposed on debugfs.
411  *			 The parameters are counters of the number of times the
412  *			 event occurred since the driver was loaded.
413  *
414  * @data_loss:			  loss of data occurred within a line, processing failure
415  * @outform_size_error:		  size error is generated in outmux submodule
416  * @img_stabilization_size_error: size error is generated in image stabilization submodule
417  * @inform_size_err:		  size error is generated in inform submodule
418  * @mipi_error:			  mipi error occurred
419  * @stats_error:		  writing to the 'Interrupt clear register' did not clear
420  *				  it in the register 'Masked interrupt status'
421  * @stop_timeout:		  upon stream stop, the capture waits 1 second for the isr to stop
422  *				  the stream. This param is incremented in case of timeout.
423  * @frame_drop:			  a frame was ready but the buffer queue was empty so the frame
424  *				  was not sent to userspace
425  */
426 struct rkisp1_debug {
427 	struct dentry *debugfs_dir;
428 	unsigned long data_loss;
429 	unsigned long outform_size_error;
430 	unsigned long img_stabilization_size_error;
431 	unsigned long inform_size_error;
432 	unsigned long irq_delay;
433 	unsigned long mipi_error;
434 	unsigned long stats_error;
435 	unsigned long stop_timeout[2];
436 	unsigned long frame_drop[2];
437 };
438 
439 /*
440  * struct rkisp1_device - ISP platform device
441  *
442  * @base_addr:	   base register address
443  * @irq:	   the irq number
444  * @dev:	   a pointer to the struct device
445  * @clk_size:	   number of clocks
446  * @clks:	   array of clocks
447  * @v4l2_dev:	   v4l2_device variable
448  * @media_dev:	   media_device variable
449  * @notifier:	   a notifier to register on the v4l2-async API to be notified on the sensor
450  * @source:        source subdev in-use, set when starting streaming
451  * @csi:	   internal CSI-2 receiver
452  * @isp:	   ISP sub-device
453  * @resizer_devs:  resizer sub-devices
454  * @capture_devs:  capture devices
455  * @stats:	   ISP statistics metadata capture device
456  * @params:	   ISP parameters metadata output device
457  * @pipe:	   media pipeline
458  * @stream_lock:   serializes {start/stop}_streaming callbacks between the capture devices.
459  * @debug:	   debug params to be exposed on debugfs
460  * @info:	   version-specific ISP information
461  */
462 struct rkisp1_device {
463 	void __iomem *base_addr;
464 	struct device *dev;
465 	unsigned int clk_size;
466 	struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
467 	struct v4l2_device v4l2_dev;
468 	struct media_device media_dev;
469 	struct v4l2_async_notifier notifier;
470 	struct v4l2_subdev *source;
471 	struct rkisp1_csi csi;
472 	struct rkisp1_isp isp;
473 	struct rkisp1_resizer resizer_devs[2];
474 	struct rkisp1_capture capture_devs[2];
475 	struct rkisp1_stats stats;
476 	struct rkisp1_params params;
477 	struct media_pipeline pipe;
478 	struct mutex stream_lock; /* serialize {start/stop}_streaming cb between capture devices */
479 	struct rkisp1_debug debug;
480 	const struct rkisp1_info *info;
481 };
482 
483 /*
484  * struct rkisp1_mbus_info - ISP media bus info, Translates media bus code to hardware
485  *			     format values
486  *
487  * @mbus_code: media bus code
488  * @pixel_enc: pixel encoding
489  * @mipi_dt:   mipi data type
490  * @yuv_seq:   the order of the Y, Cb, Cr values
491  * @bus_width: bus width
492  * @bayer_pat: bayer pattern
493  * @direction: a bitmask of the flags indicating on which pad the format is supported on
494  */
495 struct rkisp1_mbus_info {
496 	u32 mbus_code;
497 	enum v4l2_pixel_encoding pixel_enc;
498 	u32 mipi_dt;
499 	u32 yuv_seq;
500 	u8 bus_width;
501 	enum rkisp1_fmt_raw_pat_type bayer_pat;
502 	unsigned int direction;
503 };
504 
505 static inline void
506 rkisp1_write(struct rkisp1_device *rkisp1, unsigned int addr, u32 val)
507 {
508 	writel(val, rkisp1->base_addr + addr);
509 }
510 
511 static inline u32 rkisp1_read(struct rkisp1_device *rkisp1, unsigned int addr)
512 {
513 	return readl(rkisp1->base_addr + addr);
514 }
515 
516 /*
517  * rkisp1_cap_enum_mbus_codes - A helper function that return the i'th supported mbus code
518  *				of the capture entity. This is used to enumerate the supported
519  *				mbus codes on the source pad of the resizer.
520  *
521  * @cap:  the capture entity
522  * @code: the mbus code, the function reads the code->index and fills the code->code
523  */
524 int rkisp1_cap_enum_mbus_codes(struct rkisp1_capture *cap,
525 			       struct v4l2_subdev_mbus_code_enum *code);
526 
527 /*
528  * rkisp1_mbus_info_get_by_index - Retrieve the ith supported mbus info
529  *
530  * @index: index of the mbus info to fetch
531  */
532 const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_index(unsigned int index);
533 
534 /*
535  * rkisp1_sd_adjust_crop_rect - adjust a rectangle to fit into another rectangle.
536  *
537  * @crop:   rectangle to adjust.
538  * @bounds: rectangle used as bounds.
539  */
540 void rkisp1_sd_adjust_crop_rect(struct v4l2_rect *crop,
541 				const struct v4l2_rect *bounds);
542 
543 /*
544  * rkisp1_sd_adjust_crop - adjust a rectangle to fit into media bus format
545  *
546  * @crop:   rectangle to adjust.
547  * @bounds: media bus format used as bounds.
548  */
549 void rkisp1_sd_adjust_crop(struct v4l2_rect *crop,
550 			   const struct v4l2_mbus_framefmt *bounds);
551 
552 /*
553  * rkisp1_mbus_info_get_by_code - get the isp info of the media bus code
554  *
555  * @mbus_code: the media bus code
556  */
557 const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_code(u32 mbus_code);
558 
559 /* rkisp1_params_configure - configure the params when stream starts.
560  *			     This function is called by the isp entity upon stream starts.
561  *			     The function applies the initial configuration of the parameters.
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  */
567 void rkisp1_params_configure(struct rkisp1_params *params,
568 			     enum rkisp1_fmt_raw_pat_type bayer_pat,
569 			     enum v4l2_quantization quantization);
570 
571 /* rkisp1_params_disable - disable all parameters.
572  *			   This function is called by the isp entity upon stream start
573  *			   when capturing bayer format.
574  *
575  * @params: pointer to rkisp1_params.
576  */
577 void rkisp1_params_disable(struct rkisp1_params *params);
578 
579 /* irq handlers */
580 irqreturn_t rkisp1_isp_isr(int irq, void *ctx);
581 irqreturn_t rkisp1_csi_isr(int irq, void *ctx);
582 irqreturn_t rkisp1_capture_isr(int irq, void *ctx);
583 void rkisp1_stats_isr(struct rkisp1_stats *stats, u32 isp_ris);
584 void rkisp1_params_isr(struct rkisp1_device *rkisp1);
585 
586 /* register/unregisters functions of the entities */
587 int rkisp1_capture_devs_register(struct rkisp1_device *rkisp1);
588 void rkisp1_capture_devs_unregister(struct rkisp1_device *rkisp1);
589 
590 int rkisp1_isp_register(struct rkisp1_device *rkisp1);
591 void rkisp1_isp_unregister(struct rkisp1_device *rkisp1);
592 
593 int rkisp1_resizer_devs_register(struct rkisp1_device *rkisp1);
594 void rkisp1_resizer_devs_unregister(struct rkisp1_device *rkisp1);
595 
596 int rkisp1_stats_register(struct rkisp1_device *rkisp1);
597 void rkisp1_stats_unregister(struct rkisp1_device *rkisp1);
598 
599 int rkisp1_params_register(struct rkisp1_device *rkisp1);
600 void rkisp1_params_unregister(struct rkisp1_device *rkisp1);
601 
602 #if IS_ENABLED(CONFIG_DEBUG_FS)
603 void rkisp1_debug_init(struct rkisp1_device *rkisp1);
604 void rkisp1_debug_cleanup(struct rkisp1_device *rkisp1);
605 #else
606 static inline void rkisp1_debug_init(struct rkisp1_device *rkisp1)
607 {
608 }
609 static inline void rkisp1_debug_cleanup(struct rkisp1_device *rkisp1)
610 {
611 }
612 #endif
613 
614 #endif /* _RKISP1_COMMON_H */
615