Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198641
b: refs/heads/master
c: 7a68be9
h: refs/heads/master
i:
  198639: 6d45a27
v: v3
  • Loading branch information
Daniel T Chen authored and Takashi Iwai committed May 25, 2010
1 parent 6ab0584 commit 8458f57
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 172 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4daf7a0c0b3dd3c2e2ec829ecee8608d04d67773
refs/heads/master: 7a68be94e22e7643038726ebc14360752a91800b
13 changes: 3 additions & 10 deletions trunk/sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
new_hw_ptr = hw_base + pos;
}
__delta:
delta = new_hw_ptr - old_hw_ptr;
if (delta < 0)
delta += runtime->boundary;
delta = (new_hw_ptr - old_hw_ptr) % runtime->boundary;
if (xrun_debug(substream, in_interrupt ?
XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
char name[16];
Expand Down Expand Up @@ -441,13 +439,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
snd_pcm_playback_silence(substream, new_hw_ptr);

if (in_interrupt) {
delta = new_hw_ptr - runtime->hw_ptr_interrupt;
if (delta < 0)
delta += runtime->boundary;
delta -= (snd_pcm_uframes_t)delta % runtime->period_size;
runtime->hw_ptr_interrupt += delta;
if (runtime->hw_ptr_interrupt >= runtime->boundary)
runtime->hw_ptr_interrupt -= runtime->boundary;
runtime->hw_ptr_interrupt = new_hw_ptr -
(new_hw_ptr % runtime->period_size);
}
runtime->hw_ptr_base = hw_base;
runtime->status->hw_ptr = new_hw_ptr;
Expand Down
39 changes: 36 additions & 3 deletions trunk/sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/pm_qos_params.h>
#include <linux/uio.h>
#include <linux/dma-mapping.h>
#include <linux/math64.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
Expand Down Expand Up @@ -369,6 +370,38 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime)
return usecs;
}

static int calc_boundary(struct snd_pcm_runtime *runtime)
{
u_int64_t boundary;

boundary = (u_int64_t)runtime->buffer_size *
(u_int64_t)runtime->period_size;
#if BITS_PER_LONG < 64
/* try to find lowest common multiple for buffer and period */
if (boundary > LONG_MAX - runtime->buffer_size) {
u_int32_t remainder = -1;
u_int32_t divident = runtime->buffer_size;
u_int32_t divisor = runtime->period_size;
while (remainder) {
remainder = divident % divisor;
if (remainder) {
divident = divisor;
divisor = remainder;
}
}
boundary = div_u64(boundary, divisor);
if (boundary > LONG_MAX - runtime->buffer_size)
return -ERANGE;
}
#endif
if (boundary == 0)
return -ERANGE;
runtime->boundary = boundary;
while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
runtime->boundary *= 2;
return 0;
}

static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
Expand Down Expand Up @@ -444,9 +477,9 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
runtime->stop_threshold = runtime->buffer_size;
runtime->silence_threshold = 0;
runtime->silence_size = 0;
runtime->boundary = runtime->buffer_size;
while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
runtime->boundary *= 2;
err = calc_boundary(runtime);
if (err < 0)
goto _error;

snd_pcm_timer_resolution_change(substream);
runtime->status->state = SNDRV_PCM_STATE_SETUP;
Expand Down
11 changes: 7 additions & 4 deletions trunk/sound/pci/aw2/aw2-alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <asm/io.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/pcm.h>
Expand All @@ -44,6 +44,9 @@ MODULE_LICENSE("GPL");
/*********************************
* DEFINES
********************************/
#define PCI_VENDOR_ID_SAA7146 0x1131
#define PCI_DEVICE_ID_SAA7146 0x7146

#define CTL_ROUTE_ANALOG 0
#define CTL_ROUTE_DIGITAL 1

Expand Down Expand Up @@ -162,7 +165,7 @@ module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard.");

static DEFINE_PCI_DEVICE_TABLE(snd_aw2_ids) = {
{PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146, 0, 0,
{PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0,
0, 0, 0},
{0}
};
Expand Down Expand Up @@ -416,7 +419,7 @@ static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;

snd_printdd(KERN_DEBUG "aw2: Playback_open\n");
snd_printdd(KERN_DEBUG "aw2: Playback_open \n");
runtime->hw = snd_aw2_playback_hw;
return 0;
}
Expand All @@ -432,7 +435,7 @@ static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;

snd_printdd(KERN_DEBUG "aw2: Capture_open\n");
snd_printdd(KERN_DEBUG "aw2: Capture_open \n");
runtime->hw = snd_aw2_capture_hw;
return 0;
}
Expand Down
36 changes: 8 additions & 28 deletions trunk/sound/pci/emu10k1/emufx.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/moduleparam.h>

#include <sound/core.h>
#include <sound/tlv.h>
Expand All @@ -51,10 +50,6 @@
#define EMU10K1_CENTER_LFE_FROM_FRONT
#endif

