Merge tag 'asoc-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
authorTakashi Iwai <tiwai@suse.de>
Tue, 26 Jul 2016 08:35:31 +0000 (10:35 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 26 Jul 2016 08:35:31 +0000 (10:35 +0200)
ASoC: Updates for v4.8

Not really any framework work this time around (though we have seen one
of the Analog Devices drivers move more to the clock API which is good
to see) but rather a lot of new drivers:

 - Lots of updates for the Intel drivers, mostly board support and bug
   fixing, and to the NAU8825 driver.
 - Work on generalizing bits of simple-card to allow more code sharing
   with the Renesas rsrc-card (which can't use simple-card due to DPCM).
 - Removal of the Odroid X2 driver due to replacement with simple-card.
 - Support for several new Mediatek platforms and associated boards.
 - New drivers for Allwinner A10, Analog Devices ADAU7002, Broadcom
   Cygnus, Cirrus Logic CS35L33 and CS53L30, Maxim MAX8960 and MAX98504,
   Realtek RT5514 and Wolfson WM8758

34 files changed:
Documentation/sound/alsa/timestamping.txt
sound/core/control.c
sound/core/seq/oss/seq_oss_synth.c
sound/core/seq/seq_timer.c
sound/core/seq/seq_timer.h
sound/hda/hdmi_chmap.c
sound/i2c/other/ak4114.c
sound/i2c/other/ak4117.c
sound/isa/ad1848/ad1848.c
sound/isa/adlib.c
sound/isa/cmi8328.c
sound/isa/cs423x/cs4231.c
sound/isa/galaxy/galaxy.c
sound/isa/gus/gusclassic.c
sound/isa/gus/gusextreme.c
sound/isa/gus/gusmax.c
sound/isa/sb/jazz16.c
sound/isa/sb/sb8.c
sound/isa/sc6000.c
sound/oss/ad1848.c
sound/oss/aedsp16.c
sound/oss/sound_timer.c
sound/oss/sys_timer.c
sound/pci/ctxfi/cthw20k2.c
sound/pci/echoaudio/echoaudio.c
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_generic.c
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/pci/mixart/mixart_mixer.c
sound/pci/riptide/riptide.c
sound/ppc/awacs.c
sound/sh/aica.c
sound/usb/mixer_maps.c

index 1b6473f393a8220909fcbb0eb9a1e829a7e6854d..9d579aefbffd4f8fe669021ab8d4a9ce2e29ae9a 100644 (file)
@@ -14,7 +14,7 @@ provides a refined estimate with a delay.
 event or application query.
 The difference (tstamp - trigger_tstamp) defines the elapsed time.
 
-The ALSA API provides reports two basic pieces of information, avail
+The ALSA API provides two basic pieces of information, avail
 and delay, which combined with the trigger and current system
 timestamps allow for applications to keep track of the 'fullness' of
 the ring buffer and the amount of queued samples.
@@ -53,21 +53,21 @@ case):
 The analog time is taken at the last stage of the playback, as close
 as possible to the actual transducer
 
-The link time is taken at the output of the SOC/chipset as the samples
+The link time is taken at the output of the SoC/chipset as the samples
 are pushed on a link. The link time can be directly measured if
 supported in hardware by sample counters or wallclocks (e.g. with
 HDAudio 24MHz or PTP clock for networked solutions) or indirectly
 estimated (e.g. with the frame counter in USB).
 
 The DMA time is measured using counters - typically the least reliable
-of all measurements due to the bursty natured of DMA transfers.
+of all measurements due to the bursty nature of DMA transfers.
 
 The app time corresponds to the time tracked by an application after
 writing in the ring buffer.
 
-The application can query what the hardware supports, define which
+The application can query the hardware capabilities, define which
 audio time it wants reported by selecting the relevant settings in
-audio_tstamp_config fields, get an estimate of the timestamp
+audio_tstamp_config fields, thus get an estimate of the timestamp
 accuracy. It can also request the delay-to-analog be included in the
 measurement. Direct access to the link time is very interesting on
 platforms that provide an embedded DSP; measuring directly the link
@@ -169,7 +169,7 @@ playback: systime: 938107562 nsec, audio time 938112708 nsec,       systime delta -51
 Example 1 shows that the timestamp at the DMA level is close to 1ms
 ahead of the actual playback time (as a side time this sort of
 measurement can help define rewind safeguards). Compensating for the
-DMA-link delay in example 2 helps remove the hardware buffering abut
+DMA-link delay in example 2 helps remove the hardware buffering but
 the information is still very jittery, with up to one sample of
 error. In example 3 where the timestamps are measured with the link
 wallclock, the timestamps show a monotonic behavior and a lower
index b4fe9b00251251d596fbfbce2dd87eb44841b917..fb096cb20a80d1fb47c351154529177df064eb9d 100644 (file)
@@ -807,6 +807,36 @@ static int snd_ctl_elem_list(struct snd_card *card,
        return 0;
 }
 
+static bool validate_element_member_dimension(struct snd_ctl_elem_info *info)
+{
+       unsigned int members;
+       unsigned int i;
+
+       if (info->dimen.d[0] == 0)
+               return true;
+
+       members = 1;
+       for (i = 0; i < ARRAY_SIZE(info->dimen.d); ++i) {
+               if (info->dimen.d[i] == 0)
+                       break;
+               members *= info->dimen.d[i];
+
+               /*
+                * info->count should be validated in advance, to guarantee
+                * calculation soundness.
+                */
+               if (members > info->count)
+                       return false;
+       }
+
+       for (++i; i < ARRAY_SIZE(info->dimen.d); ++i) {
+               if (info->dimen.d[i] > 0)
+                       return false;
+       }
+
+       return members == info->count;
+}
+
 static int snd_ctl_elem_info(struct snd_ctl_file *ctl,
                             struct snd_ctl_elem_info *info)
 {
@@ -1274,6 +1304,8 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
        if (info->count < 1 ||
            info->count > max_value_counts[info->type])
                return -EINVAL;
+       if (!validate_element_member_dimension(info))
+               return -EINVAL;
        private_size = value_sizes[info->type] * info->count;
 
        /*
index b16dbef041747e1762c3285875a5573ac119b031..cd0e0ebbfdb1a1931b50f0fc9d70cdd08c17f740 100644 (file)
@@ -70,11 +70,11 @@ struct seq_oss_synth {
 static int max_synth_devs;
 static struct seq_oss_synth *synth_devs[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS];
 static struct seq_oss_synth midi_synth_dev = {
-       -1, /* seq_device */
-       SYNTH_TYPE_MIDI, /* synth_type */
-       0, /* synth_subtype */
-       16, /* nr_voices */
-       "MIDI", /* name */
+       .seq_device = -1,
+       .synth_type = SYNTH_TYPE_MIDI,
+       .synth_subtype = 0,
+       .nr_voices = 16,
+       .name = "MIDI",
 };
 
 static DEFINE_SPINLOCK(register_lock);
index 293104926098f7074001b6f6a4248d2a09ddd360..dcc102813aefa4d1d6e30e24f8644c8d92b12a9f 100644 (file)
@@ -165,7 +165,7 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri,
        snd_seq_timer_update_tick(&tmr->tick, resolution);
 
        /* register actual time of this timer update */
-       do_gettimeofday(&tmr->last_update);
+       ktime_get_ts64(&tmr->last_update);
 
        spin_unlock_irqrestore(&tmr->lock, flags);
 
@@ -392,7 +392,7 @@ static int seq_timer_start(struct snd_seq_timer *tmr)
                return -EINVAL;
        snd_timer_start(tmr->timeri, tmr->ticks);
        tmr->running = 1;
-       do_gettimeofday(&tmr->last_update);
+       ktime_get_ts64(&tmr->last_update);
        return 0;
 }
 
