Skip to contentSkip to conversation

fb_ddc: Allow I2C adapters without SCL read capability

PATCH In review Ondrej Zary 2 participants 3 messages Sep 24, 2015 – Sep 30, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 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.

---
 drivers/video/fbdev/core/fb_ddc.c |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/video/fbdev/core/fb_ddc.c +18 -10
index 94322cc..8bf5f2f 100644
@@ -67,13 +67,17 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
 		msleep(13);
 
 		algo_data->setscl(algo_data->data, 1);
-		for (j = 0; j < 5; j++) {
-			msleep(10);
-			if (algo_data->getscl(algo_data->data))
-				break;
+		if (algo_data->getscl) {
+			for (j = 0; j < 5; j++) {
+				msleep(10);
+				if (algo_data->getscl(algo_data->data))
+					break;
+			}
+			if (j = 5)
+				continue;
+		} else {
+			udelay(algo_data->udelay);
 		}
-		if (j = 5)
-			continue;
 
 		algo_data->setsda(algo_data->data, 0);
 		msleep(15);
@@ -89,10 +93,14 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
 		msleep(15);
 
 		algo_data->setscl(algo_data->data, 1);
-		for (j = 0; j < 10; j++) {
-			msleep(10);
-			if (algo_data->getscl(algo_data->data))
-				break;
+		if (algo_data->getscl) {
+			for (j = 0; j < 10; j++) {
+				msleep(10);
+				if (algo_data->getscl(algo_data->data))
+					break;
+			}
+		} else {
+			udelay(algo_data->udelay);
 		}
 
 		algo_data->setsda(algo_data->data, 1);
Signature · 1 line
Ondrej Zary
#1 lore raw

PATCH v2 2/2 tridentfb: Add DDC support

Add DDC support for Trident cards.

Tested on TGUI9440, TGUI9680, 3DImage 9750, Blade3D 9880 and Blade XP.

---
 drivers/video/fbdev/Kconfig     |    2 +
 drivers/video/fbdev/tridentfb.c |  182 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 179 insertions(+), 5 deletions(-)
drivers/video/fbdev/Kconfig +2 -0
index 8b1d371..5d67226 100644
@@ -1666,6 +1666,8 @@ config FB_TRIDENT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
+	select FB_DDC
+	select FB_MODE_HELPERS
 	---help---
 	  This is the frame buffer device driver for Trident PCI/AGP chipsets.
 	  Supported chipset families are TGUI 9440/96XX, 3DImage, Blade3D
drivers/video/fbdev/tridentfb.c +177 -5

237 lines not on this page · raw message

Signature · 1 line
Ondrej Zary
#2 lore raw
In reply to Ondrej Zary
Quoted 9 lines · Ondrej Zary

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.

---
 drivers/video/fbdev/core/fb_ddc.c |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

Thanks, queued this and the 2/2 patch for 4.4.

Tomi