Lines Matching refs:ss
243 if (!ss_algs[i].ss) in sun4i_ss_dbgfs_read()
289 struct sun4i_ss_ctx *ss = dev_get_drvdata(dev); in sun4i_ss_pm_suspend() local
291 reset_control_assert(ss->reset); in sun4i_ss_pm_suspend()
293 clk_disable_unprepare(ss->ssclk); in sun4i_ss_pm_suspend()
294 clk_disable_unprepare(ss->busclk); in sun4i_ss_pm_suspend()
300 struct sun4i_ss_ctx *ss = dev_get_drvdata(dev); in sun4i_ss_pm_resume() local
304 err = clk_prepare_enable(ss->busclk); in sun4i_ss_pm_resume()
306 dev_err(ss->dev, "Cannot prepare_enable busclk\n"); in sun4i_ss_pm_resume()
310 err = clk_prepare_enable(ss->ssclk); in sun4i_ss_pm_resume()
312 dev_err(ss->dev, "Cannot prepare_enable ssclk\n"); in sun4i_ss_pm_resume()
316 err = reset_control_deassert(ss->reset); in sun4i_ss_pm_resume()
318 dev_err(ss->dev, "Cannot deassert reset control\n"); in sun4i_ss_pm_resume()
337 static int sun4i_ss_pm_init(struct sun4i_ss_ctx *ss) in sun4i_ss_pm_init() argument
341 pm_runtime_use_autosuspend(ss->dev); in sun4i_ss_pm_init()
342 pm_runtime_set_autosuspend_delay(ss->dev, 2000); in sun4i_ss_pm_init()
344 err = pm_runtime_set_suspended(ss->dev); in sun4i_ss_pm_init()
347 pm_runtime_enable(ss->dev); in sun4i_ss_pm_init()
351 static void sun4i_ss_pm_exit(struct sun4i_ss_ctx *ss) in sun4i_ss_pm_exit() argument
353 pm_runtime_disable(ss->dev); in sun4i_ss_pm_exit()
363 struct sun4i_ss_ctx *ss; in sun4i_ss_probe() local
368 ss = devm_kzalloc(&pdev->dev, sizeof(*ss), GFP_KERNEL); in sun4i_ss_probe()
369 if (!ss) in sun4i_ss_probe()
372 ss->base = devm_platform_ioremap_resource(pdev, 0); in sun4i_ss_probe()
373 if (IS_ERR(ss->base)) { in sun4i_ss_probe()
375 return PTR_ERR(ss->base); in sun4i_ss_probe()
378 ss->variant = of_device_get_match_data(&pdev->dev); in sun4i_ss_probe()
379 if (!ss->variant) { in sun4i_ss_probe()
384 ss->ssclk = devm_clk_get(&pdev->dev, "mod"); in sun4i_ss_probe()
385 if (IS_ERR(ss->ssclk)) { in sun4i_ss_probe()
386 err = PTR_ERR(ss->ssclk); in sun4i_ss_probe()
392 ss->busclk = devm_clk_get(&pdev->dev, "ahb"); in sun4i_ss_probe()
393 if (IS_ERR(ss->busclk)) { in sun4i_ss_probe()
394 err = PTR_ERR(ss->busclk); in sun4i_ss_probe()
400 ss->reset = devm_reset_control_get_optional(&pdev->dev, "ahb"); in sun4i_ss_probe()
401 if (IS_ERR(ss->reset)) in sun4i_ss_probe()
402 return PTR_ERR(ss->reset); in sun4i_ss_probe()
403 if (!ss->reset) in sun4i_ss_probe()
410 err = clk_set_rate(ss->ssclk, cr_mod); in sun4i_ss_probe()
421 cr = clk_get_rate(ss->busclk); in sun4i_ss_probe()
429 cr = clk_get_rate(ss->ssclk); in sun4i_ss_probe()
441 ss->dev = &pdev->dev; in sun4i_ss_probe()
442 platform_set_drvdata(pdev, ss); in sun4i_ss_probe()
444 spin_lock_init(&ss->slock); in sun4i_ss_probe()
446 err = sun4i_ss_pm_init(ss); in sun4i_ss_probe()
457 err = pm_runtime_resume_and_get(ss->dev); in sun4i_ss_probe()
461 writel(SS_ENABLED, ss->base + SS_CTL); in sun4i_ss_probe()
462 v = readl(ss->base + SS_CTL); in sun4i_ss_probe()
466 writel(0, ss->base + SS_CTL); in sun4i_ss_probe()
468 pm_runtime_put_sync(ss->dev); in sun4i_ss_probe()
471 ss_algs[i].ss = ss; in sun4i_ss_probe()
476 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
484 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
492 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
500 ss->dbgfs_dir = debugfs_create_dir("sun4i-ss", NULL); in sun4i_ss_probe()
501 ss->dbgfs_stats = debugfs_create_file("stats", 0444, ss->dbgfs_dir, ss, in sun4i_ss_probe()
521 sun4i_ss_pm_exit(ss); in sun4i_ss_probe()
528 struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev); in sun4i_ss_remove() local
544 sun4i_ss_pm_exit(ss); in sun4i_ss_remove()