Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Intel: avs: Expose FW version with sysfs

Add functionality to read version of loaded FW from sysfs.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20240209085256.121261-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Cezary Rojewski and committed by
Mark Brown
f7fc624b 4089d82e

+50 -1
+8
Documentation/ABI/testing/sysfs-bus-pci-devices-avs
··· 1 + What: /sys/devices/pci0000:00/<dev>/avs/fw_version 2 + Date: February 2024 3 + Contact: Cezary Rojewski <cezary.rojewski@intel.com> 4 + Description: 5 + Version of AudioDSP firmware ASoC avs driver is communicating 6 + with. 7 + 8 + Format: %d.%d.%d.%d, type:major:minor:build.
+2 -1
sound/soc/intel/avs/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 3 snd-soc-avs-objs := dsp.o ipc.o messages.o utils.o core.o loader.o \ 4 - topology.o path.o pcm.o board_selection.o control.o 4 + topology.o path.o pcm.o board_selection.o control.o \ 5 + sysfs.o 5 6 snd-soc-avs-objs += cldma.o 6 7 snd-soc-avs-objs += skl.o apl.o 7 8
+4
sound/soc/intel/avs/avs.h
··· 392 392 static inline void avs_debugfs_exit(struct avs_dev *adev) { } 393 393 #endif 394 394 395 + /* Filesystems integration */ 396 + 397 + extern const struct attribute_group *avs_attr_groups[]; 398 + 395 399 #endif /* __SOUND_SOC_INTEL_AVS_H */
+1
sound/soc/intel/avs/core.c
··· 773 773 .probe = avs_pci_probe, 774 774 .remove = avs_pci_remove, 775 775 .shutdown = avs_pci_shutdown, 776 + .dev_groups = avs_attr_groups, 776 777 .driver = { 777 778 .pm = &avs_dev_pm, 778 779 },
+35
sound/soc/intel/avs/sysfs.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + // 3 + // Copyright(c) 2021-2024 Intel Corporation. All rights reserved. 4 + // 5 + // Authors: Cezary Rojewski <cezary.rojewski@intel.com> 6 + // Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com> 7 + // 8 + 9 + #include <linux/sysfs.h> 10 + #include "avs.h" 11 + 12 + static ssize_t fw_version_show(struct device *dev, struct device_attribute *attr, char *buf) 13 + { 14 + struct avs_dev *adev = to_avs_dev(dev); 15 + struct avs_fw_version *fw_version = &adev->fw_cfg.fw_version; 16 + 17 + return sysfs_emit(buf, "%d.%d.%d.%d\n", fw_version->major, fw_version->minor, 18 + fw_version->hotfix, fw_version->build); 19 + } 20 + static DEVICE_ATTR_RO(fw_version); 21 + 22 + static struct attribute *avs_fw_attrs[] = { 23 + &dev_attr_fw_version.attr, 24 + NULL 25 + }; 26 + 27 + static const struct attribute_group avs_attr_group = { 28 + .name = "avs", 29 + .attrs = avs_fw_attrs, 30 + }; 31 + 32 + const struct attribute_group *avs_attr_groups[] = { 33 + &avs_attr_group, 34 + NULL 35 + };