mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 17:30:59 +07:00
via: Rationalize vt1636 detection
The code was ugly and didn't check whether i2c operations were succeeding; make it a little better. Cc: ScottFang@viatech.com.cn Cc: JosephChan@via.com.tw Cc: Harald Welte <laforge@gnumonks.org> Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
b8f7e5d846
commit
6b841edf57
@ -167,26 +167,20 @@ bool viafb_lvds_identify_vt1636(u8 i2c_adapter)
|
|||||||
|
|
||||||
/* Sense VT1636 LVDS Transmiter */
|
/* Sense VT1636 LVDS Transmiter */
|
||||||
viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr =
|
viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr =
|
||||||
VT1636_LVDS_I2C_ADDR;
|
VT1636_LVDS_I2C_ADDR;
|
||||||
|
|
||||||
/* Check vendor ID first: */
|
/* Check vendor ID first: */
|
||||||
viafb_i2c_readbyte(i2c_adapter,
|
if (viafb_i2c_readbyte(i2c_adapter, VT1636_LVDS_I2C_ADDR,
|
||||||
(u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr,
|
0x00, &Buffer[0]))
|
||||||
0x00, &Buffer[0]);
|
return false;
|
||||||
viafb_i2c_readbyte(i2c_adapter,
|
viafb_i2c_readbyte(i2c_adapter, VT1636_LVDS_I2C_ADDR, 0x01, &Buffer[1]);
|
||||||
(u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr,
|
|
||||||
0x01, &Buffer[1]);
|
|
||||||
|
|
||||||
if (!((Buffer[0] == 0x06) && (Buffer[1] == 0x11)))
|
if (!((Buffer[0] == 0x06) && (Buffer[1] == 0x11)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Check Chip ID: */
|
/* Check Chip ID: */
|
||||||
viafb_i2c_readbyte(i2c_adapter,
|
viafb_i2c_readbyte(i2c_adapter, VT1636_LVDS_I2C_ADDR, 0x02, &Buffer[0]);
|
||||||
(u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr,
|
viafb_i2c_readbyte(i2c_adapter, VT1636_LVDS_I2C_ADDR, 0x03, &Buffer[1]);
|
||||||
0x02, &Buffer[0]);
|
|
||||||
viafb_i2c_readbyte(i2c_adapter,
|
|
||||||
(u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr,
|
|
||||||
0x03, &Buffer[1]);
|
|
||||||
if ((Buffer[0] == 0x45) && (Buffer[1] == 0x33)) {
|
if ((Buffer[0] == 0x45) && (Buffer[1] == 0x33)) {
|
||||||
viaparinfo->chip_info->lvds_chip_info.lvds_chip_name =
|
viaparinfo->chip_info->lvds_chip_info.lvds_chip_name =
|
||||||
VT1636_LVDS;
|
VT1636_LVDS;
|
||||||
|
Loading…
Reference in New Issue
Block a user