需求
屏背光亮起来的时候,LED灯 黄灯灭 绿灯亮
找到屏操作背光的驱动文件:
longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/fastlogo/fastlogo.c
写下操作LED灯的方法,在合适的地方调用
#define setbit(x,y) x|=(1<<y)
#define clrbit(x,y) x&=~(1<<y)
static void setLedStatus(void){
u32 data0;
u32 data1;
//拉低PL1
data0 = readl(0x07022000);//0x07022000
setbit(data0,4);
clrbit(data0,5);
clrbit(data0,6);
clrbit(data0,7);
writel(data0,0x07022000);
data1 =readl(0x07022010);
data1 &= ~(0x01<< 1);
writel(data1,0x07022010);
//拉高PL5
data0 = readl(0x07022000);//0x07022000
setbit(data0,20);
clrbit(data0,21);
clrbit(data0,22);
clrbit(data0,23);
writel(data0,0x07022000);
data1 =readl(0x07022010);
data1 |= (0x01<< 5);
writel(data1,0x07022010);
}
完整的补丁如下:
--- a/H713-v1.3/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/fastlogo/fastlogo.c
+++ b/H713-v1.3/longan/brandy/brandy-2.0/u-boot-2018/drivers/video/sunxi/fastlogo/fastlogo.c
@@ -74,6 +74,9 @@ static char *g_dts_value[] = {
};
#define CFG_BLOCK_MAX_SIZE 0x40000
+#define setbit(x,y) x|=(1<<y)
+#define clrbit(x,y) x&=~(1<<y)
+static void setLedStatus(void);
struct tse_src_desc {
char *default_file_name;
@@ -696,6 +699,7 @@ static void fastlogo_timer_cb(void *parg)
delay_ms = panel_set->power_on_delay1;
break;
case 3:
+ setLedStatus();
p_fastlogo->p_bl->pwm_enable(p_fastlogo->p_bl, 1);
delay_ms = panel_set->power_on_delay2;
break;
@@ -960,6 +964,35 @@ OUT:
return ret;
}
+static void setLedStatus(void){
+ u32 data0;
+ u32 data1;
+ //PL1 set gpio output low
+ data0 = readl(0x07022000);//0x07022000
+ setbit(data0,4);
+ clrbit(data0,5);
+ clrbit(data0,6);
+ clrbit(data0,7);
+ writel(data0,0x07022000);
+
+ data1 =readl(0x07022010);
+ data1 &= ~(0x01<< 1);
+ writel(data1,0x07022010);
+
+ //PL5 set gpio output high
+ data0 = readl(0x07022000);//0x07022000
+ setbit(data0,20);
+ clrbit(data0,21);
+ clrbit(data0,22);
+ clrbit(data0,23);
+ writel(data0,0x07022000);
+
+ data1 =readl(0x07022010);
+ data1 |= (0x01<< 5);
+ writel(data1,0x07022010);
+
+}
+
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 2024-11-16----Android 11(全志H713)-----拉高LED灯
发表评论 取消回复