aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/opl3.h (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2015-10-20ALSA: hda - Advertise MODALIAS in ueventThierry Reding1-0/+12
By setting the MODALIAS variable in uevents, userspace helpers will be enabled to load modules via the module alias associated with a device. This information is required to automatically load HDA codec drivers instead of having to explicitly request the various modules in the HDA core code. [Note that currently the legacy HDA controller driver tries to bind codec modules manually. It's for supporting the fallback generic drivers. This new udev modalias support was added rather for ASoC HDA ext drivers, since this addition itself won't hurt the legacy HDA -- tiwai] [Use the common helper function to generate the modalias -- tiwai] Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - convert to hda_device_idTakashi Iwai14-595/+407
Finally we have a proper infrastructure to generate the modaliases automatically, let's move to hda_device_id from the legacy hda_codec_preset that contains basically the same information. The patch function hook is stored in driver_data field, which is long, and we need an explicit cast. Other than that, the conversion is mostly straightforward. Each entry is even simplified using a macro, and the lengthy (and error-prone) manual modaliases got removed. As a result, we achieved a quite good diet: 14 files changed, 407 insertions(+), 595 deletions(-) Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - Add hdaudio bus modalias supportSubhransu S. Prusty1-0/+8
This patch just adds modalias sysfs entry to each hdaudio bus entry. [rewritten to call the common helper function by tiwai] Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - Add a common helper to give the codec modalias stringTakashi Iwai2-0/+16
This patch provide a new common helper function, snd_hdac_codec_modalias(), to give the codec modalias name string. This function will be used by multiple places in the later patches. Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - Add hduadio support to DEVTABLESubhransu S. Prusty5-11/+32
For generating modalias entries automatically, move the definition of struct hda_device_id to linux/mod_devicetable.h and add the handling of this record in file2alias helper. The new modalias is represented with combination of vendor id, device id, and api version as "hdaudio:vNrNaN". This patch itself doesn't convert the existing modaliases. Since they were added manually, this patch won't give any regression by itself at this point. [Modified the modalias format to adapt the api_version field, and drop invalid ANY_ID definition by tiwai] Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20ALSA: hda - Add api_version to hda_device_id structTakashi Iwai1-0/+1
For distinguishing the difference between HDA legacy and ext codec driver entries, we need to expose the value corresponding to type field. This patch adds a new field, api_version, to hda_device_id struct, so that this information is embedded in modalias string. Although the information is basically redundant (struct hdac_device already has type field), the helper that extracts from MODULE_DEVICE_TABLE() won't take it account except for the exported table entries themselves. So we need to put the same information in the table, too. Reviewed-by: Vinod Koul <vinod.koul@intel.com> Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: firewire-tascam: off by one in identify_model()Dan Carpenter1-1/+1
Let's leave space for the NUL char otherwise the static checkers complain that we go beyond the end of the array. Fixes: 53b3ffee7885 ('ALSA: firewire-tascam: change device probing processing') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: USB-audio: Remove mixer entry from Zoom R16/24 quirkRicard Wanderlof1-7/+0
The device has no mixer (and identifies itself as such), so just skip the mixer definition. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: USB-audio: Adjust max packet size calculation for tx_length_quirkRicard Wanderlof1-2/+10
For the Zoom R16/24 (tx_length_quirk set), when calculating the maximum sample frequency, consideration must be made for the fact that four bytes of the packet contain a length descriptor and consequently must not be counted as part of the audio data. This is corroborated by the wMaxPacketSize for this device, which is 108 bytes according for the USB playback endpoint descriptor. The frame size is 8 bytes (2 channels of 4 bytes each), and the 108 bytes thus work out as 13 * 8 + 4, i.e. corresponding to 13 frames plus the additional 4 byte length descriptor. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: USB-audio: Add quirk for Zoom R16/24 playbackRicard Wanderlof7-9/+61
The Zoom R16/24 have a nonstandard playback format where each isochronous packet contains a length descriptor in the first four bytes. (Curiously, capture data does not contain this and requires no quirk.) The quirk involves adding the extra length descriptor whenever outgoing isochronous packets are generated, both in pcm.c (outgoing audio) and endpoint.c (silent data). In order to make the quirk as unintrusive as possible, for pcm.c:prepare_playback_urb(), the isochronous packet descriptors are initially set up in the same way no matter if the quirk is enabled or not. Once it is time to actually copy the data into the outgoing packet buffer (together with the added length descriptors) the isochronous descriptors are adjusted in order take the increased payload length into account. For endpoint.c:prepare_silent_urb() it makes more sense to modify the actual function, partly because the function is less complex to start with and partly because it is not as time-critical as prepare_playback_urb() (whose bulk is run with interrupts disabled), so the (minute) additional time spent in the non-quirk case is motivated by the simplicity of having a single function for all cases. The quirk is controlled by the new tx_length_quirk member in struct snd_usb_substream and struct snd_usb_audio, which is conveyed to pcm.c and endpoint.c from quirks.c in a similar manner to the txfr_quirk member in the same structs. In contrast to txfr_quirk however, the quirk is enabled directly in quirks.c:create_standard_audio_quirk() by checking the USB ID in that function. Another option would be to introduce a new QUIRK_AUDIO_ZOOM_INTERFACE or somesuch, which would have made the quirk very plain to see in the quirk table, but it was felt that the additional code needed to implement it this way would just make the implementation more complex with no real gain. Tested with a Zoom R16, both by doing capture and playback separately using arecord and aplay (8 channel capture and 2 channel playback, respectively), as well as capture and playback together using Ardour, as well as Audacity and Qtractor together with jackd. The R24 is reportedly compatible with the R16 when used as an audio interface. Both devices share the same USB ID and have the same number of inputs (8) and outputs (2). Therefore "R16/24" is mentioned throughout the patch. Regression tested using an Edirol UA-5 in both class compliant (16-bit) and "advanced" (24 bit, forces the use of quirks) modes. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Tested-by: Panu Matilainen <pmatilai@laiskiainen.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: USB-audio: Add offset parameter to copy_to_urb()Ricard Wanderlof1-6/+6
Preparation for adding Zoom R16/24 quirk. No functional change. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: USB-audio: Break out creation of silent urbs from prepare_outbound_urb()Ricard Wanderlof1-19/+27
Refactoring in preparation for adding Zoom R16/24 quirk. No functional change. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: USB-audio: Also move out hwptr_done wrap from prepare_playback_urb()Ricard Wanderlof1-3/+6
Refactoring in preparation for adding Zoom R16/24 quirk. No functional change. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: USB-audio: Break out copying to urb from prepare_playback_urb()Ricard Wanderlof1-14/+21
Refactoring in preparation for adding Zoom R16/24 quirk. No functional change. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: oxfw: add an entry for TASCAM FireOneTakashi Sakamoto1-0/+17
TASCAM FireOne is based on OXFW971 and ALSA OXFW driver can support it. These are values of identical registers. $ ./firewire-request /dev/fw1 read 0xfffff0050000 result: 97100105 $ ./firewire-request /dev/fw1 read 0xfffff0090020 result: 39373100 This commit adds an entry for this model. This model has physical controls and its MIDI control messages are transferred to second MIDI data stream multiplexed in one MIDI conformant data channel. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: oxfw: support more MIDI portsTakashi Sakamoto1-1/+1
In IEC 61883-6, sequence multiplexing is applied to MIDI conformant data channel. As a result, eight MIDI data streams are included in the channel. Although ALSA AM824 data block processing layer implements this multiplexing, current OXFW driver doesn't utilize it due to wrong calculation of MIDI ports. This commit fixes this bug to add proper calculation. Although this commit allows to use 8 MIDI data streams, the number of available MIDI ports is limited by the number of ALSA MIDI ports added by the driver. Fixes: df075feefbd3('ALSA: firewire-lib: complete AM824 data block processing layer') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: oxfw: calculating MIDI ports in stream discoverTakashi Sakamoto2-22/+37
Current OXFW driver calculates the number of MIDI ports just before adding ALSA MIDI ports. It's convenient for some devices with quirks to move these codes before handling quirks. This commit implements this idea. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: firewire-lib: avoid NULL pointer dereference after closing MIDI portTakashi Sakamoto1-1/+5
When asynchronous MIDI port is closed before callbacked, the callback function causes NULL pointer dereference to missing MIDI substream. This commit fixes this bug. Fixes: e8a40d9bcb23('ALSA: firewire-lib: schedule work again when MIDI substream has rest of MIDI messages') Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: firewire-digi00x/firewire-tascam: remove wrong conversion for Config ROMTakashi Sakamoto2-4/+2
The contents of Config ROM in firewire device structure are already aligned to CPU-endianness. Thus, no need to convert it again. This commit removes needless conversions Fixes: 9edf723fd858('ALSA: firewire-digi00x: add skeleton for Digi 002/003 family') Fixes: c0949b278515('ALSA: firewire-tascam: add skeleton for TASCAM FireWire series') Reported-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: bebob: use correct type for __be32 dataTakashi Sakamoto1-1/+1
In former commit, metering is supported for BeBoB based models customized by M-Audio. The data in transaction is aligned to big-endianness, while in the driver code u16 typed variable is assigned to the data. This causes sparse warnings. bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16 This commit fixes this bug by using __be16 variable for the data. Fixes: 3149ac489ff8('ALSA: bebob: Add support for M-Audio special Firewire series') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: fireworks: use u32 type for be32_to_cpup() macroTakashi Sakamoto1-1/+1
In former commit, snd_efw_command_get_phys_meters() was added to handle metering data. The given buffer is used to save transaction result and to convert between endianness. But this causes sparse warnings. fireworks_command.c:269:25: warning: incorrect type in argument 1 (different base types) fireworks_command.c:269:25: expected unsigned int [usertype] *p fireworks_command.c:269:25: got restricted __be32 [usertype] * This commit fixes this bug. Fixes: bde8a8f23bbe('ALSA: fireworks: Add transaction and some commands') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: dice: assign converted data to the same type of variableTakashi Sakamoto1-1/+2
In former commit, u32 data was assigned to __be32 variable instead of an int variable. This is not enough solution because it still causes sparse warnings. dice.c:80:23: warning: incorrect type in assignment (different base types) dice.c:80:23: expected restricted __be32 [usertype] value dice.c:80:23: got unsigned int dice.c:81:21: warning: restricted __be32 degrades to integer dice.c:81:46: warning: restricted __be32 degrades to integer This commit fixes this bug. Fixes: 7c2d4c0cf5ba('ALSA: dice: Split transaction functionality into a file') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: dice: correct variable types for __be32 dataTakashi Sakamoto1-6/+6
Some local variables in some functions are typed as unsigned int, while __be32 value is assigned to them. This causes sparse warnings. dice-stream.c:50:17: warning: incorrect type in assignment (different base types) dice-stream.c:50:17: expected unsigned int [unsigned] channel dice-stream.c:50:17: got restricted __be32 [usertype] <noident> dice-stream.c:74:17: warning: incorrect type in assignment (different base types) dice-stream.c:74:17: expected unsigned int [unsigned] channel dice-stream.c:74:17: got restricted __be32 [usertype] <noident> This commit fixes this bug. Fixes: 288a8d0cb04f('ALSA: dice: Change the way to start stream') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-18ALSA: oxfw: remove a meaningless entry from firewire MakefileTakashi Sakamoto1-1/+0
A former commit moves oxfw-related codes to a sub-directory, while it forgot to remove an entry from Makefile in parent directory. Fixes: 1a4e39c2e5ca('ALSA: oxfw: Move to its own directory') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-18ALSA: fireworks/bebob/oxfw/dice: enable to make as built-inTakashi Sakamoto4-4/+4
When committed to upstream, these four modules had wrong entries for Makefile. This forces them to be loadable modules even if they're set as built-in. This commit fixes this bug. Fixes: b5b04336015e('ALSA: fireworks: Add skelton for Fireworks based devices') Fixes: fd6f4b0dc167('ALSA: bebob: Add skelton for BeBoB based devices') Fixes: 1a4e39c2e5ca('ALSA: oxfw: Move to its own directory') Fixes: 14ff6a094815('ALSA: dice: Move file to its own directory') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-17ALSA: hda - Remove obsoleted documentationTakashi Iwai1-322/+0
It's totally outdated. We need a revised version later, maybe better integrated into kernel doc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-17ALSA: hda - Remove leftover snd_hda_bus() prototypeTakashi Iwai1-4/+0
It was forgotten to be removed. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-17ALSA: hda - Fix bogus codec address check for mixer name assignmentTakashi Iwai4-4/+4
The recent commit [7fbe824a0f0e: ALSA: hda - Update mixer name for the lower codec address] tried to improve the mixer chip name assignment in the order of codec address. However, this fix was utterly bogus; it checks the field set in each codec, thus this value is reset at each codec creation, of course. For really handling this priority, the assignment has to be remembered in the common place, namely in hda_bus, instead of hda_codec. Fixes: 7fbe824a0f0e ('ALSA: hda - Update mixer name for the lower codec address') Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-17ALSA: firewire-tascam: off by one in handle_midi_tx()Dan Carpenter1-1/+1
My static checker complains because tscm->spec->midi_capture_ports is either 2 or 4 but the tscm->tx_midi_substreams[] array has 4 elements so this is possibly off by one. I have looked at the code and I think it should be >= instead of > as well. Fixes: 107cc0129a68 ('ALSA: firewire-tascam: add support for incoming MIDI messages by asynchronous transaction') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-17ALSA: firewire-tascam: fix an LED bugDan Carpenter1-1/+1
We recently tried to add some new code to support turning the LED on and off but the code in snd_tscm_transaction_reregister() is unreachable. Fixes: e65e2cb99e44 ('ALSA: firewire-tascam: Turn on/off FireWire LED') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-16ALSA: timer: add config item to export PCM timer disabling for expertJie Yang5-23/+39
PCM timer is not always used. For embedded device, we need an interface to disable it when it is not needed, to shrink the kernel size and memory footprint, here add CONFIG_SND_PCM_TIMER for it. When both CONFIG_SND_PCM_TIMER and CONFIG_SND_TIMER is unselected, about 25KB saving bonus we can get. Please be noted that when disabled, those stubs who using pcm timer (e.g. dmix, dsnoop & co) may work incorrectlly. Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jie Yang <yang.jie@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-16ALSA: USB-audio: Add support for Novation Nocturn MIDIcontrol surfaceRicard Wanderlof1-0/+9
The Nocturn needs the MIDI_RAW_BYTES quirk, like other Novation devices. Tested that the Nocturn shows up in aconnect, and that it can be used as a control surface (using the xtor synthesizer patch editor). Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-15ALSA: hda - Update mixer name for the lower codec addressTakashi Iwai3-1/+5
In most cases, we prefer the onboard codec as the primary device, thus it's better to set it as the mixer name. Currently, however, the mixer name is updated per the device instantiation order, and user gets often HDMI/DP or other seen as a mixer chip name. Also, if a codec name is renamed by the driver, the old chip name might be left still as the mixer name. This patch addresses these issues by remembering the chip address that was referred as the mixer name. When a codec with the same or lower address gives its name, renew the mixer name accordingly, as it's either the update of the codec name or we get likely the more appropriate chip as the reference. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-15ALSA: hda - consolidate chip rename functionsTakashi Iwai7-39/+54
A few multiple codec drivers do renaming the chip_name string but all these are open-coded and some of them have even no error check. Let's make common helpers to do it properly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-15ALSA: hda - Enable widget power saving for Cirrus codecsTakashi Iwai1-0/+1
Cirrus codecs have also fine power controls on each widget, thus it gets benefit from the recent widget power-saving feature. As we haven't seen any obvious regressions with tests on some MacBooks, let's try to enable it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-15ALSA: hdspm: use __u8, __u32 and __u64 from linux/types.h instead of stdint.hMikko Rapeli1-22/+18
Kernel headers should use linux/types.h based definitions. Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-15ALSA: emu10k1: added EMU10K1 version of DECLARE_BITMAP macro for UAPIMikko Rapeli1-3/+11
Fixes userspace compilation error: error: expected specifier-qualifier-list before ‘DECLARE_BITMAP’ DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ DECLARE_BITMAP macro is not meant for userspace headers and thus added here as private copy for emu10k.h. Fix was suggested by Arnd Bergmann <arnd@arndb.de> in message <2168807.4Yxh5gl11Q@wuerfel> and Takashi Iwai <tiwai@suse.de> in message <s5h1thx88tk.wl-tiwai@suse.de> on lkml. Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-15ALSA: oss: underflow in snd_mixer_oss_proc_write()Dan Carpenter1-1/+2
We cap the upper bound of "idx" but not the negative side. Let's make it unsigned to fix this. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-13ALSA: usb-audio: Fix max packet size calculation for USB audioRicard Wanderlof1-2/+17
Rounding must take place before multiplication with the frame size, since each packet contains a whole number of frames. We must also properly consider the data interval, as a larger data interval will result in larger packets, which, depending on the sampling frequency, can result in packet sizes that are less than integral multiples of the packet size for a lower data interval. Detailed explanation and rationale: The code before this commit had the following expression on line 613 to calculate the maximum isochronous packet size: maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) >> (16 - ep->datainterval); Here, ep->freqmax is the maximum assumed sample frequency, calculated from the nominal sample frequency plus 25%. It is ultimately derived from ep->freqn, which is in the units of frames per packet, from get_usb_full_speed_rate() or usb_high_speed_rate(), as applicable, in Q16.16 format. The expression essentially adds the Q16.16 equivalent of 0.999... (i.e. the largest number less than one) to the sample rate, in order to get a rate whose integer part is rounded up from the fractional value. The multiplication with (frame_bits >> 3) yields the number of bytes in a packet, and the (16 >> ep->datainterval) then converts it from Q16.16 back to an integer, taking into consideration the bDataInterval field of the endpoint descriptor (which describes how often isochronous packets are transmitted relative to the (micro)frame rate (125us or 1ms, for USB high speed and full speed, respectively)). For this discussion we will initially assume a bDataInterval of 0, so the second line of the expression just converts the Q16.16 value to an integer. In order to illustrate the problem, we will set frame_bits 64, which corresponds to a frame size of 8 bytes. The problem here is twofold. First, the rounding operation consists of the addition of 0x0.ffff and subsequent conversion to integer, but as the expression stands, the conversion to integer is done after multiplication with the frame size, rather than before. This results in the resulting maxsize becoming too large. Let's take an example. We have a sample rate of 96 kHz, so our ep->freqn is 0xc0000 (see usb_high_speed_rate()). Add 25% (line 612) and we get 0xf0000. The calculated maxsize is then ((0xf0000 + 0x0ffff) * 8) >> 16 = 127 . However, if we do the number of bytes calculation in a less obscure way it's more apparent what the true corresponding packet size is: we get ceil(96000 * 1.25 / 8000) * 8 = 120, where 1.25 is the 25% from line 612, and the 8000 is the number of isochronous packets per second on a high speed USB connection (125 us microframe interval). This is fixed by performing the complete rounding operation prior to multiplication with the frame rate. The second problem is that when considering the ep->datainterval, this must be done before rounding, in order to take the advantage of the fact that if the number of bytes per packet is not an integer, the resulting rounded-up integer is not necessarily a factor of two when the data interval is increased by the same factor. For instance, assuming a freqency of 41 kHz, the resulting bytes-per-packet value for USB high speed is 41 kHz / 8000 = 5.125, or 0x52000 in Q16.16 format. With a data interval of 1 (ep->datainterval = 0), this means that 6 frames per packet are needed, whereas with a data interval of 2 we need 10.25, i.e. 11 frames needed. Rephrasing the maxsize expression to: maxsize = (((ep->freqmax << ep->datainterval) + 0xffff) >> 16) * (frame_bits >> 3); for the above 96 kHz example we instead get ((0xf0000 + 0xffff) >> 16) * 8 = 120 which is the correct value. We can also do the calculation with a non-integer sample rate which is when rounding comes into effect: say we have 44.1 kHz (resulting ep->freqn = 0x58333, and resulting ep->freqmax 0x58333 * 1.25 = 0x6e3ff (rounded down)): Original maxsize = ((0x6e3ff + 0xffff) * 8) << 16 = 63 (63.124.. rounded down) True maxsize = ceil(44100 * 1.25 / 8000) * 8 = 7 * 8 = 56 New maxsize = ((0x6e3ff + 0xffff) >> 16) * 8 = 7 * 8 = 56 This is also corroborated by the wMaxPacketSize check on line 616. Assume that wMaxPacketSize = 104, with ep->maxpacksize then having the same value. As 104 < 127, we get maxsize = 104. ep->freqmax is then recalculated to (104 / 8) << 16 = 0xd0000 . Putting that rate into the original maxsize calculation yields a maxsize of ((0xd0000 + 0xffff) * 8) >> 16 = 111 (with decimals 111.99988). Clearly, we should get back the 104 here, which we would with the new expression: ((0xd0000 + 0xffff) >> 16) * 8 = 104 . (The error has not been a problem because it only results in maxsize being a bit too big which just wastes a couple of bytes, either as a result of the first maxsize calculation, or because the resulting calculation will hit the wMaxPacketSize value before the packet is too big, resulting in fixing the size to wMaxPacketSize even though the packet is actually not too long.) Tested with an Edirol UA-5 both at 44.1 kHz and 96 kHz. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-13ALSA: hda - Fix inverted internal mic on Lenovo G50-80David Henningsson1-0/+1
Add the appropriate quirk to indicate the Lenovo G50-80 has a stereo mic input where one channel has reverse polarity. Alsa-info available at: https://launchpadlibrarian.net/220846272/AlsaInfo.txt Cc: stable@vger.kernel.org BugLink: https://bugs.launchpad.net/bugs/1504778 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-13ALSA: hdac: Explicitly add io.hVinod Koul1-0/+1
Compiling the hdac extended core on arm fails with below error: sound/hda/ext/hdac_ext_bus.c: In function 'hdac_ext_writel': >> sound/hda/ext/hdac_ext_bus.c:29:2: error: implicit declaration of >> function +'writel' [-Werror=implicit-function-declaration] writel(value, addr); ^ sound/hda/ext/hdac_ext_bus.c: In function 'hdac_ext_readl': >> sound/hda/ext/hdac_ext_bus.c:34:2: error: implicit declaration of >> function +'readl' [-Werror=implicit-function-declaration] return readl(addr); This is fixed by explicitly including io.h Fixes: 99463b3a3994 - ('ALSA: hda: provide default bus io ops extended hdac') Reported-by: kbuild test robot <lkp@intel.com> Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-12ALSA: firewire-tascam: change device probing processingTakashi Sakamoto1-46/+32
Currently, this driver picks up model name with be32_to_cpu() macro to align characters. This is wrong operation because the result is different depending on CPU endiannness. Additionally, vendor released several versions of firmware for this series. It's not better to assign model-dependent information to device entry according to the version field. This commit fixes these bugs. The name of model is picked up correctly and used to identify model-dependent information. Cc: Stefan Richter <stefanr@s5r6.in-berlin.de> Fixes: c0949b278515 ('ALSA: firewire-tascam: add skeleton for TASCAM FireWire series') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-12ALSA: firewire-tascam: Turn on/off FireWire LEDTakashi Sakamoto2-0/+16
TASCAM FireWire series has some LEDs on its surface. These LEDs can be turned on/off by receiving asynchronous transactions to a certain address. One of the LEDs is labels as 'FireWire'. It's better to light it up when this driver starts to work. Besides, the LED for 'FireWire' is turned off at bus reset. This commit implements this idea. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-12ALSA: firewire-tascam: add support for MIDI functionalityTakashi Sakamoto4-1/+142
In former commits, this driver got functionalities to transfer/receive MIDI messages to/from TASCAM FireWire series. This commit adds some ALSA MIDI ports to enable userspace applications to use the functionalities. I note that this commit doesn't support virtual MIDI ports which console models support. A physical controls can be assigned to a certain MIDI ports including physical and virtual. But the way is not clear. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-12ALSA: firewire-tascam: add support for outgoing MIDI messages by asynchronous transactionTakashi Sakamoto2-1/+102
TASCAM FireWire series use asynchronous transaction to receive MIDI messages. The transaction should be sent to a certain address. This commit supports the outgoing MIDI messages. The messages in the transaction includes some quirks: * One MIDI message is transferred in one quadlet transaction, except for system exclusives. * MIDI running status is not allowed, thus transactions always include status byte. * The basic data format is the same as transferring MIDI messages supported in previous commit. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-12ALSA: firewire-tascam: add support for incoming MIDI messages by asynchronous transactionTakashi Sakamoto4-1/+213
TASCAM FireWire series use asynchronous transaction to transfer MIDI messages. The transaction is sent to a registered address. This commit supports the incoming MIDI messages. The messages in the transaction include some quirks: * Two quadlets are used for one MIDI message and one timestamp. * Usually, the first byte of the first quadlet includes MIDI port and MSB 4 bit of MIDI status. For system exclusive message, the first byte includes MIDI port and 0x04, or 0x07 in the end of the message. * The rest of the first quadlet includes MIDI bytes up to 3. * Several set of MIDI messages and timestamp can be transferred in one block transaction, up to 8 sets. I note that TASCAM FireWire series ignores ID bytes of system exclusive message. When receiving system exclusive messages with ID bytes on physical MIDI bus, the series transfers the messages without ID bytes on IEEE 1394 bus, and vice versa. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-11ALSA: firewire-digi00x: add support for MIDI ports for physical controlsTakashi Sakamoto1-16/+45
In former commits, asynchronous transactions are supported for physical controls. This commit adds a pair of MIDI ports for them. This driver already adds diferrent number of ALSA MIDI ports for physical MIDI ports, and the number of in/out ports are different. As seeing as 'amidi' program in alsa-utils package, a pair of in/out MIDI ports is expected with the same name. Therefore, this commit adds a pair of new ports to the first. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-11ALSA: firewire-digi00x: add support of asynchronous transaction for outgoing MIDI messages to physical controlsTakashi Sakamoto2-4/+26
In previous commit, asynchronous transaction for incoming MIDI messages from physical controls is supported. The physical controls may be controlled by receiving MIDI messages at a certain address. This commit supports asynchronous transaction for this purpose. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-11ALSA: firewire-digi00x: add support of asynchronous transaction for incoming MIDI messages from physical controlsTakashi Sakamoto2-3/+41
Digi 00x series has two types of model; rack and console. The console models have physical controls. The model can transmit control messages. These control messages are transferred by asynchronous transactions to registered address. This commit supports the asynchronous transaction. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-11ALSA: firewire-digi00x: add support for MIDI ports corresponding to isochronous packet streamingTakashi Sakamoto5-1/+140
This commit adds MIDI functionality to capture/playback MIDI messages from/to physical MIDI ports. These messages are transferred in isochronous packets. When no substreams request AMDTP streams to run, this driver starts the streams at current sampling rate. When other substreams start at different sampling rate, the streams are stopped temporarily, then start again at requested sampling rate. This operation can generate missing MIDI bytes, thus it's preferable to start PCM substreams at favorite sampling rate in advance. Digi 002/003 console also has a set of MIDI port for physical controls. These ports are added in later commits. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>