From patchwork Wed Feb 7 12:25:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 13548439 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 248B459B72 for ; Wed, 7 Feb 2024 12:24:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.88 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707308684; cv=none; b=As9ruD8zR1rwMzRXbMDrmDUW1TDZ9hL1W9YVu4CjWMKSimLNXSCbJ8IcS1JqqrxBgRfmRJ/Lt9RJ7naSwdmIw96NLne/IBbhelOlQ4p43E78gPjeg3LiiR7Gdp5Q7tbI/2S5Sf81o4uMAnhjl/LghTvYfy0vTJta744d8vqzqkQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707308684; c=relaxed/simple; bh=WJiPnGQnpL8D5hbUv1rOxOUv6OpRKLHCtAzNkuXyfhw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=BSjBMZ6lTjbymeHD9PlAxo1Avlgbafr+N4PCHAw2oHzKXCs62uIHmhsNrtjud8IMVkKAoMdzz+l03UsHgrtEMLsskt25Eu6ATeicmidILWJXNt7E5dg/wFS/tlgIzNn2U2WXFMpwOBGEonadxFQTMsUeKoSRbI33LmQ/xAsfVa4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=l6PIcNNa; arc=none smtp.client-ip=192.55.52.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="l6PIcNNa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707308683; x=1738844683; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WJiPnGQnpL8D5hbUv1rOxOUv6OpRKLHCtAzNkuXyfhw=; b=l6PIcNNa9Ra6P8QvRbxh5DZrwjc99hvU8cOavtPJb7kpg8sdHvcYgkWJ oFHg/Zx6BZG/tZOxWMF+7Sd5Gn/bRBZHhTvroTHhSkYMXE+MeK8BhiAXT FUrzs5SFRVD8PIhq/atoRkVq9Fl3Ty8DH8ikpfYKsTlQFcdnVtCQCw44v DmaPSHZiQ78sJCHe8OmOfMH9NvG7M8rkXft1NfCZTO8H4ghSA10141FSM m2/l6J4rZcPk6hSqhuhpWjKYN29ARR52pX3/wo7yiQtfeY4fKX141XsRp gCGGLUB70MT6P1KWNe98R1nIs2d6GBQLrvDbV28ThvWMmf0hOogB8pLKy w==; X-IronPort-AV: E=McAfee;i="6600,9927,10976"; a="436110927" X-IronPort-AV: E=Sophos;i="6.05,250,1701158400"; d="scan'208";a="436110927" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2024 04:24:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,250,1701158400"; d="scan'208";a="38748625" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orviesa001.jf.intel.com with ESMTP; 07 Feb 2024 04:24:39 -0800 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, =?utf-8?q?=C5=81u?= =?utf-8?q?kasz_Majczak?= , =?utf-8?q?Amadeusz_S=C5=82awi?= =?utf-8?q?=C5=84ski?= Subject: [PATCH] ASoC: Intel: avs: Expose FW version with sysfs Date: Wed, 7 Feb 2024 13:25:09 +0100 Message-Id: <20240207122509.2222214-1-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Cezary Rojewski Add functionality to read version of loaded FW from sysfs. Signed-off-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- .../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 diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-avs b/Documentation/ABI/testing/sysfs-bus-pci-devices-avs new file mode 100644 index 0000000000000..abfdecd85f204 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-avs @@ -0,0 +1,8 @@ +What: /sys/devices/pci0000:00//fw_version +Date: February 2024 +Contact: Cezary Rojewski +Description: + Version of AudioDSP firmware ASoC avs driver is communicating + with. + + Format: %d.%d.%d.%d, type:major:minor:build. diff --git a/sound/soc/intel/avs/Makefile b/sound/soc/intel/avs/Makefile index 460ee6599daf0..a3fad926d0fb0 100644 --- a/sound/soc/intel/avs/Makefile +++ b/sound/soc/intel/avs/Makefile @@ -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 diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h index d694e08e44e18..69c912feb8a7e 100644 --- a/sound/soc/intel/avs/avs.h +++ b/sound/soc/intel/avs/avs.h @@ -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 */ diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c index db78eb2f01080..273a902168562 100644 --- a/sound/soc/intel/avs/core.c +++ b/sound/soc/intel/avs/core.c @@ -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, }, diff --git a/sound/soc/intel/avs/sysfs.c b/sound/soc/intel/avs/sysfs.c new file mode 100644 index 0000000000000..cce21636fbc02 --- /dev/null +++ b/sound/soc/intel/avs/sysfs.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// Copyright(c) 2021-2024 Intel Corporation. All rights reserved. +// +// Authors: Cezary Rojewski +// Amadeusz Slawinski +// + +#include +#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 +};