Lines Matching +full:auto +full:- +full:pm

1 // SPDX-License-Identifier: GPL-2.0
4 * Copyright 2016-2022 HabanaLabs, Ltd.
12 struct goya_device *goya = hdev->asic_specific; in goya_set_pll_profile()
14 if (!hdev->pdev) in goya_set_pll_profile()
19 hl_fw_set_frequency(hdev, HL_GOYA_MME_PLL, hdev->high_pll); in goya_set_pll_profile()
20 hl_fw_set_frequency(hdev, HL_GOYA_TPC_PLL, hdev->high_pll); in goya_set_pll_profile()
21 hl_fw_set_frequency(hdev, HL_GOYA_IC_PLL, hdev->high_pll); in goya_set_pll_profile()
29 hl_fw_set_frequency(hdev, HL_GOYA_MME_PLL, goya->mme_clk); in goya_set_pll_profile()
30 hl_fw_set_frequency(hdev, HL_GOYA_TPC_PLL, goya->tpc_clk); in goya_set_pll_profile()
31 hl_fw_set_frequency(hdev, HL_GOYA_IC_PLL, goya->ic_clk); in goya_set_pll_profile()
34 dev_err(hdev->dev, "unknown frequency setting\n"); in goya_set_pll_profile()
45 return -ENODEV; in mme_clk_show()
59 struct goya_device *goya = hdev->asic_specific; in mme_clk_store()
64 count = -ENODEV; in mme_clk_store()
68 if (goya->pm_mng_profile == PM_AUTO) { in mme_clk_store()
69 count = -EPERM; in mme_clk_store()
76 count = -EINVAL; in mme_clk_store()
81 goya->mme_clk = value; in mme_clk_store()
94 return -ENODEV; in tpc_clk_show()
108 struct goya_device *goya = hdev->asic_specific; in tpc_clk_store()
113 count = -ENODEV; in tpc_clk_store()
117 if (goya->pm_mng_profile == PM_AUTO) { in tpc_clk_store()
118 count = -EPERM; in tpc_clk_store()
125 count = -EINVAL; in tpc_clk_store()
130 goya->tpc_clk = value; in tpc_clk_store()
143 return -ENODEV; in ic_clk_show()
157 struct goya_device *goya = hdev->asic_specific; in ic_clk_store()
162 count = -ENODEV; in ic_clk_store()
166 if (goya->pm_mng_profile == PM_AUTO) { in ic_clk_store()
167 count = -EPERM; in ic_clk_store()
174 count = -EINVAL; in ic_clk_store()
179 goya->ic_clk = value; in ic_clk_store()
192 return -ENODEV; in mme_clk_curr_show()
209 return -ENODEV; in tpc_clk_curr_show()
226 return -ENODEV; in ic_clk_curr_show()
240 struct goya_device *goya = hdev->asic_specific; in pm_mng_profile_show()
243 return -ENODEV; in pm_mng_profile_show()
246 (goya->pm_mng_profile == PM_AUTO) ? "auto" : in pm_mng_profile_show()
247 (goya->pm_mng_profile == PM_MANUAL) ? "manual" : in pm_mng_profile_show()
255 struct goya_device *goya = hdev->asic_specific; in pm_mng_profile_store()
258 count = -ENODEV; in pm_mng_profile_store()
262 mutex_lock(&hdev->fpriv_list_lock); in pm_mng_profile_store()
264 if (hdev->is_compute_ctx_active) { in pm_mng_profile_store()
265 dev_err(hdev->dev, in pm_mng_profile_store()
266 "Can't change PM profile while compute context is opened on the device\n"); in pm_mng_profile_store()
267 count = -EPERM; in pm_mng_profile_store()
271 if (strncmp("auto", buf, strlen("auto")) == 0) { in pm_mng_profile_store()
273 if (goya->pm_mng_profile == PM_MANUAL) { in pm_mng_profile_store()
274 goya->curr_pll_profile = PLL_HIGH; in pm_mng_profile_store()
275 goya->pm_mng_profile = PM_AUTO; in pm_mng_profile_store()
279 if (goya->pm_mng_profile == PM_AUTO) { in pm_mng_profile_store()
285 goya->pm_mng_profile = PM_MANUAL; in pm_mng_profile_store()
287 mutex_unlock(&hdev->fpriv_list_lock); in pm_mng_profile_store()
292 if (goya->goya_work) in pm_mng_profile_store()
293 flush_delayed_work(&goya->goya_work->work_freq); in pm_mng_profile_store()
298 dev_err(hdev->dev, "value should be auto or manual\n"); in pm_mng_profile_store()
299 count = -EINVAL; in pm_mng_profile_store()
303 mutex_unlock(&hdev->fpriv_list_lock); in pm_mng_profile_store()
314 return -ENODEV; in high_pll_show()
316 return sprintf(buf, "%u\n", hdev->high_pll); in high_pll_show()
327 count = -ENODEV; in high_pll_store()
334 count = -EINVAL; in high_pll_store()
338 hdev->high_pll = value; in high_pll_store()
370 cpucp_info = &hdev->asic_prop.cpucp_info; in infineon_ver_show()
372 return sprintf(buf, "%#04x\n", le32_to_cpu(cpucp_info->infineon_version)); in infineon_ver_show()
385 dev_clk_attr_grp->attrs = goya_clk_dev_attrs; in goya_add_device_attr()
386 dev_vrm_attr_grp->attrs = goya_vrm_dev_attrs; in goya_add_device_attr()