• V3s 屏幕LCD驱动总结


    使用V3s做项目一段时间了,做开发难免会做UI相关的开发,移植linux5.2.y分支后屏幕总是出现闪烁条纹,同样的7寸液晶下1024*600 和 800*480 的屏幕都试过;使用逻辑分析仪查看LCD_CLK 总是在25Mhz ,但是在Uboot 启动后加载的LCD 驱动CLK 莫名的 33.3Mhz;翻看相关论坛早已有同行踩坑,关于V3s display-engine/display_clocks /mixer0和tcon0 有关lcd时钟配置的一些问题 / 全志 SOC / WhyCan Forum(哇酷开发者社区) 

    找到修改 内核linux-5.2.y/drivers/gpu/drm/sun4i/sun4i_tcon.c , 488 行 改之,重新编译即可;

    1. static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
    2. const struct drm_encoder *encoder,
    3. const struct drm_display_mode *mode)
    4. {
    5. struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
    6. struct drm_display_info display_info = connector->display_info;
    7. unsigned int bp, hsync, vsync;
    8. u8 clk_delay;
    9. u32 val = 0;
    10. WARN_ON(!tcon->quirks->has_channel_0);
    11. //tcon->dclk_min_div = 6;
    12. tcon->dclk_min_div = 1;
    13. tcon->dclk_max_div = 127;
    14. sun4i_tcon0_mode_set_common(tcon, mode);
    15. /* Set dithering if needed */
    16. sun4i_tcon0_mode_set_dithering(tcon, connector);
    17. /* Adjust clock delay */
    18. clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
    19. regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
    20. SUN4I_TCON0_CTL_CLK_DELAY_MASK,

    借我之前写的动态 修改uboot LCD 参数:V3s uboot 通过env 修改LCD 参数信息_kensey的博客-CSDN博客

    如果一个产品已经打包封装,并且只有网口没有留下系统调试串口那么想要在linux 中修改uboot 下 env 信息就需要另外想办法了,好在uboot 已经把这部分功能考虑了;在uboot 根目录下 make env 即可得到可以操作的应用 fw_printenv;

    1. root@ubuntu:/home/xxx/licheep_pro/u-boot-mmc# make CORSS=/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- env
    2. HOSTCC scripts/basic/fixdep
    3. LD tools/env/built-in.o
    4. HOSTCC tools/env/aes.o
    5. HOSTCC tools/env/crc32.o
    6. HOSTCC tools/env/ctype.o
    7. HOSTCC tools/env/env_attr.o
    8. HOSTCC tools/env/env_flags.o
    9. HOSTCC tools/env/fw_env.o
    10. HOSTCC tools/env/linux_string.o
    11. AR tools/env/lib.a
    12. HOSTCC tools/env/fw_env_main.o
    13. HOSTLD tools/env/fw_printenv
    14. STRIP tools/env/fw_printenv
    15. root@ubuntu:/home/xxx/licheep_pro/u-boot-mmc#

    如果是TF卡启动的话,将如下配置保存为 fw_env.config 写入/etc/ 下即可;

    1. # Configuration file for fw_(printenv/setenv) utility.
    2. # Up to two entries are valid, in this case the redundant
    3. # environment sector is assumed present.
    4. # Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
    5. # Futhermore, if the Flash sector size is omitted, this value is assumed to
    6. # be the same as the Environment size, which is valid for NOR and SPI-dataflash
    7. # Device offset must be prefixed with 0x to be parsed as a hexadecimal value.
    8. # NOR example
    9. # MTD device name Device offset Env. size Flash sector size Number of sectors
    10. #/dev/mtd1 0x0000 0x4000 0x4000
    11. #/dev/mtd2 0x0000 0x4000 0x4000
    12. # MTD SPI-dataflash example
    13. # MTD device name Device offset Env. size Flash sector size Number of sectors
    14. #/dev/mtd5 0x4200 0x4200
    15. #/dev/mtd6 0x4200 0x4200
    16. # NAND example
    17. #/dev/mtd0 0x4000 0x4000 0x20000 2
    18. # On a block device a negative offset is treated as a backwards offset from the
    19. # end of the device/partition, rather than a forwards offset from the start.
    20. # Block device example
    21. /dev/mmcblk0 0x88000 0x20000
    22. #/dev/mmcblk0 -0x20000 0x20000
    23. # VFAT example
    24. #/boot/uboot.env 0x0000 0x4000

    如果想要动态修改LCD 参数 除去uboot 修改外,还需要修改 linux 启动所需要的设备数文件,

    在内核 /arch/arm/boot/dts/sun8i-v3s-licheepi-zero-with-800x480-lcd.dts  ,找到相关LCD 配置文件,这里我的是 800*480 7寸液晶,

    1. /*
    2. * Copyright (C) 2018 Icenowy Zheng
    3. *
    4. * SPDX-License-Identifier: (GPL-2.0+ OR X11)
    5. */
    6. #include "sun8i-v3s-licheepi-zero-with-lcd.dtsi"
    7. &panel {
    8. compatible = "urt,umsh-8596md-t", "simple-panel";
    9. };

    具体的 compatible = "urt,umsh-8596md-t", "simple-panel"; 配置需要找到内核相关文件,改文件内部包含多种LCD 驱动参数可供使用;具体文件为:/drivers/gpu/drm/panel/panel-simple.c ,这里展示2563 行 一部分文件,该结构体内部有大量的屏幕信息,具体分辨率等信息查看 .data 对应的结构信息描述:

    1. static const struct of_device_id platform_of_match[] = {
    2. {
    3. .compatible = "ampire,am-480272h3tmqw-t01h",
    4. .data = &ire_am_480272h3tmqw_t01h,
    5. }, {
    6. .compatible = "ampire,am800480r3tmqwa1h",
    7. .data = &ire_am800480r3tmqwa1h,
    8. }, {
    9. .compatible = "arm,rtsm-display",
    10. .data = &arm_rtsm,
    11. }, {
    12. .compatible = "auo,b101aw03",
    13. .data = &auo_b101aw03,
    14. }, {
    15. .compatible = "auo,b101ean01",
    16. .data = &auo_b101ean01,
    17. }, {
    18. .compatible = "auo,b101xtn01",
    19. .data = &auo_b101xtn01,
    20. ........

    修改好交叉编译后,下载到ARM板 挂载 第一分区 , 使用fw_printenv 修改uboot 加载的设备数文件,重启完毕!

  • 相关阅读:
    LeetCode 0236. 二叉树的最近公共祖先
    net/http库中request.RemoteAddr的值不确定性-【Golang踩坑笔记】
    Java的指针、引用与C++的指针、引用的对比
    手写方法实现字符串例如:“123“与整型例如:123相互转化(面试必会)
    【定语从句练习题】who、which
    不同content-type对应的前端请求参数处理格式
    Cholesterol-PEG-Thiol,CLS-PEG-SH,胆固醇-聚乙二醇-巯基改善胆固醇溶解度
    大数据开发工程师面试题
    Pytorch学习之路 - CNN
    【图论中貌似要二分的题,有可能是假二分,直接用kruskal】【最小生成树-独立的联通块】【最小生成森林-多个独立的联通块】【如何判定最小生成森林】
  • 原文地址:https://blog.csdn.net/qq_40545297/article/details/134065941