git: 319a4bddb0b9 - main - linuxkpi: i2c: Fix 7bit/8bit addressing
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Aug 2022 12:39:30 UTC
The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=319a4bddb0b991377208293283a87946e4b5d055 commit 319a4bddb0b991377208293283a87946e4b5d055 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2022-08-19 12:37:05 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2022-08-19 12:39:16 +0000 linuxkpi: i2c: Fix 7bit/8bit addressing Linux is using 7 bit addressing while FreeBSD uses 8 bit addresses internally, but i2c(8) uses 7 bit address. This confused me when originally doing the code and I thought that 0x50 was the 8bit EDID address while it's the 7bit address and since I did all my testing using this I didn't noticed the problem. Reported by: avg PR: 265920 (somewhat) --- sys/compat/linuxkpi/common/src/linux_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_i2c.c b/sys/compat/linuxkpi/common/src/linux_i2c.c index bdf381f8a032..72ad37919d7f 100644 --- a/sys/compat/linuxkpi/common/src/linux_i2c.c +++ b/sys/compat/linuxkpi/common/src/linux_i2c.c @@ -183,7 +183,7 @@ lkpi_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0; i < nmsgs; i++) { - linux_msgs[i].addr = msgs[i].slave; + linux_msgs[i].addr = msgs[i].slave >> 1; linux_msgs[i].len = msgs[i].len; linux_msgs[i].buf = msgs[i].buf; if (msgs[i].flags & IIC_M_RD) {