Commit 063b472f authored by Russell King's avatar Russell King Committed by Dave Airlie

drm/i2c: tda998x: fix EDID reading on TDA19988 devices

TDA19988 devices need their RAM enabled in order to read EDID
information.  Add support for this.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
Tested-by: default avatarDarren Etheridge <detheridge@ti.com>
Tested-by: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Tested-by: default avatarRussell King <rmk_kernel@arm.linux.org.uk>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent cc6a36f2
...@@ -229,6 +229,8 @@ struct tda998x_priv { ...@@ -229,6 +229,8 @@ struct tda998x_priv {
/* Page 12h: HDCP and OTP */ /* Page 12h: HDCP and OTP */
#define REG_TX3 REG(0x12, 0x9a) /* read/write */ #define REG_TX3 REG(0x12, 0x9a) /* read/write */
#define REG_TX4 REG(0x12, 0x9b) /* read/write */
# define TX4_PD_RAM (1 << 1)
#define REG_TX33 REG(0x12, 0xb8) /* read/write */ #define REG_TX33 REG(0x12, 0xb8) /* read/write */
# define TX33_HDMI (1 << 1) # define TX33_HDMI (1 << 1)
...@@ -673,6 +675,7 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, int blk) ...@@ -673,6 +675,7 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, int blk)
static uint8_t * static uint8_t *
do_get_edid(struct drm_encoder *encoder) do_get_edid(struct drm_encoder *encoder)
{ {
struct tda998x_priv *priv = to_tda998x_priv(encoder);
int j = 0, valid_extensions = 0; int j = 0, valid_extensions = 0;
uint8_t *block, *new; uint8_t *block, *new;
bool print_bad_edid = drm_debug & DRM_UT_KMS; bool print_bad_edid = drm_debug & DRM_UT_KMS;
...@@ -680,6 +683,9 @@ do_get_edid(struct drm_encoder *encoder) ...@@ -680,6 +683,9 @@ do_get_edid(struct drm_encoder *encoder)
if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL) if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
return NULL; return NULL;
if (priv->rev == TDA19988)
reg_clear(encoder, REG_TX4, TX4_PD_RAM);
/* base block fetch */ /* base block fetch */
if (read_edid_block(encoder, block, 0)) if (read_edid_block(encoder, block, 0))
goto fail; goto fail;
...@@ -689,7 +695,7 @@ do_get_edid(struct drm_encoder *encoder) ...@@ -689,7 +695,7 @@ do_get_edid(struct drm_encoder *encoder)
/* if there's no extensions, we're done */ /* if there's no extensions, we're done */
if (block[0x7e] == 0) if (block[0x7e] == 0)
return block; goto done;
new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL); new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
if (!new) if (!new)
...@@ -716,9 +722,15 @@ do_get_edid(struct drm_encoder *encoder) ...@@ -716,9 +722,15 @@ do_get_edid(struct drm_encoder *encoder)
block = new; block = new;
} }
done:
if (priv->rev == TDA19988)
reg_set(encoder, REG_TX4, TX4_PD_RAM);
return block; return block;
fail: fail:
if (priv->rev == TDA19988)
reg_set(encoder, REG_TX4, TX4_PD_RAM);
dev_warn(encoder->dev->dev, "failed to read EDID\n"); dev_warn(encoder->dev->dev, "failed to read EDID\n");
kfree(block); kfree(block);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment