From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org
Cc: pierre-louis.bossart@linux.intel.com,
Cezary Rojewski <cezary.rojewski@intel.com>,
andriy.shevchenko@intel.com, filip.kaczmarski@intel.com,
harshapriya.n@intel.com, marcin.barlik@intel.com,
zwisler@google.com, lgirdwood@gmail.com, tiwai@suse.com,
filip.proborszcz@intel.com, broonie@kernel.org,
amadeuszx.slawinski@linux.intel.com, michal.wasko@intel.com,
cujomalainey@chromium.org, krzysztof.hejmowski@intel.com,
ppapierkowski@habana.ai, vamshi.krishna.gopal@intel.com
Subject: [PATCH v4 08/13] ASoC: Intel: catpt: Simple sysfs attributes
Date: Wed, 12 Aug 2020 22:57:48 +0200 [thread overview]
Message-ID: <20200812205753.29115-9-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20200812205753.29115-1-cezary.rojewski@intel.com>
Add sysfs entries for displaying version of FW currently in use as well
as binary dump of entire version info, including build and log providers
hashes.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/catpt/fs.c | 79 ++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 sound/soc/intel/catpt/fs.c
diff --git a/sound/soc/intel/catpt/fs.c b/sound/soc/intel/catpt/fs.c
new file mode 100644
index 000000000000..d73493687f4a
--- /dev/null
+++ b/sound/soc/intel/catpt/fs.c
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0-pcm
+//
+// Copyright(c) 2020 Intel Corporation. All rights reserved.
+//
+// Author: Cezary Rojewski <cezary.rojewski@intel.com>
+//
+
+#include <linux/pm_runtime.h>
+#include "core.h"
+
+static ssize_t fw_version_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct catpt_dev *cdev = dev_get_drvdata(dev);
+ struct catpt_fw_version version;
+ int ret;
+
+ pm_runtime_get_sync(cdev->dev);
+
+ ret = catpt_ipc_get_fw_version(cdev, &version);
+
+ pm_runtime_mark_last_busy(cdev->dev);
+ pm_runtime_put_autosuspend(cdev->dev);
+
+ if (ret)
+ return CATPT_IPC_ERROR(ret);
+
+ return sprintf(buf, "%d.%d.%d.%d\n", version.type, version.major,
+ version.minor, version.build);
+}
+
+static DEVICE_ATTR_RO(fw_version);
+
+static ssize_t fw_build_read(struct file *filp, struct kobject *kobj,
+ struct bin_attribute *bin_attr, char *buf,
+ loff_t off, size_t count)
+{
+ struct catpt_dev *cdev = dev_get_drvdata(kobj_to_dev(kobj));
+ struct catpt_fw_version version;
+ int ret;
+
+ pm_runtime_get_sync(cdev->dev);
+
+ ret = catpt_ipc_get_fw_version(cdev, &version);
+
+ pm_runtime_mark_last_busy(cdev->dev);
+ pm_runtime_put_autosuspend(cdev->dev);
+
+ if (ret)
+ return CATPT_IPC_ERROR(ret);
+
+ memcpy(buf, &version, sizeof(version));
+ return count;
+}
+
+static BIN_ATTR_RO(fw_build, sizeof(struct catpt_fw_version));
+
+int catpt_sysfs_create(struct catpt_dev *cdev)
+{
+ int ret;
+
+ ret = sysfs_create_file(&cdev->dev->kobj, &dev_attr_fw_version.attr);
+ if (ret)
+ return ret;
+
+ ret = sysfs_create_bin_file(&cdev->dev->kobj, &bin_attr_fw_build);
+ if (ret) {
+ sysfs_remove_file(&cdev->dev->kobj, &dev_attr_fw_version.attr);
+ return ret;
+ }
+
+ return 0;
+}
+
+void catpt_sysfs_remove(struct catpt_dev *cdev)
+{
+ sysfs_remove_bin_file(&cdev->dev->kobj, &bin_attr_fw_build);
+ sysfs_remove_file(&cdev->dev->kobj, &dev_attr_fw_version.attr);
+}
--
2.17.1
next prev parent reply other threads:[~2020-08-12 21:04 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-12 20:57 [PATCH v4 00/13] ASoC: Intel: Catpt - Lynx and Wildcat point Cezary Rojewski
2020-08-12 20:57 ` [PATCH v4 01/13] ASoC: Intel: Add catpt device Cezary Rojewski
2020-08-13 18:29 ` Andy Shevchenko
2020-08-17 10:02 ` Cezary Rojewski
2020-08-18 10:07 ` Andy Shevchenko
2020-08-19 13:26 ` Cezary Rojewski
2020-08-19 13:43 ` Andy Shevchenko
2020-08-25 9:32 ` Cezary Rojewski
2020-08-25 13:18 ` Andy Shevchenko
2020-08-25 13:19 ` Andy Shevchenko
2020-08-25 20:43 ` Cezary Rojewski
2020-08-12 20:57 ` [PATCH v4 02/13] ASoC: Intel: catpt: Define DSP operations Cezary Rojewski
2020-08-13 18:51 ` Andy Shevchenko
2020-08-17 11:12 ` Cezary Rojewski
2020-08-18 11:50 ` Andy Shevchenko
2020-08-19 13:46 ` Cezary Rojewski
2020-08-19 14:21 ` Andy Shevchenko
2020-08-19 14:54 ` Cezary Rojewski
2020-08-20 7:30 ` Cezary Rojewski
2020-08-20 9:00 ` Andy Shevchenko
2020-08-24 16:33 ` Cezary Rojewski
2020-08-25 13:16 ` Andy Shevchenko
2020-08-25 13:23 ` Andy Shevchenko
2020-08-27 10:06 ` Cezary Rojewski
2020-08-12 20:57 ` [PATCH v4 03/13] ASoC: Intel: catpt: Firmware loading and context restore Cezary Rojewski
2020-08-12 20:57 ` [PATCH v4 04/13] ASoC: Intel: catpt: Implement IPC protocol Cezary Rojewski
2020-08-12 20:57 ` [PATCH v4 05/13] ASoC: Intel: catpt: Add IPC messages Cezary Rojewski
2020-08-12 20:57 ` [PATCH v4 06/13] ASoC: Intel: catpt: PCM operations Cezary Rojewski
2020-08-12 20:57 ` [PATCH v4 07/13] ASoC: Intel: catpt: Event tracing Cezary Rojewski
2020-08-12 20:57 ` Cezary Rojewski [this message]
2020-08-12 20:57 ` [PATCH v4 09/13] ASoC: Intel: Select catpt and deprecate haswell Cezary Rojewski
2020-08-12 20:57 ` [PATCH v4 10/13] ASoC: Intel: haswell: Remove haswell-solution specific code Cezary Rojewski
2020-08-13 18:57 ` Andy Shevchenko
2020-08-12 20:57 ` [PATCH v4 11/13] ASoC: Intel: broadwell: " Cezary Rojewski
2020-08-13 18:56 ` Andy Shevchenko
2020-08-12 20:57 ` [PATCH v4 12/13] ASoC: Intel: bdw-5650: " Cezary Rojewski
2020-08-13 18:56 ` Andy Shevchenko
2020-08-12 20:57 ` [PATCH v4 13/13] ASoC: Intel: bdw-5677: " Cezary Rojewski
2020-08-13 18:57 ` Andy Shevchenko
2020-08-13 8:30 ` [PATCH v4 00/13] ASoC: Intel: Catpt - Lynx and Wildcat point Amadeusz Sławiński
2020-08-13 16:00 ` Liam Girdwood
2020-08-13 18:11 ` Cezary Rojewski
2020-08-13 19:03 ` Liam Girdwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200812205753.29115-9-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=andriy.shevchenko@intel.com \
--cc=broonie@kernel.org \
--cc=cujomalainey@chromium.org \
--cc=filip.kaczmarski@intel.com \
--cc=filip.proborszcz@intel.com \
--cc=harshapriya.n@intel.com \
--cc=krzysztof.hejmowski@intel.com \
--cc=lgirdwood@gmail.com \
--cc=marcin.barlik@intel.com \
--cc=michal.wasko@intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ppapierkowski@habana.ai \
--cc=tiwai@suse.com \
--cc=vamshi.krishna.gopal@intel.com \
--cc=zwisler@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).