Commit 7a426098 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

media: ccs: Add debug prints for MSR registers



Also print out MSR registers written to the sensor. This isn't entirely
optimal as the debug strings are produced even if they're not used but
that isn't really a grave issue --- the I²C bus is very slow anyway.

Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 57801b6a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -387,12 +387,20 @@ int ccs_write_data_regs(struct ccs_sensor *sensor, struct ccs_reg *regs,

		for (j = 0; j < regs->len;
		     j += msg.len - 2, regdata += msg.len - 2) {
			char printbuf[(MAX_WRITE_LEN << 1) +
				      1 /* \0 */] = { 0 };
			int rval;

			msg.len = min(regs->len - j, MAX_WRITE_LEN);

			bin2hex(printbuf, regdata, msg.len);
			dev_dbg(&client->dev,
				"writing msr reg 0x%4.4x value 0x%s\n",
				regs->addr + j, printbuf);

			put_unaligned_be16(regs->addr + j, buf);
			memcpy(buf + 2, regdata, msg.len);

			msg.len += 2;

			rval = ccs_write_retry(client, &msg);