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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that 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.
*/
#include "cam_notifier.h"
#include <cam_sensor_cmn_header.h>
/*
* Notifier list for kernel code which wants to know
* camera module versions
*/
static RAW_NOTIFIER_HEAD(dev_cam_eeprom_noti_chain);
#if defined(CONFIG_SAMSUNG_WACOM_NOTIFIER)
/*
* notifyCameraList - store camera list
* wacom_notify_value - store camera eeprom information
*
* each camera use 1 byte.
*
* store up to 8 cameras. (64bit)
*/
static char checkCamera[] = { 'S', 'C', 'P', 'M', 'V', 'N', 'A', 'Y', 'H' };
#if defined(CONFIG_SEC_P3Q_PROJECT)
uint32_t notifyCameraList[] = {
SEC_WIDE_SENSOR,
SEC_ULTRA_WIDE_SENSOR,
SEC_TELE_SENSOR,
SEC_TELE2_SENSOR,
SEC_FRONT_SENSOR,
};
#elif defined(CONFIG_SEC_Q2Q_PROJECT)
uint32_t notifyCameraList[] = {
SEC_WIDE_SENSOR,
SEC_ULTRA_WIDE_SENSOR,
SEC_FRONT_SENSOR,
SEC_FRONT_TOP_SENSOR,
};
#else
uint32_t notifyCameraList[] = {
};
#endif /* CONFIG_SAMSUNG_WACOM_NOTIFIER */
static unsigned long wacom_notify_value = 0;
/**
* is_eeprom_info_update - update camera eeprom information to wacom_notify_value
* @type: eeprom type
* @header_ver: eeprom header string.
*/
int is_eeprom_info_update(uint32_t type, char *header_ver)
{
int result = 0;
uint listIndex = 0, listSize = 0;
uint checkIndex = 0, checkSize = 0;
bool bCheck = false;
if (!header_ver)
{
return -1;
}
listSize = sizeof(notifyCameraList) / sizeof(uint32_t);
checkSize = sizeof(checkCamera) / sizeof(char);
for (listIndex = 0; listIndex < listSize; listIndex++)
{
if (type == notifyCameraList[listIndex])
{
for (checkIndex = 0; checkIndex < checkSize; checkIndex++)
{
if (header_ver[9] == checkCamera[checkIndex])
{
wacom_notify_value |= (unsigned long)(checkIndex + 1) << (listIndex * 8);
bCheck = true;
break;
}
}
}
if (bCheck == true)
{
break;
}
}
// pr_info("[NOTI_DBG] notify header info:0x%llx(%d, %c)", wacom_notify_value, type, header_ver[9]);
return result;
}
/**
* is_eeprom_wacom_update_notifier - Send wacom_notify_value to notifier block.
*
* Define the mask if you need to send only information from certain cameras.
*/
int is_eeprom_wacom_update_notifier()
{
pr_info("[NOTI_DBG] send value 0x%llx to wacom", wacom_notify_value);
return raw_notifier_call_chain(&dev_cam_eeprom_noti_chain,
wacom_notify_value, NULL);
}
#endif
/* Common Notifier API */
int is_register_eeprom_notifier(struct notifier_block *nb)
{
return is_register_notifier(&dev_cam_eeprom_noti_chain, nb);
}
EXPORT_SYMBOL_GPL(is_register_eeprom_notifier);
int is_unregister_eeprom_notifier(struct notifier_block *nb)
{
return is_unregister_notifier(&dev_cam_eeprom_noti_chain, nb);
}
EXPORT_SYMBOL_GPL(is_unregister_eeprom_notifier);
int is_register_notifier(struct raw_notifier_head *head, struct notifier_block *nb)
{
if (!nb)
return -ENOENT;
return raw_notifier_chain_register(head,nb);
}
int is_unregister_notifier(struct raw_notifier_head *head, struct notifier_block *nb)
{
if (!nb)
return -ENOENT;
return raw_notifier_chain_unregister(head,nb);
}
|