1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * camss-csid.h 4 * 5 * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module 6 * 7 * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. 8 * Copyright (C) 2015-2018 Linaro Ltd. 9 */ 10 #ifndef QC_MSM_CAMSS_CSID_H 11 #define QC_MSM_CAMSS_CSID_H 12 13 #include <linux/clk.h> 14 #include <media/media-entity.h> 15 #include <media/v4l2-ctrls.h> 16 #include <media/v4l2-device.h> 17 #include <media/v4l2-mediabus.h> 18 #include <media/v4l2-subdev.h> 19 20 #define MSM_CSID_PAD_SINK 0 21 #define MSM_CSID_PAD_SRC 1 22 #define MSM_CSID_PADS_NUM 2 23 24 enum csid_payload_mode { 25 CSID_PAYLOAD_MODE_INCREMENTING = 0, 26 CSID_PAYLOAD_MODE_ALTERNATING_55_AA = 1, 27 CSID_PAYLOAD_MODE_ALL_ZEROES = 2, 28 CSID_PAYLOAD_MODE_ALL_ONES = 3, 29 CSID_PAYLOAD_MODE_RANDOM = 4, 30 CSID_PAYLOAD_MODE_USER_SPECIFIED = 5, 31 }; 32 33 struct csid_testgen_config { 34 u8 enabled; 35 enum csid_payload_mode payload_mode; 36 }; 37 38 struct csid_phy_config { 39 u8 csiphy_id; 40 u8 lane_cnt; 41 u32 lane_assign; 42 }; 43 44 struct csid_device { 45 struct camss *camss; 46 u8 id; 47 struct v4l2_subdev subdev; 48 struct media_pad pads[MSM_CSID_PADS_NUM]; 49 void __iomem *base; 50 u32 irq; 51 char irq_name[30]; 52 struct camss_clock *clock; 53 int nclocks; 54 struct regulator *vdda; 55 struct completion reset_complete; 56 struct csid_testgen_config testgen; 57 struct csid_phy_config phy; 58 struct v4l2_mbus_framefmt fmt[MSM_CSID_PADS_NUM]; 59 struct v4l2_ctrl_handler ctrls; 60 struct v4l2_ctrl *testgen_mode; 61 const struct csid_format *formats; 62 unsigned int nformats; 63 }; 64 65 struct resources; 66 67 int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, 68 const struct resources *res, u8 id); 69 70 int msm_csid_register_entity(struct csid_device *csid, 71 struct v4l2_device *v4l2_dev); 72 73 void msm_csid_unregister_entity(struct csid_device *csid); 74 75 void msm_csid_get_csid_id(struct media_entity *entity, u8 *id); 76 77 #endif /* QC_MSM_CAMSS_CSID_H */ 78