Skip to content

Commit

Permalink
media: ccs: Add debug prints for MSR registers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
Sakari Ailus authored and mchehab committed Jan 12, 2021
1 parent 57801b6 commit 7a42609
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/media/i2c/ccs/ccs-reg-access.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7a42609

Please sign in to comment.