Unverified Commit f7fc624b authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown
Browse files

ASoC: Intel: avs: Expose FW version with sysfs

parent 4089d82e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
What:		/sys/devices/pci0000:00/<dev>/avs/fw_version
Date:		February 2024
Contact:	Cezary Rojewski <cezary.rojewski@intel.com>
Description:
		Version of AudioDSP firmware ASoC avs driver is communicating
		with.

		Format: %d.%d.%d.%d, type:major:minor:build.
+2 −1
Original line number Diff line number Diff line
# 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

+4 −0
Original line number Diff line number Diff line
@@ -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 */
+1 −0
Original line number Diff line number Diff line
@@ -773,6 +773,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,
	},
+35 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2021-2024 Intel Corporation. All rights reserved.
//
// Authors: Cezary Rojewski <cezary.rojewski@intel.com>
//          Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
//

#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
};