From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Cc: archit@ti.com, mythripk@ti.com, Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 06/12] OMAP: DSS2: HDMI: split hdmi_core_ddc_edid
Date: Wed, 31 Aug 2011 13:23:17 +0000 [thread overview]
Message-ID: <1314797003-17638-7-git-send-email-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <1314797003-17638-1-git-send-email-tomi.valkeinen@ti.com>
Split the DDC initialization off from hdmi_core_ddc_edid() into a
separate function hdmi_core_ddc_init().
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/hdmi.c | 67 +++++++++++++++++++++++++++-------------
1 files changed, 45 insertions(+), 22 deletions(-)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index b5aca64..04ce105 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -366,12 +366,8 @@ static void hdmi_phy_off(void)
hdmi_set_phy_pwr(HDMI_PHYPWRCMD_OFF);
}
-static int hdmi_core_ddc_edid(u8 *pedid, int ext)
+static int hdmi_core_ddc_init(void)
{
- u32 i, j;
- char checksum = 0;
- u32 offset = 0;
-
/* Turn on CLK for DDC */
REG_FLD_MOD(HDMI_CORE_AV_DPD, 0x7, 2, 0);
@@ -382,32 +378,55 @@ static int hdmi_core_ddc_edid(u8 *pedid, int ext)
*/
usleep_range(800, 1000);
- if (!ext) {
- /* Clk SCL Devices */
- REG_FLD_MOD(HDMI_CORE_DDC_CMD, 0xA, 3, 0);
+ /* IN_PROG */
+ if (REG_GET(HDMI_CORE_DDC_STATUS, 4, 4) = 1) {
+ /* Abort transaction */
+ REG_FLD_MOD(HDMI_CORE_DDC_CMD, 0xf, 3, 0);
- /* HDMI_CORE_DDC_STATUS_IN_PROG */
+ /* IN_PROG */
if (hdmi_wait_for_bit_change(HDMI_CORE_DDC_STATUS,
- 4, 4, 0) != 0) {
- DSSERR("Failed to program DDC\n");
+ 4, 4, 0) != 0) {
+ DSSERR("Timeout aborting DDC transaction\n");
return -ETIMEDOUT;
}
+ }
- /* Clear FIFO */
- REG_FLD_MOD(HDMI_CORE_DDC_CMD, 0x9, 3, 0);
+ /* Clk SCL Devices */
+ REG_FLD_MOD(HDMI_CORE_DDC_CMD, 0xA, 3, 0);
- /* HDMI_CORE_DDC_STATUS_IN_PROG */
- if (hdmi_wait_for_bit_change(HDMI_CORE_DDC_STATUS,
- 4, 4, 0) != 0) {
- DSSERR("Failed to program DDC\n");
- return -ETIMEDOUT;
- }
+ /* HDMI_CORE_DDC_STATUS_IN_PROG */
+ if (hdmi_wait_for_bit_change(HDMI_CORE_DDC_STATUS, 4, 4, 0) != 0) {
+ DSSERR("Timeout starting SCL clock\n");
+ return -ETIMEDOUT;
+ }
- } else {
- if (ext % 2 != 0)
- offset = 0x80;
+ /* Clear FIFO */
+ REG_FLD_MOD(HDMI_CORE_DDC_CMD, 0x9, 3, 0);
+
+ /* HDMI_CORE_DDC_STATUS_IN_PROG */
+ if (hdmi_wait_for_bit_change(HDMI_CORE_DDC_STATUS, 4, 4, 0) != 0) {
+ DSSERR("Timeout clearing DDC fifo\n");
+ return -ETIMEDOUT;
+ }
+
+ return 0;
+}
+
+static int hdmi_core_ddc_edid(u8 *pedid, int ext)
+{
+ u32 i, j;
+ char checksum = 0;
+ u32 offset = 0;
+
+ /* HDMI_CORE_DDC_STATUS_IN_PROG */
+ if (hdmi_wait_for_bit_change(HDMI_CORE_DDC_STATUS, 4, 4, 0) != 0) {
+ DSSERR("Timeout waiting DDC to be ready\n");
+ return -ETIMEDOUT;
}
+ if (ext % 2 != 0)
+ offset = 0x80;
+
/* Load Segment Address Register */
REG_FLD_MOD(HDMI_CORE_DDC_SEGM, ext/2, 7, 0);
@@ -468,6 +487,10 @@ static int read_edid(u8 *pedid, u16 max_length)
int max_ext_blocks = (max_length / 128) - 1;
int len;
+ r = hdmi_core_ddc_init();
+ if (r)
+ return r;
+
r = hdmi_core_ddc_edid(pedid, 0);
if (r)
return r;
--
1.7.4.1
next prev parent reply other threads:[~2011-08-31 13:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 13:23 [PATCH 00/12] OMAP: DSS2: EDID & detect support Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 01/12] OMAP: DSS2: add read_edid() to omap_dss_driver struct Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 02/12] OMAP: DSS2: add detect() " Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 03/12] OMAP: DSS2: HDMI: make set_timing saner Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 04/12] OMAP: DSS2: HDMI: implement read_edid() Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 05/12] OMAP: DSS2: HDMI: remove edid parsing Tomi Valkeinen
2011-08-31 13:23 ` Tomi Valkeinen [this message]
2011-08-31 13:23 ` [PATCH 07/12] OMAP: DSS2: HDMI: clean up edid reading & fix checksum Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 08/12] OMAP: DSS2: HDMI: remove error prints in check_timings Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 09/12] OMAP: DSS2: HDMI: implement detect() Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 10/12] OMAP: DSS2: Generic-dpi: add detect & read_edid support Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 11/12] OMAP: Panda & Beagle: DVI: Add i2c_bus_num Tomi Valkeinen
2011-08-31 15:00 ` Andy Doan
2011-08-31 18:09 ` Tomi Valkeinen
2011-08-31 13:23 ` [PATCH 12/12] OMAPFB: find best mode from edid Tomi Valkeinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1314797003-17638-7-git-send-email-tomi.valkeinen@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=archit@ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mythripk@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).