* [PATCH v2 21/22] drm/edid: Extract drm_edid_decode_mfg_id()
[not found] <20220405173410.11436-1-ville.syrjala@linux.intel.com>
@ 2022-04-05 17:34 ` Ville Syrjala
2022-04-07 18:02 ` [Intel-gfx] " Jani Nikula
0 siblings, 1 reply; 2+ messages in thread
From: Ville Syrjala @ 2022-04-05 17:34 UTC (permalink / raw)
To: intel-gfx; +Cc: dri-devel
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Make the PNPID decoding available for other users.
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
include/drm/drm_edid.h | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index b7e170584000..5e9d7fcda8e7 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -508,6 +508,22 @@ static inline u8 drm_eld_get_conn_type(const uint8_t *eld)
return eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_CONN_TYPE_MASK;
}
+/**
+ * drm_edid_decode_mfg_id - Decode the manufacturer ID
+ * @mfg_id: The manufacturer ID
+ * @vend: A 4-byte buffer to store the 3-letter vendor string plus a '\0'
+ * termination
+ */
+static inline const char *drm_edid_decode_mfg_id(u16 mfg_id, char vend[4])
+{
+ vend[0] = '@' + ((mfg_id >> 10) & 0x1f);
+ vend[1] = '@' + ((mfg_id >> 5) & 0x1f);
+ vend[2] = '@' + ((mfg_id >> 0) & 0x1f);
+ vend[3] = '\0';
+
+ return vend;
+}
+
/**
* drm_edid_encode_panel_id - Encode an ID for matching against drm_edid_get_panel_id()
* @vend_chr_0: First character of the vendor string.
@@ -548,10 +564,7 @@ static inline u8 drm_eld_get_conn_type(const uint8_t *eld)
static inline void drm_edid_decode_panel_id(u32 panel_id, char vend[4], u16 *product_id)
{
*product_id = (u16)(panel_id & 0xffff);
- vend[0] = '@' + ((panel_id >> 26) & 0x1f);
- vend[1] = '@' + ((panel_id >> 21) & 0x1f);
- vend[2] = '@' + ((panel_id >> 16) & 0x1f);
- vend[3] = '\0';
+ drm_edid_decode_mfg_id(panel_id >> 16, vend);
}
bool drm_probe_ddc(struct i2c_adapter *adapter);
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Intel-gfx] [PATCH v2 21/22] drm/edid: Extract drm_edid_decode_mfg_id()
2022-04-05 17:34 ` [PATCH v2 21/22] drm/edid: Extract drm_edid_decode_mfg_id() Ville Syrjala
@ 2022-04-07 18:02 ` Jani Nikula
0 siblings, 0 replies; 2+ messages in thread
From: Jani Nikula @ 2022-04-07 18:02 UTC (permalink / raw)
To: Ville Syrjala, intel-gfx; +Cc: dri-devel
On Tue, 05 Apr 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Make the PNPID decoding available for other users.
>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> include/drm/drm_edid.h | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index b7e170584000..5e9d7fcda8e7 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -508,6 +508,22 @@ static inline u8 drm_eld_get_conn_type(const uint8_t *eld)
> return eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_CONN_TYPE_MASK;
> }
>
> +/**
> + * drm_edid_decode_mfg_id - Decode the manufacturer ID
> + * @mfg_id: The manufacturer ID
> + * @vend: A 4-byte buffer to store the 3-letter vendor string plus a '\0'
> + * termination
> + */
> +static inline const char *drm_edid_decode_mfg_id(u16 mfg_id, char vend[4])
> +{
> + vend[0] = '@' + ((mfg_id >> 10) & 0x1f);
> + vend[1] = '@' + ((mfg_id >> 5) & 0x1f);
> + vend[2] = '@' + ((mfg_id >> 0) & 0x1f);
> + vend[3] = '\0';
> +
> + return vend;
> +}
> +
> /**
> * drm_edid_encode_panel_id - Encode an ID for matching against drm_edid_get_panel_id()
> * @vend_chr_0: First character of the vendor string.
> @@ -548,10 +564,7 @@ static inline u8 drm_eld_get_conn_type(const uint8_t *eld)
> static inline void drm_edid_decode_panel_id(u32 panel_id, char vend[4], u16 *product_id)
> {
> *product_id = (u16)(panel_id & 0xffff);
> - vend[0] = '@' + ((panel_id >> 26) & 0x1f);
> - vend[1] = '@' + ((panel_id >> 21) & 0x1f);
> - vend[2] = '@' + ((panel_id >> 16) & 0x1f);
> - vend[3] = '\0';
> + drm_edid_decode_mfg_id(panel_id >> 16, vend);
> }
>
> bool drm_probe_ddc(struct i2c_adapter *adapter);
--
Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-07 18:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20220405173410.11436-1-ville.syrjala@linux.intel.com>
2022-04-05 17:34 ` [PATCH v2 21/22] drm/edid: Extract drm_edid_decode_mfg_id() Ville Syrjala
2022-04-07 18:02 ` [Intel-gfx] " Jani Nikula
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).