]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - sound/pci/echoaudio/echoaudio.c
[ALSA] Add even more 'const' to everything related to TLV
[mirror_ubuntu-artful-kernel.git] / sound / pci / echoaudio / echoaudio.c
index 27a8dbe6f6a8ad9aadf564b40a2b6c368c7f5bc4..6a428b81dba65e4719980a5dee6f3922b83a431b 100644 (file)
@@ -34,6 +34,7 @@ module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(enable, "Enable " ECHOCARD_NAME " soundcard.");
 
 static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999};
+static const DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1);
 
 static int get_firmware(const struct firmware **fw_entry,
                        const struct firmware *frm, struct echoaudio *chip)
@@ -236,9 +237,9 @@ static int pcm_open(struct snd_pcm_substream *substream,
        chip = snd_pcm_substream_chip(substream);
        runtime = substream->runtime;
 
-       if (!(pipe = kmalloc(sizeof(struct audiopipe), GFP_KERNEL)))
+       pipe = kzalloc(sizeof(struct audiopipe), GFP_KERNEL);
+       if (!pipe)
                return -ENOMEM;
-       memset(pipe, 0, sizeof(struct audiopipe));
        pipe->index = -1;               /* Not configured yet */
 
        /* Set up hw capabilities and contraints */
@@ -1011,17 +1012,21 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol,
 static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = {
        .name = "Line Playback Volume",
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
        .info = snd_echo_output_gain_info,
        .get = snd_echo_output_gain_get,
        .put = snd_echo_output_gain_put,
+       .tlv = {.p = db_scale_output_gain},
 };
 #else
 static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = {
        .name = "PCM Playback Volume",
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
        .info = snd_echo_output_gain_info,
        .get = snd_echo_output_gain_get,
        .put = snd_echo_output_gain_put,
+       .tlv = {.p = db_scale_output_gain},
 };
 #endif
 
@@ -1080,12 +1085,16 @@ static int snd_echo_input_gain_put(struct snd_kcontrol *kcontrol,
        return changed;
 }
 
+static const DECLARE_TLV_DB_SCALE(db_scale_input_gain, -2500, 50, 0);
+
 static struct snd_kcontrol_new snd_echo_line_input_gain __devinitdata = {
        .name = "Line Capture Volume",
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
        .info = snd_echo_input_gain_info,
        .get = snd_echo_input_gain_get,
        .put = snd_echo_input_gain_put,
+       .tlv = {.p = db_scale_input_gain},
 };
 
 #endif /* ECHOCARD_HAS_INPUT_GAIN */
@@ -1277,9 +1286,11 @@ static int snd_echo_mixer_put(struct snd_kcontrol *kcontrol,
 static struct snd_kcontrol_new snd_echo_monitor_mixer __devinitdata = {
        .name = "Monitor Mixer Volume",
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
        .info = snd_echo_mixer_info,
        .get = snd_echo_mixer_get,
        .put = snd_echo_mixer_put,
+       .tlv = {.p = db_scale_output_gain},
 };
 
 #endif /* ECHOCARD_HAS_MONITOR */
@@ -1343,9 +1354,11 @@ static int snd_echo_vmixer_put(struct snd_kcontrol *kcontrol,
 static struct snd_kcontrol_new snd_echo_vmixer __devinitdata = {
        .name = "VMixer Volume",
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
        .info = snd_echo_vmixer_info,
        .get = snd_echo_vmixer_get,
        .put = snd_echo_vmixer_put,
+       .tlv = {.p = db_scale_output_gain},
 };
 
 #endif /* ECHOCARD_HAS_VMIXER */
@@ -1753,9 +1766,12 @@ static int snd_echo_vumeters_get(struct snd_kcontrol *kcontrol,
 static struct snd_kcontrol_new snd_echo_vumeters __devinitdata = {
        .name = "VU-meters",
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-       .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
+       .access = SNDRV_CTL_ELEM_ACCESS_READ |
+                 SNDRV_CTL_ELEM_ACCESS_VOLATILE |
+                 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
        .info = snd_echo_vumeters_info,
        .get = snd_echo_vumeters_get,
+       .tlv = {.p = db_scale_output_gain},
 };
 
 
@@ -1818,8 +1834,7 @@ static struct snd_kcontrol_new snd_echo_channels_info __devinitdata = {
        IRQ Handler
 ******************************************************************************/
 
-static irqreturn_t snd_echo_interrupt(int irq, void *dev_id,
-                                     struct pt_regs *regs)
+static irqreturn_t snd_echo_interrupt(int irq, void *dev_id)
 {
        struct echoaudio *chip = dev_id;
        struct snd_pcm_substream *substream;
@@ -1873,7 +1888,7 @@ static int snd_echo_free(struct echoaudio *chip)
        DE_INIT(("Stopped.\n"));
 
        if (chip->irq >= 0)
-               free_irq(chip->irq, (void *)chip);
+               free_irq(chip->irq, chip);
 
        if (chip->dsp_registers)
                iounmap(chip->dsp_registers);
@@ -1951,8 +1966,8 @@ static __devinit int snd_echo_create(struct snd_card *card,
        chip->dsp_registers = (volatile u32 __iomem *)
                ioremap_nocache(chip->dsp_registers_phys, sz);
 
-       if (request_irq(pci->irq, snd_echo_interrupt, IRQF_DISABLED | IRQF_SHARED,
-                                               ECHOCARD_NAME, (void *)chip)) {
+       if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
+                       ECHOCARD_NAME, chip)) {
                snd_echo_free(chip);
                snd_printk(KERN_ERR "cannot grab irq\n");
                return -EBUSY;