Release 4.11 sound/usb/proc.c
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/init.h>
#include <linux/usb.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/pcm.h>
#include "usbaudio.h"
#include "helper.h"
#include "card.h"
#include "endpoint.h"
#include "proc.h"
/* convert our full speed USB rate into sampling rate in Hz */
static inline unsigned get_full_speed_hz(unsigned int usb_rate)
{
return (usb_rate * 125 + (1 << 12)) >> 13;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 26 | 100.00% | 1 | 100.00% |
Total | 26 | 100.00% | 1 | 100.00% |
/* convert our high speed USB rate into sampling rate in Hz */
static inline unsigned get_high_speed_hz(unsigned int usb_rate)
{
return (usb_rate * 125 + (1 << 9)) >> 10;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 26 | 100.00% | 1 | 100.00% |
Total | 26 | 100.00% | 1 | 100.00% |
/*
* common proc files to show the usb device info
*/
static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{
struct snd_usb_audio *chip = entry->private_data;
if (!atomic_read(&chip->shutdown))
snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 53 | 92.98% | 1 | 50.00% |
Takashi Iwai | 4 | 7.02% | 1 | 50.00% |
Total | 57 | 100.00% | 2 | 100.00% |
static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{
struct snd_usb_audio *chip = entry->private_data;
if (!atomic_read(&chip->shutdown))
snd_iprintf(buffer, "%04x:%04x\n",
USB_ID_VENDOR(chip->usb_id),
USB_ID_PRODUCT(chip->usb_id));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 53 | 92.98% | 1 | 50.00% |
Takashi Iwai | 4 | 7.02% | 1 | 50.00% |
Total | 57 | 100.00% | 2 | 100.00% |
void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
{
struct snd_info_entry *entry;
if (!snd_card_proc_new(chip->card, "usbbus", &entry))
snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read);
if (!snd_card_proc_new(chip->card, "usbid", &entry))
snd_info_set_text_ops(entry, chip, proc_audio_usbid_read);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 63 | 100.00% | 1 | 100.00% |
Total | 63 | 100.00% | 1 | 100.00% |
/*
* proc interface for list the supported pcm formats
*/
static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
{
struct audioformat *fp;
static char *sync_types[4] = {
"NONE", "ASYNC", "ADAPTIVE", "SYNC"
};
list_for_each_entry(fp, &subs->fmt_list, list) {
snd_pcm_format_t fmt;
snd_iprintf(buffer, " Interface %d\n", fp->iface);
snd_iprintf(buffer, " Altset %d\n", fp->altsetting);
snd_iprintf(buffer, " Format:");
for (fmt = 0; fmt <= SNDRV_PCM_FORMAT_LAST; ++fmt)
if (fp->formats & pcm_format_to_bits(fmt))
snd_iprintf(buffer, " %s",
snd_pcm_format_name(fmt));
snd_iprintf(buffer, "\n");
snd_iprintf(buffer, " Channels: %d\n", fp->channels);
snd_iprintf(buffer, " Endpoint: %d %s (%s)\n",
fp->endpoint & USB_ENDPOINT_NUMBER_MASK,
fp->endpoint & USB_DIR_IN ? "IN" : "OUT",
sync_types[(fp->ep_attr & USB_ENDPOINT_SYNCTYPE) >> 2]);
if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS) {
snd_iprintf(buffer, " Rates: %d - %d (continuous)\n",
fp->rate_min, fp->rate_max);
} else {
unsigned int i;
snd_iprintf(buffer, " Rates: ");
for (i = 0; i < fp->nr_rates; i++) {
if (i > 0)
snd_iprintf(buffer, ", ");
snd_iprintf(buffer, "%d", fp->rate_table[i]);
}
snd_iprintf(buffer, "\n");
}
if (subs->speed != USB_SPEED_FULL)
snd_iprintf(buffer, " Data packet interval: %d us\n",
125 * (1 << fp->datainterval));
// snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize);
// snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 236 | 81.94% | 1 | 16.67% |
Clemens Ladisch | 40 | 13.89% | 1 | 16.67% |
Eldad Zack | 9 | 3.12% | 2 | 33.33% |
Paul Zimmerman | 2 | 0.69% | 1 | 16.67% |
Takashi Iwai | 1 | 0.35% | 1 | 16.67% |
Total | 288 | 100.00% | 6 | 100.00% |
static void proc_dump_ep_status(struct snd_usb_substream *subs,
struct snd_usb_endpoint *data_ep,
struct snd_usb_endpoint *sync_ep,
struct snd_info_buffer *buffer)
{
if (!data_ep)
return;
snd_iprintf(buffer, " Packet Size = %d\n", data_ep->curpacksize);
snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n",
subs->speed == USB_SPEED_FULL
? get_full_speed_hz(data_ep->freqm)
: get_high_speed_hz(data_ep->freqm),
data_ep->freqm >> 16, data_ep->freqm & 0xffff);
if (sync_ep && data_ep->freqshift != INT_MIN) {
int res = 16 - data_ep->freqshift;
snd_iprintf(buffer, " Feedback Format = %d.%d\n",
(sync_ep->syncmaxsize > 3 ? 32 : 24) - res, res);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Takashi Iwai | 109 | 86.51% | 2 | 66.67% |
Torstein Hegge | 17 | 13.49% | 1 | 33.33% |
Total | 126 | 100.00% | 3 | 100.00% |
static void proc_dump_substream_status(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
{
if (subs->running) {
snd_iprintf(buffer, " Status: Running\n");
snd_iprintf(buffer, " Interface = %d\n", subs->interface);
snd_iprintf(buffer, " Altset = %d\n", subs->altset_idx);
proc_dump_ep_status(subs, subs->data_endpoint, subs->sync_endpoint, buffer);
} else {
snd_iprintf(buffer, " Status: Stop\n");
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 68 | 87.18% | 1 | 25.00% |
Takashi Iwai | 5 | 6.41% | 1 | 25.00% |
Clemens Ladisch | 5 | 6.41% | 2 | 50.00% |
Total | 78 | 100.00% | 4 | 100.00% |
static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{
struct snd_usb_stream *stream = entry->private_data;
snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name);
if (stream->substream[SNDRV_PCM_STREAM_PLAYBACK].num_formats) {
snd_iprintf(buffer, "\nPlayback:\n");
proc_dump_substream_status(&stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer);
proc_dump_substream_formats(&stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer);
}
if (stream->substream[SNDRV_PCM_STREAM_CAPTURE].num_formats) {
snd_iprintf(buffer, "\nCapture:\n");
proc_dump_substream_status(&stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer);
proc_dump_substream_formats(&stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 138 | 100.00% | 1 | 100.00% |
Total | 138 | 100.00% | 1 | 100.00% |
void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream)
{
struct snd_info_entry *entry;
char name[32];
struct snd_card *card = stream->chip->card;
sprintf(name, "stream%d", stream->pcm_index);
if (!snd_card_proc_new(card, name, &entry))
snd_info_set_text_ops(entry, stream, proc_pcm_format_read);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 65 | 100.00% | 1 | 100.00% |
Total | 65 | 100.00% | 1 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Mack | 763 | 79.56% | 2 | 16.67% |
Takashi Iwai | 123 | 12.83% | 3 | 25.00% |
Clemens Ladisch | 45 | 4.69% | 3 | 25.00% |
Torstein Hegge | 17 | 1.77% | 1 | 8.33% |
Eldad Zack | 9 | 0.94% | 2 | 16.67% |
Paul Zimmerman | 2 | 0.21% | 1 | 8.33% |
Total | 959 | 100.00% | 12 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.