@@ -420,7 +420,7 @@ static int seq_timer_continue(struct snd_seq_timer *tmr)
        }
        snd_timer_start(tmr->timeri, tmr->ticks);
        tmr->running = 1;
-       do_gettimeofday(&tmr->last_update);
+       ktime_get_ts64(&tmr->last_update);
        return 0;
 }
 
@@ -444,17 +444,12 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr)
        spin_lock_irqsave(&tmr->lock, flags);
        cur_time = tmr->cur_time;
        if (tmr->running) { 
-               struct timeval tm;
-               int usec;
-               do_gettimeofday(&tm);
-               usec = (int)(tm.tv_usec - tmr->last_update.tv_usec);
-               if (usec < 0) {
-                       cur_time.tv_nsec += (1000000 + usec) * 1000;
-                       cur_time.tv_sec += tm.tv_sec - tmr->last_update.tv_sec - 1;
-               } else {
-                       cur_time.tv_nsec += usec * 1000;
-                       cur_time.tv_sec += tm.tv_sec - tmr->last_update.tv_sec;
-               }
+               struct timespec64 tm;
+
+               ktime_get_ts64(&tm);
+               tm = timespec64_sub(tm, tmr->last_update);
+               cur_time.tv_nsec = tm.tv_nsec;
+               cur_time.tv_sec = tm.tv_sec;
                snd_seq_sanity_real_time(&cur_time);
        }
        spin_unlock_irqrestore(&tmr->lock, flags);
index 88dfb71805ae0b0b49bfeb37d5b44aa40214ac57..9506b661fe5bfcf056c97799a39e1ba9dec8f029 100644 (file)
@@ -52,7 +52,7 @@ struct snd_seq_timer {
        unsigned int skew;
        unsigned int skew_base;
 
-       struct timeval          last_update;     /* time of last clock update, used for interpolation */
+       struct timespec64       last_update;     /* time of last clock update, used for interpolation */
 
        spinlock_t lock;
 };
