Date: Tue, 1 Oct 2019 18:32:27 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352937 - head/sys/dev/iicbus Message-ID: <201910011832.x91IWRrN072045@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: manu Date: Tue Oct 1 18:32:27 2019 New Revision: 352937 URL: https://svnweb.freebsd.org/changeset/base/352937 Log: syr827: Switch to iicdev_{readfrom,writeto} Also use IIC_INTRWAIT as we need this to work with the rockchip i2c driver. Modified: head/sys/dev/iicbus/syr827.c Modified: head/sys/dev/iicbus/syr827.c ============================================================================== --- head/sys/dev/iicbus/syr827.c Tue Oct 1 18:30:06 2019 (r352936) +++ head/sys/dev/iicbus/syr827.c Tue Oct 1 18:32:27 2019 (r352937) @@ -90,42 +90,13 @@ struct syr827_softc { static int syr827_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) { - struct syr827_softc *sc; - struct iic_msg msg[2]; - - sc = device_get_softc(dev); - - msg[0].slave = sc->addr; - msg[0].flags = IIC_M_WR; - msg[0].len = 1; - msg[0].buf = ® - - msg[1].slave = sc->addr; - msg[1].flags = IIC_M_RD; - msg[1].len = size; - msg[1].buf = data; - - return (iicbus_transfer(dev, msg, 2)); + return (iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT)); } static int syr827_write(device_t dev, uint8_t reg, uint8_t val) { - struct syr827_softc *sc; - struct iic_msg msg; - uint8_t buffer[2]; - - sc = device_get_softc(dev); - - buffer[0] = reg; - buffer[1] = val; - - msg.slave = sc->addr; - msg.flags = IIC_M_WR; - msg.len = 2; - msg.buf = buffer; - - return (iicbus_transfer(dev, &msg, 1)); + return (iicdev_writeto(dev, reg, &val, 1, IIC_INTRWAIT)); } static int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910011832.x91IWRrN072045>