Lines Matching +full:vdd2 +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0-only
36 "vdd2",
69 err = regulator_bulk_enable(hub->pdata->num_supplies, hub->supplies); in onboard_hub_power_on()
71 dev_err(hub->dev, "failed to enable supplies: %d\n", err); in onboard_hub_power_on()
75 fsleep(hub->pdata->reset_us); in onboard_hub_power_on()
76 gpiod_set_value_cansleep(hub->reset_gpio, 0); in onboard_hub_power_on()
78 hub->is_powered_on = true; in onboard_hub_power_on()
87 gpiod_set_value_cansleep(hub->reset_gpio, 1); in onboard_hub_power_off()
89 err = regulator_bulk_disable(hub->pdata->num_supplies, hub->supplies); in onboard_hub_power_off()
91 dev_err(hub->dev, "failed to disable supplies: %d\n", err); in onboard_hub_power_off()
95 hub->is_powered_on = false; in onboard_hub_power_off()
106 if (hub->always_powered_in_suspend) in onboard_hub_suspend()
109 mutex_lock(&hub->lock); in onboard_hub_suspend()
111 list_for_each_entry(node, &hub->udev_list, list) { in onboard_hub_suspend()
112 if (!device_may_wakeup(node->udev->bus->controller)) in onboard_hub_suspend()
115 if (usb_wakeup_enabled_descendants(node->udev)) { in onboard_hub_suspend()
121 mutex_unlock(&hub->lock); in onboard_hub_suspend()
133 if (hub->is_powered_on) in onboard_hub_resume()
141 snprintf(buf, size, "usb_dev.%s", dev_name(&udev->dev)); in get_udev_link_name()
150 mutex_lock(&hub->lock); in onboard_hub_add_usbdev()
152 if (hub->going_away) { in onboard_hub_add_usbdev()
153 err = -EINVAL; in onboard_hub_add_usbdev()
159 err = -ENOMEM; in onboard_hub_add_usbdev()
163 node->udev = udev; in onboard_hub_add_usbdev()
165 list_add(&node->list, &hub->udev_list); in onboard_hub_add_usbdev()
167 mutex_unlock(&hub->lock); in onboard_hub_add_usbdev()
170 WARN_ON(sysfs_create_link(&hub->dev->kobj, &udev->dev.kobj, link_name)); in onboard_hub_add_usbdev()
175 mutex_unlock(&hub->lock); in onboard_hub_add_usbdev()
186 sysfs_remove_link(&hub->dev->kobj, link_name); in onboard_hub_remove_usbdev()
188 mutex_lock(&hub->lock); in onboard_hub_remove_usbdev()
190 list_for_each_entry(node, &hub->udev_list, list) { in onboard_hub_remove_usbdev()
191 if (node->udev == udev) { in onboard_hub_remove_usbdev()
192 list_del(&node->list); in onboard_hub_remove_usbdev()
198 mutex_unlock(&hub->lock); in onboard_hub_remove_usbdev()
206 return sysfs_emit(buf, "%d\n", hub->always_powered_in_suspend); in always_powered_in_suspend_show()
220 hub->always_powered_in_suspend = val; in always_powered_in_suspend_store()
244 struct device *dev = &pdev->dev; in onboard_hub_probe()
251 return -ENOMEM; in onboard_hub_probe()
253 of_id = of_match_device(onboard_hub_match, &pdev->dev); in onboard_hub_probe()
255 return -ENODEV; in onboard_hub_probe()
257 hub->pdata = of_id->data; in onboard_hub_probe()
258 if (!hub->pdata) in onboard_hub_probe()
259 return -EINVAL; in onboard_hub_probe()
261 if (hub->pdata->num_supplies > MAX_SUPPLIES) in onboard_hub_probe()
262 return dev_err_probe(dev, -EINVAL, "max %zu supplies supported!\n", in onboard_hub_probe()
265 for (i = 0; i < hub->pdata->num_supplies; i++) in onboard_hub_probe()
266 hub->supplies[i].supply = supply_names[i]; in onboard_hub_probe()
268 err = devm_regulator_bulk_get(dev, hub->pdata->num_supplies, hub->supplies); in onboard_hub_probe()
274 hub->reset_gpio = devm_gpiod_get_optional(dev, "reset", in onboard_hub_probe()
276 if (IS_ERR(hub->reset_gpio)) in onboard_hub_probe()
277 return dev_err_probe(dev, PTR_ERR(hub->reset_gpio), "failed to get reset GPIO\n"); in onboard_hub_probe()
279 hub->dev = dev; in onboard_hub_probe()
280 mutex_init(&hub->lock); in onboard_hub_probe()
281 INIT_LIST_HEAD(&hub->udev_list); in onboard_hub_probe()
292 * make sure to re-attach it if needed. in onboard_hub_probe()
294 * This needs to be done deferred to avoid self-deadlocks on systems in onboard_hub_probe()
304 struct onboard_hub *hub = dev_get_drvdata(&pdev->dev); in onboard_hub_remove()
308 hub->going_away = true; in onboard_hub_remove()
310 mutex_lock(&hub->lock); in onboard_hub_remove()
313 while (!list_empty(&hub->udev_list)) { in onboard_hub_remove()
314 node = list_first_entry(&hub->udev_list, struct usbdev_node, list); in onboard_hub_remove()
315 udev = node->udev; in onboard_hub_remove()
319 * which acquires hub->lock. We must release the lock first. in onboard_hub_remove()
321 get_device(&udev->dev); in onboard_hub_remove()
322 mutex_unlock(&hub->lock); in onboard_hub_remove()
323 device_release_driver(&udev->dev); in onboard_hub_remove()
324 put_device(&udev->dev); in onboard_hub_remove()
325 mutex_lock(&hub->lock); in onboard_hub_remove()
328 mutex_unlock(&hub->lock); in onboard_hub_remove()
344 .name = "onboard-usb-hub",
370 pdev = of_find_device_by_node(dev->of_node); in _find_onboard_hub()
372 np = of_parse_phandle(dev->of_node, "peer-hub", 0); in _find_onboard_hub()
375 return ERR_PTR(-EINVAL); in _find_onboard_hub()
382 return ERR_PTR(-ENODEV); in _find_onboard_hub()
385 hub = dev_get_drvdata(&pdev->dev); in _find_onboard_hub()
386 put_device(&pdev->dev); in _find_onboard_hub()
396 return ERR_PTR(-EPROBE_DEFER); in _find_onboard_hub()
403 struct device *dev = &udev->dev; in onboard_hub_usbdev_probe()
408 if (!dev->of_node) in onboard_hub_usbdev_probe()
409 return -ENODEV; in onboard_hub_usbdev_probe()
426 struct onboard_hub *hub = dev_get_drvdata(&udev->dev); in onboard_hub_usbdev_disconnect()
455 .name = "onboard-usb-hub",