From patchwork Thu Nov 22 10:23:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Egbert Eich X-Patchwork-Id: 1783461 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 15810DF24C for ; Thu, 22 Nov 2012 11:12:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0455AE64BB for ; Thu, 22 Nov 2012 03:12:12 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by gabe.freedesktop.org (Postfix) with ESMTP id 27E93E63F0 for ; Thu, 22 Nov 2012 02:56:12 -0800 (PST) Received: from debian (p5DCF0728.dip0.t-ipconnect.de [93.207.7.40]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MLC4r-1TblM138zp-000Qf6; Thu, 22 Nov 2012 11:51:05 +0100 Received: from sles11.fritz.box (sles11.fritz.box [192.168.178.22]) by debian (Postfix) with ESMTP id 4DE533F354; Thu, 22 Nov 2012 11:51:03 +0100 (CET) From: Egbert Eich To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 10/18] DRM/KMS/EDID: Feed 'firmware' supplied EDID blocks whenever the EDID is read (v2) Date: Thu, 22 Nov 2012 05:23:00 -0500 Message-Id: <1353579788-30637-11-git-send-email-eich@suse.com> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1353579788-30637-1-git-send-email-eich@suse.com> References: <1353356598-10634-1-git-send-email-eich@suse.de> <1353579788-30637-1-git-send-email-eich@suse.com> X-Provags-ID: V02:K0:etVfKPwSx4YVwWvYcKgChBtXW33DvKBRivXsswYS7Yh A/YugRW/wfCai5Pz8UjvPCgaFG9tYIC4E6U+4B6pbKhSjKBuHQ uN5n/9ybL0Mwaww3l3ar/yqeiFui1myDnvltSrxvazHC5HQMkp IvPsdKTJsclYeWK3OtqLA1nCKAppFMkUDtx2XW2pabrdOvYAgM BZ+q/nQXGmBVuSGTGtFWcH/D8K1p911/xNJuvHst07gniE8wmw t2/FJZ8nBDAJ0O7uv84WUMElUMgtvlsGSMtiz/6Trt9mlNK06i ovqpjdDfJOVqyqFRAe2y1524fbX1TnxQBtabr9JahfNNu5kBsm 2e+ItZ6Djhl0pVe5wY24= Cc: Egbert Eich , tiwai@suse.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Firmware supplied EDIDs where fed in in drm_helper_probe_single_connector_modes() in place of calling the driver supplied get_modes() function. This has two problems: 1. Drivers don't call drm_get_edid() only from within get_modes(). 2. The get_modes() replacement in drm_load_edid_firmware() provided only the least common denominator of what driver provided get_modes() callbacks do. This patch now supplies a user provided 'firmware' EDID whenever drm_get_edid() is called if one is available. The user supplied EDID is thus used the same way as a display provided one (except for detecting the presence of a device thru EDID). Also it does so not on the helper level any more, the possibility for EDID loading now happens on the DRM KMS core level. v2: Fixed formatting and conflicts due to reordering of commits. Signed-off-by: Egbert Eich --- drivers/gpu/drm/drm_crtc_helper.c | 6 +----- drivers/gpu/drm/drm_edid.c | 7 +++++++ drivers/gpu/drm/drm_edid_load.c | 22 +++++++++------------- include/drm/drm_edid.h | 4 +++- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 1227adf..bc99595 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -119,11 +119,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, goto prune; } -#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE - count = drm_load_edid_firmware(connector); - if (count == 0) -#endif - count = (*connector_funcs->get_modes)(connector); + count = (*connector_funcs->get_modes)(connector); if (count == 0 && connector->status == connector_status_connected) count = drm_add_modes_noedid(connector, 1024, 768); diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 9b298fc..8239c42 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -414,6 +414,13 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) u8 *block, *new; bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS); +#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE + /* check if the user has specified a 'firmware' EDID file */ + block = (u8 *)drm_load_edid_firmware(connector); + if (block) + return block; +#endif + if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL) return NULL; diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c index 38d3943..748f63b 100644 --- a/drivers/gpu/drm/drm_edid_load.c +++ b/drivers/gpu/drm/drm_edid_load.c @@ -114,7 +114,7 @@ static u8 generic_edid[GENERIC_EDIDS][128] = { }, }; -static u8 *edid_load(struct drm_connector *connector, char *name, +static struct edid *edid_load(struct drm_connector *connector, char *name, char *connector_name) { const struct firmware *fw; @@ -222,36 +222,32 @@ out: return edid; } -int drm_load_edid_firmware(struct drm_connector *connector) +struct edid * +drm_load_edid_firmware(struct drm_connector *connector) { char *connector_name = drm_get_connector_name(connector); char *edidname = edid_firmware, *last, *colon; - int ret; struct edid *edid; if (*edidname == '\0') - return 0; + return NULL; colon = strchr(edidname, ':'); if (colon != NULL) { if (strncmp(connector_name, edidname, colon - edidname)) - return 0; + return NULL; edidname = colon + 1; if (*edidname == '\0') - return 0; + return NULL; } last = edidname + strlen(edidname) - 1; if (*last == '\n') *last = '\0'; - edid = (struct edid *) edid_load(connector, edidname, connector_name); + edid = edid_load(connector, edidname, connector_name); if (IS_ERR_OR_NULL(edid)) - return 0; + return NULL; - drm_mode_connector_update_edid_property(connector, edid); - ret = drm_add_edid_modes(connector, edid); - kfree(edid); - - return ret; + return edid; } diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 0cac551..c0a77bd 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -252,6 +252,8 @@ int drm_av_sync_delay(struct drm_connector *connector, struct drm_display_mode *mode); struct drm_connector *drm_select_eld(struct drm_encoder *encoder, struct drm_display_mode *mode); -int drm_load_edid_firmware(struct drm_connector *connector); +#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE +struct edid *drm_load_edid_firmware(struct drm_connector *connector); +#endif #endif /* __DRM_EDID_H__ */