15cc7522dSYong Deng /* SPDX-License-Identifier: GPL-2.0+ */ 25cc7522dSYong Deng /* 35cc7522dSYong Deng * Copyright (c) 2011-2018 Magewell Electronics Co., Ltd. (Nanjing) 45cc7522dSYong Deng * Author: Yong Deng <yong.deng@magewell.com> 5dc85e4cdSPaul Kocialkowski * Copyright 2021-2022 Bootlin 6dc85e4cdSPaul Kocialkowski * Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com> 75cc7522dSYong Deng */ 85cc7522dSYong Deng 9dc85e4cdSPaul Kocialkowski #ifndef _SUN6I_CSI_H_ 10dc85e4cdSPaul Kocialkowski #define _SUN6I_CSI_H_ 115cc7522dSYong Deng 125cc7522dSYong Deng #include <media/v4l2-device.h> 1370a7ce22SPaul Kocialkowski #include <media/videobuf2-v4l2.h> 145cc7522dSYong Deng 150d2b746bSPaul Kocialkowski #include "sun6i_csi_bridge.h" 16e9201cb2SPaul Kocialkowski #include "sun6i_csi_capture.h" 175cc7522dSYong Deng 186f4d0849SPaul Kocialkowski #define SUN6I_CSI_NAME "sun6i-csi" 196f4d0849SPaul Kocialkowski #define SUN6I_CSI_DESCRIPTION "Allwinner A31 CSI Device" 206f4d0849SPaul Kocialkowski 210d2b746bSPaul Kocialkowski enum sun6i_csi_port { 220d2b746bSPaul Kocialkowski SUN6I_CSI_PORT_PARALLEL = 0, 23a617f33dSPaul Kocialkowski SUN6I_CSI_PORT_MIPI_CSI2 = 1, 240fbbb09cSPaul Kocialkowski SUN6I_CSI_PORT_ISP = 2, 250d2b746bSPaul Kocialkowski }; 260d2b746bSPaul Kocialkowski 2770a7ce22SPaul Kocialkowski struct sun6i_csi_buffer { 2870a7ce22SPaul Kocialkowski struct vb2_v4l2_buffer v4l2_buffer; 2970a7ce22SPaul Kocialkowski struct list_head list; 3070a7ce22SPaul Kocialkowski }; 3170a7ce22SPaul Kocialkowski 320b11253fSPaul Kocialkowski struct sun6i_csi_v4l2 { 335cc7522dSYong Deng struct v4l2_device v4l2_dev; 345cc7522dSYong Deng struct media_device media_dev; 350b11253fSPaul Kocialkowski }; 360b11253fSPaul Kocialkowski 370b11253fSPaul Kocialkowski struct sun6i_csi_device { 380b11253fSPaul Kocialkowski struct device *dev; 39*131823c4SPaul Kocialkowski struct v4l2_device *v4l2_dev; 40*131823c4SPaul Kocialkowski struct media_device *media_dev; 415cc7522dSYong Deng 420b11253fSPaul Kocialkowski struct sun6i_csi_v4l2 v4l2; 430d2b746bSPaul Kocialkowski struct sun6i_csi_bridge bridge; 44e9201cb2SPaul Kocialkowski struct sun6i_csi_capture capture; 450b11253fSPaul Kocialkowski 460b11253fSPaul Kocialkowski struct regmap *regmap; 4743e80196SPaul Kocialkowski struct clk *clock_mod; 4843e80196SPaul Kocialkowski struct clk *clock_ram; 490b11253fSPaul Kocialkowski struct reset_control *reset; 500fbbb09cSPaul Kocialkowski 510fbbb09cSPaul Kocialkowski bool isp_available; 525cc7522dSYong Deng }; 535cc7522dSYong Deng 54bc67ec9eSPaul Kocialkowski struct sun6i_csi_variant { 55bc67ec9eSPaul Kocialkowski unsigned long clock_mod_rate; 56bc67ec9eSPaul Kocialkowski }; 57bc67ec9eSPaul Kocialkowski 58*131823c4SPaul Kocialkowski /* ISP */ 59*131823c4SPaul Kocialkowski 60*131823c4SPaul Kocialkowski int sun6i_csi_isp_complete(struct sun6i_csi_device *csi_dev, 61*131823c4SPaul Kocialkowski struct v4l2_device *v4l2_dev); 62*131823c4SPaul Kocialkowski 63dc85e4cdSPaul Kocialkowski #endif 64