1 // SPDX-License-Identifier: GPL-2.0-only
3 * tascam-proc.h - a part of driver for TASCAM FireWire series
5 * Copyright (c) 2015 Takashi Sakamoto
10 static void proc_read_firmware(struct snd_info_entry
*entry
,
11 struct snd_info_buffer
*buffer
)
13 struct snd_tscm
*tscm
= entry
->private_data
;
15 unsigned int reg
, fpga
, arm
, hw
;
18 err
= snd_fw_transaction(tscm
->unit
, TCODE_READ_QUADLET_REQUEST
,
19 TSCM_ADDR_BASE
+ TSCM_OFFSET_FIRMWARE_REGISTER
,
20 &data
, sizeof(data
), 0);
23 reg
= be32_to_cpu(data
);
25 err
= snd_fw_transaction(tscm
->unit
, TCODE_READ_QUADLET_REQUEST
,
26 TSCM_ADDR_BASE
+ TSCM_OFFSET_FIRMWARE_FPGA
,
27 &data
, sizeof(data
), 0);
30 fpga
= be32_to_cpu(data
);
32 err
= snd_fw_transaction(tscm
->unit
, TCODE_READ_QUADLET_REQUEST
,
33 TSCM_ADDR_BASE
+ TSCM_OFFSET_FIRMWARE_ARM
,
34 &data
, sizeof(data
), 0);
37 arm
= be32_to_cpu(data
);
39 err
= snd_fw_transaction(tscm
->unit
, TCODE_READ_QUADLET_REQUEST
,
40 TSCM_ADDR_BASE
+ TSCM_OFFSET_FIRMWARE_HW
,
41 &data
, sizeof(data
), 0);
44 hw
= be32_to_cpu(data
);
46 snd_iprintf(buffer
, "Register: %d (0x%08x)\n", reg
& 0xffff, reg
);
47 snd_iprintf(buffer
, "FPGA: %d (0x%08x)\n", fpga
& 0xffff, fpga
);
48 snd_iprintf(buffer
, "ARM: %d (0x%08x)\n", arm
& 0xffff, arm
);
49 snd_iprintf(buffer
, "Hardware: %d (0x%08x)\n", hw
>> 16, hw
);
52 static void add_node(struct snd_tscm
*tscm
, struct snd_info_entry
*root
,
54 void (*op
)(struct snd_info_entry
*e
,
55 struct snd_info_buffer
*b
))
57 struct snd_info_entry
*entry
;
59 entry
= snd_info_create_card_entry(tscm
->card
, name
, root
);
61 snd_info_set_text_ops(entry
, tscm
, op
);
64 void snd_tscm_proc_init(struct snd_tscm
*tscm
)
66 struct snd_info_entry
*root
;
69 * All nodes are automatically removed at snd_card_disconnect(),
70 * by following to link list.
72 root
= snd_info_create_card_entry(tscm
->card
, "firewire",
73 tscm
->card
->proc_root
);
76 root
->mode
= S_IFDIR
| 0555;
78 add_node(tscm
, root
, "firmware", proc_read_firmware
);