summaryrefstree
path: root/kernel/drivers/media/platform/exynos/camera/is-devicemgr.h
blob: be8c4fdac98021a81175f0098fbdbada4d6aa3b4 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Samsung Exynos5 SoC series FIMC-IS driver
 *
 *
 * Copyright (c) 2016 Samsung Electronics Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */


#ifndef IS_DEVICE_MGR_H
#define IS_DEVICE_MGR_H

#include "is-config.h"
#include "is-device-ischain.h"
#include "is-device-sensor.h"

#ifdef CONFIG_USE_SENSOR_GROUP
#define GET_DEVICE_TYPE_BY_GRP(group_id)	\
	({enum is_device_type type;	\
	 switch (group_id) {		\
	 case GROUP_ID_SS0:		\
	 case GROUP_ID_SS1:		\
	 case GROUP_ID_SS2:		\
	 case GROUP_ID_SS3:		\
	 case GROUP_ID_SS4:		\
	 case GROUP_ID_SS5:		\
		type = IS_DEVICE_SENSOR;	\
		break;			\
	 default:			\
		type = IS_DEVICE_ISCHAIN;	\
		break;			\
	 }; type;})

#define GET_HEAD_GROUP_IN_DEVICE(type, group)	\
	({ struct is_group *head;			\
	 head = (group)->head;				\
	 while (head) {					\
		if (head->device_type == type)		\
			break;				\
		else					\
			head = head->child;		\
	 }; head;})

#define GET_OUT_FLAG_IN_DEVICE(device_type, out_flag)				\
	({unsigned long tmp_out_flag;						\
	if (device_type == IS_DEVICE_ISCHAIN)				\
		tmp_out_flag = ((out_flag) & (~((1 << ENTRY_3AA) - 1)));	\
	else									\
		tmp_out_flag = ((out_flag) & ((1 << ENTRY_3AA) - 1));		\
	tmp_out_flag;})
#else
#define GET_DEVICE_TYPE_BY_GRP(group_id) IS_DEVICE_ISCHAIN
#define GET_HEAD_GROUP_IN_DEVICE(type, group) ((group)->head)
#define GET_OUT_FLAG_IN_DEVICE(device_type, out_flag) (out_flag)
#endif

struct devicemgr_sensor_tag_data {
	struct is_devicemgr	*devicemgr;
	struct is_group		*group;
	u32				fcount;
	u32				stream;
};

struct is_devicemgr {
	struct is_device_sensor		*sensor[IS_STREAM_COUNT];
	struct is_device_ischain		*ischain[IS_STREAM_COUNT];
	struct tasklet_struct			tasklet[IS_STREAM_COUNT];
	struct devicemgr_sensor_tag_data	tag_data[IS_STREAM_COUNT];
};

struct is_group *get_ischain_leader_group(struct is_device_ischain *device);
int is_devicemgr_probe(struct is_devicemgr *devicemgr);
int is_devicemgr_open(struct is_devicemgr *devicemgr,
		void *device, enum is_device_type type);
int is_devicemgr_binding(struct is_devicemgr *devicemgr,
		struct is_device_sensor *sensor,
		struct is_device_ischain *ischain,
		enum is_device_type type);
int is_devicemgr_start(struct is_devicemgr *devicemgr,
		void *device, enum is_device_type type);
int is_devicemgr_stop(struct is_devicemgr *devicemgr,
		void *device, enum is_device_type type);
int is_devicemgr_close(struct is_devicemgr *devicemgr,
		void *device, enum is_device_type type);
int is_devicemgr_shot_callback(struct is_group *group,
		struct is_frame *frame,
		u32 fcount,
		enum is_device_type type);
int is_devicemgr_shot_done(struct is_group *group,
		struct is_frame *ldr_frame,
		u32 status);
#endif