linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
To: Samu Onkalo <samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: [PATCH 0/1] BH1770GLC / SFH7770 combined ambient light / proximity sensor
Date: Thu, 15 Apr 2010 12:37:57 +0100	[thread overview]
Message-ID: <4BC6FA95.1070106@cam.ac.uk> (raw)
In-Reply-To: <1271327648-13497-1-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

Hi Samu,

> This patch introduces driver for Rohm BH1770GLC and Osram SFH7770
> combined ambient light and proximity sensor.
> 
> Driver is divided to 3 parts. Core-part contains common functionality for
> both parts of the chips. ALS and PS specific functionalities are
> in separate files.
> 
> ALS part is fully based on threshold interrupts. Driver doesn't provide
> direct control for threshold levels. Instead, based on sensitivity setting,
> threshold levels are updated after every interrupt. This method keeps sensor
> to follow changes in the lightning.
> 
> PS part uses interrupt for high threshold events and delayed work to simulate
> missing low threshold interrupts. This way driver is able to react proximity
> on / off events using only high threshold interrupt. Proximity sensing can
> utilize up to 3 IR leds for movement detection. Driver supports 1-3 leds
> configurations.
> 
> Platform data is used to provide IR led configuration: number of channels and
> absolute maximum operating currents for the leds.
> 
> Chip is kept running only when someone keeps device handles open.
> Otherwise chip is powered down and optionally power supplies are turned off.
> 
> Interfaces:
> Both parts of the driver provides results via separate misc char device.
> 
> sysfs interface:
> als_calib - (RW) calibration coeffient (default is neutral value)
> als_mode  - (R)  returns current chip operational state for ALS
> als_rate  - (RW) ALS side measurement rate in ms
> als_sens  - (RW) sensitivity for changes in lightning level

This ALS stuff feeds in pretty directly to the discussion just started in response
to Alan Cox's post of the isl20920 driver.  Basically we need to try and match
as much of the sysfs interface across these chips as possible.  Obviously this
one is different to the ALS sensors already in kernel in that it doesn't allow
direct reading of the value.  For his driver I suggested

illuminance0_input (not matched here)
illuminance0_calib

(these also happen to match the new IIO spec by amazing coincidence :)

I'll put some related comments in a review of the patch.

  

> ps_calib  - (RW) calibration coeffient
> ps_leds   - (RW) IR led currents in mA
> ps_mode   - (R)  returns current chip operational state for PS
> ps_rate   - (RW) PS side measurement rates (separate rates for below /
> 	         above threshold condition)
> ps_threshold - (RW) threshold level

Likewise with the proximity sensing.  If nothing else, please allow for
a chip with multiple proximity sensors with separate parameters.
> chip_id   - (R)  chip version and revision information


> 
> Tested in top of 2.6.32 kernel. Applies to 2.6.34-RC3.
> 
> Samu Onkalo (1):
>   misc: bh1770glc: Driver for bh1770glc combined als and ps sensor
> 
>  drivers/misc/Kconfig          |   12 +
>  drivers/misc/Makefile         |    3 +
>  drivers/misc/bh1770glc.h      |  169 ++++++++++++
>  drivers/misc/bh1770glc_als.c  |  424 +++++++++++++++++++++++++++++
>  drivers/misc/bh1770glc_core.c |  301 +++++++++++++++++++++
>  drivers/misc/bh1770glc_ps.c   |  585 +++++++++++++++++++++++++++++++++++++++++
>  include/linux/bh1770glc.h     |   39 +++
>  7 files changed, 1533 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/misc/bh1770glc.h
>  create mode 100644 drivers/misc/bh1770glc_als.c
>  create mode 100644 drivers/misc/bh1770glc_core.c
>  create mode 100644 drivers/misc/bh1770glc_ps.c
>  create mode 100644 include/linux/bh1770glc.h
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

      parent reply	other threads:[~2010-04-15 11:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 10:34 [PATCH 0/1] BH1770GLC / SFH7770 combined ambient light / proximity sensor Samu Onkalo
     [not found] ` <1271327648-13497-1-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-04-15 10:34   ` [PATCH 1/1] misc: bh1770glc: Driver for bh1770glc combined als and ps sensor Samu Onkalo
     [not found]     ` <1271327648-13497-2-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-04-15 12:14       ` Jonathan Cameron
     [not found]         ` <4BC70329.5080202-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2010-04-16  6:24           ` Onkalo Samu
2010-04-15 11:26   ` [lm-sensors] [PATCH 0/1] BH1770GLC / SFH7770 combined ambient light / proximity sensor Jean Delvare
     [not found]     ` <20100415132643.415bac9f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-04-15 12:06       ` Alan Cox
2010-04-15 11:37   ` Jonathan Cameron [this message]

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=4BC6FA95.1070106@cam.ac.uk \
    --to=jic23-kwpb1pkirijaa/9udqfwiw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    --cc=samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@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).