Title: [7408] trunk/drivers/video: [#5525] drivers/video/bf537-lq035.c build fails in 2.6.31 due to old i2c
Revision
7408
Author
hennerich
Date
2009-09-22 11:35:16 -0400 (Tue, 22 Sep 2009)

Log Message

[#5525] drivers/video/bf537-lq035.c build fails in 2.6.31 due to old i2c
usage

Modified Paths

Diff

Modified: trunk/drivers/video/Kconfig (7407 => 7408)


--- trunk/drivers/video/Kconfig	2009-09-22 13:53:13 UTC (rev 7407)
+++ trunk/drivers/video/Kconfig	2009-09-22 15:35:16 UTC (rev 7408)
@@ -634,16 +634,6 @@
 	  This is the framebuffer device for a SHARP LQ035Q7DB03 TFT LCD
 	  attached to a BF537.
 
-config LQ035_SLAVE_ADDR
-	hex "The slave address of the I2C device (0x58, 0x5A, 0x5C and 0x5E)"
-	depends on FB_BF537_LQ035
-	default 0x58
-	help
-	  This is the slave address of the I2C device on the LQ035 LCD
-	  daughter board. It value could be 0x58, 0x5A, 0x5C and 0x5E.
-	  Please setting the switch S1 properly accroding to the address.
-	  The default is 0x58.
-
 config FB_BFIN_7393
 	tristate "Blackfin ADV7393 Video encoder"
 	depends on FB && BLACKFIN

Modified: trunk/drivers/video/bf537-lq035.c (7407 => 7408)


--- trunk/drivers/video/bf537-lq035.c	2009-09-22 13:53:13 UTC (rev 7407)
+++ trunk/drivers/video/bf537-lq035.c	2009-09-22 15:35:16 UTC (rev 7408)
@@ -72,20 +72,8 @@
 
 /* AD5280 vcomm */
 static unsigned char vcomm_value = 150;
-
-static char ad5280_drv_name[] = "ad5280";
-static struct i2c_driver ad5280_driver;
 static struct i2c_client *ad5280_client;
 
-static unsigned short ignore[]		= { I2C_CLIENT_END };
-static unsigned short normal_addr[] = { CONFIG_LQ035_SLAVE_ADDR>>1, I2C_CLIENT_END };
-
-static struct i2c_client_address_data addr_data = {
-	.normal_i2c			= normal_addr,
-	.probe				= ignore,
-	.ignore				= ignore,
-};
-
 static void set_vcomm(void)
 {
 	int nr;
@@ -97,55 +85,47 @@
 	}
 }
 
-static int ad5280_probe(struct i2c_adapter *adap, int addr, int kind)
+static int __devinit ad5280_probe(struct i2c_client *client,
+					const struct i2c_device_id *id)
 {
-	struct i2c_client *client;
-	int rc;
+	int ret;
+	if (!i2c_check_functionality(client->adapter,
+					I2C_FUNC_SMBUS_BYTE_DATA)) {
+		dev_err(&client->dev, "SMBUS Byte Data not Supported\n");
+		return -EIO;
+	}
 
-	client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
-	if (!client)
-		return -ENOMEM;
-	strncpy(client->name, ad5280_drv_name, I2C_NAME_SIZE);
-	client->addr = addr;
-	client->adapter = adap;
-	client->driver = &ad5280_driver;
-
-	if ((rc = i2c_attach_client(client)) != 0) {
-		kfree(client);
-		pr_err("i2c_attach_client fail: %d\n", rc);
-		return rc;
+	ret = i2c_smbus_write_byte_data(client, 0x00, vcomm_value);
+	if (ret) {
+		dev_err(&client->dev, "write fail: %d\n", ret);
+		return ret;
 	}
 
 	ad5280_client = client;
-	set_vcomm();
+
 	return 0;
 }
 
-static int ad5280_attach(struct i2c_adapter *adap)
+static int __devexit ad5280_remove(struct i2c_client *client)
 {
-	if (adap->algo->functionality)
-		return i2c_probe(adap, &addr_data, ad5280_probe);
-	else
-		return ad5280_probe(adap, CONFIG_LQ035_SLAVE_ADDR>>1, 0);
+	ad5280_client = NULL;
+	return 0;
 }
 
-static int ad5280_detach_client(struct i2c_client *client)
-{
-	int rc;
-	if ((rc = i2c_detach_client(client)) == 0)
-		kfree(i2c_get_clientdata(client));
-	return rc;
-}
+static const struct i2c_device_id ad5280_id[] = {
+	{"bf537-lq035-ad5280", 0},
+	{}
+};
 
+MODULE_DEVICE_TABLE(i2c, ad5280_id);
 
 static struct i2c_driver ad5280_driver = {
-	.id              = 0x65,
-	.attach_adapter  = ad5280_attach,
-	.detach_client   = ad5280_detach_client,
-	.driver		= {
-		.name	= ad5280_drv_name,
-		.owner	= THIS_MODULE,
-	},
+	.driver = {
+		   .name = "bf537-lq035-ad5280",
+		   },
+	.probe = ad5280_probe,
+	.remove = __devexit_p(ad5280_remove),
+	.id_table = ad5280_id,
 };
 
 #ifdef CONFIG_PNAV10
@@ -944,7 +924,6 @@
 static int __init bfin_lq035_driver_init(void)
 {
 	request_module("i2c-bfin-twi");
-
 	return platform_driver_register(&bfin_lq035_driver);
 }
 module_init(bfin_lq035_driver_init);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to