summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChethan Krishna N <chethan.krishna@stericsson.com>2011-08-25 13:04:38 +0530
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 16:00:09 +0200
commita38b3ab78080e28487109ceab5d3cb4435bff8ed (patch)
treef6cade89212527a2a01cb75a3a6bf6bdffb11a39
parent83177878674c623a2aefb37c1ceb10ea48116e41 (diff)
lsm303dlh: Detect chip version at run time
Enable both drivers and detect which probe has to be called based on hardware detected at run time. Change-Id: I7020b63c4345a23404cf06418aebaa876c504c1e Signed-off-by: Chethan Krishna N <chethan.krishna@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/27883 Reviewed-by: QATEST Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/board-u5500.c29
-rw-r--r--drivers/hwmon/Kconfig14
-rw-r--r--drivers/hwmon/Makefile3
3 files changed, 26 insertions, 20 deletions
diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c
index 9abc6cf06a7..6d6b5f29242 100644
--- a/arch/arm/mach-ux500/board-u5500.c
+++ b/arch/arm/mach-ux500/board-u5500.c
@@ -78,7 +78,6 @@ static struct av8100_platform_data av8100_plat_data = {
.mclk_freq = 1, /* MCLK_RNG_22_27 */
};
-
/*
* leds LM3530
*/
@@ -166,10 +165,23 @@ static struct i2c_board_info __initdata u5500_i2c1_devices[] = {
},
};
-static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
+static struct i2c_board_info __initdata u5500v1_i2c2_sensor_devices[] = {
+ {
+ /* LSM303DLH Accelerometer */
+ I2C_BOARD_INFO("lsm303dlh_a", 0x19),
+ .platform_data = &lsm303dlh_pdata,
+ },
+ {
+ /* LSM303DLH Magnetometer */
+ I2C_BOARD_INFO("lsm303dlh_m", 0x1E),
+ .platform_data = &lsm303dlh_pdata,
+ },
+};
+
+static struct i2c_board_info __initdata u5500v2_i2c2_sensor_devices[] = {
{
- /* LSM303DLH Accelerometer */
- I2C_BOARD_INFO("lsm303dlh_a", 0x19),
+ /* LSM303DLHC Accelerometer */
+ I2C_BOARD_INFO("lsm303dlhc_a", 0x19),
.platform_data = &lsm303dlh_pdata,
},
{
@@ -177,6 +189,9 @@ static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
I2C_BOARD_INFO("lsm303dlh_m", 0x1E),
.platform_data = &lsm303dlh_pdata,
},
+};
+
+static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
{
/* Backlight */
I2C_BOARD_INFO("lm3530-led", 0x36),
@@ -381,6 +396,12 @@ static void __init u5500_i2c_init(void)
i2c_register_board_info(1, ARRAY_AND_SIZE(u5500_i2c1_devices));
i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices));
+
+ if (cpu_is_u5500v1())
+ i2c_register_board_info(2, ARRAY_AND_SIZE(u5500v1_i2c2_sensor_devices));
+
+ if (cpu_is_u5500v2())
+ i2c_register_board_info(2, ARRAY_AND_SIZE(u5500v2_i2c2_sensor_devices));
}
static void __init u5500_uart_init(void)
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 44a7d028b1f..602ba39286d 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -709,20 +709,6 @@ config SENSORS_LSM303DLH_INPUT_DEVICE
interrupts, need to be enabled only when input device support
is required.
-config SENSORS_LSM303DLHC
- tristate "ST LSM303DLHC 3-axis accelerometer and 3-axis magnetometer"
- depends on I2C
- default n
- help
- This driver provides support for the LSM303DLHC chip which includes a
- 3-axis accelerometer and a 3-axis magnetometer.
-
- This driver can also be built as modules. If so, the module for
- accelerometer will be called lsm303dlhc_a and for magnetometer it will
- be called lsm303dlh_m.
-
- Say Y here if you have a device containing lsm303dlhc chip.
-
config SENSORS_L3G4200D
tristate "ST L3G4200D 3-axis gyroscope"
depends on I2C
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 5e6c62b28bc..4f614d48b37 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -83,8 +83,7 @@ obj-$(CONFIG_SENSORS_LM92) += lm92.o
obj-$(CONFIG_SENSORS_LM93) += lm93.o
obj-$(CONFIG_SENSORS_LM95241) += lm95241.o
obj-$(CONFIG_SENSORS_LTC4151) += ltc4151.o
-obj-$(CONFIG_SENSORS_LSM303DLH) += lsm303dlh_a.o lsm303dlh_m.o
-obj-$(CONFIG_SENSORS_LSM303DLHC) += lsm303dlhc_a.o lsm303dlh_m.o
+obj-$(CONFIG_SENSORS_LSM303DLH) += lsm303dlh_a.o lsm303dlh_m.o lsm303dlhc_a.o
obj-$(CONFIG_SENSORS_L3G4200D) += l3g4200d.o
obj-$(CONFIG_SENSORS_LTC4215) += ltc4215.o
obj-$(CONFIG_SENSORS_LTC4245) += ltc4245.o