Merge branch 'for-linus' into for-next
authorTakashi Iwai <tiwai@suse.de>
Tue, 26 Apr 2016 08:04:19 +0000 (10:04 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 26 Apr 2016 08:12:46 +0000 (10:12 +0200)
For taking back the recent change of HDA HDMI fixes for i915 HSW/BDW.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
1  2 
include/sound/hda_i915.h
sound/hda/hdac_i915.c
sound/pci/hda/hda_generic.c
sound/pci/hda/patch_hdmi.c

index eed87a7559b75a56cbdc8305250b5d1e820af492,f5842bcd9c94ca633a2673d7a4bdceac76423364..796cabf6be5ee9da39a4a5347979b169c21bd633
@@@ -9,9 -9,9 +9,9 @@@
  #ifdef CONFIG_SND_HDA_I915
  int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable);
  int snd_hdac_display_power(struct hdac_bus *bus, bool enable);
int snd_hdac_get_display_clk(struct hdac_bus *bus);
void snd_hdac_i915_set_bclk(struct hdac_bus *bus);
 -int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid, int rate);
 -int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid,
 +int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate);
 +int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid,
                           bool *audio_enabled, char *buffer, int max_bytes);
  int snd_hdac_i915_init(struct hdac_bus *bus);
  int snd_hdac_i915_exit(struct hdac_bus *bus);
@@@ -25,12 -25,11 +25,11 @@@ static inline int snd_hdac_display_powe
  {
        return 0;
  }
- static inline int snd_hdac_get_display_clk(struct hdac_bus *bus)
+ static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
  {
-       return 0;
  }
 -static inline int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid,
 -                                         int rate)
 +static inline int snd_hdac_sync_audio_rate(struct hdac_device *codec,
 +                                         hda_nid_t nid, int rate)
  {
        return 0;
  }
index 6800e0c5a38f320e7d632ba2bac0e54e0d9e307f,607bbeaebddf784aadb062c7b3934b4fa506c1e0..c9af022676c2f1071585d6ec3a7975ef19ed55be
@@@ -97,29 -98,68 +98,68 @@@ int snd_hdac_display_power(struct hdac_
  }
  EXPORT_SYMBOL_GPL(snd_hdac_display_power);
  
+ #define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \
+                               ((pci)->device == 0x0c0c) || \
+                               ((pci)->device == 0x0d0c) || \
+                               ((pci)->device == 0x160c))
  /**
-  * snd_hdac_get_display_clk - Get CDCLK in kHz
+  * snd_hdac_i915_set_bclk - Reprogram BCLK for HSW/BDW
   * @bus: HDA core bus
   *
-  * This function is supposed to be used only by a HD-audio controller
-  * driver that needs the interaction with i915 graphics.
+  * Intel HSW/BDW display HDA controller is in GPU. Both its power and link BCLK
+  * depends on GPU. Two Extended Mode registers EM4 (M value) and EM5 (N Value)
+  * are used to convert CDClk (Core Display Clock) to 24MHz BCLK:
+  * BCLK = CDCLK * M / N
+  * The values will be lost when the display power well is disabled and need to
+  * be restored to avoid abnormal playback speed.
   *
-  * This function queries CDCLK value in kHz from the graphics driver and
-  * returns the value.  A negative code is returned in error.
+  * Call this function at initializing and changing power well, as well as
+  * at ELD notifier for the hotplug.
   */
int snd_hdac_get_display_clk(struct hdac_bus *bus)
void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
  {
        struct i915_audio_component *acomp = bus->audio_component;
+       struct pci_dev *pci = to_pci_dev(bus->dev);
+       int cdclk_freq;
+       unsigned int bclk_m, bclk_n;
+       if (!acomp || !acomp->ops || !acomp->ops->get_cdclk_freq)
+               return; /* only for i915 binding */
+       if (!CONTROLLER_IN_GPU(pci))
+               return; /* only HSW/BDW */
+       cdclk_freq = acomp->ops->get_cdclk_freq(acomp->dev);
+       switch (cdclk_freq) {
+       case 337500:
+               bclk_m = 16;
+               bclk_n = 225;
+               break;
+       case 450000:
+       default: /* default CDCLK 450MHz */
+               bclk_m = 4;
+               bclk_n = 75;
+               break;
+       case 540000:
+               bclk_m = 4;
+               bclk_n = 90;
+               break;
+       case 675000:
+               bclk_m = 8;
+               bclk_n = 225;
+               break;
+       }
  
-       if (!acomp || !acomp->ops)
-               return -ENODEV;
-       return acomp->ops->get_cdclk_freq(acomp->dev);
+       snd_hdac_chip_writew(bus, HSW_EM4, bclk_m);
+       snd_hdac_chip_writew(bus, HSW_EM5, bclk_n);
  }
- EXPORT_SYMBOL_GPL(snd_hdac_get_display_clk);
+ EXPORT_SYMBOL_GPL(snd_hdac_i915_set_bclk);
  
 -/* There is a fixed mapping between audio pin node and display port
 - * on current Intel platforms:
 +/* There is a fixed mapping between audio pin node and display port.
 + * on SNB, IVY, HSW, BSW, SKL, BXT, KBL:
   * Pin Widget 5 - PORT B (port = 1 in i915 driver)
   * Pin Widget 6 - PORT C (port = 2 in i915 driver)
   * Pin Widget 7 - PORT D (port = 3 in i915 driver)
Simple merge
Simple merge
This page took 0.03015 seconds and 5 git commands to generate.