Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 051a01ac authored by Todor Tomov's avatar Todor Tomov Committed by Mauro Carvalho Chehab
Browse files

media: camss: vfe: Split to hardware dependent and independent parts



This will allow to add support for different hardware.

Signed-off-by: default avatarTodor Tomov <todor.tomov@linaro.org>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent e08c7f86
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ qcom-camss-objs += \
		camss-csiphy-3ph-1-0.o \
		camss-csiphy.o \
		camss-ispif.o \
		camss-vfe-4-1.o \
		camss-vfe.o \
		camss-video.o \

+1006 −0

File added.

Preview size limit exceeded, changes collapsed.

+94 −980

File changed.

Preview size limit exceeded, changes collapsed.

+68 −5
Original line number Diff line number Diff line
@@ -26,11 +26,6 @@
#define MSM_VFE_IMAGE_MASTERS_NUM 7
#define MSM_VFE_COMPOSITE_IRQ_NUM 4

#define MSM_VFE_VFE0_UB_SIZE 1023
#define MSM_VFE_VFE0_UB_SIZE_RDI (MSM_VFE_VFE0_UB_SIZE / 3)
#define MSM_VFE_VFE1_UB_SIZE 1535
#define MSM_VFE_VFE1_UB_SIZE_RDI (MSM_VFE_VFE1_UB_SIZE / 3)

enum vfe_output_state {
	VFE_OUTPUT_OFF,
	VFE_OUTPUT_RESERVED,
@@ -78,6 +73,70 @@ struct vfe_line {
	struct vfe_output output;
};

struct vfe_device;

struct vfe_hw_ops {
	void (*hw_version_read)(struct vfe_device *vfe, struct device *dev);
	u16 (*get_ub_size)(u8 vfe_id);
	void (*global_reset)(struct vfe_device *vfe);
	void (*halt_request)(struct vfe_device *vfe);
	void (*halt_clear)(struct vfe_device *vfe);
	void (*wm_enable)(struct vfe_device *vfe, u8 wm, u8 enable);
	void (*wm_frame_based)(struct vfe_device *vfe, u8 wm, u8 enable);
	void (*wm_line_based)(struct vfe_device *vfe, u32 wm,
			      struct v4l2_pix_format_mplane *pix,
			      u8 plane, u32 enable);
	void (*wm_set_framedrop_period)(struct vfe_device *vfe, u8 wm, u8 per);
	void (*wm_set_framedrop_pattern)(struct vfe_device *vfe, u8 wm,
					 u32 pattern);
	void (*wm_set_ub_cfg)(struct vfe_device *vfe, u8 wm, u16 offset,
			      u16 depth);
	void (*bus_reload_wm)(struct vfe_device *vfe, u8 wm);
	void (*wm_set_ping_addr)(struct vfe_device *vfe, u8 wm, u32 addr);
	void (*wm_set_pong_addr)(struct vfe_device *vfe, u8 wm, u32 addr);
	int (*wm_get_ping_pong_status)(struct vfe_device *vfe, u8 wm);
	void (*bus_enable_wr_if)(struct vfe_device *vfe, u8 enable);
	void (*bus_connect_wm_to_rdi)(struct vfe_device *vfe, u8 wm,
				      enum vfe_line_id id);
	void (*wm_set_subsample)(struct vfe_device *vfe, u8 wm);
	void (*bus_disconnect_wm_from_rdi)(struct vfe_device *vfe, u8 wm,
					   enum vfe_line_id id);
	void (*set_xbar_cfg)(struct vfe_device *vfe, struct vfe_output *output,
			     u8 enable);
	void (*set_rdi_cid)(struct vfe_device *vfe, enum vfe_line_id id,
			    u8 cid);
	void (*reg_update)(struct vfe_device *vfe, enum vfe_line_id line_id);
	void (*reg_update_clear)(struct vfe_device *vfe,
				 enum vfe_line_id line_id);
	void (*enable_irq_wm_line)(struct vfe_device *vfe, u8 wm,
				   enum vfe_line_id line_id, u8 enable);
	void (*enable_irq_pix_line)(struct vfe_device *vfe, u8 comp,
				    enum vfe_line_id line_id, u8 enable);
	void (*enable_irq_common)(struct vfe_device *vfe);
	void (*set_demux_cfg)(struct vfe_device *vfe, struct vfe_line *line);
	void (*set_scale_cfg)(struct vfe_device *vfe, struct vfe_line *line);
	void (*set_crop_cfg)(struct vfe_device *vfe, struct vfe_line *line);
	void (*set_clamp_cfg)(struct vfe_device *vfe);
	void (*set_qos)(struct vfe_device *vfe);
	void (*set_cgc_override)(struct vfe_device *vfe, u8 wm, u8 enable);
	void (*set_camif_cfg)(struct vfe_device *vfe, struct vfe_line *line);
	void (*set_camif_cmd)(struct vfe_device *vfe, u8 enable);
	void (*set_module_cfg)(struct vfe_device *vfe, u8 enable);
	int (*camif_wait_for_stop)(struct vfe_device *vfe, struct device *dev);
	void (*isr_read)(struct vfe_device *vfe, u32 *value0, u32 *value1);
	void (*violation_read)(struct vfe_device *vfe);
	irqreturn_t (*isr)(int irq, void *dev);
};

struct vfe_isr_ops {
	void (*reset_ack)(struct vfe_device *vfe);
	void (*halt_ack)(struct vfe_device *vfe);
	void (*reg_update)(struct vfe_device *vfe, enum vfe_line_id line_id);
	void (*sof)(struct vfe_device *vfe, enum vfe_line_id line_id);
	void (*comp_done)(struct vfe_device *vfe, u8 comp);
	void (*wm_done)(struct vfe_device *vfe, u8 wm);
};

struct vfe_device {
	struct camss *camss;
	u8 id;
@@ -97,6 +156,8 @@ struct vfe_device {
	struct vfe_line line[MSM_VFE_LINE_NUM];
	u32 reg_update;
	u8 was_streaming;
	const struct vfe_hw_ops *ops;
	struct vfe_isr_ops isr_ops;
};

struct resources;
@@ -114,4 +175,6 @@ void msm_vfe_get_vfe_line_id(struct media_entity *entity, enum vfe_line_id *id);

void msm_vfe_stop_streaming(struct vfe_device *vfe);

extern const struct vfe_hw_ops vfe_ops_4_1;

#endif /* QC_MSM_CAMSS_VFE_H */