summaryrefslogtreecommitdiffstats
path: root/target/linux/s3c24xx/patches-2.6.24/1029-hxd8-tsl256x.patch.patch
blob: e230a9be8416dbbfa7b9b511d74be54a363a0e76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
From d238d3347d19a6df97670624bd0712e61b83b666 Mon Sep 17 00:00:00 2001
From: mokopatches <mokopatches@openmoko.org>
Date: Fri, 4 Apr 2008 11:34:17 +0100
Subject: [PATCH] hxd8-tsl256x.patch

---
 drivers/i2c/chips/Kconfig   |   10 ++
 drivers/i2c/chips/Makefile  |    1 +
 drivers/i2c/chips/tsl256x.c |  310 +++++++++++++++++++++++++++++++++++++++++++
 drivers/i2c/chips/tsl256x.h |  154 +++++++++++++++++++++
 include/linux/i2c-id.h      |    1 +
 5 files changed, 476 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/chips/tsl256x.c
 create mode 100644 drivers/i2c/chips/tsl256x.h

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index c0011fc..bf0da3a 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -174,4 +174,14 @@ config MENELAUS
 	  and other features that are often used in portable devices like
 	  cell phones and PDAs.
 
+config SENSORS_TSL256X
+	tristate "Texas TSL256X Ambient Light Sensor"
+	depends on I2C
+	help
+	  If you say yes here you get support for the Texas TSL256X
+	  ambient light sensor chip.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called tsl256x.
+
 endmenu
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index 864e6cf..a4772c7 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_ISP1301_OMAP)	+= isp1301_omap.o
 obj-$(CONFIG_TPS65010)		+= tps65010.o
 obj-$(CONFIG_MENELAUS)		+= menelaus.o
 obj-$(CONFIG_SENSORS_TSL2550)	+= tsl2550.o
+obj-$(CONFIG_SENSORS_TSL256X)	+= tsl256x.o
 
 ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/i2c/chips/tsl256x.c b/drivers/i2c/chips/tsl256x.c
new file mode 100644
index 0000000..455ec5e
--- /dev/null
+++ b/drivers/i2c/chips/tsl256x.c
@@ -0,0 +1,310 @@
+/*
+ * tsl256x.c  --  TSL256x Light Sensor driver
+ *
+ * Copyright 2007 by Fiwin.
+ * Author: Alec Tsai <alec_tsai@fiwin.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This I2C client driver refers to pcf50606.c.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/types.h>
+#include <linux/input.h>
+
+#include "tsl256x.h"
+
+static unsigned short normal_i2c[] = { 0x39, I2C_CLIENT_END };
+/* Magic definition of all other variables and things */
+I2C_CLIENT_INSMOD;
+
+struct tsl256x_data {
+	struct i2c_client	client;
+	struct mutex		lock;
+	struct input_dev	*input_dev;
+};
+
+static struct i2c_driver tsl256x_driver;
+
+/******************************************************************************
+ * Low-Level routines
+ *****************************************************************************/
+static inline int __reg_write(struct tsl256x_data *tsl, u_int8_t reg,
+								u_int8_t val)
+{
+	return i2c_smbus_write_byte_data(&tsl->client, reg, val);
+}
+
+static int reg_write(struct tsl256x_data *tsl, u_int8_t reg, u_int8_t val)
+{
+	int ret;
+
+	mutex_lock(&tsl->lock);
+	ret = __reg_write(tsl, reg, val);
+	mutex_unlock(&tsl->lock);
+
+	return ret;
+}
+
+static inline int32_t __reg_read(struct tsl256x_data *tsl, u_int8_t reg)
+{
+	int32_t ret;
+
+	ret = i2c_smbus_read_byte_data(&tsl->client, reg);
+
+	return ret;
+}
+
+static u_int8_t reg_read(struct tsl256x_data *tsl, u_int8_t reg)
+{
+	int32_t ret;
+
+	mutex_lock(&tsl->lock);
+	ret = __reg_read(tsl, reg);
+	mutex_unlock(&tsl->lock);
+
+	return ret & 0xff;
+}
+
+u_int32_t calculate_lux(u_int32_t iGain, u_int32_t iType, u_int32_t ch0,
+						u_int32_t ch1)
+{
+	u_int32_t channel0 = ch0 * 636 / 10;
+	u_int32_t channel1 = ch1 * 636 / 10;
+	u_int32_t lux_value = 0;
+	u_int32_t ratio = (channel1 * (2^RATIO_SCALE)) / channel0;
+	u_int32_t b = 0, m = 0;
+
+	if (0 == ch0)
+		return 0;
+	else {
+		if (ratio > (13 * (2^RATIO_SCALE) / 10))
+			return 0;
+	}
+
+	switch (iType) {
+		case 0: // T package
+			if ((ratio >= 0) && (ratio <= K1T)) {
+				b = B1T;
+				m = M1T;
+			} else if (ratio <= K2T) {
+				b = B2T;
+				m = M2T;
+			} else if (ratio <= K3T) {
+				b = B3T;
+				m = M3T;
+			} else if (ratio <= K4T) {
+				b = B4T;
+				m = M4T;
+			} else if (ratio <= K5T) {
+				b = B5T;
+				m = M5T;
+			} else if (ratio <= K6T) {
+				b = B6T;
+				m = M6T;
+			} else if (ratio <= K7T) {
+				b = B7T;
+				m = M7T;
+			} else if (ratio > K8T) {
+				b = B8T;
+				m = M8T;
+			}
+		break;
+		case 1:// CS package
+			if ((ratio >= 0) && (ratio <= K1C)) {
+				b = B1C;
+				m = M1C;
+			} else if (ratio <= K2C) {
+				b = B2C;
+				m = M2C;
+			} else if (ratio <= K3C) {
+				b = B3C;
+				m = M3C;
+			} else if (ratio <= K4C) {
+				b = B4C;
+				m = M4C;
+			} else if (ratio <= K5C) {
+				b = B5C;
+				m = M5C;
+			} else if (ratio <= K6C) {
+				b = B6C;
+				m = M6C;
+			} else if (ratio <= K7C) {
+				b = B7C;
+				m = M7C;
+			} else if (ratio > K8C) {
+				b = B8C;
+				m = M8C;
+			}
+		break;
+		default:
+			return 0;
+		break;
+	}
+
+	lux_value = ((channel0 * b) - (channel1 * m)) / 16384;
+	return(lux_value);
+}
+
+static ssize_t tsl256x_show_light_lux(struct device *dev,
+					struct device_attribute *attr, char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct tsl256x_data *tsl = i2c_get_clientdata(client);
+	u_int8_t low_byte_of_ch0 = 0, high_byte_of_ch0 = 0;
+	u_int8_t low_byte_of_ch1 = 0, high_byte_of_ch1 = 0;
+	u_int32_t adc_value_ch0, adc_value_ch1, adc_value;
+
+	low_byte_of_ch0 = reg_read(tsl, TSL256X_REG_DATA0LOW);
+	high_byte_of_ch0 = reg_read(tsl, TSL256X_REG_DATA0HIGH);
+	low_byte_of_ch1 = reg_read(tsl, TSL256X_REG_DATA1LOW);
+	high_byte_of_ch1 = reg_read(tsl, TSL256X_REG_DATA1HIGH);
+
+	adc_value_ch0 = (high_byte_of_ch0 * 256 + low_byte_of_ch0) * 16;
+	adc_value_ch1 = (high_byte_of_ch1 * 256 + low_byte_of_ch1) * 16;
+
+	adc_value = calculate_lux(0, 0, adc_value_ch0, adc_value_ch1);
+	return sprintf(buf, "%d\n", adc_value);
+}
+
+static DEVICE_ATTR(light_lux, S_IRUGO, tsl256x_show_light_lux, NULL);
+
+static int tsl256x_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	struct i2c_client *new_client = NULL;
+	struct tsl256x_data *tsl256x = NULL;
+	u_int8_t id = 0;
+	int res = 0;
+
+	if (!(tsl256x = kzalloc(sizeof(*tsl256x), GFP_KERNEL)))
+		return -ENOMEM;
+
+	mutex_init(&tsl256x->lock);
+	new_client = &tsl256x->client;
+	i2c_set_clientdata(new_client, tsl256x);
+	new_client->addr = address;
+	new_client->adapter = adapter;
+	new_client->driver = &tsl256x_driver;
+	new_client->flags = 0;
+	strlcpy(new_client->name, "tsl256x", I2C_NAME_SIZE);
+
+	/* now we try to detect the chip */
+	/* register with i2c core */
+	res = i2c_attach_client(new_client);
+	if (res) {
+		printk(KERN_DEBUG "[%s]Error: during i2c_attach_client()\n",
+			new_client->name);
+		goto exit_free;
+	} else {
+		printk(KERN_INFO "TSL256X is attached to I2C bus.\n");
+	}
+
+	/* Configure TSL256X. */
+	{
+		/* Power up TSL256X. */
+		reg_write(tsl256x, TSL256X_REG_CONTROL, 0x03);
+
+		/* Check TSL256X ID. */
+		id = reg_read(tsl256x, TSL256X_REG_ID);
+		if (TSL2561_ID == (id & 0xF0)) {
+			/* Configuring the Timing Register.
+				High Gain (16x), integration time of 101ms. */
+			reg_write(tsl256x, TSL256X_REG_TIMING, 0x11);
+		} else {
+			goto exit_free;
+		}
+	}
+
+	res = device_create_file(&new_client->dev, &dev_attr_light_lux);
+	if (res)
+		goto exit_detach;
+
+	return 0;
+
+exit_free:
+	kfree(tsl256x);
+	return res;
+exit_detach:
+	i2c_detach_client(new_client);
+	return res;
+}
+
+static int tsl256x_attach_adapter(struct i2c_adapter *adapter)
+{
+	return i2c_probe(adapter, &addr_data, &tsl256x_detect);
+}
+
+static int tsl256x_detach_client(struct i2c_client *client)
+{
+	struct tsl256x_data *tsl256x = i2c_get_clientdata(client);
+
+	printk(KERN_INFO "Detach TSL256X from I2C bus.\n");
+
+	/* Power down TSL256X. */
+	reg_write(tsl256x, TSL256X_REG_CONTROL, 0x00);
+
+	device_remove_file(&client->dev, &dev_attr_light_lux);
+	kfree(tsl256x);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int tsl256x_suspend(struct device *dev, pm_message_t state)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct tsl256x_data *tsl256x = i2c_get_clientdata(client);
+
+	/* Power down TSL256X. */
+	reg_write(tsl256x, TSL256X_REG_CONTROL, 0x00);
+
+	return 0;
+}
+
+static int tsl256x_resume(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct tsl256x_data *tsl256x = i2c_get_clientdata(client);
+
+	/* Power up TSL256X. */
+	reg_write(tsl256x, TSL256X_REG_CONTROL, 0x03);
+
+	return 0;
+}
+#endif
+
+static struct i2c_driver tsl256x_driver = {
+	.driver = {
+		.name		= "tsl256x",
+		.owner		= THIS_MODULE,
+#ifdef CONFIG_PM
+		.suspend	= tsl256x_suspend,
+		.resume		= tsl256x_resume,
+#endif
+	},
+	.id				= I2C_DRIVERID_TSL256X,
+	.attach_adapter	= tsl256x_attach_adapter,
+	.detach_client	= tsl256x_detach_client,
+};
+
+static int __init tsl256x_init(void)
+{
+	return i2c_add_driver(&tsl256x_driver);
+}
+
+static void __exit tsl256x_exit(void)
+{
+	i2c_del_driver(&tsl256x_driver);
+}
+
+MODULE_AUTHOR("Alec Tsai <alec_tsai@fiwin.com.tw>");
+MODULE_LICENSE("GPL");
+
+module_init(tsl256x_init);
+module_exit(tsl256x_exit);
+
diff --git a/drivers/i2c/chips/tsl256x.h b/drivers/i2c/chips/tsl256x.h
new file mode 100644
index 0000000..88de0c6
--- /dev/null
+++ b/drivers/i2c/chips/tsl256x.h
@@ -0,0 +1,154 @@
+/*
+ * tsl256x.h  --  TSL256x Light Sensor driver
+ *
+ * Copyright 2007 by Fiwin.
+ * Author: Alec Tsai <alec_tsai@fiwin.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * The contents of header file is copied from TSL256x Datasheet.
+ */
+
+#ifndef _TSL256X_H
+#define _TSL256X_H
+
+#define	TSL2560_ID		0x00
+#define	TSL2561_ID		0x10
+
+#define LUX_SCALE		14		/* scale by 2^14 */
+#define RATIO_SCALE		9		/*scale ratio by 2^9 */
+
+/******************************************************************************
+ * Integration time scaling factors
+ *****************************************************************************/
+#define CH_SCALE		10		/* scale channel values by 2^10 */
+#define CHSCALE_TINT0	0x7517	/* 322/11 * 2^CH_SCALE */
+#define CHSCALE_TINT1	0x0fe7	/* 322/81 * 2^CH_SCALE */
+
+/******************************************************************************
+ * T Package coefficients
+ *****************************************************************************/
+/*
+ * For Ch1/Ch0=0.00 to 0.50
+ * Lux/Ch0=0.0304.0.062*((Ch1/Ch0)^1.4)
+ * piecewise approximation
+ * For Ch1/Ch0=0.00 to 0.125:
+ * Lux/Ch0=0.0304.0.0272*(Ch1/Ch0)
+ *
+ * For Ch1/Ch0=0.125 to 0.250:
+ * Lux/Ch0=0.0325.0.0440*(Ch1/Ch0)
+ *
+ * For Ch1/Ch0=0.250 to 0.375:
+ * Lux/Ch0=0.0351.0.0544*(Ch1/Ch0)
+ *
+ * For Ch1/Ch0=0.375 to 0.50:
+ * Lux/Ch0=0.0381.0.0624*(Ch1/Ch0)
+ *
+ * For Ch1/Ch0=0.50 to 0.61:
+ * Lux/Ch0=0.0224.0.031*(Ch1/Ch0)
+ *
+ * For Ch1/Ch0=0.61 to 0.80:
+ * Lux/Ch0=0.0128.0.0153*(Ch1/Ch0)
+ *
+ * For Ch1/Ch0=0.80 to 1.30:
+ * Lux/Ch0=0.00146.0.00112*(Ch1/Ch0)
+ *
+ * For Ch1/Ch0>1.3:
+ * Lux/Ch0=0
+ */
+#define K1T 0x0040 /* 0.125 * 2^RATIO_SCALE */
+#define B1T 0x01f2 /* 0.0304 * 2^LUX_SCALE */
+#define M1T 0x01be /* 0.0272 * 2^LUX_SCALE */
+#define K2T 0x0080 /* 0.250 * 2^RATIO_SCALE */
+#define B2T 0x0214 /* 0.0325 * 2^LUX_SCALE */
+#define M2T 0x02d1 /* 0.0440 * 2^LUX_SCALE */
+#define K3T 0x00c0 /* 0.375 * 2^RATIO_SCALE */
+#define B3T 0x023f /* 0.0351 * 2^LUX_SCALE */
+#define M3T 0x037b /* 0.0544 * 2^LUX_SCALE */
+#define K4T 0x0100 /* 0.50 * 2^RATIO_SCALE */
+#define B4T 0x0270 /* 0.0381 * 2^LUX_SCALE */
+#define M4T 0x03fe /* 0.0624 * 2^LUX_SCALE */
+#define K5T 0x0138 /* 0.61 * 2^RATIO_SCALE */
+#define B5T 0x016f /* 0.0224 * 2^LUX_SCALE */
+#define M5T 0x01fc /* 0.0310 * 2^LUX_SCALE */
+#define K6T 0x019a /* 0.80 * 2^RATIO_SCALE */
+#define B6T 0x00d2 /* 0.0128 * 2^LUX_SCALE */
+#define M6T 0x00fb /* 0.0153 * 2^LUX_SCALE */
+#define K7T 0x029a /* 1.3 * 2^RATIO_SCALE */
+#define B7T 0x0018 /* 0.00146 * 2^LUX_SCALE */
+#define M7T 0x0012 /* 0.00112 * 2^LUX_SCALE */
+#define K8T 0x029a /* 1.3 * 2^RATIO_SCALE */
+#define B8T 0x0000 /* 0.000 * 2^LUX_SCALE */
+#define M8T 0x0000 /* 0.000 * 2^LUX_SCALE */
+
+/******************************************************************************
+ * CS package coefficients
+ *****************************************************************************/
+/*
+ * For 0 <= Ch1/Ch0 <= 0.52
+ * Lux/Ch0 = 0.0315.0.0593*((Ch1/Ch0)^1.4)
+ * piecewise approximation
+ * For 0 <= Ch1/Ch0 <= 0.13
+ * Lux/Ch0 = 0.0315.0.0262*(Ch1/Ch0)
+ * For 0.13 <= Ch1/Ch0 <= 0.26
+ * Lux/Ch0 = 0.0337.0.0430*(Ch1/Ch0)
+ * For 0.26 <= Ch1/Ch0 <= 0.39
+ * Lux/Ch0 = 0.0363.0.0529*(Ch1/Ch0)
+ * For 0.39 <= Ch1/Ch0 <= 0.52
+ * Lux/Ch0 = 0.0392.0.0605*(Ch1/Ch0)
+ * For 0.52 < Ch1/Ch0 <= 0.65
+ * Lux/Ch0 = 0.0229.0.0291*(Ch1/Ch0)
+ * For 0.65 < Ch1/Ch0 <= 0.80
+ * Lux/Ch0 = 0.00157.0.00180*(Ch1/Ch0)
+ * For 0.80 < Ch1/Ch0 <= 1.30
+ * Lux/Ch0 = 0.00338.0.00260*(Ch1/Ch0)
+ * For Ch1/Ch0 > 1.30
+ * Lux = 0
+ */
+#define K1C 0x0043 /* 0.130 * 2^RATIO_SCALE */
+#define B1C 0x0204 /* 0.0315 * 2^LUX_SCALE */
+#define M1C 0x01ad /* 0.0262 * 2^LUX_SCALE */
+#define K2C 0x0085 /* 0.260 * 2^RATIO_SCALE */
+#define B2C 0x0228 /* 0.0337 * 2^LUX_SCALE */
+#define M2C 0x02c1 /* 0.0430 * 2^LUX_SCALE */
+#define K3C 0x00c8 /* 0.390 * 2^RATIO_SCALE */
+#define B3C 0x0253 /* 0.0363 * 2^LUX_SCALE */
+#define M3C 0x0363 /* 0.0529 * 2^LUX_SCALE */
+#define K4C 0x010a /* 0.520 * 2^RATIO_SCALE */
+#define B4C 0x0282 /* 0.0392 * 2^LUX_SCALE */
+#define M4C 0x03df /* 0.0605 * 2^LUX_SCALE */
+#define K5C 0x014d /* 0.65 * 2^RATIO_SCALE */
+#define B5C 0x0177 /* 0.0229 * 2^LUX_SCALE */
+#define M5C 0x01dd /* 0.0291 * 2^LUX_SCALE */
+#define K6C 0x019a /* 0.80 * 2^RATIO_SCALE */
+#define B6C 0x0101 /* 0.0157 * 2^LUX_SCALE */
+#define M6C 0x0127 /* 0.0180 * 2^LUX_SCALE */
+#define K7C 0x029a /* 1.3 * 2^RATIO_SCALE */
+#define B7C 0x0037 /* 0.00338 * 2^LUX_SCALE */
+#define M7C 0x002b /* 0.00260 * 2^LUX_SCALE */
+#define K8C 0x029a /* 1.3 * 2^RATIO_SCALE */
+#define B8C 0x0000 /* 0.000 * 2^LUX_SCALE */
+#define M8C 0x0000 /* 0.000 * 2^LUX_SCALE */
+
+/* TSL256x registers definition . */
+enum tsl256x_regs {
+	TSL256X_REG_CONTROL			= 0x80,	/* Control of basic functions */
+	TSL256X_REG_TIMING			= 0x81,	/* Integration time/gain control */
+	TSL256X_REG_THRESHLOWLOW	= 0x82,	/* Low byte of low interrupt threshold */
+	TSL256X_REG_THRESHLOWHIGH	= 0x83,	/* High byte of low interrupt threshold */
+	TSL256X_REG_THRESHHIGHLOW	= 0x84,	/* Low byte of high interrupt threshold */
+	TSL256X_REG_THRESHHIGHHIGH	= 0x85,	/* High byte of high interrupt threshold */
+	TSL256X_REG_INTERRUPT		= 0x86,	/* Interrupt control */
+	TSL256X_REG_CRC				= 0x88,	/* Factory test - not a user register */
+	TSL256X_REG_ID				= 0x8A,	/* Part number/ Rev ID */
+	TSL256X_REG_DATA0LOW		= 0x8C,	/* Low byte of ADC channel 0 */
+	TSL256X_REG_DATA0HIGH		= 0x8D,	/* High byte of ADC channel 0 */
+	TSL256X_REG_DATA1LOW		= 0x8E,	/* Low byte of ADC channel 1 */
+	TSL256X_REG_DATA1HIGH		= 0x8F,	/* High byte of ADC channel 1 */
+	__NUM_TSL256X_REGS
+};
+
+#endif /* _TSL256X_H */
+
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 9b8ae78..a089554 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -168,6 +168,7 @@
 #define I2C_DRIVERID_W83L785TS 1047
 #define I2C_DRIVERID_OV7670 1048	/* Omnivision 7670 camera */
 #define I2C_DRIVERID_PCF50606 1049
+#define I2C_DRIVERID_TSL256X 1050
 
 /*
  * ---- Adapter types ----------------------------------------------------
-- 
1.5.6.5