[PATCH 10/20] GTA01: Do I2C device registration in machine setup code

Jonas Bonn jonas.bonn at gmail.com
Wed Oct 1 21:47:22 CEST 2008


I2C devices should be registered with i2c_register_board_info in the machine
setup code.  This allows the devices to be auto-probed when the requred driver
is loaded.

Signed-off-by: Jonas Bonn <jonas.bonn at gmail.com>
---
 arch/arm/mach-s3c2410/mach-gta01.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c
index 567737a..e0df70e 100644
--- a/arch/arm/mach-s3c2410/mach-gta01.c
+++ b/arch/arm/mach-s3c2410/mach-gta01.c
@@ -32,6 +32,7 @@
 #include <linux/init.h>
 #include <linux/workqueue.h>
 #include <linux/platform_device.h>
+#include <linux/i2c.h>
 #include <linux/serial_core.h>
 #include <asm/arch/ts.h>
 #include <linux/spi/spi.h>
@@ -361,6 +362,14 @@ static struct s3c2410fb_mach_info gta01_lcd_cfg __initdata = {
 	.lpcsel		= ((0xCE6) & ~7) | 1<<4,
 };
 
+static struct i2c_board_info gta01_i2c_devs[] __initdata = {
+	{
+		I2C_BOARD_INFO("wm8753", 0x1a)
+	}, {
+		I2C_BOARD_INFO("neo1973_lm4857", 0x7c) 
+	}
+};
+
 static struct platform_device *gta01_devices[] __initdata = {
 	&s3c_device_usb,
 	&s3c_device_lcd,
@@ -734,6 +743,9 @@ static void __init gta01_machine_init(void)
 
 	platform_add_devices(gta01_devices, ARRAY_SIZE(gta01_devices));
 
+	i2c_register_board_info(0, gta01_i2c_devs, 
+		ARRAY_SIZE(gta01_i2c_devs));
+
 	s3c2410_pm_init();
 
 	set_irq_type(GTA01_IRQ_MODEM, IRQ_TYPE_EDGE_RISING);
-- 
1.5.4.3




More information about the openmoko-kernel mailing list