Skip to contentSkip to conversation

ASoC: Intel: avs: Expose FW version with sysfs

PATCH In review Amadeusz Sławiński 2 participants 2 messages Feb 9, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: Intel: avs: Expose FW version with sysfs

From: Cezary Rojewski <[email protected]>

Add functionality to read version of loaded FW from sysfs.

---

Changes in v2:
- Adjust path in Documentation to correct one

---
 .../ABI/testing/sysfs-bus-pci-devices-avs     |  8 +++++
 sound/soc/intel/avs/Makefile                  |  3 +-
 sound/soc/intel/avs/avs.h                     |  4 +++
 sound/soc/intel/avs/core.c                    |  1 +
 sound/soc/intel/avs/sysfs.c                   | 35 +++++++++++++++++++
 5 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-devices-avs
 create mode 100644 sound/soc/intel/avs/sysfs.c
Documentation/ABI/testing/sysfs-bus-pci-devices-avs new file +8 -0
new file mode 100644
index 0000000000000..ebff3fa12055d
@@ -0,0 +1,8 @@
+What:		/sys/devices/pci0000:00/<dev>/avs/fw_version
+Date:		February 2024
+Contact:	Cezary Rojewski <[email protected]>
+Description:
+		Version of AudioDSP firmware ASoC avs driver is communicating
+		with.
+
+		Format: %d.%d.%d.%d, type:major:minor:build.
sound/soc/intel/avs/Makefile +2 -1
index 460ee6599daf0..a3fad926d0fb0 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 snd-soc-avs-objs := dsp.o ipc.o messages.o utils.o core.o loader.o \
-		    topology.o path.o pcm.o board_selection.o control.o
+		    topology.o path.o pcm.o board_selection.o control.o \
+		    sysfs.o
 snd-soc-avs-objs += cldma.o
 snd-soc-avs-objs += skl.o apl.o
 
sound/soc/intel/avs/avs.h +4 -0
index d694e08e44e18..69c912feb8a7e 100644
@@ -392,4 +392,8 @@ static inline void avs_debugfs_init(struct avs_dev *adev) { }
 static inline void avs_debugfs_exit(struct avs_dev *adev) { }
 #endif
 
+/* Filesystems integration */
+
+extern const struct attribute_group *avs_attr_groups[];
+
 #endif /* __SOUND_SOC_INTEL_AVS_H */
sound/soc/intel/avs/core.c +1 -0
index db78eb2f01080..273a902168562 100644
@@ -776,6 +776,7 @@ static struct pci_driver avs_pci_driver = {
 	.probe = avs_pci_probe,
 	.remove = avs_pci_remove,
 	.shutdown = avs_pci_shutdown,
+	.dev_groups = avs_attr_groups,
 	.driver = {
 		.pm = &avs_dev_pm,
 	},
sound/soc/intel/avs/sysfs.c new file +35 -0
new file mode 100644
index 0000000000000..cce21636fbc02
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright(c) 2021-2024 Intel Corporation. All rights reserved.
+//
+// Authors: Cezary Rojewski <[email protected]>
+//          Amadeusz Slawinski <[email protected]>
+//
+
+#include <linux/sysfs.h>
+#include "avs.h"
+
+static ssize_t fw_version_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct avs_dev *adev = to_avs_dev(dev);
+	struct avs_fw_version *fw_version = &adev->fw_cfg.fw_version;
+
+	return sysfs_emit(buf, "%d.%d.%d.%d\n", fw_version->major, fw_version->minor,
+			  fw_version->hotfix, fw_version->build);
+}
+static DEVICE_ATTR_RO(fw_version);
+
+static struct attribute *avs_fw_attrs[] = {
+	&dev_attr_fw_version.attr,
+	NULL
+};
+
+static const struct attribute_group avs_attr_group = {
+	.name = "avs",
+	.attrs = avs_fw_attrs,
+};
+
+const struct attribute_group *avs_attr_groups[] = {
+	&avs_attr_group,
+	NULL
+};
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 3 lines · Amadeusz Sławiński

Add functionality to read version of loaded FW from sysfs.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: Intel: avs: Expose FW version with sysfs

      commit: f7fc624be3dbfb78047a1cab795b93c7235fbf1c

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark