[PATCH linux] Fix double accelerometer initialisation
Sascha Silbe
silbe at activitycentral.com
Tue Nov 22 07:13:55 EST 2011
The lis3lv02d driver doesn't support multiple instances of itself, so we need
to make sure we instantiate only the one that's actually present. This also
avoids logging an error message about not being able to initialise the 8-bit
sensor on C1 and above.
Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
---
Tested on B1 only since I don't have a C1. Are there even actual C1s or
just patched-up Bx? I wonder because the wiki page for C1 doesn't exist
yet.
arch/arm/mach-mmp/olpc-xo-1-75.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-mmp/olpc-xo-1-75.c b/arch/arm/mach-mmp/olpc-xo-1-75.c
index 61da181..b322003 100644
--- a/arch/arm/mach-mmp/olpc-xo-1-75.c
+++ b/arch/arm/mach-mmp/olpc-xo-1-75.c
@@ -182,12 +182,15 @@ static struct sram_platdata olpc_vsram_platdata = {
/*
* Accelerometer
*/
-static struct i2c_board_info olpc_xo_1_75_twsi6_info[] = {
+static struct i2c_board_info olpc_xo_1_75_twsi6_b1_info[] = {
[0] = {
.type = "lis3lv02d",
.addr = 0x1d,
},
- [1] = {
+
+};
+static struct i2c_board_info olpc_xo_1_75_twsi6_c1_info[] = {
+ [0] = {
.type = "lis3lv02d",
.addr = 0x19,
},
@@ -528,7 +531,10 @@ static void __init olpc_xo_1_75_init(void)
mmp2_add_twsi(4, NULL, ARRAY_AND_SIZE(olpc_xo_1_75_twsi4_info));
mmp2_add_twsi(2, NULL, ARRAY_AND_SIZE(olpc_xo_1_75_twsi2_info));
mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(olpc_xo_1_75_twsi1_info));
- mmp2_add_twsi(6, NULL, ARRAY_AND_SIZE(olpc_xo_1_75_twsi6_info));
+ if (olpc_board_at_least(olpc_board(0x1c1)))
+ mmp2_add_twsi(6, NULL, ARRAY_AND_SIZE(olpc_xo_1_75_twsi6_c1_info));
+ else
+ mmp2_add_twsi(6, NULL, ARRAY_AND_SIZE(olpc_xo_1_75_twsi6_b1_info));
platform_device_register(&olpc_xo_1_75_ec);
olpc_xo_1_75_enable_gpuclk();
--
1.7.6.3
More information about the Devel
mailing list