Lines Matching +full:slave +full:- +full:addr
1 /*-
51 #include <dt-bindings/mfd/max77620.h>
63 #define LOCK(_sc) sx_xlock(&(_sc)->lock)
64 #define UNLOCK(_sc) sx_xunlock(&(_sc)->lock)
65 #define LOCK_INIT(_sc) sx_init(&(_sc)->lock, "max77620")
66 #define LOCK_DESTROY(_sc) sx_destroy(&(_sc)->lock);
67 #define ASSERT_LOCKED(_sc) sx_assert(&(_sc)->lock, SA_XLOCKED);
68 #define ASSERT_UNLOCKED(_sc) sx_assert(&(_sc)->lock, SA_UNLOCKED);
78 uint8_t addr; in max77620_read() local
81 {0, IIC_M_WR, 1, &addr}, in max77620_read()
85 msgs[0].slave = sc->bus_addr; in max77620_read()
86 msgs[1].slave = sc->bus_addr; in max77620_read()
87 addr = reg; in max77620_read()
89 rv = iicbus_transfer(sc->dev, msgs, 2); in max77620_read()
91 device_printf(sc->dev, in max77620_read()
102 uint8_t addr; in max77620_read_buf() local
105 {0, IIC_M_WR, 1, &addr}, in max77620_read_buf()
109 msgs[0].slave = sc->bus_addr; in max77620_read_buf()
110 msgs[1].slave = sc->bus_addr; in max77620_read_buf()
111 addr = reg; in max77620_read_buf()
113 rv = iicbus_transfer(sc->dev, msgs, 2); in max77620_read_buf()
115 device_printf(sc->dev, in max77620_read_buf()
133 msgs[0].slave = sc->bus_addr; in max77620_write()
137 rv = iicbus_transfer(sc->dev, msgs, 1); in max77620_write()
139 device_printf(sc->dev, in max77620_write()
157 msgs[0].slave = sc->bus_addr; in max77620_write_buf()
158 msgs[1].slave = sc->bus_addr; in max77620_write_buf()
161 rv = iicbus_transfer(sc->dev, msgs, 2); in max77620_write_buf()
163 device_printf(sc->dev, in max77620_write_buf()
196 if (OF_getencprop(node, "maxim,shutdown-fps-time-period-us", &val, in max77620_parse_fps()
200 sc->shutdown_fps[id] = val; in max77620_parse_fps()
202 if (OF_getencprop(node, "maxim,suspend-fps-time-period-us", &val, in max77620_parse_fps()
206 sc->suspend_fps[id] = val; in max77620_parse_fps()
208 if (OF_getencprop(node, "maxim,fps-event-source", &val, in max77620_parse_fps()
211 device_printf(sc->dev, "Invalid 'fps-event-source' " in max77620_parse_fps()
215 sc->event_source[id] = val; in max77620_parse_fps()
228 sc->shutdown_fps[i] = -1; in max77620_parse_fdt()
229 sc->suspend_fps[i] = -1; in max77620_parse_fdt()
230 sc->event_source[i] = -1; in max77620_parse_fdt()
259 device_printf(sc->dev, "Cannot read chip ID: %d\n", rv); in max77620_get_version()
264 device_printf(sc->dev, in max77620_get_version()
268 device_printf(sc->dev, " MAX77620 version - OTP: 0x%02X, ES: 0x%02X\n", in max77620_get_version()
298 if (sc->shutdown_fps[i] != -1) { in max77620_init()
301 sc->shutdown_fps[i]); in max77620_init()
306 if (sc->event_source[i] != -1) { in max77620_init()
308 tmp = sc->event_source[i]; in max77620_init()
311 if (sc->event_source[i] == 2) { in max77620_init()
319 device_printf(sc->dev, "I/O error: %d\n", rv); in max77620_init()
373 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) in max77620_probe()
388 sc->dev = dev; in max77620_attach()
389 sc->bus_addr = iicbus_get_addr(dev); in max77620_attach()
390 node = ofw_bus_get_node(sc->dev); in max77620_attach()
395 sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in max77620_attach()
398 if (sc->irq_res == NULL) { in max77620_attach()
431 rv = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, in max77620_attach()
432 NULL, max77620_intr, sc, &sc->irq_h); in max77620_attach()
442 if (sc->irq_h != NULL) in max77620_attach()
443 bus_teardown_intr(dev, sc->irq_res, sc->irq_h); in max77620_attach()
444 if (sc->irq_res != NULL) in max77620_attach()
445 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); in max77620_attach()
461 if (sc->irq_h != NULL) in max77620_detach()
462 bus_teardown_intr(dev, sc->irq_res, sc->irq_h); in max77620_detach()
463 if (sc->irq_res != NULL) in max77620_detach()
464 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); in max77620_detach()