index c6c75e7e0981affde1d06b508f551b7be25733a0..81acc20c2535870d7154e192fb5829d005540fac 100644 (file)
@@ -353,7 +353,8 @@ static void hdmi_std_setup_channel_mapping(struct hdac_chmap *chmap,
                int hdmi_slot = 0;
                /* fill actual channel mappings in ALSA channel (i) order */
                for (i = 0; i < ch_alloc->channels; i++) {
-                       while (!ch_alloc->speakers[7 - hdmi_slot] && !WARN_ON(hdmi_slot >= 8))
+                       while (!WARN_ON(hdmi_slot >= 8) &&
+                              !ch_alloc->speakers[7 - hdmi_slot])
                                hdmi_slot++; /* skip zero slots */
 
                        hdmi_channel_mapping[ca][i] = (i << 4) | hdmi_slot++;
@@ -430,6 +431,12 @@ static int to_cea_slot(int ordered_ca, unsigned char pos)
        int mask = snd_hdac_chmap_to_spk_mask(pos);
        int i;
 
+       /* Add sanity check to pass klockwork check.
+        * This should never happen.
+        */
+       if (ordered_ca >= ARRAY_SIZE(channel_allocations))
+               return -1;
+
        if (mask) {
                for (i = 0; i < 8; i++) {
                        if (channel_allocations[ordered_ca].speakers[7 - i] == mask)
@@ -456,7 +463,15 @@ EXPORT_SYMBOL_GPL(snd_hdac_spk_to_chmap);
 /* from CEA slot to ALSA API channel position */
 static int from_cea_slot(int ordered_ca, unsigned char slot)
 {
-       int mask = channel_allocations[ordered_ca].speakers[7 - slot];
+       int mask;
+
+       /* Add sanity check to pass klockwork check.
+        * This should never happen.
+        */
+       if (slot >= 8)
+               return 0;
+
+       mask = channel_allocations[ordered_ca].speakers[7 - slot];
 
        return snd_hdac_spk_to_chmap(mask);
 }
@@ -523,7 +538,8 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca)
        int ordered_ca = get_channel_allocation_order(ca);
 
        for (i = 0; i < 8; i++) {
-               if (i < channel_allocations[ordered_ca].channels)
+               if (ordered_ca < ARRAY_SIZE(channel_allocations) &&
+                   i < channel_allocations[ordered_ca].channels)
                        map[i] = from_cea_slot(ordered_ca, hdmi_channel_mapping[ca][i] & 0x0f);
                else
                        map[i] = 0;
@@ -551,6 +567,12 @@ int snd_hdac_get_active_channels(int ca)
 {
        int ordered_ca = get_channel_allocation_order(ca);
 
+       /* Add sanity check to pass klockwork check.
+        * This should never happen.
+        */
+       if (ordered_ca >= ARRAY_SIZE(channel_allocations))
+               ordered_ca = 0;
+
        return channel_allocations[ordered_ca].channels;
 }
 EXPORT_SYMBOL_GPL(snd_hdac_get_active_channels);
index 5a4cf3fab4ae868d3d571fdb70587e22dca8f4fa..d53c9bb36281f8a1f8827c769c1d19ca494fbf50 100644 (file)
@@ -121,7 +121,7 @@ int snd_ak4114_create(struct snd_card *card,
 
       __fail:
        snd_ak4114_free(chip);
-       return err < 0 ? err : -EIO;
+       return err;
 }
 EXPORT_SYMBOL(snd_ak4114_create);
 
index 48848909a5a95f6776e262788755b0501ec59563..0702f0552d196c4daa50c8eb3039c5cf2488764c 100644 (file)
@@ -110,7 +110,7 @@ int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t
 
       __fail:
        snd_ak4117_free(chip);
-       return err < 0 ? err : -EIO;
+       return err;
 }
 
 void snd_ak4117_reg_write(struct ak4117 *chip, unsigned char reg, unsigned char mask, unsigned char val)
index f159da4ec890b856dbedb0e3d83970a7839b7a78..a302d1f8d14f410dca12d4433b6b66cef7add47f 100644 (file)
@@ -170,15 +170,4 @@ static struct isa_driver snd_ad1848_driver = {
        }
 };
 
-static int __init alsa_card_ad1848_init(void)
-{
-       return isa_register_driver(&snd_ad1848_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_ad1848_exit(void)
-{
-       isa_unregister_driver(&snd_ad1848_driver);
-}
-
-module_init(alsa_card_ad1848_init);
-module_exit(alsa_card_ad1848_exit);
+module_isa_driver(snd_ad1848_driver, SNDRV_CARDS);
index 120c524bb2a05bd01d4704ccf443f20285bf5fe0..8d3060fd7ad7e3319553c4cf604d29dc7d73bd45 100644 (file)
@@ -112,15 +112,4 @@ static struct isa_driver snd_adlib_driver = {
        }
 };
 
-static int __init alsa_card_adlib_init(void)
-{
-       return isa_register_driver(&snd_adlib_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_adlib_exit(void)
-{
-       isa_unregister_driver(&snd_adlib_driver);
-}
-
-module_init(alsa_card_adlib_init);
-module_exit(alsa_card_adlib_exit);
+module_isa_driver(snd_adlib_driver, SNDRV_CARDS);
index 2c89d95da674658f780ea475b0f2b3d55f59f0fc..787475084f4662cfd9fd03b5165d47c2f48477ea 100644 (file)
@@ -469,15 +469,4 @@ static struct isa_driver snd_cmi8328_driver = {
        },
 };
 
-static int __init alsa_card_cmi8328_init(void)
-{
-       return isa_register_driver(&snd_cmi8328_driver, CMI8328_MAX);
-}
-
-static void __exit alsa_card_cmi8328_exit(void)
-{
-       isa_unregister_driver(&snd_cmi8328_driver);
-}
-
-module_init(alsa_card_cmi8328_init)
-module_exit(alsa_card_cmi8328_exit)
+module_isa_driver(snd_cmi8328_driver, CMI8328_MAX);
index 282cd75d2235659729e58e558e2872bbfbb3f20d..ef7448e9f81300e40bf39ee760cbcad55b92600b 100644 (file)
@@ -186,15 +186,4 @@ static struct isa_driver snd_cs4231_driver = {
        }
 };
 
-static int __init alsa_card_cs4231_init(void)
-{
-       return isa_register_driver(&snd_cs4231_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_cs4231_exit(void)
-{
-       isa_unregister_driver(&snd_cs4231_driver);
-}
-
-module_init(alsa_card_cs4231_init);
-module_exit(alsa_card_cs4231_exit);
+module_isa_driver(snd_cs4231_driver, SNDRV_CARDS);
index 32278847884f018a90b20c8312bd203c78a97673..379abe2cbeb2317345c14c6fdca684129e35e5c7 100644 (file)
@@ -634,15 +634,4 @@ static struct isa_driver snd_galaxy_driver = {
        }
 };
 
-static int __init alsa_card_galaxy_init(void)
-{
-       return isa_register_driver(&snd_galaxy_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_galaxy_exit(void)
-{
-       isa_unregister_driver(&snd_galaxy_driver);
-}
-
-module_init(alsa_card_galaxy_init);
-module_exit(alsa_card_galaxy_exit);
+module_isa_driver(snd_galaxy_driver, SNDRV_CARDS);
index f0019715d82ec45cc3fefc58dbecc9d2e06d4352..c169be49ed713f302e1b35d8541e431727a89f00 100644 (file)
@@ -229,15 +229,4 @@ static struct isa_driver snd_gusclassic_driver = {
        }
 };
 
-static int __init alsa_card_gusclassic_init(void)
-{
-       return isa_register_driver(&snd_gusclassic_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_gusclassic_exit(void)
-{
-       isa_unregister_driver(&snd_gusclassic_driver);
-}
-
-module_init(alsa_card_gusclassic_init);
-module_exit(alsa_card_gusclassic_exit);
+module_isa_driver(snd_gusclassic_driver, SNDRV_CARDS);
index 693d95f4680482a4bd38dbd61c30a268215582bf..77ac2fd723b4a413c4f597d630ace5e80b2979d5 100644 (file)
@@ -358,15 +358,4 @@ static struct isa_driver snd_gusextreme_driver = {
        }
 };
 
-static int __init alsa_card_gusextreme_init(void)
-{
-       return isa_register_driver(&snd_gusextreme_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_gusextreme_exit(void)
-{
-       isa_unregister_driver(&snd_gusextreme_driver);
-}
-
-module_init(alsa_card_gusextreme_init);
-module_exit(alsa_card_gusextreme_exit);
+module_isa_driver(snd_gusextreme_driver, SNDRV_CARDS);
index 8216e8d8f017bfbdc915142e63543abaab936797..dd88c9d33492bba72365f9785319ee665e5d92cc 100644 (file)
@@ -370,15 +370,4 @@ static struct isa_driver snd_gusmax_driver = {
        },
 };
 
-static int __init alsa_card_gusmax_init(void)
-{
-       return isa_register_driver(&snd_gusmax_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_gusmax_exit(void)
-{
-       isa_unregister_driver(&snd_gusmax_driver);
-}
-
-module_init(alsa_card_gusmax_init)
-module_exit(alsa_card_gusmax_exit)
+module_isa_driver(snd_gusmax_driver, SNDRV_CARDS);
index 6b4884d052a56097c38feea055f94ede24103f70..4d909971eedbb5b8ee458ec46d08162b2302bb44 100644 (file)
@@ -387,15 +387,4 @@ static struct isa_driver snd_jazz16_driver = {
        },
 };
 
-static int __init alsa_card_jazz16_init(void)
-{
-       return isa_register_driver(&snd_jazz16_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_jazz16_exit(void)
-{
-       isa_unregister_driver(&snd_jazz16_driver);
-}
-
-module_init(alsa_card_jazz16_init)
-module_exit(alsa_card_jazz16_exit)
+module_isa_driver(snd_jazz16_driver, SNDRV_CARDS);
index b8e2391c33ff1de53f2a66620329c34f3f1604eb..ad42d2364199fd6a7200000b4f992ad9043c7f30 100644 (file)
@@ -251,15 +251,4 @@ static struct isa_driver snd_sb8_driver = {
        },
 };
 
-static int __init alsa_card_sb8_init(void)
-{
-       return isa_register_driver(&snd_sb8_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_sb8_exit(void)
-{
-       isa_unregister_driver(&snd_sb8_driver);
-}
-
-module_init(alsa_card_sb8_init)
-module_exit(alsa_card_sb8_exit)
+module_isa_driver(snd_sb8_driver, SNDRV_CARDS);
index 51cfa7615f72e82064373401e6bed9842c2c2019..b61a6633d8f2866ff9b3f586afad912abaccbb57 100644 (file)
@@ -711,15 +711,4 @@ static struct isa_driver snd_sc6000_driver = {
 };
 
 
-static int __init alsa_card_sc6000_init(void)
-{
-       return isa_register_driver(&snd_sc6000_driver, SNDRV_CARDS);
-}
-
-static void __exit alsa_card_sc6000_exit(void)
-{
-       isa_unregister_driver(&snd_sc6000_driver);
-}
-
-module_init(alsa_card_sc6000_init)
-module_exit(alsa_card_sc6000_exit)
+module_isa_driver(snd_sc6000_driver, SNDRV_CARDS);
index 10c8de1f8d29366dabf95d558e13423d5dadd4c5..6368e5c7d0ba93328fd83893731f59a314d01be0 100644 (file)
@@ -254,7 +254,7 @@ static void ad_write(ad1848_info * devc, int reg, int data)
 
 static void wait_for_calibration(ad1848_info * devc)
 {
-       int timeout = 0;
+       int timeout;
 
        /*
         * Wait until the auto calibration process has finished.
index 35b5912cf3f81fa36d181fdb44f1f35be5d92d79..bb477d5c8528611776abee1fe7584f1d65389d89 100644 (file)
@@ -482,13 +482,13 @@ static struct orVals orDMA[] __initdata = {
 };
 
 static struct aedsp16_info ae_config = {
-       DEF_AEDSP16_IOB,
-       DEF_AEDSP16_IRQ,
-       DEF_AEDSP16_MRQ,
-       DEF_AEDSP16_DMA,
-       -1,
-       -1,
-       INIT_NONE
+       .base_io = DEF_AEDSP16_IOB,
+       .irq = DEF_AEDSP16_IRQ,
+       .mpu_irq = DEF_AEDSP16_MRQ,
+       .dma = DEF_AEDSP16_DMA,
+       .mss_base = -1,
+       .mpu_base = -1,
+       .init = INIT_NONE
 };
 
 /*
index 8021c85f076d09aa1c118473607e67219b04fc16..3a444a6f10ebc3d022aacea076eef5a7f81d4f9d 100644 (file)
@@ -17,7 +17,7 @@
 #include "sound_config.h"
 
 static volatile int initialized, opened, tmr_running;
-static volatile time_t tmr_offs, tmr_ctr;
+static volatile unsigned int tmr_offs, tmr_ctr;
 static volatile unsigned long ticks_offs;
 static volatile int curr_tempo, curr_timebase;
 static volatile unsigned long curr_ticks;
index 2226dda0eff0d9e2daf3f907877f20930f4f57ff..d17019d25b994526251a7fc8d9b088b0fecc109c 100644 (file)
@@ -19,7 +19,7 @@
 #include "sound_config.h"
 
 static volatile int opened, tmr_running;
-static volatile time_t tmr_offs, tmr_ctr;
+static volatile unsigned int tmr_offs, tmr_ctr;
 static volatile unsigned long ticks_offs;
 static volatile int curr_tempo, curr_timebase;
 static volatile unsigned long curr_ticks;
index 9dc2950e1ab7466974be04588a1c5bbe7c7175c5..6414ecf93efaa293683fd065886070a91584b699 100644 (file)
@@ -1615,23 +1615,23 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
        int i;
        struct regs_cs4382 cs_read = {0};
        struct regs_cs4382 cs_def = {
-                                  0x00000001,  /* Mode Control 1 */
-                                  0x00000000,  /* Mode Control 2 */
-                                  0x00000084,  /* Mode Control 3 */
-                                  0x00000000,  /* Filter Control */
-                                  0x00000000,  /* Invert Control */
-                                  0x00000024,  /* Mixing Control Pair 1 */
-                                  0x00000000,  /* Vol Control A1 */
-                                  0x00000000,  /* Vol Control B1 */
-                                  0x00000024,  /* Mixing Control Pair 2 */
-                                  0x00000000,  /* Vol Control A2 */
-                                  0x00000000,  /* Vol Control B2 */
-                                  0x00000024,  /* Mixing Control Pair 3 */
-                                  0x00000000,  /* Vol Control A3 */
-                                  0x00000000,  /* Vol Control B3 */
-                                  0x00000024,  /* Mixing Control Pair 4 */
-                                  0x00000000,  /* Vol Control A4 */
-                                  0x00000000   /* Vol Control B4 */
+               .mode_control_1 = 0x00000001, /* Mode Control 1 */
+               .mode_control_2 = 0x00000000, /* Mode Control 2 */
+               .mode_control_3 = 0x00000084, /* Mode Control 3 */
+               .filter_control = 0x00000000, /* Filter Control */
+               .invert_control = 0x00000000, /* Invert Control */
+               .mix_control_P1 = 0x00000024, /* Mixing Control Pair 1 */
+               .vol_control_A1 = 0x00000000, /* Vol Control A1 */
+               .vol_control_B1 = 0x00000000, /* Vol Control B1 */
+               .mix_control_P2 = 0x00000024, /* Mixing Control Pair 2 */
+               .vol_control_A2 = 0x00000000, /* Vol Control A2 */
+               .vol_control_B2 = 0x00000000, /* Vol Control B2 */
+               .mix_control_P3 = 0x00000024, /* Mixing Control Pair 3 */
+               .vol_control_A3 = 0x00000000, /* Vol Control A3 */
+               .vol_control_B3 = 0x00000000, /* Vol Control B3 */
+               .mix_control_P4 = 0x00000024, /* Mixing Control Pair 4 */
+               .vol_control_A4 = 0x00000000, /* Vol Control A4 */
+               .vol_control_B4 = 0x00000000  /* Vol Control B4 */
                                 };
 
        if (hw->model == CTSB1270) {
index 286f5e3686a3e7aa7a504dbf68cfb2104bdd4bdb..937071760bc4ac7197c4931452e903689fed671f 100644 (file)
@@ -1272,11 +1272,11 @@ static int snd_echo_mixer_info(struct snd_kcontrol *kcontrol,
 
        chip = snd_kcontrol_chip(kcontrol);
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-       uinfo->count = 1;
        uinfo->value.integer.min = ECHOGAIN_MINOUT;
        uinfo->value.integer.max = ECHOGAIN_MAXOUT;
        uinfo->dimen.d[0] = num_busses_out(chip);
        uinfo->dimen.d[1] = num_busses_in(chip);
+       uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1];
        return 0;
 }
 
@@ -1344,11 +1344,11 @@ static int snd_echo_vmixer_info(struct snd_kcontrol *kcontrol,
 
        chip = snd_kcontrol_chip(kcontrol);
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-       uinfo->count = 1;
        uinfo->value.integer.min = ECHOGAIN_MINOUT;
        uinfo->value.integer.max = ECHOGAIN_MAXOUT;
        uinfo->dimen.d[0] = num_busses_out(chip);
        uinfo->dimen.d[1] = num_pipes_out(chip);
+       uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1];
        return 0;
 }
 
@@ -1728,7 +1728,6 @@ static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol,
                                  struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-       uinfo->count = 96;
        uinfo->value.integer.min = ECHOGAIN_MINOUT;
        uinfo->value.integer.max = 0;
 #ifdef ECHOCARD_HAS_VMIXER
@@ -1738,6 +1737,7 @@ static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol,
 #endif
        uinfo->dimen.d[1] = 16; /* 16 channels */
        uinfo->dimen.d[2] = 2;  /* 0=level, 1=peak */
+       uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1] * uinfo->dimen.d[2];
        return 0;
 }
 
index 83741887faa189c1700abc34bebbd3c55234384d..9913be8532ab765651ae5166953d9e25281ce83c 100644 (file)
@@ -3584,6 +3584,12 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
        bool reset;
 
        spdif = snd_hda_spdif_out_of_nid(codec, nid);
+       /* Add sanity check to pass klockwork check.
+        * This should never happen.
+        */
+       if (WARN_ON(spdif == NULL))
+               return;
+
        curr_fmt = snd_hda_codec_read(codec, nid, 0,
                                      AC_VERB_GET_STREAM_FORMAT, 0);
        reset = codec->spdif_status_reset &&
@@ -3768,7 +3774,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
        spdif = snd_hda_spdif_out_of_nid(codec, mout->dig_out_nid);
        if (mout->dig_out_nid && mout->share_spdif &&
            mout->dig_out_used != HDA_DIG_EXCLUSIVE) {
-               if (chs == 2 &&
+               if (chs == 2 && spdif != NULL &&
                    snd_hda_is_supported_format(codec, mout->dig_out_nid,
                                                format) &&
                    !(spdif->status & IEC958_AES0_NONAUDIO)) {
index 79c7b340acc2361518b51504b7ecb032a71991b2..e7c8f4f076d5f3297946b088bc31cf7ecc0d66ad 100644 (file)
@@ -2492,10 +2492,6 @@ static int create_loopback_mixing_ctl(struct hda_codec *codec)
        if (!snd_hda_gen_add_kctl(spec, NULL, &loopback_mixing_enum))
                return -ENOMEM;
        spec->have_aamix_ctl = 1;
-       /* if no explicit aamix path is present (e.g. for Realtek codecs),
-        * enable aamix as default -- just for compatibility
-        */
-       spec->aamix_mode = !has_aamix_out_paths(spec);
        return 0;
 }
 
index d0d5ad8beac565b8e5bee7bb61f6e692081083ec..56e5204ac9c1ee10e66909bd58a921159ed42703 100644 (file)
@@ -1680,6 +1680,11 @@ static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
 
        mutex_lock(&codec->spdif_mutex);
        spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid);
+       /* Add sanity check to pass klockwork check.
+        * This should never happen.
+        */
+       if (WARN_ON(spdif == NULL))
+               return true;
        non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
        mutex_unlock(&codec->spdif_mutex);
        return non_pcm;
index abcb5a6a1cd9547db9c83e1cada1456615d47db8..ddd29b9819baa08157bea9e5982da665c6a9042d 100644 (file)
@@ -3718,6 +3718,9 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
        case 0x10ec0295:
                alc_process_coef_fw(codec, coef0225);
                break;
+       case 0x10ec0867:
+               alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
+               break;
        }
        codec_dbg(codec, "Headset jack set to unplugged mode.\n");
 }
@@ -3805,6 +3808,9 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
                alc_process_coef_fw(codec, coef0293);
                snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
                break;
+       case 0x10ec0867:
+               alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
+               /* fallthru */
        case 0x10ec0662:
                snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
                snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
@@ -3899,6 +3905,9 @@ static void alc_headset_mode_default(struct hda_codec *codec)
        case 0x10ec0668:
                alc_process_coef_fw(codec, coef0688);
                break;
+       case 0x10ec0867:
+               alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
+               break;
        }
        codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
 }
@@ -3989,6 +3998,9 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
        case 0x10ec0295:
                alc_process_coef_fw(codec, coef0225);
                break;
+       case 0x10ec0867:
+               alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
+               break;
        }
        codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
 }
@@ -4166,6 +4178,9 @@ static void alc_determine_headset_type(struct hda_codec *codec)
                val = alc_read_coef_idx(codec, 0x46);
                is_ctia = (val & 0x00f0) == 0x00f0;
                break;
+       case 0x10ec0867:
+               is_ctia = true;
+               break;
        }
 
        codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
@@ -6532,6 +6547,8 @@ enum {
        ALC668_FIXUP_DELL_XPS13,
        ALC662_FIXUP_ASUS_Nx50,
        ALC668_FIXUP_ASUS_Nx51,
+       ALC891_FIXUP_HEADSET_MODE,
+       ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
 };
 
 static const struct hda_fixup alc662_fixups[] = {
@@ -6787,6 +6804,20 @@ static const struct hda_fixup alc662_fixups[] = {
                .chained = true,
                .chain_id = ALC662_FIXUP_BASS_CHMAP,
        },
+       [ALC891_FIXUP_HEADSET_MODE] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc_fixup_headset_mode,
+       },
+       [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
+                       { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC891_FIXUP_HEADSET_MODE
+       },
 };
 
 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6903,6 +6934,11 @@ static const struct hda_model_fixup alc662_fixup_models[] = {
 };
 
 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
+       SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
+               {0x17, 0x02211010},
+               {0x18, 0x01a19030},
+               {0x1a, 0x01813040},
+               {0x21, 0x01014020}),
        SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
                {0x14, 0x01014010},
                {0x18, 0x01a19020},
@@ -7091,7 +7127,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
        HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
        HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
        HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
-       HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc882),
+       HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
        HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
        HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
        HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
