svn commit: r350838 - head/sys/arm/ti/am335x
Ian Lepore
ian at FreeBSD.org
Sat Aug 10 17:14:36 UTC 2019
Author: ian
Date: Sat Aug 10 17:14:35 2019
New Revision: 350838
URL: https://svnweb.freebsd.org/changeset/base/350838
Log:
Switch the am335x_pmic driver to using iicdev_readfrom/writeto.
PR: 239697
Submitted by: Chuhong Yuan
Modified:
head/sys/arm/ti/am335x/am335x_pmic.c
Modified: head/sys/arm/ti/am335x/am335x_pmic.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 15:53:42 2019 (r350837)
+++ head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 17:14:35 2019 (r350838)
@@ -79,30 +79,16 @@ static void am335x_pmic_shutdown(void *, int);
static int
am335x_pmic_read(device_t dev, uint8_t addr, uint8_t *data, uint8_t size)
{
- struct am335x_pmic_softc *sc = device_get_softc(dev);
- struct iic_msg msg[] = {
- { sc->sc_addr, IIC_M_WR, 1, &addr },
- { sc->sc_addr, IIC_M_RD, size, data },
- };
- return (iicbus_transfer(dev, msg, 2));
+ return (iicdev_readfrom(dev, addr, data, size, IIC_INTRWAIT));
}
static int
am335x_pmic_write(device_t dev, uint8_t address, uint8_t *data, uint8_t size)
{
- uint8_t buffer[MAX_IIC_DATA_SIZE + 1];
- struct am335x_pmic_softc *sc = device_get_softc(dev);
- struct iic_msg msg[] = {
- { sc->sc_addr, IIC_M_WR, size + 1, buffer },
- };
-
if (size > MAX_IIC_DATA_SIZE)
return (ENOMEM);
- buffer[0] = address;
- memcpy(buffer + 1, data, size);
-
- return (iicbus_transfer(dev, msg, 1));
+ return (iicdev_writeto(dev, address, data, size, IIC_INTRWAIT));
}
static void
More information about the svn-src-head
mailing list