Skip to contentSkip to conversation

N800 problems with MMC, LM8323 on current linux-omap git head

DISCUSSION Riku Voipio 4 participants 8 messages Jul 22, 2008 – Aug 4, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw
Quoted 7 lines

Subject: [PATCH] input: add more error checks to lm8323 driver

If we can't reach the driver, we stop trying to probe it. Useful when building kernel for n800 and n810.

n800 doesn't have lm8323, so that driver shouldn't probe there.

Hmm. I think it would be better to avoid calling the probe in first place. git diff made the attached patch look more confusing than it actually is. Personally I'd eliminate all ifdefs from those i2c_board_info structs.

Signature · 1 line
"rm -rf" only sounds scary if you don't have backups
Quoted 1 line

From 574835f1532f0be01e0456f98bf13ebb954bc6c3 Mon Sep 17 00:00:00 2001

From: Riku Voipio <[email protected]>
Date: Tue, 22 Jul 2008 00:29:31 +0300
Subject: [PATCH] Separate i2c_board_info for n800 and n810

n800 and n810 have different peripherals, on the second i2c bus (tea5761 on n800 and lm8323 on n810). Thus they need different i2c_board_info as well to avoid probing nonexistent devices.

---
 arch/arm/mach-omap2/board-n800.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/board-n800.c +21 -3
index ae85c2c..95a2727 100644
@@ -654,13 +654,26 @@ static struct i2c_board_info __initdata_or_module n800_i2c_board_info_2[] = {
 		I2C_BOARD_INFO("tea5761", 0x10),
 	},
 #endif
-#ifdef CONFIG_MACH_NOKIA_N810
+	{
+		I2C_BOARD_INFO("tsl2563", 0x29),
+	},
+	{
+		I2C_BOARD_INFO("lp5521", 0x32),
+	},
+};
+
+static struct i2c_board_info __initdata_or_module n810_i2c_board_info_2[] = {
+#if defined (CONFIG_VIDEO_TCM825X) || defined (CONFIG_VIDEO_TCM825X_MODULE)
+	{
+		I2C_BOARD_INFO(TCM825X_NAME, TCM825X_I2C_ADDR),
+		.platform_data = &n800_tcm825x_platform_data,
+	},
+#endif
 	{
 		I2C_BOARD_INFO("lm8323", 0x45),
 		.irq		= OMAP_GPIO_IRQ(109),
 		.platform_data	= &lm8323_pdata,
 	},
-#endif
 	{
 		I2C_BOARD_INFO("tsl2563", 0x29),
 	},
@@ -690,8 +703,13 @@ void __init nokia_n800_common_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 400, n800_i2c_board_info_1,
 			      ARRAY_SIZE(n800_i2c_board_info_1));
-	omap_register_i2c_bus(2, 400, n800_i2c_board_info_2,
+	if (machine_is_nokia_n800())
+		omap_register_i2c_bus(2, 400, n800_i2c_board_info_2,
 			      ARRAY_SIZE(n800_i2c_board_info_2));
+	if (machine_is_nokia_n810())
+		omap_register_i2c_bus(2, 400, n810_i2c_board_info_2,
+			      ARRAY_SIZE(n810_i2c_board_info_2));
+		
 	mipid_dev_init();
 	blizzard_dev_init();
 }
Signature · 1 line
1.5.5.4
#1 lore raw
Quoted 4 lines · Riku Voipio

Hmm. I think it would be better to avoid calling the probe in first place. git diff made the attached patch look more confusing than it actually is. Personally I'd eliminate all ifdefs from those i2c_board_info structs.

I did the same thing before, but then we're gonna start adding several i2c_board_info for different hw. I mean, we should just reuse the code and the driver should know when the device is not present and stop probing without any problems to the rest of the system.

Signature · 5 lines
Best Regards,

Felipe Balbi
http://blog.felipebalbi.com
[email protected]
#2 lore raw
Quoted 7 lines · Felipe Balbi
Quoted 4 lines · Riku Voipio

Hmm. I think it would be better to avoid calling the probe in first place. git diff made the attached patch look more confusing than it actually is. Personally I'd eliminate all ifdefs from those i2c_board_info structs.

Quoted 5 lines

