Lines Matching refs:thdev
36 struct intel_th_device *thdev = to_intel_th_device(dev); in intel_th_match() local
38 if (thdev->type == INTEL_TH_SWITCH && in intel_th_match()
42 return !strcmp(thdev->name, driver->name); in intel_th_match()
55 struct intel_th_device *thdev = to_intel_th_device(dev); in intel_th_probe() local
60 if (thdev->type == INTEL_TH_SWITCH) in intel_th_probe()
61 hub = thdev; in intel_th_probe()
74 if (thdev->type == INTEL_TH_OUTPUT && in intel_th_probe()
75 !intel_th_output_assigned(thdev)) in intel_th_probe()
76 ret = hubdrv->assign(hub, thdev); in intel_th_probe()
84 struct intel_th_device *thdev = to_intel_th_device(dev); in intel_th_remove() local
88 if (thdev->type == INTEL_TH_SWITCH) { in intel_th_remove()
89 err = device_for_each_child(dev, thdev, intel_th_child_remove); in intel_th_remove()
94 thdrv->remove(thdev); in intel_th_remove()
96 if (intel_th_output_assigned(thdev)) { in intel_th_remove()
101 hubdrv->unassign(hub, thdev); in intel_th_remove()
115 static void intel_th_device_free(struct intel_th_device *thdev);
130 struct intel_th_device *thdev = to_intel_th_device(dev); in intel_th_output_devnode() local
133 if (thdev->id >= 0) in intel_th_output_devnode()
134 node = kasprintf(GFP_KERNEL, "intel_th%d/%s%d", 0, thdev->name, in intel_th_output_devnode()
135 thdev->id); in intel_th_output_devnode()
137 node = kasprintf(GFP_KERNEL, "intel_th%d/%s", 0, thdev->name); in intel_th_output_devnode()
145 struct intel_th_device *thdev = to_intel_th_device(dev); in port_show() local
147 if (thdev->output.port >= 0) in port_show()
148 return scnprintf(buf, PAGE_SIZE, "%u\n", thdev->output.port); in port_show()
155 static int intel_th_output_activate(struct intel_th_device *thdev) in intel_th_output_activate() argument
157 struct intel_th_driver *thdrv = to_intel_th_driver(thdev->dev.driver); in intel_th_output_activate()
160 return thdrv->activate(thdev); in intel_th_output_activate()
162 intel_th_trace_enable(thdev); in intel_th_output_activate()
167 static void intel_th_output_deactivate(struct intel_th_device *thdev) in intel_th_output_deactivate() argument
169 struct intel_th_driver *thdrv = to_intel_th_driver(thdev->dev.driver); in intel_th_output_deactivate()
172 thdrv->deactivate(thdev); in intel_th_output_deactivate()
174 intel_th_trace_disable(thdev); in intel_th_output_deactivate()
180 struct intel_th_device *thdev = to_intel_th_device(dev); in active_show() local
182 return scnprintf(buf, PAGE_SIZE, "%d\n", thdev->output.active); in active_show()
188 struct intel_th_device *thdev = to_intel_th_device(dev); in active_store() local
196 if (!!val != thdev->output.active) { in active_store()
198 ret = intel_th_output_activate(thdev); in active_store()
200 intel_th_output_deactivate(thdev); in active_store()
256 struct intel_th_device *thdev; in intel_th_device_alloc() local
263 thdev = kzalloc(sizeof(*thdev) + strlen(name) + 1, GFP_KERNEL); in intel_th_device_alloc()
264 if (!thdev) in intel_th_device_alloc()
267 thdev->id = id; in intel_th_device_alloc()
268 thdev->type = type; in intel_th_device_alloc()
270 strcpy(thdev->name, name); in intel_th_device_alloc()
271 device_initialize(&thdev->dev); in intel_th_device_alloc()
272 thdev->dev.bus = &intel_th_bus; in intel_th_device_alloc()
273 thdev->dev.type = intel_th_device_type[type]; in intel_th_device_alloc()
274 thdev->dev.parent = parent; in intel_th_device_alloc()
275 thdev->dev.dma_mask = parent->dma_mask; in intel_th_device_alloc()
276 thdev->dev.dma_parms = parent->dma_parms; in intel_th_device_alloc()
277 dma_set_coherent_mask(&thdev->dev, parent->coherent_dma_mask); in intel_th_device_alloc()
279 dev_set_name(&thdev->dev, "%d-%s%d", th->id, name, id); in intel_th_device_alloc()
281 dev_set_name(&thdev->dev, "%d-%s", th->id, name); in intel_th_device_alloc()
283 return thdev; in intel_th_device_alloc()
286 static int intel_th_device_add_resources(struct intel_th_device *thdev, in intel_th_device_add_resources() argument
295 thdev->resource = r; in intel_th_device_add_resources()
296 thdev->num_resources = nres; in intel_th_device_add_resources()
301 static void intel_th_device_remove(struct intel_th_device *thdev) in intel_th_device_remove() argument
303 device_del(&thdev->dev); in intel_th_device_remove()
304 put_device(&thdev->dev); in intel_th_device_remove()
307 static void intel_th_device_free(struct intel_th_device *thdev) in intel_th_device_free() argument
309 kfree(thdev->resource); in intel_th_device_free()
310 kfree(thdev); in intel_th_device_free()
432 struct intel_th_device *thdev; in intel_th_populate() local
435 thdev = intel_th_device_alloc(th, subdev->type, subdev->name, in intel_th_populate()
437 if (!thdev) { in intel_th_populate()
470 err = intel_th_device_add_resources(thdev, res, subdev->nres); in intel_th_populate()
472 put_device(&thdev->dev); in intel_th_populate()
477 thdev->dev.devt = MKDEV(th->major, i); in intel_th_populate()
478 thdev->output.type = subdev->otype; in intel_th_populate()
479 thdev->output.port = -1; in intel_th_populate()
482 err = device_add(&thdev->dev); in intel_th_populate()
484 put_device(&thdev->dev); in intel_th_populate()
490 th->hub = thdev; in intel_th_populate()
496 th->thdev[i] = thdev; in intel_th_populate()
503 intel_th_device_remove(th->thdev[i]); in intel_th_populate()
607 if (th->thdev[i] != th->hub) in intel_th_free()
608 intel_th_device_remove(th->thdev[i]); in intel_th_free()
625 int intel_th_trace_enable(struct intel_th_device *thdev) in intel_th_trace_enable() argument
627 struct intel_th_device *hub = to_intel_th_device(thdev->dev.parent); in intel_th_trace_enable()
633 if (WARN_ON_ONCE(thdev->type != INTEL_TH_OUTPUT)) in intel_th_trace_enable()
636 hubdrv->enable(hub, &thdev->output); in intel_th_trace_enable()
646 int intel_th_trace_disable(struct intel_th_device *thdev) in intel_th_trace_disable() argument
648 struct intel_th_device *hub = to_intel_th_device(thdev->dev.parent); in intel_th_trace_disable()
652 if (WARN_ON_ONCE(thdev->type != INTEL_TH_OUTPUT)) in intel_th_trace_disable()
655 hubdrv->disable(hub, &thdev->output); in intel_th_trace_disable()
661 int intel_th_set_output(struct intel_th_device *thdev, in intel_th_set_output() argument
664 struct intel_th_device *hub = to_intel_th_device(thdev->dev.parent); in intel_th_set_output()