From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [PATCH] ALSA: core: sysfs: show components string
Date: Mon, 23 Mar 2020 14:36:23 -0500 [thread overview]
Message-ID: <20200323193623.3587-1-pierre-louis.bossart@linux.intel.com> (raw)
Add attribute and show the components string. This is useful to see
what is provided to userspace and e.g. used by UCM to understand the
card configuration:
root@plb:~# more /sys/class/sound/card0/components
HDA:8086280b,80860101,00100000 cfg-spk:2 hs:rt711 spk:rt1308 mic:rt715
Note that the style uses what's recommended by checkpatch.pl and is
slightly different from other sysfs attributes.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/core/init.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/sound/core/init.c b/sound/core/init.c
index b02a99766351..decaf944a8ad 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -695,9 +695,21 @@ card_number_show_attr(struct device *dev,
static DEVICE_ATTR(number, 0444, card_number_show_attr, NULL);
+static ssize_t
+components_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct snd_card *card = container_of(dev, struct snd_card, card_dev);
+
+ return scnprintf(buf, PAGE_SIZE, "%s\n", card->components);
+}
+
+static DEVICE_ATTR_RO(components);
+
static struct attribute *card_dev_attrs[] = {
&dev_attr_id.attr,
&dev_attr_number.attr,
+ &dev_attr_components.attr,
NULL
};
--
2.20.1
next reply other threads:[~2020-03-23 19:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 19:36 Pierre-Louis Bossart [this message]
2020-03-23 19:41 ` [PATCH] ALSA: core: sysfs: show components string Mark Brown
2020-03-23 20:21 ` Pierre-Louis Bossart
2020-03-23 20:23 ` Takashi Iwai
2020-03-24 1:53 ` Takashi Sakamoto
2020-03-24 3:34 ` Pierre-Louis Bossart
2020-03-24 4:33 ` Takashi Sakamoto
2020-03-24 5:12 ` Pierre-Louis Bossart
2020-03-24 9:01 ` Takashi Sakamoto
2020-03-24 13:15 ` Pierre-Louis Bossart
2020-03-24 13:45 ` Jaroslav Kysela
2020-03-24 14:56 ` Takashi Iwai
2020-03-24 14:59 ` Pierre-Louis Bossart
2020-03-24 11:54 ` Mark Brown
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=20200323193623.3587-1-pierre-louis.bossart@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.