1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright 2020-2022 Bootlin 4 * Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com> 5 */ 6 7 #ifndef _SUN6I_MIPI_CSI2_H_ 8 #define _SUN6I_MIPI_CSI2_H_ 9 10 #include <linux/phy/phy.h> 11 #include <linux/regmap.h> 12 #include <linux/reset.h> 13 #include <media/v4l2-device.h> 14 #include <media/v4l2-fwnode.h> 15 16 #define SUN6I_MIPI_CSI2_NAME "sun6i-mipi-csi2" 17 18 enum sun6i_mipi_csi2_pad { 19 SUN6I_MIPI_CSI2_PAD_SINK = 0, 20 SUN6I_MIPI_CSI2_PAD_SOURCE = 1, 21 SUN6I_MIPI_CSI2_PAD_COUNT = 2, 22 }; 23 24 struct sun6i_mipi_csi2_format { 25 u32 mbus_code; 26 u8 data_type; 27 u32 bpp; 28 }; 29 30 struct sun6i_mipi_csi2_bridge { 31 struct v4l2_subdev subdev; 32 struct media_pad pads[SUN6I_MIPI_CSI2_PAD_COUNT]; 33 struct v4l2_fwnode_endpoint endpoint; 34 struct v4l2_async_notifier notifier; 35 struct v4l2_mbus_framefmt mbus_format; 36 struct mutex lock; /* Mbus format lock. */ 37 38 struct v4l2_subdev *source_subdev; 39 }; 40 41 struct sun6i_mipi_csi2_device { 42 struct device *dev; 43 44 struct regmap *regmap; 45 struct clk *clock_mod; 46 struct reset_control *reset; 47 struct phy *dphy; 48 49 struct sun6i_mipi_csi2_bridge bridge; 50 }; 51 52 #endif 53