Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fb_ddc: Allow I2C adapters without SCL read capability

i2c-algo-bit allows I2C adapters without SCL read capability to work
but fb_ddc_read fails to work on them.

Fix fb_ddc_read to work with I2C adapters not capable of reading SCL.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Ondrej Zary and committed by
Tomi Valkeinen
ec90631c 3ac58d58

+18 -10
+18 -10
drivers/video/fbdev/core/fb_ddc.c
··· 67 67 msleep(13); 68 68 69 69 algo_data->setscl(algo_data->data, 1); 70 - for (j = 0; j < 5; j++) { 71 - msleep(10); 72 - if (algo_data->getscl(algo_data->data)) 73 - break; 70 + if (algo_data->getscl) { 71 + for (j = 0; j < 5; j++) { 72 + msleep(10); 73 + if (algo_data->getscl(algo_data->data)) 74 + break; 75 + } 76 + if (j == 5) 77 + continue; 78 + } else { 79 + udelay(algo_data->udelay); 74 80 } 75 - if (j == 5) 76 - continue; 77 81 78 82 algo_data->setsda(algo_data->data, 0); 79 83 msleep(15); ··· 93 89 msleep(15); 94 90 95 91 algo_data->setscl(algo_data->data, 1); 96 - for (j = 0; j < 10; j++) { 97 - msleep(10); 98 - if (algo_data->getscl(algo_data->data)) 99 - break; 92 + if (algo_data->getscl) { 93 + for (j = 0; j < 10; j++) { 94 + msleep(10); 95 + if (algo_data->getscl(algo_data->data)) 96 + break; 97 + } 98 + } else { 99 + udelay(algo_data->udelay); 100 100 } 101 101 102 102 algo_data->setsda(algo_data->data, 1);