All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de, tiwai@suse.de, perex@perex.cz
Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sf.net
Subject: [PATCH 5/8] oxfw: Add proc interface for debugging purpose
Date: Sun,  5 Jan 2014 20:13:34 +0900	[thread overview]
Message-ID: <1388920417-5584-6-git-send-email-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <1388920417-5584-1-git-send-email-o-takashi@sakamocchi.jp>

This commit adds proc interface to get information for debugging.
 - stream formation
 - current sampling rate

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/oxfw/Makefile    |  2 +-
 sound/firewire/oxfw/oxfw.c      |  2 ++
 sound/firewire/oxfw/oxfw.h      |  3 ++
 sound/firewire/oxfw/oxfw_proc.c | 61 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 sound/firewire/oxfw/oxfw_proc.c

diff --git a/sound/firewire/oxfw/Makefile b/sound/firewire/oxfw/Makefile
index 5eb3d87..ab7865d 100644
--- a/sound/firewire/oxfw/Makefile
+++ b/sound/firewire/oxfw/Makefile
@@ -1,2 +1,2 @@
-snd-oxfw-objs := oxfw_command.o oxfw_stream.o oxfw.o
+snd-oxfw-objs := oxfw_command.o oxfw_stream.o oxfw_proc.o oxfw.o
 obj-m += snd-oxfw.o
diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
index f8320af..8298cba 100644
--- a/sound/firewire/oxfw/oxfw.c
+++ b/sound/firewire/oxfw/oxfw.c
@@ -142,6 +142,8 @@ oxfw_probe(struct fw_unit *unit,
 	if (err < 0)
 		goto error;
 
+	snd_oxfw_proc_init(oxfw);
+
 	snd_card_set_dev(card, &unit->device);
 	err = snd_card_register(card);
 	if (err < 0) {
diff --git a/sound/firewire/oxfw/oxfw.h b/sound/firewire/oxfw/oxfw.h
index 34ea0c8..7c02448e 100644
--- a/sound/firewire/oxfw/oxfw.h
+++ b/sound/firewire/oxfw/oxfw.h
@@ -20,6 +20,7 @@
 
 #include <sound/core.h>
 #include <sound/initval.h>
+#include <sound/info.h>
 
 #include "../lib.h"
 #include "../fcp.h"
@@ -106,6 +107,8 @@ void snd_oxfw_stream_destroy_duplex(struct snd_oxfw *oxfw);
 
 int snd_oxfw_stream_discover(struct snd_oxfw *oxfw);
 
+void snd_oxfw_proc_init(struct snd_oxfw *oxfw);
+
 #define SND_OXFW_DEV_ENTRY(vendor, model) \
 { \
 	.match_flags	= IEEE1394_MATCH_VENDOR_ID | \
diff --git a/sound/firewire/oxfw/oxfw_proc.c b/sound/firewire/oxfw/oxfw_proc.c
new file mode 100644
index 0000000..3c1aa96
--- /dev/null
+++ b/sound/firewire/oxfw/oxfw_proc.c
@@ -0,0 +1,61 @@
+/*
+ * oxfw_proc.c - a part of driver for OXFW970/971 based devices
+ *
+ * Copyright (c) 2013 Takashi Sakamoto
+ *
+ * Licensed under the terms of the GNU General Public License, version 2.
+ */
+
+#include "./oxfw.h"
+
+static void
+proc_read_formation(struct snd_info_entry *entry,
+		struct snd_info_buffer *buffer)
+{
+	struct snd_oxfw *oxfw = entry->private_data;
+	struct snd_oxfw_stream_formation *formation;
+	unsigned int i;
+
+	snd_iprintf(buffer, "Output Stream from device:\n");
+	snd_iprintf(buffer, "\tRate\tPCM\tMIDI\n");
+	formation = oxfw->tx_stream_formations;
+	for (i = 0; i < SND_OXFW_RATE_TABLE_ENTRIES; i++) {
+		snd_iprintf(buffer,
+			"\t%d\t%d\t%d\n", snd_oxfw_rate_table[i],
+			formation[i].pcm, formation[i].midi);
+	}
+
+	snd_iprintf(buffer, "Input Stream to device:\n");
+	snd_iprintf(buffer, "\tRate\tPCM\tMIDI\n");
+	formation = oxfw->rx_stream_formations;
+	for (i = 0; i < SND_OXFW_RATE_TABLE_ENTRIES; i++) {
+		snd_iprintf(buffer,
+			"\t%d\t%d\t%d\n", snd_oxfw_rate_table[i],
+			formation[i].pcm, formation[i].midi);
+	}
+}
+
+static void
+proc_read_clock(struct snd_info_entry *entry,
+		struct snd_info_buffer *buffer)
+{
+	struct snd_oxfw *oxfw = entry->private_data;
+	unsigned int rate;
+
+	if (snd_oxfw_stream_get_rate(oxfw, &rate) < 0)
+		return;
+	snd_iprintf(buffer, "Sampling rate: %d\n", rate);
+}
+
+void snd_oxfw_proc_init(struct snd_oxfw *oxfw)
+{
+	struct snd_info_entry *entry;
+
+	if (!snd_card_proc_new(oxfw->card, "#formation", &entry))
+		snd_info_set_text_ops(entry, oxfw, proc_read_formation);
+
+	if (!snd_card_proc_new(oxfw->card, "#clock", &entry))
+		snd_info_set_text_ops(entry, oxfw, proc_read_clock);
+
+	return;
+}
-- 
1.8.3.2

  parent reply	other threads:[~2014-01-05 11:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-05 11:13 [RFC][PATCH 0/8] A new driver for OXFW970/971 based devices Takashi Sakamoto
2014-01-05 11:13 ` [PATCH 1/8] oxfw: Add skelton " Takashi Sakamoto
2014-01-05 11:13 ` [PATCH 2/8] oxfw: Read firmware version to name card Takashi Sakamoto
2014-01-05 11:13 ` [PATCH 3/8] oxfw: Add some AV/C commands for channel formation of AMDTP stream Takashi Sakamoto
2014-01-05 11:13 ` [PATCH 4/8] oxfw: Add connections and streams management Takashi Sakamoto
2014-01-05 11:13 ` Takashi Sakamoto [this message]
2014-01-05 11:13 ` [PATCH 6/8] oxfw: Add MIDI interface Takashi Sakamoto
2014-01-05 11:13 ` [PATCH 7/8] oxfw: Add PCM interface Takashi Sakamoto
2014-01-05 11:13 ` [PATCH 8/8] oxfw: Add hwdep interface Takashi Sakamoto
2014-01-05 19:46 ` [RFC][PATCH 0/8] A new driver for OXFW970/971 based devices Takashi Iwai
2014-01-06  8:33   ` Takashi Sakamoto
2014-01-07 10:07     ` Takashi Iwai
2014-01-10 15:29 ` [RFC][PATCH v2 00/13] speakers: Add support for capture/playback of PCM/MIDI Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 01/13] speakers: move to its own directory Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 02/13] speakers: Split stream functionality to a new file and add a header file Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 03/13] speakers: Split PCM functionality to a new file Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 04/13] speakers: Split control " Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 05/13] speakers: Change the way to name card Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 06/13] speakers: Change the way to make PCM rules/constraints Takashi Sakamoto
2014-01-12 12:18     ` Stefan Richter
2014-01-12 14:44       ` Takashi Sakamoto
2014-01-30 14:21         ` Stefan Richter
2014-02-01  6:31           ` Takashi Sakamoto
2014-02-02 15:45             ` Stefan Richter
2014-02-03  3:07               ` Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 07/13] speakers: Add proc interface for debugging purpose Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 08/13] speakers: Change the way to start stream Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 09/13] speakers: Add some AV/C commands to get stream formation and supported sampling rates Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 10/13] speakers: Add support for Behringer/Mackie devices Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 11/13] speakers: Add support AMDTP in-stream and PCM capture Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 12/13] speakers: Add support for capture/playback MIDI messages Takashi Sakamoto
2014-01-10 15:29   ` [PATCH 13/13] speakers: Add hwdep interface Takashi Sakamoto
2014-01-10 15:45   ` [RFC][PATCH v2 00/13] speakers: Add support for capture/playback of PCM/MIDI Clemens Ladisch
2014-01-10 15:57     ` Takashi Iwai
2014-01-10 16:18       ` Takashi Sakamoto
2014-01-12 12:35         ` Stefan Richter
2014-01-12 14:53           ` Takashi Sakamoto
2014-01-10 15:59     ` Takashi Sakamoto

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=1388920417-5584-6-git-send-email-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=ffado-devel@lists.sf.net \
    --cc=perex@perex.cz \
    --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.