162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Microchip Image Sensor Controller (ISC) driver header file
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2016-2019 Microchip Technology, Inc.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Author: Songjun Wu
862306a36Sopenharmony_ci * Author: Eugen Hristev <eugen.hristev@microchip.com>
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci#ifndef _MICROCHIP_ISC_H_
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/clk-provider.h>
1462306a36Sopenharmony_ci#include <linux/platform_device.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#include <media/v4l2-ctrls.h>
1762306a36Sopenharmony_ci#include <media/v4l2-device.h>
1862306a36Sopenharmony_ci#include <media/videobuf2-dma-contig.h>
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define ISC_CLK_MAX_DIV		255
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cienum isc_clk_id {
2362306a36Sopenharmony_ci	ISC_ISPCK = 0,
2462306a36Sopenharmony_ci	ISC_MCK = 1,
2562306a36Sopenharmony_ci};
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistruct isc_clk {
2862306a36Sopenharmony_ci	struct clk_hw   hw;
2962306a36Sopenharmony_ci	struct clk      *clk;
3062306a36Sopenharmony_ci	struct regmap   *regmap;
3162306a36Sopenharmony_ci	spinlock_t	lock;	/* serialize access to clock registers */
3262306a36Sopenharmony_ci	u8		id;
3362306a36Sopenharmony_ci	u8		parent_id;
3462306a36Sopenharmony_ci	u32		div;
3562306a36Sopenharmony_ci	struct device	*dev;
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define to_isc_clk(v) container_of(v, struct isc_clk, hw)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_cistruct isc_buffer {
4162306a36Sopenharmony_ci	struct vb2_v4l2_buffer  vb;
4262306a36Sopenharmony_ci	struct list_head	list;
4362306a36Sopenharmony_ci};
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_cistruct isc_subdev_entity {
4662306a36Sopenharmony_ci	struct v4l2_subdev		*sd;
4762306a36Sopenharmony_ci	struct v4l2_async_connection	*asd;
4862306a36Sopenharmony_ci	struct device_node		*epn;
4962306a36Sopenharmony_ci	struct v4l2_async_notifier      notifier;
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci	u32 pfe_cfg0;
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci	struct list_head list;
5462306a36Sopenharmony_ci};
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci/*
5762306a36Sopenharmony_ci * struct isc_format - ISC media bus format information
5862306a36Sopenharmony_ci			This structure represents the interface between the ISC
5962306a36Sopenharmony_ci			and the sensor. It's the input format received by
6062306a36Sopenharmony_ci			the ISC.
6162306a36Sopenharmony_ci * @fourcc:		Fourcc code for this format
6262306a36Sopenharmony_ci * @mbus_code:		V4L2 media bus format code.
6362306a36Sopenharmony_ci * @cfa_baycfg:		If this format is RAW BAYER, indicate the type of bayer.
6462306a36Sopenharmony_ci			this is either BGBG, RGRG, etc.
6562306a36Sopenharmony_ci * @pfe_cfg0_bps:	Number of hardware data lines connected to the ISC
6662306a36Sopenharmony_ci * @raw:		If the format is raw bayer.
6762306a36Sopenharmony_ci */
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_cistruct isc_format {
7062306a36Sopenharmony_ci	u32	fourcc;
7162306a36Sopenharmony_ci	u32	mbus_code;
7262306a36Sopenharmony_ci	u32	cfa_baycfg;
7362306a36Sopenharmony_ci	u32	pfe_cfg0_bps;
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci	bool	raw;
7662306a36Sopenharmony_ci};
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci/* Pipeline bitmap */
7962306a36Sopenharmony_ci#define DPC_DPCENABLE	BIT(0)
8062306a36Sopenharmony_ci#define DPC_GDCENABLE	BIT(1)
8162306a36Sopenharmony_ci#define DPC_BLCENABLE	BIT(2)
8262306a36Sopenharmony_ci#define WB_ENABLE	BIT(3)
8362306a36Sopenharmony_ci#define CFA_ENABLE	BIT(4)
8462306a36Sopenharmony_ci#define CC_ENABLE	BIT(5)
8562306a36Sopenharmony_ci#define GAM_ENABLE	BIT(6)
8662306a36Sopenharmony_ci#define GAM_BENABLE	BIT(7)
8762306a36Sopenharmony_ci#define GAM_GENABLE	BIT(8)
8862306a36Sopenharmony_ci#define GAM_RENABLE	BIT(9)
8962306a36Sopenharmony_ci#define VHXS_ENABLE	BIT(10)
9062306a36Sopenharmony_ci#define CSC_ENABLE	BIT(11)
9162306a36Sopenharmony_ci#define CBC_ENABLE	BIT(12)
9262306a36Sopenharmony_ci#define SUB422_ENABLE	BIT(13)
9362306a36Sopenharmony_ci#define SUB420_ENABLE	BIT(14)
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci#define GAM_ENABLES	(GAM_RENABLE | GAM_GENABLE | GAM_BENABLE | GAM_ENABLE)
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/*
9862306a36Sopenharmony_ci * struct fmt_config - ISC format configuration and internal pipeline
9962306a36Sopenharmony_ci			This structure represents the internal configuration
10062306a36Sopenharmony_ci			of the ISC.
10162306a36Sopenharmony_ci			It also holds the format that ISC will present to v4l2.
10262306a36Sopenharmony_ci * @sd_format:		Pointer to an isc_format struct that holds the sensor
10362306a36Sopenharmony_ci			configuration.
10462306a36Sopenharmony_ci * @fourcc:		Fourcc code for this format.
10562306a36Sopenharmony_ci * @bpp:		Bytes per pixel in the current format.
10662306a36Sopenharmony_ci * @bpp_v4l2:		Bytes per pixel in the current format, for v4l2.
10762306a36Sopenharmony_ci			This differs from 'bpp' in the sense that in planar
10862306a36Sopenharmony_ci			formats, it refers only to the first plane.
10962306a36Sopenharmony_ci * @rlp_cfg_mode:	Configuration of the RLP (rounding, limiting packaging)
11062306a36Sopenharmony_ci * @dcfg_imode:		Configuration of the input of the DMA module
11162306a36Sopenharmony_ci * @dctrl_dview:	Configuration of the output of the DMA module
11262306a36Sopenharmony_ci * @bits_pipeline:	Configuration of the pipeline, which modules are enabled
11362306a36Sopenharmony_ci */
11462306a36Sopenharmony_cistruct fmt_config {
11562306a36Sopenharmony_ci	struct isc_format	*sd_format;
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci	u32			fourcc;
11862306a36Sopenharmony_ci	u8			bpp;
11962306a36Sopenharmony_ci	u8			bpp_v4l2;
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci	u32			rlp_cfg_mode;
12262306a36Sopenharmony_ci	u32			dcfg_imode;
12362306a36Sopenharmony_ci	u32			dctrl_dview;
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci	u32			bits_pipeline;
12662306a36Sopenharmony_ci};
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci#define HIST_ENTRIES		512
12962306a36Sopenharmony_ci#define HIST_BAYER		(ISC_HIS_CFG_MODE_B + 1)
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_cienum{
13262306a36Sopenharmony_ci	HIST_INIT = 0,
13362306a36Sopenharmony_ci	HIST_ENABLED,
13462306a36Sopenharmony_ci	HIST_DISABLED,
13562306a36Sopenharmony_ci};
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_cistruct isc_ctrls {
13862306a36Sopenharmony_ci	struct v4l2_ctrl_handler handler;
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci	u32 brightness;
14162306a36Sopenharmony_ci	u32 contrast;
14262306a36Sopenharmony_ci	u8 gamma_index;
14362306a36Sopenharmony_ci#define ISC_WB_NONE	0
14462306a36Sopenharmony_ci#define ISC_WB_AUTO	1
14562306a36Sopenharmony_ci#define ISC_WB_ONETIME	2
14662306a36Sopenharmony_ci	u8 awb;
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci	/* one for each component : GR, R, GB, B */
14962306a36Sopenharmony_ci	u32 gain[HIST_BAYER];
15062306a36Sopenharmony_ci	s32 offset[HIST_BAYER];
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci	u32 hist_entry[HIST_ENTRIES];
15362306a36Sopenharmony_ci	u32 hist_count[HIST_BAYER];
15462306a36Sopenharmony_ci	u8 hist_id;
15562306a36Sopenharmony_ci	u8 hist_stat;
15662306a36Sopenharmony_ci#define HIST_MIN_INDEX		0
15762306a36Sopenharmony_ci#define HIST_MAX_INDEX		1
15862306a36Sopenharmony_ci	u32 hist_minmax[HIST_BAYER][2];
15962306a36Sopenharmony_ci};
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci#define ISC_PIPE_LINE_NODE_NUM	15
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci/*
16462306a36Sopenharmony_ci * struct isc_reg_offsets - ISC device register offsets
16562306a36Sopenharmony_ci * @csc:		Offset for the CSC register
16662306a36Sopenharmony_ci * @cbc:		Offset for the CBC register
16762306a36Sopenharmony_ci * @sub422:		Offset for the SUB422 register
16862306a36Sopenharmony_ci * @sub420:		Offset for the SUB420 register
16962306a36Sopenharmony_ci * @rlp:		Offset for the RLP register
17062306a36Sopenharmony_ci * @his:		Offset for the HIS related registers
17162306a36Sopenharmony_ci * @dma:		Offset for the DMA related registers
17262306a36Sopenharmony_ci * @version:		Offset for the version register
17362306a36Sopenharmony_ci * @his_entry:		Offset for the HIS entries registers
17462306a36Sopenharmony_ci */
17562306a36Sopenharmony_cistruct isc_reg_offsets {
17662306a36Sopenharmony_ci	u32 csc;
17762306a36Sopenharmony_ci	u32 cbc;
17862306a36Sopenharmony_ci	u32 sub422;
17962306a36Sopenharmony_ci	u32 sub420;
18062306a36Sopenharmony_ci	u32 rlp;
18162306a36Sopenharmony_ci	u32 his;
18262306a36Sopenharmony_ci	u32 dma;
18362306a36Sopenharmony_ci	u32 version;
18462306a36Sopenharmony_ci	u32 his_entry;
18562306a36Sopenharmony_ci};
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_cienum isc_mc_pads {
18862306a36Sopenharmony_ci	ISC_PAD_SINK	= 0,
18962306a36Sopenharmony_ci	ISC_PADS_NUM	= 1,
19062306a36Sopenharmony_ci};
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_cienum isc_scaler_pads {
19362306a36Sopenharmony_ci	ISC_SCALER_PAD_SINK	= 0,
19462306a36Sopenharmony_ci	ISC_SCALER_PAD_SOURCE	= 1,
19562306a36Sopenharmony_ci	ISC_SCALER_PADS_NUM	= 2,
19662306a36Sopenharmony_ci};
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci/*
19962306a36Sopenharmony_ci * struct isc_device - ISC device driver data/config struct
20062306a36Sopenharmony_ci * @regmap:		Register map
20162306a36Sopenharmony_ci * @hclock:		Hclock clock input (refer datasheet)
20262306a36Sopenharmony_ci * @ispck:		iscpck clock (refer datasheet)
20362306a36Sopenharmony_ci * @isc_clks:		ISC clocks
20462306a36Sopenharmony_ci * @ispck_required:	ISC requires ISP Clock initialization
20562306a36Sopenharmony_ci * @dcfg:		DMA master configuration, architecture dependent
20662306a36Sopenharmony_ci *
20762306a36Sopenharmony_ci * @dev:		Registered device driver
20862306a36Sopenharmony_ci * @v4l2_dev:		v4l2 registered device
20962306a36Sopenharmony_ci * @video_dev:		registered video device
21062306a36Sopenharmony_ci *
21162306a36Sopenharmony_ci * @vb2_vidq:		video buffer 2 video queue
21262306a36Sopenharmony_ci * @dma_queue_lock:	lock to serialize the dma buffer queue
21362306a36Sopenharmony_ci * @dma_queue:		the queue for dma buffers
21462306a36Sopenharmony_ci * @cur_frm:		current isc frame/buffer
21562306a36Sopenharmony_ci * @sequence:		current frame number
21662306a36Sopenharmony_ci * @stop:		true if isc is not streaming, false if streaming
21762306a36Sopenharmony_ci * @comp:		completion reference that signals frame completion
21862306a36Sopenharmony_ci *
21962306a36Sopenharmony_ci * @fmt:		current v42l format
22062306a36Sopenharmony_ci * @try_fmt:		current v4l2 try format
22162306a36Sopenharmony_ci *
22262306a36Sopenharmony_ci * @config:		current ISC format configuration
22362306a36Sopenharmony_ci * @try_config:		the current ISC try format , not yet activated
22462306a36Sopenharmony_ci *
22562306a36Sopenharmony_ci * @ctrls:		holds information about ISC controls
22662306a36Sopenharmony_ci * @do_wb_ctrl:		control regarding the DO_WHITE_BALANCE button
22762306a36Sopenharmony_ci * @awb_work:		workqueue reference for autowhitebalance histogram
22862306a36Sopenharmony_ci *			analysis
22962306a36Sopenharmony_ci *
23062306a36Sopenharmony_ci * @lock:		lock for serializing userspace file operations
23162306a36Sopenharmony_ci *			with ISC operations
23262306a36Sopenharmony_ci * @awb_mutex:		serialize access to streaming status from awb work queue
23362306a36Sopenharmony_ci * @awb_lock:		lock for serializing awb work queue operations
23462306a36Sopenharmony_ci *			with DMA/buffer operations
23562306a36Sopenharmony_ci *
23662306a36Sopenharmony_ci * @pipeline:		configuration of the ISC pipeline
23762306a36Sopenharmony_ci *
23862306a36Sopenharmony_ci * @current_subdev:	current subdevice: the sensor
23962306a36Sopenharmony_ci * @subdev_entities:	list of subdevice entitites
24062306a36Sopenharmony_ci *
24162306a36Sopenharmony_ci * @gamma_table:	pointer to the table with gamma values, has
24262306a36Sopenharmony_ci *			gamma_max sets of GAMMA_ENTRIES entries each
24362306a36Sopenharmony_ci * @gamma_max:		maximum number of sets of inside the gamma_table
24462306a36Sopenharmony_ci *
24562306a36Sopenharmony_ci * @max_width:		maximum frame width, dependent on the internal RAM
24662306a36Sopenharmony_ci * @max_height:		maximum frame height, dependent on the internal RAM
24762306a36Sopenharmony_ci *
24862306a36Sopenharmony_ci * @config_dpc:		pointer to a function that initializes product
24962306a36Sopenharmony_ci *			specific DPC module
25062306a36Sopenharmony_ci * @config_csc:		pointer to a function that initializes product
25162306a36Sopenharmony_ci *			specific CSC module
25262306a36Sopenharmony_ci * @config_cbc:		pointer to a function that initializes product
25362306a36Sopenharmony_ci *			specific CBC module
25462306a36Sopenharmony_ci * @config_cc:		pointer to a function that initializes product
25562306a36Sopenharmony_ci *			specific CC module
25662306a36Sopenharmony_ci * @config_gam:		pointer to a function that initializes product
25762306a36Sopenharmony_ci *			specific GAMMA module
25862306a36Sopenharmony_ci * @config_rlp:		pointer to a function that initializes product
25962306a36Sopenharmony_ci *			specific RLP module
26062306a36Sopenharmony_ci * @config_ctrls:	pointer to a functoin that initializes product
26162306a36Sopenharmony_ci *			specific v4l2 controls.
26262306a36Sopenharmony_ci *
26362306a36Sopenharmony_ci * @adapt_pipeline:	pointer to a function that adapts the pipeline bits
26462306a36Sopenharmony_ci *			to the product specific pipeline
26562306a36Sopenharmony_ci *
26662306a36Sopenharmony_ci * @offsets:		struct holding the product specific register offsets
26762306a36Sopenharmony_ci * @controller_formats:	pointer to the array of possible formats that the
26862306a36Sopenharmony_ci *			controller can output
26962306a36Sopenharmony_ci * @formats_list:	pointer to the array of possible formats that can
27062306a36Sopenharmony_ci *			be used as an input to the controller
27162306a36Sopenharmony_ci * @controller_formats_size:	size of controller_formats array
27262306a36Sopenharmony_ci * @formats_list_size:	size of formats_list array
27362306a36Sopenharmony_ci * @pads:		media controller pads for isc video entity
27462306a36Sopenharmony_ci * @mdev:		media device that is registered by the isc
27562306a36Sopenharmony_ci * @mpipe:		media device pipeline used by the isc
27662306a36Sopenharmony_ci * @remote_pad:		remote pad on the connected subdevice
27762306a36Sopenharmony_ci * @scaler_sd:		subdevice for the scaler that isc registers
27862306a36Sopenharmony_ci * @scaler_pads:	media controller pads for the scaler subdevice
27962306a36Sopenharmony_ci * @scaler_format:	current format for the scaler subdevice
28062306a36Sopenharmony_ci */
28162306a36Sopenharmony_cistruct isc_device {
28262306a36Sopenharmony_ci	struct regmap		*regmap;
28362306a36Sopenharmony_ci	struct clk		*hclock;
28462306a36Sopenharmony_ci	struct clk		*ispck;
28562306a36Sopenharmony_ci	struct isc_clk		isc_clks[2];
28662306a36Sopenharmony_ci	bool			ispck_required;
28762306a36Sopenharmony_ci	u32			dcfg;
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci	struct device		*dev;
29062306a36Sopenharmony_ci	struct v4l2_device	v4l2_dev;
29162306a36Sopenharmony_ci	struct video_device	video_dev;
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci	struct vb2_queue	vb2_vidq;
29462306a36Sopenharmony_ci	spinlock_t		dma_queue_lock;
29562306a36Sopenharmony_ci	struct list_head	dma_queue;
29662306a36Sopenharmony_ci	struct isc_buffer	*cur_frm;
29762306a36Sopenharmony_ci	unsigned int		sequence;
29862306a36Sopenharmony_ci	bool			stop;
29962306a36Sopenharmony_ci	struct completion	comp;
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci	struct v4l2_format	fmt;
30262306a36Sopenharmony_ci	struct v4l2_format	try_fmt;
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci	struct fmt_config	config;
30562306a36Sopenharmony_ci	struct fmt_config	try_config;
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci	struct isc_ctrls	ctrls;
30862306a36Sopenharmony_ci	struct work_struct	awb_work;
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci	struct mutex		lock;
31162306a36Sopenharmony_ci	struct mutex		awb_mutex;
31262306a36Sopenharmony_ci	spinlock_t		awb_lock;
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci	struct regmap_field	*pipeline[ISC_PIPE_LINE_NODE_NUM];
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci	struct isc_subdev_entity	*current_subdev;
31762306a36Sopenharmony_ci	struct list_head		subdev_entities;
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci	struct {
32062306a36Sopenharmony_ci#define ISC_CTRL_DO_WB 1
32162306a36Sopenharmony_ci#define ISC_CTRL_R_GAIN 2
32262306a36Sopenharmony_ci#define ISC_CTRL_B_GAIN 3
32362306a36Sopenharmony_ci#define ISC_CTRL_GR_GAIN 4
32462306a36Sopenharmony_ci#define ISC_CTRL_GB_GAIN 5
32562306a36Sopenharmony_ci#define ISC_CTRL_R_OFF 6
32662306a36Sopenharmony_ci#define ISC_CTRL_B_OFF 7
32762306a36Sopenharmony_ci#define ISC_CTRL_GR_OFF 8
32862306a36Sopenharmony_ci#define ISC_CTRL_GB_OFF 9
32962306a36Sopenharmony_ci		struct v4l2_ctrl	*awb_ctrl;
33062306a36Sopenharmony_ci		struct v4l2_ctrl	*do_wb_ctrl;
33162306a36Sopenharmony_ci		struct v4l2_ctrl	*r_gain_ctrl;
33262306a36Sopenharmony_ci		struct v4l2_ctrl	*b_gain_ctrl;
33362306a36Sopenharmony_ci		struct v4l2_ctrl	*gr_gain_ctrl;
33462306a36Sopenharmony_ci		struct v4l2_ctrl	*gb_gain_ctrl;
33562306a36Sopenharmony_ci		struct v4l2_ctrl	*r_off_ctrl;
33662306a36Sopenharmony_ci		struct v4l2_ctrl	*b_off_ctrl;
33762306a36Sopenharmony_ci		struct v4l2_ctrl	*gr_off_ctrl;
33862306a36Sopenharmony_ci		struct v4l2_ctrl	*gb_off_ctrl;
33962306a36Sopenharmony_ci	};
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci#define GAMMA_ENTRIES	64
34262306a36Sopenharmony_ci	/* pointer to the defined gamma table */
34362306a36Sopenharmony_ci	const u32	(*gamma_table)[GAMMA_ENTRIES];
34462306a36Sopenharmony_ci	u32		gamma_max;
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci	u32		max_width;
34762306a36Sopenharmony_ci	u32		max_height;
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci	struct {
35062306a36Sopenharmony_ci		void (*config_dpc)(struct isc_device *isc);
35162306a36Sopenharmony_ci		void (*config_csc)(struct isc_device *isc);
35262306a36Sopenharmony_ci		void (*config_cbc)(struct isc_device *isc);
35362306a36Sopenharmony_ci		void (*config_cc)(struct isc_device *isc);
35462306a36Sopenharmony_ci		void (*config_gam)(struct isc_device *isc);
35562306a36Sopenharmony_ci		void (*config_rlp)(struct isc_device *isc);
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_ci		void (*config_ctrls)(struct isc_device *isc,
35862306a36Sopenharmony_ci				     const struct v4l2_ctrl_ops *ops);
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci		void (*adapt_pipeline)(struct isc_device *isc);
36162306a36Sopenharmony_ci	};
36262306a36Sopenharmony_ci
36362306a36Sopenharmony_ci	struct isc_reg_offsets		offsets;
36462306a36Sopenharmony_ci	const struct isc_format		*controller_formats;
36562306a36Sopenharmony_ci	struct isc_format		*formats_list;
36662306a36Sopenharmony_ci	u32				controller_formats_size;
36762306a36Sopenharmony_ci	u32				formats_list_size;
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci	struct {
37062306a36Sopenharmony_ci		struct media_pad		pads[ISC_PADS_NUM];
37162306a36Sopenharmony_ci		struct media_device		mdev;
37262306a36Sopenharmony_ci		struct media_pipeline		mpipe;
37362306a36Sopenharmony_ci
37462306a36Sopenharmony_ci		u32				remote_pad;
37562306a36Sopenharmony_ci	};
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_ci	struct {
37862306a36Sopenharmony_ci		struct v4l2_subdev		scaler_sd;
37962306a36Sopenharmony_ci		struct media_pad		scaler_pads[ISC_SCALER_PADS_NUM];
38062306a36Sopenharmony_ci		struct v4l2_mbus_framefmt	scaler_format[ISC_SCALER_PADS_NUM];
38162306a36Sopenharmony_ci	};
38262306a36Sopenharmony_ci};
38362306a36Sopenharmony_ci
38462306a36Sopenharmony_ciextern const struct regmap_config microchip_isc_regmap_config;
38562306a36Sopenharmony_ciextern const struct v4l2_async_notifier_operations microchip_isc_async_ops;
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ciirqreturn_t microchip_isc_interrupt(int irq, void *dev_id);
38862306a36Sopenharmony_ciint microchip_isc_pipeline_init(struct isc_device *isc);
38962306a36Sopenharmony_ciint microchip_isc_clk_init(struct isc_device *isc);
39062306a36Sopenharmony_civoid microchip_isc_subdev_cleanup(struct isc_device *isc);
39162306a36Sopenharmony_civoid microchip_isc_clk_cleanup(struct isc_device *isc);
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ciint isc_scaler_link(struct isc_device *isc);
39462306a36Sopenharmony_ciint isc_scaler_init(struct isc_device *isc);
39562306a36Sopenharmony_ciint isc_mc_init(struct isc_device *isc, u32 ver);
39662306a36Sopenharmony_civoid isc_mc_cleanup(struct isc_device *isc);
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_cistruct isc_format *isc_find_format_by_code(struct isc_device *isc,
39962306a36Sopenharmony_ci					   unsigned int code, int *index);
40062306a36Sopenharmony_ci#endif
401