drm/i915/icl: Add new supported CD clocks

Now 180, 172.8 and 192 MHz are supported.

180 and 172.8 MHz CD clocks will only be used when audio is not
enabled as state by BSpec and implemented in
intel_crtc_compute_min_cdclk(), CD clock must be at least twice of
Azalia BCLK and BCLK by default is 96 MHz, it could be set to 48 MHz
but we are not reading it.

v3:
- making icl clock arrays static (Ville)

BSpec: 20598
BSpec: 15729
Cc: Clint Taylor <Clinton.A.Taylor@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190626014053.30541-1-jose.souza@intel.com
parent 092be382
...@@ -1756,9 +1756,10 @@ static void cnl_sanitize_cdclk(struct drm_i915_private *dev_priv) ...@@ -1756,9 +1756,10 @@ static void cnl_sanitize_cdclk(struct drm_i915_private *dev_priv)
static int icl_calc_cdclk(int min_cdclk, unsigned int ref) static int icl_calc_cdclk(int min_cdclk, unsigned int ref)
{ {
int ranges_24[] = { 312000, 552000, 648000 }; static const int ranges_24[] = { 180000, 192000, 312000, 552000, 648000 };
int ranges_19_38[] = { 307200, 556800, 652800 }; static const int ranges_19_38[] = { 172800, 192000, 307200, 556800, 652800 };
int *ranges; const int *ranges;
int len, i;
switch (ref) { switch (ref) {
default: default:
...@@ -1766,19 +1767,22 @@ static int icl_calc_cdclk(int min_cdclk, unsigned int ref) ...@@ -1766,19 +1767,22 @@ static int icl_calc_cdclk(int min_cdclk, unsigned int ref)
/* fall through */ /* fall through */
case 24000: case 24000:
ranges = ranges_24; ranges = ranges_24;
len = ARRAY_SIZE(ranges_24);
break; break;
case 19200: case 19200:
case 38400: case 38400:
ranges = ranges_19_38; ranges = ranges_19_38;
len = ARRAY_SIZE(ranges_19_38);
break; break;
} }
if (min_cdclk > ranges[1]) for (i = 0; i < len; i++) {
return ranges[2]; if (min_cdclk <= ranges[i])
else if (min_cdclk > ranges[0]) return ranges[i];
return ranges[1]; }
else
return ranges[0]; WARN_ON(min_cdclk > ranges[len - 1]);
return ranges[len - 1];
} }
static int icl_calc_cdclk_pll_vco(struct drm_i915_private *dev_priv, int cdclk) static int icl_calc_cdclk_pll_vco(struct drm_i915_private *dev_priv, int cdclk)
...@@ -1792,16 +1796,24 @@ static int icl_calc_cdclk_pll_vco(struct drm_i915_private *dev_priv, int cdclk) ...@@ -1792,16 +1796,24 @@ static int icl_calc_cdclk_pll_vco(struct drm_i915_private *dev_priv, int cdclk)
default: default:
MISSING_CASE(cdclk); MISSING_CASE(cdclk);
/* fall through */ /* fall through */
case 172800:
case 307200: case 307200:
case 556800: case 556800:
case 652800: case 652800:
WARN_ON(dev_priv->cdclk.hw.ref != 19200 && WARN_ON(dev_priv->cdclk.hw.ref != 19200 &&
dev_priv->cdclk.hw.ref != 38400); dev_priv->cdclk.hw.ref != 38400);
break; break;
case 180000:
case 312000: case 312000:
case 552000: case 552000:
case 648000: case 648000:
WARN_ON(dev_priv->cdclk.hw.ref != 24000); WARN_ON(dev_priv->cdclk.hw.ref != 24000);
break;
case 192000:
WARN_ON(dev_priv->cdclk.hw.ref != 19200 &&
dev_priv->cdclk.hw.ref != 38400 &&
dev_priv->cdclk.hw.ref != 24000);
break;
} }
ratio = cdclk / (dev_priv->cdclk.hw.ref / 2); ratio = cdclk / (dev_priv->cdclk.hw.ref / 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment