1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 // Software and any modification/derivatives thereof.
18 // No right, ownership, or interest to MStar Software and any
19 // modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 // supplied together with third party`s software and the use of MStar
23 // Software may require additional licenses from third parties.
24 // Therefore, you hereby agree it is your sole responsibility to separately
25 // obtain any and all third party right and license necessary for your use of
26 // such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 // MStar`s confidential information and you agree to keep MStar`s
30 // confidential information in strictest confidence and not disclose to any
31 // third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 // kind. Any warranties are hereby expressly disclaimed by MStar, including
35 // without limitation, any warranties of merchantability, non-infringement of
36 // intellectual property rights, fitness for a particular purpose, error free
37 // and in conformity with any international standard. You agree to waive any
38 // claim against MStar for any loss, damage, cost or expense that you may
39 // incur related to your use of MStar Software.
40 // In no event shall MStar be liable for any direct, indirect, incidental or
41 // consequential damages, including without limitation, lost of profit or
42 // revenues, lost or damage of data, and unauthorized system use.
43 // You agree that this Section 4 shall still apply without being affected
44 // even if MStar Software has been modified by MStar in accordance with your
45 // request or instruction for your use, except otherwise agreed by both
46 // parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 // services in relation with MStar Software to you for your use of
50 // MStar Software in conjunction with your or your customer`s product
51 // ("Services").
52 // You understand and agree that, except otherwise agreed by both parties in
53 // writing, Services are provided on an "AS IS" basis and the warranty
54 // disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 // or otherwise:
58 // (a) conferring any license or right to use MStar name, trademark, service
59 // mark, symbol or any other identification;
60 // (b) obligating MStar or any of its affiliates to furnish any person,
61 // including without limitation, you and your customers, any assistance
62 // of any kind whatsoever, or any information; or
63 // (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 // of Taiwan, R.O.C., excluding its conflict of law rules.
67 // Any and all dispute arising out hereof or related hereto shall be finally
68 // settled by arbitration referred to the Chinese Arbitration Association,
69 // Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 // Rules of the Association by three (3) arbitrators appointed in accordance
71 // with the said Rules.
72 // The place of arbitration shall be in Taipei, Taiwan and the language shall
73 // be English.
74 // The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94
95 #if !defined(MSOS_TYPE_LINUX_KERNEL)
96 #include "string.h"
97 #include "stdio.h"
98 #else
99 #include <linux/string.h>
100 #include <linux/module.h>
101 #include <linux/kernel.h>
102 #include <linux/init.h>
103 #include <linux/slab.h>
104 #include <linux/unistd.h>
105 #include <linux/sched.h>
106 #include <linux/fs.h>
107 #include <linux/file.h>
108 #include <linux/mm.h>
109 #include <linux/compat.h>
110 #include <linux/vmalloc.h>
111 #include <linux/err.h>
112 #include <asm/uaccess.h>
113 #endif
114 #include "MsCommon.h"
115 #include "MsTypes.h"
116 #include "utopia.h"
117 #include "utopia_dapi.h"
118 #include "hwreg_utility2.h"
119 #include "drvXC_IOPort.h"
120 #include "apiXC.h"
121 #include "color_reg.h"
122 #include "drvPQ_Define.h"
123 #include "drvPQ_Declare.h"
124 #include "drvPQ.h"
125 #include "PQ_private.h"
126 #include "apiPQ_v2.h"
127
128 extern MS_PQ_Mode_Info _stMode_Info[PQ_MAX_WINDOW];
129
130 #define BW_DBG(x) //x
131
132 extern MS_BOOL _gIsH264;
133 extern MS_BOOL _gIsMMplayer;
134 extern MS_BOOL _gIsMVC4kx1k;
135 extern MS_BOOL _gIsRmvb[PQ_MAX_WINDOW];
136 extern MS_BOOL _gbIsG3D; //priority for G3D
137 extern MS_BOOL _gbSubWin_En;
138 extern MS_BOOL _gIsDualDecode;
139
140 typedef struct
141 {
142 MS_U8 *pIPTable;
143 MS_U8 u8TabNums;
144 MS_U8 u8TabIdx;
145 } TAB_Info;
146
147 #ifndef PQ_BW_RMVB_ENABLE
148 #define PQ_BW_RMVB_ENABLE 0
149 #endif
150
151 #ifndef PQ_BW_MVC4kx1k_ENABLE
152 #define PQ_BW_MVC4kx1k_ENABLE 0
153 #endif
154
155 #ifndef PQ_BW_G3D_ENABLE
156 #define PQ_BW_G3D_ENABLE 0
157 #endif
158
159 #ifndef PQ_BW_PIP_ENABLE
160 #define PQ_BW_PIP_ENABLE 0
161 #endif
162
163 #ifndef PQ_BW_DUALDECODE_ENABLE
164 #define PQ_BW_DUALDECODE_ENABLE 0
165 #endif
166
167 #ifndef PQ_BW_HDMI4kx2k_ENABLE
168 #define PQ_BW_HDMI4kx2k_ENABLE 0
169 #endif
170
171 #ifndef PQ_BW_1KTraveling_ENABLE
172 #define PQ_BW_1KTraveling_ENABLE 0
173 #endif
174
175 #if PQ_BW_1KTraveling_ENABLE
176 extern MS_BOOL _gIs1KTraveling;
177 #endif
178
179 #include "QualityMap_BW.c"
180
181 #if !defined(MSOS_TYPE_LINUX_KERNEL)
Open_bandwidthtable_Bin(const MS_U8 * pName)182 MS_U8* Open_bandwidthtable_Bin(const MS_U8 * pName)
183 {
184 FILE *pFile;
185 MS_U32 u32Rst;
186 MS_U8 *pu8TempBuffer;
187 MS_S32 size;
188
189 pFile = fopen((const char*)pName, "rb");
190 if(pFile == NULL)
191 {
192 printf("Open Bandwidthtable.bin Failed\n");
193 return NULL;
194 }
195
196 fseek(pFile, 0, SEEK_END);
197 size = ftell(pFile);
198
199 if (size <= 0)
200 {
201 fclose(pFile);
202 return NULL;
203 }
204
205 rewind(pFile);
206 pu8TempBuffer = (MS_U8*) malloc((MS_U32)size);
207 if(pu8TempBuffer == NULL)
208 {
209 printf("out of memory \n");
210 fclose(pFile);
211 return NULL;
212 }
213
214 u32Rst = fread(pu8TempBuffer, 1, (MS_U32)size, pFile);
215 if(u32Rst != (MS_U32)size)
216 {
217 printf("Read Bandwidthtable.bin Error %td %td\n", (ptrdiff_t)u32Rst,(ptrdiff_t) ((MS_U32)size));
218 #if !defined(MSOS_TYPE_LINUX_KERNEL)
219 free(pu8TempBuffer);
220 #endif
221 fclose(pFile);
222 return NULL;
223 }
224 fclose(pFile);
225 return pu8TempBuffer;
226 }
227 #else
228
Open_bandwidthtable_Bin(const MS_U8 * pName)229 MS_U8* Open_bandwidthtable_Bin(const MS_U8 * pName)
230 {
231 long lFileSize;
232 MS_U32 u32Rst;
233 const char * Name;
234 MS_U8 *pu8Buffer;
235 Name = (const char *)pName;
236 struct file *pFile = NULL;
237
238 mm_segment_t cur_mm_seg;
239 pFile = filp_open(Name, O_RDONLY, 0);
240
241 if(IS_ERR(pFile))
242 {
243 printk("Open %s Failed\n", pName);
244
245 return NULL;
246 }
247
248 vfs_llseek(pFile, 0, SEEK_END);
249 lFileSize = pFile->f_pos;
250 if (lFileSize <= 0)
251 {
252 filp_close(pFile, NULL);
253
254 return NULL;
255 }
256 loff_t pos = vfs_llseek(pFile, 0, SEEK_SET);
257 pu8Buffer = (MS_U8*)vmalloc(lFileSize);
258
259 if(pu8Buffer == NULL)
260 {
261 printk("out of memory \n");
262 filp_close(pFile, NULL);
263
264 return NULL;
265 }
266 cur_mm_seg = get_fs();
267 set_fs(KERNEL_DS);
268 u32Rst = vfs_read(pFile, pu8Buffer, lFileSize, &pos);
269 set_fs(cur_mm_seg);
270 if(u32Rst != (MS_U32)lFileSize)
271 {
272 printk("Read %s Error %d %ld\n",pName, u32Rst, lFileSize);
273 vfree(pu8Buffer);
274 filp_close(pFile, NULL);
275
276 return NULL;
277 }
278
279 filp_close(pFile, NULL);
280 return pu8Buffer;
281
282 }
283 #endif
284
285
286 #if 1 /// for New MIU HW design
_MDrv_BW_LoadTable(void * pInstance,MS_U8 u8TabIdx)287 static void _MDrv_BW_LoadTable(void *pInstance,MS_U8 u8TabIdx)
288 {
289 MS_U8 *pu8Buffer;
290
291 const MS_U8 bandwidthfileName[] = "/config/pq/Bandwidth_RegTable.bin";
292 pu8Buffer = Open_bandwidthtable_Bin(bandwidthfileName);
293
294 _MDrv_BW_PushBuffer(u8TabIdx, pu8Buffer);
295 //printk("[%s] [%d] u8TabIdx=%lu\n", __FUNCTION__, __LINE__,u8TabIdx);
296 BW_DBG(printk("[BW]LoadTable\n"));
297 #if !defined(MSOS_TYPE_LINUX_KERNEL)
298 free(pu8Buffer);
299 #endif
300 }
301
302 #else
_MDrv_BW_LoadTable(void * pInstance,MS_U8 u8TabIdx)303 static void _MDrv_BW_LoadTable(void *pInstance,MS_U8 u8TabIdx)
304 {
305 TAB_Info tab_Info;
306 tab_Info.pIPTable = (void*)BWTABLE;
307 tab_Info.u8TabNums = BWTABLE_NUMS;
308 tab_Info.u8TabIdx = u8TabIdx;
309 MS_U32 u32Index = 0;
310
311 MS_U8 *pu8Buffer;
312
313 const MS_U8 bandwidthfileName[] = "/config/pq/Bandwidth_RegTable.bin";
314 pu8Buffer = Open_bandwidthtable_Bin(bandwidthfileName);
315 if(pu8Buffer != NULL)
316 {
317
318 tab_Info.pIPTable = pu8Buffer;
319 #if 1//def NEW_MIU
320 printf("@@#@@[%s][%d]\n", __FUNCTION__, __LINE__);
321 while(!(((pu8Buffer[u32Index]&0xFF) == 0xFF) && ((pu8Buffer[u32Index+1]&0xFF) == 0xFF) && ((pu8Buffer[u32Index+2]&0xFF) == 0xFF) && ((pu8Buffer[u32Index+3]&0xFF) == 0x00) && ((pu8Buffer[u32Index+4]&0xFF) == 0x00)))
322 {
323 u32Index++;
324 printf("@@#@@[%s][%d]u32Index=%lu\n", __FUNCTION__, __LINE__,u32Index);
325 }
326
327 tab_Info.pIPTable = pu8Buffer +u32Index + 5;
328 #else
329 while(!(((pu8Buffer[u32Index]&0xFF) == 0xFF) && ((pu8Buffer[u32Index+1]&0xFF) == 0xFF) && ((pu8Buffer[u32Index+2]&0xFF) == 0x00) && ((pu8Buffer[u32Index+3]&0xFF) == 0x00)))
330 {
331 u32Index++;
332 }
333
334 tab_Info.pIPTable = pu8Buffer +u32Index + 4;
335 #endif
336 printf("Read Bandwidthtable.bin\n");
337 }
338
339 BW_DBG(printf("[BW]LoadTable\n"));
340 _MDrv_BW_DumpTable(&tab_Info);
341 free(pu8Buffer);
342 }
343
344 #endif
345
MDrv_BW_CusMode_LoadTable_U2(void * pInstance,MS_U8 u8TabIdx)346 void MDrv_BW_CusMode_LoadTable_U2(void *pInstance, MS_U8 u8TabIdx)
347 {
348 if(u8TabIdx >= BWTABLE_NUMS)
349 {
350 BW_DBG(printf("[BW]LoadTable u8TabIdx bigger than BWTABLE_NUMS\n");)
351 return;
352 }
353
354 _MDrv_BW_LoadTable(pInstance,u8TabIdx);
355 }
356
MDrv_BW_CusMode_LoadTable(MS_U8 u8TabIdx)357 void MDrv_BW_CusMode_LoadTable( MS_U8 u8TabIdx)
358 {
359 #ifdef TRACE_DBG
360 printf("\33[1;33m[MARCOS](%s %d)\33[m\n", __FUNCTION__, __LINE__);
361 #endif
362 if (pu32BWInst == NULL)
363 {
364 if(UtopiaOpen(MODULE_PQ, &pu32BWInst, 0, NULL) != UTOPIA_STATUS_SUCCESS)
365 {
366 printf("UtopiaOpen PQ failed\n");
367 return ;
368 }
369 }
370
371 stPQ_BW_CusMode_LoadTable PQArgs;
372 PQArgs.u8TabIdx = u8TabIdx;
373 if(UtopiaIoctl(pu32BWInst, E_PQ_CMD_BW_CUSMODE_LOADTABLE, (void*)&PQArgs) != 0)
374 {
375 printf("Obtain PQ engine fail\n");
376 }
377 }
378
MDrv_BW_LoadInitTable_U2(void * pInstance)379 void MDrv_BW_LoadInitTable_U2(void *pInstance)
380 {
381 TAB_Info tab_Info;
382 tab_Info.pIPTable = (void*)BWTABLE_COM;
383 tab_Info.u8TabNums = 1;
384 tab_Info.u8TabIdx = 0;
385 MS_U8 u8TabIdx = 0;
386
387 MS_U8 *pu8Buffer;
388 const MS_U8 bandwidthfileName[] = "/config/pq/Bandwidth_RegTable.bin";
389 pu8Buffer = Open_bandwidthtable_Bin(bandwidthfileName);
390 if(pu8Buffer != NULL)
391 {
392 tab_Info.pIPTable = pu8Buffer;
393 printf("Read Bandwidthtable.bin\n");
394 }
395
396 BW_DBG(printf("[BW]LoadCommTable\n"));
397 _MDrv_BW_DumpTable(&tab_Info);
398
399 #if !defined(MSOS_TYPE_LINUX_KERNEL)
400 free(pu8Buffer);
401 #endif
402
403 //load normal as init status
404 u8TabIdx = BWTABLE_Normal_mode;
405 _MDrv_BW_LoadTable(pInstance,u8TabIdx);
406
407 }
MDrv_BW_LoadInitTable(void)408 void MDrv_BW_LoadInitTable(void)
409 {
410 if (pu32BWInst == NULL)
411 {
412 if(UtopiaOpen(MODULE_PQ, &pu32BWInst, 0, NULL) != UTOPIA_STATUS_SUCCESS)
413 {
414 printf("UtopiaOpen PQ failed\n");
415 return ;
416 }
417 }
418
419 if(UtopiaIoctl(pu32BWInst, E_PQ_CMD_BW_LOAD_INIT_TABLE, NULL) != 0)
420 {
421 printf("Obtain PQ engine fail\n");
422 return ;
423 }
424 else
425 {
426 return ;
427 }
428 }
429
MDrv_BW_IsDualDecode(void)430 MS_BOOL MDrv_BW_IsDualDecode(void)
431 {
432 if( ((MDrv_PQ_GetInputSourceType(PQ_MAIN_WINDOW) == PQ_INPUT_SOURCE_STORAGE) && (MDrv_PQ_GetInputSourceType(PQ_SUB_WINDOW) == PQ_INPUT_SOURCE_STORAGE))
433 || ((MDrv_PQ_GetInputSourceType(PQ_MAIN_WINDOW) == PQ_INPUT_SOURCE_STORAGE) && (MDrv_PQ_GetInputSourceType(PQ_SUB_WINDOW) == PQ_INPUT_SOURCE_DTV))
434 || ((MDrv_PQ_GetInputSourceType(PQ_MAIN_WINDOW) == PQ_INPUT_SOURCE_DTV) && (MDrv_PQ_GetInputSourceType(PQ_SUB_WINDOW) == PQ_INPUT_SOURCE_STORAGE))
435 )
436 {
437 _gIsDualDecode = TRUE;
438 }
439 else
440 {
441 _gIsDualDecode = FALSE;
442 }
443 return _gIsDualDecode;
444 }
445
MDrv_BW_LoadTableByContext_U2(void * pInstance,PQ_WIN eWindow)446 void MDrv_BW_LoadTableByContext_U2(void* pInstance,PQ_WIN eWindow)
447 {
448 MS_U16 u16Input_HSize = 0;
449 MS_U16 u16Input_VSize = 0;
450 MS_U8 u8TabIdx = 0;
451 MS_U16 u16Input_VFreq = 0;
452 MS_BOOL bIsInterlaced = FALSE;
453
454 bIsInterlaced = _stMode_Info[eWindow].bInterlace;
455 u16Input_HSize = _stMode_Info[eWindow].u16input_hsize;
456 u16Input_VSize = _stMode_Info[eWindow].u16input_vsize;
457 u16Input_VFreq = _stMode_Info[eWindow].u16input_vfreq;
458
459 printf("BW Window:%u, PQSource:%u, Hsize:%u, Vsize: %u, interlace:%u, Vfreq=%u\n",
460 eWindow, MDrv_PQ_GetInputSourceType_U2(pInstance, eWindow), u16Input_HSize, u16Input_VSize, bIsInterlaced, u16Input_VFreq);
461 #if PQ_BW_DUALDECODE_ENABLE
462 if(MDrv_BW_IsDualDecode() && _gbSubWin_En)
463 {
464 u8TabIdx = BWTABLE_DUALDECODE_mode;
465 }
466 else
467 #endif
468 #if PQ_BW_G3D_ENABLE
469 if(_gbIsG3D)
470 {
471 u8TabIdx = BWTABLE_G3D_mode;
472 }
473 else
474 #endif
475 #if PQ_BW_PIP_ENABLE
476 if(_gbSubWin_En)
477 {
478 u8TabIdx = BWTABLE_PIP_mode;
479 }
480 else
481 #endif
482 #if PQ_BW_RMVB_ENABLE
483 if( _gIsRmvb[PQ_MAIN_WINDOW] || _gIsRmvb[PQ_SUB_WINDOW])
484 {
485 BW_DBG(printf("RMVB flag: main:%u, sub:%u\n",_gIsRmvb[PQ_MAIN_WINDOW],_gIsRmvb[PQ_SUB_WINDOW]));
486 u8TabIdx = BWTABLE_Rmvb_mode ;
487 #if PQ_BW_1KTraveling_ENABLE
488 if (_gIs1KTraveling)
489 {
490 u8TabIdx = BWTABLE_VLC_MM_1080p_mode;
491 printf("load VLC_MM_1080p_mode in Rmvb\n");
492 }
493 #endif
494 }
495 else
496 #endif
497 #if PQ_BW_MVC4kx1k_ENABLE
498 if ( (u16Input_HSize>=3800) && (u16Input_VSize >= 1080)
499 && (MDrv_PQ_GetInputSourceType_U2(pInstance, PQ_MAIN_WINDOW) != PQ_INPUT_SOURCE_HDMI))
500 {
501
502 u8TabIdx = BWTABLE_MVC4kx1k_mode;
503 }
504 else
505 #endif
506 #if (PQ_BW_MM_ENABLE && PQ_BW_H264_ENABLE)
507 #if PQ_BW_1KTraveling_ENABLE
508 if (_gIsH264 && _gIsMMplayer && _gIs1KTraveling)
509 {
510 u8TabIdx = BWTABLE_VLC_MM_1080p_mode;
511 printf("load VLC_MM_1080p_mode in H264\n");
512 }
513 else
514 #endif
515 if((u16Input_HSize>=1440) && (u16Input_VSize >= 900) && _gIsH264 &&_gIsMMplayer)
516 {
517 u8TabIdx = BWTABLE_MM_HD_H264_mode;
518 }
519 else
520 #endif
521 #if PQ_BW_H264_ENABLE
522 if((u16Input_HSize>=1440) && (u16Input_VSize >= 900) && _gIsH264)
523 {
524 u8TabIdx = BWTABLE_HD_H264_mode;
525
526 }
527 else
528 #endif
529 #if PQ_BW_MM_ENABLE
530 #if PQ_BW_1KTraveling_ENABLE
531 if (_gIsMMplayer && _gIs1KTraveling)
532 {
533 u8TabIdx = BWTABLE_VLC_MM_1080p_mode;
534 printf("load VLC_MM_1080p_mode in MM\n");
535 }
536 else
537 #endif
538 if ((u16Input_HSize>=3840) && (u16Input_VSize >= 1080) && _gIsMMplayer)
539 {
540 // 4K2K and 4K1K MM bandwidth
541 u8TabIdx = BWTABLE_MM_4k2k_mode;
542 }
543 else
544 if (_gIsMMplayer)
545 {
546 // FHD MM bandwidth
547 u8TabIdx = BWTABLE_MM_1080p_mode;
548 }
549 else
550 #endif
551 #if PQ_BW_HDMI4kx2k_ENABLE
552 if ( (u16Input_HSize>=3800) && (u16Input_VSize >= 2000)
553 && (MDrv_PQ_GetInputSourceType_U2(pInstance, PQ_MAIN_WINDOW) == PQ_INPUT_SOURCE_HDMI))
554 {
555 u8TabIdx = BWTABLE_HDMI4kx2k_mode;
556 }
557 else
558 #endif
559 if ((u16Input_HSize>=1440) && (u16Input_VSize >= 900))
560 {
561 u8TabIdx = BWTABLE_1080p_mode;
562 }
563 else
564 {
565 u8TabIdx = BWTABLE_Normal_mode;
566 }
567
568 #if (PQ_BW_PIP_ENABLE == 0)
569 if(eWindow == PQ_MAIN_WINDOW)
570 #endif
571 {
572 _MDrv_BW_LoadTable(pInstance,u8TabIdx);
573 }
574 }
MDrv_BW_LoadTableByContext(PQ_WIN eWindow)575 void MDrv_BW_LoadTableByContext(PQ_WIN eWindow)
576 {
577 #ifdef TRACE_DBG
578 printf("\33[1;33m[MARCOS](%s %d)\33[m\n", __FUNCTION__, __LINE__);
579 #endif
580 if (pu32BWInst == NULL)
581 {
582 if(UtopiaOpen(MODULE_PQ, &pu32BWInst, 0, NULL) != UTOPIA_STATUS_SUCCESS)
583 {
584 printf("UtopiaOpen PQ failed\n");
585 return ;
586 }
587 }
588
589 stPQ_BW_LoadTableByContext PQArgs;
590 PQArgs.eWindow = eWindow;
591 if(UtopiaIoctl(pu32BWInst, E_PQ_CMD_BW_LOAD_TABLE_BY_CONTEXT, (void*)&PQArgs) != 0)
592 {
593 printf("Obtain PQ engine fail\n");
594 return;
595 }
596 else
597 {
598 return;
599 }
600 }
MDrv_BW_ResetToDefault_U2(void * pInstance)601 void MDrv_BW_ResetToDefault_U2(void* pInstance)
602 {
603 printf("Load default BW table\n");
604 _MDrv_BW_LoadTable(pInstance,BWTABLE_Normal_mode);
605 }
MDrv_BW_resetToDefault(void)606 void MDrv_BW_resetToDefault(void)
607 {
608 if (pu32BWInst == NULL)
609 {
610 if(UtopiaOpen(MODULE_PQ, &pu32BWInst, 0, NULL) != UTOPIA_STATUS_SUCCESS)
611 {
612 printf("UtopiaOpen PQ failed\n");
613 return ;
614 }
615 }
616
617 if(UtopiaIoctl(pu32BWInst, E_PQ_CMD_BW_RESET_TO_DEFAULT, NULL) != 0)
618 {
619 printf("Obtain PQ engine fail\n");
620 return ;
621 }
622 else
623 {
624 return ;
625 }
626 }
627
628 EXPORT_SYMBOL(MDrv_BW_LoadInitTable);
629 EXPORT_SYMBOL(MDrv_BW_LoadTableByContext);
630