xref: /linux/drivers/media/platform/microchip/microchip-isc.h (revision a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0)
191b4e487SEugen Hristev /* SPDX-License-Identifier: GPL-2.0 */
291b4e487SEugen Hristev /*
391b4e487SEugen Hristev  * Microchip Image Sensor Controller (ISC) driver header file
491b4e487SEugen Hristev  *
591b4e487SEugen Hristev  * Copyright (C) 2016-2019 Microchip Technology, Inc.
691b4e487SEugen Hristev  *
791b4e487SEugen Hristev  * Author: Songjun Wu
891b4e487SEugen Hristev  * Author: Eugen Hristev <eugen.hristev@microchip.com>
991b4e487SEugen Hristev  *
1091b4e487SEugen Hristev  */
1191b4e487SEugen Hristev #ifndef _MICROCHIP_ISC_H_
1291b4e487SEugen Hristev 
1391b4e487SEugen Hristev #include <linux/clk-provider.h>
1491b4e487SEugen Hristev #include <linux/platform_device.h>
1591b4e487SEugen Hristev 
1691b4e487SEugen Hristev #include <media/v4l2-ctrls.h>
1791b4e487SEugen Hristev #include <media/v4l2-device.h>
1891b4e487SEugen Hristev #include <media/videobuf2-dma-contig.h>
1991b4e487SEugen Hristev 
2091b4e487SEugen Hristev #define ISC_CLK_MAX_DIV		255
2191b4e487SEugen Hristev 
2291b4e487SEugen Hristev enum isc_clk_id {
2391b4e487SEugen Hristev 	ISC_ISPCK = 0,
2491b4e487SEugen Hristev 	ISC_MCK = 1,
2591b4e487SEugen Hristev };
2691b4e487SEugen Hristev 
2791b4e487SEugen Hristev struct isc_clk {
2891b4e487SEugen Hristev 	struct clk_hw   hw;
2991b4e487SEugen Hristev 	struct clk      *clk;
3091b4e487SEugen Hristev 	struct regmap   *regmap;
3191b4e487SEugen Hristev 	spinlock_t	lock;	/* serialize access to clock registers */
3291b4e487SEugen Hristev 	u8		id;
3391b4e487SEugen Hristev 	u8		parent_id;
3491b4e487SEugen Hristev 	u32		div;
3591b4e487SEugen Hristev 	struct device	*dev;
3691b4e487SEugen Hristev };
3791b4e487SEugen Hristev 
3891b4e487SEugen Hristev #define to_isc_clk(v) container_of(v, struct isc_clk, hw)
3991b4e487SEugen Hristev 
4091b4e487SEugen Hristev struct isc_buffer {
4191b4e487SEugen Hristev 	struct vb2_v4l2_buffer  vb;
4291b4e487SEugen Hristev 	struct list_head	list;
4391b4e487SEugen Hristev };
4491b4e487SEugen Hristev 
4591b4e487SEugen Hristev struct isc_subdev_entity {
4691b4e487SEugen Hristev 	struct v4l2_subdev		*sd;
47*adb2dcd5SSakari Ailus 	struct v4l2_async_connection	*asd;
4891b4e487SEugen Hristev 	struct device_node		*epn;
4991b4e487SEugen Hristev 	struct v4l2_async_notifier      notifier;
5091b4e487SEugen Hristev 
5191b4e487SEugen Hristev 	u32 pfe_cfg0;
5291b4e487SEugen Hristev 
5391b4e487SEugen Hristev 	struct list_head list;
5491b4e487SEugen Hristev };
5591b4e487SEugen Hristev 
5691b4e487SEugen Hristev /*
5791b4e487SEugen Hristev  * struct isc_format - ISC media bus format information
5891b4e487SEugen Hristev 			This structure represents the interface between the ISC
5991b4e487SEugen Hristev 			and the sensor. It's the input format received by
6091b4e487SEugen Hristev 			the ISC.
6191b4e487SEugen Hristev  * @fourcc:		Fourcc code for this format
6291b4e487SEugen Hristev  * @mbus_code:		V4L2 media bus format code.
6391b4e487SEugen Hristev  * @cfa_baycfg:		If this format is RAW BAYER, indicate the type of bayer.
6491b4e487SEugen Hristev 			this is either BGBG, RGRG, etc.
6591b4e487SEugen Hristev  * @pfe_cfg0_bps:	Number of hardware data lines connected to the ISC
6678ba0d79SEugen Hristev  * @raw:		If the format is raw bayer.
6791b4e487SEugen Hristev  */
6891b4e487SEugen Hristev 
6991b4e487SEugen Hristev struct isc_format {
7091b4e487SEugen Hristev 	u32	fourcc;
7191b4e487SEugen Hristev 	u32	mbus_code;
7291b4e487SEugen Hristev 	u32	cfa_baycfg;
7391b4e487SEugen Hristev 	u32	pfe_cfg0_bps;
7478ba0d79SEugen Hristev 
7578ba0d79SEugen Hristev 	bool	raw;
7691b4e487SEugen Hristev };
7791b4e487SEugen Hristev 
7891b4e487SEugen Hristev /* Pipeline bitmap */
7991b4e487SEugen Hristev #define DPC_DPCENABLE	BIT(0)
8091b4e487SEugen Hristev #define DPC_GDCENABLE	BIT(1)
8191b4e487SEugen Hristev #define DPC_BLCENABLE	BIT(2)
8291b4e487SEugen Hristev #define WB_ENABLE	BIT(3)
8391b4e487SEugen Hristev #define CFA_ENABLE	BIT(4)
8491b4e487SEugen Hristev #define CC_ENABLE	BIT(5)
8591b4e487SEugen Hristev #define GAM_ENABLE	BIT(6)
8691b4e487SEugen Hristev #define GAM_BENABLE	BIT(7)
8791b4e487SEugen Hristev #define GAM_GENABLE	BIT(8)
8891b4e487SEugen Hristev #define GAM_RENABLE	BIT(9)
8991b4e487SEugen Hristev #define VHXS_ENABLE	BIT(10)
9091b4e487SEugen Hristev #define CSC_ENABLE	BIT(11)
9191b4e487SEugen Hristev #define CBC_ENABLE	BIT(12)
9291b4e487SEugen Hristev #define SUB422_ENABLE	BIT(13)
9391b4e487SEugen Hristev #define SUB420_ENABLE	BIT(14)
9491b4e487SEugen Hristev 
9591b4e487SEugen Hristev #define GAM_ENABLES	(GAM_RENABLE | GAM_GENABLE | GAM_BENABLE | GAM_ENABLE)
9691b4e487SEugen Hristev 
9791b4e487SEugen Hristev /*
9891b4e487SEugen Hristev  * struct fmt_config - ISC format configuration and internal pipeline
9991b4e487SEugen Hristev 			This structure represents the internal configuration
10091b4e487SEugen Hristev 			of the ISC.
10191b4e487SEugen Hristev 			It also holds the format that ISC will present to v4l2.
10291b4e487SEugen Hristev  * @sd_format:		Pointer to an isc_format struct that holds the sensor
10391b4e487SEugen Hristev 			configuration.
10491b4e487SEugen Hristev  * @fourcc:		Fourcc code for this format.
10591b4e487SEugen Hristev  * @bpp:		Bytes per pixel in the current format.
10691b4e487SEugen Hristev  * @bpp_v4l2:		Bytes per pixel in the current format, for v4l2.
10791b4e487SEugen Hristev 			This differs from 'bpp' in the sense that in planar
10891b4e487SEugen Hristev 			formats, it refers only to the first plane.
10991b4e487SEugen Hristev  * @rlp_cfg_mode:	Configuration of the RLP (rounding, limiting packaging)
11091b4e487SEugen Hristev  * @dcfg_imode:		Configuration of the input of the DMA module
11191b4e487SEugen Hristev  * @dctrl_dview:	Configuration of the output of the DMA module
11291b4e487SEugen Hristev  * @bits_pipeline:	Configuration of the pipeline, which modules are enabled
11391b4e487SEugen Hristev  */
11491b4e487SEugen Hristev struct fmt_config {
11591b4e487SEugen Hristev 	struct isc_format	*sd_format;
11691b4e487SEugen Hristev 
11791b4e487SEugen Hristev 	u32			fourcc;
11891b4e487SEugen Hristev 	u8			bpp;
11991b4e487SEugen Hristev 	u8			bpp_v4l2;
12091b4e487SEugen Hristev 
12191b4e487SEugen Hristev 	u32			rlp_cfg_mode;
12291b4e487SEugen Hristev 	u32			dcfg_imode;
12391b4e487SEugen Hristev 	u32			dctrl_dview;
12491b4e487SEugen Hristev 
12591b4e487SEugen Hristev 	u32			bits_pipeline;
12691b4e487SEugen Hristev };
12791b4e487SEugen Hristev 
12891b4e487SEugen Hristev #define HIST_ENTRIES		512
12991b4e487SEugen Hristev #define HIST_BAYER		(ISC_HIS_CFG_MODE_B + 1)
13091b4e487SEugen Hristev 
13191b4e487SEugen Hristev enum{
13291b4e487SEugen Hristev 	HIST_INIT = 0,
13391b4e487SEugen Hristev 	HIST_ENABLED,
13491b4e487SEugen Hristev 	HIST_DISABLED,
13591b4e487SEugen Hristev };
13691b4e487SEugen Hristev 
13791b4e487SEugen Hristev struct isc_ctrls {
13891b4e487SEugen Hristev 	struct v4l2_ctrl_handler handler;
13991b4e487SEugen Hristev 
14091b4e487SEugen Hristev 	u32 brightness;
14191b4e487SEugen Hristev 	u32 contrast;
14291b4e487SEugen Hristev 	u8 gamma_index;
14391b4e487SEugen Hristev #define ISC_WB_NONE	0
14491b4e487SEugen Hristev #define ISC_WB_AUTO	1
14591b4e487SEugen Hristev #define ISC_WB_ONETIME	2
14691b4e487SEugen Hristev 	u8 awb;
14791b4e487SEugen Hristev 
14891b4e487SEugen Hristev 	/* one for each component : GR, R, GB, B */
14991b4e487SEugen Hristev 	u32 gain[HIST_BAYER];
15091b4e487SEugen Hristev 	s32 offset[HIST_BAYER];
15191b4e487SEugen Hristev 
15291b4e487SEugen Hristev 	u32 hist_entry[HIST_ENTRIES];
15391b4e487SEugen Hristev 	u32 hist_count[HIST_BAYER];
15491b4e487SEugen Hristev 	u8 hist_id;
15591b4e487SEugen Hristev 	u8 hist_stat;
15691b4e487SEugen Hristev #define HIST_MIN_INDEX		0
15791b4e487SEugen Hristev #define HIST_MAX_INDEX		1
15891b4e487SEugen Hristev 	u32 hist_minmax[HIST_BAYER][2];
15991b4e487SEugen Hristev };
16091b4e487SEugen Hristev 
16191b4e487SEugen Hristev #define ISC_PIPE_LINE_NODE_NUM	15
16291b4e487SEugen Hristev 
16391b4e487SEugen Hristev /*
16491b4e487SEugen Hristev  * struct isc_reg_offsets - ISC device register offsets
16591b4e487SEugen Hristev  * @csc:		Offset for the CSC register
16691b4e487SEugen Hristev  * @cbc:		Offset for the CBC register
16791b4e487SEugen Hristev  * @sub422:		Offset for the SUB422 register
16891b4e487SEugen Hristev  * @sub420:		Offset for the SUB420 register
16991b4e487SEugen Hristev  * @rlp:		Offset for the RLP register
17091b4e487SEugen Hristev  * @his:		Offset for the HIS related registers
17191b4e487SEugen Hristev  * @dma:		Offset for the DMA related registers
17291b4e487SEugen Hristev  * @version:		Offset for the version register
17391b4e487SEugen Hristev  * @his_entry:		Offset for the HIS entries registers
17491b4e487SEugen Hristev  */
17591b4e487SEugen Hristev struct isc_reg_offsets {
17691b4e487SEugen Hristev 	u32 csc;
17791b4e487SEugen Hristev 	u32 cbc;
17891b4e487SEugen Hristev 	u32 sub422;
17991b4e487SEugen Hristev 	u32 sub420;
18091b4e487SEugen Hristev 	u32 rlp;
18191b4e487SEugen Hristev 	u32 his;
18291b4e487SEugen Hristev 	u32 dma;
18391b4e487SEugen Hristev 	u32 version;
18491b4e487SEugen Hristev 	u32 his_entry;
18591b4e487SEugen Hristev };
18691b4e487SEugen Hristev 
187920b2665SEugen Hristev enum isc_mc_pads {
188920b2665SEugen Hristev 	ISC_PAD_SINK	= 0,
189920b2665SEugen Hristev 	ISC_PADS_NUM	= 1,
190920b2665SEugen Hristev };
191920b2665SEugen Hristev 
192920b2665SEugen Hristev enum isc_scaler_pads {
193920b2665SEugen Hristev 	ISC_SCALER_PAD_SINK	= 0,
194920b2665SEugen Hristev 	ISC_SCALER_PAD_SOURCE	= 1,
195920b2665SEugen Hristev 	ISC_SCALER_PADS_NUM	= 2,
196920b2665SEugen Hristev };
197920b2665SEugen Hristev 
19891b4e487SEugen Hristev /*
19991b4e487SEugen Hristev  * struct isc_device - ISC device driver data/config struct
20091b4e487SEugen Hristev  * @regmap:		Register map
20191b4e487SEugen Hristev  * @hclock:		Hclock clock input (refer datasheet)
20291b4e487SEugen Hristev  * @ispck:		iscpck clock (refer datasheet)
20391b4e487SEugen Hristev  * @isc_clks:		ISC clocks
20491b4e487SEugen Hristev  * @ispck_required:	ISC requires ISP Clock initialization
20591b4e487SEugen Hristev  * @dcfg:		DMA master configuration, architecture dependent
20691b4e487SEugen Hristev  *
20791b4e487SEugen Hristev  * @dev:		Registered device driver
20891b4e487SEugen Hristev  * @v4l2_dev:		v4l2 registered device
20991b4e487SEugen Hristev  * @video_dev:		registered video device
21091b4e487SEugen Hristev  *
21191b4e487SEugen Hristev  * @vb2_vidq:		video buffer 2 video queue
21291b4e487SEugen Hristev  * @dma_queue_lock:	lock to serialize the dma buffer queue
21391b4e487SEugen Hristev  * @dma_queue:		the queue for dma buffers
21491b4e487SEugen Hristev  * @cur_frm:		current isc frame/buffer
21591b4e487SEugen Hristev  * @sequence:		current frame number
21691b4e487SEugen Hristev  * @stop:		true if isc is not streaming, false if streaming
21791b4e487SEugen Hristev  * @comp:		completion reference that signals frame completion
21891b4e487SEugen Hristev  *
21991b4e487SEugen Hristev  * @fmt:		current v42l format
22078ba0d79SEugen Hristev  * @try_fmt:		current v4l2 try format
22191b4e487SEugen Hristev  *
22291b4e487SEugen Hristev  * @config:		current ISC format configuration
22391b4e487SEugen Hristev  * @try_config:		the current ISC try format , not yet activated
22491b4e487SEugen Hristev  *
22591b4e487SEugen Hristev  * @ctrls:		holds information about ISC controls
22691b4e487SEugen Hristev  * @do_wb_ctrl:		control regarding the DO_WHITE_BALANCE button
22791b4e487SEugen Hristev  * @awb_work:		workqueue reference for autowhitebalance histogram
22891b4e487SEugen Hristev  *			analysis
22991b4e487SEugen Hristev  *
23091b4e487SEugen Hristev  * @lock:		lock for serializing userspace file operations
23191b4e487SEugen Hristev  *			with ISC operations
23291b4e487SEugen Hristev  * @awb_mutex:		serialize access to streaming status from awb work queue
23391b4e487SEugen Hristev  * @awb_lock:		lock for serializing awb work queue operations
23491b4e487SEugen Hristev  *			with DMA/buffer operations
23591b4e487SEugen Hristev  *
23691b4e487SEugen Hristev  * @pipeline:		configuration of the ISC pipeline
23791b4e487SEugen Hristev  *
23891b4e487SEugen Hristev  * @current_subdev:	current subdevice: the sensor
23991b4e487SEugen Hristev  * @subdev_entities:	list of subdevice entitites
24091b4e487SEugen Hristev  *
24191b4e487SEugen Hristev  * @gamma_table:	pointer to the table with gamma values, has
24291b4e487SEugen Hristev  *			gamma_max sets of GAMMA_ENTRIES entries each
24391b4e487SEugen Hristev  * @gamma_max:		maximum number of sets of inside the gamma_table
24491b4e487SEugen Hristev  *
24591b4e487SEugen Hristev  * @max_width:		maximum frame width, dependent on the internal RAM
24691b4e487SEugen Hristev  * @max_height:		maximum frame height, dependent on the internal RAM
24791b4e487SEugen Hristev  *
24891b4e487SEugen Hristev  * @config_dpc:		pointer to a function that initializes product
24991b4e487SEugen Hristev  *			specific DPC module
25091b4e487SEugen Hristev  * @config_csc:		pointer to a function that initializes product
25191b4e487SEugen Hristev  *			specific CSC module
25291b4e487SEugen Hristev  * @config_cbc:		pointer to a function that initializes product
25391b4e487SEugen Hristev  *			specific CBC module
25491b4e487SEugen Hristev  * @config_cc:		pointer to a function that initializes product
25591b4e487SEugen Hristev  *			specific CC module
25691b4e487SEugen Hristev  * @config_gam:		pointer to a function that initializes product
25791b4e487SEugen Hristev  *			specific GAMMA module
25891b4e487SEugen Hristev  * @config_rlp:		pointer to a function that initializes product
25991b4e487SEugen Hristev  *			specific RLP module
26091b4e487SEugen Hristev  * @config_ctrls:	pointer to a functoin that initializes product
26191b4e487SEugen Hristev  *			specific v4l2 controls.
26291b4e487SEugen Hristev  *
26391b4e487SEugen Hristev  * @adapt_pipeline:	pointer to a function that adapts the pipeline bits
26491b4e487SEugen Hristev  *			to the product specific pipeline
26591b4e487SEugen Hristev  *
26691b4e487SEugen Hristev  * @offsets:		struct holding the product specific register offsets
26791b4e487SEugen Hristev  * @controller_formats:	pointer to the array of possible formats that the
26891b4e487SEugen Hristev  *			controller can output
26991b4e487SEugen Hristev  * @formats_list:	pointer to the array of possible formats that can
27091b4e487SEugen Hristev  *			be used as an input to the controller
27191b4e487SEugen Hristev  * @controller_formats_size:	size of controller_formats array
27291b4e487SEugen Hristev  * @formats_list_size:	size of formats_list array
273920b2665SEugen Hristev  * @pads:		media controller pads for isc video entity
274920b2665SEugen Hristev  * @mdev:		media device that is registered by the isc
27578ba0d79SEugen Hristev  * @mpipe:		media device pipeline used by the isc
276920b2665SEugen Hristev  * @remote_pad:		remote pad on the connected subdevice
277920b2665SEugen Hristev  * @scaler_sd:		subdevice for the scaler that isc registers
278920b2665SEugen Hristev  * @scaler_pads:	media controller pads for the scaler subdevice
279920b2665SEugen Hristev  * @scaler_format:	current format for the scaler subdevice
28091b4e487SEugen Hristev  */
28191b4e487SEugen Hristev struct isc_device {
28291b4e487SEugen Hristev 	struct regmap		*regmap;
28391b4e487SEugen Hristev 	struct clk		*hclock;
28491b4e487SEugen Hristev 	struct clk		*ispck;
28591b4e487SEugen Hristev 	struct isc_clk		isc_clks[2];
28691b4e487SEugen Hristev 	bool			ispck_required;
28791b4e487SEugen Hristev 	u32			dcfg;
28891b4e487SEugen Hristev 
28991b4e487SEugen Hristev 	struct device		*dev;
29091b4e487SEugen Hristev 	struct v4l2_device	v4l2_dev;
29191b4e487SEugen Hristev 	struct video_device	video_dev;
29291b4e487SEugen Hristev 
29391b4e487SEugen Hristev 	struct vb2_queue	vb2_vidq;
29491b4e487SEugen Hristev 	spinlock_t		dma_queue_lock;
29591b4e487SEugen Hristev 	struct list_head	dma_queue;
29691b4e487SEugen Hristev 	struct isc_buffer	*cur_frm;
29791b4e487SEugen Hristev 	unsigned int		sequence;
29891b4e487SEugen Hristev 	bool			stop;
29991b4e487SEugen Hristev 	struct completion	comp;
30091b4e487SEugen Hristev 
30191b4e487SEugen Hristev 	struct v4l2_format	fmt;
30278ba0d79SEugen Hristev 	struct v4l2_format	try_fmt;
30391b4e487SEugen Hristev 
30491b4e487SEugen Hristev 	struct fmt_config	config;
30591b4e487SEugen Hristev 	struct fmt_config	try_config;
30691b4e487SEugen Hristev 
30791b4e487SEugen Hristev 	struct isc_ctrls	ctrls;
30891b4e487SEugen Hristev 	struct work_struct	awb_work;
30991b4e487SEugen Hristev 
31091b4e487SEugen Hristev 	struct mutex		lock;
31191b4e487SEugen Hristev 	struct mutex		awb_mutex;
31291b4e487SEugen Hristev 	spinlock_t		awb_lock;
31391b4e487SEugen Hristev 
31491b4e487SEugen Hristev 	struct regmap_field	*pipeline[ISC_PIPE_LINE_NODE_NUM];
31591b4e487SEugen Hristev 
31691b4e487SEugen Hristev 	struct isc_subdev_entity	*current_subdev;
31791b4e487SEugen Hristev 	struct list_head		subdev_entities;
31891b4e487SEugen Hristev 
31991b4e487SEugen Hristev 	struct {
32091b4e487SEugen Hristev #define ISC_CTRL_DO_WB 1
32191b4e487SEugen Hristev #define ISC_CTRL_R_GAIN 2
32291b4e487SEugen Hristev #define ISC_CTRL_B_GAIN 3
32391b4e487SEugen Hristev #define ISC_CTRL_GR_GAIN 4
32491b4e487SEugen Hristev #define ISC_CTRL_GB_GAIN 5
32591b4e487SEugen Hristev #define ISC_CTRL_R_OFF 6
32691b4e487SEugen Hristev #define ISC_CTRL_B_OFF 7
32791b4e487SEugen Hristev #define ISC_CTRL_GR_OFF 8
32891b4e487SEugen Hristev #define ISC_CTRL_GB_OFF 9
32991b4e487SEugen Hristev 		struct v4l2_ctrl	*awb_ctrl;
33091b4e487SEugen Hristev 		struct v4l2_ctrl	*do_wb_ctrl;
33191b4e487SEugen Hristev 		struct v4l2_ctrl	*r_gain_ctrl;
33291b4e487SEugen Hristev 		struct v4l2_ctrl	*b_gain_ctrl;
33391b4e487SEugen Hristev 		struct v4l2_ctrl	*gr_gain_ctrl;
33491b4e487SEugen Hristev 		struct v4l2_ctrl	*gb_gain_ctrl;
33591b4e487SEugen Hristev 		struct v4l2_ctrl	*r_off_ctrl;
33691b4e487SEugen Hristev 		struct v4l2_ctrl	*b_off_ctrl;
33791b4e487SEugen Hristev 		struct v4l2_ctrl	*gr_off_ctrl;
33891b4e487SEugen Hristev 		struct v4l2_ctrl	*gb_off_ctrl;
33991b4e487SEugen Hristev 	};
34091b4e487SEugen Hristev 
34191b4e487SEugen Hristev #define GAMMA_ENTRIES	64
34291b4e487SEugen Hristev 	/* pointer to the defined gamma table */
34391b4e487SEugen Hristev 	const u32	(*gamma_table)[GAMMA_ENTRIES];
34491b4e487SEugen Hristev 	u32		gamma_max;
34591b4e487SEugen Hristev 
34691b4e487SEugen Hristev 	u32		max_width;
34791b4e487SEugen Hristev 	u32		max_height;
34891b4e487SEugen Hristev 
34991b4e487SEugen Hristev 	struct {
35091b4e487SEugen Hristev 		void (*config_dpc)(struct isc_device *isc);
35191b4e487SEugen Hristev 		void (*config_csc)(struct isc_device *isc);
35291b4e487SEugen Hristev 		void (*config_cbc)(struct isc_device *isc);
35391b4e487SEugen Hristev 		void (*config_cc)(struct isc_device *isc);
35491b4e487SEugen Hristev 		void (*config_gam)(struct isc_device *isc);
35591b4e487SEugen Hristev 		void (*config_rlp)(struct isc_device *isc);
35691b4e487SEugen Hristev 
35791b4e487SEugen Hristev 		void (*config_ctrls)(struct isc_device *isc,
35891b4e487SEugen Hristev 				     const struct v4l2_ctrl_ops *ops);
35991b4e487SEugen Hristev 
36091b4e487SEugen Hristev 		void (*adapt_pipeline)(struct isc_device *isc);
36191b4e487SEugen Hristev 	};
36291b4e487SEugen Hristev 
36391b4e487SEugen Hristev 	struct isc_reg_offsets		offsets;
36491b4e487SEugen Hristev 	const struct isc_format		*controller_formats;
36591b4e487SEugen Hristev 	struct isc_format		*formats_list;
36691b4e487SEugen Hristev 	u32				controller_formats_size;
36791b4e487SEugen Hristev 	u32				formats_list_size;
368920b2665SEugen Hristev 
369920b2665SEugen Hristev 	struct {
370920b2665SEugen Hristev 		struct media_pad		pads[ISC_PADS_NUM];
371920b2665SEugen Hristev 		struct media_device		mdev;
37278ba0d79SEugen Hristev 		struct media_pipeline		mpipe;
373920b2665SEugen Hristev 
374920b2665SEugen Hristev 		u32				remote_pad;
375920b2665SEugen Hristev 	};
376920b2665SEugen Hristev 
377920b2665SEugen Hristev 	struct {
378920b2665SEugen Hristev 		struct v4l2_subdev		scaler_sd;
379920b2665SEugen Hristev 		struct media_pad		scaler_pads[ISC_SCALER_PADS_NUM];
380920b2665SEugen Hristev 		struct v4l2_mbus_framefmt	scaler_format[ISC_SCALER_PADS_NUM];
381920b2665SEugen Hristev 	};
38291b4e487SEugen Hristev };
38391b4e487SEugen Hristev 
38491b4e487SEugen Hristev extern const struct regmap_config microchip_isc_regmap_config;
38591b4e487SEugen Hristev extern const struct v4l2_async_notifier_operations microchip_isc_async_ops;
38691b4e487SEugen Hristev 
38791b4e487SEugen Hristev irqreturn_t microchip_isc_interrupt(int irq, void *dev_id);
38891b4e487SEugen Hristev int microchip_isc_pipeline_init(struct isc_device *isc);
38991b4e487SEugen Hristev int microchip_isc_clk_init(struct isc_device *isc);
39091b4e487SEugen Hristev void microchip_isc_subdev_cleanup(struct isc_device *isc);
39191b4e487SEugen Hristev void microchip_isc_clk_cleanup(struct isc_device *isc);
39291b4e487SEugen Hristev 
393920b2665SEugen Hristev int isc_scaler_link(struct isc_device *isc);
394920b2665SEugen Hristev int isc_scaler_init(struct isc_device *isc);
395920b2665SEugen Hristev int isc_mc_init(struct isc_device *isc, u32 ver);
396920b2665SEugen Hristev void isc_mc_cleanup(struct isc_device *isc);
397920b2665SEugen Hristev 
398920b2665SEugen Hristev struct isc_format *isc_find_format_by_code(struct isc_device *isc,
399920b2665SEugen Hristev 					   unsigned int code, int *index);
40091b4e487SEugen Hristev #endif
401