diff options
Diffstat (limited to 'drivers/media/platform/hisi/isp/isp-sr.h')
-rw-r--r-- | drivers/media/platform/hisi/isp/isp-sr.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/drivers/media/platform/hisi/isp/isp-sr.h b/drivers/media/platform/hisi/isp/isp-sr.h new file mode 100644 index 000000000000..aa5e23a259a8 --- /dev/null +++ b/drivers/media/platform/hisi/isp/isp-sr.h @@ -0,0 +1,114 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2016-2018 Linaro Ltd. + */ + +#ifndef HISI_ISP_SR_H +#define HISI_ISP_SR_H + +#include <linux/clk.h> +#include <linux/interrupt.h> +#include <media/media-entity.h> +#include <media/v4l2-device.h> +#include <media/v4l2-mediabus.h> +#include <media/v4l2-subdev.h> + +#define ISP_SR_PAD_SINK 0 +#define ISP_SR_PAD_SRC 1 +#define ISP_SR_PADS_NUM 1 + +#define STREAM_ROUTER_CSIFILTER_A_REG 0x0 +#define STREAM_ROUTER_CSIFILTER_B_REG 0x4 +#define STREAM_ROUTER_CSIFILTER_C_REG 0x8 +#define STREAM_ROUTER_CSIFILTER_GO_REG 0xC +#define STREAM_ROUTER_PRESSURE_START_REG 0x10 +#define STREAM_ROUTER_PRESSURE_STOP_REG 0x14 +#define STREAM_ROUTER_ID_ROUTER_0_REG 0x18 +#define STREAM_ROUTER_ID_ROUTER_1_REG 0x1C +#define STREAM_ROUTER_REFORMAT_0_REG 0x20 +#define STREAM_ROUTER_REFORMAT_1_REG 0x28 +#define STREAM_ROUTER_REFORMAT_2_REG 0x30 +#define STREAM_ROUTER_REFORMAT_3_REG 0x38 +#define STREAM_ROUTER_REFORMAT_4_REG 0x40 +#define STREAM_ROUTER_REFORMAT_5_REG 0x48 +#define STREAM_ROUTER_REFORMAT_6_REG 0x50 +#define STREAM_ROUTER_REFORMAT_7_REG 0x58 +#define STREAM_ROUTER_REFORMAT_MINSPACE_0_REG 0x24 +#define STREAM_ROUTER_REFORMAT_MINSPACE_1_REG 0x2C +#define STREAM_ROUTER_REFORMAT_MINSPACE_2_REG 0x34 +#define STREAM_ROUTER_REFORMAT_MINSPACE_3_REG 0x3C +#define STREAM_ROUTER_REFORMAT_MINSPACE_4_REG 0x44 +#define STREAM_ROUTER_REFORMAT_MINSPACE_5_REG 0x4C +#define STREAM_ROUTER_REFORMAT_MINSPACE_6_REG 0x54 +#define STREAM_ROUTER_REFORMAT_MINSPACE_7_REG 0x5C +#define STREAM_ROUTER_EOL_CNT_REG 0x60 +#define STREAM_ROUTER_DPCM_0_REG 0x78 +#define STREAM_ROUTER_DPCM_1_REG 0x7C +#define STREAM_ROUTER_DPCM_2_REG 0x80 +#define STREAM_ROUTER_VP_ROUTER_0_REG 0x90 +#define STREAM_ROUTER_VP_ROUTER_1_REG 0x94 +#define STREAM_ROUTER_VP_ROUTER_2_REG 0x98 +#define STREAM_ROUTER_VP_ROUTER_3_REG 0x9C +#define STREAM_ROUTER_PIXFRAG_CONVERT_REG 0xA0 + +/* Define the union U_ID_ROUTER_1 */ +union U_ID_ROUTER_1 { + /* Define the struct bits */ + struct { + unsigned int reserved_0 : 16 ; /* [15..0] */ + unsigned int idr_input_stream_6 : 4 ; /* [19..16] */ + unsigned int idr_enable_6 : 1 ; /* [20] */ + unsigned int reserved_1 : 3 ; /* [23..21] */ + unsigned int idr_input_stream_7 : 4 ; /* [27..24] */ + unsigned int idr_enable_7 : 1 ; /* [28] */ + unsigned int reserved_2 : 3 ; /* [31..29] */ + } bits; + + /* Define an unsigned member */ + unsigned int u32; + +}; + +/* Define the union U_REFORMAT */ +union U_REFORMAT { + /* Define the struct bits */ + struct { + unsigned int reformat_num_lines : 13 ; /* [12..0] */ + unsigned int reformat_pixel_reorder : 3 ; /* [15..13] */ + unsigned int reformat_num_pixels : 13 ; /* [28..16] */ + unsigned int reserved_0 : 2 ; /* [30..29] */ + unsigned int reformat_enable : 1 ; /* [31] */ + } bits; + + /* Define an unsigned member */ + unsigned int u32; +}; + +#define STREAM_ROUTER_REFORMAT_MINSPACE_REG(x) \ + (STREAM_ROUTER_REFORMAT_MINSPACE_0_REG +\ + (x)*(STREAM_ROUTER_REFORMAT_MINSPACE_1_REG -\ + STREAM_ROUTER_REFORMAT_MINSPACE_0_REG)) + +#define STREAM_ROUTER_REFORMAT_REG(x) \ + (STREAM_ROUTER_REFORMAT_0_REG +\ + (x)*(STREAM_ROUTER_REFORMAT_1_REG -\ + STREAM_ROUTER_REFORMAT_0_REG)) + +struct sr_device { + struct isp *isp; + struct v4l2_subdev subdev; + struct media_pad pads[ISP_SR_PADS_NUM]; + void __iomem *base; + unsigned int irq_frproc0; +}; + +int isp_sr_subdev_init(struct isp *isp, + struct sr_device *sr, + const struct resources *res); + +int isp_sr_register_entity(struct sr_device *sr, + struct v4l2_device *v4l2_dev); + +void isp_sr_unregister_entity(struct sr_device *sr); + +#endif /* HISI_ISP_SR_H */ |