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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
/* linux/drivers/video/samsung/s3cfb_lvds.c
*
* 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.
**/
#include "s3cfb.h"
#if 0
static struct s3cfb_lcd lvds = {
.width = 1024,
.height = 600,
.bpp = 32,
.freq = 60,
.timing = {
.h_fp = 79,
.h_bp = 200,
.h_sw = 40,
.v_fp = 10,
.v_fpe = 1,
.v_bp = 11,
.v_bpe = 1,
.v_sw = 10,
},
.polarity = {
.rise_vclk = 0,
.inv_hsync = 1,
.inv_vsync = 1,
.inv_vden = 0,
},
}
/* name should be fixed as 's3cfb_set_lcd_info' */
void s3cfb_set_lcd_info_lvds(struct s3cfb_global *ctrl)
{
lvds.init_ldi = NULL;
ctrl->lcd = &lvds;
}
#endif
//#define MDNIE_TUNING
#ifdef MDNIE_TUNING
#include <linux/vmalloc.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <asm/uaccess.h>
#define MDNIE_TUNING_TUNEFILE_PATH "/sdcard/sd/p1/mdnie_tune"
#define TUNE_TEXT_MAX_LINES 100
#define TUNE_MAX_VALUES 200
unsigned short *test[1];
EXPORT_SYMBOL(test);
extern void mDNIe_txtbuf_to_parsing(void);
static int parse_from_text(char * src, int len, unsigned short * output)
{
int i,count, ret;
int out_index=0;
char * str_line[TUNE_TEXT_MAX_LINES];
char * sstart;
char * c;
unsigned int data1, data2;
c = src;
count = 0;
sstart = c;
for(i=0; i<len; i++,c++)
{
char a = *c;
if(a=='\r' || a=='\n')
{
if(c > sstart)
{
str_line[count] = sstart;
count++;
}
*c='\0';
sstart = c+1;
}
}
if(c > sstart)
{
str_line[count] = sstart;
count++;
}
printk("<MDNIE> %s lines:%d\n", __func__, count);
for(i=0; i<count; i++)
{
printk("line:%d, string:%s[end]\n", i, str_line[i]);
ret = sscanf(str_line[i], "0x%x,0x%x\n", &data1, &data2);
printk("line:%d, num:%d, d1:0x%04x, d2:0x%04x\n", i, ret, data1, data2);
if(ret == 2)
{
output[out_index++] = data1;
output[out_index++] = data2;
}
}
output[out_index] = 0xffff; // END_SEQ
return out_index;
}
int mDNIe_tuning_load_from_file(void)
{
struct file *filp;
char *dp;
long l;
loff_t pos;
int i;
int ret;
printk("<MDNIE> %s start.\n", __func__);
mm_segment_t fs = get_fs();
set_fs(get_ds());
filp = filp_open(MDNIE_TUNING_TUNEFILE_PATH, O_RDONLY, 0);
if(IS_ERR(filp))
{
printk("<MDNIE> file open error:%d\n", filp);
return -1;
}
l = filp->f_path.dentry->d_inode->i_size;
printk("<MDNIE> l = %ld\n", l);
//dp = kmalloc(l, GFP_KERNEL);
dp = kmalloc(l+10, GFP_KERNEL); // add cushion
if(dp == NULL)
{
printk("<MDNIE> Out of Memory\n");
filp_close(filp, current->files);
return -1;
}
pos = 0;
memset(dp, 0, l);
ret = vfs_read(filp, (char __user *)dp, l, &pos);
if(ret != l)
{
printk("<MDNIE> Failed to read file ret = %d\n", ret);
kfree(dp);
filp_close(filp, current->files);
return -1;
}
filp_close(filp, current->files);
set_fs(fs);
for(i=0; i<l; i++)
{
printk("%x ", dp[i]);
}
printk("\n");
test[0] = kmalloc(TUNE_MAX_VALUES*sizeof(short), GFP_KERNEL);
if(test[0] == NULL)
{
printk("<MDNIE> Out of Memory\n");
kfree(dp);
return -1;
}
ret = parse_from_text(dp, l, test[0]);
printk("<MDNIE> parsing data:%d\n", ret);
if(ret > 0)
{
printk("<MDNIE> Call mDNIe_txtbuf_to_parsing\n");
mDNIe_txtbuf_to_parsing();
}
kfree(test[0]);
kfree(dp);
return ret;
// printk("<=PCAM=> sr200pc10_regs_table 0x%x, %ld\n", (unsigned int)dp, l);
}
EXPORT_SYMBOL(mDNIe_tuning_load_from_file);
#endif
MODULE_LICENSE("GPL");
|