From: Jani Nikula <jani.nikula@intel.com>
To: Imre Deak <imre.deak@intel.com>, intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/8] drm/dp: Factor out helper to distinguish between branch and sink devices
Date: Mon, 24 Oct 2016 20:10:46 +0300 [thread overview]
Message-ID: <87inshk6zt.fsf@intel.com> (raw)
In-Reply-To: <1477326811-30431-2-git-send-email-imre.deak@intel.com>
On Mon, 24 Oct 2016, Imre Deak <imre.deak@intel.com> wrote:
> This check is open-coded in a few places, so it makes sense to simplify
> things by having a helper for it similar to the rest of DPCD feature
> helpers.
>
> v2: (Jani)
> - Move the helper to drm_dp_helper.h.
> - Split out this change to a separate patch.
>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Imre Deak <imre.deak@intel.com>
DP 1.4 has changed the name of "branch" devices, but I think this is
good.
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/intel_dp.c | 11 ++++-------
> include/drm/drm_dp_helper.h | 6 ++++++
> 2 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index f30db8f..3c2293b 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1459,8 +1459,7 @@ static void intel_dp_print_hw_revision(struct intel_dp *intel_dp)
> if ((drm_debug & DRM_UT_KMS) == 0)
> return;
>
> - if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
> - DP_DWN_STRM_PORT_PRESENT))
> + if (!drm_dp_is_branch(intel_dp->dpcd))
> return;
>
> len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_HW_REV, &rev, 1);
> @@ -1478,8 +1477,7 @@ static void intel_dp_print_sw_revision(struct intel_dp *intel_dp)
> if ((drm_debug & DRM_UT_KMS) == 0)
> return;
>
> - if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
> - DP_DWN_STRM_PORT_PRESENT))
> + if (!drm_dp_is_branch(intel_dp->dpcd))
> return;
>
> len = drm_dp_dpcd_read(&intel_dp->aux, DP_BRANCH_SW_REV, &rev, 2);
> @@ -3615,8 +3613,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
> if (!is_edp(intel_dp) && !intel_dp->sink_count)
> return false;
>
> - if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
> - DP_DWN_STRM_PORT_PRESENT))
> + if (!drm_dp_is_branch(intel_dp->dpcd))
> return true; /* native DP sink */
>
> if (intel_dp->dpcd[DP_DPCD_REV] == 0x10)
> @@ -4134,7 +4131,7 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
> return connector_status_connected;
>
> /* if there's no downstream port, we're done */
> - if (!(dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT))
> + if (!drm_dp_is_branch(dpcd))
> return connector_status_connected;
>
> /* If we're HPD-aware, SINK_COUNT changes dynamically */
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 2a79882..55bbeb0 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -690,6 +690,12 @@ drm_dp_tps3_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
> dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED;
> }
>
> +static inline bool
> +drm_dp_is_branch(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
> +{
> + return dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT;
> +}
> +
> /*
> * DisplayPort AUX channel
> */
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-10-24 17:10 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 16:33 [PATCH v2 0/8] drm/i915/lspcon: Work around resume failure Imre Deak
2016-10-24 16:33 ` [PATCH v2 1/8] drm/dp: Factor out helper to distinguish between branch and sink devices Imre Deak
2016-10-24 17:10 ` Jani Nikula [this message]
2016-10-25 6:54 ` [Intel-gfx] " Daniel Vetter
2016-10-25 7:46 ` Jani Nikula
2016-10-25 8:12 ` Daniel Vetter
2016-10-24 16:33 ` [PATCH v2 2/8] drm/i915/dp: Remove debug dependency of DPCD SW/HW revision read Imre Deak
2016-10-24 17:11 ` Jani Nikula
2016-10-24 16:33 ` [PATCH v2 3/8] drm/i915/dp: Print only sink or branch specific OUI based on dev type Imre Deak
2016-10-24 17:12 ` Jani Nikula
2016-10-24 16:33 ` [PATCH v2 4/8] drm/i915/dp: Print full branch/sink descriptor Imre Deak
2016-10-24 18:14 ` Jani Nikula
2016-10-24 18:56 ` Imre Deak
2016-10-24 19:10 ` Jani Nikula
2016-10-24 19:35 ` Imre Deak
2016-10-25 9:28 ` Jani Nikula
2016-10-25 10:38 ` Imre Deak
2016-10-25 10:55 ` Jani Nikula
2016-10-25 13:12 ` [PATCH v3 " Imre Deak
2016-10-25 15:07 ` Jani Nikula
2016-10-24 16:33 ` [PATCH v2 5/8] drm/i915/lspcon: Fail LSPCON probe if the start of DPCD can't be read Imre Deak
2016-10-24 18:48 ` Jani Nikula
2016-10-24 16:33 ` [PATCH v2 6/8] drm/i915/dp: Read DP descriptor for eDP and LSPCON too Imre Deak
2016-10-24 18:49 ` Jani Nikula
2016-10-24 16:33 ` [PATCH v2 7/8] drm/i915/lspcon: Get DDC adapter via container_of() instead of cached ptr Imre Deak
2016-10-24 18:53 ` Jani Nikula
2016-10-24 16:33 ` [PATCH v2 8/8] drm/i915/lspcon: Add workaround for resuming in PCON mode Imre Deak
2016-10-25 15:12 ` Jani Nikula
2016-10-24 17:16 ` ✗ Fi.CI.BAT: warning for drm/i915/lspcon: Work around resume failure Patchwork
2016-10-24 17:25 ` Imre Deak
2016-10-24 18:58 ` Jani Nikula
2016-10-24 19:05 ` Imre Deak
2016-10-25 5:47 ` Saarinen, Jani
2016-10-25 5:46 ` Saarinen, Jani
2016-10-25 14:46 ` ✗ Fi.CI.BAT: warning for drm/i915/lspcon: Work around resume failure (rev2) Patchwork
2016-10-26 15:53 ` Imre Deak
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=87inshk6zt.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.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).