Taos TSL2550
From EnneEnneWiki
This driver is obsolete, you can find newer version into the latest vanilla kernel.
Contents |
| If you like TSL2550 Linux driver make a donation with PayPal - it's fast, free and secure! |
This driver implements the support for Linux 2.6.19 and later of Taos TSL2550 ambient light sensor.
Note that this driver has been added to the kernel main line on Thu Jul 12 14:12:30 2007, so the following information may be imprecise.
This manual will show how to compile the driver and how to use the methods it exports into the user space in order to allow a normal process to get ambient light measurement in LUX.
References
The chip's main references are at Taos's site.
The stable driver's source code is available on my server as patch.
Please, note that this driver is derived from a main job, that is the Eurotech's WL1100.
Patching the kernel and compilation
To patch the kernel get the driver patch and use the following command into your kernel source tree:
$ patch -p1 < patch_tsl2550-support patching file drivers/i2c/chips/Kconfig patching file drivers/i2c/chips/Makefile patching file drivers/i2c/chips/tsl2550.c
then reconfigure your system adding the TSL2550 support into I2C subsystem (Miscellaneous I2C Chip support):
<M> Taos TSL2550 ambient light sensor
and then recompile the kernel as usual.
Loading the driver
In order to define the TSL2550 into your system you must add the following code into your platform specific code:
static struct i2c_board_info __initdata wwpc1100_i2c_devices[] = {
...
{
I2C_BOARD_INFO("tsl2550", 0x39),
.type = "tsl2550",
},
...
};
and then call:
i2c_register_board_info(0, wwpc1100_i2c_devices,
ARRAY_SIZE(wwpc1100_i2c_devices));
in order to register the device into I2C bus "0".
Once the driver is loaded, or during the boot time, if the chip is correctly probed, you should see something like that:
tsl2550: TSL2550 I2C support enabled - ver. 1.1.0 tsl2550: Copyright (C) 2007 Rodolfo Giometti <giometti@linux.it>
Using the driver
Once the driver is loaded you can use sysfs support to get device's info or LUX measurements.
# ls /sys/class/i2c-dev/i2c-0/device/0-0039/ bus driver lux name operating_mode power_state subsystem uevent
Into name file there is the driver's name:
# cat /sys/class/i2c-dev/i2c-0/device/0-0039/name tsl2550
while files power_state operating_mode and lux can be used for set the power state (on/off) or the operating mode (standard/extended) and to get the current LUX value:
# cat /sys/class/i2c-dev/i2c-0/device/0-0039/lux1_input 9
| If you like TSL2550 Linux driver make a donation with PayPal - it's fast, free and secure! |