index 58fd79ebac2082805662104e8616696166f2e8be..51e53497f0ad1801ab338f548fcc7cbe88ab9a26 100644 (file)
@@ -965,7 +965,7 @@ static int mixart_update_monitoring(struct snd_mixart* chip, int channel)
        int err;
        struct mixart_msg request;
        struct mixart_set_out_audio_level audio_level;
-       u32 resp;
+       u32 resp = 0;
 
        if(chip->pipe_out_ana.status == PIPE_UNDEFINED)
                return -EINVAL; /* no pipe defined */
index 94639d6b5fb5a3cb19031afbe0dc4432f33dcfe7..067a91207d8e53bc521988b449cd7a65b4308f63 100644 (file)
@@ -1496,7 +1496,7 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
                f = PAGE_SIZE;
                while ((size + (f >> 1) - 1) <= (f << 7) && (f << 1) > period)
                        f = f >> 1;
-               pages = (size + f - 1) / f;
+               pages = DIV_ROUND_UP(size, f);
                data->size = size;
                data->pages = pages;
                snd_printdd
index 09da7b52bc2e6deba601d876a9578cfbb485b768..1468e4b7bf934fac19e04bd6b0aef6b5536e0589 100644 (file)
@@ -991,6 +991,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
                if (err < 0)
                        return err;
        }
