Revert "ALSA: hda - Set codec to D3 forcibly even if not used"
[firefly-linux-kernel-4.4.55.git] / sound / pci / hda / hda_intel.c
index 95dfb687494144e54b191e3f7f4dbe7179bcf37d..6e958bf941915f3c2b8cb744e12a74a47896cfdf 100644 (file)
@@ -84,7 +84,7 @@ module_param_array(model, charp, NULL, 0444);
 MODULE_PARM_DESC(model, "Use the given board model.");
 module_param_array(position_fix, int, NULL, 0444);
 MODULE_PARM_DESC(position_fix, "DMA pointer read method."
-                "(0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO).");
+                "(0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO).");
 module_param_array(bdl_pos_adj, int, NULL, 0644);
 MODULE_PARM_DESC(bdl_pos_adj, "BDL position adjustment offset.");
 module_param_array(probe_mask, int, NULL, 0444);
@@ -94,7 +94,7 @@ MODULE_PARM_DESC(probe_only, "Only probing and no codec initialization.");
 module_param(single_cmd, bool, 0444);
 MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs "
                 "(for debugging only).");
-module_param(enable_msi, int, 0444);
+module_param(enable_msi, bint, 0444);
 MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)");
 #ifdef CONFIG_SND_HDA_PATCH_LOADER
 module_param_array(patch, charp, NULL, 0444);
@@ -121,8 +121,8 @@ module_param(power_save_controller, bool, 0644);
 MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
 #endif
 
-static bool align_buffer_size = 1;
-module_param(align_buffer_size, bool, 0644);
+static int align_buffer_size = -1;
+module_param(align_buffer_size, bint, 0644);
 MODULE_PARM_DESC(align_buffer_size,
                "Force buffer and period sizes to be multiple of 128 bytes.");
 
@@ -148,6 +148,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
                         "{Intel, PCH},"
                         "{Intel, CPT},"
                         "{Intel, PPT},"
+                        "{Intel, LPT},"
                         "{Intel, PBG},"
                         "{Intel, SCH},"
                         "{ATI, SB450},"
@@ -329,6 +330,7 @@ enum {
        POS_FIX_LPIB,
        POS_FIX_POSBUF,
        POS_FIX_VIACOMBO,
+       POS_FIX_COMBO,
 };
 
 /* Defines for ATI HD Audio support in SB450 south bridge */
@@ -515,6 +517,7 @@ enum {
 #define AZX_DCAPS_SYNC_WRITE   (1 << 19)       /* sync each cmd write */
 #define AZX_DCAPS_OLD_SSYNC    (1 << 20)       /* Old SSYNC reg for ICH */
 #define AZX_DCAPS_BUFSIZE      (1 << 21)       /* no buffer size alignment */
+#define AZX_DCAPS_ALIGN_BUFSIZE        (1 << 22)       /* buffer size alignment */
 
 /* quirks for ATI SB / AMD Hudson */
 #define AZX_DCAPS_PRESET_ATI_SB \
@@ -527,7 +530,8 @@ enum {
 
 /* quirks for Nvidia */
 #define AZX_DCAPS_PRESET_NVIDIA \
-       (AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY | AZX_DCAPS_NO_MSI)
+       (AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY | AZX_DCAPS_NO_MSI |\
+        AZX_DCAPS_ALIGN_BUFSIZE)
 
 static char *driver_short_names[] __devinitdata = {
        [AZX_DRIVER_ICH] = "HDA Intel",
@@ -2517,6 +2521,7 @@ static int __devinit check_position_fix(struct azx *chip, int fix)
        case POS_FIX_LPIB:
        case POS_FIX_POSBUF:
        case POS_FIX_VIACOMBO:
+       case POS_FIX_COMBO:
                return fix;
        }
 
@@ -2696,6 +2701,12 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
 
        chip->position_fix[0] = chip->position_fix[1] =
                check_position_fix(chip, position_fix[dev]);
+       /* combo mode uses LPIB for playback */
+       if (chip->position_fix[0] == POS_FIX_COMBO) {
+               chip->position_fix[0] = POS_FIX_LPIB;
+               chip->position_fix[1] = POS_FIX_AUTO;
+       }
+
        check_probe_mask(chip, dev);
 
        chip->single_cmd = single_cmd;
@@ -2774,9 +2785,16 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
        }
 
        /* disable buffer size rounding to 128-byte multiples if supported */
-       chip->align_buffer_size = align_buffer_size;
-       if (chip->driver_caps & AZX_DCAPS_BUFSIZE)
-               chip->align_buffer_size = 0;
+       if (align_buffer_size >= 0)
+               chip->align_buffer_size = !!align_buffer_size;
+       else {
+               if (chip->driver_caps & AZX_DCAPS_BUFSIZE)
+                       chip->align_buffer_size = 0;
+               else if (chip->driver_caps & AZX_DCAPS_ALIGN_BUFSIZE)
+                       chip->align_buffer_size = 1;
+               else
+                       chip->align_buffer_size = 1;
+       }
 
        /* allow 64bit DMA address if supported by H/W */
        if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
@@ -2992,6 +3010,10 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
        { PCI_DEVICE(0x8086, 0x1e20),
          .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
          AZX_DCAPS_BUFSIZE},
+       /* Lynx Point */
+       { PCI_DEVICE(0x8086, 0x8c20),
+         .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
+         AZX_DCAPS_BUFSIZE},
        /* SCH */
        { PCI_DEVICE(0x8086, 0x811b),
          .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |