OSDN Git Service

media: ccs: Add debug prints for MSR registers
authorSakari Ailus <sakari.ailus@linux.intel.com>
Thu, 24 Sep 2020 21:34:27 +0000 (23:34 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 12 Jan 2021 16:29:25 +0000 (17:29 +0100)
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: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/i2c/ccs/ccs-reg-access.c

index b776af2..5f07059 100644 (file)
@@ -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);