diff --git a/[refs] b/[refs] index 0cc895eea7aa..b262e21bd025 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a98d3984c85222aa9efc63c4f9dd3d805ce469f2 +refs/heads/master: a39e33eb2a9d6afa79021ba1de2aa7d1039f4e53 diff --git a/trunk/include/linux/usb/audio-v2.h b/trunk/include/linux/usb/audio-v2.h index 92f1d99f0f17..2389f93a28b5 100644 --- a/trunk/include/linux/usb/audio-v2.h +++ b/trunk/include/linux/usb/audio-v2.h @@ -105,22 +105,6 @@ struct uac_as_header_descriptor_v2 { __u8 iChannelNames; } __attribute__((packed)); -/* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */ - -struct uac2_iso_endpoint_descriptor { - __u8 bLength; /* in bytes: 8 */ - __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ - __u8 bDescriptorSubtype; /* EP_GENERAL */ - __u8 bmAttributes; - __u8 bmControls; - __u8 bLockDelayUnits; - __le16 wLockDelay; -} __attribute__((packed)); - -#define UAC2_CONTROL_PITCH (3 << 0) -#define UAC2_CONTROL_DATA_OVERRUN (3 << 2) -#define UAC2_CONTROL_DATA_UNDERRUN (3 << 4) - /* 6.1 Interrupt Data Message */ #define UAC2_INTERRUPT_DATA_MSG_VENDOR (1 << 0) diff --git a/trunk/sound/core/pcm_lib.c b/trunk/sound/core/pcm_lib.c index e9d98be190c5..a2ff86189d2a 100644 --- a/trunk/sound/core/pcm_lib.c +++ b/trunk/sound/core/pcm_lib.c @@ -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]; @@ -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; diff --git a/trunk/sound/core/pcm_native.c b/trunk/sound/core/pcm_native.c index 303ac04ff6e4..644c2bb17b86 100644 --- a/trunk/sound/core/pcm_native.c +++ b/trunk/sound/core/pcm_native.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -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) { @@ -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; diff --git a/trunk/sound/mips/au1x00.c b/trunk/sound/mips/au1x00.c index 446cf9748664..3e763d6a5d67 100644 --- a/trunk/sound/mips/au1x00.c +++ b/trunk/sound/mips/au1x00.c @@ -516,7 +516,6 @@ get the interrupt driven case to work efficiently */ break; if (i == 0x5000) { printk(KERN_ERR "au1000 AC97: AC97 command read timeout\n"); - spin_unlock(&au1000->ac97_lock); return 0; } diff --git a/trunk/sound/oss/dmasound/dmasound_atari.c b/trunk/sound/oss/dmasound/dmasound_atari.c index 13c214466d3b..1f4774123064 100644 --- a/trunk/sound/oss/dmasound/dmasound_atari.c +++ b/trunk/sound/oss/dmasound/dmasound_atari.c @@ -1277,7 +1277,7 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy) * (almost) like on the TT. */ write_sq_ignore_int = 0; - goto out; + return IRQ_HANDLED; } if (!write_sq.active) { @@ -1285,7 +1285,7 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy) * the sq variables, so better don't do anything here. */ WAKE_UP(write_sq.sync_queue); - goto out; + return IRQ_HANDLED; } /* Probably ;) one frame is finished. Well, in fact it may be that a @@ -1322,7 +1322,6 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy) /* We are not playing after AtaPlay(), so there is nothing to play any more. Wake up a process waiting for audio output to drain. */ -out: spin_unlock(&dmasound.lock); return IRQ_HANDLED; } diff --git a/trunk/sound/pci/asihpi/hpi.h b/trunk/sound/pci/asihpi/hpi.h index 0173bbe62b67..99400de6c075 100644 --- a/trunk/sound/pci/asihpi/hpi.h +++ b/trunk/sound/pci/asihpi/hpi.h @@ -50,7 +50,7 @@ i.e 3.05.02 is a development version #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) /* Use single digits for versions less that 10 to avoid octal. */ -#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 25) +#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 18) /* Library version as documented in hpi-api-versions.txt */ #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) @@ -1632,12 +1632,6 @@ u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys, u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *pquality); -u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, - u32 h_control, u32 *pblend); - -u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, - u32 h_control, const u32 blend); - /****************************/ /* PADs control */ /****************************/ diff --git a/trunk/sound/pci/asihpi/hpi6000.c b/trunk/sound/pci/asihpi/hpi6000.c index 12dab5e4892c..839ecb2e4b64 100644 --- a/trunk/sound/pci/asihpi/hpi6000.c +++ b/trunk/sound/pci/asihpi/hpi6000.c @@ -691,6 +691,9 @@ static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, case 0x6200: boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x6200); break; + case 0x8800: + boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x8800); + break; default: return HPI6000_ERROR_UNHANDLED_SUBSYS_ID; } @@ -1772,6 +1775,7 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm, u16 error = 0; u16 dsp_index = 0; u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp; + hpios_dsplock_lock(pao); if (num_dsp < 2) dsp_index = 0; @@ -1792,8 +1796,6 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm, } } } - - hpios_dsplock_lock(pao); error = hpi6000_message_response_sequence(pao, dsp_index, phm, phr); /* maybe an error response */ diff --git a/trunk/sound/pci/asihpi/hpi6205.c b/trunk/sound/pci/asihpi/hpi6205.c index e89991ea3543..5e88c1fc2b9e 100644 --- a/trunk/sound/pci/asihpi/hpi6205.c +++ b/trunk/sound/pci/asihpi/hpi6205.c @@ -965,17 +965,24 @@ static void outstream_write(struct hpi_adapter_obj *pao, hpi_init_response(phr, phm->object, phm->function, 0); status = &interface->outstream_host_buffer_status[phm->obj_index]; + if (phw->flag_outstream_just_reset[phm->obj_index]) { + /* Format can only change after reset. Must tell DSP. */ + u16 function = phm->function; + phw->flag_outstream_just_reset[phm->obj_index] = 0; + phm->function = HPI_OSTREAM_SET_FORMAT; + hw_message(pao, phm, phr); /* send the format to the DSP */ + phm->function = function; + if (phr->error) + return; + } +#if 1 if (phw->flag_outstream_just_reset[phm->obj_index]) { /* First OutStremWrite() call following reset will write data to the - adapter's buffers, reducing delay before stream can start. The DSP - takes care of setting the stream data format using format information - embedded in phm. + adapter's buffers, reducing delay before stream can start */ int partial_write = 0; unsigned int original_size = 0; - phw->flag_outstream_just_reset[phm->obj_index] = 0; - /* Send the first buffer to the DSP the old way. */ /* Limit size of first transfer - */ /* expect that this will not usually be triggered. */ @@ -1005,6 +1012,7 @@ static void outstream_write(struct hpi_adapter_obj *pao, original_size - HPI6205_SIZEOF_DATA; phm->u.d.u.data.pb_data += HPI6205_SIZEOF_DATA; } +#endif space_available = outstream_get_space_available(status); if (space_available < (long)phm->u.d.u.data.data_size) { @@ -1361,9 +1369,6 @@ static u16 adapter_boot_load_dsp(struct hpi_adapter_obj *pao, case HPI_ADAPTER_FAMILY_ASI(0x6500): firmware_id = HPI_ADAPTER_FAMILY_ASI(0x6600); break; - case HPI_ADAPTER_FAMILY_ASI(0x8800): - firmware_id = HPI_ADAPTER_FAMILY_ASI(0x8900); - break; } boot_code_id[1] = firmware_id; diff --git a/trunk/sound/pci/asihpi/hpi_internal.h b/trunk/sound/pci/asihpi/hpi_internal.h index fdd0ce02aa68..f1cd6f1a0d44 100644 --- a/trunk/sound/pci/asihpi/hpi_internal.h +++ b/trunk/sound/pci/asihpi/hpi_internal.h @@ -232,8 +232,6 @@ enum HPI_BUSES { #define HPI_TUNER_HDRADIO_SDK_VERSION HPI_CTL_ATTR(TUNER, 13) /** HD Radio DSP firmware version. */ #define HPI_TUNER_HDRADIO_DSP_VERSION HPI_CTL_ATTR(TUNER, 14) -/** HD Radio signal blend (force analog, or automatic). */ -#define HPI_TUNER_HDRADIO_BLEND HPI_CTL_ATTR(TUNER, 15) /** \} */ @@ -480,10 +478,8 @@ Threshold is a -ve number in units of dB/100, /** First 2 hex digits define the adapter family */ #define HPI_ADAPTER_FAMILY_MASK 0xff00 -#define HPI_MODULE_FAMILY_MASK 0xfff0 #define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK) -#define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK) #define HPI_ADAPTER_ASI(f) (f) /******************************************* message types */ @@ -974,7 +970,6 @@ struct hpi_control_union_msg { u32 mode; u32 value; } mode; - u32 blend; } tuner; } u; }; diff --git a/trunk/sound/pci/asihpi/hpicmn.c b/trunk/sound/pci/asihpi/hpicmn.c index fcd64539d9ef..565102cae4f8 100644 --- a/trunk/sound/pci/asihpi/hpicmn.c +++ b/trunk/sound/pci/asihpi/hpicmn.c @@ -347,15 +347,20 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, found = 0; break; case HPI_CONTROL_TUNER: - if (phm->u.c.attribute == HPI_TUNER_FREQ) - phr->u.c.param1 = pC->u.t.freq_ink_hz; - else if (phm->u.c.attribute == HPI_TUNER_BAND) - phr->u.c.param1 = pC->u.t.band; - else if ((phm->u.c.attribute == HPI_TUNER_LEVEL) - && (phm->u.c.param1 == HPI_TUNER_LEVEL_AVERAGE)) - phr->u.c.param1 = pC->u.t.level; - else - found = 0; + { + struct hpi_control_cache_single *pCT = + (struct hpi_control_cache_single *)pI; + if (phm->u.c.attribute == HPI_TUNER_FREQ) + phr->u.c.param1 = pCT->u.t.freq_ink_hz; + else if (phm->u.c.attribute == HPI_TUNER_BAND) + phr->u.c.param1 = pCT->u.t.band; + else if ((phm->u.c.attribute == HPI_TUNER_LEVEL) + && (phm->u.c.param1 == + HPI_TUNER_LEVEL_AVERAGE)) + phr->u.c.param1 = pCT->u.t.level; + else + found = 0; + } break; case HPI_CONTROL_AESEBU_RECEIVER: if (phm->u.c.attribute == HPI_AESEBURX_ERRORSTATUS) @@ -498,9 +503,6 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache, struct hpi_control_cache_single *pC; struct hpi_control_cache_info *pI; - if (phr->error) - return; - if (!find_control(phm, p_cache, &pI, &control_index)) return; @@ -518,6 +520,8 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache, break; case HPI_CONTROL_MULTIPLEXER: /* mux does not return its setting on Set command. */ + if (phr->error) + return; if (phm->u.c.attribute == HPI_MULTIPLEXER_SOURCE) { pC->u.x.source_node_type = (u16)phm->u.c.param1; pC->u.x.source_node_index = (u16)phm->u.c.param2; @@ -525,6 +529,8 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache, break; case HPI_CONTROL_CHANNEL_MODE: /* mode does not return its setting on Set command. */ + if (phr->error) + return; if (phm->u.c.attribute == HPI_CHANNEL_MODE_MODE) pC->u.m.mode = (u16)phm->u.c.param1; break; @@ -539,14 +545,20 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache, pC->u.phantom_power.state = (u16)phm->u.c.param1; break; case HPI_CONTROL_AESEBU_TRANSMITTER: + if (phr->error) + return; if (phm->u.c.attribute == HPI_AESEBUTX_FORMAT) pC->u.aes3tx.format = phm->u.c.param1; break; case HPI_CONTROL_AESEBU_RECEIVER: + if (phr->error) + return; if (phm->u.c.attribute == HPI_AESEBURX_FORMAT) pC->u.aes3rx.source = phm->u.c.param1; break; case HPI_CONTROL_SAMPLECLOCK: + if (phr->error) + return; if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE) pC->u.clk.source = (u16)phm->u.c.param1; else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE_INDEX) @@ -578,7 +590,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 void hpi_free_control_cache(struct hpi_control_cache *p_cache) { - if (p_cache->init) { + if ((p_cache->init) && (p_cache->p_info)) { kfree(p_cache->p_info); p_cache->p_info = NULL; p_cache->init = 0; diff --git a/trunk/sound/pci/asihpi/hpifunc.c b/trunk/sound/pci/asihpi/hpifunc.c index 298eef3e20e9..eda26b312324 100644 --- a/trunk/sound/pci/asihpi/hpifunc.c +++ b/trunk/sound/pci/asihpi/hpifunc.c @@ -2946,20 +2946,6 @@ u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys, HPI_TUNER_HDRADIO_SIGNAL_QUALITY, 0, 0, pquality, NULL); } -u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, - u32 h_control, u32 *pblend) -{ - return hpi_control_param_get(ph_subsys, h_control, - HPI_TUNER_HDRADIO_BLEND, 0, 0, pblend, NULL); -} - -u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, - u32 h_control, const u32 blend) -{ - return hpi_control_param_set(ph_subsys, h_control, - HPI_TUNER_HDRADIO_BLEND, blend, 0); -} - u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control, char *p_data) { @@ -3280,7 +3266,8 @@ u16 hpi_entity_find_next(struct hpi_entity *container_entity, void hpi_entity_free(struct hpi_entity *entity) { - kfree(entity); + if (entity != NULL) + kfree(entity); } static u16 hpi_entity_alloc_and_copy(struct hpi_entity *src, diff --git a/trunk/sound/pci/asihpi/hpios.c b/trunk/sound/pci/asihpi/hpios.c index 742ee12a9e17..de615cfdb950 100644 --- a/trunk/sound/pci/asihpi/hpios.c +++ b/trunk/sound/pci/asihpi/hpios.c @@ -89,3 +89,26 @@ u16 hpios_locked_mem_free(struct consistent_dma_area *p_mem_area) void hpios_locked_mem_free_all(void) { } + +void __iomem *hpios_map_io(struct pci_dev *pci_dev, int idx, + unsigned int length) +{ + HPI_DEBUG_LOG(DEBUG, "mapping %d %s %08llx-%08llx %04llx len 0x%x\n", + idx, pci_dev->resource[idx].name, + (unsigned long long)pci_resource_start(pci_dev, idx), + (unsigned long long)pci_resource_end(pci_dev, idx), + (unsigned long long)pci_resource_flags(pci_dev, idx), length); + + if (!(pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM)) { + HPI_DEBUG_LOG(ERROR, "not an io memory resource\n"); + return NULL; + } + + if (length > pci_resource_len(pci_dev, idx)) { + HPI_DEBUG_LOG(ERROR, "resource too small for requested %d \n", + length); + return NULL; + } + + return ioremap(pci_resource_start(pci_dev, idx), length); +} diff --git a/trunk/sound/pci/asihpi/hpios.h b/trunk/sound/pci/asihpi/hpios.h index 370f39b43f85..a62c3f1e5f09 100644 --- a/trunk/sound/pci/asihpi/hpios.h +++ b/trunk/sound/pci/asihpi/hpios.h @@ -166,4 +166,13 @@ struct hpi_adapter { void __iomem *ap_remapped_mem_base[HPI_MAX_ADAPTER_MEM_SPACES]; }; +static inline void hpios_unmap_io(void __iomem *addr, + unsigned long size) +{ + iounmap(addr); +} + +void __iomem *hpios_map_io(struct pci_dev *pci_dev, int idx, + unsigned int length); + #endif diff --git a/trunk/sound/pci/aw2/aw2-alsa.c b/trunk/sound/pci/aw2/aw2-alsa.c index c15002242d98..67921f93a41e 100644 --- a/trunk/sound/pci/aw2/aw2-alsa.c +++ b/trunk/sound/pci/aw2/aw2-alsa.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -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 @@ -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} }; @@ -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; } @@ -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; } diff --git a/trunk/sound/pci/emu10k1/emufx.c b/trunk/sound/pci/emu10k1/emufx.c index 7a9401462c1c..4b302d86f5f2 100644 --- a/trunk/sound/pci/emu10k1/emufx.c +++ b/trunk/sound/pci/emu10k1/emufx.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -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 */ @@ -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 @@ -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 @@ -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 diff --git a/trunk/sound/pci/hda/patch_conexant.c b/trunk/sound/pci/hda/patch_conexant.c index e863649d31f5..f4a2bd621663 100644 --- a/trunk/sound/pci/hda/patch_conexant.c +++ b/trunk/sound/pci/hda/patch_conexant.c @@ -2975,6 +2975,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), + SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), SND_PCI_QUIRK(0x17aa, 0x3a0d, "ideapad", CXT5066_IDEAPAD), SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), {} diff --git a/trunk/sound/soc/codecs/wm8350.c b/trunk/sound/soc/codecs/wm8350.c index 0221ca79b3ae..8ae20208e7be 100644 --- a/trunk/sound/soc/codecs/wm8350.c +++ b/trunk/sound/soc/codecs/wm8350.c @@ -426,8 +426,8 @@ static const struct soc_enum wm8350_enum[] = { SOC_ENUM_SINGLE(WM8350_INPUT_MIXER_VOLUME, 15, 2, wm8350_lr), }; -static DECLARE_TLV_DB_SCALE(pre_amp_tlv, -1200, 3525, 0); -static DECLARE_TLV_DB_SCALE(out_pga_tlv, -5700, 600, 0); +static DECLARE_TLV_DB_LINEAR(pre_amp_tlv, -1200, 3525); +static DECLARE_TLV_DB_LINEAR(out_pga_tlv, -5700, 600); static DECLARE_TLV_DB_SCALE(dac_pcm_tlv, -7163, 36, 1); static DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -12700, 50, 1); static DECLARE_TLV_DB_SCALE(out_mix_tlv, -1500, 300, 1); diff --git a/trunk/sound/soc/codecs/wm8400.c b/trunk/sound/soc/codecs/wm8400.c index 8f294066b0ed..7f5d080536a0 100644 --- a/trunk/sound/soc/codecs/wm8400.c +++ b/trunk/sound/soc/codecs/wm8400.c @@ -107,21 +107,21 @@ static void wm8400_codec_reset(struct snd_soc_codec *codec) wm8400_reset_codec_reg_cache(wm8400->wm8400); } -static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 600, 0); +static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -1500, 600); -static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0); +static const DECLARE_TLV_DB_LINEAR(in_pga_tlv, -1650, 3000); -static const DECLARE_TLV_DB_SCALE(out_mix_tlv, -2100, 0, 0); +static const DECLARE_TLV_DB_LINEAR(out_mix_tlv, -2100, 0); -static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0); +static const DECLARE_TLV_DB_LINEAR(out_pga_tlv, -7300, 600); -static const DECLARE_TLV_DB_SCALE(out_omix_tlv, -600, 0, 0); +static const DECLARE_TLV_DB_LINEAR(out_omix_tlv, -600, 0); -static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0); +static const DECLARE_TLV_DB_LINEAR(out_dac_tlv, -7163, 0); -static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0); +static const DECLARE_TLV_DB_LINEAR(in_adc_tlv, -7163, 1763); -static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0); +static const DECLARE_TLV_DB_LINEAR(out_sidetone_tlv, -3600, 0); static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -440,7 +440,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w, /* INMIX dB values */ static const unsigned int in_mix_tlv[] = { TLV_DB_RANGE_HEAD(1), - 0,7, TLV_DB_SCALE_ITEM(-1200, 600, 0), + 0,7, TLV_DB_LINEAR_ITEM(-1200, 600), }; /* Left In PGA Connections */ diff --git a/trunk/sound/soc/codecs/wm8990.c b/trunk/sound/soc/codecs/wm8990.c index c018772cc430..7b536d923ea9 100644 --- a/trunk/sound/soc/codecs/wm8990.c +++ b/trunk/sound/soc/codecs/wm8990.c @@ -111,21 +111,21 @@ static const u16 wm8990_reg[] = { #define wm8990_reset(c) snd_soc_write(c, WM8990_RESET, 0) -static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 600, 0); +static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -1500, 600); -static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0); +static const DECLARE_TLV_DB_LINEAR(in_pga_tlv, -1650, 3000); -static const DECLARE_TLV_DB_SCALE(out_mix_tlv, 0, -2100, 0); +static const DECLARE_TLV_DB_LINEAR(out_mix_tlv, 0, -2100); -static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0); +static const DECLARE_TLV_DB_LINEAR(out_pga_tlv, -7300, 600); -static const DECLARE_TLV_DB_SCALE(out_omix_tlv, -600, 0, 0); +static const DECLARE_TLV_DB_LINEAR(out_omix_tlv, -600, 0); -static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0); +static const DECLARE_TLV_DB_LINEAR(out_dac_tlv, -7163, 0); -static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0); +static const DECLARE_TLV_DB_LINEAR(in_adc_tlv, -7163, 1763); -static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0); +static const DECLARE_TLV_DB_LINEAR(out_sidetone_tlv, -3600, 0); static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -451,7 +451,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, /* INMIX dB values */ static const unsigned int in_mix_tlv[] = { TLV_DB_RANGE_HEAD(1), - 0, 7, TLV_DB_SCALE_ITEM(-1200, 600, 0), + 0, 7, TLV_DB_LINEAR_ITEM(-1200, 600), }; /* Left In PGA Connections */ diff --git a/trunk/sound/soc/imx/imx-pcm-dma-mx2.c b/trunk/sound/soc/imx/imx-pcm-dma-mx2.c index 05f19c9284f4..2b31ac673ea4 100644 --- a/trunk/sound/soc/imx/imx-pcm-dma-mx2.c +++ b/trunk/sound/soc/imx/imx-pcm-dma-mx2.c @@ -73,8 +73,7 @@ static void snd_imx_dma_err_callback(int channel, void *data, int err) { struct snd_pcm_substream *substream = data; struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct imx_pcm_dma_params *dma_params = - snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); + struct imx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; struct snd_pcm_runtime *runtime = substream->runtime; struct imx_pcm_runtime_data *iprtd = runtime->private_data; int ret; @@ -103,7 +102,7 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) struct imx_pcm_runtime_data *iprtd = runtime->private_data; int ret; - dma_params = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); + dma_params = snd_soc_get_dma_data(rtd->dai->cpu_dai, substream); iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); if (iprtd->dma < 0) { @@ -213,7 +212,7 @@ static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) struct imx_pcm_runtime_data *iprtd = runtime->private_data; int err; - dma_params = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); + dma_params = snd_soc_get_dma_data(rtd->dai->cpu_dai, substream); iprtd->substream = substream; iprtd->buf = (unsigned int *)substream->dma_buffer.area; diff --git a/trunk/sound/soc/sh/siu_dai.c b/trunk/sound/soc/sh/siu_dai.c index eeed5edd722b..d86ee1bfc03a 100644 --- a/trunk/sound/soc/sh/siu_dai.c +++ b/trunk/sound/soc/sh/siu_dai.c @@ -588,8 +588,6 @@ static int siu_dai_prepare(struct snd_pcm_substream *substream, ret = siu_dai_spbstart(port_info); if (ret < 0) goto fail; - } else { - ret = 0; } port_info->play_cap |= self; diff --git a/trunk/sound/usb/caiaq/control.c b/trunk/sound/usb/caiaq/control.c index 91c804cd2782..36ed703a7416 100644 --- a/trunk/sound/usb/caiaq/control.c +++ b/trunk/sound/usb/caiaq/control.c @@ -42,9 +42,8 @@ static int control_info(struct snd_kcontrol *kcontrol, switch (dev->chip.usb_id) { case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): - case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): if (pos == 0) { - /* current input mode of A8DJ and A4DJ */ + /* current input mode of A8DJ */ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->value.integer.min = 0; uinfo->value.integer.max = 2; @@ -52,6 +51,16 @@ static int control_info(struct snd_kcontrol *kcontrol, } break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + if (pos == 0) { + /* current input mode of A4DJ */ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 1; + return 0; + } + break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): maxval = 127; break; @@ -77,6 +86,14 @@ static int control_get(struct snd_kcontrol *kcontrol, struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); int pos = kcontrol->private_value; + if (dev->chip.usb_id == + USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { + /* A4DJ has only one control */ + /* do not expose hardware input mode 0 */ + ucontrol->value.integer.value[0] = dev->control_state[0] - 1; + return 0; + } + if (pos & CNT_INTVAL) ucontrol->value.integer.value[0] = dev->control_state[pos & ~CNT_INTVAL]; @@ -95,9 +112,20 @@ static int control_put(struct snd_kcontrol *kcontrol, int pos = kcontrol->private_value; unsigned char cmd = EP1_CMD_WRITE_IO; - if (dev->chip.usb_id == - USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1)) + switch (dev->chip.usb_id) { + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): { + /* A4DJ has only one control */ + /* do not expose hardware input mode 0 */ + dev->control_state[0] = ucontrol->value.integer.value[0] + 1; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, sizeof(dev->control_state)); + return 1; + } + + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): cmd = EP1_CMD_DIMM_LEDS; + break; + } if (pos & CNT_INTVAL) { dev->control_state[pos & ~CNT_INTVAL] diff --git a/trunk/sound/usb/caiaq/device.c b/trunk/sound/usb/caiaq/device.c index cdfb856bddd2..805271827675 100644 --- a/trunk/sound/usb/caiaq/device.c +++ b/trunk/sound/usb/caiaq/device.c @@ -36,7 +36,7 @@ #include "input.h" MODULE_AUTHOR("Daniel Mack "); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.21"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.20"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," @@ -320,6 +320,12 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev) } break; + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): + /* Audio 4 DJ - default input mode to phono */ + dev->control_state[0] = 2; + snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, + dev->control_state, 1); + break; } if (dev->spec.num_analog_audio_out + diff --git a/trunk/sound/usb/caiaq/input.c b/trunk/sound/usb/caiaq/input.c index dcb620796d9e..8bbfbfd4c658 100644 --- a/trunk/sound/usb/caiaq/input.c +++ b/trunk/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[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]); diff --git a/trunk/sound/usb/endpoint.c b/trunk/sound/usb/endpoint.c index 28ee1ce3971a..ef07a6d0dd5f 100644 --- a/trunk/sound/usb/endpoint.c +++ b/trunk/sound/usb/endpoint.c @@ -149,47 +149,6 @@ int snd_usb_add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct au return 0; } -static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip, - struct usb_host_interface *alts, - int protocol, int iface_no) -{ - /* parsed with a v1 header here. that's ok as we only look at the - * header first which is the same for both versions */ - struct uac_iso_endpoint_descriptor *csep; - struct usb_interface_descriptor *altsd = get_iface_desc(alts); - int attributes = 0; - - csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT); - - /* Creamware Noah has this descriptor after the 2nd endpoint */ - if (!csep && altsd->bNumEndpoints >= 2) - csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); - - if (!csep || csep->bLength < 7 || - csep->bDescriptorSubtype != UAC_EP_GENERAL) { - snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" - " class specific endpoint descriptor\n", - chip->dev->devnum, iface_no, - altsd->bAlternateSetting); - return 0; - } - - if (protocol == UAC_VERSION_1) { - attributes = csep->bmAttributes; - } else { - struct uac2_iso_endpoint_descriptor *csep2 = - (struct uac2_iso_endpoint_descriptor *) csep; - - attributes = csep->bmAttributes & UAC_EP_CS_ATTR_FILL_MAX; - - /* emulate the endpoint attributes of a v1 device */ - if (csep2->bmControls & UAC2_CONTROL_PITCH) - attributes |= UAC_EP_CS_ATTR_PITCH_CONTROL; - } - - return attributes; -} - int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) { struct usb_device *dev; @@ -199,8 +158,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) int i, altno, err, stream; int format = 0, num_channels = 0; struct audioformat *fp = NULL; + unsigned char *fmt, *csep; int num, protocol; - struct uac_format_type_i_continuous_descriptor *fmt; dev = chip->dev; @@ -297,8 +256,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) dev->devnum, iface_no, altno); continue; } - if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) || - ((protocol == UAC_VERSION_2) && (fmt->bLength != 6))) { + if (((protocol == UAC_VERSION_1) && (fmt[0] < 8)) || + ((protocol == UAC_VERSION_2) && (fmt[0] != 6))) { snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", dev->devnum, iface_no, altno); continue; @@ -309,9 +268,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) * with the previous one, except for a larger packet size, but * is actually a mislabeled two-channel setting; ignore it. */ - if (fmt->bNrChannels == 1 && - fmt->bSubframeSize == 2 && - altno == 2 && num == 3 && + if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 && fp && fp->altsetting == 1 && fp->channels == 1 && fp->formats == SNDRV_PCM_FMTBIT_S16_LE && protocol == UAC_VERSION_1 && @@ -319,6 +276,17 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) fp->maxpacksize * 2) continue; + csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT); + /* Creamware Noah has this descriptor after the 2nd endpoint */ + if (!csep && altsd->bNumEndpoints >= 2) + csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); + if (!csep || csep[0] < 7 || csep[2] != UAC_EP_GENERAL) { + snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" + " class specific endpoint descriptor\n", + dev->devnum, iface_no, altno); + csep = NULL; + } + fp = kzalloc(sizeof(*fp), GFP_KERNEL); if (! fp) { snd_printk(KERN_ERR "cannot malloc\n"); @@ -337,7 +305,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) * (fp->maxpacksize & 0x7ff); - fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no); + fp->attributes = csep ? csep[3] : 0; /* some quirks for attributes here */ diff --git a/trunk/sound/usb/format.c b/trunk/sound/usb/format.c index fe29d61de19b..b87cf87c4e7b 100644 --- a/trunk/sound/usb/format.c +++ b/trunk/sound/usb/format.c @@ -278,11 +278,12 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, * parse the format type I and III descriptors */ static int parse_audio_format_i(struct snd_usb_audio *chip, - struct audioformat *fp, int format, - struct uac_format_type_i_continuous_descriptor *fmt, + struct audioformat *fp, + int format, void *_fmt, struct usb_host_interface *iface) { struct usb_interface_descriptor *altsd = get_iface_desc(iface); + struct uac_format_type_i_discrete_descriptor *fmt = _fmt; int protocol = altsd->bInterfaceProtocol; int pcm_format, ret; @@ -319,7 +320,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, switch (protocol) { case UAC_VERSION_1: fp->channels = fmt->bNrChannels; - ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); + ret = parse_audio_format_rates_v1(chip, fp, _fmt, 7); break; case UAC_VERSION_2: /* fp->channels is already set in this case */ @@ -391,12 +392,12 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, } int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp, - int format, struct uac_format_type_i_continuous_descriptor *fmt, - int stream, struct usb_host_interface *iface) + int format, unsigned char *fmt, int stream, + struct usb_host_interface *iface) { int err; - switch (fmt->bFormatType) { + switch (fmt[3]) { case UAC_FORMAT_TYPE_I: case UAC_FORMAT_TYPE_III: err = parse_audio_format_i(chip, fp, format, fmt, iface); @@ -406,11 +407,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *f break; default: snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", - chip->dev->devnum, fp->iface, fp->altsetting, - fmt->bFormatType); - return -ENOTSUPP; + chip->dev->devnum, fp->iface, fp->altsetting, fmt[3]); + return -1; } - fp->fmt_type = fmt->bFormatType; + fp->fmt_type = fmt[3]; if (err < 0) return err; #if 1 @@ -421,10 +421,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *f if (chip->usb_id == USB_ID(0x041e, 0x3000) || chip->usb_id == USB_ID(0x041e, 0x3020) || chip->usb_id == USB_ID(0x041e, 0x3061)) { - if (fmt->bFormatType == UAC_FORMAT_TYPE_I && + if (fmt[3] == UAC_FORMAT_TYPE_I && fp->rates != SNDRV_PCM_RATE_48000 && fp->rates != SNDRV_PCM_RATE_96000) - return -ENOTSUPP; + return -1; } #endif return 0; diff --git a/trunk/sound/usb/format.h b/trunk/sound/usb/format.h index 387924f0af85..8298c4e8ddfa 100644 --- a/trunk/sound/usb/format.h +++ b/trunk/sound/usb/format.h @@ -1,9 +1,8 @@ #ifndef __USBAUDIO_FORMAT_H #define __USBAUDIO_FORMAT_H -int snd_usb_parse_audio_format(struct snd_usb_audio *chip, - struct audioformat *fp, int format, - struct uac_format_type_i_continuous_descriptor *fmt, - int stream, struct usb_host_interface *iface); +int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp, + int format, unsigned char *fmt, int stream, + struct usb_host_interface *iface); #endif /* __USBAUDIO_FORMAT_H */ diff --git a/trunk/sound/usb/midi.c b/trunk/sound/usb/midi.c index 9c23d89066e4..2c1558c327bb 100644 --- a/trunk/sound/usb/midi.c +++ b/trunk/sound/usb/midi.c @@ -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 @@ -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, @@ -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; diff --git a/trunk/sound/usb/midi.h b/trunk/sound/usb/midi.h index 2fca80b744c0..2089ec987c66 100644 --- a/trunk/sound/usb/midi.h +++ b/trunk/sound/usb/midi.h @@ -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, diff --git a/trunk/sound/usb/mixer.c b/trunk/sound/usb/mixer.c index 03ce971e0027..97dd17655104 100644 --- a/trunk/sound/usb/mixer.c +++ b/trunk/sound/usb/mixer.c @@ -1126,7 +1126,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void } else { struct uac2_feature_unit_descriptor *ftr = _ftr; csize = 4; - channels = (hdr->bLength - 6) / 4 - 1; + channels = (hdr->bLength - 6) / 4; bmaControls = ftr->bmaControls; } diff --git a/trunk/sound/usb/pcm.c b/trunk/sound/usb/pcm.c index 056587de7be4..2bf0d77d1768 100644 --- a/trunk/sound/usb/pcm.c +++ b/trunk/sound/usb/pcm.c @@ -120,6 +120,10 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface, ep = get_endpoint(alts, 0)->bEndpointAddress; + /* if endpoint doesn't have pitch control, bail out */ + if (!(fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL)) + return 0; + data[0] = 1; if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, @@ -133,32 +137,8 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface, return 0; } -static int init_pitch_v2(struct snd_usb_audio *chip, int iface, - struct usb_host_interface *alts, - struct audioformat *fmt) -{ - struct usb_device *dev = chip->dev; - unsigned char data[1]; - unsigned int ep; - int err; - - ep = get_endpoint(alts, 0)->bEndpointAddress; - - data[0] = 1; - if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR, - USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, - UAC2_EP_CS_PITCH << 8, 0, - data, sizeof(data), 1000)) < 0) { - snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH (v2)\n", - dev->devnum, iface, fmt->altsetting); - return err; - } - - return 0; -} - /* - * initialize the pitch control and sample rate + * initialize the picth control and sample rate */ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, struct usb_host_interface *alts, @@ -166,16 +146,13 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, { struct usb_interface_descriptor *altsd = get_iface_desc(alts); - /* if endpoint doesn't have pitch control, bail out */ - if (!(fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL)) - return 0; - switch (altsd->bInterfaceProtocol) { case UAC_VERSION_1: return init_pitch_v1(chip, iface, alts, fmt); case UAC_VERSION_2: - return init_pitch_v2(chip, iface, alts, fmt); + /* not implemented yet */ + return 0; } return -EINVAL; diff --git a/trunk/sound/usb/quirks-table.h b/trunk/sound/usb/quirks-table.h index f8797f61a24b..91ddef31bcbd 100644 --- a/trunk/sound/usb/quirks-table.h +++ b/trunk/sound/usb/quirks-table.h @@ -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), diff --git a/trunk/sound/usb/quirks.c b/trunk/sound/usb/quirks.c index b45e54c09ba2..136e5b4cf6de 100644 --- a/trunk/sound/usb/quirks.c +++ b/trunk/sound/usb/quirks.c @@ -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, diff --git a/trunk/sound/usb/usbaudio.h b/trunk/sound/usb/usbaudio.h index 06ebf24d3a4d..d679e72a3e5c 100644 --- a/trunk/sound/usb/usbaudio.h +++ b/trunk/sound/usb/usbaudio.h @@ -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,