drm/panel: panel-himax-hx83102: support for csot-pna957qt1-1 MIPI-DSI panel
[drm/drm-misc.git] / drivers / media / platform / qcom / camss / camss-vfe-gen1.h
blob6d5f9656562c861948b75495865307dd80f36b7a
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * camss-vfe.h
5 * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module
7 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
8 * Copyright (C) 2015-2018 Linaro Ltd.
9 */
10 #ifndef QC_MSM_CAMSS_VFE_GEN1_H
11 #define QC_MSM_CAMSS_VFE_GEN1_H
13 #include "camss-vfe.h"
15 enum vfe_line_id;
16 struct vfe_device;
17 struct vfe_line;
18 struct vfe_output;
20 struct vfe_hw_ops_gen1 {
21 void (*bus_connect_wm_to_rdi)(struct vfe_device *vfe, u8 wm, enum vfe_line_id id);
22 void (*bus_disconnect_wm_from_rdi)(struct vfe_device *vfe, u8 wm, enum vfe_line_id id);
23 void (*bus_enable_wr_if)(struct vfe_device *vfe, u8 enable);
24 void (*bus_reload_wm)(struct vfe_device *vfe, u8 wm);
25 int (*camif_wait_for_stop)(struct vfe_device *vfe, struct device *dev);
26 void (*enable_irq_common)(struct vfe_device *vfe);
27 void (*enable_irq_wm_line)(struct vfe_device *vfe, u8 wm, enum vfe_line_id line_id,
28 u8 enable);
29 void (*enable_irq_pix_line)(struct vfe_device *vfe, u8 comp, enum vfe_line_id line_id,
30 u8 enable);
31 u16 (*get_ub_size)(u8 vfe_id);
32 void (*halt_clear)(struct vfe_device *vfe);
33 void (*halt_request)(struct vfe_device *vfe);
34 void (*set_camif_cfg)(struct vfe_device *vfe, struct vfe_line *line);
35 void (*set_camif_cmd)(struct vfe_device *vfe, u8 enable);
36 void (*set_cgc_override)(struct vfe_device *vfe, u8 wm, u8 enable);
37 void (*set_clamp_cfg)(struct vfe_device *vfe);
38 void (*set_crop_cfg)(struct vfe_device *vfe, struct vfe_line *line);
39 void (*set_demux_cfg)(struct vfe_device *vfe, struct vfe_line *line);
40 void (*set_ds)(struct vfe_device *vfe);
41 void (*set_module_cfg)(struct vfe_device *vfe, u8 enable);
42 void (*set_scale_cfg)(struct vfe_device *vfe, struct vfe_line *line);
43 void (*set_rdi_cid)(struct vfe_device *vfe, enum vfe_line_id id, u8 cid);
44 void (*set_realign_cfg)(struct vfe_device *vfe, struct vfe_line *line, u8 enable);
45 void (*set_qos)(struct vfe_device *vfe);
46 void (*set_xbar_cfg)(struct vfe_device *vfe, struct vfe_output *output, u8 enable);
47 void (*wm_frame_based)(struct vfe_device *vfe, u8 wm, u8 enable);
48 void (*wm_line_based)(struct vfe_device *vfe, u32 wm, struct v4l2_pix_format_mplane *pix,
49 u8 plane, u32 enable);
50 void (*wm_set_ub_cfg)(struct vfe_device *vfe, u8 wm, u16 offset, u16 depth);
51 void (*wm_set_subsample)(struct vfe_device *vfe, u8 wm);
52 void (*wm_set_framedrop_period)(struct vfe_device *vfe, u8 wm, u8 per);
53 void (*wm_set_framedrop_pattern)(struct vfe_device *vfe, u8 wm, u32 pattern);
54 void (*wm_set_ping_addr)(struct vfe_device *vfe, u8 wm, u32 addr);
55 void (*wm_set_pong_addr)(struct vfe_device *vfe, u8 wm, u32 addr);
56 int (*wm_get_ping_pong_status)(struct vfe_device *vfe, u8 wm);
57 void (*wm_enable)(struct vfe_device *vfe, u8 wm, u8 enable);
61 * vfe_calc_interp_reso - Calculate interpolation mode
62 * @input: Input resolution
63 * @output: Output resolution
65 * Return interpolation mode
67 static inline u8 vfe_calc_interp_reso(u16 input, u16 output)
69 if (input / output >= 16)
70 return 0;
72 if (input / output >= 8)
73 return 1;
75 if (input / output >= 4)
76 return 2;
78 return 3;
82 * vfe_gen1_disable - Disable streaming on VFE line
83 * @line: VFE line
85 * Return 0 on success or a negative error code otherwise
87 int vfe_gen1_disable(struct vfe_line *line);
90 * vfe_gen1_enable - Enable VFE module
91 * @line: VFE line
93 * Return 0 on success
95 int vfe_gen1_enable(struct vfe_line *line);
98 * vfe_gen1_enable - Halt VFE module
99 * @vfe: VFE device
101 * Return 0 on success
103 int vfe_gen1_halt(struct vfe_device *vfe);
106 * vfe_word_per_line - Calculate number of words per frame width
107 * @format: V4L2 format
108 * @width: Frame width
110 * Return number of words per frame width
112 int vfe_word_per_line(u32 format, u32 width);
114 extern const struct vfe_isr_ops vfe_isr_ops_gen1;
115 extern const struct camss_video_ops vfe_video_ops_gen1;
117 #endif /* QC_MSM_CAMSS_VFE_GEN1_H */