i2c tools && ds90ub927芯片使用:
**下载:**git clone git://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git -b i2c-tools-3.1
**交叉编译:**静态链接编译,
使用方法:
1、i2cdetect:
/*
"Usage: i2cdetect [-y] [-a] [-q | -r] I2CBUS [FIRST LAST]"
" i2cdetect -F I2CBUS"
" i2cdetect -l"
"I2CBUS is an integer or an I2C bus name"
"If provided, FIRST and LAST limit the probing range"
*/
/*=============================================================
-l Output a list of installed busses.
-F Display the list of functionalities implemented by the adapter and exit.
-y Disable interactive mode. By default, i2cdetect will wait for a confirmation from the user before messing with the I2C bus. When this flag is used, it will perform the operation directly. This is mainly meant to be used in scripts.
-r Use SMBus "read byte" commands for probing (by default, the command used is the one believed to be the safest for each address). Not recommended.This is know to lock SMBus on various write-only chips (most notably clock chips at address 0x69)
=============================================================*/
// 探测机器上的所有i2c总线
i2cdetect -l
// 探测指定i2c总线上的设备
i2cdetect -y -r i2cbusnum
2、i2cdump:
/*
"Usage: i2cdump [-f] [-y] [-r first-last] [-a] I2CBUS ADDRESS [MODE [BANK [BADNREG]]]"
" I2CBUS is an interger or an I2C bus name"
" ADDRESS is an interger (0x08 - 0x77, or 0x00 - 0x7f if -a is given)"
" MODE is one of :"
" b (byte,default)"
" w (word)"
" W (word on even register addresses)"
" s (SMBus block)"
" i (I2C block)"
" c (consecutive byte)"
" Append p for SMBus PEC"
*/
/*=============================================================
-f Force access to the device even if it is already busy. By default, i2cdump will refuse to access a device which is already under the control of a kernel driver. Using this flag is dangerous, it can seriously confuse the kernel driver in question. It can alse cause i2cdump to return invalid results.So use at your own risk and only if you know what you're doing
-r first-last Limit the range of registers being accessed. This option is only available with modes b, w, c and W. For mode W, first must be even and last must be odd.
-y Disable interactive mode. By default, i2cdump will wait for a confirmation from the user before messing with the I2C bus. When this flag is used, it will perform the operation directly. This is mainly meant to be used in script.
=============================================================*/
// 打印指定总线上指定地址的所有寄存器值
i2cdump -f -y busnum deviceaddr
3、i2cset && i2cget
/*
"Usage: i2cset [-f] [-y] [-m MASK] [-r] [-a] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE]...[MODE]"
"I2CBUS is an integer or an I2C bus name"
"ADDRESS is an integer (0x08 - 0x77, or 0x00 - 0x7f if -a is given)"
"MODE is one of:"
" c (byte, no value)"
" b (byte data, default)"
" w (word data)"
" i (I2C block data)"
" s (SMBus block data)"
" Append p for SMBus PEC"
*/
/*=============================================================
-f Force access to the device even if it is already busy. By default, i2cdump will refuse to access a device which is already under the control of a kernel driver. Using this flag is dangerous, it can seriously confuse the kernel driver in question. It can alse cause i2cdump to return invalid results.So use at your own risk and only if you know what you're doing
-y Disable interactive mode. By default, i2cdump will wait for a confirmation from the user before messing with the I2C bus. When this flag is used, it will perform the operation directly. This is mainly meant to be used in script.
=============================================================*/
// 获取指定总线上,指定地址,指定寄存器的值
i2cget -f -y busnum deviceaddr regaddr
// 设置指定总线,指定设备地址,指定寄存器的值
i2cset -f -y busnum deviceaddr regaddr value
ds90ub927 && ds90ub948
ds90ub927:lvds 转换成FDP-Link III信号。加串器。
ds90ub948:FDP-Link III信号转换成 lvds信号。解串器。
应用场景:
屏幕和板卡分离,即ds90ub927在板卡端,ds90ub948在屏幕端,两端通过FDP-Link III连接。
ds90ub948:控制屏幕的背光使能,输出背光PWM,LCD使能。
927和948线缆连接上之后,927的状态寄存器会显示连接状态,以及在DES ID寄存器自动填充解串器的i2c地址。如果连接状态无误并且能找到 DES ID,就可以配置927的I2C control寄存器,打开Pass All模式,后面即可在imx6端通过同一i2c总线,使用DES ID的地址,即可读取、写入948的寄存器值。
关于pwm:
948解串器自身无法产生pwm方波,927和948的gpio 0 1 2 3可配置为远程控制(手册中仅0 1 2 3可以配置为远程控制),即用927的gpio口控制948的gpio口的输出,首先imx6输出pwm方波到927的gpio口(0,1,2或3),927通过FDP-Link透传到948上,然后输出到屏幕端。