From patchwork Mon Jul 10 11:18:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 9832767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4469C60350 for ; Mon, 10 Jul 2017 11:18:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37558283C3 for ; Mon, 10 Jul 2017 11:18:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C4D5283D8; Mon, 10 Jul 2017 11:18:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E66FF283C3 for ; Mon, 10 Jul 2017 11:18:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8796E89BB0; Mon, 10 Jul 2017 11:16:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 07CCF89AC9; Mon, 10 Jul 2017 11:16:21 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2017 04:16:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,339,1496127600"; d="scan'208";a="106590287" Received: from shashanks-linuxbox.iind.intel.com ([10.223.161.29]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2017 04:16:18 -0700 From: Shashank Sharma To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Mon, 10 Jul 2017 16:48:44 +0530 Message-Id: <1499685528-6926-17-git-send-email-shashank.sharma@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499685528-6926-1-git-send-email-shashank.sharma@intel.com> References: <1499685528-6926-1-git-send-email-shashank.sharma@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 16/20] drm: add function to read vendor OUI X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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. Cc: Ville Syrjälä Cc: Imre Deak Signed-off-by: Shashank Sharma --- 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