]> err.no Git - linux-2.6/blobdiff - sound/ppc/pmac.c
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-2.6] / sound / ppc / pmac.c
index 5a2bef44a2f5c7ef52d2e5312b89e21c02670425..4f9b19c90a430036ee834120b2b6c0d91e0c2454 100644 (file)
@@ -490,35 +490,14 @@ static int snd_pmac_pcm_open(struct snd_pmac *chip, struct pmac_stream *rec,
                             struct snd_pcm_substream *subs)
 {
        struct snd_pcm_runtime *runtime = subs->runtime;
-       int i, j, fflags;
-       static int typical_freqs[] = {
-               44100,
-               22050,
-               11025,
-               0,
-       };
-       static int typical_freq_flags[] = {
-               SNDRV_PCM_RATE_44100,
-               SNDRV_PCM_RATE_22050,
-               SNDRV_PCM_RATE_11025,
-               0,
-       };
+       int i;
 
        /* look up frequency table and fill bit mask */
        runtime->hw.rates = 0;
-       fflags = chip->freqs_ok;
-       for (i = 0; typical_freqs[i]; i++) {
-               for (j = 0; j < chip->num_freqs; j++) {
-                       if ((chip->freqs_ok & (1 << j)) &&
-                           chip->freq_table[j] == typical_freqs[i]) {
-                               runtime->hw.rates |= typical_freq_flags[i];
-                               fflags &= ~(1 << j);
-                               break;
-                       }
-               }
-       }
-       if (fflags) /* rest */
-               runtime->hw.rates |= SNDRV_PCM_RATE_KNOT;
+       for (i = 0; i < chip->num_freqs; i++)
+               if (chip->freqs_ok & (1 << i))
+                       runtime->hw.rates |=
+                               snd_pcm_rate_to_rate_bit(chip->freq_table[i]);
 
        /* check for minimum and maximum rates */
        for (i = 0; i < chip->num_freqs; i++) {
@@ -551,9 +530,6 @@ static int snd_pmac_pcm_open(struct snd_pmac *chip, struct pmac_stream *rec,
 
        runtime->hw.periods_max = rec->cmd.size - 1;
 
-       if (chip->can_duplex)
-               snd_pcm_set_sync(subs);
-
        /* constraints to fix choppy sound */
        snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
        return 0;
@@ -775,7 +751,8 @@ static int snd_pmac_free(struct snd_pmac *chip)
                out_le32(&chip->awacs->control, in_le32(&chip->awacs->control) & 0xfff);
        }
 
-       snd_pmac_sound_feature(chip, 0);
+       if (chip->node)
+               snd_pmac_sound_feature(chip, 0);
 
        /* clean up mixer if any */
        if (chip->mixer_free)
@@ -925,6 +902,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
        }
        if (! sound) {
                of_node_put(chip->node);
+               chip->node = NULL;
                return -ENODEV;
        }
        prop = of_get_property(sound, "sub-frame", NULL);
@@ -937,7 +915,9 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
                printk(KERN_INFO "snd-powermac no longer handles any "
                                 "machines with a layout-id property "
                                 "in the device-tree, use snd-aoa.\n");
+               of_node_put(sound);
                of_node_put(chip->node);
+               chip->node = NULL;
                return -ENODEV;
        }
        /* This should be verified on older screamers */
@@ -1031,29 +1011,6 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
        return 0;
 }
 
-/*
- * exported - boolean info callbacks for ease of programming
- */
-int snd_pmac_boolean_stereo_info(struct snd_kcontrol *kcontrol,
-                                struct snd_ctl_elem_info *uinfo)
-{
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 2;
-       uinfo->value.integer.min = 0;
-       uinfo->value.integer.max = 1;
-       return 0;
-}
-
-int snd_pmac_boolean_mono_info(struct snd_kcontrol *kcontrol,
-                              struct snd_ctl_elem_info *uinfo)
-{
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 1;
-       uinfo->value.integer.min = 0;
-       uinfo->value.integer.max = 1;
-       return 0;
-}
-
 #ifdef PMAC_SUPPORT_AUTOMUTE
 /*
  * auto-mute
@@ -1297,8 +1254,6 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
        return 0;
 
  __error:
-       if (chip->pdev)
-               pci_dev_put(chip->pdev);
        snd_pmac_free(chip);
        return err;
 }