camss-csid.h 1.8 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
T
Todor Tomov 已提交
2 3 4
/*
 * camss-csid.h
 *
5
 * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module
T
Todor Tomov 已提交
6 7
 *
 * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
T
Todor Tomov 已提交
8
 * Copyright (C) 2015-2018 Linaro Ltd.
T
Todor Tomov 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
 */
#ifndef QC_MSM_CAMSS_CSID_H
#define QC_MSM_CAMSS_CSID_H

#include <linux/clk.h>
#include <media/media-entity.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-mediabus.h>
#include <media/v4l2-subdev.h>

#define MSM_CSID_PAD_SINK 0
#define MSM_CSID_PAD_SRC 1
#define MSM_CSID_PADS_NUM 2

enum csid_payload_mode {
	CSID_PAYLOAD_MODE_INCREMENTING = 0,
	CSID_PAYLOAD_MODE_ALTERNATING_55_AA = 1,
	CSID_PAYLOAD_MODE_ALL_ZEROES = 2,
	CSID_PAYLOAD_MODE_ALL_ONES = 3,
	CSID_PAYLOAD_MODE_RANDOM = 4,
	CSID_PAYLOAD_MODE_USER_SPECIFIED = 5,
};

struct csid_testgen_config {
	u8 enabled;
	enum csid_payload_mode payload_mode;
};

struct csid_phy_config {
	u8 csiphy_id;
	u8 lane_cnt;
	u32 lane_assign;
};

struct csid_device {
T
Todor Tomov 已提交
45
	struct camss *camss;
T
Todor Tomov 已提交
46 47 48 49 50 51
	u8 id;
	struct v4l2_subdev subdev;
	struct media_pad pads[MSM_CSID_PADS_NUM];
	void __iomem *base;
	u32 irq;
	char irq_name[30];
52
	struct camss_clock *clock;
T
Todor Tomov 已提交
53 54 55 56 57 58 59 60 61 62 63 64
	int nclocks;
	struct regulator *vdda;
	struct completion reset_complete;
	struct csid_testgen_config testgen;
	struct csid_phy_config phy;
	struct v4l2_mbus_framefmt fmt[MSM_CSID_PADS_NUM];
	struct v4l2_ctrl_handler ctrls;
	struct v4l2_ctrl *testgen_mode;
};

struct resources;

T
Todor Tomov 已提交
65
int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
T
Todor Tomov 已提交
66 67 68 69 70 71 72 73 74 75
			 const struct resources *res, u8 id);

int msm_csid_register_entity(struct csid_device *csid,
			     struct v4l2_device *v4l2_dev);

void msm_csid_unregister_entity(struct csid_device *csid);

void msm_csid_get_csid_id(struct media_entity *entity, u8 *id);

#endif /* QC_MSM_CAMSS_CSID_H */