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;
81 {0, IIC_M_WR, 1, &addr},
85 msgs[0].slave = sc->bus_addr;
86 msgs[1].slave = sc->bus_addr;
87 addr = reg;
89 rv = iicbus_transfer(sc->dev, msgs, 2);
91 device_printf(sc->dev,
102 uint8_t addr;
105 {0, IIC_M_WR, 1, &addr},
109 msgs[0].slave = sc->bus_addr;
110 msgs[1].slave = sc->bus_addr;
111 addr = reg;
113 rv = iicbus_transfer(sc->dev, msgs, 2);
115 device_printf(sc->dev,
133 msgs[0].slave = sc->bus_addr;
137 rv = iicbus_transfer(sc->dev, msgs, 1);
139 device_printf(sc->dev,
157 msgs[0].slave = sc->bus_addr;
158 msgs[1].slave = sc->bus_addr;
161 rv = iicbus_transfer(sc->dev, msgs, 2);
163 device_printf(sc->dev,
196 if (OF_getencprop(node, "maxim,shutdown-fps-time-period-us", &val,
200 sc->shutdown_fps[id] = val;
202 if (OF_getencprop(node, "maxim,suspend-fps-time-period-us", &val,
206 sc->suspend_fps[id] = val;
208 if (OF_getencprop(node, "maxim,fps-event-source", &val,
211 device_printf(sc->dev, "Invalid 'fps-event-source' "
215 sc->event_source[id] = val;
228 sc->shutdown_fps[i] = -1;
229 sc->suspend_fps[i] = -1;
230 sc->event_source[i] = -1;
259 device_printf(sc->dev, "Cannot read chip ID: %d\n", rv);
264 device_printf(sc->dev,
268 device_printf(sc->dev, " MAX77620 version - OTP: 0x%02X, ES: 0x%02X\n",
298 if (sc->shutdown_fps[i] != -1) {
301 sc->shutdown_fps[i]);
306 if (sc->event_source[i] != -1) {
308 tmp = sc->event_source[i];
311 if (sc->event_source[i] == 2) {
319 device_printf(sc->dev, "I/O error: %d\n", rv);
373 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data)
388 sc->dev = dev;
389 sc->bus_addr = iicbus_get_addr(dev);
390 node = ofw_bus_get_node(sc->dev);
395 sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
398 if (sc->irq_res == NULL) {
431 rv = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
432 NULL, max77620_intr, sc, &sc->irq_h);
442 if (sc->irq_h != NULL)
443 bus_teardown_intr(dev, sc->irq_res, sc->irq_h);
444 if (sc->irq_res != NULL)
445 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res);
461 if (sc->irq_h != NULL)
462 bus_teardown_intr(dev, sc->irq_res, sc->irq_h);
463 if (sc->irq_res != NULL)
464 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res);