Lines Matching refs:ss
242 if (!ss_algs[i].ss) in sun4i_ss_debugfs_show()
276 struct sun4i_ss_ctx *ss = dev_get_drvdata(dev); in sun4i_ss_pm_suspend() local
278 reset_control_assert(ss->reset); in sun4i_ss_pm_suspend()
280 clk_disable_unprepare(ss->ssclk); in sun4i_ss_pm_suspend()
281 clk_disable_unprepare(ss->busclk); in sun4i_ss_pm_suspend()
287 struct sun4i_ss_ctx *ss = dev_get_drvdata(dev); in sun4i_ss_pm_resume() local
291 err = clk_prepare_enable(ss->busclk); in sun4i_ss_pm_resume()
293 dev_err(ss->dev, "Cannot prepare_enable busclk\n"); in sun4i_ss_pm_resume()
297 err = clk_prepare_enable(ss->ssclk); in sun4i_ss_pm_resume()
299 dev_err(ss->dev, "Cannot prepare_enable ssclk\n"); in sun4i_ss_pm_resume()
303 err = reset_control_deassert(ss->reset); in sun4i_ss_pm_resume()
305 dev_err(ss->dev, "Cannot deassert reset control\n"); in sun4i_ss_pm_resume()
324 static int sun4i_ss_pm_init(struct sun4i_ss_ctx *ss) in sun4i_ss_pm_init() argument
328 pm_runtime_use_autosuspend(ss->dev); in sun4i_ss_pm_init()
329 pm_runtime_set_autosuspend_delay(ss->dev, 2000); in sun4i_ss_pm_init()
331 err = pm_runtime_set_suspended(ss->dev); in sun4i_ss_pm_init()
334 pm_runtime_enable(ss->dev); in sun4i_ss_pm_init()
338 static void sun4i_ss_pm_exit(struct sun4i_ss_ctx *ss) in sun4i_ss_pm_exit() argument
340 pm_runtime_disable(ss->dev); in sun4i_ss_pm_exit()
350 struct sun4i_ss_ctx *ss; in sun4i_ss_probe() local
355 ss = devm_kzalloc(&pdev->dev, sizeof(*ss), GFP_KERNEL); in sun4i_ss_probe()
356 if (!ss) in sun4i_ss_probe()
359 ss->base = devm_platform_ioremap_resource(pdev, 0); in sun4i_ss_probe()
360 if (IS_ERR(ss->base)) { in sun4i_ss_probe()
362 return PTR_ERR(ss->base); in sun4i_ss_probe()
365 ss->variant = of_device_get_match_data(&pdev->dev); in sun4i_ss_probe()
366 if (!ss->variant) { in sun4i_ss_probe()
371 ss->ssclk = devm_clk_get(&pdev->dev, "mod"); in sun4i_ss_probe()
372 if (IS_ERR(ss->ssclk)) { in sun4i_ss_probe()
373 err = PTR_ERR(ss->ssclk); in sun4i_ss_probe()
379 ss->busclk = devm_clk_get(&pdev->dev, "ahb"); in sun4i_ss_probe()
380 if (IS_ERR(ss->busclk)) { in sun4i_ss_probe()
381 err = PTR_ERR(ss->busclk); in sun4i_ss_probe()
387 ss->reset = devm_reset_control_get_optional(&pdev->dev, "ahb"); in sun4i_ss_probe()
388 if (IS_ERR(ss->reset)) in sun4i_ss_probe()
389 return PTR_ERR(ss->reset); in sun4i_ss_probe()
390 if (!ss->reset) in sun4i_ss_probe()
397 err = clk_set_rate(ss->ssclk, cr_mod); in sun4i_ss_probe()
408 cr = clk_get_rate(ss->busclk); in sun4i_ss_probe()
416 cr = clk_get_rate(ss->ssclk); in sun4i_ss_probe()
428 ss->dev = &pdev->dev; in sun4i_ss_probe()
429 platform_set_drvdata(pdev, ss); in sun4i_ss_probe()
431 spin_lock_init(&ss->slock); in sun4i_ss_probe()
433 err = sun4i_ss_pm_init(ss); in sun4i_ss_probe()
444 err = pm_runtime_resume_and_get(ss->dev); in sun4i_ss_probe()
448 writel(SS_ENABLED, ss->base + SS_CTL); in sun4i_ss_probe()
449 v = readl(ss->base + SS_CTL); in sun4i_ss_probe()
453 writel(0, ss->base + SS_CTL); in sun4i_ss_probe()
455 pm_runtime_put_sync(ss->dev); in sun4i_ss_probe()
458 ss_algs[i].ss = ss; in sun4i_ss_probe()
463 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
471 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
479 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
487 ss->dbgfs_dir = debugfs_create_dir("sun4i-ss", NULL); in sun4i_ss_probe()
488 ss->dbgfs_stats = debugfs_create_file("stats", 0444, ss->dbgfs_dir, ss, in sun4i_ss_probe()
508 sun4i_ss_pm_exit(ss); in sun4i_ss_probe()
515 struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev); in sun4i_ss_remove() local
531 sun4i_ss_pm_exit(ss); in sun4i_ss_remove()