V3s 屏幕LCD驱动总结

编程入门 行业动态 更新时间:2024-10-24 12:26:40

V3s <a href=https://www.elefans.com/category/jswz/34/1767915.html style=屏幕LCD驱动总结"/>

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 行 改之,重新编译即可;

static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,const struct drm_encoder *encoder,const struct drm_display_mode *mode)
{struct drm_connector *connector = sun4i_tcon_get_connector(encoder);struct drm_display_info display_info = connector->display_info;unsigned int bp, hsync, vsync;u8 clk_delay;u32 val = 0;WARN_ON(!tcon->quirks->has_channel_0);//tcon->dclk_min_div = 6;tcon->dclk_min_div = 1;tcon->dclk_max_div = 127;sun4i_tcon0_mode_set_common(tcon, mode);/* Set dithering if needed */sun4i_tcon0_mode_set_dithering(tcon, connector);/* Adjust clock delay */clk_delay = sun4i_tcon_get_clk_delay(mode, 0);regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,SUN4I_TCON0_CTL_CLK_DELAY_MASK,

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

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

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- envHOSTCC  scripts/basic/fixdepLD      tools/env/built-in.oHOSTCC  tools/env/aes.oHOSTCC  tools/env/crc32.oHOSTCC  tools/env/ctype.oHOSTCC  tools/env/env_attr.oHOSTCC  tools/env/env_flags.oHOSTCC  tools/env/fw_env.oHOSTCC  tools/env/linux_string.oAR      tools/env/lib.aHOSTCC  tools/env/fw_env_main.oHOSTLD  tools/env/fw_printenvSTRIP   tools/env/fw_printenv
root@ubuntu:/home/xxx/licheep_pro/u-boot-mmc#

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

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

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

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

/** Copyright (C) 2018 Icenowy Zheng <icenowy@aosc.io>** SPDX-License-Identifier: (GPL-2.0+ OR X11)*/#include "sun8i-v3s-licheepi-zero-with-lcd.dtsi"&panel {compatible = "urt,umsh-8596md-t", "simple-panel";
};

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

static const struct of_device_id platform_of_match[] = {{patible = "ampire,am-480272h3tmqw-t01h",.data = &ampire_am_480272h3tmqw_t01h,}, {patible = "ampire,am800480r3tmqwa1h",.data = &ampire_am800480r3tmqwa1h,}, {patible = "arm,rtsm-display",.data = &arm_rtsm,}, {patible = "auo,b101aw03",.data = &auo_b101aw03,}, {patible = "auo,b101ean01",.data = &auo_b101ean01,}, {patible = "auo,b101xtn01",.data = &auo_b101xtn01,
........

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

更多推荐

V3s 屏幕LCD驱动总结

本文发布于:2023-12-03 06:52:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1652354.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:屏幕   V3s   LCD

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!