ALSA: usb: Add quirk for 192KHz recording on E-Mu devices
[deliverable/linux.git] / sound / usb / pcm.c
index f94397b42aa5740bbc719702becf15bbbbb6128c..9916c85d8cdb5574516d672614dd401e724c652c 100644 (file)
@@ -94,13 +94,11 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream
  */
 static struct audioformat *find_format(struct snd_usb_substream *subs)
 {
-       struct list_head *p;
+       struct audioformat *fp;
        struct audioformat *found = NULL;
        int cur_attr = 0, attr;
 
-       list_for_each(p, &subs->fmt_list) {
-               struct audioformat *fp;
-               fp = list_entry(p, struct audioformat, list);
+       list_for_each_entry(fp, &subs->fmt_list, list) {
                if (!(fp->formats & (1uLL << subs->pcm_format)))
                        continue;
                if (fp->channels != subs->channels)
@@ -350,6 +348,8 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
                                fmt->iface, fmt->altsetting);
                subs->interface = fmt->iface;
                subs->altset_idx = fmt->altset_idx;
+
+               snd_usb_set_interface_quirk(dev);
        }
 
        subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip,
@@ -802,7 +802,7 @@ static int hw_rule_rate(struct snd_pcm_hw_params *params,
                        struct snd_pcm_hw_rule *rule)
 {
        struct snd_usb_substream *subs = rule->private;
-       struct list_head *p;
+       struct audioformat *fp;
        struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
        unsigned int rmin, rmax;
        int changed;
@@ -810,9 +810,7 @@ static int hw_rule_rate(struct snd_pcm_hw_params *params,
        hwc_debug("hw_rule_rate: (%d,%d)\n", it->min, it->max);
        changed = 0;
        rmin = rmax = 0;
-       list_for_each(p, &subs->fmt_list) {
-               struct audioformat *fp;
-               fp = list_entry(p, struct audioformat, list);
+       list_for_each_entry(fp, &subs->fmt_list, list) {
                if (!hw_check_valid_format(subs, params, fp))
                        continue;
                if (changed++) {
@@ -856,7 +854,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params,
                            struct snd_pcm_hw_rule *rule)
 {
        struct snd_usb_substream *subs = rule->private;
-       struct list_head *p;
+       struct audioformat *fp;
        struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
        unsigned int rmin, rmax;
        int changed;
@@ -864,9 +862,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params,
        hwc_debug("hw_rule_channels: (%d,%d)\n", it->min, it->max);
        changed = 0;
        rmin = rmax = 0;
-       list_for_each(p, &subs->fmt_list) {
-               struct audioformat *fp;
-               fp = list_entry(p, struct audioformat, list);
+       list_for_each_entry(fp, &subs->fmt_list, list) {
                if (!hw_check_valid_format(subs, params, fp))
                        continue;
                if (changed++) {
@@ -909,7 +905,7 @@ static int hw_rule_format(struct snd_pcm_hw_params *params,
                          struct snd_pcm_hw_rule *rule)
 {
        struct snd_usb_substream *subs = rule->private;
-       struct list_head *p;
+       struct audioformat *fp;
        struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
        u64 fbits;
        u32 oldbits[2];
@@ -917,9 +913,7 @@ static int hw_rule_format(struct snd_pcm_hw_params *params,
 
        hwc_debug("hw_rule_format: %x:%x\n", fmt->bits[0], fmt->bits[1]);
        fbits = 0;
-       list_for_each(p, &subs->fmt_list) {
-               struct audioformat *fp;
-               fp = list_entry(p, struct audioformat, list);
+       list_for_each_entry(fp, &subs->fmt_list, list) {
                if (!hw_check_valid_format(subs, params, fp))
                        continue;
                fbits |= fp->formats;
@@ -1027,7 +1021,7 @@ static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime,
 
 static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substream *subs)
 {
-       struct list_head *p;
+       struct audioformat *fp;
        unsigned int pt, ptmin;
        int param_period_time_if_needed;
        int err;
@@ -1041,9 +1035,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre
        runtime->hw.rates = 0;
        ptmin = UINT_MAX;
        /* check min/max rates and channels */
-       list_for_each(p, &subs->fmt_list) {
-               struct audioformat *fp;
-               fp = list_entry(p, struct audioformat, list);
+       list_for_each_entry(fp, &subs->fmt_list, list) {
                runtime->hw.rates |= fp->rates;
                if (runtime->hw.rate_min > fp->rate_min)
                        runtime->hw.rate_min = fp->rate_min;
@@ -1170,7 +1162,7 @@ static void retire_capture_urb(struct snd_usb_substream *subs,
        stride = runtime->frame_bits >> 3;
 
        for (i = 0; i < urb->number_of_packets; i++) {
-               cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
+               cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj;
                if (urb->iso_frame_desc[i].status && printk_ratelimit()) {
                        snd_printdd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status);
                        // continue;
@@ -1274,7 +1266,7 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
                        }
                }
                if (period_elapsed &&
-                   !snd_usb_endpoint_implict_feedback_sink(subs->data_endpoint)) /* finish at the period boundary */
+                   !snd_usb_endpoint_implicit_feedback_sink(subs->data_endpoint)) /* finish at the period boundary */
                        break;
        }
        bytes = frames * stride;
This page took 0.026431 seconds and 5 git commands to generate.