From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/bios: use a flag for vbt hdmi level shift presence
Date: Thu, 7 Nov 2019 12:47:51 +0200 [thread overview]
Message-ID: <20191107104751.GZ1208@intel.com> (raw)
In-Reply-To: <20191107103230.19118-1-jani.nikula@intel.com>
On Thu, Nov 07, 2019 at 12:32:30PM +0200, Jani Nikula wrote:
> The pre-initialized magic value is a bit silly, switch to a flag
> instead.
>
> v2: Reduce paranoia to a single sanity check (Ville)
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
stands
> ---
> drivers/gpu/drm/i915/display/intel_bios.c | 10 +---------
> drivers/gpu/drm/i915/display/intel_ddi.c | 13 +++++++------
> drivers/gpu/drm/i915/i915_drv.h | 8 ++------
> 3 files changed, 10 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index a03f56b7b4ef..c19b234bebe6 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -1509,6 +1509,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv,
> port_name(port),
> hdmi_level_shift);
> info->hdmi_level_shift = hdmi_level_shift;
> + info->hdmi_level_shift_set = true;
> }
>
> if (bdb_version >= 204) {
> @@ -1692,8 +1693,6 @@ parse_general_definitions(struct drm_i915_private *dev_priv,
> static void
> init_vbt_defaults(struct drm_i915_private *dev_priv)
> {
> - enum port port;
> -
> dev_priv->vbt.crt_ddc_pin = GMBUS_PIN_VGADDC;
>
> /* Default to having backlight */
> @@ -1721,13 +1720,6 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
> dev_priv->vbt.lvds_ssc_freq = intel_bios_ssc_frequency(dev_priv,
> !HAS_PCH_SPLIT(dev_priv));
> DRM_DEBUG_KMS("Set default to SSC at %d kHz\n", dev_priv->vbt.lvds_ssc_freq);
> -
> - for_each_port(port) {
> - struct ddi_vbt_port_info *info =
> - &dev_priv->vbt.ddi_port_info[port];
> -
> - info->hdmi_level_shift = HDMI_LEVEL_SHIFT_UNKNOWN;
> - }
> }
>
> /* Defaults to initialize only if there is no VBT. */
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 398c6f054a6e..4018c2e2a6fc 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -888,11 +888,10 @@ icl_get_combo_buf_trans(struct drm_i915_private *dev_priv, int type, int rate,
>
> static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port port)
> {
> + struct ddi_vbt_port_info *port_info = &dev_priv->vbt.ddi_port_info[port];
> int n_entries, level, default_entry;
> enum phy phy = intel_port_to_phy(dev_priv, port);
>
> - level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
> -
> if (INTEL_GEN(dev_priv) >= 12) {
> if (intel_phy_is_combo(dev_priv, phy))
> icl_get_combo_buf_trans(dev_priv, INTEL_OUTPUT_HDMI,
> @@ -927,12 +926,14 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
> return 0;
> }
>
> - /* Choose a good default if VBT is badly populated */
> - if (level == HDMI_LEVEL_SHIFT_UNKNOWN || level >= n_entries)
> - level = default_entry;
> -
> if (WARN_ON_ONCE(n_entries == 0))
> return 0;
> +
> + if (port_info->hdmi_level_shift_set)
> + level = port_info->hdmi_level_shift;
> + else
> + level = default_entry;
> +
> if (WARN_ON_ONCE(level >= n_entries))
> level = n_entries - 1;
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 7e0f67babe20..67bdfe6de3fa 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -627,13 +627,9 @@ struct ddi_vbt_port_info {
>
> int max_tmds_clock;
>
> - /*
> - * This is an index in the HDMI/DVI DDI buffer translation table.
> - * The special value HDMI_LEVEL_SHIFT_UNKNOWN means the VBT didn't
> - * populate this field.
> - */
> -#define HDMI_LEVEL_SHIFT_UNKNOWN 0xff
> + /* This is an index in the HDMI/DVI DDI buffer translation table. */
> u8 hdmi_level_shift;
> + u8 hdmi_level_shift_set:1;
>
> u8 supports_dvi:1;
> u8 supports_hdmi:1;
> --
> 2.20.1
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/bios: use a flag for vbt hdmi level shift presence
Date: Thu, 7 Nov 2019 12:47:51 +0200 [thread overview]
Message-ID: <20191107104751.GZ1208@intel.com> (raw)
Message-ID: <20191107104751.utnUyncNoNrRMGuvs5cLFXkIS0MZcjwCcU_3TKPq-eY@z> (raw)
In-Reply-To: <20191107103230.19118-1-jani.nikula@intel.com>
On Thu, Nov 07, 2019 at 12:32:30PM +0200, Jani Nikula wrote:
> The pre-initialized magic value is a bit silly, switch to a flag
> instead.
>
> v2: Reduce paranoia to a single sanity check (Ville)
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
stands
> ---
> drivers/gpu/drm/i915/display/intel_bios.c | 10 +---------
> drivers/gpu/drm/i915/display/intel_ddi.c | 13 +++++++------
> drivers/gpu/drm/i915/i915_drv.h | 8 ++------
> 3 files changed, 10 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index a03f56b7b4ef..c19b234bebe6 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -1509,6 +1509,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv,
> port_name(port),
> hdmi_level_shift);
> info->hdmi_level_shift = hdmi_level_shift;
> + info->hdmi_level_shift_set = true;
> }
>
> if (bdb_version >= 204) {
> @@ -1692,8 +1693,6 @@ parse_general_definitions(struct drm_i915_private *dev_priv,
> static void
> init_vbt_defaults(struct drm_i915_private *dev_priv)
> {
> - enum port port;
> -
> dev_priv->vbt.crt_ddc_pin = GMBUS_PIN_VGADDC;
>
> /* Default to having backlight */
> @@ -1721,13 +1720,6 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
> dev_priv->vbt.lvds_ssc_freq = intel_bios_ssc_frequency(dev_priv,
> !HAS_PCH_SPLIT(dev_priv));
> DRM_DEBUG_KMS("Set default to SSC at %d kHz\n", dev_priv->vbt.lvds_ssc_freq);
> -
> - for_each_port(port) {
> - struct ddi_vbt_port_info *info =
> - &dev_priv->vbt.ddi_port_info[port];
> -
> - info->hdmi_level_shift = HDMI_LEVEL_SHIFT_UNKNOWN;
> - }
> }
>
> /* Defaults to initialize only if there is no VBT. */
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 398c6f054a6e..4018c2e2a6fc 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -888,11 +888,10 @@ icl_get_combo_buf_trans(struct drm_i915_private *dev_priv, int type, int rate,
>
> static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port port)
> {
> + struct ddi_vbt_port_info *port_info = &dev_priv->vbt.ddi_port_info[port];
> int n_entries, level, default_entry;
> enum phy phy = intel_port_to_phy(dev_priv, port);
>
> - level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
> -
> if (INTEL_GEN(dev_priv) >= 12) {
> if (intel_phy_is_combo(dev_priv, phy))
> icl_get_combo_buf_trans(dev_priv, INTEL_OUTPUT_HDMI,
> @@ -927,12 +926,14 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
> return 0;
> }
>
> - /* Choose a good default if VBT is badly populated */
> - if (level == HDMI_LEVEL_SHIFT_UNKNOWN || level >= n_entries)
> - level = default_entry;
> -
> if (WARN_ON_ONCE(n_entries == 0))
> return 0;
> +
> + if (port_info->hdmi_level_shift_set)
> + level = port_info->hdmi_level_shift;
> + else
> + level = default_entry;
> +
> if (WARN_ON_ONCE(level >= n_entries))
> level = n_entries - 1;
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 7e0f67babe20..67bdfe6de3fa 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -627,13 +627,9 @@ struct ddi_vbt_port_info {
>
> int max_tmds_clock;
>
> - /*
> - * This is an index in the HDMI/DVI DDI buffer translation table.
> - * The special value HDMI_LEVEL_SHIFT_UNKNOWN means the VBT didn't
> - * populate this field.
> - */
> -#define HDMI_LEVEL_SHIFT_UNKNOWN 0xff
> + /* This is an index in the HDMI/DVI DDI buffer translation table. */
> u8 hdmi_level_shift;
> + u8 hdmi_level_shift_set:1;
>
> u8 supports_dvi:1;
> u8 supports_hdmi:1;
> --
> 2.20.1
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-11-07 10:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-07 10:32 [PATCH] drm/i915/bios: use a flag for vbt hdmi level shift presence Jani Nikula
2019-11-07 10:32 ` [Intel-gfx] " Jani Nikula
2019-11-07 10:47 ` Ville Syrjälä [this message]
2019-11-07 10:47 ` Ville Syrjälä
2019-11-07 13:03 ` ✓ Fi.CI.BAT: success for drm/i915/bios: use a flag for vbt hdmi level shift presence (rev2) Patchwork
2019-11-07 13:03 ` [Intel-gfx] " Patchwork
2019-11-08 14:25 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-11-08 14:25 ` [Intel-gfx] " Patchwork
2019-11-12 14:09 ` ✗ Fi.CI.BAT: failure for drm/i915/bios: use a flag for vbt hdmi level shift presence (rev3) Patchwork
2019-11-12 14:09 ` [Intel-gfx] " Patchwork
2019-11-12 20:02 ` ✗ Fi.CI.BAT: failure for drm/i915/bios: use a flag for vbt hdmi level shift presence (rev4) Patchwork
2019-11-12 20:02 ` [Intel-gfx] " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2019-11-05 13:39 [PATCH] drm/i915/bios: use a flag for vbt hdmi level shift presence Jani Nikula
2019-11-05 13:50 ` Ville Syrjälä
2019-11-05 13:59 ` Jani Nikula
2019-11-05 15:21 ` Ville Syrjälä
2019-11-05 15:37 ` Ville Syrjälä
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191107104751.GZ1208@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox