]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'takashi/topic/drm-sync-audio-rate' into drm-intel-next...
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 7 Oct 2015 13:34:15 +0000 (15:34 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 7 Oct 2015 14:05:04 +0000 (16:05 +0200)
Pull in the i915/hda changes for N/CTS setting so I can apply the
follow-up documentation work for drm/i915.

Some conflicts because ofc we had to rework i915 while that N/CTS work
was going on. But not more than adjacent changes really.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
1  2 
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_audio.c

Simple merge
Simple merge
index b08b4a7fae49e4b55e53a158f083717377ce698e,dffd0b4c5f1792a994592f7166342af3f112545c..72d696b0e7d4a04da2dbdc6ba9f277fa97f4691b
@@@ -68,8 -68,33 +68,33 @@@ static const struct 
        { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 },
  };
  
+ /* HDMI N/CTS table */
+ #define TMDS_297M 297000
+ #define TMDS_296M DIV_ROUND_UP(297000 * 1000, 1001)
+ static const struct {
+       int sample_rate;
+       int clock;
+       int n;
+       int cts;
+ } aud_ncts[] = {
+       { 44100, TMDS_296M, 4459, 234375 },
+       { 44100, TMDS_297M, 4704, 247500 },
+       { 48000, TMDS_296M, 5824, 281250 },
+       { 48000, TMDS_297M, 5120, 247500 },
+       { 32000, TMDS_296M, 5824, 421875 },
+       { 32000, TMDS_297M, 3072, 222750 },
+       { 88200, TMDS_296M, 8918, 234375 },
+       { 88200, TMDS_297M, 9408, 247500 },
+       { 96000, TMDS_296M, 11648, 281250 },
+       { 96000, TMDS_297M, 10240, 247500 },
+       { 176400, TMDS_296M, 17836, 234375 },
+       { 176400, TMDS_297M, 18816, 247500 },
+       { 192000, TMDS_296M, 23296, 281250 },
+       { 192000, TMDS_297M, 20480, 247500 },
+ };
  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
 -static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
 +static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted_mode)
  {
        int i;
  
@@@ -252,8 -325,28 +326,28 @@@ static void hsw_audio_codec_enable(stru
        if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
                tmp |= AUD_CONFIG_N_VALUE_INDEX;
        else
 -              tmp |= audio_config_hdmi_pixel_clock(mode);
 +              tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
+       tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
 -      if (audio_rate_need_prog(intel_crtc, mode)) {
++      if (audio_rate_need_prog(intel_crtc, adjusted_mode)) {
+               if (!acomp)
+                       rate = 0;
+               else if (port >= PORT_A && port <= PORT_E)
+                       rate = acomp->aud_sample_rate[port];
+               else {
+                       DRM_ERROR("invalid port: %d\n", port);
+                       rate = 0;
+               }
 -              n = audio_config_get_n(mode, rate);
++              n = audio_config_get_n(adjusted_mode, rate);
+               if (n != 0)
+                       tmp = audio_config_setup_n_reg(n, tmp);
+               else
+                       DRM_DEBUG_KMS("no suitable N value is found\n");
+       }
        I915_WRITE(HSW_AUD_CFG(pipe), tmp);
+       mutex_unlock(&dev_priv->av_mutex);
  }
  
  static void ilk_audio_codec_disable(struct intel_encoder *encoder)