Lines Matching defs:nop

10  *	This provides a "nop" transceiver for PHYs which are
48 struct usb_phy_generic *nop = dev_get_drvdata(x->dev);
52 if (!IS_ERR(nop->clk))
53 clk_disable_unprepare(nop->clk);
54 if (!IS_ERR(nop->vcc) && !device_may_wakeup(x->dev))
55 ret = regulator_disable(nop->vcc);
57 if (!IS_ERR(nop->vcc) && !device_may_wakeup(x->dev))
58 ret = regulator_enable(nop->vcc);
59 if (!IS_ERR(nop->clk))
60 clk_prepare_enable(nop->clk);
66 static void nop_reset(struct usb_phy_generic *nop)
68 if (!nop->gpiod_reset)
71 gpiod_set_value_cansleep(nop->gpiod_reset, 1);
73 gpiod_set_value_cansleep(nop->gpiod_reset, 0);
80 struct usb_phy_generic *nop = dev_get_drvdata(otg->usb_phy->dev);
82 if (!nop->vbus_draw)
85 if (enable && !nop->vbus_draw_enabled) {
86 ret = regulator_enable(nop->vbus_draw);
88 nop->vbus_draw_enabled = false;
90 nop->vbus_draw_enabled = true;
92 } else if (!enable && nop->vbus_draw_enabled) {
93 ret = regulator_disable(nop->vbus_draw);
94 nop->vbus_draw_enabled = false;
102 struct usb_phy_generic *nop = data;
103 struct usb_otg *otg = nop->phy.otg;
106 vbus = gpiod_get_value(nop->gpiod_vbus);
107 if ((vbus ^ nop->vbus) == 0)
109 nop->vbus = vbus;
114 nop->phy.last_event = status;
116 atomic_notifier_call_chain(&nop->phy.notifier, status,
121 nop->phy.last_event = status;
123 atomic_notifier_call_chain(&nop->phy.notifier, status,
131 struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
134 if (!IS_ERR(nop->vcc)) {
135 if (regulator_enable(nop->vcc))
139 if (!IS_ERR(nop->clk)) {
140 ret = clk_prepare_enable(nop->clk);
145 nop_reset(nop);
153 struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
155 gpiod_set_value_cansleep(nop->gpiod_reset, 1);
157 if (!IS_ERR(nop->clk))
158 clk_disable_unprepare(nop->clk);
160 if (!IS_ERR(nop->vcc)) {
161 if (regulator_disable(nop->vcc))
200 int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
216 nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
218 err = PTR_ERR_OR_ZERO(nop->gpiod_reset);
220 nop->gpiod_vbus = devm_gpiod_get_optional(dev,
223 err = PTR_ERR_OR_ZERO(nop->gpiod_vbus);
229 if (nop->gpiod_reset)
230 gpiod_direction_output(nop->gpiod_reset, 1);
232 nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg),
234 if (!nop->phy.otg)
237 nop->clk = devm_clk_get(dev, "main_clk");
238 if (IS_ERR(nop->clk)) {
240 PTR_ERR(nop->clk));
242 return PTR_ERR(nop->clk);
245 if (!IS_ERR(nop->clk) && clk_rate) {
246 err = clk_set_rate(nop->clk, clk_rate);
253 nop->vcc = devm_regulator_get_optional(dev, "vcc");
254 if (IS_ERR(nop->vcc) && PTR_ERR(nop->vcc) != -ENODEV)
255 return dev_err_probe(dev, PTR_ERR(nop->vcc),
258 nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus");
259 if (PTR_ERR(nop->vbus_draw) == -ENODEV)
260 nop->vbus_draw = NULL;
261 if (IS_ERR(nop->vbus_draw))
262 return dev_err_probe(dev, PTR_ERR(nop->vbus_draw),
265 nop->dev = dev;
266 nop->phy.dev = nop->dev;
267 nop->phy.label = "nop-xceiv";
268 nop->phy.set_suspend = nop_set_suspend;
269 nop->phy.type = type;
271 nop->phy.otg->state = OTG_STATE_UNDEFINED;
272 nop->phy.otg->usb_phy = &nop->phy;
273 nop->phy.otg->set_host = nop_set_host;
274 nop->phy.otg->set_peripheral = nop_set_peripheral;
275 nop->phy.otg->set_vbus = nop_set_vbus;
285 struct usb_phy_generic *nop;
288 nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL);
289 if (!nop)
292 err = usb_phy_gen_create_phy(dev, nop);
295 if (nop->gpiod_vbus) {
297 gpiod_to_irq(nop->gpiod_vbus),
300 nop);
303 gpiod_to_irq(nop->gpiod_vbus), err);
306 nop->phy.otg->state = gpiod_get_value(nop->gpiod_vbus) ?
310 nop->phy.init = usb_gen_phy_init;
311 nop->phy.shutdown = usb_gen_phy_shutdown;
313 err = usb_add_phy_dev(&nop->phy);
320 platform_set_drvdata(pdev, nop);
330 struct usb_phy_generic *nop = platform_get_drvdata(pdev);
332 usb_remove_phy(&nop->phy);
334 if (nop->vbus_draw && nop->vbus_draw_enabled)
335 regulator_disable(nop->vbus_draw);
339 { .compatible = "usb-nop-xceiv" },