From: "Michele De Candia (VT)" <michele.decandia-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
To: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH] TSL2550: extended mode bugfix
Date: Wed, 05 Aug 2009 17:08:05 +0200 [thread overview]
Message-ID: <4A79A055.1010602@valueteam.com> (raw)
Hi all,
according to the TAOS Application Note 'Controlling a Backlight with the
TSL2550 Ambient Light Sensor' (page 14), the actual lux value in
extended mode should be obtained multiplying the calculated lux value by 5.
The following patch should fix the lux calculation in this case.
Regards,
Michele De Candia
--
Signed-off-by: Michele Jr De Candia <michele.decandia-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
drivers/i2c/chips/tsl2550.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c
index b96f302..04b87e0 100644
--- a/drivers/i2c/chips/tsl2550.c
+++ b/drivers/i2c/chips/tsl2550.c
@@ -279,7 +279,7 @@ static ssize_t __tsl2550_show_lux(struct i2c_client
*client, char *buf)
{
u8 ch0, ch1;
int ret;
-
+ struct tsl2550_data *data = i2c_get_clientdata(client);
ret = tsl2550_get_adc_value(client, TSL2550_READ_ADC0);
if (ret < 0)
return ret;
@@ -293,7 +293,10 @@ static ssize_t __tsl2550_show_lux(struct i2c_client
*client, char *buf)
ch1 = ret;
/* Do the job */
- ret = tsl2550_calculate_lux(ch0, ch1);
+ if (!data->operating_mode)
+ ret = tsl2550_calculate_lux(ch0, ch1);
+ else
+ ret = tsl2550_calculate_lux(ch0, ch1) * 5;
if (ret < 0)
return ret;
next reply other threads:[~2009-08-05 15:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-05 15:08 Michele De Candia (VT) [this message]
[not found] ` <4A79A055.1010602-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
2009-08-05 15:14 ` [PATCH] TSL2550: extended mode bugfix Jean Delvare
[not found] ` <20090805171452.592a2bbd-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-08-05 15:22 ` Wolfram Sang
[not found] ` <4A79AAF5.9000702@valueteam.com>
[not found] ` <4A79AAF5.9000702-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
2009-08-05 16:00 ` Wolfram Sang
2009-11-09 16:33 ` Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A79A055.1010602@valueteam.com \
--to=michele.decandia-ezxuzqjkuwwybs5ee8rs3a@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).