intel-gfx.lists.freedesktop.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, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm/edid: add drm_edid_get_product_id()
Date: Mon, 8 Apr 2024 21:10:59 +0300	[thread overview]
Message-ID: <ZhQzM2bCCKDr0IsY@intel.com> (raw)
In-Reply-To: <e3e7194ae72190a48916defa77b0a4de2fc87086.1711015462.git.jani.nikula@intel.com>

On Thu, Mar 21, 2024 at 12:05:09PM +0200, Jani Nikula wrote:
> Add a struct drm_edid based function to get the vendor and product ID
> from an EDID. Add a separate struct for defining this part of the EDID,
> with defined byte order for product code and serial number.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 15 +++++++++++++++
>  include/drm/drm_edid.h     | 25 ++++++++++++++++++++-----
>  2 files changed, 35 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index ea77577a3786..626a0e24e66a 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2756,6 +2756,21 @@ const struct drm_edid *drm_edid_read(struct drm_connector *connector)
>  }
>  EXPORT_SYMBOL(drm_edid_read);
>  
> +/**
> + * drm_edid_get_product_id - Get the vendor and product identification
> + * @drm_edid: EDID
> + * @id: Where to place the product id
> + */
> +void drm_edid_get_product_id(const struct drm_edid *drm_edid,
> +			     struct drm_edid_product_id *id)
> +{
> +	if (drm_edid && drm_edid->edid && drm_edid->size >= EDID_LENGTH)
> +		memcpy(id, &drm_edid->edid->product_id, sizeof(*id));
> +	else
> +		memset(id, 0, sizeof(*id));
> +}
> +EXPORT_SYMBOL(drm_edid_get_product_id);
> +
>  /**
>   * drm_edid_get_panel_id - Get a panel's ID from EDID
>   * @drm_edid: EDID that contains panel ID.
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index 6f65bbf655a1..7911a2f8a672 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -272,14 +272,27 @@ struct detailed_timing {
>  #define DRM_EDID_DSC_MAX_SLICES			0xf
>  #define DRM_EDID_DSC_TOTAL_CHUNK_KBYTES		0x3f
>  
> +struct drm_edid_product_id {
> +	u8 manufacturer_name[2];

__be16?

> +	__le16 product_code;
> +	__le32 serial_number;
> +	u8 week_of_manufacture;
> +	u8 year_of_manufacture;
> +} __packed;
> +
>  struct edid {
>  	u8 header[8];
>  	/* Vendor & product info */
> -	u8 mfg_id[2];
> -	u8 prod_code[2];
> -	u32 serial; /* FIXME: byte order */
> -	u8 mfg_week;
> -	u8 mfg_year;
> +	union {
> +		struct drm_edid_product_id product_id;
> +		struct {
> +			u8 mfg_id[2];
> +			u8 prod_code[2];
> +			u32 serial; /* FIXME: byte order */
> +			u8 mfg_week;
> +			u8 mfg_year;
> +		} __packed;
> +	} __packed;
>  	/* EDID version */
>  	u8 version;
>  	u8 revision;
> @@ -466,6 +479,8 @@ int drm_edid_connector_update(struct drm_connector *connector,
>  			      const struct drm_edid *edid);
>  int drm_edid_connector_add_modes(struct drm_connector *connector);
>  bool drm_edid_is_digital(const struct drm_edid *drm_edid);
> +void drm_edid_get_product_id(const struct drm_edid *drm_edid,
> +			     struct drm_edid_product_id *id);
>  
>  const u8 *drm_find_edid_extension(const struct drm_edid *drm_edid,
>  				  int ext_id, int *ext_index);
> -- 
> 2.39.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-04-08 18:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 10:05 [PATCH 0/4] drm/edid & drm/i915: vendor and product id logging improvements Jani Nikula
2024-03-21 10:05 ` [PATCH 1/4] drm/edid: add drm_edid_get_product_id() Jani Nikula
2024-04-08 18:10   ` Ville Syrjälä [this message]
2024-04-09  7:42     ` Jani Nikula
2024-03-21 10:05 ` [PATCH 2/4] drm/edid: add drm_edid_print_product_id() Jani Nikula
2024-04-08 18:05   ` Ville Syrjälä
2024-04-09  9:41     ` Jani Nikula
2024-03-21 10:05 ` [PATCH 3/4] drm/i915/bios: switch to struct drm_edid and struct drm_edid_product_id Jani Nikula
2024-03-21 10:05 ` [PATCH 4/4] drm/i915/bios: return drm_edid_product_id from get_lvds_pnp_id() Jani Nikula
2024-03-21 11:03 ` ✗ Fi.CI.SPARSE: warning for drm/edid & drm/i915: vendor and product id logging improvements Patchwork
2024-03-21 11:16 ` ✓ Fi.CI.BAT: success " Patchwork
2024-03-22  2:27 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-04-02  8:49 ` [PATCH 0/4] " Jani Nikula
2024-04-08 12:34   ` Melissa Wen
2024-04-08 13:05     ` Jani Nikula
2024-04-08 13:30       ` Melissa Wen
2024-04-08 13:37         ` 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=ZhQzM2bCCKDr0IsY@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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;
as well as URLs for NNTP newsgroup(s).