On 5/9/19 6:11 PM, Dan Murphy wrote: > +static int regmap_spi_gather_write(void *context, const void *reg, > + size_t reg_len, const void *val, > + size_t val_len) > +{ > + struct device *dev = context; > + struct spi_device *spi = to_spi_device(dev); > + struct spi_message m; > + u32 addr; > + struct spi_transfer t[2] = { > + { .tx_buf = &addr, .len = reg_len, .cs_change = 0,}, > + { .tx_buf = val, .len = val_len, }, > + }; > + > + addr = TCAN4X5X_WRITE_CMD | (*((u16 *)reg) << 8) | val_len >> 3; Why do you shift the len by 3? This means division by 8, but AFAICS the chip expects the number of words (32 bit) you want to read. > + > + spi_message_init(&m); > + spi_message_add_tail(&t[0], &m); > + spi_message_add_tail(&t[1], &m); > + > + return spi_sync(spi, &m); > +} regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Attachment:
signature.asc
Description: OpenPGP digital signature