需求

屏背光亮起来的时候,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);
+
+}
+

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部