Lines Matching refs:domain

318 	struct imx_pgc_domain *domain = to_imx_pgc_domain(genpd);  in imx_pgc_power_up()  local
322 ret = pm_runtime_get_sync(domain->dev); in imx_pgc_power_up()
324 pm_runtime_put_noidle(domain->dev); in imx_pgc_power_up()
328 if (!IS_ERR(domain->regulator)) { in imx_pgc_power_up()
329 ret = regulator_enable(domain->regulator); in imx_pgc_power_up()
331 dev_err(domain->dev, in imx_pgc_power_up()
338 reset_control_assert(domain->reset); in imx_pgc_power_up()
341 ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks); in imx_pgc_power_up()
343 dev_err(domain->dev, "failed to enable reset clocks\n"); in imx_pgc_power_up()
350 if (domain->bits.pxx) { in imx_pgc_power_up()
352 regmap_update_bits(domain->regmap, domain->regs->pup, in imx_pgc_power_up()
353 domain->bits.pxx, domain->bits.pxx); in imx_pgc_power_up()
358 ret = regmap_read_poll_timeout(domain->regmap, in imx_pgc_power_up()
359 domain->regs->pup, reg_val, in imx_pgc_power_up()
360 !(reg_val & domain->bits.pxx), in imx_pgc_power_up()
363 dev_err(domain->dev, "failed to command PGC\n"); in imx_pgc_power_up()
368 for_each_set_bit(pgc, &domain->pgc, 32) { in imx_pgc_power_up()
369 regmap_clear_bits(domain->regmap, GPC_PGC_CTRL(pgc), in imx_pgc_power_up()
377 reset_control_deassert(domain->reset); in imx_pgc_power_up()
380 if (domain->bits.hskreq) { in imx_pgc_power_up()
381 regmap_update_bits(domain->regmap, domain->regs->hsk, in imx_pgc_power_up()
382 domain->bits.hskreq, domain->bits.hskreq); in imx_pgc_power_up()
399 if (!domain->keep_clocks) in imx_pgc_power_up()
400 clk_bulk_disable_unprepare(domain->num_clks, domain->clks); in imx_pgc_power_up()
405 clk_bulk_disable_unprepare(domain->num_clks, domain->clks); in imx_pgc_power_up()
407 if (!IS_ERR(domain->regulator)) in imx_pgc_power_up()
408 regulator_disable(domain->regulator); in imx_pgc_power_up()
410 pm_runtime_put(domain->dev); in imx_pgc_power_up()
417 struct imx_pgc_domain *domain = to_imx_pgc_domain(genpd); in imx_pgc_power_down() local
422 if (!domain->keep_clocks) { in imx_pgc_power_down()
423 ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks); in imx_pgc_power_down()
425 dev_err(domain->dev, "failed to enable reset clocks\n"); in imx_pgc_power_down()
431 if (domain->bits.hskreq) { in imx_pgc_power_down()
432 regmap_clear_bits(domain->regmap, domain->regs->hsk, in imx_pgc_power_down()
433 domain->bits.hskreq); in imx_pgc_power_down()
435 ret = regmap_read_poll_timeout(domain->regmap, domain->regs->hsk, in imx_pgc_power_down()
437 !(reg_val & domain->bits.hskack), in imx_pgc_power_down()
440 dev_err(domain->dev, "failed to power down ADB400\n"); in imx_pgc_power_down()
445 if (domain->bits.pxx) { in imx_pgc_power_down()
447 for_each_set_bit(pgc, &domain->pgc, 32) { in imx_pgc_power_down()
448 regmap_update_bits(domain->regmap, GPC_PGC_CTRL(pgc), in imx_pgc_power_down()
453 regmap_update_bits(domain->regmap, domain->regs->pdn, in imx_pgc_power_down()
454 domain->bits.pxx, domain->bits.pxx); in imx_pgc_power_down()
459 ret = regmap_read_poll_timeout(domain->regmap, in imx_pgc_power_down()
460 domain->regs->pdn, reg_val, in imx_pgc_power_down()
461 !(reg_val & domain->bits.pxx), in imx_pgc_power_down()
464 dev_err(domain->dev, "failed to command PGC\n"); in imx_pgc_power_down()
470 clk_bulk_disable_unprepare(domain->num_clks, domain->clks); in imx_pgc_power_down()
472 if (!IS_ERR(domain->regulator)) { in imx_pgc_power_down()
473 ret = regulator_disable(domain->regulator); in imx_pgc_power_down()
475 dev_err(domain->dev, in imx_pgc_power_down()
482 pm_runtime_put_sync_suspend(domain->dev); in imx_pgc_power_down()
487 if (!domain->keep_clocks) in imx_pgc_power_down()
488 clk_bulk_disable_unprepare(domain->num_clks, domain->clks); in imx_pgc_power_down()
1315 struct imx_pgc_domain *domain = pdev->dev.platform_data; in imx_pgc_domain_probe() local
1318 domain->dev = &pdev->dev; in imx_pgc_domain_probe()
1320 domain->regulator = devm_regulator_get_optional(domain->dev, "power"); in imx_pgc_domain_probe()
1321 if (IS_ERR(domain->regulator)) { in imx_pgc_domain_probe()
1322 if (PTR_ERR(domain->regulator) != -ENODEV) in imx_pgc_domain_probe()
1323 return dev_err_probe(domain->dev, PTR_ERR(domain->regulator), in imx_pgc_domain_probe()
1325 } else if (domain->voltage) { in imx_pgc_domain_probe()
1326 regulator_set_voltage(domain->regulator, in imx_pgc_domain_probe()
1327 domain->voltage, domain->voltage); in imx_pgc_domain_probe()
1330 domain->num_clks = devm_clk_bulk_get_all(domain->dev, &domain->clks); in imx_pgc_domain_probe()
1331 if (domain->num_clks < 0) in imx_pgc_domain_probe()
1332 return dev_err_probe(domain->dev, domain->num_clks, in imx_pgc_domain_probe()
1335 domain->reset = devm_reset_control_array_get_optional_exclusive(domain->dev); in imx_pgc_domain_probe()
1336 if (IS_ERR(domain->reset)) in imx_pgc_domain_probe()
1337 return dev_err_probe(domain->dev, PTR_ERR(domain->reset), in imx_pgc_domain_probe()
1340 pm_runtime_enable(domain->dev); in imx_pgc_domain_probe()
1342 if (domain->bits.map) in imx_pgc_domain_probe()
1343 regmap_update_bits(domain->regmap, domain->regs->map, in imx_pgc_domain_probe()
1344 domain->bits.map, domain->bits.map); in imx_pgc_domain_probe()
1346 ret = pm_genpd_init(&domain->genpd, NULL, true); in imx_pgc_domain_probe()
1348 dev_err(domain->dev, "Failed to init power domain\n"); in imx_pgc_domain_probe()
1353 of_property_read_bool(domain->dev->of_node, "power-domains")) in imx_pgc_domain_probe()
1354 lockdep_set_subclass(&domain->genpd.mlock, 1); in imx_pgc_domain_probe()
1356 ret = of_genpd_add_provider_simple(domain->dev->of_node, in imx_pgc_domain_probe()
1357 &domain->genpd); in imx_pgc_domain_probe()
1359 dev_err(domain->dev, "Failed to add genpd provider\n"); in imx_pgc_domain_probe()
1366 pm_genpd_remove(&domain->genpd); in imx_pgc_domain_probe()
1368 if (domain->bits.map) in imx_pgc_domain_probe()
1369 regmap_update_bits(domain->regmap, domain->regs->map, in imx_pgc_domain_probe()
1370 domain->bits.map, 0); in imx_pgc_domain_probe()
1371 pm_runtime_disable(domain->dev); in imx_pgc_domain_probe()
1378 struct imx_pgc_domain *domain = pdev->dev.platform_data; in imx_pgc_domain_remove() local
1380 of_genpd_del_provider(domain->dev->of_node); in imx_pgc_domain_remove()
1381 pm_genpd_remove(&domain->genpd); in imx_pgc_domain_remove()
1383 if (domain->bits.map) in imx_pgc_domain_remove()
1384 regmap_update_bits(domain->regmap, domain->regs->map, in imx_pgc_domain_remove()
1385 domain->bits.map, 0); in imx_pgc_domain_remove()
1387 pm_runtime_disable(domain->dev); in imx_pgc_domain_remove()
1476 struct imx_pgc_domain *domain; in builtin_platform_driver() local
1513 domain = pd_pdev->dev.platform_data; in builtin_platform_driver()
1514 domain->regmap = regmap; in builtin_platform_driver()
1515 domain->regs = domain_data->pgc_regs; in builtin_platform_driver()
1517 domain->genpd.power_on = imx_pgc_power_up; in builtin_platform_driver()
1518 domain->genpd.power_off = imx_pgc_power_down; in builtin_platform_driver()