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