V
3  
Tags
There are no tags for this page.
Attachments
Dobrica Pavlinušić's random unstructured stuff
al3000a

al3000a i2c light sensor

found in Lenovo Thinkpad Tablet



alternative driver, different from one in 2.6 kernel, contains some registar names but not full description of values:

https://github.com/vhda/linux_kernel_TF101/blob/master/drivers/hwmon/al3000a.c

#define AL3000A_REG_CONFIGURATION 0x00
#define AL3000A_REG_TIMING_CONTROL 0x01
#define AL3000A_REG_ALS_CONTROL  0x02
#define AL3000A_REG_INTERRUPT_STATUS 0x03
#define AL3000A_REG_DATA 0x05
#define AL3000A_REG_ALS_WINDOW 0x08

#define AL3000A_MODE_POWER_UP 0
#define AL3000A_MODE_POWER_DOWN 2
#define AL3000A_MODE_RESET 3

#define AL3000A_OPERATION_ACTIVE 0
#define AL3000A_OPERATION_IDLE 3

i2c usage

kernel 2.6 driver: https://github.com/dpavlin/linux/blob/thinktabletopensource-2.6.36/drivers/misc/al3000a.c

# al_init


	//F/W Initial Flow
	//Power Down & Idle
	ret = i2c_smbus_write_byte_data(client, 0x00, 0x0B);

	// Integration Cycle = 4; Integration Time = 100ms;
	// Interrupt trigger when lux detection has changed 4 times
	// at 100ms intervals.
	ret = i2c_smbus_write_byte_data(client, 0x01, 0x11);

	//AL3000A ADC resolution = 64 levels; Low lux threshold = 0
	ret = i2c_smbus_write_byte_data(client, 0x02, 0xA0);

	//ALS Window Loss = 0
	//It isn't covered by shell so no window loss, need to modify at DVT
	ret = i2c_smbus_write_byte_data(client, 0x08, 0x00);


	//Read Data to clear INT Flag
	ret = i2c_smbus_read_i2c_block_data(client, 0x05, 1, &data);


# ls_enable

		//Read Data to clear INT Flag
		i2c_smbus_read_i2c_block_data(client, 0x05, 1, &data);
		//Power Up & Enable ALS
		i2c_smbus_write_byte_data(client, 0x00, 0x00);

# ls_disable

		//Power Down & Idle
		i2c_smbus_write_byte_data(client, 0x00, 0x0B);



re-create in shell

root@tegra20:/home/dpavlin# i2cget -y 0 0x1c 0x05 b
0x00
root@tegra20:/home/dpavlin# i2cset -y 0 0x1c 0x00 0 b
root@tegra20:/home/dpavlin# i2cget -y 0 0x1c 0x05 b
0x10
root@tegra20:/home/dpavlin# i2cget -y 0 0x1c 0x05 b
0x10
root@tegra20:/home/dpavlin# i2cget -y 0 0x1c 0x05 b
0x1f
root@tegra20:/home/dpavlin# i2cget -y 0 0x1c 0x05 b
0x1f
root@tegra20:/home/dpavlin# i2cget -y 0 0x1c 0x05 b
0x10
root@tegra20:/home/dpavlin# i2cget -y 0 0x1c 0x05 b
0x10
root@tegra20:/home/dpavlin# i2cdump -y 0 0x1c
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
02: 00 11 a0 01 4a 01 00 00 00 ff ff ff ff ff ff ff    .???J?..........



 

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

 
 
 
File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

 
 
 
Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.

Tag: 

Suggestions: