lin
2025-01-10 2e0fe69425adee0529756dc3381ac1838197f3ac
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
/*
 * drivers/video/sunxi/disp2/disp/de/disp_private.c
 *
 * Copyright (c) 2007-2019 Allwinnertech Co., Ltd.
 * Author: zhengxiaobin <zhengxiaobin@allwinnertech.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * 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 "disp_private.h"
 
s32 disp_delay_ms(u32 ms)
{
#if defined(__LINUX_PLAT__)
   u32 timeout = msecs_to_jiffies(ms);
 
   set_current_state(TASK_UNINTERRUPTIBLE);
   schedule_timeout(timeout);
#endif
#ifdef __BOOT_OSAL__
   wBoot_timer_delay(ms);//assume cpu runs at 1000Mhz,10 clock one cycle
#endif
#ifdef __UBOOT_PLAT__
    __msdelay(ms);
#endif
   return 0;
}
 
 
s32 disp_delay_us(u32 us)
{
#if defined(__LINUX_PLAT__)
   udelay(us);
#endif
#ifdef __BOOT_OSAL__
   volatile u32 time;
 
   for (time = 0; time < (us*700/10);time++);//assume cpu runs at 700Mhz,10 clock one cycle
#endif
#ifdef __UBOOT_PLAT__
    __usdelay(us);
#endif
   return 0;
}
 
u32 dump_layer_config(struct disp_layer_config_data *data)
{
   u32 count = 0;
   char buf[512];
 
   count += sprintf(buf + count, " %6s ", (data->config.info.mode == LAYER_MODE_BUFFER)? "buffer":"color");
   count += sprintf(buf + count, " %8s ", (data->config.enable==1)?"enable":"disable");
   count += sprintf(buf + count, "ch[%1d] ", data->config.channel);
   count += sprintf(buf + count, "lyr[%1d] ", data->config.layer_id);
   count += sprintf(buf + count, "z[%1d] ", data->config.info.zorder);
   count += sprintf(buf + count, "pre_m[%1s] ", (data->config.info.fb.pre_multiply)? "Y":"N");
   count += sprintf(buf + count, "alpha[%5s %3d] ", (data->config.info.alpha_mode)? "globl":"pixel", data->config.info.alpha_value);
   count += sprintf(buf + count, "fmt[%3d] ", data->config.info.fb.format);
   count += sprintf(buf + count, "size[%4d,%4d;%4d,%4d;%4d,%4d] ", data->config.info.fb.size[0].width, data->config.info.fb.size[0].height,
       data->config.info.fb.size[0].width, data->config.info.fb.size[0].height,data->config.info.fb.size[0].width, data->config.info.fb.size[0].height);
   count += sprintf(buf + count, "crop[%4d,%4d,%4d,%4d] ", (u32)(data->config.info.fb.crop.x>>32), (u32)(data->config.info.fb.crop.y>>32),
       (u32)(data->config.info.fb.crop.width>>32),    (u32)(data->config.info.fb.crop.height>>32));
   count += sprintf(buf + count, "frame[%4d,%4d,%4d,%4d] ", data->config.info.screen_win.x, data->config.info.screen_win.y, data->config.info.screen_win.width, data->config.info.screen_win.height);
   count += sprintf(buf + count, "addr[%8llx,%8llx,%8llx] ", data->config.info.fb.addr[0], data->config.info.fb.addr[1], data->config.info.fb.addr[2]);
   count += sprintf(buf + count, "flag[0x%8x] ", data->flag);
   count += sprintf(buf + count, "\n");
 
   DE_WRN("%s", buf);
   return count;
}
 
void *disp_vmap(unsigned long phys_addr, unsigned long size)
{
   return (void *)phys_addr;
}
 
void disp_vunmap(const void *vaddr)
{
}