View | Details | Raw Unified | Return to bug 239693
Collapse All | Expand All

(-)sys/arm/allwinner/axp81x.c (-32 / +4 lines)
Lines 707-749 Link Here
707
static int
707
static int
708
axp8xx_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
708
axp8xx_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
709
{
709
{
710
	struct axp8xx_softc *sc;
710
	
711
	struct iic_msg msg[2];
711
	return (iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT));
712
713
	sc = device_get_softc(dev);
714
715
	msg[0].slave = sc->addr;
716
	msg[0].flags = IIC_M_WR;
717
	msg[0].len = 1;
718
	msg[0].buf = ®
719
720
	msg[1].slave = sc->addr;
721
	msg[1].flags = IIC_M_RD;
722
	msg[1].len = size;
723
	msg[1].buf = data;
724
725
	return (iicbus_transfer(dev, msg, 2));
726
}
712
}
727
713
728
static int
714
static int
729
axp8xx_write(device_t dev, uint8_t reg, uint8_t val)
715
axp8xx_write(device_t dev, uint8_t reg, uint8_t val)
730
{
716
{
731
	struct axp8xx_softc *sc;
717
	
732
	struct iic_msg msg[2];
718
	return (iicdev_writeto(dev, reg, &val, sizeof(val), IIC_INTRWAIT));
733
734
	sc = device_get_softc(dev);
735
736
	msg[0].slave = sc->addr;
737
	msg[0].flags = IIC_M_WR;
738
	msg[0].len = 1;
739
	msg[0].buf = ®
740
741
	msg[1].slave = sc->addr;
742
	msg[1].flags = IIC_M_WR;
743
	msg[1].len = 1;
744
	msg[1].buf = &val;
745
746
	return (iicbus_transfer(dev, msg, 2));
747
}
719
}
748
720
749
static int
721
static int

Return to bug 239693