summaryrefslogtreecommitdiffstats
path: root/include/media/tegra_camera_dev_mfi.h
blob: 6e8f7ef655a25a9e78c1bac3699ffbb042104555 (plain) (blame)
1
2
3
4
5
6
7
8
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (c) 2015-2017, NVIDIA CORPORATION.  All rights reserved.

 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.

 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __CAMERA_DEV_MFI_H__
#define __CAMERA_DEV_MFI_H__

#include <linux/list.h>
#include <linux/i2c.h>
#include <linux/regmap.h>

#define CAMERA_MAX_NAME_LENGTH	32
#define CAMERA_REGCACHE_MAX		(128)

struct cam_reg {
	u32 addr;
	u32 val;
};

struct cam_i2c_msg {
	struct i2c_msg msg;
	u8 buf[8];
};

struct camera_mfi_dev {
	char name[CAMERA_MAX_NAME_LENGTH];
	struct regmap *regmap;
	struct cam_reg reg[CAMERA_REGCACHE_MAX];
	struct cam_reg prev_reg[CAMERA_REGCACHE_MAX];
	struct i2c_client *i2c_client;
	struct cam_i2c_msg msg[CAMERA_REGCACHE_MAX];
	u32 num_used;
	u32 prev_num_used;
	struct list_head list;
};

struct mfi_cb_arg {
	u8 vi_chan;
};

void tegra_camera_dev_mfi_cb(void *stub);
int tegra_camera_dev_mfi_clear(struct camera_mfi_dev *cmfidev);
int tegra_camera_dev_mfi_wr_add(
	struct camera_mfi_dev *cmfidev, u32 offset, u32 val);
int tegra_camera_dev_mfi_wr_add_i2c(
	struct camera_mfi_dev *cmfidev, struct i2c_msg *msg, int num);
int tegra_camera_dev_mfi_add_regmap(
	struct camera_mfi_dev **cmfidev, u8 *name, struct regmap *regmap);
int tegra_camera_dev_mfi_add_i2cclient(
	struct camera_mfi_dev **cmfidev, u8 *name,
	struct i2c_client *i2c_client);

#endif
/* __CAMERA_DEV_MFI_H__ */