From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Shashank Sharma <shashank.sharma@intel.com>,
intel-gfx@lists.freedesktop.org, ville.syrjala@linux.intel.com,
imre.deak@intel.com
Subject: Re: [PATCH v2 5/7] drm/i915: check LSPCON vendor OUI
Date: Tue, 31 Oct 2017 10:00:56 +0100 [thread overview]
Message-ID: <0c5e59a5-37ff-0844-3d48-de5d1022612c@linux.intel.com> (raw)
In-Reply-To: <1502261186-10417-6-git-send-email-shashank.sharma@intel.com>
Hey,
Op 09-08-17 om 08:46 schreef Shashank Sharma:
> Intel LSPCON chip is provided by 2 vendors:
> - Megachips America (MCA)
> - Parade technologies (Parade tech)
>
> Its important to know the vendor of this chip, as the address to
> write AVI infoframes is different for those two.
>
> This patch reads the vendor OUI signature, and marks into LSPCON
> encoder structure for future usages.
>
> This patch also does a small re-arrangement of the code, by moving
> lspcon mode change into probe function.
>
> V2: Use dp->desc for OUI detection, dont add a helper for this
> (Ville)
>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
> drivers/gpu/drm/i915/intel_drv.h | 6 ++++
> drivers/gpu/drm/i915/intel_lspcon.c | 69 +++++++++++++++++++++++++++++--------
> 2 files changed, 61 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 7eadac0..adab635 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1043,9 +1043,15 @@ struct intel_dp {
> struct intel_dp_compliance compliance;
> };
>
> +enum lspcon_vendor {
> + LSPCON_VENDOR_MCA,
> + LSPCON_VENDOR_PARADE
> +};
> +
> struct intel_lspcon {
> bool active;
> enum drm_lspcon_mode mode;
> + enum lspcon_vendor vendor;
> };
>
> struct intel_digital_port {
> diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c
> index 5abef482..93507c5 100644
> --- a/drivers/gpu/drm/i915/intel_lspcon.c
> +++ b/drivers/gpu/drm/i915/intel_lspcon.c
> @@ -27,6 +27,10 @@
> #include <drm/drm_dp_dual_mode_helper.h>
> #include "intel_drv.h"
>
> +/* LSPCON OUI Vendor ID(signatures) */
> +#define LSPCON_VENDOR_PARADE_OUI 0x001CF8
> +#define LSPCON_VENDOR_MCA_OUI 0x0060AD
> +
> static struct intel_dp *lspcon_to_intel_dp(struct intel_lspcon *lspcon)
> {
> struct intel_digital_port *dig_port =
> @@ -50,6 +54,40 @@ static const char *lspcon_mode_name(enum drm_lspcon_mode mode)
> }
> }
>
> +static bool lspcon_detect_vendor(struct intel_lspcon *lspcon)
> +{
> + struct intel_dp *dp = lspcon_to_intel_dp(lspcon);
> + struct drm_dp_dpcd_ident *ident;
> + u32 vendor_oui;
> +
> + if (drm_dp_read_desc(&dp->aux, &dp->desc, drm_dp_is_branch(dp->dpcd))) {
> + DRM_ERROR("Can't read description\n");
> + return false;
> + }
> +
> + ident = &dp->desc.ident;
> + vendor_oui = (ident->oui[0] << 16) | (ident->oui[1] << 8) |
> + ident->oui[2];
> +
> + switch (vendor_oui) {
> + case LSPCON_VENDOR_MCA_OUI:
> + lspcon->vendor = LSPCON_VENDOR_MCA;
> + DRM_DEBUG_KMS("Vendor: Mega Chips\n");
> + break;
> +
> + case LSPCON_VENDOR_PARADE_OUI:
> + lspcon->vendor = LSPCON_VENDOR_PARADE;
> + DRM_DEBUG_KMS("Vendor: Parade Tech\n");
> + break;
> +
> + default:
> + DRM_ERROR("Invalid/Unknown vendor OUI\n");
MISSING_CASE(vendor_oui) ?
> + return false;
> + }
> +
> + return true;
> +}
> +
> static enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
> {
> enum drm_lspcon_mode current_mode;
> @@ -151,7 +189,18 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)
> /* Yay ... got a LSPCON device */
> DRM_DEBUG_KMS("LSPCON detected\n");
> lspcon->mode = lspcon_wait_mode(lspcon, expected_mode);
> - lspcon->active = true;
> +
> + /*
> + * In the SW state machine, lets Put LSPCON in PCON mode only.
> + * In this way, it will work with both HDMI 1.4 sinks as well as HDMI
> + * 2.0 sinks.
> + */
> + if (lspcon->active && lspcon->mode != DRM_LSPCON_MODE_PCON) {
> + if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0) {
> + DRM_ERROR("LSPCON mode change to PCON failed\n");
> + return false;
> + }
> + }
> return true;
> }
>
> @@ -223,25 +272,17 @@ bool lspcon_init(struct intel_digital_port *intel_dig_port)
> return false;
> }
>
> - /*
> - * In the SW state machine, lets Put LSPCON in PCON mode only.
> - * In this way, it will work with both HDMI 1.4 sinks as well as HDMI
> - * 2.0 sinks.
> - */
> - if (lspcon->active && lspcon->mode != DRM_LSPCON_MODE_PCON) {
> - if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0) {
> - DRM_ERROR("LSPCON mode change to PCON failed\n");
> - return false;
> - }
> - }
> -
> if (!intel_dp_read_dpcd(dp)) {
> DRM_ERROR("LSPCON DPCD read failed\n");
> return false;
> }
>
> - drm_dp_read_desc(&dp->aux, &dp->desc, drm_dp_is_branch(dp->dpcd));
> + if (!lspcon_detect_vendor(lspcon)) {
> + DRM_ERROR("LSPCON vendor detection failed\n");
> + return false;
> + }
Error seems double here, lspcon_detect_vendor should already succeed.
Same for lspcon_probe I think, better to upgrade the DRM_DEBUG_KMS failure there to DRM_ERROR there and remove the one from lspcon_init.
>
> + lspcon->active = true;
> DRM_DEBUG_KMS("Success: LSPCON init\n");
> return true;
> }
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-10-31 9:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 6:46 [PATCH v2 0/7] YCBCR 4:2:0 support for LSPCON Shashank Sharma
2017-08-09 6:46 ` [PATCH v2 1/7] drm/i915: Check has_infoframes when enabling infoframes Shashank Sharma
2017-08-09 6:46 ` [PATCH v2 2/7] drm/i915: Disable infoframes when shutting down DDI HDMI Shashank Sharma
2017-08-09 6:46 ` [PATCH v2 3/7] drm/i915: Move infoframe vfuncs into intel_digital_port Shashank Sharma
2017-08-09 6:46 ` [PATCH v2 4/7] drm/i915: Init infoframe vfuncs for DP encoders as well Shashank Sharma
2017-08-09 6:46 ` [PATCH v2 5/7] drm/i915: check LSPCON vendor OUI Shashank Sharma
2017-10-31 9:00 ` Maarten Lankhorst [this message]
2017-11-02 6:31 ` Sharma, Shashank
2017-08-09 6:46 ` [PATCH v2 6/7] drm/i915: write AVI infoframes for LSPCON Shashank Sharma
2017-11-01 9:27 ` Maarten Lankhorst
2017-11-01 9:48 ` Ville Syrjälä
2017-11-02 6:39 ` Sharma, Shashank
2017-11-02 6:38 ` Sharma, Shashank
2017-08-09 6:46 ` [PATCH v2 7/7] drm/i915: YCBCR 420 support " Shashank Sharma
2017-11-01 9:32 ` Maarten Lankhorst
2017-11-02 6:32 ` Sharma, Shashank
2017-08-09 7:04 ` ✗ Fi.CI.BAT: warning for YCBCR 4:2:0 " Patchwork
2017-08-09 7:29 ` Sharma, Shashank
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=0c5e59a5-37ff-0844-3d48-de5d1022612c@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=shashank.sharma@intel.com \
--cc=ville.syrjala@linux.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