Lines Matching +full:rpmcc +full:- +full:msm8974

1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/clk-provider.h>
17 #include <linux/soc/qcom/smd-rpm.h>
19 #include <dt-bindings/clock/qcom,rpmcc.h>
164 .key = cpu_to_le32(r->rpm_key), in clk_smd_rpm_handoff()
166 .value = cpu_to_le32(r->branch ? 1 : INT_MAX), in clk_smd_rpm_handoff()
169 ret = qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_ACTIVE_STATE, in clk_smd_rpm_handoff()
170 r->rpm_res_type, r->rpm_clk_id, &req, in clk_smd_rpm_handoff()
174 ret = qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_SLEEP_STATE, in clk_smd_rpm_handoff()
175 r->rpm_res_type, r->rpm_clk_id, &req, in clk_smd_rpm_handoff()
187 .key = cpu_to_le32(r->rpm_key), in clk_smd_rpm_set_rate_active()
192 return qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_ACTIVE_STATE, in clk_smd_rpm_set_rate_active()
193 r->rpm_res_type, r->rpm_clk_id, &req, in clk_smd_rpm_set_rate_active()
201 .key = cpu_to_le32(r->rpm_key), in clk_smd_rpm_set_rate_sleep()
206 return qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_SLEEP_STATE, in clk_smd_rpm_set_rate_sleep()
207 r->rpm_res_type, r->rpm_clk_id, &req, in clk_smd_rpm_set_rate_sleep()
217 * Active-only clocks don't care what the rate is during sleep. So, in to_active_sleep()
220 if (r->active_only) in to_active_sleep()
229 struct clk_smd_rpm *peer = r->peer; in clk_smd_rpm_prepare()
238 if (!r->rate) in clk_smd_rpm_prepare()
241 to_active_sleep(r, r->rate, &this_rate, &this_sleep_rate); in clk_smd_rpm_prepare()
244 if (peer->enabled) in clk_smd_rpm_prepare()
245 to_active_sleep(peer, peer->rate, in clk_smd_rpm_prepare()
250 if (r->branch) in clk_smd_rpm_prepare()
258 if (r->branch) in clk_smd_rpm_prepare()
268 r->enabled = true; in clk_smd_rpm_prepare()
278 struct clk_smd_rpm *peer = r->peer; in clk_smd_rpm_unprepare()
285 if (!r->rate) in clk_smd_rpm_unprepare()
289 if (peer->enabled) in clk_smd_rpm_unprepare()
290 to_active_sleep(peer, peer->rate, &peer_rate, in clk_smd_rpm_unprepare()
293 active_rate = r->branch ? !!peer_rate : peer_rate; in clk_smd_rpm_unprepare()
298 sleep_rate = r->branch ? !!peer_sleep_rate : peer_sleep_rate; in clk_smd_rpm_unprepare()
303 r->enabled = false; in clk_smd_rpm_unprepare()
313 struct clk_smd_rpm *peer = r->peer; in clk_smd_rpm_set_rate()
321 if (!r->enabled) in clk_smd_rpm_set_rate()
327 if (peer->enabled) in clk_smd_rpm_set_rate()
328 to_active_sleep(peer, peer->rate, in clk_smd_rpm_set_rate()
341 r->rate = rate; in clk_smd_rpm_set_rate()
370 return r->rate; in clk_smd_rpm_recalc_rate()
533 DEFINE_CLK_SMD_RPM(msm8974, cnoc_clk, cnoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 2);
534 DEFINE_CLK_SMD_RPM(msm8974, mmssnoc_ahb_clk, mmssnoc_ahb_a_clk, QCOM_SMD_RPM_BUS_CLK, 3);
535 DEFINE_CLK_SMD_RPM(msm8974, gfx3d_clk_src, gfx3d_a_clk_src, QCOM_SMD_RPM_MEM_CLK, 1);
536 DEFINE_CLK_SMD_RPM(msm8974, ocmemgx_clk, ocmemgx_a_clk, QCOM_SMD_RPM_MEM_CLK, 2);
537 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_d0, cxo_d0_a, 1, 19200000);
538 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_d1, cxo_d1_a, 2, 19200000);
539 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_a0, cxo_a0_a, 4, 19200000);
540 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_a1, cxo_a1_a, 5, 19200000);
541 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_a2, cxo_a2_a, 6, 19200000);
542 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, diff_clk, diff_a_clk, 7, 19200000);
543 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, div_clk1, div_a_clk1, 11, 19200000);
544 DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, div_clk2, div_a_clk2, 12, 19200000);
545 DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_d0_pin, cxo_d0_a_pin, 1, 19200000);
546 DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_d1_pin, cxo_d1_a_pin, 2, 19200000);
547 DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_a0_pin, cxo_a0_a_pin, 4, 19200000);
548 DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_a1_pin, cxo_a1_a_pin, 5, 19200000);
549 DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_a2_pin, cxo_a2_a_pin, 6, 19200000);
1222 { .compatible = "qcom,rpmcc-mdm9607", .data = &rpm_clk_mdm9607 },
1223 { .compatible = "qcom,rpmcc-msm8226", .data = &rpm_clk_msm8974 },
1224 { .compatible = "qcom,rpmcc-msm8909", .data = &rpm_clk_msm8909 },
1225 { .compatible = "qcom,rpmcc-msm8916", .data = &rpm_clk_msm8916 },
1226 { .compatible = "qcom,rpmcc-msm8936", .data = &rpm_clk_msm8936 },
1227 { .compatible = "qcom,rpmcc-msm8953", .data = &rpm_clk_msm8953 },
1228 { .compatible = "qcom,rpmcc-msm8974", .data = &rpm_clk_msm8974 },
1229 { .compatible = "qcom,rpmcc-msm8976", .data = &rpm_clk_msm8976 },
1230 { .compatible = "qcom,rpmcc-msm8992", .data = &rpm_clk_msm8992 },
1231 { .compatible = "qcom,rpmcc-msm8994", .data = &rpm_clk_msm8994 },
1232 { .compatible = "qcom,rpmcc-msm8996", .data = &rpm_clk_msm8996 },
1233 { .compatible = "qcom,rpmcc-msm8998", .data = &rpm_clk_msm8998 },
1234 { .compatible = "qcom,rpmcc-qcm2290", .data = &rpm_clk_qcm2290 },
1235 { .compatible = "qcom,rpmcc-qcs404", .data = &rpm_clk_qcs404 },
1236 { .compatible = "qcom,rpmcc-sdm660", .data = &rpm_clk_sdm660 },
1237 { .compatible = "qcom,rpmcc-sm6115", .data = &rpm_clk_sm6115 },
1238 { .compatible = "qcom,rpmcc-sm6125", .data = &rpm_clk_sm6125 },
1239 { .compatible = "qcom,rpmcc-sm6375", .data = &rpm_clk_sm6375 },
1248 unsigned int idx = clkspec->args[0]; in qcom_smdrpm_clk_hw_get()
1250 if (idx >= desc->num_clks) { in qcom_smdrpm_clk_hw_get()
1252 return ERR_PTR(-EINVAL); in qcom_smdrpm_clk_hw_get()
1255 return desc->clks[idx] ? &desc->clks[idx]->hw : ERR_PTR(-ENOENT); in qcom_smdrpm_clk_hw_get()
1266 rpm = dev_get_drvdata(pdev->dev.parent); in rpm_smd_clk_probe()
1268 dev_err(&pdev->dev, "Unable to retrieve handle to RPM\n"); in rpm_smd_clk_probe()
1269 return -ENODEV; in rpm_smd_clk_probe()
1272 desc = of_device_get_match_data(&pdev->dev); in rpm_smd_clk_probe()
1274 return -EINVAL; in rpm_smd_clk_probe()
1276 rpm_smd_clks = desc->clks; in rpm_smd_clk_probe()
1277 num_clks = desc->num_clks; in rpm_smd_clk_probe()
1283 rpm_smd_clks[i]->rpm = rpm; in rpm_smd_clk_probe()
1298 ret = devm_clk_hw_register(&pdev->dev, &rpm_smd_clks[i]->hw); in rpm_smd_clk_probe()
1303 ret = devm_of_clk_add_hw_provider(&pdev->dev, qcom_smdrpm_clk_hw_get, in rpm_smd_clk_probe()
1310 dev_err(&pdev->dev, "Error registering SMD clock driver (%d)\n", ret); in rpm_smd_clk_probe()
1316 .name = "qcom-clk-smd-rpm",
1336 MODULE_ALIAS("platform:qcom-clk-smd-rpm");