linux/drivers/media/platform/samsung/exynos4-is/fimc-lite-reg.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2012 Samsung Electronics Co., Ltd.
 */

#ifndef FIMC_LITE_REG_H_
#define FIMC_LITE_REG_H_

#include <linux/bitops.h>

#include "fimc-lite.h"

/* Camera Source size */
#define FLITE_REG_CISRCSIZE
#define FLITE_REG_CISRCSIZE_ORDER422_IN_YCBYCR
#define FLITE_REG_CISRCSIZE_ORDER422_IN_YCRYCB
#define FLITE_REG_CISRCSIZE_ORDER422_IN_CBYCRY
#define FLITE_REG_CISRCSIZE_ORDER422_IN_CRYCBY
#define FLITE_REG_CISRCSIZE_ORDER422_MASK
#define FLITE_REG_CISRCSIZE_SIZE_CAM_MASK

/* Global control */
#define FLITE_REG_CIGCTRL
#define FLITE_REG_CIGCTRL_YUV422_1P
#define FLITE_REG_CIGCTRL_RAW8
#define FLITE_REG_CIGCTRL_RAW10
#define FLITE_REG_CIGCTRL_RAW12
#define FLITE_REG_CIGCTRL_RAW14
/* User defined formats. x = 0...15 */
#define FLITE_REG_CIGCTRL_USER(x)
#define FLITE_REG_CIGCTRL_FMT_MASK
#define FLITE_REG_CIGCTRL_SHADOWMASK_DISABLE
#define FLITE_REG_CIGCTRL_ODMA_DISABLE
#define FLITE_REG_CIGCTRL_SWRST_REQ
#define FLITE_REG_CIGCTRL_SWRST_RDY
#define FLITE_REG_CIGCTRL_SWRST
#define FLITE_REG_CIGCTRL_TEST_PATTERN_COLORBAR
#define FLITE_REG_CIGCTRL_INVPOLPCLK
#define FLITE_REG_CIGCTRL_INVPOLVSYNC
#define FLITE_REG_CIGCTRL_INVPOLHREF
/* Interrupts mask bits (1 disables an interrupt) */
#define FLITE_REG_CIGCTRL_IRQ_LASTEN
#define FLITE_REG_CIGCTRL_IRQ_ENDEN
#define FLITE_REG_CIGCTRL_IRQ_STARTEN
#define FLITE_REG_CIGCTRL_IRQ_OVFEN
#define FLITE_REG_CIGCTRL_IRQ_DISABLE_MASK
#define FLITE_REG_CIGCTRL_SELCAM_MIPI

/* Image Capture Enable */
#define FLITE_REG_CIIMGCPT
#define FLITE_REG_CIIMGCPT_IMGCPTEN
#define FLITE_REG_CIIMGCPT_CPT_FREN
#define FLITE_REG_CIIMGCPT_CPT_MOD_FRCNT
#define FLITE_REG_CIIMGCPT_CPT_MOD_FREN

/* Capture Sequence */
#define FLITE_REG_CICPTSEQ

/* Camera Window Offset */
#define FLITE_REG_CIWDOFST
#define FLITE_REG_CIWDOFST_WINOFSEN
#define FLITE_REG_CIWDOFST_CLROVIY
#define FLITE_REG_CIWDOFST_CLROVFICB
#define FLITE_REG_CIWDOFST_CLROVFICR
#define FLITE_REG_CIWDOFST_OFST_MASK

/* Camera Window Offset2 */
#define FLITE_REG_CIWDOFST2

/* Camera Output DMA Format */
#define FLITE_REG_CIODMAFMT
#define FLITE_REG_CIODMAFMT_RAW_CON
#define FLITE_REG_CIODMAFMT_PACK12
#define FLITE_REG_CIODMAFMT_YCBYCR
#define FLITE_REG_CIODMAFMT_YCRYCB
#define FLITE_REG_CIODMAFMT_CBYCRY
#define FLITE_REG_CIODMAFMT_CRYCBY
#define FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK

/* Camera Output Canvas */
#define FLITE_REG_CIOCAN
#define FLITE_REG_CIOCAN_MASK

/* Camera Output DMA Offset */
#define FLITE_REG_CIOOFF
#define FLITE_REG_CIOOFF_MASK

/* Camera Output DMA Start Address */
#define FLITE_REG_CIOSA

/* Camera Status */
#define FLITE_REG_CISTATUS
#define FLITE_REG_CISTATUS_MIPI_VVALID
#define FLITE_REG_CISTATUS_MIPI_HVALID
#define FLITE_REG_CISTATUS_MIPI_DVALID
#define FLITE_REG_CISTATUS_ITU_VSYNC
#define FLITE_REG_CISTATUS_ITU_HREFF
#define FLITE_REG_CISTATUS_OVFIY
#define FLITE_REG_CISTATUS_OVFICB
#define FLITE_REG_CISTATUS_OVFICR
#define FLITE_REG_CISTATUS_IRQ_SRC_OVERFLOW
#define FLITE_REG_CISTATUS_IRQ_SRC_LASTCAPEND
#define FLITE_REG_CISTATUS_IRQ_SRC_FRMSTART
#define FLITE_REG_CISTATUS_IRQ_SRC_FRMEND
#define FLITE_REG_CISTATUS_IRQ_CAM
#define FLITE_REG_CISTATUS_IRQ_MASK

/* Camera Status2 */
#define FLITE_REG_CISTATUS2
#define FLITE_REG_CISTATUS2_LASTCAPEND
#define FLITE_REG_CISTATUS2_FRMEND

/* Qos Threshold */
#define FLITE_REG_CITHOLD
#define FLITE_REG_CITHOLD_W_QOS_EN

/* Camera General Purpose */
#define FLITE_REG_CIGENERAL
/* b0: 1 - camera B, 0 - camera A */
#define FLITE_REG_CIGENERAL_CAM_B

#define FLITE_REG_CIFCNTSEQ
#define FLITE_REG_CIOSAN(x)

/* ----------------------------------------------------------------------------
 * Function declarations
 */
void flite_hw_reset(struct fimc_lite *dev);
void flite_hw_clear_pending_irq(struct fimc_lite *dev);
u32 flite_hw_get_interrupt_source(struct fimc_lite *dev);
void flite_hw_clear_last_capture_end(struct fimc_lite *dev);
void flite_hw_set_interrupt_mask(struct fimc_lite *dev);
void flite_hw_capture_start(struct fimc_lite *dev);
void flite_hw_capture_stop(struct fimc_lite *dev);
void flite_hw_set_camera_bus(struct fimc_lite *dev,
			     const struct fimc_source_info *s_info);
void flite_hw_set_window_offset(struct fimc_lite *dev, const struct flite_frame *f);
void flite_hw_set_source_format(struct fimc_lite *dev, const struct flite_frame *f);

void flite_hw_set_output_dma(struct fimc_lite *dev, const struct flite_frame *f,
			     bool enable);
void flite_hw_set_dma_window(struct fimc_lite *dev, const struct flite_frame *f);
void flite_hw_set_test_pattern(struct fimc_lite *dev, bool on);
void flite_hw_dump_regs(struct fimc_lite *dev, const char *label);
void flite_hw_set_dma_buffer(struct fimc_lite *dev, struct flite_buffer *buf);
void flite_hw_mask_dma_buffer(struct fimc_lite *dev, u32 index);

static inline void flite_hw_set_dma_buf_mask(struct fimc_lite *dev, u32 mask)
{}

#endif /* FIMC_LITE_REG_H */