Linux Audio

Check our new training course

Loading...
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * camss-vfe.h
  4 *
  5 * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module
  6 *
  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
 12
 13#include "camss-vfe.h"
 14
 15enum vfe_line_id;
 16struct vfe_device;
 17struct vfe_line;
 18struct vfe_output;
 19
 20struct 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);
 58};
 59
 60/*
 61 * vfe_calc_interp_reso - Calculate interpolation mode
 62 * @input: Input resolution
 63 * @output: Output resolution
 64 *
 65 * Return interpolation mode
 66 */
 67static inline u8 vfe_calc_interp_reso(u16 input, u16 output)
 68{
 69	if (input / output >= 16)
 70		return 0;
 71
 72	if (input / output >= 8)
 73		return 1;
 74
 75	if (input / output >= 4)
 76		return 2;
 77
 78	return 3;
 79}
 80
 81/*
 82 * vfe_gen1_disable - Disable streaming on VFE line
 83 * @line: VFE line
 84 *
 85 * Return 0 on success or a negative error code otherwise
 86 */
 87int vfe_gen1_disable(struct vfe_line *line);
 88
 89/*
 90 * vfe_gen1_enable - Enable VFE module
 91 * @line: VFE line
 92 *
 93 * Return 0 on success
 94 */
 95int vfe_gen1_enable(struct vfe_line *line);
 96
 97/*
 98 * vfe_gen1_enable - Halt VFE module
 99 * @vfe: VFE device
100 *
101 * Return 0 on success
102 */
103int vfe_gen1_halt(struct vfe_device *vfe);
104
105/*
106 * vfe_word_per_line - Calculate number of words per frame width
107 * @format: V4L2 format
108 * @width: Frame width
109 *
110 * Return number of words per frame width
111 */
112int vfe_word_per_line(u32 format, u32 width);
113
114extern const struct vfe_isr_ops vfe_isr_ops_gen1;
115extern const struct camss_video_ops vfe_video_ops_gen1;
116
117#endif /* QC_MSM_CAMSS_VFE_GEN1_H */