1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * camss-ispif.h 4 * 5 * Qualcomm MSM Camera Subsystem - ISPIF (ISP Interface) Module 6 * 7 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. 8 * Copyright (C) 2015-2018 Linaro Ltd. 9 */ 10 #ifndef QC_MSM_CAMSS_ISPIF_H 11 #define QC_MSM_CAMSS_ISPIF_H 12 13 #include <linux/clk.h> 14 #include <media/media-entity.h> 15 #include <media/v4l2-device.h> 16 #include <media/v4l2-subdev.h> 17 18 #define MSM_ISPIF_PAD_SINK 0 19 #define MSM_ISPIF_PAD_SRC 1 20 #define MSM_ISPIF_PADS_NUM 2 21 22 #define MSM_ISPIF_VFE_NUM 2 23 24 enum ispif_intf { 25 PIX0, 26 RDI0, 27 PIX1, 28 RDI1, 29 RDI2 30 }; 31 32 struct ispif_intf_cmd_reg { 33 u32 cmd_0; 34 u32 cmd_1; 35 }; 36 37 struct ispif_line { 38 struct ispif_device *ispif; 39 u8 id; 40 u8 csid_id; 41 u8 vfe_id; 42 enum ispif_intf interface; 43 struct v4l2_subdev subdev; 44 struct media_pad pads[MSM_ISPIF_PADS_NUM]; 45 struct v4l2_mbus_framefmt fmt[MSM_ISPIF_PADS_NUM]; 46 const u32 *formats; 47 unsigned int nformats; 48 }; 49 50 struct ispif_device { 51 void __iomem *base; 52 void __iomem *base_clk_mux; 53 u32 irq; 54 char irq_name[30]; 55 struct camss_clock *clock; 56 int nclocks; 57 struct camss_clock *clock_for_reset; 58 int nclocks_for_reset; 59 struct completion reset_complete[MSM_ISPIF_VFE_NUM]; 60 int power_count; 61 struct mutex power_lock; 62 struct ispif_intf_cmd_reg intf_cmd[MSM_ISPIF_VFE_NUM]; 63 struct mutex config_lock; 64 unsigned int line_num; 65 struct ispif_line *line; 66 struct camss *camss; 67 }; 68 69 struct camss_subdev_resources; 70 71 int msm_ispif_subdev_init(struct camss *camss, 72 const struct camss_subdev_resources *res); 73 74 int msm_ispif_register_entities(struct ispif_device *ispif, 75 struct v4l2_device *v4l2_dev); 76 77 void msm_ispif_unregister_entities(struct ispif_device *ispif); 78 79 #endif /* QC_MSM_CAMSS_ISPIF_H */ 80