summaryrefslogtreecommitdiff
path: root/drivers/media/sprd_sensor/csi2/csi_api_null.c
blob: 56b7556f3fc2f82a0b766827f5c66d53d4c38c7a (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include <linux/kernel.h>
#include <linux/semaphore.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>


#include "csi_api.h"
#include "csi_log.h"

void csi_api_event1_handler(int irq, void *handle);
void csi_api_event2_handler(int irq, void *handle);
int csi_api_malloc(void **handle)
{
	return ERR_NOT_COMPATIBLE;
}

void csi_api_free(void *handle)
{
}
u8 csi_api_init(u32 bps_per_lane, u32 phy_id)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_start(void *handle)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_close(void *handle, u32 phy_id)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_set_on_lanes(u8 no_of_lanes)
{
	return ERR_NOT_COMPATIBLE;
}

u8 csi_api_get_on_lanes()
{
	return ERR_NOT_COMPATIBLE;
}
csi_lane_state_t csi_api_get_clk_state()
{
	return ERR_NOT_COMPATIBLE;
}
csi_lane_state_t csi_api_get_lane_state(u8 lane)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_register_event(void *handle, csi_event_t event, u8 vc_lane, handler_t handler)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_unregister_event(void *handle, csi_event_t event, u8 vc_lane)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_register_line_event(void *handle, u8 vc, csi_data_type_t data_type, csi_line_event_t line_event, handler_t handler)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_unregister_line_event(void *handle, u8 vc, csi_data_type_t data_type, csi_line_event_t line_event)
{
	return ERR_NOT_COMPATIBLE;
}
void csi_api_event1_handler(int irq, void *handle)
{
	return ERR_NOT_COMPATIBLE;
}
void csi_api_event2_handler(int irq, void *handle)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_unregister_all_events(void *handle)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_shut_down_phy(u8 shutdown)
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_reset_phy()
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_reset_controller()
{
	return ERR_NOT_COMPATIBLE;
}
u8 csi_api_core_write(csi_registers_t address, u32 data)
{
	return ERR_NOT_COMPATIBLE;
}
u32 csi_api_core_read(csi_registers_t address)
{
	return ERR_NOT_COMPATIBLE;
}

int csi_reg_isr(void *handle, csi2_isr_func user_func, void* user_data)
{
	unsigned long                flag;
	struct csi_context *csi_handle = handle;
	if (NULL == handle) {
		printk("handle null\n");
		return ERR_UNDEFINED;
	}

	spin_lock_irqsave(&csi_handle->csi2_lock, flag);
	csi_handle->isr_cb = user_func;
	csi_handle->u_data = user_data;
	spin_unlock_irqrestore(&csi_handle->csi2_lock, flag);
	return 0;
}

int csi_read_registers(u32* reg_buf, u32 *buf_len)
{
	u32                *reg_addr = (u32*)CSI2_BASE;

	if (NULL == reg_buf || NULL == buf_len || 0 != (*buf_len % 4)) {
		return -1;
	}

	while (buf_len != 0 && (u32)reg_addr < (CSI2_BASE + SPRD_CSI2_REG_SIZE)) {
		*reg_buf++ = *(volatile u32*)reg_addr++;
		*buf_len -= 4;
	}

	*buf_len = SPRD_CSI2_REG_SIZE;
	return 0;
}