Lines Matching refs:hdev
14 struct hl_device *hdev = dev_get_drvdata(dev); in clk_max_freq_mhz_show() local
17 if (!hl_device_operational(hdev, NULL)) in clk_max_freq_mhz_show()
20 value = hl_fw_get_frequency(hdev, hdev->asic_prop.clk_pll_index, false); in clk_max_freq_mhz_show()
24 hdev->asic_prop.max_freq_value = value; in clk_max_freq_mhz_show()
32 struct hl_device *hdev = dev_get_drvdata(dev); in clk_max_freq_mhz_store() local
36 if (!hl_device_operational(hdev, NULL)) { in clk_max_freq_mhz_store()
47 hdev->asic_prop.max_freq_value = value * 1000 * 1000; in clk_max_freq_mhz_store()
49 hl_fw_set_frequency(hdev, hdev->asic_prop.clk_pll_index, hdev->asic_prop.max_freq_value); in clk_max_freq_mhz_store()
57 struct hl_device *hdev = dev_get_drvdata(dev); in clk_cur_freq_mhz_show() local
60 if (!hl_device_operational(hdev, NULL)) in clk_cur_freq_mhz_show()
63 value = hl_fw_get_frequency(hdev, hdev->asic_prop.clk_pll_index, true); in clk_cur_freq_mhz_show()
81 struct hl_device *hdev = dev_get_drvdata(dev); in vrm_ver_show() local
84 cpucp_info = &hdev->asic_prop.cpucp_info; in vrm_ver_show()
103 struct hl_device *hdev = dev_get_drvdata(dev); in uboot_ver_show() local
105 return sprintf(buf, "%s\n", hdev->asic_prop.uboot_ver); in uboot_ver_show()
111 struct hl_device *hdev = dev_get_drvdata(dev); in armcp_kernel_ver_show() local
113 return sprintf(buf, "%s", hdev->asic_prop.cpucp_info.kernel_version); in armcp_kernel_ver_show()
119 struct hl_device *hdev = dev_get_drvdata(dev); in armcp_ver_show() local
121 return sprintf(buf, "%s\n", hdev->asic_prop.cpucp_info.cpucp_version); in armcp_ver_show()
127 struct hl_device *hdev = dev_get_drvdata(dev); in cpld_ver_show() local
130 le32_to_cpu(hdev->asic_prop.cpucp_info.cpld_version)); in cpld_ver_show()
136 struct hl_device *hdev = dev_get_drvdata(dev); in cpucp_kernel_ver_show() local
138 return sprintf(buf, "%s", hdev->asic_prop.cpucp_info.kernel_version); in cpucp_kernel_ver_show()
144 struct hl_device *hdev = dev_get_drvdata(dev); in cpucp_ver_show() local
146 return sprintf(buf, "%s\n", hdev->asic_prop.cpucp_info.cpucp_version); in cpucp_ver_show()
152 struct hl_device *hdev = dev_get_drvdata(dev); in fuse_ver_show() local
154 return sprintf(buf, "%s\n", hdev->asic_prop.cpucp_info.fuse_version); in fuse_ver_show()
160 struct hl_device *hdev = dev_get_drvdata(dev); in thermal_ver_show() local
162 return sprintf(buf, "%s", hdev->asic_prop.cpucp_info.thermal_version); in thermal_ver_show()
168 struct hl_device *hdev = dev_get_drvdata(dev); in fw_os_ver_show() local
170 return sprintf(buf, "%s", hdev->asic_prop.cpucp_info.fw_os_version); in fw_os_ver_show()
176 struct hl_device *hdev = dev_get_drvdata(dev); in preboot_btl_ver_show() local
178 return sprintf(buf, "%s\n", hdev->asic_prop.preboot_ver); in preboot_btl_ver_show()
185 struct hl_device *hdev = dev_get_drvdata(dev); in soft_reset_store() local
196 if (!hdev->asic_prop.allow_inference_soft_reset) { in soft_reset_store()
197 dev_err(hdev->dev, "Device does not support inference soft-reset\n"); in soft_reset_store()
201 dev_warn(hdev->dev, "Inference Soft-Reset requested through sysfs\n"); in soft_reset_store()
203 hl_device_reset(hdev, 0); in soft_reset_store()
213 struct hl_device *hdev = dev_get_drvdata(dev); in hard_reset_store() local
224 dev_warn(hdev->dev, "Hard-Reset requested through sysfs\n"); in hard_reset_store()
226 hl_device_reset(hdev, HL_DRV_RESET_HARD); in hard_reset_store()
235 struct hl_device *hdev = dev_get_drvdata(dev); in device_type_show() local
238 switch (hdev->asic_type) { in device_type_show()
255 dev_err(hdev->dev, "Unrecognized ASIC type %d\n", in device_type_show()
256 hdev->asic_type); in device_type_show()
266 struct hl_device *hdev = dev_get_drvdata(dev); in pci_addr_show() local
269 pci_domain_nr(hdev->pdev->bus), in pci_addr_show()
270 hdev->pdev->bus->number, in pci_addr_show()
271 PCI_SLOT(hdev->pdev->devfn), in pci_addr_show()
272 PCI_FUNC(hdev->pdev->devfn)); in pci_addr_show()
278 struct hl_device *hdev = dev_get_drvdata(dev); in status_show() local
281 strscpy(str, hdev->status[hl_device_status(hdev)], HL_STR_MAX); in status_show()
292 struct hl_device *hdev = dev_get_drvdata(dev); in soft_reset_cnt_show() local
294 return sprintf(buf, "%d\n", hdev->reset_info.compute_reset_cnt); in soft_reset_cnt_show()
300 struct hl_device *hdev = dev_get_drvdata(dev); in hard_reset_cnt_show() local
302 return sprintf(buf, "%d\n", hdev->reset_info.hard_reset_cnt); in hard_reset_cnt_show()
308 struct hl_device *hdev = dev_get_drvdata(dev); in max_power_show() local
311 if (!hl_device_operational(hdev, NULL)) in max_power_show()
314 val = hl_fw_get_max_power(hdev); in max_power_show()
324 struct hl_device *hdev = dev_get_drvdata(dev); in max_power_store() local
328 if (!hl_device_operational(hdev, NULL)) { in max_power_store()
340 hdev->max_power = value; in max_power_store()
341 hl_fw_set_max_power(hdev); in max_power_store()
352 struct hl_device *hdev = dev_get_drvdata(dev); in eeprom_read_handler() local
356 if (!hl_device_operational(hdev, NULL)) in eeprom_read_handler()
366 rc = hdev->asic_funcs->get_eeprom_data(hdev, data, max_size); in eeprom_read_handler()
381 struct hl_device *hdev = dev_get_drvdata(dev); in security_enabled_show() local
383 return sprintf(buf, "%d\n", hdev->asic_prop.fw_security_enabled); in security_enabled_show()
468 void hl_sysfs_add_dev_clk_attr(struct hl_device *hdev, struct attribute_group *dev_clk_attr_grp) in hl_sysfs_add_dev_clk_attr() argument
473 void hl_sysfs_add_dev_vrm_attr(struct hl_device *hdev, struct attribute_group *dev_vrm_attr_grp) in hl_sysfs_add_dev_vrm_attr() argument
478 int hl_sysfs_init(struct hl_device *hdev) in hl_sysfs_init() argument
482 hdev->max_power = hdev->asic_prop.max_power_default; in hl_sysfs_init()
484 hdev->asic_funcs->add_device_attr(hdev, &hl_dev_clks_attr_group, &hl_dev_vrm_attr_group); in hl_sysfs_init()
486 rc = device_add_groups(hdev->dev, hl_dev_attr_groups); in hl_sysfs_init()
488 dev_err(hdev->dev, in hl_sysfs_init()
493 if (!hdev->asic_prop.allow_inference_soft_reset) in hl_sysfs_init()
496 rc = device_add_groups(hdev->dev, hl_dev_inference_attr_groups); in hl_sysfs_init()
498 dev_err(hdev->dev, in hl_sysfs_init()
506 device_remove_groups(hdev->dev, hl_dev_attr_groups); in hl_sysfs_init()
510 void hl_sysfs_fini(struct hl_device *hdev) in hl_sysfs_fini() argument
512 device_remove_groups(hdev->dev, hl_dev_attr_groups); in hl_sysfs_fini()
514 if (!hdev->asic_prop.allow_inference_soft_reset) in hl_sysfs_fini()
517 device_remove_groups(hdev->dev, hl_dev_inference_attr_groups); in hl_sysfs_fini()