Lines Matching refs:hub
36 int (*get_state)(struct ssam_hub *hub, enum ssam_hub_state *state);
61 int (*get_state)(struct ssam_hub *hub, enum ssam_hub_state *state);
69 struct ssam_hub *hub = container_of(work, struct ssam_hub, update_work.work); in ssam_hub_update_workfn() local
73 status = hub->ops.get_state(hub, &state); in ssam_hub_update_workfn()
97 if (test_and_clear_bit(SSAM_HUB_HOT_REMOVED, &hub->flags)) { in ssam_hub_update_workfn()
99 schedule_delayed_work(&hub->update_work, hub->connect_delay); in ssam_hub_update_workfn()
104 if (hub->state == state) in ssam_hub_update_workfn()
106 hub->state = state; in ssam_hub_update_workfn()
108 if (hub->state == SSAM_HUB_CONNECTED) in ssam_hub_update_workfn()
109 status = ssam_device_register_clients(hub->sdev); in ssam_hub_update_workfn()
111 ssam_remove_clients(&hub->sdev->dev); in ssam_hub_update_workfn()
114 dev_err(&hub->sdev->dev, "failed to update hub child devices: %d\n", status); in ssam_hub_update_workfn()
127 static void ssam_hub_update(struct ssam_hub *hub, bool connected) in ssam_hub_update() argument
133 set_bit(SSAM_HUB_HOT_REMOVED, &hub->flags); in ssam_hub_update()
134 device_for_each_child_reverse(&hub->sdev->dev, NULL, ssam_hub_mark_hot_removed); in ssam_hub_update()
141 delay = connected ? hub->connect_delay : 0; in ssam_hub_update()
143 schedule_delayed_work(&hub->update_work, delay); in ssam_hub_update()
148 struct ssam_hub *hub = dev_get_drvdata(dev); in ssam_hub_resume() local
150 schedule_delayed_work(&hub->update_work, 0); in ssam_hub_resume()
158 struct ssam_hub *hub; in ssam_hub_probe() local
167 hub = devm_kzalloc(&sdev->dev, sizeof(*hub), GFP_KERNEL); in ssam_hub_probe()
168 if (!hub) in ssam_hub_probe()
171 hub->sdev = sdev; in ssam_hub_probe()
172 hub->state = SSAM_HUB_UNINITIALIZED; in ssam_hub_probe()
174 hub->notif.base.priority = INT_MAX; /* This notifier should run first. */ in ssam_hub_probe()
175 hub->notif.base.fn = desc->ops.notify; in ssam_hub_probe()
176 hub->notif.event.reg = desc->event.reg; in ssam_hub_probe()
177 hub->notif.event.id = desc->event.id; in ssam_hub_probe()
178 hub->notif.event.mask = desc->event.mask; in ssam_hub_probe()
179 hub->notif.event.flags = SSAM_EVENT_SEQUENCED; in ssam_hub_probe()
181 hub->connect_delay = msecs_to_jiffies(desc->connect_delay_ms); in ssam_hub_probe()
182 hub->ops.get_state = desc->ops.get_state; in ssam_hub_probe()
184 INIT_DELAYED_WORK(&hub->update_work, ssam_hub_update_workfn); in ssam_hub_probe()
186 ssam_device_set_drvdata(sdev, hub); in ssam_hub_probe()
188 status = ssam_device_notifier_register(sdev, &hub->notif); in ssam_hub_probe()
192 schedule_delayed_work(&hub->update_work, 0); in ssam_hub_probe()
198 struct ssam_hub *hub = ssam_device_get_drvdata(sdev); in ssam_hub_remove() local
200 ssam_device_notifier_unregister(sdev, &hub->notif); in ssam_hub_remove()
201 cancel_delayed_work_sync(&hub->update_work); in ssam_hub_remove()
225 static int ssam_base_hub_query_state(struct ssam_hub *hub, enum ssam_hub_state *state) in ssam_base_hub_query_state() argument
230 status = ssam_retry(ssam_bas_query_opmode, hub->sdev->ctrl, &opmode); in ssam_base_hub_query_state()
232 dev_err(&hub->sdev->dev, "failed to query base state: %d\n", status); in ssam_base_hub_query_state()
246 struct ssam_hub *hub = container_of(nf, struct ssam_hub, notif); in ssam_base_hub_notif() local
252 dev_err(&hub->sdev->dev, "unexpected payload size: %u\n", event->length); in ssam_base_hub_notif()
256 ssam_hub_update(hub, event->data[0]); in ssam_base_hub_notif()
300 static int ssam_kip_hub_query_state(struct ssam_hub *hub, enum ssam_hub_state *state) in ssam_kip_hub_query_state() argument
305 status = ssam_retry(__ssam_kip_query_state, hub->sdev->ctrl, &connected); in ssam_kip_hub_query_state()
307 dev_err(&hub->sdev->dev, "failed to query KIP connection state: %d\n", status); in ssam_kip_hub_query_state()
317 struct ssam_hub *hub = container_of(nf, struct ssam_hub, notif); in ssam_kip_hub_notif() local
323 dev_err(&hub->sdev->dev, "unexpected payload size: %u\n", event->length); in ssam_kip_hub_notif()
327 ssam_hub_update(hub, event->data[0]); in ssam_kip_hub_notif()