~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to sound/usb/pcm.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "helper.h"
33
33
#include "pcm.h"
34
34
#include "clock.h"
 
35
#include "power.h"
35
36
 
36
37
/*
37
38
 * return the current pcm pointer.  just based on the hwptr_done value.
739
740
                pt = 125 * (1 << fp->datainterval);
740
741
                ptmin = min(ptmin, pt);
741
742
        }
 
743
        err = snd_usb_autoresume(subs->stream->chip);
 
744
        if (err < 0)
 
745
                return err;
742
746
 
743
747
        param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME;
744
748
        if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
756
760
                                       SNDRV_PCM_HW_PARAM_CHANNELS,
757
761
                                       param_period_time_if_needed,
758
762
                                       -1)) < 0)
759
 
                return err;
 
763
                goto rep_err;
760
764
        if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
761
765
                                       hw_rule_channels, subs,
762
766
                                       SNDRV_PCM_HW_PARAM_FORMAT,
763
767
                                       SNDRV_PCM_HW_PARAM_RATE,
764
768
                                       param_period_time_if_needed,
765
769
                                       -1)) < 0)
766
 
                return err;
 
770
                goto rep_err;
767
771
        if ((err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT,
768
772
                                       hw_rule_format, subs,
769
773
                                       SNDRV_PCM_HW_PARAM_RATE,
770
774
                                       SNDRV_PCM_HW_PARAM_CHANNELS,
771
775
                                       param_period_time_if_needed,
772
776
                                       -1)) < 0)
773
 
                return err;
 
777
                goto rep_err;
774
778
        if (param_period_time_if_needed >= 0) {
775
779
                err = snd_pcm_hw_rule_add(runtime, 0,
776
780
                                          SNDRV_PCM_HW_PARAM_PERIOD_TIME,
780
784
                                          SNDRV_PCM_HW_PARAM_RATE,
781
785
                                          -1);
782
786
                if (err < 0)
783
 
                        return err;
 
787
                        goto rep_err;
784
788
        }
785
789
        if ((err = snd_usb_pcm_check_knot(runtime, subs)) < 0)
786
 
                return err;
 
790
                goto rep_err;
787
791
        return 0;
 
792
 
 
793
rep_err:
 
794
        snd_usb_autosuspend(subs->stream->chip);
 
795
        return err;
788
796
}
789
797
 
790
798
static int snd_usb_pcm_open(struct snd_pcm_substream *substream, int direction)
798
806
        runtime->hw = snd_usb_hardware;
799
807
        runtime->private_data = subs;
800
808
        subs->pcm_substream = substream;
 
809
        /* runtime PM is also done there */
801
810
        return setup_hw_info(runtime, subs);
802
811
}
803
812
 
811
820
                subs->interface = -1;
812
821
        }
813
822
        subs->pcm_substream = NULL;
 
823
        snd_usb_autosuspend(subs->stream->chip);
814
824
        return 0;
815
825
}
816
826