Lines Matching +full:twl4030 +full:- +full:usb

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
32 * Texas Instruments TWL4030/TWL5030/TWL60x0/TPS659x0 Power Management and
36 * copyright (C) 2005-2006 Texas Instruments, Inc.
41 * codecs, USB OTG transceivers, RTC, PWM, etc.
112 #define TWL_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
113 #define TWL_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
115 mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), \
117 #define TWL_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx);
118 #define TWL_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED);
119 #define TWL_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
122 * twl_is_4030 - returns true if the device is TWL4030
123 * twl_is_6025 - returns true if the device is TWL6025
124 * twl_is_6030 - returns true if the device is TWL6030
127 * Returns a non-zero value if the device matches.
130 * Returns a non-zero value if the device matches, otherwise zero.
136 return (sc->sc_type == TWL_DEVICE_4030); in twl_is_4030()
143 return (sc->sc_type == TWL_DEVICE_6025); in twl_is_6025()
150 return (sc->sc_type == TWL_DEVICE_6030); in twl_is_6030()
154 * twl_read - read one or more registers from the TWL device
156 * @nsub: the sub-module to read from
177 addr = sc->sc_subaddr_map[nsub]; in twl_read()
205 * twl_write - writes one or more registers to the TWL device
207 * @nsub: the sub-module to read from
236 addr = sc->sc_subaddr_map[nsub]; in twl_write()
250 device_printf(sc->sc_dev, "iicbus write failed (adr:0x%02x, reg:0x%02x)\n", in twl_write()
259 * twl_test_present - checks if a device with given address is present
281 if (iicbus_transfer(sc->sc_dev, &msg, 1) != 0) in twl_test_present()
288 * twl_scan - scans the i2c bus for sub modules
293 * function scans the bus for 4 possible sub-devices and stores the info
315 device_printf(sc->sc_dev, "Found (sub)device at 0x%02x\n", (base + i)); in twl_scan()
320 memcpy(sc->sc_subaddr_map, devs, TWL_MAX_SUBADDRS); in twl_scan()
324 config_intrhook_disestablish(&sc->sc_scan_hook); in twl_scan()
328 * twl_probe -
332 * strings are; "ti,twl6030", "ti,twl6025", "ti,twl4030".
357 sc->sc_dev = dev; in twl_probe()
358 sc->sc_type = TWL_DEVICE_UNKNOWN; in twl_probe()
362 sc->sc_type = TWL_DEVICE_6030; in twl_probe()
364 sc->sc_type = TWL_DEVICE_6025; in twl_probe()
365 else if (strncasecmp(compat, "ti,twl4030", 10) == 0) in twl_probe()
366 sc->sc_type = TWL_DEVICE_4030; in twl_probe()
368 if (sc->sc_type != TWL_DEVICE_UNKNOWN) in twl_probe()
371 /* Slide to the next sub-string. */ in twl_probe()
374 len -= l; in twl_probe()
377 switch (sc->sc_type) { in twl_probe()
379 device_set_desc(dev, "TI TWL4030/TPS659x0 Companion IC"); in twl_probe()
401 sc->sc_dev = dev; in twl_attach()
408 sc->sc_scan_hook.ich_func = twl_scan; in twl_attach()
409 sc->sc_scan_hook.ich_arg = dev; in twl_attach()
411 if (config_intrhook_establish(&sc->sc_scan_hook) != 0) in twl_attach()
415 if ((sc->sc_vreg = device_add_child(dev, "twl_vreg", -1)) == NULL) in twl_attach()
417 if ((sc->sc_clks = device_add_child(dev, "twl_clks", -1)) == NULL) in twl_attach()
430 if (sc->sc_vreg) in twl_detach()
431 device_delete_child(dev, sc->sc_vreg); in twl_detach()
432 if (sc->sc_clks) in twl_detach()
433 device_delete_child(dev, sc->sc_clks); in twl_detach()