+       master_vol = NULL;
        if (pm7500)
                err = build_mixers(chip,
                                   ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500),
index ad3d9ae380349ddb4d367645a4deb841d6ea4452..fbbc252795599655bac0f795fbe47b607f18f8d8 100644 (file)
@@ -63,9 +63,6 @@ MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
 module_param(enable, bool, 0644);
 MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
 
-/* Use workqueue */
-static struct workqueue_struct *aica_queue;
-
 /* Simple platform device */
 static struct platform_device *pd;
 static struct resource aica_memory_space[2] = {
@@ -327,7 +324,7 @@ static void aica_period_elapsed(unsigned long timer_var)
                dreamcastcard->current_period = play_period;
        if (unlikely(dreamcastcard->dma_check == 0))
                dreamcastcard->dma_check = 1;
-       queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
+       schedule_work(&(dreamcastcard->spu_dma_work));
 }
 
 static void spu_begin_dma(struct snd_pcm_substream *substream)
@@ -337,7 +334,7 @@ static void spu_begin_dma(struct snd_pcm_substream *substream)
        runtime = substream->runtime;
        dreamcastcard = substream->pcm->private_data;
        /*get the queue to do the work */
-       queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
+       schedule_work(&(dreamcastcard->spu_dma_work));
        /* Timer may already be running */
        if (unlikely(dreamcastcard->timer.data)) {
                mod_timer(&dreamcastcard->timer, jiffies + 4);
@@ -381,7 +378,7 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream
                                 *substream)
 {
        struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
-       flush_workqueue(aica_queue);
+       flush_work(&(dreamcastcard->spu_dma_work));
        if (dreamcastcard->timer.data)
                del_timer(&dreamcastcard->timer);
        kfree(dreamcastcard->channel);
@@ -633,9 +630,6 @@ static int snd_aica_probe(struct platform_device *devptr)
        if (unlikely(err < 0))
                goto freedreamcast;
        platform_set_drvdata(devptr, dreamcastcard);
-       aica_queue = create_workqueue(CARD_NAME);
-       if (unlikely(!aica_queue))
-               goto freedreamcast;
        snd_printk
            ("ALSA Driver for Yamaha AICA Super Intelligent Sound Processor\n");
        return 0;
@@ -671,10 +665,6 @@ static int __init aica_init(void)
 
 static void __exit aica_exit(void)
 {
-       /* Destroy the aica kernel thread            *
-        * being extra cautious to check if it exists*/
-       if (likely(aica_queue))
-               destroy_workqueue(aica_queue);
        platform_device_unregister(pd);
        platform_driver_unregister(&snd_aica_driver);
        /* Kill any sound still playing and reset ARM7 to safe state */
index 1f8fb0d904e059d4e6084d0c221489d598e9e4c1..9038b2e7df732d453993a180071a98ea3b2ff79f 100644 (file)
@@ -107,8 +107,10 @@ static struct usbmix_name_map extigy_map[] = {
  * e.g. no Master and fake PCM volume
  *                     Pavel Mihaylov <bin@bash.info>
  */
-static struct usbmix_dB_map mp3plus_dB_1 = {-4781, 0}; /* just guess */
-static struct usbmix_dB_map mp3plus_dB_2 = {-1781, 618}; /* just guess */
+static struct usbmix_dB_map mp3plus_dB_1 = {.min = -4781, .max = 0};
+                                               /* just guess */
+static struct usbmix_dB_map mp3plus_dB_2 = {.min = -1781, .max = 618};
+                                               /* just guess */
 
 static struct usbmix_name_map mp3plus_map[] = {
        /* 1: IT pcm */