Lines Matching defs:ta

51 static int get_flipped(struct tca_apb *ta, bool *flipped)
56 ret = extcon_get_property(ta->phy.edev, EXTCON_USB_HOST,
59 dev_err(ta->phy.dev, "no polarity property from extcon\n");
70 struct tca_apb *ta = container_of(phy, struct tca_apb, phy);
74 if (ta->phy_initialized)
78 reset_control_deassert(ta->resets[i]);
82 dev_err(ta->phy.dev, "SRAM init failed, 0x%x\n", val);
88 ta->phy_initialized = true;
89 if (!ta->phy.edev) {
90 writel(TCPC_CONN, ta->phy.io_priv + TCPC_OFFSET);
94 schedule_work(&ta->wk);
101 struct tca_apb *ta = container_of(phy, struct tca_apb, phy);
104 if (!ta->phy_initialized)
107 ta->phy_initialized = false;
108 flush_work(&ta->wk);
109 ta->phy.set_vbus(&ta->phy, false);
111 ta->connected = false;
112 writel(TCPC_DISCONN, ta->phy.io_priv + TCPC_OFFSET);
115 reset_control_assert(ta->resets[i]);
120 struct tca_apb *ta = container_of(phy, struct tca_apb, phy);
123 if (!!on == ta->regulator_enabled)
127 ret = regulator_enable(ta->vbus);
129 ret = regulator_disable(ta->vbus);
132 ta->regulator_enabled = on;
134 dev_dbg(ta->phy.dev, "set vbus: %d\n", on);
140 struct tca_apb *ta = container_of(work, struct tca_apb, wk);
146 ret = get_flipped(ta, &flipped);
150 connected = extcon_get_state(ta->phy.edev, EXTCON_USB_HOST);
151 if (connected == ta->connected)
154 ta->connected = connected;
159 dev_dbg(ta->phy.dev, "connected%s\n", flipped ? " flipped" : "");
162 dev_dbg(ta->phy.dev, "disconnected\n");
165 writel(val, ta->phy.io_priv + TCPC_OFFSET);
167 ret = ta->phy.set_vbus(&ta->phy, connected);
169 dev_err(ta->phy.dev, "failed to set VBUS\n");
174 struct tca_apb *ta = container_of(nb, struct tca_apb, phy.id_nb);
176 if (ta->phy_initialized)
177 schedule_work(&ta->wk);
192 struct tca_apb *ta;
195 ta = devm_kzalloc(dev, sizeof(*ta), GFP_KERNEL);
196 if (!ta)
199 platform_set_drvdata(pdev, ta);
200 INIT_WORK(&ta->wk, tca_work);
202 phy = &ta->phy;
216 ta->vbus = devm_regulator_get(dev, "vbus");
217 if (IS_ERR(ta->vbus))
218 return PTR_ERR(ta->vbus);
229 ta->resets[i] = devm_reset_control_get_exclusive(dev, PHY_RESETS[i]);
230 if (IS_ERR(ta->resets[i])) {
232 return PTR_ERR(ta->resets[i]);
240 reset_control_assert(ta->resets[i]);
257 struct tca_apb *ta = platform_get_drvdata(pdev);
259 usb_remove_phy(&ta->phy);