Lines Matching refs:dev

48 #include <dev/iicbus/iiconf.h>
49 #include <dev/iicbus/iicbus.h>
77 #define XLR_I2C_CFG_ADDR 0xF8 /* 8-Bit dev Addr + POR Values */
78 #define XLR_I2C_CFG_NOADDR 0xFA /* 8-Bit reg Addr + POR Values : No dev addr */
97 static int xlr_i2c_start(device_t dev, u_char slave, int timeout);
98 static int xlr_i2c_stop(device_t dev);
99 static int xlr_i2c_read(device_t dev, char *buf, int len, int *read, int last, int delay);
100 static int xlr_i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout);
101 static int xlr_i2c_callback(device_t dev, int index, caddr_t data);
102 static int xlr_i2c_repeated_start(device_t dev, u_char slave, int timeout);
106 device_t dev; /* Self */
117 set_i2c_base(device_t dev)
121 sc = device_get_softc(dev);
122 if (device_get_unit(dev) == 0)
129 xlr_i2c_dev_write(device_t dev, int reg, int value)
133 sc = device_get_softc(dev);
140 xlr_i2c_dev_read(device_t dev, int reg)
145 sc = device_get_softc(dev);
152 xlr_i2c_probe(device_t dev)
154 device_set_desc(dev, "XLR/XLS I2C bus controller");
165 xlr_i2c_attach(device_t dev)
171 if(device_get_unit(dev)!=ARIZONA_I2C_BUS) {
172 device_printf(dev, "unused iicbus instance\n");
176 sc = device_get_softc(dev);
177 set_i2c_base(dev);
181 sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
185 if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) {
212 bus_generic_attach(dev);
218 xlr_i2c_detach(device_t dev)
220 bus_generic_detach(dev);
226 xlr_i2c_start(device_t dev, u_char slave, int timeout)
231 sc = device_get_softc(dev);
240 xlr_i2c_stop(device_t dev)
245 sc = device_get_softc(dev);
252 xlr_i2c_read(device_t dev, char *buf, int len, int *read, int last,
259 xlr_i2c_dev_write(dev, XLR_I2C_CFG, XLR_I2C_CFG_NOADDR);
260 xlr_i2c_dev_write(dev, XLR_I2C_BYTECNT, len);
263 xlr_i2c_dev_write(dev, XLR_I2C_STARTXFR, XLR_I2C_STARTXFR_RD);
270 i2c_status = xlr_i2c_dev_read(dev, XLR_I2C_STATUS);
272 buf[pos++] = (uint8_t) xlr_i2c_dev_read(dev, XLR_I2C_DATAIN);
295 xlr_i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout /* us */ )
302 sc = device_get_softc(dev);
307 xlr_i2c_dev_write(dev, XLR_I2C_ADDR, addr);
308 xlr_i2c_dev_write(dev, XLR_I2C_DEVADDR, devaddr);
309 xlr_i2c_dev_write(dev, XLR_I2C_CFG, XLR_I2C_CFG_ADDR);
310 xlr_i2c_dev_write(dev, XLR_I2C_BYTECNT, len - 1);
315 xlr_i2c_dev_write(dev, XLR_I2C_STARTXFR, XLR_I2C_STARTXFR_ND);
317 xlr_i2c_dev_write(dev, XLR_I2C_STARTXFR, XLR_I2C_STARTXFR_WR);
318 xlr_i2c_dev_write(dev, XLR_I2C_DATAOUT, buf[pos]);
322 i2c_status = xlr_i2c_dev_read(dev, XLR_I2C_STATUS);
327 xlr_i2c_dev_write(dev, XLR_I2C_DATAOUT, buf[pos]);
354 xlr_i2c_callback(device_t dev, int index, caddr_t data)
360 xlr_i2c_repeated_start(device_t dev, u_char slave, int timeout)