Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1134e9d1 authored by Matthias Schwarzott's avatar Matthias Schwarzott Committed by Mauro Carvalho Chehab
Browse files

[media] cx231xx: fix i2c debug prints



Do not shift the already 7bit i2c address.
Print a message also for write+read transactions.
For write+read, print the read buffer correctly instead of using the write
buffer.

Signed-off-by: default avatarMatthias Schwarzott <zzam@gentoo.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 5765f33c
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -371,9 +371,9 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
	mutex_lock(&dev->i2c_lock);
	mutex_lock(&dev->i2c_lock);
	for (i = 0; i < num; i++) {
	for (i = 0; i < num; i++) {


		addr = msgs[i].addr >> 1;
		addr = msgs[i].addr;


		dprintk2(2, "%s %s addr=%x len=%d:",
		dprintk2(2, "%s %s addr=0x%x len=%d:",
			 (msgs[i].flags & I2C_M_RD) ? "read" : "write",
			 (msgs[i].flags & I2C_M_RD) ? "read" : "write",
			 i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
			 i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
		if (!msgs[i].len) {
		if (!msgs[i].len) {
@@ -395,13 +395,21 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
		} else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) &&
		} else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) &&
			   msgs[i].addr == msgs[i + 1].addr
			   msgs[i].addr == msgs[i + 1].addr
			   && (msgs[i].len <= 2) && (bus->nr < 3)) {
			   && (msgs[i].len <= 2) && (bus->nr < 3)) {
			/* write bytes */
			if (i2c_debug >= 2) {
				for (byte = 0; byte < msgs[i].len; byte++)
					printk(" %02x", msgs[i].buf[byte]);
			}
			/* read bytes */
			/* read bytes */
			dprintk2(2, "plus %s %s addr=0x%x len=%d:",
				(msgs[i+1].flags & I2C_M_RD) ? "read" : "write",
				i+1 == num - 1 ? "stop" : "nonstop", addr, msgs[i+1].len);
			rc = cx231xx_i2c_recv_bytes_with_saddr(i2c_adap,
			rc = cx231xx_i2c_recv_bytes_with_saddr(i2c_adap,
							       &msgs[i],
							       &msgs[i],
							       &msgs[i + 1]);
							       &msgs[i + 1]);
			if (i2c_debug >= 2) {
			if (i2c_debug >= 2) {
				for (byte = 0; byte < msgs[i].len; byte++)
				for (byte = 0; byte < msgs[i+1].len; byte++)
					printk(" %02x", msgs[i].buf[byte]);
					printk(" %02x", msgs[i+1].buf[byte]);
			}
			}
			i++;
			i++;
		} else {
		} else {