diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-08-14 15:43:26 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-08-18 19:10:00 -0400 |
commit | 063b472fbb44ac562797a630ac3516720f588140 (patch) | |
tree | 0f6c6e05aba1765af91b80283568dd1fa60584a0 /drivers/gpu/drm/i2c | |
parent | cc6a36f2fe06b28c7ea049e6c45622c98358bc00 (diff) |
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: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Tested-by: Darren Etheridge <detheridge@ti.com>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Tested-by: Russell King <rmk_kernel@arm.linux.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/i2c')
-rw-r--r-- | drivers/gpu/drm/i2c/tda998x_drv.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index e68b58a1aaf9..d71c408916e4 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c | |||
@@ -229,6 +229,8 @@ struct tda998x_priv { | |||
229 | 229 | ||
230 | /* Page 12h: HDCP and OTP */ | 230 | /* Page 12h: HDCP and OTP */ |
231 | #define REG_TX3 REG(0x12, 0x9a) /* read/write */ | 231 | #define REG_TX3 REG(0x12, 0x9a) /* read/write */ |
232 | #define REG_TX4 REG(0x12, 0x9b) /* read/write */ | ||
233 | # define TX4_PD_RAM (1 << 1) | ||
232 | #define REG_TX33 REG(0x12, 0xb8) /* read/write */ | 234 | #define REG_TX33 REG(0x12, 0xb8) /* read/write */ |
233 | # define TX33_HDMI (1 << 1) | 235 | # define TX33_HDMI (1 << 1) |
234 | 236 | ||
@@ -673,6 +675,7 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, int blk) | |||
673 | static uint8_t * | 675 | static uint8_t * |
674 | do_get_edid(struct drm_encoder *encoder) | 676 | do_get_edid(struct drm_encoder *encoder) |
675 | { | 677 | { |
678 | struct tda998x_priv *priv = to_tda998x_priv(encoder); | ||
676 | int j = 0, valid_extensions = 0; | 679 | int j = 0, valid_extensions = 0; |
677 | uint8_t *block, *new; | 680 | uint8_t *block, *new; |
678 | bool print_bad_edid = drm_debug & DRM_UT_KMS; | 681 | bool print_bad_edid = drm_debug & DRM_UT_KMS; |
@@ -680,6 +683,9 @@ do_get_edid(struct drm_encoder *encoder) | |||
680 | if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL) | 683 | if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL) |
681 | return NULL; | 684 | return NULL; |
682 | 685 | ||
686 | if (priv->rev == TDA19988) | ||
687 | reg_clear(encoder, REG_TX4, TX4_PD_RAM); | ||
688 | |||
683 | /* base block fetch */ | 689 | /* base block fetch */ |
684 | if (read_edid_block(encoder, block, 0)) | 690 | if (read_edid_block(encoder, block, 0)) |
685 | goto fail; | 691 | goto fail; |
@@ -689,7 +695,7 @@ do_get_edid(struct drm_encoder *encoder) | |||
689 | 695 | ||
690 | /* if there's no extensions, we're done */ | 696 | /* if there's no extensions, we're done */ |
691 | if (block[0x7e] == 0) | 697 | if (block[0x7e] == 0) |
692 | return block; | 698 | goto done; |
693 | 699 | ||
694 | new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL); | 700 | new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL); |
695 | if (!new) | 701 | if (!new) |
@@ -716,9 +722,15 @@ do_get_edid(struct drm_encoder *encoder) | |||
716 | block = new; | 722 | block = new; |
717 | } | 723 | } |
718 | 724 | ||
725 | done: | ||
726 | if (priv->rev == TDA19988) | ||
727 | reg_set(encoder, REG_TX4, TX4_PD_RAM); | ||
728 | |||
719 | return block; | 729 | return block; |
720 | 730 | ||
721 | fail: | 731 | fail: |
732 | if (priv->rev == TDA19988) | ||
733 | reg_set(encoder, REG_TX4, TX4_PD_RAM); | ||
722 | dev_warn(encoder->dev->dev, "failed to read EDID\n"); | 734 | dev_warn(encoder->dev->dev, "failed to read EDID\n"); |
723 | kfree(block); | 735 | kfree(block); |
724 | return NULL; | 736 | return NULL; |