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

Commit 57f1c053 authored by Alessandro Radicati's avatar Alessandro Radicati Committed by Mauro Carvalho Chehab
Browse files

[media] af9035: I2C combined write + read transaction fix



This patch will modify the af9035 driver to use the register address
fields of the I2C read command for the combined write/read transaction
case.  Without this change, the firmware issues just a I2C read
transaction without the preceding write transaction to select the
register.

Signed-off-by: default avatarAlessandro Radicati <alessandro@radicati.net>
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 9f5a802b
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -367,10 +367,25 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
				memcpy(&buf[3], msg[0].buf, msg[0].len);
			} else {
				buf[1] = msg[0].addr << 1;
				buf[2] = 0x00; /* reg addr len */
				buf[3] = 0x00; /* reg addr MSB */
				buf[4] = 0x00; /* reg addr LSB */

				/* Keep prev behavior for write req len > 2*/
				if (msg[0].len > 2) {
					buf[2] = 0x00; /* reg addr len */
					memcpy(&buf[5], msg[0].buf, msg[0].len);

				/* Use reg addr fields if write req len <= 2 */
				} else {
					req.wlen = 5;
					buf[2] = msg[0].len;
					if (msg[0].len == 2) {
						buf[3] = msg[0].buf[0];
						buf[4] = msg[0].buf[1];
					} else if (msg[0].len == 1) {
						buf[4] = msg[0].buf[0];
					}
				}
			}
			ret = af9035_ctrl_msg(d, &req);
		}