I did the same thing before, but then we're gonna start adding several i2c_board_info for different hw. I mean, we should just reuse the code and the driver should know when the device is not present and stop probing without any problems to the rest of the system.

If the different hw has different devices on the i2c bus, then different i2c_board_info struct should be provided. IIRC i2c_board_info is expected to provide a accurate picture of what i2c devices is connected to the bus. This has been used as a argument to remove detection code from .probe functions.

To all the confused i2c list readers, the topic is about should we split n800_i2c_board_info_2 [0] to n800 and n810 specific structs[1] or make the lm8323 configure to err out earlier[2].

[0] http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=blob;f=arch/arm/mach-omap2/board-n800.c;h=ae85c2c60534820856c8bb0e019be29f2375470b;hb=HEAD#l645
[1] http://article.gmane.org/gmane.linux.ports.arm.omap/9562
[2] http://article.gmane.org/gmane.linux.ports.arm.omap/9522

"rm -rf" only sounds scary if you don't have backups

#3 lore raw
Quoted 20 lines · Riku Voipio
Quoted 7 lines · Felipe Balbi
Quoted 4 lines · Riku Voipio

Hmm. I think it would be better to avoid calling the probe in first place. git diff made the attached patch look more confusing than it actually is. Personally I'd eliminate all ifdefs from those i2c_board_info structs.

Quoted 5 lines

I did the same thing before, but then we're gonna start adding several i2c_board_info for different hw. I mean, we should just reuse the code and the driver should know when the device is not present and stop probing without any problems to the rest of the system.

If the different hw has different devices on the i2c bus, then different i2c_board_info struct should be provided. IIRC i2c_board_info is expected to provide a accurate picture of what i2c devices is connected to the bus. This has been used as a argument to remove detection code from .probe functions.

Quoted 3 lines

To all the confused i2c list readers, the topic is about should we split n800_i2c_board_info_2 [0] to n800 and n810 specific structs[1] or make the lm8323 configure to err out earlier[2].

Split them into a common and then machine specfic structures, you are allowed to register more than one board per bus.

Quoted 11 lines

[0] http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=blob;f=arch/arm/mach-omap2/board-n800.c;h=ae85c2c60534820856c8bb0e019be29f2375470b;hb=HEAD#l645
[1] http://article.gmane.org/gmane.linux.ports.arm.omap/9562
[2] http://article.gmane.org/gmane.linux.ports.arm.omap/9522

"rm -rf" only sounds scary if you don't have backups

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#4 lore raw

Hi,

Quoted 2 lines · Ben Dooks

Split them into a common and then machine specfic structures, you are allowed to register more than one board per bus.

Good to know :-)

Riku, could you update your patch then ?

but it anyways doesn't annul the need of a better error handling in lm8323. I think both patches will need to be applied :-)

Signature · 5 lines
Best Regards,

Felipe Balbi
http://blog.felipebalbi.com
[email protected]
#5 lore raw
Quoted 5 lines · Felipe Balbi
Quoted 2 lines · Ben Dooks

Split them into a common and then machine specfic structures, you are allowed to register more than one board per bus.

Good to know :-)

Indeed - compared to my previous version, this one makes the boardfile even smaller:

   text    data     bss     dec     hex filename
   2362    1552       4    3918     f4e old/arch/arm/mach-omap2/board-n800.o
   2354    1456       4    3814     ee6 new/arch/arm/mach-omap2/board-n800.o
Quoted 1 line

Riku, could you update your patch then ?

tested and attached.

Quoted 2 lines

but it anyways doesn't annul the need of a better error handling in lm8323. I think both patches will need to be applied :-)

true.

Signature · 1 line
"rm -rf" only sounds scary if you don't have backups
Quoted 1 line

From 1e9d7271505e85c99fe9b46653569ff6216e07b3 Mon Sep 17 00:00:00 2001

From: Riku Voipio <[email protected]>
Date: Tue, 22 Jul 2008 12:29:31 +0300
Subject: [PATCH] Separate i2c_board_info for n800 and n810

n800 and n810 have different peripherals on the second i2c bus (tea5761 on n800 and lm8323 on n810). Split the i2c_board_info to common and hw specific to avoid probing nonexistent devices.

