• Home
  • Raw
  • Download

Lines Matching refs:pmu

71 	struct rockchip_pmu *pmu;  member
144 struct rockchip_pmu *pmu = pd->pmu; in rockchip_pmu_domain_is_idle() local
148 regmap_read(pmu->regmap, pmu->info->idle_offset, &val); in rockchip_pmu_domain_is_idle()
152 static unsigned int rockchip_pmu_read_ack(struct rockchip_pmu *pmu) in rockchip_pmu_read_ack() argument
156 regmap_read(pmu->regmap, pmu->info->ack_offset, &val); in rockchip_pmu_read_ack()
165 struct rockchip_pmu *pmu = pd->pmu; in rockchip_pmu_set_idle_request() local
174 regmap_write(pmu->regmap, pmu->info->req_offset, in rockchip_pmu_set_idle_request()
178 regmap_update_bits(pmu->regmap, pmu->info->req_offset, in rockchip_pmu_set_idle_request()
185 ret = readx_poll_timeout_atomic(rockchip_pmu_read_ack, pmu, val, in rockchip_pmu_set_idle_request()
189 dev_err(pmu->dev, in rockchip_pmu_set_idle_request()
198 dev_err(pmu->dev, in rockchip_pmu_set_idle_request()
258 struct rockchip_pmu *pmu = pd->pmu; in rockchip_pmu_domain_is_on() local
265 regmap_read(pmu->regmap, pmu->info->status_offset, &val); in rockchip_pmu_domain_is_on()
274 struct rockchip_pmu *pmu = pd->pmu; in rockchip_do_pmu_set_power_domain() local
281 regmap_write(pmu->regmap, pmu->info->pwr_offset, in rockchip_do_pmu_set_power_domain()
285 regmap_update_bits(pmu->regmap, pmu->info->pwr_offset, in rockchip_do_pmu_set_power_domain()
292 dev_err(pmu->dev, in rockchip_do_pmu_set_power_domain()
301 struct rockchip_pmu *pmu = pd->pmu; in rockchip_pd_power() local
304 mutex_lock(&pmu->mutex); in rockchip_pd_power()
309 dev_err(pmu->dev, "failed to enable clocks\n"); in rockchip_pd_power()
310 mutex_unlock(&pmu->mutex); in rockchip_pd_power()
333 mutex_unlock(&pmu->mutex); in rockchip_pd_power()
389 static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, in rockchip_pm_add_one_domain() argument
401 dev_err(pmu->dev, in rockchip_pm_add_one_domain()
407 if (id >= pmu->info->num_domains) { in rockchip_pm_add_one_domain()
408 dev_err(pmu->dev, "%pOFn: invalid domain id %d\n", in rockchip_pm_add_one_domain()
413 pd_info = &pmu->info->domain_info[id]; in rockchip_pm_add_one_domain()
415 dev_err(pmu->dev, "%pOFn: undefined domain id %d\n", in rockchip_pm_add_one_domain()
420 pd = devm_kzalloc(pmu->dev, sizeof(*pd), GFP_KERNEL); in rockchip_pm_add_one_domain()
425 pd->pmu = pmu; in rockchip_pm_add_one_domain()
429 pd->clks = devm_kcalloc(pmu->dev, pd->num_clks, in rockchip_pm_add_one_domain()
434 dev_dbg(pmu->dev, "%pOFn: doesn't have clocks: %d\n", in rockchip_pm_add_one_domain()
443 dev_err(pmu->dev, in rockchip_pm_add_one_domain()
458 pd->qos_regmap = devm_kcalloc(pmu->dev, pd->num_qos, in rockchip_pm_add_one_domain()
467 pd->qos_save_regs[j] = devm_kcalloc(pmu->dev, in rockchip_pm_add_one_domain()
495 dev_err(pmu->dev, in rockchip_pm_add_one_domain()
514 pmu->genpd_data.domains[id] = &pd->genpd; in rockchip_pm_add_one_domain()
534 dev_err(pd->pmu->dev, "failed to remove domain '%s' : %d - state may be inconsistent\n", in rockchip_pm_remove_one_domain()
541 mutex_lock(&pd->pmu->mutex); in rockchip_pm_remove_one_domain()
543 mutex_unlock(&pd->pmu->mutex); in rockchip_pm_remove_one_domain()
548 static void rockchip_pm_domain_cleanup(struct rockchip_pmu *pmu) in rockchip_pm_domain_cleanup() argument
554 for (i = 0; i < pmu->genpd_data.num_domains; i++) { in rockchip_pm_domain_cleanup()
555 genpd = pmu->genpd_data.domains[i]; in rockchip_pm_domain_cleanup()
565 static void rockchip_configure_pd_cnt(struct rockchip_pmu *pmu, in rockchip_configure_pd_cnt() argument
570 regmap_write(pmu->regmap, domain_reg_offset, count); in rockchip_configure_pd_cnt()
572 regmap_write(pmu->regmap, domain_reg_offset + 4, count); in rockchip_configure_pd_cnt()
575 static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu, in rockchip_pm_add_subdomain() argument
587 dev_err(pmu->dev, in rockchip_pm_add_subdomain()
592 parent_domain = pmu->genpd_data.domains[idx]; in rockchip_pm_add_subdomain()
594 error = rockchip_pm_add_one_domain(pmu, np); in rockchip_pm_add_subdomain()
596 dev_err(pmu->dev, "failed to handle node %pOFn: %d\n", in rockchip_pm_add_subdomain()
603 dev_err(pmu->dev, in rockchip_pm_add_subdomain()
608 child_domain = pmu->genpd_data.domains[idx]; in rockchip_pm_add_subdomain()
612 dev_err(pmu->dev, "%s failed to add subdomain %s: %d\n", in rockchip_pm_add_subdomain()
616 dev_dbg(pmu->dev, "%s add subdomain: %s\n", in rockchip_pm_add_subdomain()
620 rockchip_pm_add_subdomain(pmu, np); in rockchip_pm_add_subdomain()
636 struct rockchip_pmu *pmu; in rockchip_pm_domain_probe() local
654 pmu = devm_kzalloc(dev, in rockchip_pm_domain_probe()
655 struct_size(pmu, domains, pmu_info->num_domains), in rockchip_pm_domain_probe()
657 if (!pmu) in rockchip_pm_domain_probe()
660 pmu->dev = &pdev->dev; in rockchip_pm_domain_probe()
661 mutex_init(&pmu->mutex); in rockchip_pm_domain_probe()
663 pmu->info = pmu_info; in rockchip_pm_domain_probe()
665 pmu->genpd_data.domains = pmu->domains; in rockchip_pm_domain_probe()
666 pmu->genpd_data.num_domains = pmu_info->num_domains; in rockchip_pm_domain_probe()
674 pmu->regmap = syscon_node_to_regmap(parent->of_node); in rockchip_pm_domain_probe()
675 if (IS_ERR(pmu->regmap)) { in rockchip_pm_domain_probe()
677 return PTR_ERR(pmu->regmap); in rockchip_pm_domain_probe()
685 rockchip_configure_pd_cnt(pmu, pmu_info->core_pwrcnt_offset, in rockchip_pm_domain_probe()
688 rockchip_configure_pd_cnt(pmu, pmu_info->gpu_pwrcnt_offset, in rockchip_pm_domain_probe()
694 error = rockchip_pm_add_one_domain(pmu, node); in rockchip_pm_domain_probe()
702 error = rockchip_pm_add_subdomain(pmu, node); in rockchip_pm_domain_probe()
716 error = of_genpd_add_provider_onecell(np, &pmu->genpd_data); in rockchip_pm_domain_probe()
725 rockchip_pm_domain_cleanup(pmu); in rockchip_pm_domain_probe()