Lines Matching full:ssi
2 /* OMAP SSI driver.
42 struct hsi_controller *ssi = m->private; in ssi_regs_show() local
43 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_regs_show()
46 pm_runtime_get_sync(ssi->device.parent); in ssi_regs_show()
50 pm_runtime_put(ssi->device.parent); in ssi_regs_show()
57 struct hsi_controller *ssi = m->private; in ssi_gdd_regs_show() local
58 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_gdd_regs_show()
63 pm_runtime_get_sync(ssi->device.parent); in ssi_gdd_regs_show()
104 pm_runtime_put(ssi->device.parent); in ssi_gdd_regs_show()
112 static int ssi_debug_add_ctrl(struct hsi_controller *ssi) in ssi_debug_add_ctrl() argument
114 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_debug_add_ctrl()
117 /* SSI controller */ in ssi_debug_add_ctrl()
118 omap_ssi->dir = debugfs_create_dir(dev_name(&ssi->device), NULL); in ssi_debug_add_ctrl()
119 debugfs_create_file("regs", S_IRUGO, omap_ssi->dir, ssi, &ssi_regs_fops); in ssi_debug_add_ctrl()
121 /* SSI GDD (DMA) */ in ssi_debug_add_ctrl()
123 debugfs_create_file("regs", S_IRUGO, dir, ssi, &ssi_gdd_regs_fops); in ssi_debug_add_ctrl()
128 static void ssi_debug_remove_ctrl(struct hsi_controller *ssi) in ssi_debug_remove_ctrl() argument
130 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_debug_remove_ctrl()
144 struct hsi_controller *ssi = to_hsi_controller(port->device.parent); in ssi_waketest() local
145 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_waketest()
149 pm_runtime_get_sync(ssi->device.parent); in ssi_waketest()
155 pm_runtime_put(ssi->device.parent); in ssi_waketest()
160 static void ssi_gdd_complete(struct hsi_controller *ssi, unsigned int lch) in ssi_gdd_complete() argument
162 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_gdd_complete()
185 dma_unmap_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, dir); in ssi_gdd_complete()
213 struct hsi_controller *ssi = (struct hsi_controller *)dev; in ssi_gdd_tasklet() local
214 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_gdd_tasklet()
219 pm_runtime_get(ssi->device.parent); in ssi_gdd_tasklet()
221 if (!pm_runtime_active(ssi->device.parent)) { in ssi_gdd_tasklet()
222 dev_warn(ssi->device.parent, "ssi_gdd_tasklet called without runtime PM!\n"); in ssi_gdd_tasklet()
223 pm_runtime_put(ssi->device.parent); in ssi_gdd_tasklet()
230 ssi_gdd_complete(ssi, lch); in ssi_gdd_tasklet()
235 pm_runtime_put(ssi->device.parent); in ssi_gdd_tasklet()
244 static irqreturn_t ssi_gdd_isr(int irq, void *ssi) in ssi_gdd_isr() argument
246 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_gdd_isr()
254 static unsigned long ssi_get_clk_rate(struct hsi_controller *ssi) in ssi_get_clk_rate() argument
256 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_get_clk_rate()
266 struct hsi_controller *ssi = to_hsi_controller(omap_ssi->dev); in ssi_clk_event() local
273 dev_dbg(&ssi->device, "pre rate change\n"); in ssi_clk_event()
275 for (i = 0; i < ssi->num_ports; i++) { in ssi_clk_event()
284 /* stop all ssi communication */ in ssi_clk_event()
291 dev_dbg(&ssi->device, "abort rate change\n"); in ssi_clk_event()
294 dev_dbg(&ssi->device, "post rate change (%lu -> %lu)\n", in ssi_clk_event()
298 for (i = 0; i < ssi->num_ports; i++) { in ssi_clk_event()
304 omap_ssi_port_update_fclk(ssi, omap_port); in ssi_clk_event()
306 /* resume ssi communication */ in ssi_clk_event()
324 struct hsi_controller *ssi = platform_get_drvdata(pd); in ssi_get_iomem() local
327 base = devm_ioremap_resource(&ssi->device, mem); in ssi_get_iomem()
339 static int ssi_add_controller(struct hsi_controller *ssi, in ssi_add_controller() argument
345 omap_ssi = devm_kzalloc(&ssi->device, sizeof(*omap_ssi), GFP_KERNEL); in ssi_add_controller()
352 ssi->id = err; in ssi_add_controller()
354 ssi->owner = THIS_MODULE; in ssi_add_controller()
355 ssi->device.parent = &pd->dev; in ssi_add_controller()
356 dev_set_name(&ssi->device, "ssi%d", ssi->id); in ssi_add_controller()
357 hsi_controller_set_drvdata(ssi, omap_ssi); in ssi_add_controller()
358 omap_ssi->dev = &ssi->device; in ssi_add_controller()
370 (unsigned long)ssi); in ssi_add_controller()
371 err = devm_request_irq(&ssi->device, omap_ssi->gdd_irq, ssi_gdd_isr, in ssi_add_controller()
372 0, "gdd_mpu", ssi); in ssi_add_controller()
374 dev_err(&ssi->device, "Request GDD IRQ %d failed (%d)", in ssi_add_controller()
379 omap_ssi->port = devm_kcalloc(&ssi->device, ssi->num_ports, in ssi_add_controller()
386 omap_ssi->fck = devm_clk_get(&ssi->device, "ssi_ssr_fck"); in ssi_add_controller()
403 err = hsi_register_controller(ssi); in ssi_add_controller()
411 ida_free(&platform_omap_ssi_ida, ssi->id); in ssi_add_controller()
415 static int ssi_hw_init(struct hsi_controller *ssi) in ssi_hw_init() argument
417 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_hw_init()
420 err = pm_runtime_resume_and_get(ssi->device.parent); in ssi_hw_init()
422 dev_err(&ssi->device, "runtime PM failed %d\n", err); in ssi_hw_init()
428 omap_ssi->fck_rate = DIV_ROUND_CLOSEST(ssi_get_clk_rate(ssi), 1000); in ssi_hw_init()
429 dev_dbg(&ssi->device, "SSI fck rate %lu kHz\n", omap_ssi->fck_rate); in ssi_hw_init()
433 pm_runtime_put_sync(ssi->device.parent); in ssi_hw_init()
438 static void ssi_remove_controller(struct hsi_controller *ssi) in ssi_remove_controller() argument
440 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in ssi_remove_controller()
441 int id = ssi->id; in ssi_remove_controller()
443 hsi_unregister_controller(ssi); in ssi_remove_controller()
454 if (of_device_is_compatible(child, "ti,omap3-ssi-port")) in ssi_of_get_available_ports_count()
478 struct hsi_controller *ssi; in ssi_probe() local
489 ssi = hsi_alloc_controller(num_ports, GFP_KERNEL); in ssi_probe()
490 if (!ssi) { in ssi_probe()
495 platform_set_drvdata(pd, ssi); in ssi_probe()
497 err = ssi_add_controller(ssi, pd); in ssi_probe()
499 hsi_put_controller(ssi); in ssi_probe()
505 err = ssi_hw_init(ssi); in ssi_probe()
509 err = ssi_debug_add_ctrl(ssi); in ssi_probe()
515 if (!of_device_is_compatible(child, "ti,omap3-ssi-port")) in ssi_probe()
521 dev_err(&pd->dev, "failed to create ssi controller port\n"); in ssi_probe()
527 dev_info(&pd->dev, "ssi controller %d initialized (%d ports)!\n", in ssi_probe()
528 ssi->id, num_ports); in ssi_probe()
533 ssi_remove_controller(ssi); in ssi_probe()
543 struct hsi_controller *ssi = platform_get_drvdata(pd); in ssi_remove() local
549 ssi_debug_remove_ctrl(ssi); in ssi_remove()
551 ssi_remove_controller(ssi); in ssi_remove()
560 struct hsi_controller *ssi = dev_get_drvdata(dev); in omap_ssi_runtime_suspend() local
561 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in omap_ssi_runtime_suspend()
567 omap_ssi->get_loss(ssi->device.parent); in omap_ssi_runtime_suspend()
574 struct hsi_controller *ssi = dev_get_drvdata(dev); in omap_ssi_runtime_resume() local
575 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); in omap_ssi_runtime_resume()
580 omap_ssi->get_loss(ssi->device.parent))) in omap_ssi_runtime_resume()
600 { .compatible = "ti,omap3-ssi", },