video: tegra: edid: Fix corrupted header
Animesh Kishore [Tue, 29 Sep 2015 08:42:33 +0000 (13:42 +0530)]
Fix base block header if corrupted.

Bug 200131561

Change-Id: Ic87fe0a466454502ea721676b746c77a4bdeba99
Signed-off-by: Animesh Kishore <ankishore@nvidia.com>
Reviewed-on: http://git-master/r/806557
(cherry picked from commit a2109be0cb0a9674a812f59d7a4f4cc92977c731)
Reviewed-on: http://git-master/r/818188
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mitch Luban <mluban@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/video/tegra/dc/edid.c
drivers/video/tegra/dc/edid.h

index 832a675..2ab67fb 100644 (file)
@@ -174,6 +174,14 @@ int tegra_edid_read_block(struct tegra_edid *edid, int block, u8 *data)
                if (status != msg_len)
                        return -EIO;
 
+               /* fix base block header if corrupted */
+               if (!block) {
+                       for (i = 0; i < EDID_BASE_HEADER_SIZE; i++) {
+                               if (data[i] != edid_base_header[i])
+                                       data[i] = edid_base_header[i];
+                       }
+               }
+
                for (i = 0; i < 128; i++)
                        checksum += data[i];
                if (checksum != 0) {
index ff677e5..4c01496 100644 (file)
@@ -75,6 +75,11 @@ enum {
 
 struct tegra_edid_pvt;
 
+#define EDID_BASE_HEADER_SIZE 8
+static const unsigned char edid_base_header[EDID_BASE_HEADER_SIZE] = {
+       0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
+};
+
 typedef int (*i2c_transfer_func_t)(struct tegra_dc *dc, struct i2c_msg *msgs,
        int num);