linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: dri-devel@lists.freedesktop.org,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	intel-gfx@lists.freedesktop.org, linux-media@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH 2/6] drm/i915/display: use drm_edid_is_digital()
Date: Thu, 31 Aug 2023 20:24:58 +0300	[thread overview]
Message-ID: <ZPDM6rh0NMa4yt6H@intel.com> (raw)
In-Reply-To: <dbc0269d34f3140aff410eefae8a2711c59299b3.1692884619.git.jani.nikula@intel.com>

On Thu, Aug 24, 2023 at 04:46:03PM +0300, Jani Nikula wrote:
> Reduce the use of struct edid and drm_edid_raw().
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_crt.c  | 11 ++++-------
>  drivers/gpu/drm/i915/display/intel_hdmi.c |  9 ++++-----
>  drivers/gpu/drm/i915/display/intel_sdvo.c |  7 ++-----
>  3 files changed, 10 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_crt.c b/drivers/gpu/drm/i915/display/intel_crt.c
> index f66340b4caf0..310670bb6c25 100644
> --- a/drivers/gpu/drm/i915/display/intel_crt.c
> +++ b/drivers/gpu/drm/i915/display/intel_crt.c
> @@ -657,21 +657,18 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
>  	drm_edid = intel_crt_get_edid(connector, i2c);
>  
>  	if (drm_edid) {
> -		const struct edid *edid = drm_edid_raw(drm_edid);
> -		bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL;
> -
>  		/*
>  		 * This may be a DVI-I connector with a shared DDC
>  		 * link between analog and digital outputs, so we
>  		 * have to check the EDID input spec of the attached device.
>  		 */
> -		if (!is_digital) {
> +		if (drm_edid_is_digital(drm_edid)) {
>  			drm_dbg_kms(&dev_priv->drm,
> -				    "CRT detected via DDC:0x50 [EDID]\n");
> -			ret = true;
> +				    "CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
>  		} else {
>  			drm_dbg_kms(&dev_priv->drm,
> -				    "CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
> +				    "CRT detected via DDC:0x50 [EDID]\n");
> +			ret = true;

Inverting the check made the diff a bit confusing, but looks
correct in the end.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  		}
>  	} else {
>  		drm_dbg_kms(&dev_priv->drm,
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 9442bf43550e..aa9915098dda 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -2452,7 +2452,6 @@ intel_hdmi_set_edid(struct drm_connector *connector)
>  	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(to_intel_connector(connector));
>  	intel_wakeref_t wakeref;
>  	const struct drm_edid *drm_edid;
> -	const struct edid *edid;
>  	bool connected = false;
>  	struct i2c_adapter *i2c;
>  
> @@ -2475,9 +2474,7 @@ intel_hdmi_set_edid(struct drm_connector *connector)
>  
>  	to_intel_connector(connector)->detect_edid = drm_edid;
>  
> -	/* FIXME: Get rid of drm_edid_raw() */
> -	edid = drm_edid_raw(drm_edid);
> -	if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) {
> +	if (drm_edid_is_digital(drm_edid)) {
>  		intel_hdmi_dp_dual_mode_detect(connector);
>  
>  		connected = true;
> @@ -2485,7 +2482,9 @@ intel_hdmi_set_edid(struct drm_connector *connector)
>  
>  	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS, wakeref);
>  
> -	cec_notifier_set_phys_addr_from_edid(intel_hdmi->cec_notifier, edid);
> +	/* FIXME: Get rid of drm_edid_raw() */
> +	cec_notifier_set_phys_addr_from_edid(intel_hdmi->cec_notifier,
> +					     drm_edid_raw(drm_edid));
>  
>  	return connected;
>  }
> diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> index 7d25a64698e2..917771e19e38 100644
> --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> @@ -2094,10 +2094,8 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector)
>  
>  	status = connector_status_unknown;
>  	if (drm_edid) {
> -		const struct edid *edid = drm_edid_raw(drm_edid);
> -
>  		/* DDC bus is shared, match EDID to connector type */
> -		if (edid && edid->input & DRM_EDID_INPUT_DIGITAL)
> +		if (drm_edid_is_digital(drm_edid))
>  			status = connector_status_connected;
>  		else
>  			status = connector_status_disconnected;
> @@ -2111,8 +2109,7 @@ static bool
>  intel_sdvo_connector_matches_edid(struct intel_sdvo_connector *sdvo,
>  				  const struct drm_edid *drm_edid)
>  {
> -	const struct edid *edid = drm_edid_raw(drm_edid);
> -	bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL);
> +	bool monitor_is_digital = drm_edid_is_digital(drm_edid);
>  	bool connector_is_digital = !!IS_DIGITAL(sdvo);
>  
>  	DRM_DEBUG_KMS("connector_is_digital? %d, monitor_is_digital? %d\n",
> -- 
> 2.39.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2023-08-31 17:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 13:46 [PATCH 0/6] drm, cec and edid updates Jani Nikula
2023-08-24 13:46 ` [PATCH 1/6] drm/edid: add drm_edid_is_digital() Jani Nikula
2023-08-31 17:23   ` Ville Syrjälä
2023-09-01 19:26   ` Alex Deucher
2023-09-04 10:43     ` Jani Nikula
2023-08-24 13:46 ` [PATCH 2/6] drm/i915/display: use drm_edid_is_digital() Jani Nikula
2023-08-31 17:24   ` Ville Syrjälä [this message]
2023-08-24 13:46 ` [PATCH 3/6] drm/edid: parse source physical address Jani Nikula
2023-08-30  9:54   ` Hans Verkuil
2023-08-24 13:46 ` [PATCH 4/6] drm/cec: add drm_dp_cec_attach() as the non-edid version of set edid Jani Nikula
2023-08-25 11:23   ` [Intel-gfx] " kernel test robot
2023-08-25 11:23   ` kernel test robot
2023-08-25 13:01   ` [PATCH v2] " Jani Nikula
2023-08-30 10:26     ` Hans Verkuil
2023-08-30  9:57   ` [PATCH 4/6] " Hans Verkuil
2023-08-30 10:23     ` Jani Nikula
2023-08-24 13:46 ` [PATCH 5/6] drm/i915/cec: switch to setting physical address directly Jani Nikula
2023-08-30  9:57   ` Hans Verkuil
2023-08-24 13:46 ` [PATCH 6/6] media: cec: core: add note about *_from_edid() function usage in drm Jani Nikula
2023-08-30 10:03   ` Hans Verkuil
2023-08-31 10:52     ` Jani Nikula
2023-08-31 10:51   ` [PATCH v2] " Jani Nikula
2023-08-31 11:38     ` Hans Verkuil
2023-08-31 18:51 ` [PATCH 0/6] drm, cec and edid updates Jani Nikula
2023-08-31 21:32   ` Hans Verkuil
2023-09-01  7:24   ` Maxime Ripard
2023-09-01  8:57     ` Jani Nikula

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=ZPDM6rh0NMa4yt6H@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=linux-media@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).