Dobrica Pavlinušić's random unstructured stuff
al3000a: Revision 1

al3000a i2c light sensor

alternative driver, different from one in 2.6 kernel:

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

# 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);