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