]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/video/fb_ddc.c
x86: fix C1E && nx6325 stability problem
[linux-2.6-omap-h63xx.git] / drivers / video / fb_ddc.c
index 3aa6ebf68f178d5bea7b8f3fa34a38f3fd6a5d11..a0df63289b5f83ed9007be92df25c9c5f7065b4c 100644 (file)
 static unsigned char *fb_do_probe_ddc_edid(struct i2c_adapter *adapter)
 {
        unsigned char start = 0x0;
+       unsigned char *buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
        struct i2c_msg msgs[] = {
                {
                        .addr   = DDC_ADDR,
+                       .flags  = 0,
                        .len    = 1,
                        .buf    = &start,
                }, {
                        .addr   = DDC_ADDR,
                        .flags  = I2C_M_RD,
                        .len    = EDID_LENGTH,
+                       .buf    = buf,
                }
        };
-       unsigned char *buf;
 
-       buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
        if (!buf) {
                dev_warn(&adapter->dev, "unable to allocate memory for EDID "
                         "block.\n");
                return NULL;
        }
-       msgs[1].buf = buf;
 
        if (i2c_transfer(adapter, msgs, 2) == 2)
                return buf;
@@ -56,13 +56,12 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
        int i, j;
 
        algo_data->setscl(algo_data->data, 1);
-       algo_data->setscl(algo_data->data, 0);
 
        for (i = 0; i < 3; i++) {
                /* For some old monitors we need the
                 * following process to initialize/stop DDC
                 */
-               algo_data->setsda(algo_data->data, 0);
+               algo_data->setsda(algo_data->data, 1);
                msleep(13);
 
                algo_data->setscl(algo_data->data, 1);
@@ -97,14 +96,15 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
                algo_data->setsda(algo_data->data, 1);
                msleep(15);
                algo_data->setscl(algo_data->data, 0);
+               algo_data->setsda(algo_data->data, 0);
                if (edid)
                        break;
        }
        /* Release the DDC lines when done or the Apple Cinema HD display
         * will switch off
         */
-       algo_data->setsda(algo_data->data, 0);
-       algo_data->setscl(algo_data->data, 0);
+       algo_data->setsda(algo_data->data, 1);
+       algo_data->setscl(algo_data->data, 1);
 
        return edid;
 }