sysfs.c 885 B

1234567891011121314151617181920212223242526272829303132333435
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. //
  3. // Copyright(c) 2021-2024 Intel Corporation
  4. //
  5. // Authors: Cezary Rojewski <cezary.rojewski@intel.com>
  6. // Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
  7. //
  8. #include <linux/sysfs.h>
  9. #include "avs.h"
  10. static ssize_t fw_version_show(struct device *dev, struct device_attribute *attr, char *buf)
  11. {
  12. struct avs_dev *adev = to_avs_dev(dev);
  13. struct avs_fw_version *fw_version = &adev->fw_cfg.fw_version;
  14. return sysfs_emit(buf, "%d.%d.%d.%d\n", fw_version->major, fw_version->minor,
  15. fw_version->hotfix, fw_version->build);
  16. }
  17. static DEVICE_ATTR_RO(fw_version);
  18. static struct attribute *avs_fw_attrs[] = {
  19. &dev_attr_fw_version.attr,
  20. NULL
  21. };
  22. static const struct attribute_group avs_attr_group = {
  23. .name = "avs",
  24. .attrs = avs_fw_attrs,
  25. };
  26. const struct attribute_group *avs_attr_groups[] = {
  27. &avs_attr_group,
  28. NULL
  29. };