Lines Matching +full:sc7180 +full:- +full:mss

1 // SPDX-License-Identifier: GPL-2.0
14 #include <soc/qcom/cmd-db.h>
16 #include <dt-bindings/power/qcom-rpmpd.h>
17 #include <dt-bindings/power/qcom,rpmhpd.h>
24 * struct rpmhpd - top level RPMh power domain resource data structure
33 * @enable_corner: lowest non-zero corner
35 * derived from cmd-db
37 * being 16 (0 - 15)
39 * @res_name: Resource name used for cmd-db lookup
41 * cmd-db
154 static struct rpmhpd mss = { variable
155 .pd = { .name = "mss", },
156 .res_name = "mss.lvl",
258 [SDM670_MSS] = &mss,
276 [SDM845_MSS] = &mss,
289 [SDX55_MSS] = &mss,
302 [SDX65_MSS] = &mss,
317 [RPMHPD_MSS] = &mss,
334 [SM6350_MSS] = &mss,
353 [SM8150_MSS] = &mss,
368 [SA8155P_MSS] = &mss,
407 [RPMHPD_MSS] = &mss,
429 [RPMHPD_MSS] = &mss,
451 [RPMHPD_MSS] = &mss,
468 [QDU1000_MSS] = &mss,
477 /* SC7180 RPMH powerdomains */
484 [SC7180_MSS] = &mss,
502 [SC7280_MSS] = &mss,
522 [SC8180X_MSS] = &mss,
554 { .compatible = "qcom,qdu1000-rpmhpd", .data = &qdu1000_desc },
555 { .compatible = "qcom,sa8155p-rpmhpd", .data = &sa8155p_desc },
556 { .compatible = "qcom,sa8540p-rpmhpd", .data = &sa8540p_desc },
557 { .compatible = "qcom,sa8775p-rpmhpd", .data = &sa8775p_desc },
558 { .compatible = "qcom,sc7180-rpmhpd", .data = &sc7180_desc },
559 { .compatible = "qcom,sc7280-rpmhpd", .data = &sc7280_desc },
560 { .compatible = "qcom,sc8180x-rpmhpd", .data = &sc8180x_desc },
561 { .compatible = "qcom,sc8280xp-rpmhpd", .data = &sc8280xp_desc },
562 { .compatible = "qcom,sdm670-rpmhpd", .data = &sdm670_desc },
563 { .compatible = "qcom,sdm845-rpmhpd", .data = &sdm845_desc },
564 { .compatible = "qcom,sdx55-rpmhpd", .data = &sdx55_desc},
565 { .compatible = "qcom,sdx65-rpmhpd", .data = &sdx65_desc},
566 { .compatible = "qcom,sdx75-rpmhpd", .data = &sdx75_desc},
567 { .compatible = "qcom,sm6350-rpmhpd", .data = &sm6350_desc },
568 { .compatible = "qcom,sm8150-rpmhpd", .data = &sm8150_desc },
569 { .compatible = "qcom,sm8250-rpmhpd", .data = &sm8250_desc },
570 { .compatible = "qcom,sm8350-rpmhpd", .data = &sm8350_desc },
571 { .compatible = "qcom,sm8450-rpmhpd", .data = &sm8450_desc },
572 { .compatible = "qcom,sm8550-rpmhpd", .data = &sm8550_desc },
581 .addr = pd->addr, in rpmhpd_send_corner()
590 return rpmh_write(pd->dev, state, &cmd, 1); in rpmhpd_send_corner()
592 return rpmh_write_async(pd->dev, state, &cmd, 1); in rpmhpd_send_corner()
600 if (pd->active_only) in to_active_sleep()
618 struct rpmhpd *peer = pd->peer; in rpmhpd_aggregate_corner()
624 if (pd->state_synced) { in rpmhpd_aggregate_corner()
628 this_active_corner = pd->level_count - 1; in rpmhpd_aggregate_corner()
629 this_sleep_corner = pd->level_count - 1; in rpmhpd_aggregate_corner()
632 if (peer && peer->enabled) { in rpmhpd_aggregate_corner()
633 peer_enabled_corner = max(peer->corner, peer->enable_corner); in rpmhpd_aggregate_corner()
641 active_corner > pd->active_corner); in rpmhpd_aggregate_corner()
645 pd->active_corner = active_corner; in rpmhpd_aggregate_corner()
648 peer->active_corner = active_corner; in rpmhpd_aggregate_corner()
672 corner = max(pd->corner, pd->enable_corner); in rpmhpd_power_on()
675 pd->enabled = true; in rpmhpd_power_on()
691 pd->enabled = false; in rpmhpd_power_off()
706 for (i = 0; i < pd->level_count; i++) in rpmhpd_set_performance_state()
707 if (level <= pd->level[i]) in rpmhpd_set_performance_state()
714 if (i == pd->level_count) in rpmhpd_set_performance_state()
715 i--; in rpmhpd_set_performance_state()
717 if (pd->enabled) { in rpmhpd_set_performance_state()
719 if (i < pd->enable_corner) in rpmhpd_set_performance_state()
720 i = pd->enable_corner; in rpmhpd_set_performance_state()
727 pd->corner = i; in rpmhpd_set_performance_state()
745 buf = cmd_db_read_aux_data(rpmhpd->res_name, &rpmhpd->level_count); in rpmhpd_update_level_mapping()
750 rpmhpd->level_count >>= 1; in rpmhpd_update_level_mapping()
752 if (rpmhpd->level_count > RPMH_ARC_MAX_LEVELS) in rpmhpd_update_level_mapping()
753 return -EINVAL; in rpmhpd_update_level_mapping()
755 for (i = 0; i < rpmhpd->level_count; i++) { in rpmhpd_update_level_mapping()
756 if (rpmhpd->skip_retention_level && buf[i] == RPMH_REGULATOR_LEVEL_RETENTION) in rpmhpd_update_level_mapping()
759 rpmhpd->level[i] = buf[i]; in rpmhpd_update_level_mapping()
761 /* Remember the first corner with non-zero level */ in rpmhpd_update_level_mapping()
762 if (!rpmhpd->level[rpmhpd->enable_corner] && rpmhpd->level[i]) in rpmhpd_update_level_mapping()
763 rpmhpd->enable_corner = i; in rpmhpd_update_level_mapping()
769 if (i > 0 && rpmhpd->level[i] == 0) { in rpmhpd_update_level_mapping()
770 rpmhpd->level_count = i; in rpmhpd_update_level_mapping()
773 pr_debug("%s: ARC hlvl=%2d --> vlvl=%4u\n", rpmhpd->res_name, i, in rpmhpd_update_level_mapping()
774 rpmhpd->level[i]); in rpmhpd_update_level_mapping()
784 struct device *dev = &pdev->dev; in rpmhpd_probe()
791 return -EINVAL; in rpmhpd_probe()
793 rpmhpds = desc->rpmhpds; in rpmhpd_probe()
794 num_pds = desc->num_pds; in rpmhpd_probe()
798 return -ENOMEM; in rpmhpd_probe()
800 data->domains = devm_kcalloc(dev, num_pds, sizeof(*data->domains), in rpmhpd_probe()
802 if (!data->domains) in rpmhpd_probe()
803 return -ENOMEM; in rpmhpd_probe()
805 data->num_domains = num_pds; in rpmhpd_probe()
811 rpmhpds[i]->dev = dev; in rpmhpd_probe()
812 rpmhpds[i]->addr = cmd_db_read_addr(rpmhpds[i]->res_name); in rpmhpd_probe()
813 if (!rpmhpds[i]->addr) { in rpmhpd_probe()
815 rpmhpds[i]->res_name); in rpmhpd_probe()
816 return -ENODEV; in rpmhpd_probe()
819 ret = cmd_db_read_slave_id(rpmhpds[i]->res_name); in rpmhpd_probe()
822 return -EINVAL; in rpmhpd_probe()
829 rpmhpds[i]->pd.power_off = rpmhpd_power_off; in rpmhpd_probe()
830 rpmhpds[i]->pd.power_on = rpmhpd_power_on; in rpmhpd_probe()
831 rpmhpds[i]->pd.set_performance_state = rpmhpd_set_performance_state; in rpmhpd_probe()
832 rpmhpds[i]->pd.opp_to_performance_state = rpmhpd_get_performance_state; in rpmhpd_probe()
833 pm_genpd_init(&rpmhpds[i]->pd, NULL, true); in rpmhpd_probe()
835 data->domains[i] = &rpmhpds[i]->pd; in rpmhpd_probe()
842 if (rpmhpds[i]->parent) in rpmhpd_probe()
843 pm_genpd_add_subdomain(rpmhpds[i]->parent, in rpmhpd_probe()
844 &rpmhpds[i]->pd); in rpmhpd_probe()
847 return of_genpd_add_provider_onecell(pdev->dev.of_node, data); in rpmhpd_probe()
853 struct rpmhpd **rpmhpds = desc->rpmhpds; in rpmhpd_sync_state()
860 for (i = 0; i < desc->num_pds; i++) { in rpmhpd_sync_state()
865 pd->state_synced = true; in rpmhpd_sync_state()
866 if (pd->enabled) in rpmhpd_sync_state()
867 corner = max(pd->corner, pd->enable_corner); in rpmhpd_sync_state()
873 dev_err(dev, "failed to sync %s\n", pd->res_name); in rpmhpd_sync_state()
880 .name = "qcom-rpmhpd",