1.拉取代码
通过以下命令拉取代码或者使用smifb2.zip 文件解压
git clone https://github.com/teddywlq/smifb2.git
代码信息
zwzn2064@zwzn2064-CVN-Z690D5-GAMING-PRO:~/smifb2$ ls
ddk750 hw750.c hw768.h Makefile smi_dbg.h smi_drv.c smi_mode.c smi_priv.h smi_ttm.c xorg.conf.multicard
ddk768 hw750.h hw_com.h Makefile.kernel smi_debugfs.c smi_drv.h smi_plane.c smi_snd.c smi_ver.h xorg.conf.SM768
dkms.conf hw768.c Kconfig readme smi_debugfs.h smi_main.c smi_prime.c smi_snd.h tags
zwzn2064@zwzn2064-CVN-Z690D5-GAMING-PRO:~/smifb2$
readme信息
1. Introduction
SiliconMotion SM750/SM768 Graphics PCI-E DRM Driver
2. Usage
This driver can be compiled under the kernel 5.x.
1) Please make sure that you are in console and run as root user.
2) Open this driver directory, and use the "make" command, it will to generate the "smifb.ko".
3) Install the module.
make install
4) use "depmod -a" to handle dependency descriptions for loadable kernel modules.
5) On some ubuntu or debian OS, we need to update initramfs update-initramfs -u
5) Reboot and restart graphic interface,
Build essential package:
If there is build-mistake such as "/lib/modules/.../build: No such file or directory"
(Ubuntu version)
apt-get install linux-headers-$(uname -r) build-essential
(Fedora version)
yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)
Module Options
==============
Special configuration for smifb is usually unnecessary. There are a few
options, however.
From the command line, pass options to modprobe
modprobe smifb.ko lvds=1 width=1024 height=768
Or modify options on the fly at /sys/module/smifb/parameters directory
change the parameter in place, and save the file.
Or for permanent option, create file like /etc/modprobe.d/smifb.conf with text
options smifb lvds=1 width=1024 height=768
Module Parameter
==============
You can use "modinfo smifb" to get detail information
2 修改代码
调整时序。结构体 mode_parameter_t 定义了一种模式参数,通常用于描述显示设备(如液晶显示器或其他图形显示设备)的时序和频率设置
jw@kylin:~/smifb2$ git diff ddk768/ddk768_mode.c
diff --git a/ddk768/ddk768_mode.c b/ddk768/ddk768_mode.c
index 2e556a9..5dfbbcf 100644
--- a/ddk768/ddk768_mode.c
+++ b/ddk768/ddk768_mode.c
@@ -263,7 +263,9 @@ static mode_parameter_t gLVDSModeParamTable[] =
{1678,1280,1350,136, POS, 795, 768, 769, 3, POS, 80000000, 47676, 60, NEG},
/* 1280 x 800 [8:5] -- Not a popular mode */
- {1650,1280,1344,136, NEG, 824, 800, 800, 3, NEG, 81600000, 49455, 60, NEG},
+// {1650,1280,1344,136, NEG, 824, 800, 800, 3, NEG, 81600000, 49455, 60, NEG},
+/* 1280 x 800 [8:5] -- New */
+ {1440,1280,1408,32, NEG, 823, 800, 817, 6, NEG, 71000000, 49305, 60, NEG},
/* 1280 x 960 [4:3] */
/* The first commented line below are taken from SM502, the rest timing are
jw@kylin:~/smifb2$
3.编译代码
将代码放到麒麟系统下,使用 make 命令编译代码,会生成smifb.ko 驱动模块
make
4 替换驱动
执行以下命令替换驱动,重新启动机器,屏幕就成功点亮了
rm /lib/modules/5.4.18-63.52-embedded-generic/kernel/drivers/gpu/drm/smidrm/smifb.ko.xz
cp smifb.ko /lib/modules/5.4.18-63.52-embedded-generic/kernel/drivers/gpu/drm/smidrm/
depmod -a
update-initramfs -u