static bool high_res_gpr_volume;
module_param(high_res_gpr_volume, bool, 0444);
MODULE_PARM_DESC(high_res_gpr_volume, "GPR mixer controls use 31-bit range.");

/*
* Tables
*/
Expand Down Expand Up @@ -301,7 +296,6 @@ static const u32 db_table[101] = {

/* EMU10k1/EMU10k2 DSP control db gain */
static const DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1);
static const DECLARE_TLV_DB_LINEAR(snd_emu10k1_db_linear, TLV_DB_GAIN_MUTE, 0);

static const u32 onoff_table[2] = {
0x00000000, 0x00000001
Expand Down Expand Up @@ -1078,17 +1072,10 @@ snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
strcpy(ctl->id.name, name);
ctl->vcount = ctl->count = 1;
ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
if (high_res_gpr_volume) {
ctl->min = 0;
ctl->max = 0x7fffffff;
ctl->tlv = snd_emu10k1_db_linear;
ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
} else {
ctl->min = 0;
ctl->max = 100;
ctl->tlv = snd_emu10k1_db_scale1;
ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
}
ctl->min = 0;
ctl->max = 100;
ctl->tlv = snd_emu10k1_db_scale1;
ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
}

static void __devinit
Expand All @@ -1100,17 +1087,10 @@ snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
ctl->vcount = ctl->count = 2;
ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
ctl->gpr[1] = gpr + 1; ctl->value[1] = defval;
if (high_res_gpr_volume) {
ctl->min = 0;
ctl->max = 0x7fffffff;
ctl->tlv = snd_emu10k1_db_linear;
ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
} else {
ctl->min = 0;
ctl->max = 100;
ctl->tlv = snd_emu10k1_db_scale1;
ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
}
ctl->min = 0;
ctl->max = 100;
ctl->tlv = snd_emu10k1_db_scale1;
ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
}

static void __devinit
Expand Down
1 change: 1 addition & 0 deletions trunk/sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,7 @@ static int azx_dev_free(struct snd_device *device)
* white/black-listing for position_fix
*/
static struct snd_pci_quirk position_fix_list[] __devinitdata = {
SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB),
Expand Down
2 changes: 1 addition & 1 deletion trunk/sound/usb/caiaq/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev,
input_report_abs(input_dev, ABS_HAT0Y, (buf[4] << 8) | buf[5]);
input_report_abs(input_dev, ABS_HAT1X, (buf[12] << 8) | buf[13]);
input_report_abs(input_dev, ABS_HAT1Y, (buf[2] << 8) | buf[3]);
input_report_abs(input_dev, ABS_HAT2X, (buf[14] << 8) | buf[15]);
input_report_abs(input_dev, ABS_HAT2X, (buf[15] << 8) | buf[15]);
input_report_abs(input_dev, ABS_HAT2Y, (buf[0] << 8) | buf[1]);
input_report_abs(input_dev, ABS_HAT3X, (buf[10] << 8) | buf[11]);
input_report_abs(input_dev, ABS_HAT3Y, (buf[6] << 8) | buf[7]);
Expand Down
110 changes: 0 additions & 110 deletions trunk/sound/usb/midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,105 +644,6 @@ static struct usb_protocol_ops snd_usbmidi_cme_ops = {
.output_packet = snd_usbmidi_output_standard_packet,
};

/*
* AKAI MPD16 protocol:
*
* For control port (endpoint 1):
* ==============================
* One or more chunks consisting of first byte of (0x10 | msg_len) and then a
* SysEx message (msg_len=9 bytes long).
*
* For data port (endpoint 2):
* ===========================
* One or more chunks consisting of first byte of (0x20 | msg_len) and then a
* MIDI message (msg_len bytes long)
*
* Messages sent: Active Sense, Note On, Poly Pressure, Control Change.
*/
static void snd_usbmidi_akai_input(struct snd_usb_midi_in_endpoint *ep,
uint8_t *buffer, int buffer_length)
{
unsigned int pos = 0;
unsigned int len = (unsigned int)buffer_length;
while (pos < len) {
unsigned int port = (buffer[pos] >> 4) - 1;
unsigned int msg_len = buffer[pos] & 0x0f;
pos++;
if (pos + msg_len <= len && port < 2)
snd_usbmidi_input_data(ep, 0, &buffer[pos], msg_len);
pos += msg_len;
}
}

#define MAX_AKAI_SYSEX_LEN 9

