Lines Matching refs:hdev
12 long hl_get_frequency(struct hl_device *hdev, u32 pll_index, bool curr) in hl_get_frequency() argument
28 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_get_frequency()
32 dev_err(hdev->dev, in hl_get_frequency()
41 void hl_set_frequency(struct hl_device *hdev, u32 pll_index, u64 freq) in hl_set_frequency() argument
53 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_set_frequency()
57 dev_err(hdev->dev, in hl_set_frequency()
62 u64 hl_get_max_power(struct hl_device *hdev) in hl_get_max_power() argument
73 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_get_max_power()
77 dev_err(hdev->dev, "Failed to get max power, error %d\n", rc); in hl_get_max_power()
84 void hl_set_max_power(struct hl_device *hdev) in hl_set_max_power() argument
93 pkt.value = cpu_to_le64(hdev->max_power); in hl_set_max_power()
95 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_set_max_power()
99 dev_err(hdev->dev, "Failed to set max power, error %d\n", rc); in hl_set_max_power()
105 struct hl_device *hdev = dev_get_drvdata(dev); in uboot_ver_show() local
107 return sprintf(buf, "%s\n", hdev->asic_prop.uboot_ver); in uboot_ver_show()
113 struct hl_device *hdev = dev_get_drvdata(dev); in armcp_kernel_ver_show() local
115 return sprintf(buf, "%s", hdev->asic_prop.cpucp_info.kernel_version); in armcp_kernel_ver_show()
121 struct hl_device *hdev = dev_get_drvdata(dev); in armcp_ver_show() local
123 return sprintf(buf, "%s\n", hdev->asic_prop.cpucp_info.cpucp_version); in armcp_ver_show()
129 struct hl_device *hdev = dev_get_drvdata(dev); in cpld_ver_show() local
132 hdev->asic_prop.cpucp_info.cpld_version); in cpld_ver_show()
138 struct hl_device *hdev = dev_get_drvdata(dev); in cpucp_kernel_ver_show() local
140 return sprintf(buf, "%s", hdev->asic_prop.cpucp_info.kernel_version); in cpucp_kernel_ver_show()
146 struct hl_device *hdev = dev_get_drvdata(dev); in cpucp_ver_show() local
148 return sprintf(buf, "%s\n", hdev->asic_prop.cpucp_info.cpucp_version); in cpucp_ver_show()
154 struct hl_device *hdev = dev_get_drvdata(dev); in infineon_ver_show() local
157 hdev->asic_prop.cpucp_info.infineon_version); in infineon_ver_show()
163 struct hl_device *hdev = dev_get_drvdata(dev); in fuse_ver_show() local
165 return sprintf(buf, "%s\n", hdev->asic_prop.cpucp_info.fuse_version); in fuse_ver_show()
171 struct hl_device *hdev = dev_get_drvdata(dev); in thermal_ver_show() local
173 return sprintf(buf, "%s", hdev->asic_prop.cpucp_info.thermal_version); in thermal_ver_show()
179 struct hl_device *hdev = dev_get_drvdata(dev); in preboot_btl_ver_show() local
181 return sprintf(buf, "%s\n", hdev->asic_prop.preboot_ver); in preboot_btl_ver_show()
188 struct hl_device *hdev = dev_get_drvdata(dev); in soft_reset_store() local
199 if (!hdev->supports_soft_reset) { in soft_reset_store()
200 dev_err(hdev->dev, "Device does not support soft-reset\n"); in soft_reset_store()
204 dev_warn(hdev->dev, "Soft-Reset requested through sysfs\n"); in soft_reset_store()
206 hl_device_reset(hdev, false, false); in soft_reset_store()
216 struct hl_device *hdev = dev_get_drvdata(dev); in hard_reset_store() local
227 dev_warn(hdev->dev, "Hard-Reset requested through sysfs\n"); in hard_reset_store()
229 hl_device_reset(hdev, true, false); in hard_reset_store()
238 struct hl_device *hdev = dev_get_drvdata(dev); in device_type_show() local
241 switch (hdev->asic_type) { in device_type_show()
249 dev_err(hdev->dev, "Unrecognized ASIC type %d\n", in device_type_show()
250 hdev->asic_type); in device_type_show()
260 struct hl_device *hdev = dev_get_drvdata(dev); in pci_addr_show() local
263 pci_domain_nr(hdev->pdev->bus), in pci_addr_show()
264 hdev->pdev->bus->number, in pci_addr_show()
265 PCI_SLOT(hdev->pdev->devfn), in pci_addr_show()
266 PCI_FUNC(hdev->pdev->devfn)); in pci_addr_show()
272 struct hl_device *hdev = dev_get_drvdata(dev); in status_show() local
275 if (atomic_read(&hdev->in_reset)) in status_show()
277 else if (hdev->disabled) in status_show()
288 struct hl_device *hdev = dev_get_drvdata(dev); in soft_reset_cnt_show() local
290 return sprintf(buf, "%d\n", hdev->soft_reset_cnt); in soft_reset_cnt_show()
296 struct hl_device *hdev = dev_get_drvdata(dev); in hard_reset_cnt_show() local
298 return sprintf(buf, "%d\n", hdev->hard_reset_cnt); in hard_reset_cnt_show()
304 struct hl_device *hdev = dev_get_drvdata(dev); in max_power_show() local
307 if (hl_device_disabled_or_in_reset(hdev)) in max_power_show()
310 val = hl_get_max_power(hdev); in max_power_show()
318 struct hl_device *hdev = dev_get_drvdata(dev); in max_power_store() local
322 if (hl_device_disabled_or_in_reset(hdev)) { in max_power_store()
334 hdev->max_power = value; in max_power_store()
335 hl_set_max_power(hdev); in max_power_store()
346 struct hl_device *hdev = dev_get_drvdata(dev); in eeprom_read_handler() local
350 if (hl_device_disabled_or_in_reset(hdev)) in eeprom_read_handler()
360 rc = hdev->asic_funcs->get_eeprom_data(hdev, data, max_size); in eeprom_read_handler()
437 int hl_sysfs_init(struct hl_device *hdev) in hl_sysfs_init() argument
441 if (hdev->asic_type == ASIC_GOYA) in hl_sysfs_init()
442 hdev->pm_mng_profile = PM_AUTO; in hl_sysfs_init()
444 hdev->pm_mng_profile = PM_MANUAL; in hl_sysfs_init()
446 hdev->max_power = hdev->asic_prop.max_power_default; in hl_sysfs_init()
448 hdev->asic_funcs->add_device_attr(hdev, &hl_dev_clks_attr_group); in hl_sysfs_init()
450 rc = device_add_groups(hdev->dev, hl_dev_attr_groups); in hl_sysfs_init()
452 dev_err(hdev->dev, in hl_sysfs_init()
460 void hl_sysfs_fini(struct hl_device *hdev) in hl_sysfs_fini() argument
462 device_remove_groups(hdev->dev, hl_dev_attr_groups); in hl_sysfs_fini()