---
 arch/arm/mach-omap2/board-n800.c |   36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/board-n800.c +22 -14
index ae85c2c..e156dbd 100644
@@ -642,30 +642,31 @@ static struct i2c_board_info __initdata n800_i2c_board_info_1[] = {
 
 extern struct tcm825x_platform_data n800_tcm825x_platform_data;
 
-static struct i2c_board_info __initdata_or_module n800_i2c_board_info_2[] = {
-#if defined (CONFIG_VIDEO_TCM825X) || defined (CONFIG_VIDEO_TCM825X_MODULE)
+static struct i2c_board_info __initdata_or_module n8x0_i2c_board_info_2[] = {
 	{
 		I2C_BOARD_INFO(TCM825X_NAME, TCM825X_I2C_ADDR),
 		.platform_data = &n800_tcm825x_platform_data,
 	},
-#endif
-#if defined(CONFIG_RADIO_TEA5761) || defined(CONFIG_RADIO_TEA5761_MODULE)
 	{
-		I2C_BOARD_INFO("tea5761", 0x10),
+		I2C_BOARD_INFO("tsl2563", 0x29),
 	},
-#endif
-#ifdef CONFIG_MACH_NOKIA_N810
 	{
-		I2C_BOARD_INFO("lm8323", 0x45),
-		.irq		= OMAP_GPIO_IRQ(109),
-		.platform_data	= &lm8323_pdata,
+		I2C_BOARD_INFO("lp5521", 0x32),
 	},
-#endif
+};
+
+
+static struct i2c_board_info __initdata_or_module n800_i2c_board_info_2[] = {
 	{
-		I2C_BOARD_INFO("tsl2563", 0x29),
+		I2C_BOARD_INFO("tea5761", 0x10),
 	},
+};
+
+static struct i2c_board_info __initdata_or_module n810_i2c_board_info_2[] = {
 	{
-		I2C_BOARD_INFO("lp5521", 0x32),
+		I2C_BOARD_INFO("lm8323", 0x45),
+		.irq		= OMAP_GPIO_IRQ(109),
+		.platform_data	= &lm8323_pdata,
 	},
 };
 
@@ -690,8 +691,15 @@ void __init nokia_n800_common_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 400, n800_i2c_board_info_1,
 			      ARRAY_SIZE(n800_i2c_board_info_1));
-	omap_register_i2c_bus(2, 400, n800_i2c_board_info_2,
+	omap_register_i2c_bus(2, 400, n8x0_i2c_board_info_2,
 			      ARRAY_SIZE(n800_i2c_board_info_2));
+	if (machine_is_nokia_n800())
+		i2c_register_board_info(2, n800_i2c_board_info_2,
+			ARRAY_SIZE(n800_i2c_board_info_2));
+	if (machine_is_nokia_n810())
+	    i2c_register_board_info(2, n810_i2c_board_info_2,
+			ARRAY_SIZE(n810_i2c_board_info_2));
+		
 	mipid_dev_init();
 	blizzard_dev_init();
 }
Signature · 1 line
1.5.5.4
Acked-by
#6 lore raw
Quoted 8 lines · Riku Voipio

Indeed - compared to my previous version, this one makes the boardfile even smaller:

   text    data     bss     dec     hex filename
   2362    1552       4    3918     f4e

old/arch/arm/mach-omap2/board-n800.o
2354 1456 4 3814 ee6
new/arch/arm/mach-omap2/board-n800.o

Cool :-)

Signature · 5 lines
Best Regards,

Felipe Balbi
http://blog.felipebalbi.com
[email protected]
maintainer
#7 lore raw
Quoted 6 lines · Felipe Balbi
Quoted 3 lines · Riku Voipio

Indeed - compared to my previous version, this one makes the boardfile even smaller:

Quoted 7 lines
Quoted 5 lines
   text    data     bss     dec     hex filename
   2362    1552       4    3918     f4e

old/arch/arm/mach-omap2/board-n800.o
2354 1456 4 3814 ee6
new/arch/arm/mach-omap2/board-n800.o

Cool :-)

Pushing to linux-omap tree.

Tony

Quoted 13 lines
Signature · 10 lines
Best Regards,

Felipe Balbi
http://blog.felipebalbi.com
[email protected]

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html