static void snd_usbmidi_akai_output(struct snd_usb_midi_out_endpoint *ep,
struct urb *urb)
{
uint8_t *msg;
int pos, end, count, buf_end;
uint8_t tmp[MAX_AKAI_SYSEX_LEN];
struct snd_rawmidi_substream *substream = ep->ports[0].substream;

if (!ep->ports[0].active)
return;

msg = urb->transfer_buffer + urb->transfer_buffer_length;
buf_end = ep->max_transfer - MAX_AKAI_SYSEX_LEN - 1;

/* only try adding more data when there's space for at least 1 SysEx */
while (urb->transfer_buffer_length < buf_end) {
count = snd_rawmidi_transmit_peek(substream,
tmp, MAX_AKAI_SYSEX_LEN);
if (!count) {
ep->ports[0].active = 0;
return;
}
/* try to skip non-SysEx data */
for (pos = 0; pos < count && tmp[pos] != 0xF0; pos++)
;

if (pos > 0) {
snd_rawmidi_transmit_ack(substream, pos);
continue;
}

/* look for the start or end marker */
for (end = 1; end < count && tmp[end] < 0xF0; end++)
;

/* next SysEx started before the end of current one */
if (end < count && tmp[end] == 0xF0) {
/* it's incomplete - drop it */
snd_rawmidi_transmit_ack(substream, end);
continue;
}
/* SysEx complete */
if (end < count && tmp[end] == 0xF7) {
/* queue it, ack it, and get the next one */
count = end + 1;
msg[0] = 0x10 | count;
memcpy(&msg[1], tmp, count);
snd_rawmidi_transmit_ack(substream, count);
urb->transfer_buffer_length += count + 1;
msg += count + 1;
continue;
}
/* less than 9 bytes and no end byte - wait for more */
if (count < MAX_AKAI_SYSEX_LEN) {
ep->ports[0].active = 0;
return;
}
/* 9 bytes and no end marker in sight - malformed, skip it */
snd_rawmidi_transmit_ack(substream, count);
}
}

static struct usb_protocol_ops snd_usbmidi_akai_ops = {
.input = snd_usbmidi_akai_input,
.output = snd_usbmidi_akai_output,
};

/*
* Novation USB MIDI protocol: number of data bytes is in the first byte
* (when receiving) (+1!) or in the second byte (when sending); data begins
Expand Down Expand Up @@ -1533,11 +1434,6 @@ static struct port_info {
EXTERNAL_PORT(0x086a, 0x0001, 8, "%s Broadcast"),
EXTERNAL_PORT(0x086a, 0x0002, 8, "%s Broadcast"),
EXTERNAL_PORT(0x086a, 0x0003, 4, "%s Broadcast"),
/* Akai MPD16 */
CONTROL_PORT(0x09e8, 0x0062, 0, "%s Control"),
PORT_INFO(0x09e8, 0x0062, 1, "%s MIDI", 0,
SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
SNDRV_SEQ_PORT_TYPE_HARDWARE),
/* Access Music Virus TI */
EXTERNAL_PORT(0x133e, 0x0815, 0, "%s MIDI"),
PORT_INFO(0x133e, 0x0815, 1, "%s Synth", 0,
Expand Down Expand Up @@ -2139,12 +2035,6 @@ int snd_usbmidi_create(struct snd_card *card,
umidi->usb_protocol_ops = &snd_usbmidi_cme_ops;
err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
break;
case QUIRK_MIDI_AKAI:
umidi->usb_protocol_ops = &snd_usbmidi_akai_ops;
err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
/* endpoint 1 is input-only */
endpoints[1].out_cables = 0;
break;
default:
snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
err = -ENXIO;
Expand Down
2 changes: 0 additions & 2 deletions trunk/sound/usb/midi.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ struct snd_usb_midi_endpoint_info {

/* for QUIRK_MIDI_CME, data is NULL */

/* for QUIRK_MIDI_AKAI, data is NULL */

int snd_usbmidi_create(struct snd_card *card,
struct usb_interface *iface,
struct list_head *midi_list,
Expand Down
11 changes: 0 additions & 11 deletions trunk/sound/usb/quirks-table.h
Original file line number Diff line number Diff line change
Expand Up @@ -1973,17 +1973,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
}
},

/* AKAI devices */
{
USB_DEVICE(0x09e8, 0x0062),
.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
.vendor_name = "AKAI",
.product_name = "MPD16",
.ifnum = 0,
.type = QUIRK_MIDI_AKAI,
}
},

/* TerraTec devices */
{
USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012),
Expand Down
1 change: 0 additions & 1 deletion trunk/sound/usb/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
[QUIRK_MIDI_FASTLANE] = create_any_midi_quirk,
[QUIRK_MIDI_EMAGIC] = create_any_midi_quirk,
[QUIRK_MIDI_CME] = create_any_midi_quirk,
[QUIRK_MIDI_AKAI] = create_any_midi_quirk,
[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
Expand Down
1 change: 0 additions & 1 deletion trunk/sound/usb/usbaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ enum quirk_type {
QUIRK_MIDI_FASTLANE,
QUIRK_MIDI_EMAGIC,
QUIRK_MIDI_CME,
QUIRK_MIDI_AKAI,
QUIRK_MIDI_US122L,
QUIRK_AUDIO_STANDARD_INTERFACE,
QUIRK_AUDIO_FIXED_ENDPOINT,
Expand Down

0 comments on commit 8458f57

Please sign in to comment.