From ead4046b2fdfd69acc4272e693afd249ad3eb689 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 21 May 2010 09:15:59 +0200 Subject: ALSA: pcm: fix the fix of the runtime->boundary calculation Commit 7910b4a1db63fefc3d291853d33c34c5b6352e8e in 2.6.34 changed the runtime->boundary calculation to make this value a multiple of both the buffer_size and the period_size, because the latter is assumed by the runtime->hw_ptr_interrupt calculation. However, due to the lack of a ioctl that could read the software parameters before they are set, the kernel requires that alsa-lib calculates the boundary value, too. The changed algorithm leads to a different boundary value used by alsa-lib, which makes, e.g., mplayer fail to play a 44.1 kHz file because the silence_size parameter is now invalid; bug report: . This patch reverts the change to the boundary calculation, and instead fixes the hw_ptr_interrupt calculation to be period-aligned regardless of the boundary value. Signed-off-by: Clemens Ladisch Cc: Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 9 +++++++-- sound/core/pcm_native.c | 39 +++------------------------------------ 2 files changed, 10 insertions(+), 38 deletions(-) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index a2ff86189d2a..22aff180dd1f 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -439,8 +439,13 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, snd_pcm_playback_silence(substream, new_hw_ptr); if (in_interrupt) { - runtime->hw_ptr_interrupt = new_hw_ptr - - (new_hw_ptr % runtime->period_size); + 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_base = hw_base; runtime->status->hw_ptr = new_hw_ptr; diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 644c2bb17b86..303ac04ff6e4 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -370,38 +369,6 @@ 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) { @@ -477,9 +444,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; - err = calc_boundary(runtime); - if (err < 0) - goto _error; + runtime->boundary = runtime->buffer_size; + while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) + runtime->boundary *= 2; snd_pcm_timer_resolution_change(substream); runtime->status->state = SNDRV_PCM_STATE_SETUP; -- cgit v1.2.3 From 4434ade8c9334a3ab975d8993de456f06841899e Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Thu, 20 May 2010 20:31:10 +0100 Subject: ALSA: usb-audio: add support for Akai MPD16 The decoding/encoding is based on own reverse-engineering. Both control and data ports are handled. Writing to control port supports SysEx events only, as this is the only type of messages that MPD16 recognizes. Signed-off-by: Krzysztof Foltman Signed-off-by: Takashi Iwai --- sound/usb/midi.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++ sound/usb/midi.h | 2 + sound/usb/quirks-table.h | 11 +++++ sound/usb/quirks.c | 1 + sound/usb/usbaudio.h | 1 + 5 files changed, 125 insertions(+) (limited to 'sound') diff --git a/sound/usb/midi.c b/sound/usb/midi.c index 2c1558c327bb..9c23d89066e4 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c @@ -644,6 +644,105 @@ 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 @@ -1434,6 +1533,11 @@ 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, @@ -2035,6 +2139,12 @@ 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; diff --git a/sound/usb/midi.h b/sound/usb/midi.h index 2089ec987c66..2fca80b744c0 100644 --- a/sound/usb/midi.h +++ b/sound/usb/midi.h @@ -37,6 +37,8 @@ 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, diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 91ddef31bcbd..f8797f61a24b 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -1973,6 +1973,17 @@ 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), diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 136e5b4cf6de..b45e54c09ba2 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -289,6 +289,7 @@ 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, diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index d679e72a3e5c..06ebf24d3a4d 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -74,6 +74,7 @@ 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, -- cgit v1.2.3 From 34329fae7f88c1d60ff94d5fed5a3bedcd6b2224 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 21 May 2010 17:35:03 -0500 Subject: ALSA: aw2-alsa.c: use pci_ids.h defines and fix checkpatch.pl noise Use the VENDOR/DEVICE ids provided in pci_ids.h instead of creating local ids of the same values. Also, fix the following checkpatch.pl warnings: WARNING: Use #include instead of WARNING: unnecessary whitespace before a quoted newline Signed-off-by: H Hartley Sweeten Signed-off-by: Takashi Iwai --- sound/pci/aw2/aw2-alsa.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index 67921f93a41e..c15002242d98 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -44,9 +44,6 @@ 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 @@ -165,7 +162,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_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0, + {PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146, 0, 0, 0, 0, 0}, {0} }; @@ -419,7 +416,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; } @@ -435,7 +432,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; } -- cgit v1.2.3 From 7a68be94e22e7643038726ebc14360752a91800b Mon Sep 17 00:00:00 2001 From: Daniel T Chen Date: Sat, 22 May 2010 12:05:41 -0400 Subject: ALSA: hda: Use LPIB for Acer Aspire 5110 BugLink: https://launchpad.net/bugs/583983 Symptom: on a significant number of hardware, booting from a live cd results in capture working correctly, but once the distribution is installed, booting from the install results in capture not working. Test case: boot from Ubuntu 10.04 LTS live cd; capture works correctly. Install to HD and reboot; capture does not work. Reproduced with 2.6.32 mainline build (vanilla kernel.org compile). Resolution: add SSID for Acer Aspire 5110 to the position_fix quirk table, explicitly specifying the LPIB method. I'll be sending additional patches for these SSIDs as bug reports are confirmed. Reported-and-Tested-By: Leo Cc: Signed-off-by: Daniel T Chen Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 170610e1d7da..ec554fc7a00e 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -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), -- cgit v1.2.3 From 4e0938dba7fccf37a4aecba4d937da7f312b5d55 Mon Sep 17 00:00:00 2001 From: Daniel T Chen Date: Sat, 22 May 2010 13:12:22 -0400 Subject: ALSA: hda: Use LPIB for Toshiba A100-259 BugLink: https://launchpad.net/bugs/549560 Symptom: on a significant number of hardware, booting from a live cd results in capture working correctly, but once the distribution is installed, booting from the install results in capture not working. Test case: boot from Ubuntu 10.04 LTS live cd; capture works correctly. Install to HD and reboot; capture does not work. Reproduced with 2.6.32 mainline build (vanilla kernel.org compile) Resolution: add SSID for Toshiba A100-259 to the position_fix quirk table, explicitly specifying the LPIB method. I'll be sending additional patches for these SSIDs as bug reports are confirmed. This patch also trivially sorts the quirk table in ascending order by subsystem vendor. Reported-and-Tested-by: Cc: Signed-off-by: Daniel T Chen Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index ec554fc7a00e..14d895bcf3fe 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2284,8 +2284,9 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), - SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB), SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB), -- cgit v1.2.3 From b7cccc52feb142f48beae1566b749480fa9989de Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Sun, 23 May 2010 10:55:00 -0700 Subject: ALSA: hda - iMac9,1 sound fixes First issue: With the original patch, I've noticed by unmuting the mic (and even having it muted), there is a distorted("Noise") coming from the internal speakers, even when the headphones are plugged in. What my finding's revealed is: /* Mic (rear) pin: input vref at 80% */ {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, From the original patch. Looking at codec#0 0x18/0x1a is listed as: Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0000373c: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x90100141: [Fixed] Speaker at Int N/A Conn = Unknown, Color = Unknown DefAssociation = 0x4, Sequence = 0x1 Misc = NO_PRESENCE Pin-ctls: 0x41: OUT VREF_50 Unsolicited: tag=00, enabled=0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 seems this Node is listed as: [Fixed] Speaker while 0x15 Node 0x15 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0000373c: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x018b3020: [Jack] Line In at Ext Rear Conn = Comb, Color = Blue DefAssociation = 0x2, Sequence = 0x0 Pin-ctls: 0x01: VREF_50 Unsolicited: tag=00, enabled=0 Connection: 5 0x0c 0x0d* 0x0e 0x0f 0x26 is [Jack] Line In at Ext Rear. (looking at the other apple products as examples I came up with the fix below). Second issue: alc885_mbp_4ch_modes The original patch does a good job with the HP pin automute function, but from what I noticed is I would have to manually change the channel form 2 to 4 after plugging the headphones in. And not to mention having odd moments to where I was jamming out with the headphones on, then later realized I had sound blasting out of the speakers as well. My findings revealed that changing alc885_mbp_4ch_modes to alc885_mba21_ch_modes and setting - spec->autocfg.speaker_pins[0] = 0x15; + spec->autocfg.speaker_pins[0] = 0x18; gets the automute function when the headphones plugged in working flawlessly(and the no need to manually change the channel number afterwards). Third issue: alc885_imac91_mixer There probably doesnt need to be anything changed with this (esspecially if your one to like lots of sliders),but my findings revealed that mac osx only has a master on the top right, another switch on itunes, and then a slider for the mic. So the changes I did below try and mimic osx as much as possible (only thing I had an issue with is just having one mute switch on the master, instead of having two(still investigating)). fourth issue: alc882_capture_source I endeded up creating alc889A_imac91_capture_source() only because looking at alc882_capture_source I see that the mic is set to 0x1 while this works, I also noticed that adding 0x1 and 0x01 and testing that 0x1 somehow stops working, and 0x01 works(so I figured 0x01 was more of the alpha of the numbers(still need to figure out where that valuse is)). In any case the microphone does work with the original, and with the below patch, but both still record not as clean(lots of "Noise", which I would like to look into too). Note: using alsamixer -Va reveals the capture switches. Signed-off-by: Justin P. Mattock Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 84 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 44 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 53538b0f9991..17d4548cc353 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7025,6 +7025,14 @@ static struct hda_input_mux alc889A_mb31_capture_source = { }, }; +static struct hda_input_mux alc889A_imac91_capture_source = { + .num_items = 2, + .items = { + { "Mic", 0x01 }, + { "Line", 0x2 }, /* Not sure! */ + }, +}; + /* * 2ch mode */ @@ -7486,15 +7494,8 @@ static struct snd_kcontrol_new alc885_macmini3_mixer[] = { }; static struct snd_kcontrol_new alc885_imac91_mixer[] = { - HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), - HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), - HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), - HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), + HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), + HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), { } /* end */ }; @@ -7995,61 +7996,56 @@ static struct hda_verb alc885_mbp3_init_verbs[] = { /* iMac 9,1 */ static struct hda_verb alc885_imac91_init_verbs[] = { - /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, - /* Rear mixer */ - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, - /* HP Pin: output 0 (0x0c) */ + /* Internal Speaker Pin (0x0c) */ + {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, + {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, + {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, + {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, + /* HP Pin: Rear */ {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, - /* Internal Speakers: output 0 (0x0d) */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, + /* Line in Rear */ + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* Mic (rear) pin: input vref at 80% */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Front Mic pin: input vref at 80% */ {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - /* Line In pin: use output 1 when in LineOut mode */ - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, - {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, - - /* FIXME: use matrix-type input source selection */ - /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ - /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ + /* Rear mixer */ + {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - /* Input mixer2 */ + /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - /* Input mixer3 */ + /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - /* ADC1: mute amp left and right */ + /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* ADC2: mute amp left and right */ + /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* ADC3: mute amp left and right */ + /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, - { } }; @@ -8118,7 +8114,7 @@ static void alc885_imac91_setup(struct hda_codec *codec) struct alc_spec *spec = codec->spec; spec->autocfg.hp_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x15; + spec->autocfg.speaker_pins[0] = 0x18; spec->autocfg.speaker_pins[1] = 0x1a; } @@ -9627,14 +9623,14 @@ static struct alc_config_preset alc882_presets[] = { .init_hook = alc885_imac24_init_hook, }, [ALC885_IMAC91] = { - .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, + .mixers = {alc885_imac91_mixer}, .init_verbs = { alc885_imac91_init_verbs, alc880_gpio1_init_verbs }, .num_dacs = ARRAY_SIZE(alc882_dac_nids), .dac_nids = alc882_dac_nids, - .channel_mode = alc885_mbp_4ch_modes, - .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), - .input_mux = &alc882_capture_source, + .channel_mode = alc885_mba21_ch_modes, + .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), + .input_mux = &alc889A_imac91_capture_source, .dig_out_nid = ALC882_DIGOUT_NID, .dig_in_nid = ALC882_DIGIN_NID, .unsol_event = alc_automute_amp_unsol_event, -- cgit v1.2.3 From 66668b6fb6861fad7f6bfef6646ac84693474c9a Mon Sep 17 00:00:00 2001 From: Daniel T Chen Date: Sun, 23 May 2010 20:47:45 -0400 Subject: ALSA: hda: Fix model quirk for Dell M1730 BugLink: https://launchpad.net/bugs/576160 Symptom: Currently (2.6.32.12) the Dell M1730 uses the 3stack model quirk. Unfortunately this means that capture is not functional out- of-the-box despite ensuring that capture settings are unmuted and raised fully. Test case: boot from Ubuntu 10.04 LTS live cd; capture does not work. Resolution: Correct the model quirk for Dell M1730 to rely on the BIOS configuration. This patch also trivially sorts the quirk into the correct section based on the comments. Reported-and-Tested-By: Tested-By: Daren Hayward Tested-By: Tobias Krais Cc: Signed-off-by: Daniel T Chen Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a0e06d82da1f..f1e7babd6920 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2078,12 +2078,12 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, "Intel D965", STAC_D965_3ST), /* Dell 3 stack systems */ - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), /* Dell 3 stack systems with verb table in BIOS */ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS), -- cgit v1.2.3 From 57c7ffc9414d79c8ec25800bbdbf8f801b2f148a Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Thu, 20 May 2010 14:15:04 +0200 Subject: ALSA: usb/caiaq: fix Traktor Kontrol X1 ABS_HAT2X axis Signed-off-by: Daniel Mack Signed-off-by: Takashi Iwai --- sound/usb/caiaq/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c index 8bbfbfd4c658..dcb620796d9e 100644 --- a/sound/usb/caiaq/input.c +++ b/sound/usb/caiaq/input.c @@ -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[15] << 8) | buf[15]); + input_report_abs(input_dev, ABS_HAT2X, (buf[14] << 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]); -- cgit v1.2.3 From 9ef04066b3e7c51ed7edc6010ac039f18f9f3617 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 25 May 2010 09:03:40 +0200 Subject: ALSA: hda_intel: fix handling of non-completion stream interrupts Check that the interrupt raised for a stream is actually a buffer completion interrupt before handling it as one. Otherwise, memory errors or FIFO xruns would be interpreted as a pointer update and could break the stream timing. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 14d895bcf3fe..77e22c2a8caa 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1097,6 +1097,7 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) struct azx *chip = dev_id; struct azx_dev *azx_dev; u32 status; + u8 sd_status; int i, ok; spin_lock(&chip->reg_lock); @@ -1110,8 +1111,10 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) for (i = 0; i < chip->num_streams; i++) { azx_dev = &chip->azx_dev[i]; if (status & azx_dev->sd_int_sta_mask) { + sd_status = azx_sd_readb(azx_dev, SD_STS); azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); - if (!azx_dev->substream || !azx_dev->running) + if (!azx_dev->substream || !azx_dev->running || + !(sd_status & SD_INT_COMPLETE)) continue; /* check whether this IRQ is really acceptable */ ok = azx_position_ok(chip, azx_dev); -- cgit v1.2.3 From b406e6103baa3da85950f22d3d46d21a8da654c5 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 25 May 2010 09:01:46 +0200 Subject: ALSA: pcm: fix delta calculation at boundary wraparound In the cleanup of the hw_ptr update functions in 2.6.33, the calculation of the delta value was changed to use the modulo operator to protect against a negative difference due to the pointer wrapping around at the boundary. However, the ptr variables are unsigned, so a negative difference would result in the two complement's value which has no relation to the actual difference relative to the boundary; the result is typically some value near LONG_MAX-boundary. Furthermore, even if the modulo operation would be done with signed types, the result of a negative dividend could be negative. The invalid delta value is then caught by the following checks, but this means that the pointer update is ignored. To fix this, use a range check as in the other pointer calculations. Signed-off-by: Clemens Ladisch Cc: Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 22aff180dd1f..e9d98be190c5 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -345,7 +345,9 @@ 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) % runtime->boundary; + delta = new_hw_ptr - old_hw_ptr; + if (delta < 0) + delta += runtime->boundary; if (xrun_debug(substream, in_interrupt ? XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) { char name[16]; -- cgit v1.2.3 From 4daf7a0c0b3dd3c2e2ec829ecee8608d04d67773 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 25 May 2010 09:04:49 +0200 Subject: ALSA: emu10k1: allow high-resolution mixer controls Add a module option to allow the GPR mixer controls to have the full resolution of the hardware, i.e., 0...2^31-1 instead of 0...100. Because of bugs in userspace tools like alsactl and alsamixer, this is not yet enabled by default. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emufx.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 4b302d86f5f2..7a9401462c1c 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,10 @@ #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 */ @@ -296,6 +301,7 @@ 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 @@ -1072,10 +1078,17 @@ 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; - ctl->min = 0; - ctl->max = 100; - ctl->tlv = snd_emu10k1_db_scale1; - ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; + 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; + } } static void __devinit @@ -1087,10 +1100,17 @@ 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; - ctl->min = 0; - ctl->max = 100; - ctl->tlv = snd_emu10k1_db_scale1; - ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; + 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; + } } static void __devinit -- cgit v1.2.3