On Mon, Jul 10, 2017 at 04:48:44PM +0530, Shashank Sharma wrote:
> This patch adds a helper function in DP dual mode layer to
> read the vendor's IEEE OUI signature from a Dual mode adapter.
> This will be used to differentiate between different LSPCON
> vendors, to address their custom programming requirements.

Can't we just read it from DPCD instead?

> 
> Cc: Ville Syrjälä <ville.syrj...@linux.intel.com>
> Cc: Imre Deak <imre.d...@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sha...@intel.com>
> ---
>  drivers/gpu/drm/drm_dp_dual_mode_helper.c | 24 ++++++++++++++++++++++++
>  include/drm/drm_dp_dual_mode_helper.h     |  4 +++-
>  2 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c 
> b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> index 80e62f6..0b890dc 100644
> --- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> @@ -396,6 +396,30 @@ const char *drm_dp_get_dual_mode_type_name(enum 
> drm_dp_dual_mode_type type)
>  EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
>  
>  /**
> + * drm_lspcon_get_vendor_oui: match vendor OUI signature
> + * @adapter: i2c adapter under action
> + * @vendor_id = 3 bytes of vendor OUI signature, LSB=lower byte
> + *
> + * Returns:
> + * Vendor OUI id if got one, 0 if not
> + */
> +uint32_t drm_lspcon_get_vendor_oui(struct i2c_adapter *adapter)
> +{
> +     uint8_t sign[3] = {0, };
> +     uint32_t oui = 0;
> +
> +     if (drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_OUI_OFFSET,
> +                                             sign, 3)) {
> +             DRM_ERROR("Can't identify vendor sign\n");
> +             return 0;
> +     }
> +
> +     oui = (sign[0] << 16) | (sign[1] << 8) | sign[2];
> +     return oui;
> +}
> +EXPORT_SYMBOL(drm_lspcon_get_vendor_oui);
> +
> +/**
>   * drm_lspcon_get_mode: Get LSPCON's current mode of operation by
>   * reading offset (0x80, 0x41)
>   * @adapter: I2C-over-aux adapter
> diff --git a/include/drm/drm_dp_dual_mode_helper.h 
> b/include/drm/drm_dp_dual_mode_helper.h
> index 4c42db8..f81b526 100644
> --- a/include/drm/drm_dp_dual_mode_helper.h
> +++ b/include/drm/drm_dp_dual_mode_helper.h
> @@ -60,7 +60,8 @@
>  /* LSPCON specific registers, defined by MCA */
>  #define DP_DUAL_MODE_LSPCON_MODE_CHANGE              0x40
>  #define DP_DUAL_MODE_LSPCON_CURRENT_MODE             0x41
> -#define  DP_DUAL_MODE_LSPCON_MODE_PCON                       0x1
> +#define DP_DUAL_MODE_LSPCON_MODE_PCON                        0x1
> +#define DP_DUAL_MODE_LSPCON_OUI_OFFSET                       0x11
>  
>  struct i2c_adapter;
>  
> @@ -116,4 +117,5 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
>                       enum drm_lspcon_mode *current_mode);
>  int drm_lspcon_set_mode(struct i2c_adapter *adapter,
>                       enum drm_lspcon_mode reqd_mode);
> +uint32_t drm_lspcon_get_vendor_oui(struct i2c_adapter *adapter);
>  #endif
> -- 
> 2.7.4

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to