Lines Matching refs:nop

65 static void nop_reset(struct usb_phy_generic *nop)  in nop_reset()  argument
67 if (!nop->gpiod_reset) in nop_reset()
70 gpiod_set_value(nop->gpiod_reset, 1); in nop_reset()
72 gpiod_set_value(nop->gpiod_reset, 0); in nop_reset()
76 static void nop_set_vbus_draw(struct usb_phy_generic *nop, unsigned mA) in nop_set_vbus_draw() argument
78 struct regulator *vbus_draw = nop->vbus_draw; in nop_set_vbus_draw()
85 enabled = nop->vbus_draw_enabled; in nop_set_vbus_draw()
92 nop->vbus_draw_enabled = 1; in nop_set_vbus_draw()
99 nop->vbus_draw_enabled = 0; in nop_set_vbus_draw()
102 nop->mA = mA; in nop_set_vbus_draw()
108 struct usb_phy_generic *nop = data; in nop_gpio_vbus_thread() local
109 struct usb_otg *otg = nop->phy.otg; in nop_gpio_vbus_thread()
112 vbus = gpiod_get_value(nop->gpiod_vbus); in nop_gpio_vbus_thread()
113 if ((vbus ^ nop->vbus) == 0) in nop_gpio_vbus_thread()
115 nop->vbus = vbus; in nop_gpio_vbus_thread()
120 nop->phy.last_event = status; in nop_gpio_vbus_thread()
124 nop_set_vbus_draw(nop, 100); in nop_gpio_vbus_thread()
126 atomic_notifier_call_chain(&nop->phy.notifier, status, in nop_gpio_vbus_thread()
129 nop_set_vbus_draw(nop, 0); in nop_gpio_vbus_thread()
134 nop->phy.last_event = status; in nop_gpio_vbus_thread()
136 atomic_notifier_call_chain(&nop->phy.notifier, status, in nop_gpio_vbus_thread()
144 struct usb_phy_generic *nop = dev_get_drvdata(phy->dev); in usb_gen_phy_init() local
146 if (!IS_ERR(nop->vcc)) { in usb_gen_phy_init()
147 if (regulator_enable(nop->vcc)) in usb_gen_phy_init()
151 if (!IS_ERR(nop->clk)) in usb_gen_phy_init()
152 clk_prepare_enable(nop->clk); in usb_gen_phy_init()
154 nop_reset(nop); in usb_gen_phy_init()
162 struct usb_phy_generic *nop = dev_get_drvdata(phy->dev); in usb_gen_phy_shutdown() local
164 gpiod_set_value(nop->gpiod_reset, 1); in usb_gen_phy_shutdown()
166 if (!IS_ERR(nop->clk)) in usb_gen_phy_shutdown()
167 clk_disable_unprepare(nop->clk); in usb_gen_phy_shutdown()
169 if (!IS_ERR(nop->vcc)) { in usb_gen_phy_shutdown()
170 if (regulator_disable(nop->vcc)) in usb_gen_phy_shutdown()
205 int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, in usb_phy_gen_create_phy() argument
221 nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset", in usb_phy_gen_create_phy()
223 err = PTR_ERR_OR_ZERO(nop->gpiod_reset); in usb_phy_gen_create_phy()
225 nop->gpiod_vbus = devm_gpiod_get_optional(dev, in usb_phy_gen_create_phy()
228 err = PTR_ERR_OR_ZERO(nop->gpiod_vbus); in usb_phy_gen_create_phy()
239 nop->gpiod_reset = in usb_phy_gen_create_phy()
242 nop->gpiod_vbus = pdata->gpiod_vbus; in usb_phy_gen_create_phy()
251 if (nop->gpiod_reset) in usb_phy_gen_create_phy()
252 gpiod_direction_output(nop->gpiod_reset, 1); in usb_phy_gen_create_phy()
254 nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg), in usb_phy_gen_create_phy()
256 if (!nop->phy.otg) in usb_phy_gen_create_phy()
259 nop->clk = devm_clk_get(dev, "main_clk"); in usb_phy_gen_create_phy()
260 if (IS_ERR(nop->clk)) { in usb_phy_gen_create_phy()
262 PTR_ERR(nop->clk)); in usb_phy_gen_create_phy()
265 if (!IS_ERR(nop->clk) && clk_rate) { in usb_phy_gen_create_phy()
266 err = clk_set_rate(nop->clk, clk_rate); in usb_phy_gen_create_phy()
273 nop->vcc = devm_regulator_get(dev, "vcc"); in usb_phy_gen_create_phy()
274 if (IS_ERR(nop->vcc)) { in usb_phy_gen_create_phy()
276 PTR_ERR(nop->vcc)); in usb_phy_gen_create_phy()
281 nop->dev = dev; in usb_phy_gen_create_phy()
282 nop->phy.dev = nop->dev; in usb_phy_gen_create_phy()
283 nop->phy.label = "nop-xceiv"; in usb_phy_gen_create_phy()
284 nop->phy.set_suspend = nop_set_suspend; in usb_phy_gen_create_phy()
285 nop->phy.type = type; in usb_phy_gen_create_phy()
287 nop->phy.otg->state = OTG_STATE_UNDEFINED; in usb_phy_gen_create_phy()
288 nop->phy.otg->usb_phy = &nop->phy; in usb_phy_gen_create_phy()
289 nop->phy.otg->set_host = nop_set_host; in usb_phy_gen_create_phy()
290 nop->phy.otg->set_peripheral = nop_set_peripheral; in usb_phy_gen_create_phy()
299 struct usb_phy_generic *nop; in usb_phy_generic_probe() local
302 nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL); in usb_phy_generic_probe()
303 if (!nop) in usb_phy_generic_probe()
306 err = usb_phy_gen_create_phy(dev, nop, dev_get_platdata(&pdev->dev)); in usb_phy_generic_probe()
309 if (nop->gpiod_vbus) { in usb_phy_generic_probe()
311 gpiod_to_irq(nop->gpiod_vbus), in usb_phy_generic_probe()
314 nop); in usb_phy_generic_probe()
317 gpiod_to_irq(nop->gpiod_vbus), err); in usb_phy_generic_probe()
322 nop->phy.init = usb_gen_phy_init; in usb_phy_generic_probe()
323 nop->phy.shutdown = usb_gen_phy_shutdown; in usb_phy_generic_probe()
325 err = usb_add_phy_dev(&nop->phy); in usb_phy_generic_probe()
332 platform_set_drvdata(pdev, nop); in usb_phy_generic_probe()
339 struct usb_phy_generic *nop = platform_get_drvdata(pdev); in usb_phy_generic_remove() local
341 usb_remove_phy(&nop->phy); in usb_phy_generic_remove()