From patchwork Wed Jun 27 14:05:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jassi Brar X-Patchwork-Id: 9651 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1E10823E42 for ; Wed, 27 Jun 2012 14:05:58 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id CBAC9A187CE for ; Wed, 27 Jun 2012 14:05:57 +0000 (UTC) Received: by ghbz12 with SMTP id z12so1018646ghb.11 for ; Wed, 27 Jun 2012 07:05:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=dZ7wUCSH51vkF5i2lAHtKbsgz9TsYPUbR8VQL+NZNO8=; b=W9BynjPsfI4kMHH62hnwTVxevsJm/X38hs36xVxVesAXt2R/djVnAnLTnb3PPMfhq1 ZP7sytNmzEByIsywEs5p7CR93gyrzgQJQqb1SyqppdCZE/mM3itcKSH7DmDxB5eOj3z8 G8ImgbvBcY/mI5qT4uw3AYGMSRfNzaB/rso1YqI4HUEFa9eLkT7NOErh5S4I6/GoQeh7 gLe84LeHiZe5jRz+rs7eLFf/sRIUZoQenxNZau9NbZVCQOdLAHAdF4UuEOhj8WwEaqyI 9gWUSLGR/3/aQCrkL8x1pkN3s04yzKjBygSrRncWEtWj1AGzoaJYqQ0+qyXA4i9HBZdm v8rA== Received: by 10.42.89.72 with SMTP id f8mr11250364icm.33.1340805957005; Wed, 27 Jun 2012 07:05:57 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp13268ibb; Wed, 27 Jun 2012 07:05:56 -0700 (PDT) Received: by 10.68.226.99 with SMTP id rr3mr64224826pbc.48.1340805956289; Wed, 27 Jun 2012 07:05:56 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id qr7si20818374pbc.310.2012.06.27.07.05.56 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jun 2012 07:05:56 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of jaswinder.singh@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of jaswinder.singh@linaro.org) smtp.mail=jaswinder.singh@linaro.org Received: by pbbrr4 with SMTP id rr4so1939238pbb.37 for ; Wed, 27 Jun 2012 07:05:56 -0700 (PDT) Received: by 10.68.202.136 with SMTP id ki8mr64021962pbc.65.1340805955970; Wed, 27 Jun 2012 07:05:55 -0700 (PDT) Received: from localhost.localdomain ([122.178.249.255]) by mx.google.com with ESMTPS id rg10sm1231596pbc.54.2012.06.27.07.05.51 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jun 2012 07:05:54 -0700 (PDT) From: jaswinder.singh@linaro.org To: tomi.valkeinen@ti.com, mythripk@ti.com Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, andy.green@linaro.org, n-dechesne@ti.com, patches@linaro.org, Jassi Brar Subject: [PATCH 3/3] OMAPDSS: HDMI: Cache EDID Date: Wed, 27 Jun 2012 19:35:44 +0530 Message-Id: <1340805944-28805-1-git-send-email-jaswinder.singh@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQmkjkPrRn3m7iOl65tGfj18Deua1b/Ok/OhKciU+5dQr6IYQGXBbZ1NSWlWYLg4dj1rVxBx From: Jassi Brar We can easily keep track of latest EDID from the display and hence avoid expensive EDID re-reads over I2C. This could also help some cheapo displays that provide EDID reliably only immediately after asserting HPD and not later. Even with good displays, there is something in OMAPDSS that apparantly messes up DDC occasionally while EDID is being read, giving the "operation stopped when reading edid" error. Signed-off-by: Jassi Brar --- drivers/video/omap2/dss/hdmi.c | 1 + drivers/video/omap2/dss/ti_hdmi.h | 2 ++ drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 0738090..9853621 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -758,6 +758,7 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev) hdmi.ip_data.core_av_offset = HDMI_CORE_AV; hdmi.ip_data.pll_offset = HDMI_PLLCTRL; hdmi.ip_data.phy_offset = HDMI_PHY; + hdmi.ip_data.edid_len = 0; /* Invalidate EDID Cache */ mutex_init(&hdmi.ip_data.lock); hdmi_panel_init(); diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h index cc292b8..4735860 100644 --- a/drivers/video/omap2/dss/ti_hdmi.h +++ b/drivers/video/omap2/dss/ti_hdmi.h @@ -178,6 +178,8 @@ struct hdmi_ip_data { /* ti_hdmi_4xxx_ip private data. These should be in a separate struct */ int hpd_gpio; struct mutex lock; + u8 edid_cached[256]; + unsigned edid_len; }; int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data); void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c index 04acca9..b5c3dc4 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c @@ -243,10 +243,13 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data) hpd = gpio_get_value(ip_data->hpd_gpio); - if (hpd) + if (hpd) { r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON); - else + } else { + /* Invalidate EDID Cache */ + ip_data->edid_len = 0; r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON); + } if (r) { DSSERR("Failed to %s PHY TX power\n", @@ -454,6 +457,11 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, { int r, l; + if (ip_data->edid_len) { + memcpy(edid, ip_data->edid_cached, ip_data->edid_len); + return ip_data->edid_len; + } + if (len < 128) return -EINVAL; @@ -474,6 +482,9 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, l += 128; } + ip_data->edid_len = l; + memcpy(ip_data->edid_cached, edid, l); + return l; }