18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2013 Texas Instruments Inc.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * David Griego, <dagriego@biglakesoftware.com>
68c2ecf20Sopenharmony_ci * Dale Farnsworth, <dale@farnsworth.org>
78c2ecf20Sopenharmony_ci * Archit Taneja, <archit@ti.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef _TI_VPDMA_PRIV_H_
118c2ecf20Sopenharmony_ci#define _TI_VPDMA_PRIV_H_
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci * VPDMA Register offsets
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Top level */
188c2ecf20Sopenharmony_ci#define VPDMA_PID		0x00
198c2ecf20Sopenharmony_ci#define VPDMA_LIST_ADDR		0x04
208c2ecf20Sopenharmony_ci#define VPDMA_LIST_ATTR		0x08
218c2ecf20Sopenharmony_ci#define VPDMA_LIST_STAT_SYNC	0x0c
228c2ecf20Sopenharmony_ci#define VPDMA_BG_RGB		0x18
238c2ecf20Sopenharmony_ci#define VPDMA_BG_YUV		0x1c
248c2ecf20Sopenharmony_ci#define VPDMA_SETUP		0x30
258c2ecf20Sopenharmony_ci#define VPDMA_MAX_SIZE1		0x34
268c2ecf20Sopenharmony_ci#define VPDMA_MAX_SIZE2		0x38
278c2ecf20Sopenharmony_ci#define VPDMA_MAX_SIZE3		0x3c
288c2ecf20Sopenharmony_ci#define VPDMA_MAX_SIZE_WIDTH_MASK	0xffff
298c2ecf20Sopenharmony_ci#define VPDMA_MAX_SIZE_WIDTH_SHFT	16
308c2ecf20Sopenharmony_ci#define VPDMA_MAX_SIZE_HEIGHT_MASK	0xffff
318c2ecf20Sopenharmony_ci#define VPDMA_MAX_SIZE_HEIGHT_SHFT	0
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* Interrupts */
348c2ecf20Sopenharmony_ci#define VPDMA_INT_CHAN_STAT(grp)	(0x40 + grp * 8)
358c2ecf20Sopenharmony_ci#define VPDMA_INT_CHAN_MASK(grp)	(VPDMA_INT_CHAN_STAT(grp) + 4)
368c2ecf20Sopenharmony_ci#define VPDMA_INT_CLIENT0_STAT		0x78
378c2ecf20Sopenharmony_ci#define VPDMA_INT_CLIENT0_MASK		0x7c
388c2ecf20Sopenharmony_ci#define VPDMA_INT_CLIENT1_STAT		0x80
398c2ecf20Sopenharmony_ci#define VPDMA_INT_CLIENT1_MASK		0x84
408c2ecf20Sopenharmony_ci#define VPDMA_INT_LIST0_STAT		0x88
418c2ecf20Sopenharmony_ci#define VPDMA_INT_LIST0_MASK		0x8c
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define VPDMA_INTX_OFFSET		0x50
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define VPDMA_PERFMON(i)		(0x200 + i * 4)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* VIP/VPE client registers */
488c2ecf20Sopenharmony_ci#define VPDMA_DEI_CHROMA1_CSTAT		0x0300
498c2ecf20Sopenharmony_ci#define VPDMA_DEI_LUMA1_CSTAT		0x0304
508c2ecf20Sopenharmony_ci#define VPDMA_DEI_LUMA2_CSTAT		0x0308
518c2ecf20Sopenharmony_ci#define VPDMA_DEI_CHROMA2_CSTAT		0x030c
528c2ecf20Sopenharmony_ci#define VPDMA_DEI_LUMA3_CSTAT		0x0310
538c2ecf20Sopenharmony_ci#define VPDMA_DEI_CHROMA3_CSTAT		0x0314
548c2ecf20Sopenharmony_ci#define VPDMA_DEI_MV_IN_CSTAT		0x0330
558c2ecf20Sopenharmony_ci#define VPDMA_DEI_MV_OUT_CSTAT		0x033c
568c2ecf20Sopenharmony_ci#define VPDMA_VIP_LO_Y_CSTAT		0x0388
578c2ecf20Sopenharmony_ci#define VPDMA_VIP_LO_UV_CSTAT		0x038c
588c2ecf20Sopenharmony_ci#define VPDMA_VIP_UP_Y_CSTAT		0x0390
598c2ecf20Sopenharmony_ci#define VPDMA_VIP_UP_UV_CSTAT		0x0394
608c2ecf20Sopenharmony_ci#define VPDMA_VPI_CTL_CSTAT		0x03d0
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* Reg field info for VPDMA_CLIENT_CSTAT registers */
638c2ecf20Sopenharmony_ci#define VPDMA_CSTAT_LINE_MODE_MASK	0x03
648c2ecf20Sopenharmony_ci#define VPDMA_CSTAT_LINE_MODE_SHIFT	8
658c2ecf20Sopenharmony_ci#define VPDMA_CSTAT_FRAME_START_MASK	0xf
668c2ecf20Sopenharmony_ci#define VPDMA_CSTAT_FRAME_START_SHIFT	10
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define VPDMA_LIST_NUM_MASK		0x07
698c2ecf20Sopenharmony_ci#define VPDMA_LIST_NUM_SHFT		24
708c2ecf20Sopenharmony_ci#define VPDMA_LIST_STOP_SHFT		20
718c2ecf20Sopenharmony_ci#define VPDMA_LIST_RDY_MASK		0x01
728c2ecf20Sopenharmony_ci#define VPDMA_LIST_RDY_SHFT		19
738c2ecf20Sopenharmony_ci#define VPDMA_LIST_TYPE_MASK		0x03
748c2ecf20Sopenharmony_ci#define VPDMA_LIST_TYPE_SHFT		16
758c2ecf20Sopenharmony_ci#define VPDMA_LIST_SIZE_MASK		0xffff
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/*
788c2ecf20Sopenharmony_ci * The YUV data type definition below are taken from
798c2ecf20Sopenharmony_ci * both the TRM and i839 Errata information.
808c2ecf20Sopenharmony_ci * Use the correct data type considering byte
818c2ecf20Sopenharmony_ci * reordering of components.
828c2ecf20Sopenharmony_ci *
838c2ecf20Sopenharmony_ci * Also since the single use of "C" in the 422 case
848c2ecf20Sopenharmony_ci * to mean "Cr" (i.e. V component). It was decided
858c2ecf20Sopenharmony_ci * to explicitly label them CR to remove any confusion.
868c2ecf20Sopenharmony_ci * Bear in mind that the type label refer to the memory
878c2ecf20Sopenharmony_ci * packed order (LSB - MSB).
888c2ecf20Sopenharmony_ci */
898c2ecf20Sopenharmony_ci#define DATA_TYPE_Y444				0x0
908c2ecf20Sopenharmony_ci#define DATA_TYPE_Y422				0x1
918c2ecf20Sopenharmony_ci#define DATA_TYPE_Y420				0x2
928c2ecf20Sopenharmony_ci#define DATA_TYPE_C444				0x4
938c2ecf20Sopenharmony_ci#define DATA_TYPE_C422				0x5
948c2ecf20Sopenharmony_ci#define DATA_TYPE_C420				0x6
958c2ecf20Sopenharmony_ci#define DATA_TYPE_CB420				0x16
968c2ecf20Sopenharmony_ci#define DATA_TYPE_YC444				0x8
978c2ecf20Sopenharmony_ci#define DATA_TYPE_YCB422			0x7
988c2ecf20Sopenharmony_ci#define DATA_TYPE_YCR422			0x17
998c2ecf20Sopenharmony_ci#define DATA_TYPE_CBY422			0x27
1008c2ecf20Sopenharmony_ci#define DATA_TYPE_CRY422			0x37
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/*
1038c2ecf20Sopenharmony_ci * The RGB data type definition below are defined
1048c2ecf20Sopenharmony_ci * to follow Errata i819.
1058c2ecf20Sopenharmony_ci * The initial values were taken from:
1068c2ecf20Sopenharmony_ci * VPDMA_data_type_mapping_v0.2vayu_c.pdf
1078c2ecf20Sopenharmony_ci * But some of the ARGB definition appeared to be wrong
1088c2ecf20Sopenharmony_ci * in the document also. As they would yield RGBA instead.
1098c2ecf20Sopenharmony_ci * They have been corrected based on experimentation.
1108c2ecf20Sopenharmony_ci */
1118c2ecf20Sopenharmony_ci#define DATA_TYPE_RGB16_565			0x10
1128c2ecf20Sopenharmony_ci#define DATA_TYPE_ARGB_1555			0x13
1138c2ecf20Sopenharmony_ci#define DATA_TYPE_ARGB_4444			0x14
1148c2ecf20Sopenharmony_ci#define DATA_TYPE_RGBA_5551			0x11
1158c2ecf20Sopenharmony_ci#define DATA_TYPE_RGBA_4444			0x12
1168c2ecf20Sopenharmony_ci#define DATA_TYPE_ARGB24_6666			0x18
1178c2ecf20Sopenharmony_ci#define DATA_TYPE_RGB24_888			0x16
1188c2ecf20Sopenharmony_ci#define DATA_TYPE_ARGB32_8888			0x17
1198c2ecf20Sopenharmony_ci#define DATA_TYPE_RGBA24_6666			0x15
1208c2ecf20Sopenharmony_ci#define DATA_TYPE_RGBA32_8888			0x19
1218c2ecf20Sopenharmony_ci#define DATA_TYPE_BGR16_565			0x0
1228c2ecf20Sopenharmony_ci#define DATA_TYPE_ABGR_1555			0x3
1238c2ecf20Sopenharmony_ci#define DATA_TYPE_ABGR_4444			0x4
1248c2ecf20Sopenharmony_ci#define DATA_TYPE_BGRA_5551			0x1
1258c2ecf20Sopenharmony_ci#define DATA_TYPE_BGRA_4444			0x2
1268c2ecf20Sopenharmony_ci#define DATA_TYPE_ABGR24_6666			0x8
1278c2ecf20Sopenharmony_ci#define DATA_TYPE_BGR24_888			0x6
1288c2ecf20Sopenharmony_ci#define DATA_TYPE_ABGR32_8888			0x7
1298c2ecf20Sopenharmony_ci#define DATA_TYPE_BGRA24_6666			0x5
1308c2ecf20Sopenharmony_ci#define DATA_TYPE_BGRA32_8888			0x9
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci#define DATA_TYPE_MV				0x3
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/* VPDMA channel numbers, some are common between VIP/VPE and appear twice */
1358c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_LUMA1_IN		0
1368c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_CHROMA1_IN		1
1378c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_LUMA2_IN		2
1388c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_CHROMA2_IN		3
1398c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_LUMA3_IN		4
1408c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_CHROMA3_IN		5
1418c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_MV_IN		12
1428c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_MV_OUT		15
1438c2ecf20Sopenharmony_ci#define VIP1_CHAN_NUM_MULT_PORT_A_SRC0	38
1448c2ecf20Sopenharmony_ci#define VIP1_CHAN_NUM_MULT_ANC_A_SRC0	70
1458c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_LUMA_OUT		102
1468c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_CHROMA_OUT		103
1478c2ecf20Sopenharmony_ci#define VIP1_CHAN_NUM_PORT_A_LUMA	102
1488c2ecf20Sopenharmony_ci#define VIP1_CHAN_NUM_PORT_A_CHROMA	103
1498c2ecf20Sopenharmony_ci#define	VPE_CHAN_NUM_RGB_OUT		106
1508c2ecf20Sopenharmony_ci#define VIP1_CHAN_NUM_PORT_A_RGB	106
1518c2ecf20Sopenharmony_ci#define VIP1_CHAN_NUM_PORT_B_RGB	107
1528c2ecf20Sopenharmony_ci/*
1538c2ecf20Sopenharmony_ci * a VPDMA address data block payload for a configuration descriptor needs to
1548c2ecf20Sopenharmony_ci * have each sub block length as a multiple of 16 bytes. Therefore, the overall
1558c2ecf20Sopenharmony_ci * size of the payload also needs to be a multiple of 16 bytes. The sub block
1568c2ecf20Sopenharmony_ci * lengths should be ensured to be aligned by the VPDMA user.
1578c2ecf20Sopenharmony_ci */
1588c2ecf20Sopenharmony_ci#define VPDMA_ADB_SIZE_ALIGN		0x0f
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/*
1618c2ecf20Sopenharmony_ci * data transfer descriptor
1628c2ecf20Sopenharmony_ci */
1638c2ecf20Sopenharmony_cistruct vpdma_dtd {
1648c2ecf20Sopenharmony_ci	u32			type_ctl_stride;
1658c2ecf20Sopenharmony_ci	union {
1668c2ecf20Sopenharmony_ci		u32		xfer_length_height;
1678c2ecf20Sopenharmony_ci		u32		w1;
1688c2ecf20Sopenharmony_ci	};
1698c2ecf20Sopenharmony_ci	u32			start_addr;
1708c2ecf20Sopenharmony_ci	u32			pkt_ctl;
1718c2ecf20Sopenharmony_ci	union {
1728c2ecf20Sopenharmony_ci		u32		frame_width_height;	/* inbound */
1738c2ecf20Sopenharmony_ci		u32		desc_write_addr;	/* outbound */
1748c2ecf20Sopenharmony_ci	};
1758c2ecf20Sopenharmony_ci	union {
1768c2ecf20Sopenharmony_ci		u32		start_h_v;		/* inbound */
1778c2ecf20Sopenharmony_ci		u32		max_width_height;	/* outbound */
1788c2ecf20Sopenharmony_ci	};
1798c2ecf20Sopenharmony_ci	u32			client_attr0;
1808c2ecf20Sopenharmony_ci	u32			client_attr1;
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* Data Transfer Descriptor specifics */
1848c2ecf20Sopenharmony_ci#define DTD_NO_NOTIFY		0
1858c2ecf20Sopenharmony_ci#define DTD_NOTIFY		1
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci#define DTD_PKT_TYPE		0xa
1888c2ecf20Sopenharmony_ci#define DTD_DIR_IN		0
1898c2ecf20Sopenharmony_ci#define DTD_DIR_OUT		1
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci/* type_ctl_stride */
1928c2ecf20Sopenharmony_ci#define DTD_DATA_TYPE_MASK	0x3f
1938c2ecf20Sopenharmony_ci#define DTD_DATA_TYPE_SHFT	26
1948c2ecf20Sopenharmony_ci#define DTD_NOTIFY_MASK		0x01
1958c2ecf20Sopenharmony_ci#define DTD_NOTIFY_SHFT		25
1968c2ecf20Sopenharmony_ci#define DTD_FIELD_MASK		0x01
1978c2ecf20Sopenharmony_ci#define DTD_FIELD_SHFT		24
1988c2ecf20Sopenharmony_ci#define DTD_1D_MASK		0x01
1998c2ecf20Sopenharmony_ci#define DTD_1D_SHFT		23
2008c2ecf20Sopenharmony_ci#define DTD_EVEN_LINE_SKIP_MASK	0x01
2018c2ecf20Sopenharmony_ci#define DTD_EVEN_LINE_SKIP_SHFT	20
2028c2ecf20Sopenharmony_ci#define DTD_ODD_LINE_SKIP_MASK	0x01
2038c2ecf20Sopenharmony_ci#define DTD_ODD_LINE_SKIP_SHFT	16
2048c2ecf20Sopenharmony_ci#define DTD_LINE_STRIDE_MASK	0xffff
2058c2ecf20Sopenharmony_ci#define DTD_LINE_STRIDE_SHFT	0
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/* xfer_length_height */
2088c2ecf20Sopenharmony_ci#define DTD_LINE_LENGTH_MASK	0xffff
2098c2ecf20Sopenharmony_ci#define DTD_LINE_LENGTH_SHFT	16
2108c2ecf20Sopenharmony_ci#define DTD_XFER_HEIGHT_MASK	0xffff
2118c2ecf20Sopenharmony_ci#define DTD_XFER_HEIGHT_SHFT	0
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci/* pkt_ctl */
2148c2ecf20Sopenharmony_ci#define DTD_PKT_TYPE_MASK	0x1f
2158c2ecf20Sopenharmony_ci#define DTD_PKT_TYPE_SHFT	27
2168c2ecf20Sopenharmony_ci#define DTD_MODE_MASK		0x01
2178c2ecf20Sopenharmony_ci#define DTD_MODE_SHFT		26
2188c2ecf20Sopenharmony_ci#define DTD_DIR_MASK		0x01
2198c2ecf20Sopenharmony_ci#define DTD_DIR_SHFT		25
2208c2ecf20Sopenharmony_ci#define DTD_CHAN_MASK		0x01ff
2218c2ecf20Sopenharmony_ci#define DTD_CHAN_SHFT		16
2228c2ecf20Sopenharmony_ci#define DTD_PRI_MASK		0x0f
2238c2ecf20Sopenharmony_ci#define DTD_PRI_SHFT		9
2248c2ecf20Sopenharmony_ci#define DTD_NEXT_CHAN_MASK	0x01ff
2258c2ecf20Sopenharmony_ci#define DTD_NEXT_CHAN_SHFT	0
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci/* frame_width_height */
2288c2ecf20Sopenharmony_ci#define DTD_FRAME_WIDTH_MASK	0xffff
2298c2ecf20Sopenharmony_ci#define DTD_FRAME_WIDTH_SHFT	16
2308c2ecf20Sopenharmony_ci#define DTD_FRAME_HEIGHT_MASK	0xffff
2318c2ecf20Sopenharmony_ci#define DTD_FRAME_HEIGHT_SHFT	0
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci/* start_h_v */
2348c2ecf20Sopenharmony_ci#define DTD_H_START_MASK	0xffff
2358c2ecf20Sopenharmony_ci#define DTD_H_START_SHFT	16
2368c2ecf20Sopenharmony_ci#define DTD_V_START_MASK	0xffff
2378c2ecf20Sopenharmony_ci#define DTD_V_START_SHFT	0
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci#define DTD_DESC_START_MASK	0xffffffe0
2408c2ecf20Sopenharmony_ci#define DTD_DESC_START_SHIFT	5
2418c2ecf20Sopenharmony_ci#define DTD_WRITE_DESC_MASK	0x01
2428c2ecf20Sopenharmony_ci#define DTD_WRITE_DESC_SHIFT	2
2438c2ecf20Sopenharmony_ci#define DTD_DROP_DATA_MASK	0x01
2448c2ecf20Sopenharmony_ci#define DTD_DROP_DATA_SHIFT	1
2458c2ecf20Sopenharmony_ci#define DTD_USE_DESC_MASK	0x01
2468c2ecf20Sopenharmony_ci#define DTD_USE_DESC_SHIFT	0
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/* max_width_height */
2498c2ecf20Sopenharmony_ci#define DTD_MAX_WIDTH_MASK	0x07
2508c2ecf20Sopenharmony_ci#define DTD_MAX_WIDTH_SHFT	4
2518c2ecf20Sopenharmony_ci#define DTD_MAX_HEIGHT_MASK	0x07
2528c2ecf20Sopenharmony_ci#define DTD_MAX_HEIGHT_SHFT	0
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_cistatic inline u32 dtd_type_ctl_stride(int type, bool notify, int field,
2558c2ecf20Sopenharmony_ci			bool one_d, bool even_line_skip, bool odd_line_skip,
2568c2ecf20Sopenharmony_ci			int line_stride)
2578c2ecf20Sopenharmony_ci{
2588c2ecf20Sopenharmony_ci	return (type << DTD_DATA_TYPE_SHFT) | (notify << DTD_NOTIFY_SHFT) |
2598c2ecf20Sopenharmony_ci		(field << DTD_FIELD_SHFT) | (one_d << DTD_1D_SHFT) |
2608c2ecf20Sopenharmony_ci		(even_line_skip << DTD_EVEN_LINE_SKIP_SHFT) |
2618c2ecf20Sopenharmony_ci		(odd_line_skip << DTD_ODD_LINE_SKIP_SHFT) |
2628c2ecf20Sopenharmony_ci		line_stride;
2638c2ecf20Sopenharmony_ci}
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_cistatic inline u32 dtd_xfer_length_height(int line_length, int xfer_height)
2668c2ecf20Sopenharmony_ci{
2678c2ecf20Sopenharmony_ci	return (line_length << DTD_LINE_LENGTH_SHFT) | xfer_height;
2688c2ecf20Sopenharmony_ci}
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_cistatic inline u32 dtd_pkt_ctl(bool mode, bool dir, int chan, int pri,
2718c2ecf20Sopenharmony_ci			int next_chan)
2728c2ecf20Sopenharmony_ci{
2738c2ecf20Sopenharmony_ci	return (DTD_PKT_TYPE << DTD_PKT_TYPE_SHFT) | (mode << DTD_MODE_SHFT) |
2748c2ecf20Sopenharmony_ci		(dir << DTD_DIR_SHFT) | (chan << DTD_CHAN_SHFT) |
2758c2ecf20Sopenharmony_ci		(pri << DTD_PRI_SHFT) | next_chan;
2768c2ecf20Sopenharmony_ci}
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_cistatic inline u32 dtd_frame_width_height(int width, int height)
2798c2ecf20Sopenharmony_ci{
2808c2ecf20Sopenharmony_ci	return (width << DTD_FRAME_WIDTH_SHFT) | height;
2818c2ecf20Sopenharmony_ci}
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_cistatic inline u32 dtd_desc_write_addr(unsigned int addr, bool write_desc,
2848c2ecf20Sopenharmony_ci			bool drop_data, bool use_desc)
2858c2ecf20Sopenharmony_ci{
2868c2ecf20Sopenharmony_ci	return (addr & DTD_DESC_START_MASK) |
2878c2ecf20Sopenharmony_ci		(write_desc << DTD_WRITE_DESC_SHIFT) |
2888c2ecf20Sopenharmony_ci		(drop_data << DTD_DROP_DATA_SHIFT) |
2898c2ecf20Sopenharmony_ci		use_desc;
2908c2ecf20Sopenharmony_ci}
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_cistatic inline u32 dtd_start_h_v(int h_start, int v_start)
2938c2ecf20Sopenharmony_ci{
2948c2ecf20Sopenharmony_ci	return (h_start << DTD_H_START_SHFT) | v_start;
2958c2ecf20Sopenharmony_ci}
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_cistatic inline u32 dtd_max_width_height(int max_width, int max_height)
2988c2ecf20Sopenharmony_ci{
2998c2ecf20Sopenharmony_ci	return (max_width << DTD_MAX_WIDTH_SHFT) | max_height;
3008c2ecf20Sopenharmony_ci}
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_cistatic inline int dtd_get_data_type(struct vpdma_dtd *dtd)
3038c2ecf20Sopenharmony_ci{
3048c2ecf20Sopenharmony_ci	return dtd->type_ctl_stride >> DTD_DATA_TYPE_SHFT;
3058c2ecf20Sopenharmony_ci}
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_cistatic inline bool dtd_get_notify(struct vpdma_dtd *dtd)
3088c2ecf20Sopenharmony_ci{
3098c2ecf20Sopenharmony_ci	return (dtd->type_ctl_stride >> DTD_NOTIFY_SHFT) & DTD_NOTIFY_MASK;
3108c2ecf20Sopenharmony_ci}
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_cistatic inline int dtd_get_field(struct vpdma_dtd *dtd)
3138c2ecf20Sopenharmony_ci{
3148c2ecf20Sopenharmony_ci	return (dtd->type_ctl_stride >> DTD_FIELD_SHFT) & DTD_FIELD_MASK;
3158c2ecf20Sopenharmony_ci}
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_cistatic inline bool dtd_get_1d(struct vpdma_dtd *dtd)
3188c2ecf20Sopenharmony_ci{
3198c2ecf20Sopenharmony_ci	return (dtd->type_ctl_stride >> DTD_1D_SHFT) & DTD_1D_MASK;
3208c2ecf20Sopenharmony_ci}
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_cistatic inline bool dtd_get_even_line_skip(struct vpdma_dtd *dtd)
3238c2ecf20Sopenharmony_ci{
3248c2ecf20Sopenharmony_ci	return (dtd->type_ctl_stride >> DTD_EVEN_LINE_SKIP_SHFT)
3258c2ecf20Sopenharmony_ci		& DTD_EVEN_LINE_SKIP_MASK;
3268c2ecf20Sopenharmony_ci}
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_cistatic inline bool dtd_get_odd_line_skip(struct vpdma_dtd *dtd)
3298c2ecf20Sopenharmony_ci{
3308c2ecf20Sopenharmony_ci	return (dtd->type_ctl_stride >> DTD_ODD_LINE_SKIP_SHFT)
3318c2ecf20Sopenharmony_ci		& DTD_ODD_LINE_SKIP_MASK;
3328c2ecf20Sopenharmony_ci}
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_cistatic inline int dtd_get_line_stride(struct vpdma_dtd *dtd)
3358c2ecf20Sopenharmony_ci{
3368c2ecf20Sopenharmony_ci	return dtd->type_ctl_stride & DTD_LINE_STRIDE_MASK;
3378c2ecf20Sopenharmony_ci}
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_cistatic inline int dtd_get_line_length(struct vpdma_dtd *dtd)
3408c2ecf20Sopenharmony_ci{
3418c2ecf20Sopenharmony_ci	return dtd->xfer_length_height >> DTD_LINE_LENGTH_SHFT;
3428c2ecf20Sopenharmony_ci}
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_cistatic inline int dtd_get_xfer_height(struct vpdma_dtd *dtd)
3458c2ecf20Sopenharmony_ci{
3468c2ecf20Sopenharmony_ci	return dtd->xfer_length_height & DTD_XFER_HEIGHT_MASK;
3478c2ecf20Sopenharmony_ci}
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_cistatic inline int dtd_get_pkt_type(struct vpdma_dtd *dtd)
3508c2ecf20Sopenharmony_ci{
3518c2ecf20Sopenharmony_ci	return dtd->pkt_ctl >> DTD_PKT_TYPE_SHFT;
3528c2ecf20Sopenharmony_ci}
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_cistatic inline bool dtd_get_mode(struct vpdma_dtd *dtd)
3558c2ecf20Sopenharmony_ci{
3568c2ecf20Sopenharmony_ci	return (dtd->pkt_ctl >> DTD_MODE_SHFT) & DTD_MODE_MASK;
3578c2ecf20Sopenharmony_ci}
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_cistatic inline bool dtd_get_dir(struct vpdma_dtd *dtd)
3608c2ecf20Sopenharmony_ci{
3618c2ecf20Sopenharmony_ci	return (dtd->pkt_ctl >> DTD_DIR_SHFT) & DTD_DIR_MASK;
3628c2ecf20Sopenharmony_ci}
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_cistatic inline int dtd_get_chan(struct vpdma_dtd *dtd)
3658c2ecf20Sopenharmony_ci{
3668c2ecf20Sopenharmony_ci	return (dtd->pkt_ctl >> DTD_CHAN_SHFT) & DTD_CHAN_MASK;
3678c2ecf20Sopenharmony_ci}
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_cistatic inline int dtd_get_priority(struct vpdma_dtd *dtd)
3708c2ecf20Sopenharmony_ci{
3718c2ecf20Sopenharmony_ci	return (dtd->pkt_ctl >> DTD_PRI_SHFT) & DTD_PRI_MASK;
3728c2ecf20Sopenharmony_ci}
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_cistatic inline int dtd_get_next_chan(struct vpdma_dtd *dtd)
3758c2ecf20Sopenharmony_ci{
3768c2ecf20Sopenharmony_ci	return (dtd->pkt_ctl >> DTD_NEXT_CHAN_SHFT) & DTD_NEXT_CHAN_MASK;
3778c2ecf20Sopenharmony_ci}
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_cistatic inline int dtd_get_frame_width(struct vpdma_dtd *dtd)
3808c2ecf20Sopenharmony_ci{
3818c2ecf20Sopenharmony_ci	return dtd->frame_width_height >> DTD_FRAME_WIDTH_SHFT;
3828c2ecf20Sopenharmony_ci}
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_cistatic inline int dtd_get_frame_height(struct vpdma_dtd *dtd)
3858c2ecf20Sopenharmony_ci{
3868c2ecf20Sopenharmony_ci	return dtd->frame_width_height & DTD_FRAME_HEIGHT_MASK;
3878c2ecf20Sopenharmony_ci}
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_cistatic inline int dtd_get_desc_write_addr(struct vpdma_dtd *dtd)
3908c2ecf20Sopenharmony_ci{
3918c2ecf20Sopenharmony_ci	return dtd->desc_write_addr & DTD_DESC_START_MASK;
3928c2ecf20Sopenharmony_ci}
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_cistatic inline bool dtd_get_write_desc(struct vpdma_dtd *dtd)
3958c2ecf20Sopenharmony_ci{
3968c2ecf20Sopenharmony_ci	return (dtd->desc_write_addr >> DTD_WRITE_DESC_SHIFT) &
3978c2ecf20Sopenharmony_ci							DTD_WRITE_DESC_MASK;
3988c2ecf20Sopenharmony_ci}
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_cistatic inline bool dtd_get_drop_data(struct vpdma_dtd *dtd)
4018c2ecf20Sopenharmony_ci{
4028c2ecf20Sopenharmony_ci	return (dtd->desc_write_addr >> DTD_DROP_DATA_SHIFT) &
4038c2ecf20Sopenharmony_ci							DTD_DROP_DATA_MASK;
4048c2ecf20Sopenharmony_ci}
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_cistatic inline bool dtd_get_use_desc(struct vpdma_dtd *dtd)
4078c2ecf20Sopenharmony_ci{
4088c2ecf20Sopenharmony_ci	return dtd->desc_write_addr & DTD_USE_DESC_MASK;
4098c2ecf20Sopenharmony_ci}
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_cistatic inline int dtd_get_h_start(struct vpdma_dtd *dtd)
4128c2ecf20Sopenharmony_ci{
4138c2ecf20Sopenharmony_ci	return dtd->start_h_v >> DTD_H_START_SHFT;
4148c2ecf20Sopenharmony_ci}
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_cistatic inline int dtd_get_v_start(struct vpdma_dtd *dtd)
4178c2ecf20Sopenharmony_ci{
4188c2ecf20Sopenharmony_ci	return dtd->start_h_v & DTD_V_START_MASK;
4198c2ecf20Sopenharmony_ci}
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_cistatic inline int dtd_get_max_width(struct vpdma_dtd *dtd)
4228c2ecf20Sopenharmony_ci{
4238c2ecf20Sopenharmony_ci	return (dtd->max_width_height >> DTD_MAX_WIDTH_SHFT) &
4248c2ecf20Sopenharmony_ci							DTD_MAX_WIDTH_MASK;
4258c2ecf20Sopenharmony_ci}
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_cistatic inline int dtd_get_max_height(struct vpdma_dtd *dtd)
4288c2ecf20Sopenharmony_ci{
4298c2ecf20Sopenharmony_ci	return (dtd->max_width_height >> DTD_MAX_HEIGHT_SHFT) &
4308c2ecf20Sopenharmony_ci							DTD_MAX_HEIGHT_MASK;
4318c2ecf20Sopenharmony_ci}
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci/*
4348c2ecf20Sopenharmony_ci * configuration descriptor
4358c2ecf20Sopenharmony_ci */
4368c2ecf20Sopenharmony_cistruct vpdma_cfd {
4378c2ecf20Sopenharmony_ci	union {
4388c2ecf20Sopenharmony_ci		u32	dest_addr_offset;
4398c2ecf20Sopenharmony_ci		u32	w0;
4408c2ecf20Sopenharmony_ci	};
4418c2ecf20Sopenharmony_ci	union {
4428c2ecf20Sopenharmony_ci		u32	block_len;		/* in words */
4438c2ecf20Sopenharmony_ci		u32	w1;
4448c2ecf20Sopenharmony_ci	};
4458c2ecf20Sopenharmony_ci	u32		payload_addr;
4468c2ecf20Sopenharmony_ci	u32		ctl_payload_len;	/* in words */
4478c2ecf20Sopenharmony_ci};
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_ci/* Configuration descriptor specifics */
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci#define CFD_PKT_TYPE		0xb
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci#define CFD_DIRECT		1
4548c2ecf20Sopenharmony_ci#define CFD_INDIRECT		0
4558c2ecf20Sopenharmony_ci#define CFD_CLS_ADB		0
4568c2ecf20Sopenharmony_ci#define CFD_CLS_BLOCK		1
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci/* block_len */
4598c2ecf20Sopenharmony_ci#define CFD__BLOCK_LEN_MASK	0xffff
4608c2ecf20Sopenharmony_ci#define CFD__BLOCK_LEN_SHFT	0
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci/* ctl_payload_len */
4638c2ecf20Sopenharmony_ci#define CFD_PKT_TYPE_MASK	0x1f
4648c2ecf20Sopenharmony_ci#define CFD_PKT_TYPE_SHFT	27
4658c2ecf20Sopenharmony_ci#define CFD_DIRECT_MASK		0x01
4668c2ecf20Sopenharmony_ci#define CFD_DIRECT_SHFT		26
4678c2ecf20Sopenharmony_ci#define CFD_CLASS_MASK		0x03
4688c2ecf20Sopenharmony_ci#define CFD_CLASS_SHFT		24
4698c2ecf20Sopenharmony_ci#define CFD_DEST_MASK		0xff
4708c2ecf20Sopenharmony_ci#define CFD_DEST_SHFT		16
4718c2ecf20Sopenharmony_ci#define CFD_PAYLOAD_LEN_MASK	0xffff
4728c2ecf20Sopenharmony_ci#define CFD_PAYLOAD_LEN_SHFT	0
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_cistatic inline u32 cfd_pkt_payload_len(bool direct, int cls, int dest,
4758c2ecf20Sopenharmony_ci		int payload_len)
4768c2ecf20Sopenharmony_ci{
4778c2ecf20Sopenharmony_ci	return (CFD_PKT_TYPE << CFD_PKT_TYPE_SHFT) |
4788c2ecf20Sopenharmony_ci		(direct << CFD_DIRECT_SHFT) |
4798c2ecf20Sopenharmony_ci		(cls << CFD_CLASS_SHFT) |
4808c2ecf20Sopenharmony_ci		(dest << CFD_DEST_SHFT) |
4818c2ecf20Sopenharmony_ci		payload_len;
4828c2ecf20Sopenharmony_ci}
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_cistatic inline int cfd_get_pkt_type(struct vpdma_cfd *cfd)
4858c2ecf20Sopenharmony_ci{
4868c2ecf20Sopenharmony_ci	return cfd->ctl_payload_len >> CFD_PKT_TYPE_SHFT;
4878c2ecf20Sopenharmony_ci}
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_cistatic inline bool cfd_get_direct(struct vpdma_cfd *cfd)
4908c2ecf20Sopenharmony_ci{
4918c2ecf20Sopenharmony_ci	return (cfd->ctl_payload_len >> CFD_DIRECT_SHFT) & CFD_DIRECT_MASK;
4928c2ecf20Sopenharmony_ci}
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_cistatic inline bool cfd_get_class(struct vpdma_cfd *cfd)
4958c2ecf20Sopenharmony_ci{
4968c2ecf20Sopenharmony_ci	return (cfd->ctl_payload_len >> CFD_CLASS_SHFT) & CFD_CLASS_MASK;
4978c2ecf20Sopenharmony_ci}
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_cistatic inline int cfd_get_dest(struct vpdma_cfd *cfd)
5008c2ecf20Sopenharmony_ci{
5018c2ecf20Sopenharmony_ci	return (cfd->ctl_payload_len >> CFD_DEST_SHFT) & CFD_DEST_MASK;
5028c2ecf20Sopenharmony_ci}
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_cistatic inline int cfd_get_payload_len(struct vpdma_cfd *cfd)
5058c2ecf20Sopenharmony_ci{
5068c2ecf20Sopenharmony_ci	return cfd->ctl_payload_len & CFD_PAYLOAD_LEN_MASK;
5078c2ecf20Sopenharmony_ci}
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci/*
5108c2ecf20Sopenharmony_ci * control descriptor
5118c2ecf20Sopenharmony_ci */
5128c2ecf20Sopenharmony_cistruct vpdma_ctd {
5138c2ecf20Sopenharmony_ci	union {
5148c2ecf20Sopenharmony_ci		u32	timer_value;
5158c2ecf20Sopenharmony_ci		u32	list_addr;
5168c2ecf20Sopenharmony_ci		u32	w0;
5178c2ecf20Sopenharmony_ci	};
5188c2ecf20Sopenharmony_ci	union {
5198c2ecf20Sopenharmony_ci		u32	pixel_line_count;
5208c2ecf20Sopenharmony_ci		u32	list_size;
5218c2ecf20Sopenharmony_ci		u32	w1;
5228c2ecf20Sopenharmony_ci	};
5238c2ecf20Sopenharmony_ci	union {
5248c2ecf20Sopenharmony_ci		u32	event;
5258c2ecf20Sopenharmony_ci		u32	fid_ctl;
5268c2ecf20Sopenharmony_ci		u32	w2;
5278c2ecf20Sopenharmony_ci	};
5288c2ecf20Sopenharmony_ci	u32		type_source_ctl;
5298c2ecf20Sopenharmony_ci};
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci/* control descriptor types */
5328c2ecf20Sopenharmony_ci#define CTD_TYPE_SYNC_ON_CLIENT		0
5338c2ecf20Sopenharmony_ci#define CTD_TYPE_SYNC_ON_LIST		1
5348c2ecf20Sopenharmony_ci#define CTD_TYPE_SYNC_ON_EXT		2
5358c2ecf20Sopenharmony_ci#define CTD_TYPE_SYNC_ON_LM_TIMER	3
5368c2ecf20Sopenharmony_ci#define CTD_TYPE_SYNC_ON_CHANNEL	4
5378c2ecf20Sopenharmony_ci#define CTD_TYPE_CHNG_CLIENT_IRQ	5
5388c2ecf20Sopenharmony_ci#define CTD_TYPE_SEND_IRQ		6
5398c2ecf20Sopenharmony_ci#define CTD_TYPE_RELOAD_LIST		7
5408c2ecf20Sopenharmony_ci#define CTD_TYPE_ABORT_CHANNEL		8
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci#define CTD_PKT_TYPE		0xc
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_ci/* timer_value */
5458c2ecf20Sopenharmony_ci#define CTD_TIMER_VALUE_MASK	0xffff
5468c2ecf20Sopenharmony_ci#define CTD_TIMER_VALUE_SHFT	0
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci/* pixel_line_count */
5498c2ecf20Sopenharmony_ci#define CTD_PIXEL_COUNT_MASK	0xffff
5508c2ecf20Sopenharmony_ci#define CTD_PIXEL_COUNT_SHFT	16
5518c2ecf20Sopenharmony_ci#define CTD_LINE_COUNT_MASK	0xffff
5528c2ecf20Sopenharmony_ci#define CTD_LINE_COUNT_SHFT	0
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci/* list_size */
5558c2ecf20Sopenharmony_ci#define CTD_LIST_SIZE_MASK	0xffff
5568c2ecf20Sopenharmony_ci#define CTD_LIST_SIZE_SHFT	0
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci/* event */
5598c2ecf20Sopenharmony_ci#define CTD_EVENT_MASK		0x0f
5608c2ecf20Sopenharmony_ci#define CTD_EVENT_SHFT		0
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ci/* fid_ctl */
5638c2ecf20Sopenharmony_ci#define CTD_FID2_MASK		0x03
5648c2ecf20Sopenharmony_ci#define CTD_FID2_SHFT		4
5658c2ecf20Sopenharmony_ci#define CTD_FID1_MASK		0x03
5668c2ecf20Sopenharmony_ci#define CTD_FID1_SHFT		2
5678c2ecf20Sopenharmony_ci#define CTD_FID0_MASK		0x03
5688c2ecf20Sopenharmony_ci#define CTD_FID0_SHFT		0
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ci/* type_source_ctl */
5718c2ecf20Sopenharmony_ci#define CTD_PKT_TYPE_MASK	0x1f
5728c2ecf20Sopenharmony_ci#define CTD_PKT_TYPE_SHFT	27
5738c2ecf20Sopenharmony_ci#define CTD_SOURCE_MASK		0xff
5748c2ecf20Sopenharmony_ci#define CTD_SOURCE_SHFT		16
5758c2ecf20Sopenharmony_ci#define CTD_CONTROL_MASK	0x0f
5768c2ecf20Sopenharmony_ci#define CTD_CONTROL_SHFT	0
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_cistatic inline u32 ctd_pixel_line_count(int pixel_count, int line_count)
5798c2ecf20Sopenharmony_ci{
5808c2ecf20Sopenharmony_ci	return (pixel_count << CTD_PIXEL_COUNT_SHFT) | line_count;
5818c2ecf20Sopenharmony_ci}
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_cistatic inline u32 ctd_set_fid_ctl(int fid0, int fid1, int fid2)
5848c2ecf20Sopenharmony_ci{
5858c2ecf20Sopenharmony_ci	return (fid2 << CTD_FID2_SHFT) | (fid1 << CTD_FID1_SHFT) | fid0;
5868c2ecf20Sopenharmony_ci}
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_cistatic inline u32 ctd_type_source_ctl(int source, int control)
5898c2ecf20Sopenharmony_ci{
5908c2ecf20Sopenharmony_ci	return (CTD_PKT_TYPE << CTD_PKT_TYPE_SHFT) |
5918c2ecf20Sopenharmony_ci		(source << CTD_SOURCE_SHFT) | control;
5928c2ecf20Sopenharmony_ci}
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_cistatic inline u32 ctd_get_pixel_count(struct vpdma_ctd *ctd)
5958c2ecf20Sopenharmony_ci{
5968c2ecf20Sopenharmony_ci	return ctd->pixel_line_count >> CTD_PIXEL_COUNT_SHFT;
5978c2ecf20Sopenharmony_ci}
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_cistatic inline int ctd_get_line_count(struct vpdma_ctd *ctd)
6008c2ecf20Sopenharmony_ci{
6018c2ecf20Sopenharmony_ci	return ctd->pixel_line_count & CTD_LINE_COUNT_MASK;
6028c2ecf20Sopenharmony_ci}
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_cistatic inline int ctd_get_event(struct vpdma_ctd *ctd)
6058c2ecf20Sopenharmony_ci{
6068c2ecf20Sopenharmony_ci	return ctd->event & CTD_EVENT_MASK;
6078c2ecf20Sopenharmony_ci}
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_cistatic inline int ctd_get_fid2_ctl(struct vpdma_ctd *ctd)
6108c2ecf20Sopenharmony_ci{
6118c2ecf20Sopenharmony_ci	return (ctd->fid_ctl >> CTD_FID2_SHFT) & CTD_FID2_MASK;
6128c2ecf20Sopenharmony_ci}
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_cistatic inline int ctd_get_fid1_ctl(struct vpdma_ctd *ctd)
6158c2ecf20Sopenharmony_ci{
6168c2ecf20Sopenharmony_ci	return (ctd->fid_ctl >> CTD_FID1_SHFT) & CTD_FID1_MASK;
6178c2ecf20Sopenharmony_ci}
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_cistatic inline int ctd_get_fid0_ctl(struct vpdma_ctd *ctd)
6208c2ecf20Sopenharmony_ci{
6218c2ecf20Sopenharmony_ci	return ctd->fid_ctl & CTD_FID2_MASK;
6228c2ecf20Sopenharmony_ci}
6238c2ecf20Sopenharmony_ci
6248c2ecf20Sopenharmony_cistatic inline int ctd_get_pkt_type(struct vpdma_ctd *ctd)
6258c2ecf20Sopenharmony_ci{
6268c2ecf20Sopenharmony_ci	return ctd->type_source_ctl >> CTD_PKT_TYPE_SHFT;
6278c2ecf20Sopenharmony_ci}
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_cistatic inline int ctd_get_source(struct vpdma_ctd *ctd)
6308c2ecf20Sopenharmony_ci{
6318c2ecf20Sopenharmony_ci	return (ctd->type_source_ctl >> CTD_SOURCE_SHFT) & CTD_SOURCE_MASK;
6328c2ecf20Sopenharmony_ci}
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_cistatic inline int ctd_get_ctl(struct vpdma_ctd *ctd)
6358c2ecf20Sopenharmony_ci{
6368c2ecf20Sopenharmony_ci	return ctd->type_source_ctl & CTD_CONTROL_MASK;
6378c2ecf20Sopenharmony_ci}
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci#endif
640