-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ALSA: firewire-tascam: add proc node to show firmware information
TASCAM FireWire series has certain registers for firmware information. This commit adds proc node to show the information. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
- Loading branch information
Takashi Sakamoto
authored and
Takashi Iwai
committed
Oct 2, 2015
1 parent
6f81ba1
commit 96e5fbb
Showing
4 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
snd-firewire-tascam-objs := tascam.o | ||
snd-firewire-tascam-objs := tascam-proc.o tascam.o | ||
obj-$(CONFIG_SND_FIREWIRE_TASCAM) += snd-firewire-tascam.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* tascam-proc.h - a part of driver for TASCAM FireWire series | ||
* | ||
* Copyright (c) 2015 Takashi Sakamoto | ||
* | ||
* Licensed under the terms of the GNU General Public License, version 2. | ||
*/ | ||
|
||
#include "./tascam.h" | ||
|
||
static void proc_read_firmware(struct snd_info_entry *entry, | ||
struct snd_info_buffer *buffer) | ||
{ | ||
struct snd_tscm *tscm = entry->private_data; | ||
__be32 data; | ||
unsigned int reg, fpga, arm, hw; | ||
int err; | ||
|
||
err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST, | ||
TSCM_ADDR_BASE + TSCM_OFFSET_FIRMWARE_REGISTER, | ||
&data, sizeof(data), 0); | ||
if (err < 0) | ||
return; | ||
reg = be32_to_cpu(data); | ||
|
||
err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST, | ||
TSCM_ADDR_BASE + TSCM_OFFSET_FIRMWARE_FPGA, | ||
&data, sizeof(data), 0); | ||
if (err < 0) | ||
return; | ||
fpga = be32_to_cpu(data); | ||
|
||
err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST, | ||
TSCM_ADDR_BASE + TSCM_OFFSET_FIRMWARE_ARM, | ||
&data, sizeof(data), 0); | ||
if (err < 0) | ||
return; | ||
arm = be32_to_cpu(data); | ||
|
||
err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST, | ||
TSCM_ADDR_BASE + TSCM_OFFSET_FIRMWARE_HW, | ||
&data, sizeof(data), 0); | ||
if (err < 0) | ||
return; | ||
hw = be32_to_cpu(data); | ||
|
||
snd_iprintf(buffer, "Register: %d (0x%08x)\n", reg & 0xffff, reg); | ||
snd_iprintf(buffer, "FPGA: %d (0x%08x)\n", fpga & 0xffff, fpga); | ||
snd_iprintf(buffer, "ARM: %d (0x%08x)\n", arm & 0xffff, arm); | ||
snd_iprintf(buffer, "Hardware: %d (0x%08x)\n", hw >> 16, hw); | ||
} | ||
|
||
static void add_node(struct snd_tscm *tscm, struct snd_info_entry *root, | ||
const char *name, | ||
void (*op)(struct snd_info_entry *e, | ||
struct snd_info_buffer *b)) | ||
{ | ||
struct snd_info_entry *entry; | ||
|
||
entry = snd_info_create_card_entry(tscm->card, name, root); | ||
if (entry == NULL) | ||
return; | ||
|
||
snd_info_set_text_ops(entry, tscm, op); | ||
if (snd_info_register(entry) < 0) | ||
snd_info_free_entry(entry); | ||
} | ||
|
||
void snd_tscm_proc_init(struct snd_tscm *tscm) | ||
{ | ||
struct snd_info_entry *root; | ||
|
||
/* | ||
* All nodes are automatically removed at snd_card_disconnect(), | ||
* by following to link list. | ||
*/ | ||
root = snd_info_create_card_entry(tscm->card, "firewire", | ||
tscm->card->proc_root); | ||
if (root == NULL) | ||
return; | ||
root->mode = S_IFDIR | S_IRUGO | S_IXUGO; | ||
if (snd_info_register(root) < 0) { | ||
snd_info_free_entry(root); | ||
return; | ||
} | ||
|
||
add_node(tscm, root, "firmware", proc_read_firmware); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters